Browse Source

Merge branch 'master' into wangyang

king 4 years ago
parent
commit
1d0e0b4862
32 changed files with 725 additions and 454 deletions
  1. 1 1
      app/Exceptions/Handler.php
  2. 15 5
      app/Filters/OrderPackageFilters.php
  3. 3 5
      app/Http/Controllers/InventoryAccountController.php
  4. 0 1
      app/Http/Controllers/OrderController.php
  5. 1 0
      app/Http/Controllers/OrderPackageController.php
  6. 60 30
      app/Http/Controllers/PackageLogisticController.php
  7. 0 1
      app/Http/Controllers/StorageController.php
  8. 22 12
      app/Http/Controllers/TestController.php
  9. 80 51
      app/Http/Controllers/WaybillController.php
  10. 6 11
      app/Http/Middleware/LogPostRequest.php
  11. 34 26
      app/Jobs/CacheShelfTaskJob.php
  12. 6 0
      app/Order.php
  13. 1 1
      app/OrderPackage.php
  14. 14 0
      app/Services/CacheShelfService.php
  15. 9 4
      app/Services/ForeignHaiRoboticsService.php
  16. 241 186
      app/Services/HandInStorageService.php
  17. 14 0
      app/Services/InventoryAccountService.php
  18. 2 2
      app/Services/OrderService.php
  19. 1 2
      app/Services/StationService.php
  20. 2 2
      app/Services/StationTaskBatchService.php
  21. 13 4
      app/Services/StationTaskMaterialBoxService.php
  22. 31 6
      app/Services/StorageService.php
  23. 1 6
      app/Station.php
  24. 2 6
      app/User.php
  25. 23 1
      resources/sass/animation.css
  26. 1 1
      resources/views/order/workOrder/index.blade.php
  27. 7 2
      resources/views/package/logistic/index.blade.php
  28. 15 1
      resources/views/store/handInStorage/putaway.blade.php
  29. 1 1
      resources/views/store/handInStorage/receive.blade.php
  30. 2 2
      resources/views/store/handInStorage/receiveDetailPage.blade.php
  31. 116 83
      resources/views/transport/waybill/delivering.blade.php
  32. 1 1
      tests/Services/LogisticAliJiSuApiService/QueryTest.php

+ 1 - 1
app/Exceptions/Handler.php

@@ -35,7 +35,7 @@ class Handler extends ExceptionHandler
      *
      * @param Throwable $exception
      * @return void
-     * @throws Exception
+     * @throws Exception|Throwable
      */
     public function report(Throwable $exception)
     {

+ 15 - 5
app/Filters/OrderPackageFilters.php

@@ -3,6 +3,7 @@
 
 namespace App\Filters;
 
+use App\OracleDOCOrderHeader;
 use App\Order;
 use App\OrderIssue;
 use App\Services\UserService;
@@ -35,6 +36,7 @@ class OrderPackageFilters
         'is_new_rejecting',
         'result_explain',
         'issue_type_name',
+        'order_notes',//订单备注
     ];
 
     protected $orderIssueQuery;
@@ -155,7 +157,7 @@ class OrderPackageFilters
                 $query->from('order_issues')->select('order_id')->whereNotNull('order_id');
             });
         } else {
-            $this->queryBuilder->whereIn('order_id', function ($query) {
+            $this->queryBuilder->whereNotIn('order_id', function ($query) {
                 $query->from('order_issues')->select('order_id')->whereNotNull('order_id');
             });
         }
@@ -177,12 +179,12 @@ class OrderPackageFilters
     {
         if ($is_new_rejecting === '有') {
             $this->queryBuilder->whereIn('logistic_number', function ($query) {
-                $query->from('rejected_bills')->select('logistic_number_return')->where('logistic_number','原单退回')->whereNotNull('logistic_number_return');
+                $query->from('rejected_bills')->select('logistic_number_return')->where('logistic_number', '原单退回')->whereNotNull('logistic_number_return');
             });
         }
         if ($is_new_rejecting === '无') {
             $this->queryBuilder->whereNotIn('logistic_number', function ($query) {
-                $query->from('rejected_bills')->select('logistic_number_return')->where('logistic_number','原单退回')->whereNotNull('logistic_number_return');
+                $query->from('rejected_bills')->select('logistic_number_return')->where('logistic_number', '原单退回')->whereNotNull('logistic_number_return');
             });
         }
     }
@@ -190,7 +192,7 @@ class OrderPackageFilters
     public function issue_type_name($issue_type_name)
     {
         $this->queryBuilder->whereIn('order_id', function ($query) use ($issue_type_name) {
-            $query->from('order_issues')->select('order_id')->where('order_issue_type_id',function ($query) use ($issue_type_name){
+            $query->from('order_issues')->select('order_id')->where('order_issue_type_id', function ($query) use ($issue_type_name) {
                 $query->from('order_issue_types')->select('id')->where('name', $issue_type_name);
             });
         });
@@ -199,7 +201,15 @@ class OrderPackageFilters
     public function result_explain($result_explain)
     {
         $this->queryBuilder->whereIn('order_id', function ($query) use ($result_explain) {
-            $query->from('order_issues')->select('order_id')->where('result_explain','like',$result_explain);
+            $query->from('order_issues')->select('order_id')->where('result_explain', 'like', $result_explain);
+        });
+    }
+
+    public function order_notes($order_notes)
+    {
+        $ordernos = OracleDOCOrderHeader::query()->select('orderno')->where('notes', 'like', $order_notes)->pluck('orderno');
+        $this->queryBuilder->whereIn('order_id', function ($query) use ($ordernos) {
+            $query->from('orders')->select('order_id')->whereIn('code', $ordernos);
         });
     }
 }

+ 3 - 5
app/Http/Controllers/InventoryAccountController.php

@@ -40,9 +40,7 @@ class InventoryAccountController extends Controller
     //创建盘点任务
     public function createStockInventoryMission(Request $request)
     {
-        if (!Gate::allows("库存管理-盘点")) {
-            return redirect(url('/'));
-        }
+        if (!Gate::allows("库存管理-盘点")) {return ['success' => false ,'data' => '没有对应权限'];}
 //        $date_start=$request->input('formData.date_start');
 //        $date_end=$request->input('formData.date_end');
 //        $ownerId=$request->input('formData.owner_id')[0];
@@ -51,8 +49,8 @@ class InventoryAccountController extends Controller
         $ownerId = $request->input('owner_id');
         $location = $request->input('location');
         $barcode = $request->input('barcode');
-        $inventoryAccount = app('inventoryAccountService')->createMission($date_start, $date_end, $ownerId, $location, $barcode);
-        $inventoryAccount = InventoryAccount::with('owner')->find($inventoryAccount->id);
+        $inventory = app('inventoryAccountService')->createMission($date_start, $date_end, $ownerId, $location, $barcode);
+        $inventoryAccount = InventoryAccount::with('owner')->find($inventory->id);
         if (is_null($inventoryAccount)) return ['success' => false, 'data' => '参数错误!'];
         return ['success' => true, 'data' => $inventoryAccount];
     }

+ 0 - 1
app/Http/Controllers/OrderController.php

@@ -20,7 +20,6 @@ use Oursdreams\Export\Export;
 class OrderController extends Controller
 {
     public function delivering(OrderDelivering $request){
-        //if(!Gate::allows('订单管理-查询')){ return view('order/index');  }
         /** @var OrderService $orderService */
         $orderService = app('OrderService');
         $request = $request->input();

+ 1 - 0
app/Http/Controllers/OrderPackageController.php

@@ -50,6 +50,7 @@ class OrderPackageController extends Controller
                 'user_id' => auth()->id(),
                 'order_package_id' => $order_package_id,
                 'content' => $request->remark,
+                'created_at' => now(),
             ];
         }
         OrderPackageRemark::query()->insert($createDate);

+ 60 - 30
app/Http/Controllers/PackageLogisticController.php

@@ -33,8 +33,9 @@ class PackageLogisticController extends Controller
             ->filter($filters)
             ->with([
                 'order.logistic',
-                'rejectedBill'=>function($query){
-                    $query->select('id','logistic_number','logistic_number_return')->where('logistic_number', '原单退回');
+                'order.OracleDOCOrderHeader:orderno,notes',
+                'rejectedBill' => function ($query) {
+                    $query->select('id', 'logistic_number', 'logistic_number_return')->where('logistic_number', '原单退回');
                 },
                 'orderPackageRemarks' => function ($query) {
                     $query->with('user')->orderByDesc('created_at');
@@ -68,11 +69,11 @@ class PackageLogisticController extends Controller
 
     public function batchUpdate(Request $request)
     {
-        $data['status'] = OrderPackage::switchStatus($request->input('status'));
-        $logistic_numbers = $request->input('logistic_numbers');
-        //标记为手动更新
-        $data['is_manual_update']= true;
-        OrderPackage::query()->whereIn('logistic_number', $logistic_numbers)->update($data);
+        OrderPackage::query()->whereIn('logistic_number', $request->input('logistic_numbers'))->update([
+            'status' => OrderPackage::switchStatus($request->input('status')),
+            //标记为手动更新
+            'is_manual_update' => true,
+        ]);
     }
 
     /**
@@ -85,12 +86,21 @@ class PackageLogisticController extends Controller
         $owner_ids = $userService->getPermittingOwnerIds(auth()->user());
         $query = OrderPackage::query()
             ->filter($filters)
-            ->whereIn('owner_id', $owner_ids)
-            ->with(['order.logistic', 'order.owner', 'order.issue' => function ($query) {
-                $query->with(['issueType', 'logs' => function ($query) {
-                    $query->with('user')->orderBy('created_at', 'DESC');
-                }]);
-            }]);
+            ->with([
+                'order.logistic',
+                'rejectedBill' => function ($query) {
+                    $query->select('id', 'logistic_number', 'logistic_number_return')->where('logistic_number', '原单退回');
+                },
+                'orderPackageRemarks' => function ($query) {
+                    $query->with('user')->orderByDesc('created_at');
+                },
+                'order.owner',
+                'order.issue' => function ($query) {
+                    $query->with(['issueType', 'logs' => function ($query) {
+                        $query->with('user')->orderBy('created_at', 'DESC');
+                    }]);
+                }])
+            ->orderByDesc('id');
         if ($request->exists('checkAllSign')) {
             $orderPackages = $query->orderByDesc('id')->get();
         } else {
@@ -98,7 +108,24 @@ class PackageLogisticController extends Controller
                 ->whereIn('logistic_number', explode(',', $request['data']))
                 ->orderByDesc('id')->get();
         }
-        $row = ["异常类型", "单号", "状态", "快递公司", "货主", "省份", "发出日期", "收货日期", "称重日期", "快递路由", "客服备注", "情况说明", "问题类别", "说明", "操作者", "时间",];
+        $row = [
+            '单号',
+            '状态',
+            '快递公司',
+            '货主',
+            '省份',
+            '发出日期',
+            '收货日期',
+            '称重日期',
+            '快递路由',
+            '退件状态',
+            '客服备注',
+            '情况说明',
+            '问题类别',
+            '说明',
+            '操作者',
+            '时间',
+        ];
         $json = [];
         foreach ($orderPackages as $orderPackage) {
             $transfer_status = "";
@@ -110,9 +137,9 @@ class PackageLogisticController extends Controller
                 }
             }
             $remark = "";
-            if (is_array($orderPackage->remark) && !empty($orderPackage->remark)) {
-                foreach ($orderPackage->remark as $remarkItem) {
-                    $remark = $remark . $remarkItem . ",\r\n";
+            if (!empty($orderPackage->orderPackageRemarks)) {
+                foreach ($orderPackage->orderPackageRemarks as $remarkItem) {
+                    $remark = $remark . $remarkItem->content . '-' . $remarkItem->user->name . '-' . $remarkItem->created_at . ",\r\n";
                 }
             }
             $logsContent = "";
@@ -126,19 +153,22 @@ class PackageLogisticController extends Controller
                 }
             }
             $data = [
-                $orderPackage->logistic_number,
-                $orderPackage->status,
-                $orderPackage->order->logistic->name,
-                $orderPackage->order->owner->name,
-                $orderPackage->order->province,
-                $orderPackage->sent_at,
-                $orderPackage->received_at,
-                $orderPackage->weighed_at,
-                $transfer_status,
-                $remark,
-                $logsContent,
-                $users,
-                $logCreatedAt,
+                $orderPackage->logistic_number ?? '',//单号
+                $orderPackage->status ?? '',//状态
+                $orderPackage->order->logistic->name ?? '',//快递公司
+                $orderPackage->order->owner->name ?? '',//货主
+                $orderPackage->order->province ?? '',//省份
+                $orderPackage->sent_at ?? '',//发出日期
+                $orderPackage->received_at ?? '',//收货日期
+                $orderPackage->weighed_at ?? '',//称重日期
+                $transfer_status ?? '',//快递路由
+                empty($orderPackage->rejectedBill) ? '无' : '有',//退件状态
+                $remark ?? '',//客服备注
+                $orderPackage->order->issue->result_explain ?? '',//情况说明
+                $orderPackage->order->issue->issueType->name ?? '',//问题类别
+                $logsContent ?? '',//说明
+                $users ?? '',//操作者
+                $logCreatedAt ?? '',//时间
             ];
             $json[] = $data;
         }

+ 0 - 1
app/Http/Controllers/StorageController.php

@@ -183,7 +183,6 @@ sql;
         $result = app("ForeignHaiRoboticsService")->paddingCacheShelf(Station::query()->whereIn("code",$boxes)->get());
         if ($result===null)$this->error("任务下发错误,检查日志");
         if ($result===false)$this->error("已无可用料箱,部分库位填充失败");
-        app("StationService")->locationOccupyMulti($boxes);
         $this->success(["data"=>$data,"boxes"=>$boxes]);
     }
 

+ 22 - 12
app/Http/Controllers/TestController.php

@@ -17,6 +17,7 @@ use App\Jobs\OrderCreateWaybill;
 use App\Jobs\SettlementBillReportTask;
 use App\Jobs\StoreCreateInstantBill;
 use App\Jobs\WeightUpdateInstantBill;
+use App\Log;
 use App\MaterialBox;
 use App\MaterialBoxModel;
 use App\Order;
@@ -88,19 +89,28 @@ class TestController extends Controller
 
     public function test()
     {
-        $a = new StorageService();
-        $b = Station::query()->where("station_type_id",5)->whereNotNull("parent_id")->get();
-        $a->clearTask(array_column($b->toArray(),"code"));
+        $a = 1;
+        if ($a>2)dd(1);
+        else if($a==0)dd(2);
+        dd(3);
     }
-    public function _stationCacheLightOff($locCode)
+
+    public function update_order_packages_is_manual_update()
     {
-        if (!$locCode) return null;
-        $params = [
-            "areaCode" => "1004",
-            'locCode' => $locCode,
-            'PTLAction' => 0,
-        ];
-        $response = Http::post(config('api.haiq.storage.light'), $params);
-        return json_decode($response->body());
+        $descriptions = Log::query()
+            ->select('description')
+            ->whereBetween('created_at', ['2021-08-31 10:30:00', '2021-08-31 10:35:00'])
+            ->where('class', 'like', 'https://was.baoshi56.com/package/logistic/batchUpdate%')->pluck('description');
+        foreach ($descriptions as $description) {
+            $description = substr($description, 9);
+            $description = \Illuminate\Support\Str::before($description,"}");
+            $obj= json_decode($description.'}',true);
+            OrderPackage::query()
+                ->whereIn('logistic_number', $obj['logistic_numbers'])
+                ->update([
+                    'status' => '无',
+                    'is_manual_update' => false,
+                ]);
+        }
     }
 }

+ 80 - 51
app/Http/Controllers/WaybillController.php

@@ -57,7 +57,6 @@ class WaybillController extends Controller
      */
     public function index(Request $request,OwnerService $ownerService,LogisticService $logisticService)
     {
-        if(!Gate::allows('运输管理-运单-查询')){ return view("exception.authority");  }
         $paginateParams = $request->input();
         $waybills=app('waybillService')->paginate($request->input());
         $mac_addr = getMacAddr();
@@ -777,12 +776,10 @@ SQL;
         ])->direct();
     }
 
-    //发运
-    public function delivering(Request $request){
-        if (!Auth::user())return view('exception.login');
-        $waybills= Waybill::query()->where("type","专线")
-            ->whereNotNull("logistic_id")->whereNotIn("status",["未审核","待重审"])
-            ->orderByDesc("id");
+    private function deliveringQuery(Request $request): Builder
+    {
+        $waybills= Waybill::query()->where("type","专线")->with(["order","logistic"])
+        ->whereNotNull("logistic_id")->whereNotNull("deliver_at")->whereIn("status",["已审核","待终审"]);
         if (!Auth::user()->isSuperAdmin()){
             $carriersUsers=DB::table('logistic_user')->where('user_id',Auth::id())->get();
             $carrierIds=array_column($carriersUsers->toArray(),'logistic_id');
@@ -792,12 +789,34 @@ SQL;
         if ($searchText)$waybills->where(function ($query)use($searchText){
             $query->where("waybill_number",'like','%'.$searchText.'%')->orWhere("carrier_bill",'like','%'.$searchText.'%');
         });
-        $waybills = $waybills->get();
-        return view('transport.waybill.delivering',compact('waybills',"searchText"));
+        $lastId = $request->get("lastId","");
+        if ($lastId)$waybills->where("id","<",$lastId);
+        $deliverAt = $request->get("deliverAt");
+        if ($deliverAt)$waybills->where("deliver_at",$deliverAt);
+        $date = $request->get("date");
+        if ($date)$waybills->where("deliver_at",'like',$date."%");
+        return $waybills;
+    }
+    //发运
+    public function delivering(Request $request){
+        $groups = $this->deliveringQuery($request)->selectRaw("date_format(deliver_at, '%Y-%m-%d') date")
+            ->orderByDesc(DB::raw("date"))->groupByRaw("date")->get();
+        $searchText = $request->get("searchText","");
+        return view('transport.waybill.delivering',compact('groups',"searchText"));
+    }
+
+    /**
+     * 懒加载发运数据
+     */
+    public function loadData(Request $request)
+    {
+        if (!Auth::user())$this->error("登录信息失效");
+        $this->success($this->deliveringQuery($request)->limit(10)->orderByDesc("id")->get());
+        $this->success($this->deliveringQuery($request)->orderByDesc("id")->get());
     }
     //承运商提交
     public function storeCarrierBill(Request $request){
-        //if(!Gate::allows("运输管理-承运商调度"))return ["error"=>"无权操作!"];
+        if(!Gate::allows("运输管理-承运商调度"))return ["error"=>"无权操作!"];
         $errors=Validator::make($request->input(),[
             'id'=>'required|integer',
             'carrier_bill'=>'required',
@@ -823,10 +842,16 @@ SQL;
         if (count($errors)>0)return ["errors"=>$errors];
         $waybill=Waybill::query()->find($request->input('id'));
         if (!$waybill)return ["error"=>"未找到该运单!"];
-        $request->offsetSet("carrier_weight_unit_id",$unit2);
-        $request->offsetSet("carrier_weight_unit_id_other",$unit);
-        $request->offsetSet("amount_unit_id",$unit1);
+        $request->offsetSet("carrier_weight_unit_id",$unit2->id);
+        $request->offsetSet("carrier_weight_unit_id_other",$unit->id);
+        $request->offsetSet("amount_unit_id",$unit1->id);
+        $request->offsetSet("status","待终审");
         $waybill->fill($request->input());
+        WaybillAuditLog::query()->create([
+            'waybill_id'=>$waybill->id,
+            'audit_stage'=>'调度阶段',
+            'user_id'=>Auth::id(),
+        ]);
         $waybill->update();
         return $waybill;
     }
@@ -1148,34 +1173,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();
@@ -1184,6 +1182,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(),
+        ]);
+    }
+
     /**
      * 快递面单打印 :暂时支持 德邦
      */
@@ -1233,7 +1263,6 @@ SQL;
         $logistics = app("LogisticService")->getSelection(['id','name','tag'],"物流");
         return view("transport.waybill.android.shipment",compact("logistics"));
     }
-
     /**
      * 发货与合并
      */
@@ -1241,10 +1270,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)
@@ -1260,8 +1294,7 @@ SQL;
                             || $item->order->consignee_phone!=$waybill->order->consignee_phone
                             || $item->order->address!=$waybill->order->address)) ||
                     (!$waybill->order && ($item->recipient!=$waybill->recipient
-                            || $item->recipient_mobile!=$waybill->recipient_mobile
-                            || $item->destination!=$waybill->destination));
+                            || $item->recipient_mobile!=$waybill->recipient_mobile));
                 if ($identical)$this->error("订单信息不一致,无法统一发货");
                 $destroys[] = $item->id;
                 $waybill->source_bill .= $item->source_bill ? ",".$item->source_bill : '';
@@ -1278,14 +1311,10 @@ SQL;
             $owner = array_unique($owner);
             if (count($owner)>1)$waybill->merge_owner = implode(',',$owner);
             $waybill->deliver_at = date("Y-m-d H:i:s");
+            $waybill->logistic_id = \request("logistic");
             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'=>'合单发货',

+ 6 - 11
app/Http/Middleware/LogPostRequest.php

@@ -19,17 +19,12 @@ class LogPostRequest
      */
     public function handle($request, Closure $next)
     {
-        try {
-            if($request->method()!='GET'){
-                LogService::log($request->fullUrl(),$request->method(),
-                    '请求:'.json_encode($request->all())
-                    .'请求头:'.json_encode($request->headers->all())
-                );
-            }
-            return $next($request);
-        }catch (\Exception $e){
-            $this->push(__METHOD__."->".__LINE__,"路径跳转捕获",$e->getMessage()."  请求用户:".Auth::id()."  request对象:".json_encode($request));
-            return view("exception.404");
+        if($request->method()!='GET'){
+            LogService::log($request->fullUrl(),$request->method(),
+                '请求:'.json_encode($request->all())
+                .'请求头:'.json_encode($request->headers->all())
+            );
         }
+        return $next($request);
     }
 }

+ 34 - 26
app/Jobs/CacheShelfTaskJob.php

@@ -46,11 +46,15 @@ class CacheShelfTaskJob implements ShouldQueue
         switch ($this->key){
             case "CACHE_SHELF_AVAILABLE"://缓存架释放呼叫
                 //等待一定时间来合并同类请求至此
-                $available = Cache::get($this->key,function (){return [];});
-                if ($this->count!==count($available))return;
+                $available = Cache::get($this->key,0);
+                if ($this->count!==$available)return;
+                Cache::forget($this->key); //无论是否开始分发 都清除本次缓存架的计数器
+                //获取可用缓存架
+                $stations = app("StationService")->getCacheShelf(true);
+                if ($stations->count()==0)break;
                 //检查事务 尝试分发任务 改变下方序列来控制分发顺序 逐级分发 一次成功就终止
-                if ($this->dispatchOutTask($available,$service))break; //首先尝试向出库事务分发 分发成功跳出
-                if ($this->dispatchInTask($available,$service))break;  //尝试向入库事务分发
+                if ($this->dispatchOutTask($stations,$service))break; //首先尝试向出库事务分发 分发成功跳出
+                if ($this->dispatchInTask($stations,$service))break;  //尝试向入库事务分发
                 break;
             default://入库呼叫
                 if (!Cache::has($this->key))return;
@@ -61,10 +65,10 @@ class CacheShelfTaskJob implements ShouldQueue
                 $controlSuccess = $service->controlHaiRobot($dataToPost,$task,'缓存架入立架');
                 $tIds = [];
                 $task->each(function ($t)use(&$tIds){$tIds[] = $t->id;});
-                StationTaskMaterialBox::query()->where("id",$tIds)
+                StationTaskMaterialBox::query()->whereIn("id",$tIds)
                     ->where("status","待处理")->update(['status' => $controlSuccess ? '处理中' : '异常']);
                 Cache::forget($this->key);
-                if ($controlSuccess)$this->materialBoxMappingCacheShelf($task,$location);
+                //if ($controlSuccess)$this->materialBoxMappingCacheShelf($task,$location);
         }
     }
 
@@ -88,11 +92,11 @@ class CacheShelfTaskJob implements ShouldQueue
     /**
      * 分发出库任务
      *
-     * @param array $available
+     * @param $stations
      * @param $service
      * @return bool
      */
-    private function dispatchOutTask(array $available, $service):bool
+    private function dispatchOutTask(&$stations,$service):bool
     {
         DB::beginTransaction();
         try {
@@ -101,14 +105,14 @@ class CacheShelfTaskJob implements ShouldQueue
                     $query->where("status","待处理");
                 })->where("status",3)->lockForUpdate()
                 ->where("mark",2)->groupBy("task_id")->get(); //检索等待的队列事务来获取对应任务
-            if ($this->dispatchTask($tasks,$available,$service,function ($obj,$stationId,$time,&$updateTransaction){
+            if ($this->dispatchTask($tasks,$stations,$service,function ($obj,$stationId,$time,&$updateTransaction){
                 if ($obj->ids!=$obj->id){
                     $ids = explode(",",$obj->ids);
                     foreach ($ids as $id)$updateTransaction[] = ["id"=>$id,"to_station_id"=>$stationId,"status"=>0,"updated_at"=>$time];
                 }else $updateTransaction[] = ["id"=>$obj->id,"to_station_id"=>$stationId,"status"=>0,"updated_at"=>$time];
             },function ($service,$toLocation,$task,$prefix){
                 return $service->fetchGroup_multiLocation($toLocation,$task,$prefix,'立架出至缓存架',20);
-            },"to_station_id")){DB::commit();return true;}
+            },"to_station_id")){DB::commit();return $stations->count()==0;} //缓存架用完 跳出,否则接着分发
             DB::rollBack();
         }catch (\Exception $e){
             DB::rollBack();
@@ -120,11 +124,11 @@ class CacheShelfTaskJob implements ShouldQueue
     /**
      * 分发入库任务
      *
-     * @param array $available
+     * @param $stations
      * @param $service
      * @return bool
      */
-    private function dispatchInTask(array $available, $service):bool
+    private function dispatchInTask(&$stations,$service):bool
     {
         DB::beginTransaction();
         try {
@@ -133,11 +137,14 @@ class CacheShelfTaskJob implements ShouldQueue
                     $query->where("status","待处理");
                 })->where("status",3)->lockForUpdate()
                 ->where("mark",1)->get(); //检索等待的队列事务来获取对应任务
-            if ($this->dispatchTask($tasks,$available,$service,function ($obj,$stationId,$time,&$updateTransaction){
+            if (!$tasks->count())return false;
+            if ($this->dispatchTask($tasks,$stations,$service,function ($obj,$stationId,$time,&$updateTransaction){
                 $updateTransaction[] = ["id"=>$obj->id,"fm_station_id"=>$stationId,"status"=>0,"updated_at"=>$time];
             },function ($service,$toLocation,$task,$prefix){
                 return $service->fetchGroup_multiLocation($toLocation,$task,'','立架出至缓存架');
-            },"fm_station_id")){DB::commit();return true;}
+            },"fm_station_id")){
+                DB::commit();return $stations->count()==0; //缓存架用完 跳出,否则接着分发
+            }
             DB::rollBack();
         }catch (\Exception $e){
             DB::rollBack();
@@ -146,31 +153,32 @@ class CacheShelfTaskJob implements ShouldQueue
         return false;
     }
 
-    private function dispatchTask(\Illuminate\Database\Eloquent\Collection $tasks, array $available, $service,
+    private function dispatchTask(\Illuminate\Database\Eloquent\Collection $tasks,&$stations, $service,
                                   \Closure $update, \Closure $execute, string $stationName):bool
     {
-        if (!$tasks->count())return false;
-        if ($tasks->count()>count($available))$tasks = $tasks->slice(0,count($available));//事务过多切割部分处理
+        $locations = $stations;
+        if ($tasks->count()>$locations->count())$tasks = $tasks->slice(0,$locations->count());//事务过多切割部分处理
+        if ($tasks->count()<$locations->count()){
+            $stations = $stations->slice($tasks->count());
+            $stations = $stations->values($stations);
+        }
         $toLocation = collect();
         $task = collect();
-        $availableTemp = array_keys($available);
-        $map = app("StationService")->getStationMapping($availableTemp);//获取库位映射信息
         $updateTask = [["id","station_id","updated_at"]];
         $updateTransaction = [["id",$stationName,"status","updated_at"]];
         $time = date("Y-m-d H:i:s");
+        $map = [];
         foreach ($tasks as $index=>$obj){
-            $loc = $availableTemp[$index];
-            $toLocation->push($loc);
-            $obj->task->station_id = $map[$loc];
+            $toLocation->push($stations[$index]->code);
+            $map[$stations[$index]->code] = $stations[$index]->id;
+            $obj->task->station_id = $stations[$index]->id;
             $task->push($obj->task);
-            unset($available[$loc]);
-            $updateTask[] = ["id"=>$obj->task->id,"station_id"=>$map[$loc],"updated_at"=>$time];
-            $update($obj,$map[$loc],$time,$updateTransaction);
+            $updateTask[] = ["id"=>$obj->task->id,"station_id"=>$stations[$index]->id,"updated_at"=>$time];
+            $update($obj,$stations[$index]->id,$time,$updateTransaction);
         }
         app("BatchUpdateService")->batchUpdate("station_task_material_boxes",$updateTask);
         app("BatchUpdateService")->batchUpdate("task_transactions",$updateTransaction);
         if ($execute($service,$toLocation,$task,$tasks[0]->station_task_batch_id)){
-            Cache::forever($this->key,$available);
             foreach ($toLocation as $value){
                 app("CacheShelfService")->lightUp($value,'3','0',["title"=>"机器人取箱中,禁止操作"]);
                 Cache::forever("CACHE_SHELF_OCCUPANCY_{$map[$value]}",true);

+ 6 - 0
app/Order.php

@@ -5,6 +5,7 @@ namespace App;
 use App\Traits\ModelTimeFormat;
 use Illuminate\Database\Eloquent\Model;
 use App\Traits\ModelLogChanging;
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
 
 class Order extends Model
 {
@@ -178,4 +179,9 @@ class Order extends Model
         ];
         return $arr[$string] ?? '否';
     }
+
+    public function OracleDOCOrderHeader(): BelongsTo
+    {
+        return $this->belongsTo(OracleDOCOrderHeader::class,'code','orderno');
+    }
 }

+ 1 - 1
app/OrderPackage.php

@@ -84,7 +84,7 @@ class OrderPackage extends Model
 
     public function getStatusAttribute($value)
     {
-        if(!$value)return '';
+        if(!$value || !isset(self::$enums['status'][$value]))return '';
         return self::$enums['status'][$value];
     }
     public function setStatusAttribute($value)

+ 14 - 0
app/Services/CacheShelfService.php

@@ -4,6 +4,7 @@ namespace App\Services;
 
 use App\Events\BroadcastToStation;
 use App\Exceptions\ErrorException;
+use App\Jobs\CacheShelfTaskJob;
 use App\Station;
 use App\StationTaskMaterialBox;
 use App\Traits\ServiceAppAop;
@@ -202,4 +203,17 @@ class   CacheShelfService
 
         return ['success' => true];
     }
+
+    /**
+     * 料箱被取走
+     *
+     * @param Station|\stdClass $station
+     */
+    public function boxHasBeenTaken($station)
+    {
+        app("StationService")->locationFreed($station); //释放库位,解除绑定料箱
+        $available=Cache::get("CACHE_SHELF_AVAILABLE",0)+1;//获取可用缓存架数量 plus当前
+        Cache::forever("CACHE_SHELF_AVAILABLE",$available);
+        CacheShelfTaskJob::dispatch("CACHE_SHELF_AVAILABLE",$available)->delay(now()->addSeconds(config("haiRou.cacheShelf.outBinAwait")));
+    }
 }

+ 9 - 4
app/Services/ForeignHaiRoboticsService.php

@@ -351,10 +351,6 @@ class ForeignHaiRoboticsService
         $binCode
     ):bool{
         $this->instant($this->stationTaskMaterialBoxService,'StationTaskMaterialBoxService');
-        if ($status==1){ //海柔失败
-            $this->push(__METHOD__."->".__LINE__,"海柔任务异常",json_encode(request()->input()));
-            return false;
-        }
         //获取下达任务
         /** @var StationTaskMaterialBox|\stdClass $stationTaskMaterialBox */
         $stationTaskMaterialBox = $stationTaskMaterialBox_id ? StationTaskMaterialBox::query()->with("materialBox:id,code")
@@ -363,6 +359,11 @@ class ForeignHaiRoboticsService
             $this->push(__METHOD__."->".__LINE__,"海柔任务不存在",json_encode(request()->input()));
             return false;
         }
+        if ($status==1){ //海柔失败
+            $this->push(__METHOD__."->".__LINE__,"海柔任务异常",json_encode(request()->input()));
+            $stationTaskMaterialBox->update(['status'=>"异常"]);
+            return false;
+        }
         if ($stationTaskMaterialBox->materialBox->code != $binCode){
             $this->push(__METHOD__."->".__LINE__,"海柔任务料箱号不匹配",json_encode(request()->input()));
             return false;
@@ -496,6 +497,10 @@ class ForeignHaiRoboticsService
         }
         if ($stationCollection->count()>0){
             if (!$this->fetchGroup_multiLocation($stationCollection,$collection,'','立架出至缓存架')) return null;
+            app("StationService")->locationOccupyMulti($stationCollection->toArray());
+            $stationCollection->each(function ($code){
+                app("CacheShelfService")->lightUp($code,'3','0',["title"=>"机器人取箱中,禁止操作"]);
+            });
         }
         return $stations->count()==$stationCollection->count();
     }

+ 241 - 186
app/Services/HandInStorageService.php

@@ -36,20 +36,31 @@ class HandInStorageService
      * @return object
      * 根据asn单号获取 总预期数量 总已收数量
      */
-    public function getAsnQty($asnno)
+    public function getAsnQty($asnno): object
     {
-        $asnQty=OracleDOCASNDetail::query()
-            ->select('expectedqty','receivedqty')
-            ->where('asnno',$asnno)
+        $asnQty = OracleDOCASNDetail::query()
+            ->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);
+        return (object)array('expectedqty' => $expectedqty, 'receivedqty' => $receivedqty);
     }
+
     /**
      * @param array $info
      * @return bool|int
@@ -57,19 +68,20 @@ class HandInStorageService
      */
     public function checkForwardingLoc(array $info)
     {
-        $res=OracleBasCustomer::query()
-            ->where('customerid',$info['customerid'])
-            ->where('customer_type','OW')
-            ->where('udf1','Y')->count(); //查询此货主是否必须有拣货位
-        if ($res>0) {
-            $amount=OracleBasForwardingLoc::query()
-                ->where('customerid',$info['customerid'])
-                ->where('sku',$info['sku'])
+        $res = OracleBasCustomer::query()
+            ->where('customerid', $info['customerid'])
+            ->where('customer_type', 'OW')
+            ->where('udf1', 'Y')->count(); //查询此货主是否必须有拣货位
+        if ($res > 0) {
+            $amount = OracleBasForwardingLoc::query()
+                ->where('customerid', $info['customerid'])
+                ->where('sku', $info['sku'])
                 ->count();
-            if ($amount==0)return 1;//请维护拣货位!
+            if ($amount == 0) return 1;//请维护拣货位!
         }
         return true;
     }
+
     /**
      * @param array $info
      * @return bool|int
@@ -77,9 +89,9 @@ class HandInStorageService
      */
     public function checkWidthHeight(array $info)
     {
-        $basSku=OracleBasSKU::query()->where('customerid',$info['customerid'])->where('sku',$info['sku'])->first();
-        if (!$basSku)return 1;//需要维护产品档案
-        if ($basSku->skulength<=0||$basSku->skuwidth<=0||$basSku->skuhigh<=0)return 2;//需要维护该产品档案中的长宽高
+        $basSku = OracleBasSKU::query()->where('customerid', $info['customerid'])->where('sku', $info['sku'])->first();
+        if (!$basSku) return 1;//需要维护产品档案
+        if ($basSku->skulength <= 0 || $basSku->skuwidth <= 0 || $basSku->skuhigh <= 0) return 2;//需要维护该产品档案中的长宽高
         return true;
     }
 
@@ -90,11 +102,12 @@ class HandInStorageService
      */
     public function checkCubicWeight(array $info)
     {
-        $basSku=OracleBasSKU::query()->where('customerid',$info['customerid'])->where('sku',$info['sku'])->first();
-        if (!$basSku)return 1;//需要维护产品档案
-        if ($basSku->grossweight<=0||$basSku->cube<=0)return 2;//需要维护该产品档案中的重量体积
+        $basSku = OracleBasSKU::query()->where('customerid', $info['customerid'])->where('sku', $info['sku'])->first();
+        if (!$basSku) return 1;//需要维护产品档案
+        if ($basSku->grossweight <= 0 || $basSku->cube <= 0) return 2;//需要维护该产品档案中的重量体积
         return true;
     }
+
     /**
      * @param array $info
      * @param array $param
@@ -187,7 +200,7 @@ class HandInStorageService
     public function selectAsn($asn)
     {
         if (!$asn) return OracleDOCASNHeader::query()  //空扫
-            ->select(['asnno', 'asnreference1', 'asnstatus', 'addtime', 'customerid', 'asntype','notes'])
+        ->select(['asnno', 'asnreference1', 'asnstatus', 'addtime', 'customerid', 'asntype', 'notes'])
             ->where('asnstatus', '00')
             ->orderByDesc('addtime')
             ->limit(50)
@@ -195,13 +208,13 @@ class HandInStorageService
 
         if (strpos(strtoupper($asn), 'ASN') !== false) {  //asn 单号
             return OracleDOCASNHeader::query()
-                ->select(['asnno', 'asnreference1', 'asnstatus', 'addtime', 'customerid', 'asntype','notes'])
+                ->select(['asnno', 'asnreference1', 'asnstatus', 'addtime', 'customerid', 'asntype', 'notes'])
                 ->where('asnno', $asn)
                 ->whereIn('asnstatus', ['00', '30'])
                 ->get();
         } else {
             $asns = OracleDOCASNHeader::query()  //货主
-                ->select(['asnno', 'asnreference1', 'asnstatus', 'addtime', 'customerid', 'asntype','notes'])
+            ->select(['asnno', 'asnreference1', 'asnstatus', 'addtime', 'customerid', 'asntype', 'notes'])
                 ->where('customerid', strtoupper($asn))
                 ->whereIn('asnstatus', ['00', '30'])
                 ->get();
@@ -232,7 +245,7 @@ SQL;
     {
         $sql = <<<sql
  SELECT DOC_ASN_DETAILS.sku,DOC_ASN_DETAILS.expectedqty,DOC_ASN_DETAILS.skudescrc,DOC_ASN_DETAILS.asnlineno,DOC_ASN_DETAILS.asnno,
-       DOC_ASN_DETAILS.receivedqty,BAS_SKU.alternate_sku1
+       DOC_ASN_DETAILS.receivedqty,DOC_ASN_DETAILS.receivedqty_each,BAS_SKU.alternate_sku1
 FROM DOC_ASN_DETAILS LEFT JOIN BAS_SKU ON DOC_ASN_DETAILS.CUSTOMERID = BAS_SKU.CUSTOMERID AND DOC_ASN_DETAILS.SKU = BAS_SKU.SKU
 WHERE asnno = ? AND linestatus IN ('00','30')
 sql;
@@ -253,15 +266,15 @@ sql;
 SELECT DOC_ASN_DETAILS.sku,DOC_ASN_DETAILS.expectedqty,DOC_ASN_DETAILS.skudescrc,
        DOC_ASN_DETAILS.lotatt01, DOC_ASN_DETAILS.lotatt02, DOC_ASN_DETAILS.lotatt03, DOC_ASN_DETAILS.lotatt04,
        DOC_ASN_DETAILS.lotatt05, DOC_ASN_DETAILS.lotatt06, DOC_ASN_DETAILS.lotatt07, DOC_ASN_DETAILS.lotatt08,
-       DOC_ASN_DETAILS.asnlineno,DOC_ASN_DETAILS.asnno,DOC_ASN_DETAILS.receivedqty FROM DOC_ASN_DETAILS
+       DOC_ASN_DETAILS.asnlineno,DOC_ASN_DETAILS.asnno,DOC_ASN_DETAILS.receivedqty,DOC_ASN_DETAILS.receivedqty_each FROM DOC_ASN_DETAILS
          LEFT JOIN BAS_SKU ON DOC_ASN_DETAILS.CUSTOMERID = BAS_SKU.CUSTOMERID AND DOC_ASN_DETAILS.SKU = BAS_SKU.SKU
 WHERE ASNNO = ? AND LINESTATUS IN ('00','30') AND (ALTERNATE_SKU1 = ? OR ALTERNATE_SKU2 = ?  OR ALTERNATE_SKU3 = ?)
 sql;
         $asn_detail = DB::connection("oracle")->selectOne(DB::raw($sql), [$asnno, $skuOrBarcode, $skuOrBarcode, $skuOrBarcode]);
         if ($asn_detail) return $asn_detail;
         else return OracleDOCASNDetail::query()
-            ->select(['sku', 'expectedqty', 'skudescrc', 'asnlineno', 'asnno', 'receivedqty',
-                'lotatt01','lotatt02','lotatt03','lotatt04','lotatt05','lotatt06','lotatt07','lotatt08'])
+            ->select(['sku', 'expectedqty', 'skudescrc', 'asnlineno', 'asnno', 'receivedqty','receivedqty_each',
+                'lotatt01', 'lotatt02', 'lotatt03', 'lotatt04', 'lotatt05', 'lotatt06', 'lotatt07', 'lotatt08'])
             ->where('asnno', $asnno)
             ->where('sku', $skuOrBarcode)
             ->whereIn('linestatus', ['00', '30'])
@@ -318,7 +331,7 @@ sql;
      */
     public function getInvotlocid($barcode): array
     {
-        $sql=<<<sql
+        $sql = <<<sql
 select INV_LOT_LOC_ID.CUSTOMERID,BAS_SKU.ALTERNATE_SKU1,INV_LOT_LOC_ID.LOCATIONID,INV_LOT_ATT.LOTATT05,INV_LOT_ATT.LOTATT08,
        INV_LOT_ATT.LOTATT01,INV_LOT_ATT.LOTATT02,INV_LOT_ATT.LOTATT03,INV_LOT_ATT.LOTATT04,
        sum(INV_LOT_LOC_ID.QTY) AS QTY from INV_LOT_LOC_ID
@@ -330,7 +343,7 @@ select INV_LOT_LOC_ID.CUSTOMERID,BAS_SKU.ALTERNATE_SKU1,INV_LOT_LOC_ID.LOCATIONI
 group by INV_LOT_LOC_ID.CUSTOMERID,BAS_SKU.ALTERNATE_SKU1,INV_LOT_LOC_ID.LOCATIONID,INV_LOT_ATT.LOTATT05,INV_LOT_ATT.LOTATT08,INV_LOT_ATT.LOTATT01,INV_LOT_ATT.LOTATT02,INV_LOT_ATT.LOTATT03,INV_LOT_ATT.LOTATT04
 sql;
         $invLots = DB::connection("oracle")->select(DB::raw($sql), [$barcode, $barcode, $barcode]);
-        if (!$invLots)return [];
+        if (!$invLots) return [];
         else return $invLots;
     }
 
@@ -339,10 +352,10 @@ sql;
      * @return array|int
      * 根据商品条码  获取完全收货状态  部分收货状态的 PA任务
      */
-    public function getTsk($trackNumber,$barCode): array
+    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 +363,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
@@ -357,45 +376,45 @@ from (select TSK_TASKLISTS.CustomerID,
       where TSK_TASKLISTS.TASKTYPE = 'PA'
         AND TSK_TASKLISTS.TASKPROCESS = '00'
 sql;
-        if (!$trackNumber){ //没有输入条件  空扫
+        if (!$trackNumber) { //没有输入条件  空扫
             $owner_codes = app('OwnerService')->getIntersectPermitting(['code']);
-            if (count($owner_codes)>0){
-                $sql.=' AND TSK_TASKLISTS.CustomerID IN (';
-                foreach ($owner_codes as $index => $no){
-                    if ($index==0){
-                        $sql.="'".$no->code."'";
+            if (count($owner_codes) > 0) {
+                $sql .= ' AND TSK_TASKLISTS.CustomerID IN (';
+                foreach ($owner_codes as $index => $no) {
+                    if ($index == 0) {
+                        $sql .= "'" . $no->code . "'";
                         continue;
                     }
-                    $sql.=",'".$no->code."'";
+                    $sql .= ",'" . $no->code . "'";
                 }
-                $sql.=')';
-            }else{
+                $sql .= ')';
+            } else {
                 $sql .= ' AND TSK_TASKLISTS.CustomerID IS NULL ';
             }
 
-        }else{
-            if (strpos(strtoupper($trackNumber), 'ASN') !== false){
-                $sql.='AND TSK_TASKLISTS.DOCNO= ?'; //输入条件为asn单号
-            } else{ //不为asn号时 判断是否为货主
-                if ($this->checkUserOwnerAuth($trackNumber)){ //输入条件为货主
-                    $sql.=' AND TSK_TASKLISTS.CustomerID= ?';
-                }else{
-                    $sql.=' AND TSK_TASKLISTS.PlanToID= ?';  //不是货主 判断是否为跟踪号
+        } else {
+            if (strpos(strtoupper($trackNumber), 'ASN') !== false) {
+                $sql .= 'AND TSK_TASKLISTS.DOCNO= ?'; //输入条件为asn单号
+            } else { //不为asn号时 判断是否为货主
+                if ($this->checkUserOwnerAuth($trackNumber)) { //输入条件为货主
+                    $sql .= ' AND TSK_TASKLISTS.CustomerID= ?';
+                } else {
+                    $sql .= ' AND TSK_TASKLISTS.PlanToID= ?';  //不是货主 判断是否为跟踪号
                 }
             }
         }
 
-        if ($barCode)$sql.=" AND TSK_TASKLISTS.sku in (
-                                    select SKU from BAS_SKU where ALTERNATE_SKU1='".$barCode."' union
-                                    select SKU from BAS_SKU where ALTERNATE_SKU2='".$barCode."' union
-                                    select SKU from BAS_SKU where ALTERNATE_SKU3='".$barCode."' union
-                                    select SKU from BAS_SKU where SKU='".$barCode."' )";
+        if ($barCode) $sql .= " AND TSK_TASKLISTS.sku in (
+                                    select SKU from BAS_SKU where ALTERNATE_SKU1='" . $barCode . "' union
+                                    select SKU from BAS_SKU where ALTERNATE_SKU2='" . $barCode . "' union
+                                    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)]);
+        if ($trackNumber) {
+            if ($this->checkUserOwnerAuth($trackNumber)) $tasks = DB::connection("oracle")->select(DB::raw($sql), [strtoupper($trackNumber)]);
             else $tasks = DB::connection("oracle")->select(DB::raw($sql), [$trackNumber]);
         }else {$tasks = DB::connection("oracle")->select(DB::raw($sql));}
         if (!$tasks) return [];
@@ -410,8 +429,8 @@ sql;
     public function checkUserOwnerAuth($owner_code): bool
     {
         $owner_codes = app('OwnerService')->getIntersectPermitting(['code']);
-        $owner=$owner_codes->where('code','=',strtoupper($owner_code));
-        if ($owner->count()>0)return true;
+        $owner = $owner_codes->where('code', '=', strtoupper($owner_code));
+        if ($owner->count() > 0) return true;
         else return false;
     }
 
@@ -425,8 +444,8 @@ sql;
         if (!$tasks) return false; //获取任务失败
         return DB::connection("oracle")->transaction(function () use ($tasks, $info) { //单体嵌套事务 回滚FLUX失败任务
             foreach ($tasks as $task) {
-                $res=$this->checkExpiryPa($task,$info['location']);
-                if ($res!==true)return $res;
+                $res = $this->checkExpiryPa($task, $info['location']);
+                if ($res !== true) return $res;
                 if (!app("StorageService")->fluxPA($task, $info['location'])) {
                     DB::connection("oracle")->rollBack();
                     return false; //上架失败
@@ -442,16 +461,16 @@ sql;
      * @return bool|int
      * 上架校验效期
      */
-    public function checkExpiryPa($task,$location)
+    public function checkExpiryPa($task, $location)
     {
-        if (!$task->taskid)return 0;//任务id不存在
-        if (strpos($task->taskid,'MIX') !== false)return true;//合并拣货,不校验
+        if (!$task->taskid) return 0;//任务id不存在
+        if (strpos($task->taskid, 'MIX') !== false) return true;//合并拣货,不校验
 
         $sql = <<<sql
 select instr(DESCR,'拣货') as var_IsPickingArea from BAS_Zone where ZONE=(select PutawayZone from BAS_Location where LocationID = ?)
 sql;
         $basZone = DB::connection("oracle")->selectOne(DB::raw($sql), [$location]);
-        if ($basZone&&$basZone->var_ispickingarea>0) return true; //不是存储区,不校验
+        if ($basZone && $basZone->var_ispickingarea > 0) return true; //不是存储区,不校验
 
         $sql1 = <<<sql
 select SKU,LotAtt02,CustomerID from INV_LOT_ATT WHERE LOTNUM=?
@@ -468,8 +487,8 @@ sql;
       and attres.LotAtt02 > ?
       and zone.DESCR like '%拣货%'
 sql;
-        $invLotLocId=DB::connection("oracle")->selectOne(DB::raw($sql2), [$invLotAtt->sku,$invLotAtt->customerid,$task->fmlotnum,$invLotAtt->lotatt02]);
-        if ($invLotLocId&&$invLotLocId->var_amountofdecaying>0)return 1;//拣货区找到效期更新的同样货品,不能上架至存储区
+        $invLotLocId = DB::connection("oracle")->selectOne(DB::raw($sql2), [$invLotAtt->sku, $invLotAtt->customerid, $task->fmlotnum, $invLotAtt->lotatt02]);
+        if ($invLotLocId && $invLotLocId->var_amountofdecaying > 0) return 1;//拣货区找到效期更新的同样货品,不能上架至存储区
         return true;
     }
 
@@ -507,10 +526,11 @@ sql;
 
 
     /**
-     * @throws \Throwable
+     * @param array $info
+     * @return bool
      * fulx 手持收货
      */
-    public function fluxHandIn(array $info)
+    public function fluxHandIn(array $info): bool
     {
         $lotatt = array_filter($info, function ($key) {
             return strpos($key, 'lotatt') === 0;
@@ -526,27 +546,51 @@ sql;
         }
         $who = 'WAS' . (Auth::user() ? '-' . Auth::user()["name"] : '');
         $time = Carbon::now()->toDateTimeString();
-        return DB::connection("oracle")->transaction(function () use ($info, $invlotatt, $who, $time) {
+        $db = DB::connection("oracle");
+        $db->beginTransaction();
+        try {
+//        return DB::connection("oracle")->transaction(function () use ($info, $invlotatt, $who, $time) {
             //flux 批次号
             $lotNum = $this->getOrCreateLotNum($info, $invlotatt, $who, $time);
-            if (!$lotNum) return false;
+            if (!$lotNum){
+                $db->rollBack();
+                return false;
+            }
 
             //flux 创建入库事务
             $actTransactionLog = $this->setFluxActTransactionLog($info, $lotNum, $who, $time);
-            if (count($actTransactionLog)==0) return false;
-
+            if (count($actTransactionLog) == 0){
+                $db->rollBack();
+                return false;
+            }
             //flux 创建上架任务
             $this->setFluxTskTaskListPA($info, $invlotatt, $actTransactionLog, $who, $time);
             //flux 完善库存余量
             $this->updateFluxInv($info, $lotNum, $who, $time, $actTransactionLog);
             //flux 更新asn_detail 和 asn_header 状态
-            return $this->updateFluxAsn($info, $invlotatt, $time, $who);
-        });
+            $result=$this->updateFluxAsn($info, $invlotatt, $time, $who);
+            if ($result){
+                $db->commit();
+                return true;
+            }else{
+                $db->rollBack();
+                return false;
+            }
+//        });
+        } catch (\Exception $e) {
+            $db->rollBack();
+            return false;
+        }
 
     }
 
     /**
-     * @throws \Throwable
+     * @param array $info
+     * @param array $invlotatt
+     * @param $time
+     * @param $who
+     * @return bool
+     * 更新asn状态
      */
     public function updateFluxAsn(array $info, array $invlotatt, $time, $who): bool
     {
@@ -565,59 +609,64 @@ sql;
                 $asnDetail['customerid'] == $info['customerid'] &&
                 $asnDetail['sku'] == $info['sku']) $receiveAsn = $asnDetail;
         }
-        return $db->transaction(function () use ($db, $info, $receiveAsn, $invlotatt, $time, $who, $asn) {
-            if ($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 = '30',holdrejectcode ='OK',
+//        return $db->transaction(function () use ($db, $info, $receiveAsn, $invlotatt, $time, $who, $asn) {
+        if ($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 = '30',holdrejectcode ='OK',
                 reserve_flag ='Y',edittime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),receivedtime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),editwho = ?,
              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'],
-                        $invlotatt['lotatt05'], $invlotatt['lotatt06'], $invlotatt['lotatt07'], $invlotatt['lotatt08'], $info['asnno'], $info['asnlineno']]);
+                [(int)$info['amount'], (int)$info['amount'], $time, $time, $who, $invlotatt['lotatt01'], $invlotatt['lotatt02'], $invlotatt['lotatt03'], $invlotatt['lotatt04'],
+                    $invlotatt['lotatt05'], $invlotatt['lotatt06'], $invlotatt['lotatt07'], $invlotatt['lotatt08'], $info['asnno'], $info['asnlineno']]);
+            //asn_header 部分收货状态
+            $db->update(DB::raw("UPDATE DOC_ASN_HEADER SET asnstatus = '30',edittime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),editwho = ? WHERE asnno = ?"),
+                [$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',
+                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'],
+                    $invlotatt['lotatt05'], $invlotatt['lotatt06'], $invlotatt['lotatt07'], $invlotatt['lotatt08'], $info['asnno'], $info['asnlineno']]);
+            //当asn_detail 所有状态都为完全收货是  asn_header 状态修改为 完全收货(asnstatus=40)
+            if (OracleDOCASNDetail::query()->where('asnno', $info['asnno'])->where('linestatus', 40)->count() == $asn->asn_details_count) {
+                $db->update(DB::raw("UPDATE DOC_ASN_HEADER SET asnstatus = '40',edittime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),editwho = ? WHERE asnno = ?"),
+                    [$time, $who, $info['asnno']]);
+            } else {
                 //asn_header 部分收货状态
                 $db->update(DB::raw("UPDATE DOC_ASN_HEADER SET asnstatus = '30',edittime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),editwho = ? WHERE asnno = ?"),
                     [$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',
-                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'],
-                        $invlotatt['lotatt05'], $invlotatt['lotatt06'], $invlotatt['lotatt07'], $invlotatt['lotatt08'], $info['asnno'], $info['asnlineno']]);
-                //当asn_detail 所有状态都为完全收货是  asn_header 状态修改为 完全收货(asnstatus=40)
-                if (OracleDOCASNDetail::query()->where('asnno', $info['asnno'])->where('linestatus', 40)->count() == $asn->asn_details_count) {
-                    $db->update(DB::raw("UPDATE DOC_ASN_HEADER SET asnstatus = '40',edittime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),editwho = ? WHERE asnno = ?"),
-                        [$time, $who, $info['asnno']]);
-                } else {
-                    //asn_header 部分收货状态
-                    $db->update(DB::raw("UPDATE DOC_ASN_HEADER SET asnstatus = '30',edittime = TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),editwho = ? WHERE asnno = ?"),
-                        [$time, $who, $info['asnno']]);
-                }
             }
-            return true;
-        });
+        }
+        return true;
+//        });
     }
 
     /**
-     * @throws \Throwable
+     * @param array $info
+     * @param $lotNum
+     * @param $who
+     * @param $time
+     * @param array $actTransactionLog
+     * 更新flux 库存
      */
     public function updateFluxInv(array $info, $lotNum, $who, $time, array $actTransactionLog)
     {
         $db = DB::connection("oracle");
-        $db->transaction(function () use ($db, $info, $lotNum, $actTransactionLog, $who, $time) {
-            //更新 inv_lot 批次 库存表
-            $invLot = $db->selectOne(DB::raw("SELECT * FROM INV_LOT WHERE lotnum = ? AND customerid = ? AND sku = ? "), [
-                $lotNum, $info['customerid'], $info['sku']
-            ]);
-            if ($invLot) $db->update(DB::raw("UPDATE INV_LOT SET qty = qty+?,edittime=?,editwho=? WHERE lotnum = ? AND customerid = ? AND sku = ?"), [
-                (int)$info['amount'], $time, $who, $lotNum, $info['customerid'], $info['sku'],
-            ]);
-            else $db->insert(DB::raw("INSERT INTO INV_LOT VALUES(?,?,?,?,0,0,0,0,0,0,0,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?)"), [
-                $lotNum, $info['customerid'], $info['sku'], $info['amount'], $time, $who, $time, $who
-            ]);
-            //更新 inv_lot_loc_id 批次/库位/跟踪号 库存表
-            $invLotId = $db->selectOne(DB::raw("SELECT * FROM inv_lot_loc_id WHERE lotnum = ? AND locationid = ? AND customerid = ? AND sku = ? AND traceid = ? FOR UPDATE"), [
-                $lotNum, $actTransactionLog['location'], $actTransactionLog['customerid'], $actTransactionLog['sku'], $actTransactionLog['trackid']
-            ]);
+//        $db->transaction(function () use ($db, $info, $lotNum, $actTransactionLog, $who, $time) {
+        //更新 inv_lot 批次 库存表
+        $invLot = $db->selectOne(DB::raw("SELECT * FROM INV_LOT WHERE lotnum = ? AND customerid = ? AND sku = ? "), [
+            $lotNum, $info['customerid'], $info['sku']
+        ]);
+        if ($invLot) $db->update(DB::raw("UPDATE INV_LOT SET qty = qty+?,edittime=?,editwho=? WHERE lotnum = ? AND customerid = ? AND sku = ?"), [
+            (int)$info['amount'], $time, $who, $lotNum, $info['customerid'], $info['sku'],
+        ]);
+        else $db->insert(DB::raw("INSERT INTO INV_LOT VALUES(?,?,?,?,0,0,0,0,0,0,0,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?)"), [
+            $lotNum, $info['customerid'], $info['sku'], $info['amount'], $time, $who, $time, $who
+        ]);
+        //更新 inv_lot_loc_id 批次/库位/跟踪号 库存表
+        $invLotId = $db->selectOne(DB::raw("SELECT * FROM inv_lot_loc_id WHERE lotnum = ? AND locationid = ? AND customerid = ? AND sku = ? AND traceid = ? FOR UPDATE"), [
+            $lotNum, $actTransactionLog['location'], $actTransactionLog['customerid'], $actTransactionLog['sku'], $actTransactionLog['trackid']
+        ]);
 
 //            if ($info['location']) { //存在目标库位
 //                $invLotIdHasPreLocation = $db->selectOne(DB::raw("SELECT * FROM inv_lot_loc_id WHERE lotnum = ? AND locationid = ? AND customerid = ? AND sku = ? AND traceid = ? FOR UPDATE"), [
@@ -643,36 +692,41 @@ sql;
 //                }
 //
 //            }
-                if ($invLotId) $db->update(DB::raw("UPDATE inv_lot_loc_id SET qty = qty+?,qtymvout = qtymvout+?,edittime=?,editwho=? WHERE lotnum = ? AND locationid = ? AND traceid = ?"), [
-                    (int)$info['amount'],(int)$info['amount'], $time, $who, $lotNum, $actTransactionLog['location'], $actTransactionLog['trackid']
-                ]);
-                else $db->insert(DB::raw("INSERT INTO inv_lot_loc_id VALUES(?,?,?,?,?,?,0,0,0,0,?,0,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,0,0,0,0,0,'*',0,null)"), [
-                    $lotNum, $actTransactionLog['location'], $actTransactionLog['trackid'], $actTransactionLog['customerid'], $actTransactionLog['sku'], (int)$info['amount'], (int)$info['amount'], $time, $who, $time, $who,
-                ]);
-        });
+        if ($invLotId) $db->update(DB::raw("UPDATE inv_lot_loc_id SET qty = qty+?,qtymvout = qtymvout+?,edittime=?,editwho=? WHERE lotnum = ? AND locationid = ? AND traceid = ?"), [
+            (int)$info['amount'], (int)$info['amount'], $time, $who, $lotNum, $actTransactionLog['location'], $actTransactionLog['trackid']
+        ]);
+        else $db->insert(DB::raw("INSERT INTO inv_lot_loc_id VALUES(?,?,?,?,?,?,0,0,0,0,?,0,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,0,0,0,0,0,'*',0,null)"), [
+            $lotNum, $actTransactionLog['location'], $actTransactionLog['trackid'], $actTransactionLog['customerid'], $actTransactionLog['sku'], (int)$info['amount'], (int)$info['amount'], $time, $who, $time, $who,
+        ]);
+//        });
     }
 
     /**
-     * @throws \Throwable
+     * @param array $info
+     * @param array $invlotatt
+     * @param $actTransactionLog
+     * @param $who
+     * @param $time
+     * 生成上架任务
      */
     public function setFluxTskTaskListPA(array $info, array $invlotatt, $actTransactionLog, $who, $time)
     {
         $db = DB::connection("oracle");
-        $db->transaction(function () use ($db, $info, $invlotatt, $actTransactionLog, $who, $time) {
-            $sql = <<<sql
+//        $db->transaction(function () use ($db, $info, $invlotatt, $actTransactionLog, $who, $time) {
+        $sql = <<<sql
 INSERT INTO TSK_TASKLISTS VALUES(?,'1','PA',?,?,'ASN',?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,null,null,?,?,?,?,?,?,?,?,null,null,null,null,
     0,0,0,0,null,?,null,null,null,?,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),null,null,?,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),'N',null,null,
     ?,?,?,'N',null,?,'*',null,null,null,'N',null,null)
 sql;
-            $db->insert(DB::raw($sql), [
-                $actTransactionLog['tsid'], $actTransactionLog['customerid'], $actTransactionLog['sku'], $actTransactionLog['docno'], $actTransactionLog['doclineno'],
-                $actTransactionLog['lotNum'], $actTransactionLog['packid'], 'EA', $info['amount'], $info['amount'], $actTransactionLog['location'], $actTransactionLog['location'],
-                $actTransactionLog['trackid'], $actTransactionLog['lotNum'], $actTransactionLog['packid'], 'EA', $info['amount'], $info['amount'],
-                $info['location'], $info['location'], $actTransactionLog['trackid'], '00', 'Putaway Task', '3', $invlotatt['lotatt01'], $invlotatt['lotatt02'], $invlotatt['lotatt03'], $invlotatt['lotatt04'],
-                $invlotatt['lotatt05'], $invlotatt['lotatt06'], $invlotatt['lotatt07'], $invlotatt['lotatt08'], $actTransactionLog['trid'], $who, $time, null, null, null, null,
-                $actTransactionLog['userdefine1'], $actTransactionLog['userdefine2'], $actTransactionLog['userdefine3'], $actTransactionLog['warehouseid']
-            ]);
-        });
+        $db->insert(DB::raw($sql), [
+            $actTransactionLog['tsid'], $actTransactionLog['customerid'], $actTransactionLog['sku'], $actTransactionLog['docno'], $actTransactionLog['doclineno'],
+            $actTransactionLog['lotNum'], $actTransactionLog['packid'], 'EA', $info['amount'], $info['amount'], $actTransactionLog['location'], $actTransactionLog['location'],
+            $actTransactionLog['trackid'], $actTransactionLog['lotNum'], $actTransactionLog['packid'], 'EA', $info['amount'], $info['amount'],
+            $info['location'], $info['location'], $actTransactionLog['trackid'], '00', 'Putaway Task', '3', $invlotatt['lotatt01'], $invlotatt['lotatt02'], $invlotatt['lotatt03'], $invlotatt['lotatt04'],
+            $invlotatt['lotatt05'], $invlotatt['lotatt06'], $invlotatt['lotatt07'], $invlotatt['lotatt08'], $actTransactionLog['trid'], $who, $time, null, null, null, null,
+            $actTransactionLog['userdefine1'], $actTransactionLog['userdefine2'], $actTransactionLog['userdefine3'], $actTransactionLog['warehouseid']
+        ]);
+//        });
     }
 
     /**
@@ -680,54 +734,55 @@ sql;
      * @param $lotNum
      * @param $who
      * @param $time
-     * @return mixed
-     * @throws \Throwable
+     * @return array
      * 创建入库事务
      */
-    public function setFluxActTransactionLog(array $info, $lotNum, $who, $time)
+    public function setFluxActTransactionLog(array $info, $lotNum, $who, $time): array
     {
         $db = DB::connection("oracle");
-        return $db->transaction(function () use ($db, $info, $lotNum, $time, $who) {
-            if ($info['trackNumber']) $trackNumber = $info['trackNumber'];
-            else $trackNumber = substr(md5($time), 0, 30);
-            $asnHeader = OracleDOCASNHeader::query()->where('asnno', $info['asnno'])->first();
-            $asnDetail = OracleDOCASNDetail::query()->where('asnno', $info['asnno'])
-                ->where('asnlineno',$info['asnlineno'])->where('sku', $info['sku'])->first();
-            //添加超收判断
-            $actTransactionLogQty=OracleActTransactionLog::query()->where('docno',$info['asnno'])
-                ->where('doclineno',$info['asnlineno'])->where('fmsku', $info['sku'])->count('fmqty');
-            if ((int)($info['amount']+$actTransactionLogQty)>(int)$asnDetail['expectedqty'])return [];
-
-            $sql = <<<sql
+//        return $db->transaction(function () use ($db, $info, $lotNum, $time, $who) {
+        if ($info['trackNumber']) $trackNumber = $info['trackNumber'];
+        else $trackNumber = substr(md5($time), 0, 30);
+        $asnHeader = OracleDOCASNHeader::query()->where('asnno', $info['asnno'])->first();
+        $asnDetail = OracleDOCASNDetail::query()->where('asnno', $info['asnno'])
+            ->where('asnlineno', $info['asnlineno'])->where('sku', $info['sku'])->first();
+        //添加超收判断
+        $actTransactionLogQty = OracleActTransactionLog::query()->where('docno', $info['asnno'])
+            ->where('doclineno', $info['asnlineno'])->where('fmsku', $info['sku'])->count('fmqty');
+        if ((int)($info['amount'] + $actTransactionLogQty) > (int)$asnDetail['expectedqty']) return [];
+
+        $sql = <<<sql
 INSERT INTO ACT_TRANSACTION_LOG VALUES(?,'IN',?,?,?,?,'ASN',?,?,?,?,?,?,?,?,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,?,?,?,?,?,?,?,?,
 ?,?,?,?,'1','Y',null,?,?,?,?,null,null,?,null,null)
 sql;
-            list($trid, $max) = app('StorageService')->getTrNumber();
-            list($tsid, $max) = $this->getTsNum();
-            $db->insert(DB::raw($sql), [
-                $trid, $asnDetail->customerid, $asnDetail->sku,
-                $asnDetail->asnno, $asnDetail->asnlineno, $lotNum, $asnDetail->receivinglocation, '*', $asnDetail->packid, 'EA', $info['amount'], $info['amount'], '99', $time, $who,
-                $time, $who, $time, $asnDetail->customerid, $asnDetail->sku, $trackNumber, $asnDetail->receivinglocation, $who, $asnDetail->packid, 'EA', $info['amount'], $info['amount'], $lotNum,
-                '*', '0', 'N', $tsid, substr($asnDetail->receivinglocation, -4), $asnHeader->userdefine1, $asnHeader->userdefine2,
-                $asnHeader->userdefine3, 'O'
-            ]);
-            app('StorageService')->setTrNumber();
-            $this->setTsNum();
-            $actTransactionLog = [
-                'trid' => $trid, 'docno' => $asnDetail->asnno, 'customerid' => $asnDetail->customerid, 'sku' => $asnDetail->sku, 'doclineno' => $asnDetail->asnlineno, 'lotNum' => $lotNum, 'location' => $asnDetail->receivinglocation,
-                'packid' => $asnDetail->packid, 'tsid' => $tsid, 'warehouseid' => substr($asnDetail->receivinglocation, -4), 'userdefine1' => $asnHeader->userdefine1, 'userdefine2' => $asnHeader->userdefine2,
-                'userdefine3' => $asnHeader->userdefine3, 'trackid' => $trackNumber
-            ];
-            return $actTransactionLog;
-        });
+        list($trid, $max) = app('StorageService')->getTrNumber();
+        list($tsid, $max) = $this->getTsNum();
+        $db->insert(DB::raw($sql), [
+            $trid, $asnDetail->customerid, $asnDetail->sku,
+            $asnDetail->asnno, $asnDetail->asnlineno, $lotNum, $asnDetail->receivinglocation, '*', $asnDetail->packid, 'EA', $info['amount'], $info['amount'], '99', $time, $who,
+            $time, $who, $time, $asnDetail->customerid, $asnDetail->sku, $trackNumber, $asnDetail->receivinglocation, $who, $asnDetail->packid, 'EA', $info['amount'], $info['amount'], $lotNum,
+            '*', '0', 'N', $tsid, substr($asnDetail->receivinglocation, -4), $asnHeader->userdefine1, $asnHeader->userdefine2,
+            $asnHeader->userdefine3, 'O'
+        ]);
+        app('StorageService')->setTrNumber();
+        $this->setTsNum();
+        $actTransactionLog = [
+            'trid' => $trid, 'docno' => $asnDetail->asnno, 'customerid' => $asnDetail->customerid, 'sku' => $asnDetail->sku, 'doclineno' => $asnDetail->asnlineno, 'lotNum' => $lotNum, 'location' => $asnDetail->receivinglocation,
+            'packid' => $asnDetail->packid, 'tsid' => $tsid, 'warehouseid' => substr($asnDetail->receivinglocation, -4), 'userdefine1' => $asnHeader->userdefine1, 'userdefine2' => $asnHeader->userdefine2,
+            'userdefine3' => $asnHeader->userdefine3, 'trackid' => $trackNumber
+        ];
+        return $actTransactionLog;
+//        });
     }
 
     /**
      * @param array $info
+     * @param array $invlotatt
+     * @param $who
+     * @param $time
      * @return mixed
-     * @throws \Throwable
-     * 或去flux 批次号
+     * 获取flux 批次号
      */
     public function getOrCreateLotNum(array $info, array $invlotatt, $who, $time)
     {
@@ -739,18 +794,18 @@ sql;
 
         $db = DB::connection("oracle");
         list($num, $max) = $this->getLtNum();
-        return $db->transaction(function () use ($db, $info, $invlotatt, $num, $who, $time) {
-            $sql = <<<sql
+//        return $db->transaction(function () use ($db, $info, $invlotatt, $num, $who, $time) {
+        $sql = <<<sql
 INSERT INTO INV_LOT_ATT VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,
 TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?,TO_DATE(?,'yyyy-mm-dd hh24:mi:ss'),?)
 sql;
-            $db->insert(DB::raw($sql), [
-                $num, $info['customerid'], $info['sku'], $invlotatt['lotatt01'], $invlotatt['lotatt02'], $invlotatt['lotatt03'], $invlotatt['lotatt04'],
-                $invlotatt['lotatt05'], $invlotatt['lotatt06'], $invlotatt['lotatt07'], $invlotatt['lotatt08'], null, null, null, null, $time, $who, $time, $who, $time, null
-            ]);
-            $this->setLtNum();
-            return $num;
-        });
+        $db->insert(DB::raw($sql), [
+            $num, $info['customerid'], $info['sku'], $invlotatt['lotatt01'], $invlotatt['lotatt02'], $invlotatt['lotatt03'], $invlotatt['lotatt04'],
+            $invlotatt['lotatt05'], $invlotatt['lotatt06'], $invlotatt['lotatt07'], $invlotatt['lotatt08'], null, null, null, null, $time, $who, $time, $who, $time, null
+        ]);
+        $this->setLtNum();
+        return $num;
+//        });
 
     }
 
@@ -818,7 +873,7 @@ select BAS_SKU.SKU,INV_LOT_LOC_ID.CUSTOMERID,BAS_SKU.ALTERNATE_SKU1,INV_LOT_LOC_
 sql;
         if ($this->checkUserOwnerAuth($param)) { //输入条件为货主
             $sql .= ' INV_LOT_LOC_ID.CUSTOMERID= ?';
-        } else if (preg_match('/^[A-Z]{1,3}[0-9]{2,3}[-][0-9]{2,3}[-][0-9]{2,3}$/', $param)) { //判断是否为库位
+        } else if (preg_match('/^[A-Z]{1,3}[0-9]{2,3}[-][0-9]{2,3}[-][0-9]{2,3}$/', $param) ||strpos($param,'IDE') !== false) { //判断是否为库位
             $sql .= ' INV_LOT_LOC_ID.LOCATIONID= ?';
         } else {
             $sql .= " BAS_SKU.SKU in (  select SKU from BAS_SKU where ALTERNATE_SKU1=? union
@@ -829,13 +884,13 @@ sql;
 
         $sql .= ' group by BAS_SKU.SKU,INV_LOT_LOC_ID.CUSTOMERID,BAS_SKU.ALTERNATE_SKU1,INV_LOT_LOC_ID.LOCATIONID,
         INV_LOT_ATT.LOTATT05,INV_LOT_ATT.LOTATT08,INV_LOT_ATT.LOTATT01,INV_LOT_ATT.LOTATT02,INV_LOT_ATT.LOTATT03,INV_LOT_ATT.LOTATT04';
-        if ($this->checkUserOwnerAuth($param)){
+        if ($this->checkUserOwnerAuth($param)) {
             $invLots = DB::connection("oracle")->select(DB::raw($sql), [strtoupper($param)
             ]);
-        }else if(preg_match('/^[A-Z]{1,3}[0-9]{2,3}[-][0-9]{2,3}[-][0-9]{2,3}$/', $param)){
+        }else if(preg_match('/^[A-Z]{1,3}[0-9]{2,3}[-][0-9]{2,3}[-][0-9]{2,3}$/', $param) ||strpos($param,'IDE') !== false){
             $invLots = DB::connection("oracle")->select(DB::raw($sql), [$param]);
-        }else{
-            $invLots = DB::connection("oracle")->select(DB::raw($sql), [$param,$param,$param,$param]);
+        } else {
+            $invLots = DB::connection("oracle")->select(DB::raw($sql), [$param, $param, $param, $param]);
         }
         if (!$invLots) return [];
         else return $invLots;

+ 14 - 0
app/Services/InventoryAccountService.php

@@ -77,21 +77,25 @@ class InventoryAccountService
         $sql.=' , storeStatus.QTY 在库数量, storeStatus.QtyAllocated 占用数量,count(1) over () as sum from ';
         $sql.=' (select FMLotNum,FMSKU,TOCustomerID 客户,0 as 移出数量, sum(TOQty_Each) as 移入数量, TOLocation as 库位 ';
         $sql.=" from ACT_Transaction_Log where TransactionType='PA' ";
+        if ($code)$sql.=" and TOCustomerID = '".$code."' ";
         if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
         if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
         $sql.=' group by TOCustomerID, TOLocation,FMSKU,FMLotNum union all ';
         $sql.=' select FMLotNum,FMSKU,FMCUSTOMERID 客户,sum(FMQty_Each) as 移出数量, 0 as 移入数量, FMLOCATION as 库位 ';
         $sql.=" from ACT_Transaction_Log where TransactionType='SO' ";
+        if ($code)$sql.=" and FMCUSTOMERID = '".$code."' ";
         if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
         if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
         $sql.=' group by FMCustomerID, FMLocation,FMSKU,FMLotNum union all ';
         $sql.=' select FMLotNum,FMSKU,FMCUSTOMERID 客户,sum(FMQty_Each) as 移出数量,0 as 移入数量, FMLocation as 库位 ';
         $sql.=" from ACT_Transaction_Log  where TransactionType='MV' ";
+        if ($code)$sql.=" and FMCUSTOMERID = '".$code."' ";
         if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
         if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
         $sql.=' group by FMLocation,FMCUSTOMERID,FMSKU,FMLotNum union all ';
         $sql.=' select FMLotNum,FMSKU,TOCustomerID 客户,0 as 移出数量,sum(TOQty_Each)as 移入数量, TOLocation as 库位 ';
         $sql.=" from ACT_Transaction_Log where TransactionType='MV' ";
+        if ($code)$sql.=" and TOCustomerID = '".$code."' ";
         if ($date_start) $sql.=" and addtime > to_date('".$date_start." 00:00:00','yyyy-mm-dd hh24:mi:ss') ";
         if ($date_end) $sql.=" and addtime < to_date('".$date_end." 23:59:59','yyyy-mm-dd hh24:mi:ss') ";
         $sql.=' group by TOLocation,TOCustomerID,FMSKU,FMLotNum)stockLog ';
@@ -211,7 +215,17 @@ class InventoryAccountService
             if ($location||$barcode)$type='局部盘点';
             if (!$location&&!$barcode)$type='动盘';
             $wmsInventories=$this->conditionPortStock($date_start,$date_end,$ownerId,$location,$barcode);
+            //动盘  判断库存为0的ide料想是否放有其他商品
+            foreach ($wmsInventories as $key=>$wmsInventory){
+                if (!$wmsInventory->在库数量 && strpos($wmsInventory->库位,'IDE') !== false){
+                    /** @var HandInStorageService $handInStorageService  */
+                    $handInStorageService=app('HandInStorageService');
+                    $invs=$handInStorageService->getInventoryInfos($wmsInventory->库位);
+                    if (count($invs)>0) unset($wmsInventories[$key]);
+                }
+            }
         }
+
         if (!$date_start&&!$date_end){
             $ownerName=Owner::where('id',$ownerId)->value('code');
             //$ownerName=OracleBasCustomer::where('customer_type','OW')->where('active_flag','Y')->where('descr_c',$name)->value('customerid');

+ 2 - 2
app/Services/OrderService.php

@@ -188,7 +188,8 @@ class OrderService
         }
         if ($soreference5){
             $soreference5 = str_replace("'",'"',$soreference5);
-            $arr=array_values(array_filter(preg_split('/[,, ]+/is', $soreference5)));
+            mb_regex_encoding('utf-8');
+            $arr=array_values(array_filter(preg_split('/[,, ]+/u', $soreference5,-1,PREG_SPLIT_NO_EMPTY)));
             if (count($arr)>0){
                 $sql.=" and (soreference5 in (";
                 foreach ($arr as $index=>$str){
@@ -348,7 +349,6 @@ class OrderService
             $params['soreference']='';
             $sql = $this->getSql($params,$params['page'] ?? 1, $params['paginate'] ?? 50);
         }
-
         if ($sql)$orders=DB::connection('oracle')->select(DB::raw($sql));
         else $orders = [];
         return $this->orderFormat($orders);

+ 1 - 2
app/Services/StationService.php

@@ -199,8 +199,7 @@ class StationService
     public function locationFreed(?string $location, ?int $boxId=null):int
     {
         if (!$location)return 0;
-        $update = ["status"=>0];
-        if ($boxId)$update["material_box_id"]=$boxId;
+        $update = ["status"=>0,"material_box_id"=>$boxId];
         return Station::query()->where("code",$location)->update($update);
     }
 

+ 2 - 2
app/Services/StationTaskBatchService.php

@@ -136,7 +136,7 @@ class StationTaskBatchService
      * @return Collection|\Tightenco\Collect\Support\Collection|null 返回执行失败的记录
      * @throws ErrorException
      */
-    function runMany(?Collection $stationTaskBatches, $locationType = 'OUTBIN-U-SHAPE-LINE'):?Collection
+    function runMany(?Collection $stationTaskBatches,string $locationType = 'OUTBIN-U-SHAPE-LINE'):?Collection
     {
         LogService::log(__METHOD__,'runMany','波次任务分配6.1:'.json_encode($stationTaskBatches));
         $stationTaskBatches_failed = null;
@@ -171,7 +171,7 @@ class StationTaskBatchService
      * @return bool
      * @throws ErrorException
      */
-    function run(StationTaskBatch $stationTaskBatch, $locationType): bool
+    function run(StationTaskBatch $stationTaskBatch,string $locationType): bool
     {
         $this->instant($this->foreignHaiRoboticsService,'ForeignHaiRoboticsService');
         $this->instant($this->stationService,'StationService');

+ 13 - 4
app/Services/StationTaskMaterialBoxService.php

@@ -5,10 +5,12 @@ namespace App\Services;
 
 
 use App\Batch;
+use App\Components\ErrorPush;
 use App\Exceptions\ErrorException;
 use App\Jobs\CacheShelfTaskJob;
 use App\MaterialBox;
 use App\OrderCommodity;
+use App\Station;
 use App\StationTask;
 use App\StationTaskMaterialBox;
 use Carbon\Carbon;
@@ -20,7 +22,7 @@ use Illuminate\Support\Facades\DB;
 
 class StationTaskMaterialBoxService
 {
-    use ServiceAppAop;
+    use ServiceAppAop,ErrorPush;
     protected $modelClass=StationTaskMaterialBox::class;
     /** @var StationService $stationService */
     private $stationService;
@@ -209,9 +211,16 @@ class StationTaskMaterialBoxService
      */
     function markHasTaken($stationTaskMaterialBox)
     {
-        $stationTaskMaterialBox->loadMissing("station");
         $this->instant($this->cacheShelfService,'CacheShelfService');
-        //维护缓存架可用度
+        //$stationTaskMaterialBox->loadMissing("station");
+        $this->push("1","取出料箱通知","任务信息:".$stationTaskMaterialBox->toJson());
+
+        //判断取出料箱是否是在缓存架
+        $station = Station::query()->where("material_box_id",$stationTaskMaterialBox->material_box_id)
+            ->first();
+        if ($station && app("StationService")->isHalfBoxLocation($station))
+            app("CacheShelfService")->boxHasBeenTaken($station);
+        /*//维护缓存架可用度
         $map = Cache::get("CACHE_SHELF_MAPPING",function (){return [];});
         if (isset($map[$stationTaskMaterialBox->material_box_id])){
             $available=Cache::get("CACHE_SHELF_AVAILABLE",function (){return [];});
@@ -220,7 +229,7 @@ class StationTaskMaterialBoxService
             CacheShelfTaskJob::dispatch("CACHE_SHELF_AVAILABLE",count($available))->delay(now()->addSeconds(config("haiRou.cacheShelf.outBinAwait")));
             unset($map[$stationTaskMaterialBox->material_box_id]);
             Cache::forever("CACHE_SHELF_MAPPING",$map);
-        }
+        }*/
     }
 
     function processNextQueued(?StationTaskMaterialBox $stationTaskMaterialBox_lastProcessed){

+ 31 - 6
app/Services/StorageService.php

@@ -36,10 +36,8 @@ class StorageService
         DB::beginTransaction();
         try{
             $stationTaskMaterialBox->loadMissing("station");
-            //如果为半箱位置 清理原有任务
             if (!$stationTaskMaterialBox->station)return;
             if (app("StationService")->isHalfBoxLocation($stationTaskMaterialBox->station)){
-                app("StationService")->locationOccupy($stationTaskMaterialBox->station->code,$stationTaskMaterialBox->material_box_id);
                 //清除海柔库位信息
                 $this->clearTask([$stationTaskMaterialBox->station->code]);
                 $stationId = $stationTaskMaterialBox->station_id;
@@ -95,9 +93,13 @@ class StorageService
                             }
                             break;
                     }
-                    app("CacheShelfService")->lightUp($stationTaskMaterialBox->station->code,'2','0',$options);
                     Cache::forget("CACHE_SHELF_OCCUPANCY_{$stationTaskMaterialBox->station->id}");//关闭无限亮灯
-                }else app("StationService")->locationFreed($stationTaskMaterialBox->station->code); //释放库位占用
+                    app("StationService")->locationOccupy($stationTaskMaterialBox->station->code,$stationTaskMaterialBox->material_box_id);//料箱绑定缓存架
+                    app("CacheShelfService")->lightUp($stationTaskMaterialBox->station->code,'2','0',$options);
+                }else{
+                    app("StationService")->locationFreed($stationTaskMaterialBox->station->code); //释放库位占用
+                    app("CacheShelfService")->_stationCacheLightOff($stationTaskMaterialBox->station->code);//灭灯
+                }
             }
             DB::commit();
         }catch (\Exception $e){
@@ -495,7 +497,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 +506,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 +531,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 - 6
app/Station.php

@@ -23,8 +23,8 @@ class Station extends Model
      * CACHE_SHELF_OCCUPANCY_{ID}   //bool:缓存架占用标记,开启此标记后连续排灯无效
      * CACHE_SHELF_MAPPING          //array(map):缓存架映射标记,用来映射入库任务的真实库位 CacheShelfTaskJob:materialBoxMappingCacheShelf详细描述此流程
      * CACHE_SHELF_AVAILABLE        //array(map):缓存架可用标记,映射缓存架是否可以被下达出库任务
+     * CACHE_SHELF_AVAILABLE        //array(map):缓存架可用计数器,来标识这个已取出箱子的缓存架数量,这个标识用来判定缓存架一定时间内是否仍然被操作,如果缓存架停止操作则开启处理
      * */
-
     public function task()
     {
         return $this->hasOne(StationTaskMaterialBox::class,"station_id","id");
@@ -67,9 +67,4 @@ class Station extends Model
             ->where('status','=','待处理');
     }
 
-    public function storage(): HasOne
-    {
-        return $this->hasOne(Storage::class);
-    }
-
 }

+ 2 - 6
app/User.php

@@ -119,12 +119,8 @@ class User extends Authenticatable
             });
             return $ownerIds;
         }
-        return array_column(DB::table("owner_role")->whereIn("role_id",array_column($this->roles->toArray(),"id"))->get()->toArray(),"owner_id");
-        /*$this->authorities()->each(function(Authority $authority)use(&$ownerIds){
-            $ownerId=$authority->getOwnerIdAttribute();
-            if($ownerId){array_push($ownerIds,$ownerId);}
-        });
-        return array_unique($ownerIds);*/
+        return array_column(DB::table("owner_role")->whereIn("role_id",
+            array_column($this->roles->toArray(),"id"))->get()->toArray(),"owner_id");
     }
     function getPermittingWorkgroupIds($allowAll=false){
         $workgroupIds=[];

+ 23 - 1
resources/sass/animation.css

@@ -27,4 +27,26 @@
 {
     from {top:0;}
     to {top:-50px;}
-}
+}
+
+.translationRtoL{
+    animation:moveRtoL 500ms 1;
+    -moz-animation:moveRtoL 500ms 1; /* Firefox */
+    -webkit-animation:moveRtoL 500ms 1; /* Safari and Chrome */
+    -o-animation:moveRtoL 500ms 1;/* Opera */
+}
+@keyframes moveRtoL { from {left:0;} to {left:-50px;} }
+@-moz-keyframes moveRtoL { from {left:0;} to {left:-50px;} }
+@-webkit-keyframes moveRtoL { from {left:0;} to {left:-50px;} }
+@-o-keyframes moveRtoL { from {left:0;} to {left:-50px;} }
+
+.translationLtoR{
+    animation:moveLtoR 500ms 1;
+    -moz-animation:moveLtoR 500ms 1; /* Firefox */
+    -webkit-animation:moveLtoR 500ms 1; /* Safari and Chrome */
+    -o-animation:moveLtoR 500ms 1;/* Opera */
+}
+@keyframes moveLtoR { from {right:0;} to {right:-50px;} }
+@-moz-keyframes moveLtoR { from {right:0;} to {right:-50px;} }
+@-webkit-keyframes moveLtoR { from {right:0;} to {right:-50px;} }
+@-o-keyframes moveLtoR { from {right:0;} to {right:-50px;} }

+ 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;
                 },

+ 7 - 2
resources/views/package/logistic/index.blade.php

@@ -157,6 +157,7 @@
                     </td>
                     <!--退件状态-->
                     <td>@{{ package.rejected_bill?'有':'无' }}</td>
+                    <td>@{{ package.order.oracle_d_o_c_order_header.notes??'' }}</td>
                     <td  class="m-0 p-0 order-package-remarks" style="padding-left: 0 !important;padding-right: 0 !important">
                         @can('包裹管理-快递-客服备注')
                         <label :for="'create_remark_'+package.id" class="btn-create-remark" @click="package.input_remark=!package.input_remark">
@@ -366,7 +367,6 @@
                             placeholder: '是否有物流信息',
                             data: [{name: '是', value: '是'}, {name: '否', value: '否'}]
                         },
-                        {name: 'sent_at_end', type: 'dateTime', tip: '选择显示发出时间的截止时间'},
                         {
                             name: 'sync_routes_flag',
                             type: 'select',
@@ -374,7 +374,8 @@
                             placeholder: '是否有查询记录',
                             data: [{name: true, value: '是'}, {name: false, value: '否'}]
                         },
-                        {name: 'received_at_end', type: 'dateTime', tip: '选择显示收货时间的截止时间'},
+
+                        {name: 'sent_at_end', type: 'dateTime', tip: '选择显示发出时间的截止时间'},
                         {
                             name: 'is_issue',
                             type: 'select',
@@ -382,6 +383,7 @@
                             placeholder: '是否为问题件',
                             data: [{name: '是', value: '是'}, {name: '否', value: '否'}]
                         },
+                        {name: 'received_at_end', type: 'dateTime', tip: '选择显示收货时间的截止时间'},
                         {
                             name: 'is_new_rejecting',
                             type: 'select',
@@ -416,6 +418,8 @@
                                 {name: '无记录', value: '无记录'},
                             ]
                         },
+                        {name: 'order_notes', type: 'input', tip: '糊模查找需要在右边打上%符号', placeholder: '订单备注'},
+
                     ]
                 ];
                 _this.form = new query({
@@ -436,6 +440,7 @@
                     {name: 'weighed_at', value: '称重日期'},
                     {name: 'transfer_status', value: '快递路由'},
                     {name: 'is_new_rejecting', value: '退件状态'},
+                    {name: 'order_notes', value: '订单备注'},
                     {name: 'remark', value: '客服备注'},
                     {name: 'result_explain', value: '情况说明'},
                     {name: 'issue_type', value: '问题类别'},

+ 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
resources/views/store/handInStorage/receive.blade.php

@@ -51,7 +51,7 @@
                                                     <span><span class="small">条码:</span><span class="text-black font-weight-bold small">@{{ asnDetail.alternate_sku1 }}</span></span>
                                                     <span><span class="small">品名:</span><span class="text-black small">@{{ asnDetail.skudescrc }}</span></span>
                                                     <span><span class="small">预期数量:</span><span class="text-black font-weight-bold small">@{{ asnDetail.expectedqty }}</span></span>
-                                                    <span><span class="small">已收数量:</span><span class="text-black font-weight-bold small">@{{ asnDetail.receivedqty }}</span></span>
+                                                    <span><span class="small">已收数量:</span><span class="text-black font-weight-bold small">@{{ asnDetail.receivedqty?asnDetail.receivedqty:asnDetail.receivedqty_each }}</span></span>
                                                 <td/>
                                             </tr>
                                         </table>

+ 2 - 2
resources/views/store/handInStorage/receiveDetailPage.blade.php

@@ -67,7 +67,7 @@
                                         <span class="text-right float-right h5">选中:<input type="checkbox" @click="checked(asnDetail)"></span>
                                         <span><span class="text-lowercase h5">品名:</span><span class="text-lowercase h5">@{{ asnDetail.skudescrc }} </span></span>
                                         <span><span class="text-black h5">预期数量:</span><span class="text-black-50 h5">@{{ asnDetail.expectedqty }}</span></span>
-                                        <span><span class="text-black h5">已收数量:</span><span class="text-black-50 h5">@{{ asnDetail.receivedqty }}</span></span>
+                                        <span><span class="text-black h5">已收数量:</span><span class="text-black-50 h5">@{{ asnDetail.receivedqty?asnDetail.receivedqty:asnDetail.receivedqty_each }}</span></span>
                                     </div>
                                 </div>
                             </td>
@@ -258,7 +258,7 @@
                     this.info.sku=asnDetail.sku;
                     this.info.name=asnDetail.skudescrc;
                     this.info.expectedqty=asnDetail.expectedqty;
-                    this.info.receivedqty=asnDetail.receivedqty;
+                    this.info.receivedqty=asnDetail.receivedqty?asnDetail.receivedqty:asnDetail.receivedqty_each;
                     this.info.amount=Number(this.info.expectedqty)-Number(this.info.receivedqty);
                     this.info.asnlineno=asnDetail.asnlineno;
                 },

+ 116 - 83
resources/views/transport/waybill/delivering.blade.php

@@ -1,101 +1,102 @@
 @extends('layouts.app')
 @section('title')发运-运输管理@endsection
-
+@section("head")<link href="{{ mix('css/animation.css') }}" rel="stylesheet">@endsection
 @section('content')
     <div id="list" class="d-none container-fluid mt-2">
         <div class="card" v-for="(waybills,date) in groups">
-            <div class="card-header p-0 text-center" @click="selectedHeader(date)">
-                @{{ date }}
-                <i class="fa mr-2 pull-right" :class="header[date] ? 'fa-angle-down' : 'fa-angle-right'"></i>
+            <div class="card-header p-0 row" >
+                <div class="text-center" :class="slideStatus[date] ? 'col-8' : 'col-12'" @click="selectedHeader(date)" @touchstart="startSlide()" @touchend="endSlide(date)">
+                    @{{ date }}<i class="fa mr-2 pull-right" :class="header[date] ? 'fa-angle-down' : 'fa-angle-right'"></i>
+                </div>
+                <div class="col-4 bg-white" :class="slideStatus[date] ? '' : 'd-none'">
+                    专线费预留区域
+                </div>
             </div>
             <div class="card-body p-0" v-if="header[date]">
                 <div class="w-100 h-100 d-inline-block text-center" v-if="loadAnimation[date]">
                     <i class="fa fa-spinner fa-pulse"></i>
                 </div>
-                <div v-else>
-                    <table class="table table-striped table-sm table-bordered table-hover p-0 d-block d-sm-none" style="background: rgb(255, 255, 255);">
-                        <tbody>
-                        <tr v-for="waybill in waybills">
-                            <td style="filter:grayscale(30%); " :id="'waybill-'+waybill.id">
-                                <div :style="waybill.status!='已完结'?'background-color:#f6eee8':''" class="mt-3">
-                                    <div style="transform:scale(0.9)" class="pl-0">
-                                        <span class="mr-3 text-nowrap"><span style="color:#783000">日期:</span><span style="color:#af7651">@{{ waybill.deliver_at }}</span></span>
-                                        <span class="mr-3 text-nowrap"><span style="color:#783000">承运商:</span><span style="color:#af7651">@{{ waybill.carrier_name }}</span></span>
-                                        <span class="mr-3 text-nowrap"><span style="color:#783000">宝时运单号:</span><span style="color:#af7651">@{{ waybill.waybill_number }}</span><br></span>
-                                        <span class="mr-3 text-nowrap"><span style="color:#783000">目的地:</span><span style="color:#af7651">@{{ waybill.address }}</span><br></span>
-                                        <span class="mr-3 text-nowrap"><span style="color:#783000">收货人:</span><span style="color:#af7651">@{{ waybill.recipient }}</span></span>
-                                        <span class="mr-3 text-nowrap"><span style="color:#783000">提货仓:</span><span style="color:#af7651">@{{ waybill.origination }}</span></span>
-                                        <span class="mr-3 text-nowrap"><span style="color:#783000">预估重量:</span><span style="color:#af7651" v-if="waybill.warehouse_weight_other">@{{ waybill.warehouse_weight_other }} @{{ waybill.warehouse_weight_unit_other_name }}</span></span>
-                                        <span class="mr-3 text-nowrap"><span style="color:#783000">预估体积:</span><span style="color:#af7651" v-if="waybill.warehouse_weight">@{{ waybill.warehouse_weight }} @{{ waybill.warehouse_weight_unit_name }}</span></span>
-                                    </div>
-                                </div>
-                                <div style="background-color:#e8eef6"  class="mb-3">
-                                    <div style="transform:scale(0.9)" class="pl-0 form-inline">
-                                <span class="mr-3 text-nowrap form-inline"><span style="color:#02346a">专线运单号:</span>
-                                    <input :id="'carrier_bill'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_bill?'is-invalid tooltipTargetError':''"
-                                           :title="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_bill?errors['_'+waybill.id].carrier_bill[0]:''" v-if="waybill.isBtn || updatePool[waybill.id]" type="text" :value="waybill.carrier_bill"
-                                           class="form-control form-control-sm " @click="enlarge($event)"  style="width: 50px">
-                                    <span v-else  class="text-muted">@{{ waybill.carrier_bill }}</span>
-                                </span>
-                                        <span class="mr-3 text-nowrap form-inline"><span style="color:#02346a">查&nbsp;件&nbsp;电&nbsp;&nbsp;话:</span>
-                                    <input :id="'inquire_tel'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].inquire_tel?'is-invalid tooltipTargetError':''"
-                                           :title="errors['_'+waybill.id]&&errors['_'+waybill.id].inquire_tel?errors['_'+waybill.id].inquire_tel[0]:''" v-if="waybill.isBtn || updatePool[waybill.id]" type="text" :value="waybill.inquire_tel"
-                                           class="form-control form-control-sm" @click="enlarge($event)"  style="width:50px">
-                                    <span v-else  class="text-muted">@{{ waybill.inquire_tel }}</span>
-                                </span>
-                                        <span class="mr-3 text-nowrap form-inline"><span style="color:#02346a">数量:</span>
-                                    <span class="input-group input-group-sm" v-if="waybill.isBtn || updatePool[waybill.id]">
-                                        <input :id="'amount'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].amount?'is-invalid tooltipTargetError':''"
-                                               :title="errors['_'+waybill.id]&&errors['_'+waybill.id].amount?errors['_'+waybill.id].amount[0]:''" type="text" :value="waybill.amount"
-                                               class="form-control"
-                                               @click="enlarge($event)" style="width:50px">
-                                        <span class="input-group-append">
-                                          <span class="input-group-text">件</span>
-                                        </span>
-                                    </span>
-                                    <span v-else class="text-muted"><span v-if="waybill.amount">@{{ waybill.amount }} @{{ waybill.amount_unit_name }}</span></span>
-                                </span>
-                                        <span class="mr-3 text-nowrap form-inline"><span style="color:#02346a">重量:</span>
-                                    <span class="input-group input-group-sm" v-if="waybill.isBtn || updatePool[waybill.id]">
-                                        <input :id="'carrier_weight_other'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_weight_other?'is-invalid tooltipTargetError':''"
-                                               :title="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_weight_other?errors['_'+waybill.id].carrier_weight_other[0]:''" type="text" :value="waybill.carrier_weight_other"
-                                               class="form-control" @click="enlarge($event)" style="width:50px">
-                                        <span class="input-group-append">
-                                          <span class="input-group-text">KG</span>
-                                        </span>
-                                    </span>
-                                    <span v-else class="text-muted">@{{ waybill.carrier_weight_other }}</span>
-                                </span>
-                                        <span class="mr-3 text-nowrap form-inline"><span style="color:#02346a">体积:</span>
-                                    <span class="input-group input-group-sm" v-if="waybill.isBtn || updatePool[waybill.id]">
-                                        <input :id="'carrier_weight'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_weight?'is-invalid tooltipTargetError':''"
-                                               :title="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_weight?errors['_'+waybill.id].carrier_weight[0]:''" type="text" :value="waybill.carrier_weight"
-                                               class="form-control" @click="enlarge($event)" style="width:50px">
-                                        <span class="input-group-append">
-                                          <span class="input-group-text">M³</span>
-                                        </span>
+                <div v-else v-for="waybill in waybills" class="w-100 border border-1" style="filter:grayscale(30%); " :id="'waybill-'+waybill.id">
+                    <div :style="waybill.status!=='已完结'?'background-color:#f6eee8':''" class="mt-3">
+                        <div style="transform:scale(0.9);color:#783000" class="pl-0">
+                            <span class="mr-3 text-nowrap">日期:@{{ waybill.deliver_at }}</span>
+                            <span class="mr-3 text-nowrap">承运商:@{{ waybill.carrier_name }}</span>
+                            <span class="mr-3 text-nowrap">宝时运单号:@{{ waybill.waybill_number }}<br></span>
+                            <span class="mr-3 text-nowrap">目的地:@{{ waybill.address }}<br></span>
+                            <span class="mr-3 text-nowrap">收货人:@{{ waybill.recipient }}</span>
+                            <span class="mr-3 text-nowrap">提货仓:@{{ waybill.origination }}</span>
+                            <span class="mr-3 text-nowrap">预估重量:<span v-if="waybill.warehouse_weight_other">@{{ waybill.warehouse_weight_other }} @{{ waybill.warehouse_weight_unit_other_name }}</span></span>
+                            <span class="mr-3 text-nowrap">预估体积:<span v-if="waybill.warehouse_weight">@{{ waybill.warehouse_weight }} @{{ waybill.warehouse_weight_unit_name }}</span></span>
+                        </div>
+                    </div>
+                    <div style="background-color:#e8eef6"  class="mb-3">
+                        <div style="transform:scale(0.9);color:#02346a" class="pl-0 form-inline">
+                            <div class="mr-3 text-nowrap form-inline">
+                                <label :for="'carrier_bill'+waybill.id">专线运单号:</label>
+                                <input :id="'carrier_bill'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_bill?'is-invalid tooltipTargetError':''"
+                                       v-if="waybill.isBtn || updatePool[waybill.id]" type="text" :value="waybill.carrier_bill"
+                                        class="form-control form-control-sm " @click="enlarge($event)"  style="width: 50px">
+                                <span v-else  class="text-muted">@{{ waybill.carrier_bill }}</span>
+                            </div>
+                            <div class="mr-3 text-nowrap form-inline">
+                                <label :for="'inquire_tel'+waybill.id">查&nbsp;件&nbsp;电&nbsp;&nbsp;话:</label>
+                                <input :id="'inquire_tel'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].inquire_tel?'is-invalid tooltipTargetError':''"
+                                       v-if="waybill.isBtn || updatePool[waybill.id]" :value="waybill.inquire_tel"  @click="enlarge($event)"
+                                       class="form-control form-control-sm" type="text" style="width:50px">
+                                <span v-else  class="text-muted">@{{ waybill.inquire_tel }}</span>
+                            </div>
+                            <div class="mr-3 text-nowrap form-inline">
+                                <label :for="'amount'+waybill.id">数量:</label>
+                                <div class="input-group input-group-sm" v-if="waybill.isBtn || updatePool[waybill.id]">
+                                    <input :id="'amount'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].amount?'is-invalid tooltipTargetError':''"
+                                     :value="waybill.amount" @click="enlarge($event)"
+                                   class="form-control" type="text" style="width:50px">
+                                    <span class="input-group-append">
+                                        <span class="input-group-text">件</span>
                                     </span>
-                                    <span v-else class="text-muted">@{{ waybill.carrier_weight }}</span>
+                                </div>
+                                <span v-else class="text-muted"><span v-if="waybill.amount">@{{ waybill.amount }} @{{ waybill.amount_unit_name }}</span></span>
+                            </div>
+                            <div class="mr-3 text-nowrap form-inline">
+                                <label :for="'carrier_weight_other'+waybill.id">重量:</label>
+                                <div class="input-group input-group-sm" v-if="waybill.isBtn || updatePool[waybill.id]">
+                                <input :id="'carrier_weight_other'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_weight_other?'is-invalid tooltipTargetError':''"
+                                   :value="waybill.carrier_weight_other" @click="enlarge($event)"
+                                    type="text" class="form-control" style="width:50px">
+                                <span class="input-group-append">
+                                  <span class="input-group-text">KG</span>
                                 </span>
-                                        <span class="mr-3 text-nowrap form-inline" v-if="!waybill.isBtn"><span style="color:#02346a">附加费:</span>
-                                    <span class="input-group input-group-sm">
-                                        <input :id="'subjoin_fee'+waybill.id" :value="waybill.subjoin_fee" type="number" step="0.01"
-                                               class="form-control" style="width:150px">
-                                        <span class="input-group-append">
-                                          <span class="input-group-text">元</span>
-                                        </span>
+                                </div>
+                                <span v-else class="text-muted">@{{ waybill.carrier_weight_other }}</span>
+                            </div>
+                            <div class="mr-3 text-nowrap form-inline">
+                                <label :for="'carrier_weight'+waybill.id">体积:</label>
+                                <div class="input-group input-group-sm" v-if="waybill.isBtn || updatePool[waybill.id]">
+                                    <input :id="'carrier_weight'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_weight?'is-invalid tooltipTargetError':''"
+                                           :value="waybill.carrier_weight" @click="enlarge($event)"
+                                           type="text" class="form-control" style="width:50px">
+                                    <span class="input-group-append">
+                                      <span class="input-group-text">M³</span>
                                     </span>
-                                </span>
-                                <span class="mr-3 text-nowrap">
-                                    <button class="btn btn-sm btn-outline-success" @click="submit(date,waybill.isBtn,waybill.id)">提交</button>
-                                    <button v-if="!waybill.isBtn && !updatePool[waybill.id]" class="btn btn-sm btn-outline-info" @click="$set(updatePool,waybill.id,true);">修改</button>
-                                </span>
                                 </div>
+                                <span v-else class="text-muted">@{{ waybill.carrier_weight }}</span>
+                            </div>
+                            <div class="mr-3 text-nowrap form-inline" v-if="!waybill.isBtn">
+                                <label :for="'subjoin_fee'+waybill.id">附加费:</label>
+                                <div class="input-group input-group-sm">
+                                    <input :id="'subjoin_fee'+waybill.id" :value="waybill.subjoin_fee" type="number" step="0.01"
+                                           class="form-control" style="width:150px">
+                                    <span class="input-group-append">
+                                      <span class="input-group-text">元</span>
+                                    </span>
                                 </div>
-                            </td>
-                        </tr>
-                        </tbody>
-                    </table>
+                            </div>
+                            <span class="mr-3 text-nowrap">
+                                <button class="btn btn-sm btn-outline-success" @click="submit(date,waybill.isBtn,waybill.id)">提交</button>
+                                <button v-if="!waybill.isBtn && !updatePool[waybill.id]" class="btn btn-sm btn-outline-info" @click="$set(updatePool,waybill.id,true);">修改</button>
+                            </span>
+                        </div>
+                    </div>
                 </div>
             </div>
         </div>
@@ -129,6 +130,8 @@
             searchText:"{{$searchText}}",
             lastHeight:"",
             updatePool:{},
+            coordinate:{},
+            slideStatus:{},
         },
         mounted:function(){
             $(".tooltipTarget").tooltip({'trigger':'hover'});
@@ -137,6 +140,36 @@
             $("#list").removeClass('d-none');
         },
         methods:{
+            startSlide(){
+                event.preventDefault();
+                this.coordinate.x = event.touches[0].pageX;
+                this.coordinate.y = event.touches[0].pageY;
+            },
+            endSlide(date){
+                event.preventDefault();
+                let x = event.changedTouches[0].pageX - this.coordinate.x;
+                let y = event.changedTouches[0].pageY - this.coordinate.y;
+                if (Math.abs(x) > Math.abs(y)) {
+                    if (x>0)this.lToR(date,event.target);
+                    else this.rToL(date,event.target);
+                }
+            },
+            rToL(date,element){
+                if (this.slideStatus[date])return;
+                element.classList.add('translationRtoL');
+                setTimeout(()=>{
+                    element.classList.remove('translationRtoL');
+                    this.$set(this.slideStatus,date,true);
+                },400);
+            },
+            lToR(date,element){
+                if (!this.slideStatus[date])return;
+                element.classList.add('translationLtoR');
+                setTimeout(()=>{
+                    element.classList.remove('translationLtoR');
+                    this.$set(this.slideStatus,date,false);
+                },400);
+            },
             selectedHeader(date){
                 if (this.header[date]===undefined)this.loadData(date);
                 if (this.header[date])this.$set(this.header,date,!this.header[date])

+ 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);