Prechádzať zdrojové kódy

Merge branch 'zzd' of ssh://was.baoshi56.com:10022/var/git/bswas

LD 5 rokov pred
rodič
commit
6e05417643

+ 6 - 1
app/Http/Controllers/PackageLogisticController.php

@@ -7,6 +7,7 @@ use App\Logistic;
 use App\OrderPackage;
 use App\Owner;
 use App\Services\UserService;
+use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Http\Request;
 
 class PackageLogisticController extends Controller
@@ -28,7 +29,11 @@ class PackageLogisticController extends Controller
         $orderPackages = OrderPackage::query()
             ->filter($filters)
             ->whereIn('owner_id', $owner_ids)->with(['order.logistic', 'order.owner', 'order.issue' => function ($query) {
-                $query->with(['issueType', 'logs.user']);
+                /** @var Builder $query */
+                $query->with(['issueType','logs'=>function($query){
+                    /** @var Builder $query */
+                    $query->with('user')->orderByDesc('created_at');
+                }]);
             }])->orderByDesc('id')->paginate($request->paginate ?? 50);
         $logistics = Logistic::all();
         $owners = Owner::find($owner_ids);

+ 32 - 13
app/Http/Controllers/TestController.php

@@ -179,19 +179,38 @@ class TestController extends Controller
     }
     public function test()
     {
-        dd(preg_split('/[,, ]+/is', "1,,2,3 4 "));
-       $owners = Owner::query()->get();
-       foreach ($owners as $owner){
-           if (Cache::has(date("Y-m")."|A|".$owner->id)){
-               $query = DB::raw(<<<sql
-SELECT sum(amount) total FROM `store_items` LEFT JOIN stores ON store_items.store_id=stores.id WHERE stores.owner_id = ? AND (stores.status='已入库' OR stores.status='ASN关闭') AND store_items.updated_at LIKE ?
-sql
-               );
-               $statistics = DB::selectOne($query,[$owner->id,date("Y-m")."%"]);
-               Cache::put(date("Y-m")."|A|".$owner->id,$statistics->total ? $statistics->total : 0,2764800);
-           }
-       }
-       dd("OK");
+        $time = explode("-",DeliveryAppointment::PERIOD[1])[1];
+        dd("2021-05-16"." ".$time.":00:00",Carbon::now()->gt(Carbon::parse("2021-05-15"." ".$time.":00:00")));
+        $asnno = "ASN2105141388";
+        $query = DB::raw("SELECT b.ALTERNATE_SKU1,h.WAREHOUSEID,h.asnno,d.ASNLINENO,d.SKUDESCRC,h.CUSTOMERID,d.SKU,d.PACKID,d.RECEIVEDQTY_EACH,d.EXPECTEDQTY_EACH,d.LOTATT01,d.LOTATT02,d.lotatt04,".
+            "d.lotatt05,d.lotatt08,d.USERDEFINE1,d.USERDEFINE2,d.USERDEFINE3,d.USERDEFINE4,d.USERDEFINE5,d.RECEIVINGLOCATION FROM DOC_ASN_DETAILS d ".
+            " LEFT JOIN BAS_SKU b ON d.CUSTOMERID = b.CUSTOMERID AND d.SKU = b.SKU INNER JOIN DOC_ASN_HEADER h ON d.ASNNO = h.ASNNO WHERE h.ASNNO = ?");
+        $detail = DB::connection("oracle")->selectOne($query,[$asnno]);
+        //dd($detail);
+        $ser = new StoreService();
+        $result = $ser->warehousing(array(
+            "IN_Warehouse" => $detail->warehouseid ?? '',
+            "In_ASNNo_C" => $detail->asnno ?? '',
+            "In_ASNLineNo_C" => $detail->asnlineno ?? '',
+            "In_New_TraceID_C" => (string)rand(100,999),
+            "In_CustomerID" => $detail->customerid ?? '',
+            "In_SKU" => $detail->sku ?? '',
+            "In_ReceivedQty" => (string)((int)$detail->expectedqty_each - (int)$detail->receivedqty_each) ?? '',
+            "In_PackID" => $detail->packid ?? '',
+            "In_LotAtt01_C" => $detail->lotatt01 ?? '',
+            "In_LotAtt02_C" => $detail->lotatt02 ?? '',
+            "In_LotAtt04_C" => $detail->lotatt04 ?? '',
+            "In_LotAtt05_C" => $detail->lotatt05 ?? '',
+            "In_LotAtt08_C" => $detail->lotatt08 ?? '',
+            "In_UserDefine1" => $detail->userdefine1 ?? '',
+            "In_UserDefine2" => $detail->userdefine2 ?? '',
+            "In_UserDefine3" => $detail->userdefine3 ?? '',
+            "In_UserDefine4" => $detail->userdefine4 ?? '',
+            "In_UserDefine5" => $detail->userdefine5 ?? '',
+            "In_FMLocation"  => 'STAGE' . $detail->warehouseid,
+            "In_TOLocation_C" => 'STAGE' . $detail->warehouseid,//'IDE0000001',
+        ));
+       dd($result);
         /*$order = Order::query()->where("code","SO210511005663")->first();
         $ser = new OrderService();
         $ser->createInstantBill($order);

+ 2 - 0
app/Http/Controllers/WaybillController.php

@@ -3,6 +3,7 @@
 namespace App\Http\Controllers;
 
 
+use App\CarType;
 use App\Components\AsyncResponse;
 use App\Region;
 use App\Services\CarTypeService;
@@ -61,6 +62,7 @@ class WaybillController extends Controller
             'waybills' => $waybills,
             'logistics' => $logisticService->getSelection(["id","name"],"物流"),
             'owners' => $ownerService->getIntersectPermitting(),
+            "carTypes" => CarType::query()->get(),
             'paginateParams'=>$paginateParams,
             'uriType'=>$request->uriType??'']);
     }

+ 1 - 1
app/Jobs/DeliveryAppointmentCheck.php

@@ -38,7 +38,7 @@ class DeliveryAppointmentCheck implements ShouldQueue
         /** @var DeliveryAppointment|\stdClass $appointment */
         $appointment = DeliveryAppointment::query()->find($this->int);
         $time = explode("-",DeliveryAppointment::PERIOD[$appointment->date_period])[1];
-        if ($appointment && $appointment->status!=2
+        if ($appointment && $appointment->status==0
             && Carbon::now()->gt(Carbon::parse($appointment->appointment_date." ".$time.":00:00"))
         )$appointment->update(["status"=>3]);
     }

+ 129 - 0
app/Services/StoreService.php

@@ -417,4 +417,133 @@ sql
         if (!Cache::has($date."|A|".$owner))$this->storeAmountCompensationLogic($owner);
         return Cache::get($date."|A|".$owner);
     }
+
+    public function warehousing(array $params)
+    {
+        $conn = oci_connect(config('database.connections.oracle.username'),
+            config('database.connections.oracle.password'),
+            config('database.connections.oracle.host'). '/' . config('database.connections.oracle.service_name'),"utf8");
+        $sp = "begin SPASN_Receiving_Process(:IN_Warehouse, :In_Process_Action, :In_ASNNo_C, :In_ASNLineNo_C, :In_FMTraceID_C, :In_New_TraceID_C, :In_ProductStatus," .
+            ":In_ProductStatus_Descr, :In_HoldRejectCode_C, :In_HoldRejectReason_C, :In_PONo_C, :In_CustomerID, :In_SKU, :In_ReceivedQty, :In_RejectedQty,:In_UOM, :In_PackID," .
+            " :In_ContainerID, :In_LotAtt01_C, :In_LotAtt02_C, :In_LotAtt03_C, :In_LotAtt04_C, :In_LotAtt05_C, :In_LotAtt06_C," .
+            ":In_LotAtt07_C, :In_LotAtt08_C, :In_LotAtt09_C, :In_LotAtt10_C, :In_LotAtt11_C, :In_LotAtt12_C," .
+            ":In_TotalCubic, :In_TotalGrossWeight, :In_TotalNetWeight, :In_TotalPrice, :In_UserDefine1, :In_UserDefine2,:In_UserDefine3, :In_UserDefine4, :In_UserDefine5, :In_FMLocation," .
+            ":In_TOLocation_C,:In_QC_Type_C, :In_PlanToLoc_C,:In_ReceivingTime, :In_LPN, :In_Operator, :IN_RCVModule, :IN_RCVStation, :In_Language, :In_UserID, :OUT_Return_Code); end;";
+        $inParams = array(
+            "IN_Warehouse"=>"",
+            "In_Process_Action"=>"",
+            "In_ASNNo_C"=>"",
+            "In_ASNLineNo_C"=>"",
+            "In_FMTraceID_C"=>"",
+            "In_New_TraceID_C"=>"",
+            "In_ProductStatus"=>"00",
+            "In_ProductStatus_Descr"=>"正常",
+            "In_HoldRejectCode_C"=>"OK",
+            "In_HoldRejectReason_C"=>"正常",
+            "In_PONo_C"=>"",
+            "In_CustomerID"=>"",
+            "In_SKU"=>"",
+            "In_ReceivedQty"=>"",
+            "In_RejectedQty"=>"",
+            "In_UOM"=>"EA",
+            "In_PackID"=>"",
+            "In_ContainerID"=>"",
+            "In_LotAtt01_C"=>"",
+            "In_LotAtt02_C"=>"",
+            "In_LotAtt03_C"=>"",
+            "In_LotAtt04_C"=>"",
+            "In_LotAtt05_C"=>"",
+            "In_LotAtt06_C"=>"",
+            "In_LotAtt07_C"=>"",
+            "In_LotAtt08_C"=>"",
+            "In_LotAtt09_C"=>"",
+            "In_LotAtt10_C"=>"",
+            "In_LotAtt11_C"=>"",
+            "In_LotAtt12_C"=>"",
+            "In_TotalCubic"=>"0.00",
+            "In_TotalGrossWeight"=>"0.00",
+            "In_TotalNetWeight"=>"0.00",
+            "In_TotalPrice"=>"0.00",
+            "In_UserDefine1"=>"",
+            "In_UserDefine2"=>"",
+            "In_UserDefine3"=>"",
+            "In_UserDefine4"=>"",
+            "In_UserDefine5"=>"",
+            "In_FMLocation"=>"",
+            "In_TOLocation_C"=>"",
+            "In_QC_Type_C"=>"OK",
+            "In_PlanToLoc_C"=>"",
+            "In_ReceivingTime"=>"",
+            "In_LPN"=>"*",
+            "In_Operator"=>"WCS",
+            "IN_RCVModule"=>"",
+            "IN_RCVStation"=>"",
+            "In_Language"=>"cn",
+            "In_UserID"=>"WCS",
+            "result"=>""
+        );
+        foreach ($params as $key=>$val)$inParams[$key] = $val;
+        list($IN_Warehouse,$In_Process_Action,$In_ASNNo_C,$In_ASNLineNo_C,$In_FMTraceID_C,$In_New_TraceID_C,$In_ProductStatus,
+            $In_ProductStatus_Descr,$In_HoldRejectCode_C,$In_HoldRejectReason_C,$In_PONo_C,$In_CustomerID,$In_SKU,$In_ReceivedQty,
+            $In_RejectedQty,$In_UOM,$In_PackID,$In_ContainerID,$In_LotAtt01_C,$In_LotAtt02_C,$In_LotAtt03_C,$In_LotAtt04_C,$In_LotAtt05_C,
+            $In_LotAtt06_C,$In_LotAtt07_C,$In_LotAtt08_C,$In_LotAtt09_C,$In_LotAtt10_C,$In_LotAtt11_C,$In_LotAtt12_C,$In_TotalCubic,
+            $In_TotalGrossWeight,$In_TotalNetWeight,$In_TotalPrice,$In_UserDefine1,$In_UserDefine2,$In_UserDefine3,$In_UserDefine4,
+            $In_UserDefine5,$In_FMLocation,$In_TOLocation_C,$In_QC_Type_C,$In_PlanToLoc_C,$In_ReceivingTime,$In_LPN,$In_Operator,
+            $IN_RCVModule,$IN_RCVStation,$In_Language,$In_UserID,$result) = array_values($inParams);
+        $stmt = oci_parse($conn, $sp);
+        oci_bind_by_name($stmt, ':IN_Warehouse', $IN_Warehouse);
+        oci_bind_by_name($stmt, ':In_Process_Action', $In_Process_Action);
+        oci_bind_by_name($stmt, ':In_ASNNo_C', $In_ASNNo_C);
+        oci_bind_by_name($stmt, ':In_ASNLineNo_C', $In_ASNLineNo_C);
+        oci_bind_by_name($stmt, ':In_FMTraceID_C', $In_FMTraceID_C);
+        oci_bind_by_name($stmt, ':In_New_TraceID_C', $In_New_TraceID_C);
+        oci_bind_by_name($stmt, ':In_ProductStatus', $In_ProductStatus);
+        oci_bind_by_name($stmt, ':In_ProductStatus_Descr', $In_ProductStatus_Descr);
+        oci_bind_by_name($stmt, ':In_HoldRejectCode_C', $In_HoldRejectCode_C);
+        oci_bind_by_name($stmt, ':In_HoldRejectReason_C', $In_HoldRejectReason_C);
+        oci_bind_by_name($stmt, ':In_PONo_C', $In_PONo_C);
+        oci_bind_by_name($stmt, ':In_CustomerID', $In_CustomerID);
+        oci_bind_by_name($stmt, ':In_SKU', $In_SKU);
+        oci_bind_by_name($stmt, ':In_ReceivedQty', $In_ReceivedQty);
+        oci_bind_by_name($stmt, ':In_RejectedQty', $In_RejectedQty);
+        oci_bind_by_name($stmt, ':In_UOM', $In_UOM);
+        oci_bind_by_name($stmt, ':In_PackID', $In_PackID);
+        oci_bind_by_name($stmt, ':In_ContainerID', $In_ContainerID);
+        oci_bind_by_name($stmt, ':In_LotAtt01_C', $In_LotAtt01_C);
+        oci_bind_by_name($stmt, ':In_LotAtt02_C', $In_LotAtt02_C);
+        oci_bind_by_name($stmt, ':In_LotAtt03_C', $In_LotAtt03_C);
+        oci_bind_by_name($stmt, ':In_LotAtt04_C', $In_LotAtt04_C);
+        oci_bind_by_name($stmt, ':In_LotAtt05_C', $In_LotAtt05_C);
+        oci_bind_by_name($stmt, ':In_LotAtt06_C', $In_LotAtt06_C);
+        oci_bind_by_name($stmt, ':In_LotAtt07_C', $In_LotAtt07_C);
+        oci_bind_by_name($stmt, ':In_LotAtt08_C', $In_LotAtt08_C);
+        oci_bind_by_name($stmt, ':In_LotAtt09_C', $In_LotAtt09_C);
+        oci_bind_by_name($stmt, ':In_LotAtt10_C', $In_LotAtt10_C);
+        oci_bind_by_name($stmt, ':In_LotAtt11_C', $In_LotAtt11_C);
+        oci_bind_by_name($stmt, ':In_LotAtt12_C', $In_LotAtt12_C);
+        oci_bind_by_name($stmt, ':In_TotalCubic', $In_TotalCubic);
+        oci_bind_by_name($stmt, ':In_TotalGrossWeight', $In_TotalGrossWeight);
+        oci_bind_by_name($stmt, ':In_TotalNetWeight', $In_TotalNetWeight);
+        oci_bind_by_name($stmt, ':In_TotalPrice', $In_TotalPrice);
+        oci_bind_by_name($stmt, ':In_UserDefine1', $In_UserDefine1);
+        oci_bind_by_name($stmt, ':In_UserDefine2', $In_UserDefine2);
+        oci_bind_by_name($stmt, ':In_UserDefine3', $In_UserDefine3);
+        oci_bind_by_name($stmt, ':In_UserDefine4', $In_UserDefine4);
+        oci_bind_by_name($stmt, ':In_UserDefine5', $In_UserDefine5);
+        oci_bind_by_name($stmt, ':In_FMLocation', $In_FMLocation);
+        oci_bind_by_name($stmt, ':In_TOLocation_C', $In_TOLocation_C);
+        oci_bind_by_name($stmt, ':In_QC_Type_C', $In_QC_Type_C);
+        oci_bind_by_name($stmt, ':In_PlanToLoc_C', $In_PlanToLoc_C);
+        oci_bind_by_name($stmt, ':In_ReceivingTime', $In_ReceivingTime);
+        oci_bind_by_name($stmt, ':In_LPN', $In_LPN);
+        oci_bind_by_name($stmt, ':In_Operator', $In_Operator);
+        oci_bind_by_name($stmt, ':IN_RCVModule', $IN_RCVModule);
+        oci_bind_by_name($stmt, ':IN_RCVStation', $IN_RCVStation);
+        oci_bind_by_name($stmt, ':In_Language', $In_Language);
+        oci_bind_by_name($stmt, ':In_UserID', $In_UserID);
+        oci_bind_by_name($stmt, ':OUT_Return_Code', $result,300);
+        oci_execute($stmt);
+        oci_close($conn);
+        return $result;
+    }
 }

+ 10 - 0
app/Services/WaybillService.php

@@ -98,6 +98,10 @@ class WaybillService
             unset($param["recipient_mobile"]);
         }
 
+        if (($param["updated_at_start"] ?? false) || ($param["updated_at_end"] ?? false)){
+            $waybills->whereIn("waybills.status",['已完结','无模型']);
+        }
+
 //        if($param['carrier_bill'] ?? false){    // 承运商单号
 //            $this->searchWay($waybills,$param['carrier_bill'],'waybills.carrier_bill');
 //            unset($param['carrier_bill']);
@@ -123,9 +127,15 @@ class WaybillService
             'car_owner_info' => ['batch' => ''],
             'created_at_start' => ['alias' => 'created_at' , 'startDate' => ':00'],
             'created_at_end' => ['alias' => 'created_at' , 'endDate' => ':59'],
+            'updated_at_start' => ['alias' => 'updated_at' , 'startDate' => ':00'],
+            'updated_at_end' => ['alias' => 'updated_at' , 'endDate' => ':59'],
+            'deliver_at_start' => ['alias' => 'deliver_at' , 'startDate' => ':00'],
+            'deliver_at_end' => ['alias' => 'deliver_at' , 'endDate' => ':59'],
             'uriType' => ['alias' => 'type'],
             'id' => ['multi' => ','],
             'logistic_id' => ['multi' => ','],
+            'mileage' => ['like' => ''],
+            'carrier_weight_other' => ['like' => ''],
         ];
         $waybills = app(QueryService::class)->query($param,$waybills,$columnQueryRules,"waybills");
         return $waybills;

+ 14 - 2
resources/views/transport/waybill/index.blade.php

@@ -350,6 +350,11 @@
                     {name:'{{$owner->id}}',value:'{{$owner->name}}'},
                     @endforeach
                 ],
+                carTypes:[
+                        @foreach($carTypes as $carType)
+                    {name:'{{$carType->id}}',value:'{{$carType->name}}'},
+                    @endforeach
+                ],
                 logistics:[
                         @foreach($logistics as $logistic)
                     {name:"{{$logistic->id}}",value:'{{$logistic->name}}'},
@@ -383,23 +388,30 @@
                     [
                         {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的客户'],
                             placeholder:['货主','定位或多选货主'],data:this.owners},
-                        {name:'created_at_start',type:'time',tip:['选择显示指定日期的起始时间','选择显示指定日期的起始时间']},
+                        {name:'created_at_start',type:'time',tip:['选择显示创建日期的起始时间','选择显示创建日期的起始时间']},
+                        {name:'updated_at_start',type:'time',tip:['选择显示完结日期的起始时间','选择显示完结日期的起始时间']},
+                        {name:'deliver_at_start',type:'time',tip:['选择显示发货日期的起始时间','选择显示发货日期的起始时间']},
                         {name:'origination',type:'input',tip:'始发地:可在左侧增加百分号(%)进行模糊搜索',placeholder: '始发地'},
                         {name:'carrier_bill',type:'input',tip:'可支持多承运商单号:可在左侧增加百分号(%)进行模糊搜索',placeholder: '承运商单号'},
                         {name:'status',type:'select',placeholder: '运单状态',data:this.status},
                         {name:'source_bill',type:'input',tip: '可支持多上游单号:可在左侧增加百分号(%)进行模糊搜索',placeholder: '上游单号'},
                         {name:'recipient',type:'input',tip: '可支持多收货人姓名:可在左侧增加百分号(%)进行模糊搜索',placeholder: '收货人姓名'},
                         {name:'car_owner_info',type:'input',tip: '车辆信息:可在左侧增加百分号(%)进行模糊搜索',placeholder: '车辆信息'},
+                        {name:'mileage',type:'input',tip: '里程:可在左侧增加百分号(%)进行模糊搜索',placeholder: '里程'},
                     ],
                     [
                         {name:'wms_bill_number',type:'input',tip:'可支持多WMS单号:可在两侧增加百分号(%)进行模糊搜索',placeholder: 'WMS单号'},
-                        {name:'created_at_end',type:'time',tip:['选择显示指定日期的结束时间','选择显示指定日期的结束时间']},
+                        {name:'created_at_end',type:'time',tip:['选择显示创建日期的结束时间','选择显示创建日期的结束时间']},
+                        {name:'updated_at_end',type:'time',tip:['选择显示完结日期的结束时间','选择显示完结日期的结束时间']},
+                        {name:'deliver_at_end',type:'time',tip:['选择显示发货日期的结束时间','选择显示发货日期的结束时间']},
                         {name:'destination',type:'input',tip:'目的地:可在两侧增加百分号(%)进行模糊搜索',placeholder: '目的地'},
                         {name:'waybill_number',type:'input',tip:'运单号:可在两侧增加百分号(%)进行模糊搜索',placeholder: '运单号'},
                         // {name:'logistic_id',type:'select',placeholder: '承运商',data:this.logistics},
                         {name:'logistic_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的承运商'],
                             placeholder:['承运商','定位或多选承运商'],data:this.logistics},
                         {name:'recipient_mobile',type:'input',tip: '可支持多收货人电话:可在左侧增加百分号(%)进行模糊搜索',placeholder: '收货人电话'},
+                        {name:'carrier_weight_other',type:'input',tip: '仓库计重:可在左侧增加百分号(%)进行模糊搜索',placeholder: '仓库计重'},
+                        {name:'carType_id',type:'select',placeholder: '车型',data:this.carTypes},
                     ],
                 ];
                 let param=[];