Преглед на файлове

Merge branch 'master' into yang

ANG YU преди 4 години
родител
ревизия
cc19b859eb

+ 4 - 10
app/Http/Controllers/TestController.php

@@ -88,15 +88,9 @@ class TestController extends Controller
 
     public function test()
     {
-        $a = DB::select(DB::raw("select payload from failed_jobs where id in (356633,356640)"));
-        $o = [];
-        foreach ($a as $b){
-            $c = json_decode($b->payload)->tags;
-            foreach ($c as $d){
-                $o[] = explode(":",$d)[1];
-            }
-        }
-        $orders = Order::query()->whereIn("id",$o)->get();
-        $this->dispatch(new OrderCreateInstantBill($orders));
+        $a = 1;
+        if ($a>2)dd(1);
+        else if($a==0)dd(2);
+        dd(3);
     }
 }

+ 40 - 35
app/Http/Controllers/WaybillController.php

@@ -1174,34 +1174,7 @@ SQL;
                 $query->where("audit_stage","合并运单");
             })->whereIn("id",$ids)->get();
             if ($waybills->count()==0)$this->error("运单不存在或非合并运单");
-            foreach ($waybills as $waybill){
-                $codes = explode(",",$waybill->wms_bill_number);
-                $bills = explode(",",$waybill->source_bill);
-                $remark = explode(",",$waybill->ordering_remark);
-                if (!$codes)continue;
-                /** @var Collection $destroys */
-                foreach (Waybill::onlyTrashed()->whereIn("wms_bill_number",$codes)->get() as $obj){
-                    unset($codes[array_search($obj->wms_bill_number,$codes)]);
-                    unset($bills[array_search($obj->source_bill,$bills)]);
-                    if (array_search($obj->ordering_remark,$remark)===false)unset($bills[array_search($obj->ordering_remark,$remark)]);
-                    $waybill->charge -= (double)$obj->charge;
-                    $waybill->collect_fee -= (double)$obj->collect_fee;
-                    $waybill->other_fee -= (double)$obj->other_fee;
-                    $waybill->warehouse_weight_other -= (double)$obj->warehouse_weight_other;
-                    $waybill->warehouse_weight -= (double)$obj->warehouse_weight;
-                }
-                Waybill::onlyTrashed()->whereIn("wms_bill_number",explode(",",$waybill->wms_bill_number))->restore();
-                $waybill->merge_owner = null;
-                $waybill->source_bill = implode(",",$bills);
-                $waybill->wms_bill_number = implode(",",$codes);
-                $waybill->ordering_remark = implode(",",$remark);
-                $waybill->update();
-                WaybillAuditLog::query()->create([
-                    'waybill_id'=>$waybill->id,
-                    'audit_stage'=>'拆单返回',
-                    'user_id'=>Auth::id(),
-                ]);
-            }
+            foreach ($waybills as $waybill)$this->split($waybill);
             DB::commit();
         }catch (\Exception $e){
             DB::rollBack();
@@ -1210,6 +1183,38 @@ SQL;
         $this->success(count($ids)==$waybills->count() ? '运单拆单完毕' : '部分运单不符合拆单条件');
     }
 
+    private function split($waybill)
+    {
+        $codes = explode(",",$waybill->wms_bill_number);
+        if (!$codes || count($codes)<2)return;
+        $bills = explode(",",$waybill->source_bill);
+        $remark = explode(",",$waybill->ordering_remark);
+        /** @var Collection $waybills */
+        $waybills = Waybill::onlyTrashed()->whereIn("wms_bill_number",$codes)->get();
+        if (!$waybills->count())return;
+        foreach ($waybills as $obj){
+            unset($codes[array_search($obj->wms_bill_number,$codes)]);
+            unset($bills[array_search($obj->source_bill,$bills)]);
+            if (array_search($obj->ordering_remark,$remark)===false)unset($bills[array_search($obj->ordering_remark,$remark)]);
+            $waybill->charge -= (double)$obj->charge;
+            $waybill->collect_fee -= (double)$obj->collect_fee;
+            $waybill->other_fee -= (double)$obj->other_fee;
+            $waybill->warehouse_weight_other -= (double)$obj->warehouse_weight_other;
+            $waybill->warehouse_weight -= (double)$obj->warehouse_weight;
+        }
+        Waybill::onlyTrashed()->whereIn("wms_bill_number",explode(",",$waybill->wms_bill_number))->restore();
+        $waybill->merge_owner = null;
+        $waybill->source_bill = implode(",",$bills);
+        $waybill->wms_bill_number = implode(",",$codes);
+        $waybill->ordering_remark = implode(",",$remark);
+        $waybill->update();
+        WaybillAuditLog::query()->create([
+            'waybill_id'=>$waybill->id,
+            'audit_stage'=>'拆单返回',
+            'user_id'=>Auth::id(),
+        ]);
+    }
+
     /**
      * 快递面单打印 :暂时支持 德邦
      */
@@ -1266,10 +1271,15 @@ SQL;
     {
         $this->gate("运输管理-编辑");
         if (!\request("logistic"))$this->error("未选择承运商");
-        $waybill = Waybill::query()->where("waybill_number",\request("waybill"))->whereNull("deliver_at")
+        $waybill = Waybill::query()->with("waybillAuditLogs:waybill_id,audit_stage")->where("waybill_number",\request("waybill"))
             ->whereNotIn("status",["已完结","无模型"])->first();
         if (!$waybill)$this->error("运单禁止操作");
-        if ($waybill->deliver_at)$this->error("运单已发货,请勿重复调配");
+        if ($waybill->deliver_at){
+            if ($waybill->waybillAuditLogs->where("audit_stage","单独发货")->count())$this->split($waybill);
+            else if(!$waybill->waybillAuditLogs->where("audit_stage","合单发货")->count())
+                $this->error("运单已发货,请勿重复调配");
+        }
+
         $codes = explode("\n",\request("order"));
         $waybills = Waybill::query()->whereIn("wms_bill_number",$codes)
             ->where("id","!=",$waybill->id)
@@ -1306,11 +1316,6 @@ SQL;
             if ($waybill->status=='未审核')$waybill->status = '已审核';
             $waybill->update();
             Waybill::destroy($destroys);
-            WaybillAuditLog::query()->create([
-                'waybill_id'=>$waybill->id,
-                'audit_stage'=>'合并运单',
-                'user_id'=>Auth::id(),
-            ]);
             WaybillAuditLog::query()->create([
                 'waybill_id'=>$waybill->id,
                 'audit_stage'=>'合单发货',

+ 23 - 7
app/Services/HandInStorageService.php

@@ -39,14 +39,23 @@ class HandInStorageService
     public function getAsnQty($asnno)
     {
         $asnQty=OracleDOCASNDetail::query()
-            ->select('expectedqty','receivedqty')
+            ->select('expectedqty','receivedqty','receivedqty_each','expectedqty_each')
             ->where('asnno',$asnno)
             ->get();
         $expectedqty=0;
         $receivedqty=0;
         foreach ($asnQty as $qty){
-            $expectedqty+=$qty->expectedqty;
-            $receivedqty+=$qty->receivedqty;
+            if ($qty->expectedqty) {
+                $expectedqty+=$qty->expectedqty;
+            }else{
+                $expectedqty+=$qty->expectedqty_each??0;
+            }
+            if ($qty->receivedqty){
+                $receivedqty+=$qty->receivedqty;
+            }else{
+                $receivedqty+=$qty->receivedqty_each??0;
+            }
+
         }
         return (object)array('expectedqty'=>$expectedqty,'receivedqty'=>$receivedqty);
     }
@@ -342,7 +351,7 @@ sql;
     public function getTsk($trackNumber,$barCode): array
     {
         $sql = <<<sql
-select t.*, DOC_ASN_DETAILS.RECEIVEDQTY
+select t.*, DOC_ASN_DETAILS.RECEIVEDQTY,DOC_ASN_DETAILS.ReceivedQty_Each
 from (select TSK_TASKLISTS.CustomerID,
              TSK_TASKLISTS.DOCNO,
              TSK_TASKLISTS.Sku,
@@ -350,6 +359,12 @@ from (select TSK_TASKLISTS.CustomerID,
              TSK_TASKLISTS.PlanToID,
              DOC_ASN_DETAILS.SKUDESCRC,
              TSK_TASKLISTS.DOCLINENO,
+             TSK_TASKLISTS.LOTATT01,
+             TSK_TASKLISTS.LOTATT02,
+             TSK_TASKLISTS.LOTATT03,
+             TSK_TASKLISTS.LOTATT04,
+             TSK_TASKLISTS.LOTATT05,
+             TSK_TASKLISTS.LOTATT08,
              sum(TSK_TASKLISTS.PlanToQty) as qty
       from TSK_TASKLISTS
                LEFT JOIN DOC_ASN_DETAILS ON DOC_ASN_DETAILS.ASNNO = TSK_TASKLISTS.DOCNO AND
@@ -391,8 +406,8 @@ sql;
                                     select SKU from BAS_SKU where ALTERNATE_SKU3='".$barCode."' union
                                     select SKU from BAS_SKU where SKU='".$barCode."' )";
 
-        $sql.=' group by TSK_TASKLISTS.CustomerID, TSK_TASKLISTS.DOCNO, TSK_TASKLISTS.Sku, TSK_TASKLISTS.PlanToLotNum,
-               TSK_TASKLISTS.PlanToID, DOC_ASN_DETAILS.SKUDESCRC, TSK_TASKLISTS.DOCLINENO) t
+        $sql.=' group by TSK_TASKLISTS.CustomerID, TSK_TASKLISTS.DOCNO, TSK_TASKLISTS.Sku, TSK_TASKLISTS.PlanToLotNum, TSK_TASKLISTS.PlanToID, DOC_ASN_DETAILS.SKUDESCRC,
+         TSK_TASKLISTS.DOCLINENO, TSK_TASKLISTS.LOTATT01, TSK_TASKLISTS.LOTATT02, TSK_TASKLISTS.LOTATT03, TSK_TASKLISTS.LOTATT04, TSK_TASKLISTS.LOTATT05, TSK_TASKLISTS.LOTATT08) t
          left join DOC_ASN_DETAILS on t.DOCLINENO = DOC_ASN_DETAILS.ASNLINENO and t.DOCNO = DOC_ASN_DETAILS.ASNNO';
         if ($trackNumber){
             if ($this->checkUserOwnerAuth($trackNumber))$tasks = DB::connection("oracle")->select(DB::raw($sql), [strtoupper($trackNumber)]);
@@ -578,7 +593,8 @@ sql;
                     [$time, $who, $info['asnno']]);
             } elseif ($receiveAsn && (int)$receiveAsn['receivedqty'] + (int)$info['amount'] == (int)$receiveAsn['expectedqty']) {
                 //asn_detail 收货数量+已收数量=预期数量
-                $db->update(DB::raw("UPDATE DOC_ASN_DETAILS SET receivedqty=receivedqty+?,receivedqty_each=receivedqty_each+?,linestatus = '40',
+                $db->update(DB::raw("UPDATE DOC_ASN_DETAILS SET receivedqty=receivedqty+?,receivedqty_each=
+                +?,linestatus = '40',
                 edittime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),receivedtime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),editwho = ?,holdrejectcode='OK',
                 reserve_flag='Y',lotatt01=?,lotatt02=?,lotatt03=?,lotatt04=?,lotatt05=?,lotatt06=?,lotatt07=?,lotatt08=? WHERE asnno = ? and asnlineno = ?"),
                     [(int)$info['amount'], (int)$info['amount'], $time, $time, $who, $invlotatt['lotatt01'], $invlotatt['lotatt02'], $invlotatt['lotatt03'], $invlotatt['lotatt04'],

+ 25 - 2
app/Services/StorageService.php

@@ -495,7 +495,7 @@ sql;
                 $ide,'0',$trid,$who,date("Y-m-d H:i:s"),$who,date("Y-m-d H:i:s"),date("Y-m-d H:i:s"),$who,$task->taskid,$task->taskid_sequence
             ]);
             $task->who = $who;
-            $this->checkAsn($task);
+            $this->checkAsn($task,$who);
             $db->commit();
             return true;
         }catch (\Exception $e){
@@ -504,7 +504,7 @@ sql;
         }
     }
 
-    private function checkAsn($task)
+    private function checkAsn($task,$who)
     {
         $sql = <<<SQL
 SELECT 1 FROM DOC_ASN_DETAILS WHERE ASNNO = ? AND LINESTATUS != '40'
@@ -529,6 +529,29 @@ DELETE FROM INV_LOT_LOC_ID WHERE ((LOTNUM,LOCATIONID,TRACEID) IN
 AND QTY = 0 AND QTYPA = 0
 SQL;
         DB::connection("oracle")->delete(DB::raw($sql),[$task->docno,$task->docno]);
+        $this->createCloseTransaction($task,$who);
+    }
+
+    /**
+     * 建立关单事务
+     */
+    private function createCloseTransaction($task,$who)
+    {
+        $date = date("Y-m-d H:i:s");
+        $sql = <<<sql
+INSERT INTO ACT_TRANSACTION_LOG VALUES(?,'99',?,'*',?,'0','ASN','*','*','*','*','*','0','0','99',TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,
+TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,0,0,0,0,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,'*',null,null,null,'*','*',?,'*','*','0','0','*',
+null,null,null,null,null,null,null,?,?,?,?,null,null,?,null,null)
+sql;
+        list($trid,$max) = $this->getTrNumber();
+        DB::connection("oracle")->insert(DB::raw($sql),[
+            $trid, $task->customerid, $task->docno,
+            $date,$who, $date,$who,
+            $date,$task->customerid, $who,
+            $task->warehouseid, $task->userdefine1,
+            $task->userdefine2, $task->userdefine3,'O'
+        ]);
+        $this->setTrNumber();
     }
     /**
      * put cache rack box to warehousing(将缓存架料箱入库)

+ 1 - 1
resources/views/order/workOrder/index.blade.php

@@ -454,7 +454,7 @@
                     let adder = item.order.consignee_name + ' ' + item.order.consignee_phone + ' '
                         + item.order.province + ' ' + item.order.city + ' ' + item.order.district + ' ' + item.order.address;
                     item.order.packages.forEach(p=>{
-                        message+= p.logistic_number + '  '+ adder + ' ——描述 '+itemremark+'\n';
+                        message+= p.logistic_number + '  '+ adder + ' ——描述 '+item.remark+'\n';
                     });
                     return message;
                 },

+ 15 - 1
resources/views/store/handInStorage/putaway.blade.php

@@ -76,8 +76,22 @@
                                         <span class="text-right float-right" v-show="info.barCode">选中:<input type="checkbox" :id="'task_'+i"
                                                                                        @click="checked($event,task)"></span>
                                         <span><span class="text-lowercase h5">待上架/总量:</span><span
-                                                class="text-lowercase text-info font-weight-bold h5">@{{ task.qty}}/@{{ task.receivedqty }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
+                                                class="text-lowercase text-info font-weight-bold h5">@{{ task.qty}}/@{{ task.receivedqty?task.receivedqty:task.receivedqty_each }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
                                         <span><span class="h5">容器号:</span><span class="h5">@{{ task.plantoid }} </span></span>
+
+                                        <span v-if="task.lotatt01"><span class="text-black h5">生产日期:</span><span
+                                                class="text-black font-weight-bold h5">@{{ task.lotatt01 }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
+                                        <span v-if="task.lotatt02"><span class="text-black h5">失效日期:</span><span
+                                                class="text-black font-weight-bold h5">@{{ task.lotatt02 }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
+                                        <span v-if="task.lotatt03"><span class="text-black h5">入库日期:</span><span
+                                                class="text-black font-weight-bold h5">@{{ task.lotatt03 }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
+                                        <span v-if="task.lotatt04"><span class="text-black h5">批号:</span><span
+                                                class="text-black font-weight-bold h5">@{{ task.lotatt04 }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
+                                        <span v-if="task.lotatt05"><span class="text-black h5">属性仓:</span><span
+                                                class="text-black font-weight-bold h5">@{{ task.lotatt05 }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
+                                        <span v-if="task.lotatt08"><span class="text-black h5">质量状态:</span><span
+                                                class="text-black font-weight-bold h5">@{{ task.lotatt08 }}</span> <span>&nbsp;&nbsp;&nbsp;&nbsp;</span></span>
+
                                     </div>
                                 </div>
                             </td>

+ 1 - 1
tests/Services/LogisticAliJiSuApiService/QueryTest.php

@@ -30,7 +30,7 @@ class QueryTest extends TestCase
      */
     public function prod_test()
     {
-//       $response = $this->service->query('9883840347518');
+//       $response = $this->service->query('KYE900000391232');
 //       dd($response);
 //       if ($response->status==0){
 //           $this->assertNotEmpty($response->result);