Bladeren bron

二次加工单没有工时的成本算作是0,也要计算出利润
FIX 称重管理导出很慢(比就9.9号至10号就很久)

Zhouzhendong 5 jaren geleden
bovenliggende
commit
509135e3e5

+ 6 - 5
app/Http/Controllers/CommodityController.php

@@ -26,7 +26,7 @@ class CommodityController extends Controller
      */
      */
     public function index()
     public function index()
     {
     {
-        if(!Gate::allows('商品信息-查询')){ return redirect(url('/'));  }
+        if(!Gate::allows('商品信息-查询')){ return redirect(url('denied'));  }
         $commodities=Commodity::query()->orderBy('id','desc')->paginate(50);
         $commodities=Commodity::query()->orderBy('id','desc')->paginate(50);
         return view('maintenance.commodity.index',['commodities'=>$commodities]);
         return view('maintenance.commodity.index',['commodities'=>$commodities]);
     }
     }
@@ -38,7 +38,7 @@ class CommodityController extends Controller
      */
      */
     public function create()
     public function create()
     {
     {
-        if(!Gate::allows('商品信息-录入')){ return redirect(url('/'));  }
+        if(!Gate::allows('商品信息-录入')){ return redirect(url('denied'));  }
         return view('maintenance.commodity.create');
         return view('maintenance.commodity.create');
     }
     }
 
 
@@ -50,7 +50,7 @@ class CommodityController extends Controller
      */
      */
     public function store(Request $request)
     public function store(Request $request)
     {
     {
-        if(!Gate::allows('商品信息-录入')){ return redirect(url('/'));  }
+        if(!Gate::allows('商品信息-录入')){ return redirect(url('denied'));  }
         $this->validatorCreate($request->all())->validate();
         $this->validatorCreate($request->all())->validate();
         $commodity=new Commodity($request->all());
         $commodity=new Commodity($request->all());
         $commodity->save();
         $commodity->save();
@@ -92,7 +92,7 @@ class CommodityController extends Controller
      */
      */
     public function edit(Commodity $commodity)
     public function edit(Commodity $commodity)
     {
     {
-        if(!Gate::allows('商品信息-编辑')){ return redirect(url('/'));  }
+        if(!Gate::allows('商品信息-编辑')){ return redirect(url('denied'));  }
         return view('maintenance.commodity.edit',['commodity'=>$commodity]);
         return view('maintenance.commodity.edit',['commodity'=>$commodity]);
     }
     }
 
 
@@ -318,7 +318,8 @@ class CommodityController extends Controller
         }
         }
 
 
         if (count($barcodes) > 0){
         if (count($barcodes) > 0){
-            $commodities = $commodityService->ownerBarcodeSeekCommodityGet(['id'=>$owner_id], $barcodes, true);
+            // TODO ownerBarcodeSeekCommodityGet可指定第三个参数为true 默认无差别覆盖 如若指定该布尔值true代表仅覆盖SKU空值项
+            $commodities = $commodityService->ownerBarcodeSeekCommodityGet(['id'=>$owner_id], $barcodes);
             $updateCommodities = [];
             $updateCommodities = [];
             $updateCommodities[] = [
             $updateCommodities[] = [
                 'id', 'sku', 'name', 'length', 'width', 'height', 'volumn',
                 'id', 'sku', 'name', 'length', 'width', 'height', 'volumn',

+ 3 - 3
app/Http/Controllers/PackageController.php

@@ -107,7 +107,7 @@ class PackageController extends Controller
         if (!$package && !$logistic_number)return redirect('package/create')->with('successError','录入失败!系统内没有对应波次的包裹!');
         if (!$package && !$logistic_number)return redirect('package/create')->with('successError','录入失败!系统内没有对应波次的包裹!');
         if ($package){
         if ($package){
             if(!$package->batch_number)$package->batch_number=$batch_number;
             if(!$package->batch_number)$package->batch_number=$batch_number;
-            if(!$package->order_code)$package->order_code=$order_code;
+            //if(!$package->order_code)$package->order_code=$order_code;
             $package->fetchAllFromOracle();
             $package->fetchAllFromOracle();
             $package->weight=$weight;
             $package->weight=$weight;
             if(!$package->paper_box_id)$package->paper_box_id=$paper_box_id;
             if(!$package->paper_box_id)$package->paper_box_id=$paper_box_id;
@@ -131,12 +131,12 @@ class PackageController extends Controller
             $result=$accomplishToWMS->accomplishToWMS($package);
             $result=$accomplishToWMS->accomplishToWMS($package);
             $str = "录入包裹成功!";
             $str = "录入包裹成功!";
             $str .= $package['logistic_number']?"快递单号:{$package['logistic_number']}":'';
             $str .= $package['logistic_number']?"快递单号:{$package['logistic_number']}":'';
-            $str .= $package['order_code']?", 订单号:{$package['order_code']}":'';
+            $str .= $order_code?", 订单号:{$order_code}":'';
             if(!$result||$result['result']=='false'){
             if(!$result||$result['result']=='false'){
                 $package['status'] = '上传失败';
                 $package['status'] = '上传失败';
                 $str = "录入包裹失败!";
                 $str = "录入包裹失败!";
                 $str .= $package['logistic_number']?"快递单号:{$package['logistic_number']}":'';
                 $str .= $package['logistic_number']?"快递单号:{$package['logistic_number']}":'';
-                $str .= $package['order_code']?", 订单号:{$package['order_code']}":'';
+                $str .= $order_code?", 订单号:{$order_code}":'';
                 $this->log(__METHOD__,__FUNCTION__,json_encode($package).json_encode($result).$str,Auth::user()['name']);
                 $this->log(__METHOD__,__FUNCTION__,json_encode($package).json_encode($result).$str,Auth::user()['name']);
             }
             }
             $package->save();
             $package->save();

+ 5 - 0
app/Http/Controllers/ProcessController.php

@@ -235,6 +235,11 @@ class ProcessController extends Controller
         $processStatistic->duration_man_hours=$duration_man_hours;
         $processStatistic->duration_man_hours=$duration_man_hours;
         if ($sign_end) $processStatistic->ended_at = date('Y-m-d H:i:s');
         if ($sign_end) $processStatistic->ended_at = date('Y-m-d H:i:s');
         if (!$revenue || !$total_cost){
         if (!$revenue || !$total_cost){
+            if (!$total_cost && $revenue){
+                $processStatistic->total_cost = 0;
+                $processStatistic->gross_profit = $revenue;
+                $processStatistic->gross_profit_rate = 1;
+            }
             $processStatistic->update();
             $processStatistic->update();
             return ['success'=>false,'data'=>'该单未产生费用,无法计算毛利率!'];
             return ['success'=>false,'data'=>'该单未产生费用,无法计算毛利率!'];
         }
         }

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

@@ -12,6 +12,7 @@ use Illuminate\Support\Facades\Http;
 class ProcessStatisticController extends Controller
 class ProcessStatisticController extends Controller
 {
 {
     public function index(Request $request){
     public function index(Request $request){
+        if(!Gate::allows('二次加工管理-查询')){ return redirect('denied');  }
         /** @var ProcessStatisticService $processStatistics */
         /** @var ProcessStatisticService $processStatistics */
         $processStatistics=app("processStatisticService")->paginate($request->input());
         $processStatistics=app("processStatisticService")->paginate($request->input());
         $owners=app("ownerService")->getSelection();
         $owners=app("ownerService")->getSelection();

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

@@ -522,13 +522,19 @@ where (commodities.owner_id,commodity_barcodes.code) in (select commodities.owne
         Commodity::destroy($deleteCommodities);
         Commodity::destroy($deleteCommodities);
     }
     }
 
 
+
     public function test2(){
     public function test2(){
-        $owner = Owner::where('name','B站')->first();
-        $commodities = Commodity::query()->where('owner_id',$owner->id)->get();
-        $comID = array_column($commodities->toArray(),'id');
-        CommodityBarcode::query()->whereIn('commodity_id',$comID)->delete();
-        Commodity::destroy($comID);
-        return $comID;
+        $processes = Process::query()->where('status','交接完成')->get();
+        $ids = array_column($processes->toArray(),'id');
+        $processStatistics = ProcessStatistic::query()->whereIn('process_id',$ids)->whereNull('total_cost')->whereNull('gross_profit')->whereNull('gross_profit_rate')->get();
+        LogService::log(__METHOD__,'更正成本利润',json_encode($processStatistics));
+        foreach ($processStatistics as $p){
+            $p->update([
+                'total_cost'=>0,
+                'gross_profit'=>$p->revenue,
+                'gross_profit_rate'=>1
+            ]);
+        }
     }
     }
 
 
     /*1*/
     /*1*/

+ 456 - 1
app/Http/Controllers/api/thirdPart/flux/StoreController.php

@@ -6,7 +6,9 @@ use App\Http\Controllers\Controller;
 use App\Store;
 use App\Store;
 use App\WMSReflectReceive;
 use App\WMSReflectReceive;
 use App\WMSReflectReceiveSku;
 use App\WMSReflectReceiveSku;
+use Carbon\Carbon;
 use Illuminate\Support\Facades\Auth;
 use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\DB;
 use Zttp\Zttp;
 use Zttp\Zttp;
 
 
 class StoreController extends Controller
 class StoreController extends Controller
@@ -23,7 +25,7 @@ class StoreController extends Controller
         $METHOD=__METHOD__;
         $METHOD=__METHOD__;
         $FUNCTION=__FUNCTION__;
         $FUNCTION=__FUNCTION__;
         Controller::logS(__METHOD__, __FUNCTION__, '快递入库进入WMS接口:' . $store['asn_code']);
         Controller::logS(__METHOD__, __FUNCTION__, '快递入库进入WMS接口:' . $store['asn_code']);
-        $wmsReceiveds=WMSReflectReceive::where('ASNNO',$store['asn_code'])->get();
+        $wmsReceiveds=WMSReflectReceive::query()->where('ASNNO',$store['asn_code'])->get();
         if($wmsReceiveds->isEmpty()){
         if($wmsReceiveds->isEmpty()){
             (new Controller())->log(__METHOD__,'error_'.__FUNCTION__,'没有本地WMS入库单');
             (new Controller())->log(__METHOD__,'error_'.__FUNCTION__,'没有本地WMS入库单');
             return false;
             return false;
@@ -127,4 +129,457 @@ class StoreController extends Controller
         return $success;
         return $success;
     }
     }
 
 
+    public function quickStorage($asnno){
+        $docno = ""; //订单号 非ASN号
+        //判断单据有效性
+        $cus_bs_asnheader = DB::connection('oracle')->select(DB::raw("SELECT t.addwho FROM CUS_BS_ASNHEADER t WHERE t.asnreferencel = '".$docno."'"));
+        if (!$cus_bs_asnheader) return ['success'=>false, 'data'=>'单据不存在'];
+        $addwho = $cus_bs_asnheader[0]->addwho;
+        if ($addwho == "WCS"){
+            //判断单据状态
+            $cus_bs_asnheader = DB::connection('oracle')->select(
+                DB::raw("SELECT COUNT(1) FROM CUS_BS_ASNHEADER t INNER JOIN DOC_ASN_HEADER a ON a.asnno = t.asnno WHERE t.asnreference1 = '".$docno."' AND a.asnstatus < '40'"));
+            if (!$cus_bs_asnheader) return ['success'=>false, 'data'=>"该单据已完成收货"];
+
+            $sql = "select a.warehouseid,a.asnno as docno,a1.asnlineno,a.customerid,t1.sku,a1.packid,t1.receivedqty_each,t1.lotatt01,t1.lotatt02,";
+            $sql .= " t1.lotatt04,t1.lotatt05,t1.lotatt08,t1.userdefine1 as new_traceid,a.userdefine1,a.userdefine2,a.userdefine3,a.userdefine4,a.userdefine5,t.addwho";
+            $sql .= " from doc_asn_details a1";
+            $sql .= " inner join doc_asn_header a on a.asnno = a1.asnno";
+            $sql .= " inner join cus_bs_asndetails t1 on t1.asnno = a.asnno and t1.asnlineno = a1.asnlineno";
+            $sql .= " inner join cus_bs_asnheader t on t.asnno = a1.asnno";
+            $sql .= " where t.asnreference1 = ".$docno." and nvl(t1.rcvflag,'N') = 'N'";
+            $doc_asn_details = DB::connection('oracle')->select(DB::raw($sql));
+            $that = $this;
+            DB::transaction(function ()use($doc_asn_details,$that){
+                foreach ($doc_asn_details as $doc_asn_detail){
+                    $resule = $that->exe($doc_asn_detail->warehouseid,'3',$doc_asn_detail->docno,$doc_asn_detail->asnlineno,'',$doc_asn_detail->new_traceid,'00','正常','OK','正常',
+                        '',$doc_asn_detail->customerid,$doc_asn_detail->sku,$doc_asn_detail->receivedqty_each,'','EA',$doc_asn_detail->packid,'',$doc_asn_detail->lotatt01,$doc_asn_detail->lotatt02,
+                        '',$doc_asn_detail->lotatt04,$doc_asn_detail->lotatt05,'','',$doc_asn_detail->lotatt08,'','','','',
+                        '0.00','0.00','0.00','0.00',$doc_asn_detail->userdefine1,$doc_asn_detail->userdefine2,$doc_asn_detail->userdefine3,$doc_asn_detail->userdefine4,$doc_asn_detail->userdefine5,'STAGE'.$doc_asn_detail->warehouseid,
+                    'STAGE'.$doc_asn_detail->warehouseid,'OK','','','*',$doc_asn_detail->addwho,'','','cn',$doc_asn_detail->addwho,'');
+                    if (substr($resule,1,3) == '000'){
+                        exe2();
+                    }else{
+                        exe3();
+                        DB::rollBack();
+                        break;
+                    }
+                }
+            });
+            DB::commit();
+            return ['success'=>true, 'data'=>"OK"];
+        }
+        if ($addwho == "BSERP"){
+            $cus_bs_asnheader = DB::connection('oracle')->select(DB::raw('SELECT t.asnreference1 FROM cus_bs_asnheader t'));
+            if (!$cus_bs_asnheader) return ['success'=>false, 'data'=>'单据不存在'];
+            $asnreference1 = $cus_bs_asnheader[0]->asnreference1;
+            return ['success'=>true, 'data'=>$asnreference1];
+        }
+    }
+
+    /** $In_Process_Action为来源渠道,快速入库调用固定值 为 '3' */
+    private function exe($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)
+    {
+        /*$r_NO_COMMIT $R_CurrentTime $OUT_Return_Code $R_ReceivingTime $r_LPN $r_UDF2_AD $r_UDF2_IN
+        $R_Qty_PlanPutaway $R_QCTaskID $R_HOLD_FLAG $R_PA_TaskID $R_PA_Flag $R_QC_Sequence $R_PA_Sequence
+        $R_Reserve_Flag $R_QtyMVOut $r_TotalGrossWeight $r_TotalCubic r_TotalNetWeight r_TotalPrice In_LotAtt01
+        In_LotAtt02 In_LotAtt03 In_LotAtt04 In_LotAtt05 In_LotAtt06 In_LotAtt07 In_LotAtt08 In_LotAtt09 In_LotAtt10
+        In_LotAtt11 In_LotAtt12 In_HoldRejectCode In_HoldRejectReason
+        */
+        if ($OUT_Return_Code == "NO_COMMIT" || $OUT_Return_Code == "*_*"){
+            $r_NO_COMMIT = 'N';
+        }else{
+            $r_NO_COMMIT = 'Y';
+        }
+        //初始化
+        $R_CurrentTime = Carbon::now();
+        $OUT_Return_Code ='000';
+        if (!$In_ReceivingTime){
+            $R_ReceivingTime = Carbon::now();
+        }else{
+            $R_ReceivingTime = $In_ReceivingTime;
+        }
+        //else R_ReceivingTime:=To_Date( IN_ReceivingTime,'YYYY/MM/DD hh24:mi:ss'); --2008-11-25 15:53:33
+
+        if ($In_LPN && $In_LPN != "*"){
+            $r_LPN = $In_LPN;
+        }else $r_LPN = "*";
+
+        $bascode = DB::select(DB::raw("SELECT udf2 FROM BAS_CODES WHERE codeid ='TRN_TYP' AND code='AD'"));
+        $r_UDF2_AD = $bascode[0]->udf2 ?? 'N';
+
+        $bascode = DB::select(DB::raw("SELECT udf2 FROM BAS_CODES WHERE codeid ='TRN_TYP' AND code='IN'"));
+        $r_UDF2_IN = $bascode[0]->udf2 ?? 'N';
+
+        $R_Qty_PlanPutaway = 0;
+        $R_QCTaskID = '*';
+        $R_HOLD_FLAG = 'N';
+        $R_PA_TaskID = '*';
+        $R_PA_Flag = 'N';
+        $R_QC_Sequence = 0;
+        $R_PA_Sequence = 0;
+        $R_Reserve_Flag = 'N';
+        $R_QtyMVOut  =  0;
+
+        $r_TotalGrossWeight = $In_TotalGrossWeight;
+        $r_TotalCubic = $In_TotalCubic;
+        $r_TotalNetWeight = $In_TotalNetWeight ?? 0;
+        $r_TotalPrice = $In_TotalPrice;
+
+        $In_LotAtt01 = $In_LotAtt01_C;
+        $In_LotAtt02 = $In_LotAtt02_C;
+        $In_LotAtt03 = $In_LotAtt03_C;
+        $In_LotAtt04 = $In_LotAtt04_C;
+        $In_LotAtt05 = $In_LotAtt05_C;
+        $In_LotAtt06 = $In_LotAtt06_C;
+        $In_LotAtt07 = $In_LotAtt07_C;
+        $In_LotAtt08 = $In_LotAtt08_C;
+        $In_LotAtt09 = $In_LotAtt09_C;
+        $In_LotAtt10 = $In_LotAtt10_C;
+        $In_LotAtt11 = $In_LotAtt11_C;
+        $In_LotAtt12 = $In_LotAtt12_C;
+
+        $In_HoldRejectCode = $In_HoldRejectCode_C;
+        $In_HoldRejectReason = $In_HoldRejectReason_C;
+
+        $In_TOLocation = $In_TOLocation_C;
+        $In_New_TraceID = $In_New_TraceID_C ?? '*';
+        $In_QC_Type = $In_QC_Type_C;
+        $In_FMTraceID = $In_FMTraceID_C;
+        $In_ASNNo = $In_ASNNo_C;
+        $In_ASNLineNo = $In_ASNLineNo_C;
+        $In_PONo = $In_PONo_C;
+        $In_PlanToLoc = $In_PlanToLoc_C;
+
+        $r_nrow = 0;
+
+        $OUT_Return_Code = '*_*';
+        //此处调用必然返回000,所以直接忽视判断进入下层逻辑
+        $OUT_Return_Code = $this->SPUDF_ProcessA($IN_Warehouse,'RCV_BEFORE',$In_ASNNo,$In_ASNLineNo,$In_ReceivedQty,$In_Language,$In_UserID,$OUT_Return_Code);
+
+        //TODO 盲收逻辑 SPASN_Receiving_Process:536行 $In_Process_Action = 2
+
+        //如果订单已经关闭或者取消,则报错
+        $doc_asn_header = DB::connection('oracle')->select(DB::raw("Select count(1)  from DOC_ASN_Header where ASNNO='".$In_ASNNo."' and (ASNStatus='90' or ASNStatus='99')"));
+        if ($doc_asn_header) return '201';
+
+        //收货数量必须大于0
+        if ($In_ReceivedQty <= 0 && ((!$In_ProductStatus) || $In_ProductStatus == '00')) return '204';
+
+        //批次属性自动复制 系统配置是否允许超量收货
+        $customer = DB::connection('oracle')->select(DB::raw("SELECT OverReceiving,OverRCVPercentage,ASN_LNK_PO,AsnRef1ToLot4,AsnRef2ToLot5,AsnRef3ToLot6,AsnRef4ToLot7,AsnRef5ToLot8 FROM Bas_Customer WHERE CustomerID='".$In_CustomerID."' AND Customer_Type = 'OW'"));
+        if (!$customer) return '888BAS_Customer,OPEN';
+
+        $R_OverReceiving = $customer[0]->overreceiving ?? 'N';
+        $R_OverRCVPercentage_Customer = $customer[0]->overrcvpercentage ?? 0;
+        $r_ASN_LNK_PO = $customer[0]->asn_lnk_po ?? 'Y';
+        $R_AsnRef1ToLot4 = $customer[0]->asnref1tolot4;
+        $R_AsnRef2ToLot5 = $customer[0]->asnref2tolot5;
+        $R_AsnRef3ToLot6 = $customer[0]->asnref3tolot6;
+        $R_AsnRef4ToLot7 = $customer[0]->asnref4tolot7;
+        $R_AsnRef5ToLot8 = $customer[0]->asnref5tolot8;
+
+        $DOC_ASN_Header = DB::connection('oracle')->select(DB::raw("SELECT ASNReference1,ASNReference2,ASNReference3,ASNReference4,ASNReference5,ExpectedArriveTime1,ExpectedArriveTime2,QCStatus,ASNType,WarehouseID,ReleaseStatus,Priority FROM DOC_ASN_Header WHERE ASNNO='".$In_ASNNo."'"));
+        if (!$DOC_ASN_Header) return '888DOC_ASN_Header,OPEN';
+
+        $r_ASNReference1 = $DOC_ASN_Header[0]->asnreference1;
+        $r_ASNReference2 = $DOC_ASN_Header[0]->asnreference2;
+        $r_ASNReference3 = $DOC_ASN_Header[0]->asnreference3;
+        $r_ASNReference4 = $DOC_ASN_Header[0]->asnreference4;
+        $r_ASNReference5 = $DOC_ASN_Header[0]->asnreference5;
+        $r_ExpectedArriveTime1 = $DOC_ASN_Header[0]->expectedarrivetime1 ?? "2000-01-01 00:00:00";
+        $r_ExpectedArriveTime2 = $DOC_ASN_Header[0]->expectedarrivetime2 ?? "2099-12-31 00:00:00";
+        $r_QCStatus = $DOC_ASN_Header[0]->qcstatus;
+        $r_ASNType = $DOC_ASN_Header[0]->asntype;
+        $r_WarehouseID = $DOC_ASN_Header[0]->warehouseid;
+        $R_ReleaseStatus = $DOC_ASN_Header[0]->releasestatus;
+        $r_Priority = $DOC_ASN_Header[0]->priority ?? '3';
+
+        if ($R_AsnRef1ToLot4 == 'Y' && ($r_ASNReference1 && $r_ASNReference1 != "*") && ((!$In_LotAtt04) || $In_LotAtt04=='*')){
+            $In_LotAtt04 = $r_ASNReference1;
+        }
+        if ($R_AsnRef2ToLot5 == 'Y' && ($r_ASNReference2 && $r_ASNReference2 != "*") && ((!$In_LotAtt05) || $In_LotAtt05=='*')){
+            $In_LotAtt05 = $r_ASNReference2;
+        }
+        if ($R_AsnRef3ToLot6 == 'Y' && ($r_ASNReference3 && $r_ASNReference3 != "*") && ((!$In_LotAtt06) || $In_LotAtt06=='*')){
+            $In_LotAtt06 = $r_ASNReference3;
+        }
+        if ($R_AsnRef4ToLot7 == 'Y' && ($r_ASNReference4 && $r_ASNReference4 != "*") && ((!$In_LotAtt07) || $In_LotAtt07=='*')){
+            $In_LotAtt07 = $r_ASNReference4;
+        }
+        if ($R_AsnRef5ToLot8 == 'Y' && ($r_ASNReference5 && $r_ASNReference5 != "*") && ((!$In_LotAtt08) || $In_LotAtt08=='*')){
+            $In_LotAtt08 = $r_ASNReference5;
+        }
+
+        if ($In_LotAtt01 == 'YYYY-MM-DD') $In_LotAtt01 = null;
+        if ($In_LotAtt02 == 'YYYY-MM-DD') $In_LotAtt02 = null;
+        if ($In_LotAtt03 == 'YYYY-MM-DD') $In_LotAtt03 = null;
+
+        // TODO SPASN_Receiving_Process:643行 IN_ProductStatus固定值00 跳过
+
+        //生产日期、入库日期、失效日期的逻辑校验
+        if (($In_LotAtt01 && $In_LotAtt02 && Carbon::parse($In_LotAtt01)->gte(Carbon::parse($In_LotAtt02))) || ($In_LotAtt01 && Carbon::parse($In_LotAtt01)->gt(Carbon::parse($R_CurrentTime)))){
+            return "260";
+        }
+        $r_ASN_MDT_CHK = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'ASN_MDT_CHK');
+
+        //入库生产日期不能小于在库库存生产日期
+        if ($r_ASN_MDT_CHK == 'Y' && trim($In_LotAtt01)){
+            $data = DB::connection('oracle')->select(DB::raw("SELECT count(*) c FROM INV_LOT_LOC_ID a,INV_LOT_ATT b, bas_location c WHERE a.CUSTOMERID='".$In_CustomerID.
+                "' AND a.sku='".$In_SKU."' AND a.LotNum=b.LotNum AND a.LocationID=c.LocationID AND c.LocationUsage<>'ST' AND b.LotAtt01>'".$In_LotAtt01."'"));
+            if ($data) return '266INV_LOT_LOC_ID';
+        }
+
+        //批次属性必输校验
+        $BAS_lotID = DB::connection('oracle')->select(DB::raw("SELECT LotAtt01_Flag,LotAtt02_Flag,LotAtt03_Flag,LotAtt04_Flag,LotAtt05_Flag,LotAtt06_Flag,".
+            "LotAtt07_Flag,LotAtt08_Flag,LotAtt09_Flag,LotAtt10_Flag,LotAtt11_Flag,LotAtt12_Flag,OverRCVPercentage,a.LotID,PackID,".
+            "GrossWeight,Cube,CopyPackIDToLotAtt12,AllowReceiving,A.SKU_Group1 FROM Bas_SKU a, BAS_lotID b WHERE a.CustomerID='".$In_CustomerID."' AND a.sku='".$In_SKU."' AND a.LotID=b.LotID"));
+        if (!$BAS_lotID)return "888From Bas_SKU*BAS_lotID,OPEN";
+        $r_LotAtt01_Flag = $BAS_lotID[0]->lotatt01_flag;
+        $r_LotAtt02_Flag = $BAS_lotID[0]->lotatt02_flag;
+        $r_LotAtt03_Flag = $BAS_lotID[0]->lotatt03_flag;
+        $r_LotAtt04_Flag = $BAS_lotID[0]->lotatt04_flag;
+        $r_LotAtt05_Flag = $BAS_lotID[0]->lotatt05_flag;
+        $r_LotAtt06_Flag = $BAS_lotID[0]->lotatt06_flag;
+        $r_LotAtt07_Flag = $BAS_lotID[0]->lotatt07_flag;
+        $r_LotAtt08_Flag = $BAS_lotID[0]->lotatt08_flag;
+        $r_LotAtt09_Flag = $BAS_lotID[0]->lotatt09_flag;
+        $r_LotAtt10_Flag = $BAS_lotID[0]->lotatt10_flag;
+        $r_LotAtt11_Flag = $BAS_lotID[0]->lotatt11_flag;
+        $r_LotAtt12_Flag = $BAS_lotID[0]->lotatt12_flag;
+        $r_OverRCVPercentage_SKU = $BAS_lotID[0]->overrcvpercentage ?? 0;
+        $r_SKU_LOTID = $BAS_lotID[0]->lotid;
+        $r_SKU_PackID = $BAS_lotID[0]->packid;
+        $r_SKU_GrossWeight = $BAS_lotID[0]->grossweight;
+        $r_SKU_Cube = $BAS_lotID[0]->cube;
+        $r_CopyPackIDToLotAtt12 = $BAS_lotID[0]->copypackidtolotatt12;
+        $r_AllowReceiving = $BAS_lotID[0]->allowreceiving;
+        $r_SKU_Group1 = $BAS_lotID[0]->sku_group1;
+        //是否被设置禁止入库
+        if ($r_AllowReceiving == 'N') return "117";
+        if (($r_LotAtt01_Flag == '3' && !$In_LotAtt01) ||
+            ($r_LotAtt02_Flag == "3" && !$In_LotAtt02) ||
+            ($r_LotAtt03_Flag == "3" && !$In_LotAtt03) ||
+            ($r_LotAtt04_Flag == "3" && !$In_LotAtt04) ||
+            ($r_LotAtt05_Flag == "3" && !$In_LotAtt05) ||
+            ($r_LotAtt06_Flag == "3" && !$In_LotAtt06) ||
+            ($r_LotAtt07_Flag == "3" && !$In_LotAtt07) ||
+            ($r_LotAtt08_Flag == "3" && !$In_LotAtt08) ||
+            ($r_LotAtt09_Flag == "3" && !$In_LotAtt09) ||
+            ($r_LotAtt10_Flag == "3" && !$In_LotAtt10) ||
+            ($r_LotAtt11_Flag == "3" && !$In_LotAtt11) ||
+            ($r_LotAtt12_Flag == "3" && !$In_LotAtt12))return "221".$In_ASNLineNo_C;
+        if ($r_LotAtt01_Flag == '1' && $In_LotAtt01) $In_LotAtt01 = null;
+        if ($r_LotAtt02_Flag == '1' && $In_LotAtt02) $In_LotAtt02 = null;
+        if ($r_LotAtt03_Flag == '1' && $In_LotAtt03) $In_LotAtt03 = null;
+        if ($r_LotAtt04_Flag == '1' && $In_LotAtt04) $In_LotAtt04 = null;
+        if ($r_LotAtt05_Flag == '1' && $In_LotAtt05) $In_LotAtt05 = null;
+        if ($r_LotAtt06_Flag == '1' && $In_LotAtt06) $In_LotAtt06 = null;
+        if ($r_LotAtt07_Flag == '1' && $In_LotAtt07) $In_LotAtt07 = null;
+        if ($r_LotAtt08_Flag == '1' && $In_LotAtt08) $In_LotAtt08 = null;
+        if ($r_LotAtt09_Flag == '1' && $In_LotAtt09) $In_LotAtt09 = null;
+        if ($r_LotAtt10_Flag == '1' && $In_LotAtt10) $In_LotAtt10 = null;
+        //if ($r_LotAtt11_Flag == '1' && $In_LotAtt11) $In_LotAtt11 = null;
+        if ($r_LotAtt12_Flag == '1' && $In_LotAtt12) $In_LotAtt12 = null;
+
+        $R_LOT_12_PKG = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'LOT_#12_PKG');
+        // 批次属性12被设置为跟踪包装数量,不允许输入非数字字符'
+        if ($R_LOT_12_PKG == 'Y' && !is_numeric($In_LotAtt12)) return "232";
+
+        if ($r_OverRCVPercentage_SKU != 0) $r_OverRCVPercentage = $r_OverRCVPercentage_SKU;
+        else $r_OverRCVPercentage = $R_OverRCVPercentage_Customer;
+
+        // TODO 药品相关逻辑 SPASN_Receiving_Process:817行 药品有效期 证书有效期 经营许可证有效期校验提示
+
+        //基础设置是否维护完全校验
+        $R_BAS_PAC_CHK = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'BAS_PAC_CHK');
+        $R_BAS_LOT_CHK = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'BAS_LOT_CHK');
+        $R_BAS_GWT_CHK = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'BAS_GWT_CHK');
+        $R_BAS_CUB_CHK = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'BAS_CUB_CHK');
+        if ($R_BAS_PAC_CHK == 'Y' && !$r_SKU_PackID)return '110'.$In_SKU;
+        if ($R_BAS_LOT_CHK == 'Y' && !$r_SKU_LOTID)return '111';
+        if ($R_BAS_GWT_CHK == 'Y' && $r_SKU_GrossWeight == 0)return '112';
+        if ($R_BAS_CUB_CHK == 'Y' && $r_SKU_Cube == 0)return '113';
+
+        //订单释放状态校验
+        if($R_ReleaseStatus == 'N') return '226';
+
+        /*参数准备 */
+        //必须输入价格
+        $R_UNT_PRI_CTL = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'UNT_PRI_CTL');
+        //收货后打印上架标签
+        $R_PRT_PTA_LBL = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'PRT_PTA_LBL');
+        //ASN收货自动产生跟踪号
+        $r_ASN_GEN_TID = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'ASN_GEN_TID');
+        //收货后将收货结果更新ASN明细
+        $r_ASN_RCV_UPD = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'ASN_RCV_UPD');
+        //完全收货后自动关闭ASN
+        $r_RCV_CTL = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'RCV_CTL');
+        //超过产品有效期控制天数是否拒收
+        $r_EXP_CTL = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'EXP_CTL');
+        //码盘后才能收货
+        $r_PLT_RCV = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'PLT_RCV');
+        //跨区域货物是否允许收到一个托盘上
+        $r_RCV_CRS_ARA = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'RCV_CRS_ARA');
+        //收货时必须指定跟踪号
+        $r_RCV_TID_CTL = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'RCV_TID_CTL');
+        //超额收货
+        $R_OverReceiving = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'OVR_RCV');
+        //收货时间必须在预期到货时间范围内
+        $r_RCV_TIM_CTL = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'RCV_TIM_CTL');
+        //同一跟踪号不允许在收货区重复收货
+        $r_RCV_MIX_TID = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'RCV_MIX_TID');
+        //只有上架确认后才能关闭ASN
+        $r_PTA_CLS_CHK = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'PTA_CLS_CHK');
+        //收货数量拆分寻找目标库位
+        $r_RCV_BRK_TSK = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'RCV_BRK_TSK');
+        //扫描收货时记录箱码和序列号
+        $r_SN_CTL = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'SN#_CTL','0');
+        //质检后才能收货
+        $r_QC_RCV_CTL = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'QC_RCV_CTL');
+        //目标库位为拆零拣货位拆箱时作废箱码
+        $r_PCK_LOS_SN = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'PCK_LOS_SN');
+        //服装行业插件开关
+        $r_IND_TEX = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'IND_TEX');
+
+        if ($In_Process_Action != '2'){
+            $DOC_ASN_DETAiLS = DB::connection('oracle')->select(DB::raw("SELECT ExpectedQty_Each,ReceivedQty_Each,POLineNO,PONO,OverRCVPercentage,ContainerID,QCStatus FROM DOC_ASN_DETAiLS WHERE ASNNO='".$In_ASNNo."' AND ASNLineNo='".$In_ASNLineNo."' FOR UPDATE"));
+            if (!$DOC_ASN_DETAiLS)return '104'.$In_ASNNo.":".$In_ASNLineNo;
+            $r_ExpectedQty_Each_ASN = $DOC_ASN_DETAiLS[0]->expectedqty_each;
+            $r_ReceivedQty_Each_ASN = $DOC_ASN_DETAiLS[0]->receivedqty_each;
+            $r_POLineNO = $DOC_ASN_DETAiLS[0]->polineno;
+            $r_PONO = $DOC_ASN_DETAiLS[0]->pono;
+            $R_OverRCVPercentage_ASN = $DOC_ASN_DETAiLS[0]->overrcvpercentage;
+            $r_ASNContainerID = $DOC_ASN_DETAiLS[0]->containerid ?? '';
+            $r_QCStatus = $DOC_ASN_DETAiLS[0]->qcstatus ?? '';
+        }
+
+        //目标库位属性
+        if ($In_TOLocation == '*' || !trim($In_TOLocation))$In_TOLocation = $In_FMLocation;
+
+        $BAS_Location = DB::connection('oracle')->select(DB::raw("SELECT LocationUsage,LoseID_Flag,Mix_Flag,Mix_LotFlag,LocationAttribute,SKUCount FROM BAS_Location WHERE LocationID='".$In_TOLocation."'"));
+        if (!$BAS_Location)return '104'.$In_TOLocation;
+        $R_LocationUsage = $BAS_Location[0]->locationusage;
+        $R_LoseID_Flag = $BAS_Location[0]->loseid_flag ?? 'N';
+        $R_Mix_Flag = $BAS_Location[0]->mix_flag ?? 'Y';
+        $R_Mix_LotFlag = $BAS_Location[0]->mix_lotflag ?? 'Y';
+        $r_LocationAttribute = $BAS_Location[0]->locationattribute;
+        $r_SKUCount = $BAS_Location[0]->skucount;
+
+        if($r_QC_RCV_CTL == 'Y' && $r_QCStatus != '20')return '272';
+
+        //如果ASN中ContainerID有值,并且收货SP没有传递跟踪号,则以ContainerID作为跟踪号
+        if ($r_ASNContainerID && (!$In_New_TraceID || $In_New_TraceID == '*'))$In_New_TraceID = $r_ASNContainerID;
+
+        $IN_New_TraceID_OLD = $In_New_TraceID;
+
+        if ($r_RCV_TID_CTL == 'Y' && (!$In_New_TraceID || $In_New_TraceID=='*'))return '270';
+        //必须维护单价后才能收货
+        if ($R_UNT_PRI_CTL == 'Y'){
+            if (!$In_TotalPrice || $In_TotalPrice <= 0)return '050';
+        }
+
+        if($r_RCV_TIM_CTL == 'Y' && ($R_CurrentTime->lt(Carbon::parse($r_ExpectedArriveTime1)) || $R_CurrentTime->gt($r_ExpectedArriveTime2)))return '271';
+
+        // 同一跟踪号不允许混收产品
+        if (strtoupper($In_FMLocation) == 'SCANSTATION')$r_RCV_MIX_SKU = 'Y';
+        else $r_RCV_MIX_SKU=$this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'RCV_MIX_SKU', 'Y');
+
+        $r_RCV_MIX_GR1 = $this->GETSYS_configuration($IN_Warehouse, $In_CustomerID, $r_ASNType, 'RCV_MIX_GR1', 'Y','C');
+
+        //跟踪号的校验处理
+        if ($In_New_TraceID != '*' && trim($In_New_TraceID)){
+            if ($R_LoseID_Flag == 'N'){
+                if ($r_RCV_MIX_TID == 'N'){ //跟踪号是否可以多次收货
+                    $INV_LOT_LOC_ID = DB::connection('oracle')->select(DB::raw("SELECT COUNT(*) FROM INV_LOT_LOC_ID a INNER JOIN view_MultiWarehouse b ON a.LOCATIONID = b.LOCATIONID WHERE b.WAREHOUSEID = '".
+                        $IN_Warehouse."' AND  TraceID='".$In_New_TraceID."' AND qty>0"));
+                    if ($INV_LOT_LOC_ID) return '218跟踪号重复错误ID='.$In_New_TraceID;
+                }else{
+                    if ($r_RCV_MIX_SKU == 'N'){
+                        $TABLE_INV_LOT_LOC_ID = DB::connection('oracle')->select(DB::raw("SELECT COUNT(*) FROM INV_LOT_LOC_ID a INNER JOIN view_MultiWarehouse b ON a.locationid = b.LocationID WHERE b.WarehouseID = '".
+                        $IN_Warehouse."' AND TraceID = '".$In_New_TraceID."' AND sku <> '".$In_SKU."' AND qty>0"));
+                        if ($TABLE_INV_LOT_LOC_ID) return '273';
+                    }elseif ($r_RCV_MIX_GR1 == 'N'){}//TODO 1065行
+                }
+            }
+        }
+        return $OUT_Return_Code;
+    }
+
+    /** 对于快速入库 $IN_Parameter1 = 'RCV_AFTER' |  'RCV_BEFORE'
+     * 目前该SP只存在 RCV_AFTER(校验近期产品) 且已被注释
+     */
+    private function SPUDF_ProcessA($IN_Warehouse, $IN_Parameter1, $IN_Parameter2, $IN_Parameter3, $IN_Parameter4, $IN_Language, $IN_UserID, $OUT_Return_Code){
+        $r_CurrentTime = Carbon::now();
+
+        //TODO 状态为 分配之前 走此逻辑,本快速入库不存在分配之前 不会走此逻辑 保留一下
+        if ($IN_Parameter1='ALLOCATION_BEFORE'){
+            $doc_order_header = DB::connection('oracle')->select(DB::raw("SELECT t.Carrierid,t.soreference5 FROM DOC_ORDER_HEADER t WHERE  ORDERNO='".$IN_Parameter2."'"));
+            $r_Carrierid = $doc_order_header[0]->carrierid;
+            $r_soreference5 = $doc_order_header[0]->soreference5;
+            if (in_array($r_Carrierid,['ZTO','YUNDA','POSTB','YTO','STO','EMS','SF']) && !$r_soreference5){
+                $OUT_Return_Code = '999面单号未获取!';
+                DB::rollBack();
+                return $OUT_Return_Code;
+            }
+        }
+        //TODO 状态为 导入后的逻辑:SPUDF_ProcessA 77行起 此处忽略 IN_Parameter1='SO_IMPORT_AFTER'
+
+        //TODO 装箱完成前,做一些数据处理:SPUDF_ProcessA 125行起 此处忽略 IN_Parameter1='PACKING_BEFORE'
+
+        //TODO 装箱完成后,做一些数据处理:SPUDF_ProcessA 132行起 此处忽略 IN_Parameter1='PACKING_AFTER'
+
+        //TODO 打印标记:SPUDF_ProcessA 281行起 此处忽略 IN_Parameter1='PRINT'
+
+        //TODO 发货前校验是否全部复核:SPUDF_ProcessA 553行起 此处忽略 IN_Parameter1='SHIP_BEFORE'
+
+        //TODO 转移时校验库位是否允许混放批次:SPUDF_ProcessA 594行起 此处忽略 IN_Parameter1='TRAPPROVE_BEFORE'
+
+        //TODO 分配之后,如果是单品单件订单,更新deliveryno:SPUDF_ProcessA 658行起 此处忽略 IN_Parameter1='ALLOCATION_AFTER'
+
+        //TODO 上架前,校验此货主是否必须有拣货位,如果无拣货位,则拦截   by mxl 20191205:SPUDF_ProcessA 675行起 此处忽略 IN_Parameter1='PA_BEFORE'
+
+        //TODO ASN关闭后  针对JIANSHANG货主,订单关闭后将数据写入临时表CUS_ADJ_H  by mxl 20191217:SPUDF_ProcessA 700行起 此处忽略 IN_Parameter1='ASNCLOSE_AFTER'
+
+        //TODO SO关闭后 针对JIANSHANG货主,订单关闭后将数据写入临时表CUS_ADJ_H  by mxl 20191217:SPUDF_ProcessA 734行起 此处忽略 IN_Parameter1='SHIP_AFTER'
+
+        $OUT_Return_Code = '000';
+        return $OUT_Return_Code;
+    }
+
+    private function GETSYS_configuration($IN_WarehouseID, $IN_CustomerID, $IN_OrderType, $IN_ConfigID, $IN_DefaultValue = 'N', $IN_ValueType = 'C')
+    {
+        if ($IN_ValueType == 'C'){
+            $sys_configuration = DB::connection('oracle')->select(DB::raw("SELECT VALUE_STRING FROM sys_configuration WHERE WarehouseID='".($IN_WarehouseID ?? '*')."' AND CustomerID='".($IN_CustomerID ?? '*')."' AND OrderType='".($IN_OrderType ?? '*')."' AND CONFIG_ID='".$IN_ConfigID."'"));
+            if (!$sys_configuration){
+                $sys_configuration = DB::connection('oracle')->select(DB::raw("SELECT VALUE_STRING FROM sys_configuration WHERE WarehouseID='".($IN_WarehouseID ?? '*')."' AND CustomerID='".($IN_CustomerID ?? '*')."' AND OrderType='*' AND CONFIG_ID='".$IN_ConfigID."'"));
+                if (!$sys_configuration){
+                    $sys_configuration = DB::connection('oracle')->select(DB::raw("SELECT VALUE_STRING FROM sys_configuration WHERE WarehouseID='".($IN_WarehouseID ?? '*')."' AND CustomerID='*' AND OrderType='*' AND CONFIG_ID='".$IN_ConfigID."'"));
+                    if (!$sys_configuration){
+                        $sys_configuration = DB::connection('oracle')->select(DB::raw("SELECT VALUE_STRING FROM sys_configuration WHERE WarehouseID='*' AND CustomerID='*' AND OrderType='*' AND CONFIG_ID='".$IN_ConfigID."'"));
+                        if (!$sys_configuration) return $IN_DefaultValue;
+                    }
+                }
+            }
+            return trim($sys_configuration[0]->value_string);
+        }
+        $sys_configuration = DB::connection('oracle')->select(DB::raw("SELECT VALUE_INT FROM sys_configuration WHERE WarehouseID='".($IN_WarehouseID ?? '*')."' AND CustomerID='".($IN_CustomerID ?? '*')."' AND OrderType='".($IN_OrderType ?? '*')."' AND CONFIG_ID='".$IN_ConfigID."'"));
+        if (!$sys_configuration){
+            $sys_configuration = DB::connection('oracle')->select(DB::raw("SELECT VALUE_INT FROM sys_configuration WHERE WarehouseID='".($IN_WarehouseID ?? '*')."' AND CustomerID='".($IN_CustomerID ?? '*')."' AND OrderType='*' AND CONFIG_ID='".$IN_ConfigID."'"));
+            if (!$sys_configuration){
+                $sys_configuration = DB::connection('oracle')->select(DB::raw("SELECT VALUE_INT FROM sys_configuration WHERE WarehouseID='".($IN_WarehouseID ?? '*')."' AND CustomerID='*' AND OrderType='*' AND CONFIG_ID='".$IN_ConfigID."'"));
+                if (!$sys_configuration){
+                    $sys_configuration = DB::connection('oracle')->select(DB::raw("SELECT VALUE_INT FROM sys_configuration WHERE WarehouseID='*' AND CustomerID='*' AND OrderType='*' AND CONFIG_ID='".$IN_ConfigID."'"));
+                    if (!$sys_configuration) return $IN_DefaultValue;
+                }
+            }
+        }
+        return trim($sys_configuration[0]->value_string);
+    }
 }
 }

+ 20 - 49
app/Http/Controllers/api/thirdPart/haiq/StorageController.php

@@ -21,71 +21,42 @@ class StorageController
         $bin = [
         $bin = [
             "taskCode" => "TEST-BS2010100001",//任务编号 全局唯一
             "taskCode" => "TEST-BS2010100001",//任务编号 全局唯一
             "binCode" => "TEST-BIN01",//料箱编码
             "binCode" => "TEST-BIN01",//料箱编码
-            "toWorkStation" => "TEST-HQ01",//出库工作站
-            "fromWorkStation" => "TEST-HQ01",//回库工作站
-            "fromLocCode" => "TEST-J04-058-3",//源库位编码
-            "toLocCode" => "TEST-J24-128-7",//目标库位编码 出库填多个,表示这些库位都可以支持
+            //"toWorkStation" => "TEST-HQ01",//出库工作站
+            //"fromWorkStation" => "TEST-HQ01",//回库工作站
+            "fromLocCode" => "HAIB1-02-01",//源库位编码
+            "toLocCode" => "HAIB1-02-01",//目标库位编码 出库填多个,表示这些库位都可以支持
             "sequence" => -1,//出库顺序 -1表示没有顺序,只有移库出库时需要指定顺序,其他可为-1
             "sequence" => -1,//出库顺序 -1表示没有顺序,只有移库出库时需要指定顺序,其他可为-1
             "stockInfo" => [$stockInfo],//商品信息
             "stockInfo" => [$stockInfo],//商品信息
         ];
         ];
         $this->request = [[
         $this->request = [[
             "groupCode" => 1,//组号/波次号 一组任务需要一起完成,再开始下一组任务;没有组任务的限制默认传-1或空
             "groupCode" => 1,//组号/波次号 一组任务需要一起完成,再开始下一组任务;没有组任务的限制默认传-1或空
-            "taskMode" => 1,//任务模式 值 1 (输送线入库)值 2 (输送线出库)值 3(货架到缓存货架)值4(货架到流利货架)
+            "taskMode" => 3,//任务模式 值 1 (输送线入库)值 2 (输送线出库)值 3(货架到缓存货架)值4(货架到流利货架)
             "priority" => 99,//优先级 1-2147483647 1最低
             "priority" => 99,//优先级 1-2147483647 1最低
             "sequenceFlag" => -1,//是否需要有序 1:需要有序 0:不需要有序
             "sequenceFlag" => -1,//是否需要有序 1:需要有序 0:不需要有序
             "bins" => [$bin],//可执行货箱任务
             "bins" => [$bin],//可执行货箱任务
         ]];
         ]];
     }
     }
 
 
-    public function out(Request $request){
-        $bin = [
-            "taskCode" => "TEST-BS2010100001",//任务编号
-            "binCode" => "TEST-BIN01",//料箱编码
-            "sequence" => -1,//出库顺序 -1表示没有顺序,只有移库出库时需要指定顺序,其他可为-1
-            "fromLocCode" => "TEST-J04-058-3",//源库位编码
-            "toLocCode" => "TEST-J24-128-7",//目标库位编码 出库填多个,表示这些库位都可以支持
-        ];
+    public function relocate(Request $request){
         $req = [[
         $req = [[
-            "groupCode" => 1,//组号/波次号 决定了出库的顺序,越大优先级越高
-            "priority" => 99,//优先级 1-100 1最低
-            "taskMode" => 1,//任务模式 1(拣货出库) 2(入库指定料箱出库) 3(盘点出库) 4(移库出库) 5(入库不指定料箱出库)
-            "emptyBinQty" => -1,//需求空料箱数量 taskMode 为 3 时必填, 其他时候可以传-1
-            "toWorkStations" => ["TEST-HQ01","TEST-HQ02",],//出库工作站 不指定具体一个,指定多个
-            "bins" => [$bin],//可执行货箱任务
+            "groupCode"=> "test_code2",
+            "priority"=> 1,
+            "taskMode"=> 1,
+            "bins"=> [[
+                "binCode"=> "test_bin_1",
+                "fromLocCode"=> "HAIB1-02-01"
+            ]],
         ]];
         ]];
-
-        $response = Http::post(config('api.haiq.storage.out'),$this->request);
-        return $response;
-        if ($response["code"] != 200){
-            LogService::log(__METHOD__,"haiq-料箱出库失败","REQUEST:".json_encode($req)." | RESPONSE:".$response);
+        $response = Http::post(config('api.haiq.storage.relocate'),$req);
+        if (($response["code"] ?? false) && $response["code"] != 200){
+            LogService::log(__METHOD__,"haiq-料箱出库失败","REQUEST:".json_encode($this->request)." | RESPONSE:".$response);
             return ['success'=>false,"data"=>$response["errMsg"]];
             return ['success'=>false,"data"=>$response["errMsg"]];
         }
         }
-        LogService::log(__METHOD__,"haiq-料箱出库成功","REQUEST:".json_encode($req)." | RESPONSE:".$response);
-        return ["success"=>true];
-    }
-    public function in(Request $request){
-        $stockInfo = [
-            "skuCode" => "TEST-BSSKU",//商品编码 sku
-            "qty" => 9,//数量
-        ];
-        $req = [[
-            "taskCode" => "TEST-BSSTIN2010100001",//任务编号
-            "taskMode" => 1,//任务类型 1(出库回库) 2(入库回库) 3(盘点回库) 4(移库回库)
-            "binCode" => "TEST-BIN01",//料箱编号
-            "fromWorkStation" => "TEST-HQ01",//回库工作站
-            "fromLocCode" => "TEST-JH-0025",//源库位编码
-            "toLocCode" => "TEST-JH-001",//目标库位编码
-            "isEmpty" => 1,//料箱是否为空 0(为空) 1(不为空)
-            "stockInfo" => [$stockInfo],//商品信息
-        ]];
-
-        $response = Http::post(config('api.haiq.storage.in'),$this->request);
-        return $response;
-        if ($response["code"] != 200){
-            LogService::log(__METHOD__,"haiq-料箱回库失败","REQUEST:".json_encode($req)." | RESPONSE:".$response);
-            return ['success'=>false,'data'=>$response["errMsg"]];
+       if (($response["status"] ?? false) && $response["status"] == 500){
+           LogService::log(__METHOD__,"haiq-料箱出库失败","REQUEST:".json_encode($this->request)." | RESPONSE:".$response);
+           return ['success'=>false,"data"=>$response["msg"]];
         }
         }
-        LogService::log(__METHOD__,"haiq-料箱回库成功","REQUEST:".json_encode($req)." | RESPONSE:".$response);
+        LogService::log(__METHOD__,"haiq-料箱出库成功","REQUEST:".json_encode($this->request)." | RESPONSE:".$response);
         return ["success"=>true];
         return ["success"=>true];
     }
     }
 }
 }

+ 1 - 1
app/Http/Controllers/api/thirdPart/weight/PackageController.php

@@ -238,7 +238,7 @@ class PackageController extends Controller
             $logisticNumber=$request['barcode'];
             $logisticNumber=$request['barcode'];
             /** @var $orderService OrderService */
             /** @var $orderService OrderService */
             $orderService = app('orderService');
             $orderService = app('orderService');
-            $order = $orderService->logisticNumberCreateOrder($logisticNumber);
+            $order = $orderService->logisticNumberFirstOrCreateOrder($logisticNumber);
             if (!$order) {
             if (!$order) {
                 $response=["msg"=>"保存时发生错误(未在WMS找到该单)!","code"=>500,"data"=>null];
                 $response=["msg"=>"保存时发生错误(未在WMS找到该单)!","code"=>500,"data"=>null];
                 return json_encode($response,JSON_UNESCAPED_UNICODE);
                 return json_encode($response,JSON_UNESCAPED_UNICODE);

+ 1 - 1
app/OrderPackage.php

@@ -106,7 +106,7 @@ class OrderPackage extends Model
         foreach($resultOracleObjs_grouped as $resultOracleObj_grouped){
         foreach($resultOracleObjs_grouped as $resultOracleObj_grouped){
             $resultOracleObj = $resultOracleObj_grouped[0];
             $resultOracleObj = $resultOracleObj_grouped[0];
             /** @var OrderService */
             /** @var OrderService */
-            $order = app('orderService')->logisticNumberCreateOrder($resultOracleObj['soreference5']);
+            $order = app('orderService')->logisticNumberFirstOrCreateOrder($resultOracleObj['soreference5']);
             if (!$order){
             if (!$order){
                 LogService::log(__METHOD__,"此包裹在WMS未找到order",json_encode($resultOracleObj),Auth::user()['id']);
                 LogService::log(__METHOD__,"此包裹在WMS未找到order",json_encode($resultOracleObj),Auth::user()['id']);
                 continue;
                 continue;

+ 2 - 1
app/Services/OrderPackageService.php

@@ -147,8 +147,9 @@ class OrderPackageService
         $package = OrderPackage::query()->where('logistic_number',$logistic_number)->first();
         $package = OrderPackage::query()->where('logistic_number',$logistic_number)->first();
         if ($package)return $package;
         if ($package)return $package;
 
 
+        $order = app('orderService')->first();
         /** @var OrderService */
         /** @var OrderService */
-        $order = app('orderService')->logisticNumberCreateOrder($logistic_number);
+        $order = app('orderService')->logisticNumberFirstOrCreateOrder($logistic_number);
         if ($order) $values["order_id"] = $order->id;
         if ($order) $values["order_id"] = $order->id;
 
 
         $values["logistic_number"] = $logistic_number;
         $values["logistic_number"] = $logistic_number;

+ 4 - 1
app/Services/OrderService.php

@@ -743,7 +743,7 @@ class OrderService
         return $order->first();
         return $order->first();
     }
     }
 
 
-    public function logisticNumberCreateOrder($logistic_number)
+    public function logisticNumberFirstOrCreateOrder($logistic_number)
     {
     {
         /**
         /**
          * @var OracleActAllocationDetailService
          * @var OracleActAllocationDetailService
@@ -764,6 +764,9 @@ class OrderService
 
 
         if ($orderHeader == null) return null;
         if ($orderHeader == null) return null;
 
 
+        $order = $this->first(['code',$orderHeader->orderno]);
+        if ($order) return $order;
+
         /** @var OwnerService */
         /** @var OwnerService */
         $owner = app('ownerService')->first(['code' => $orderHeader->customerid]);
         $owner = app('ownerService')->first(['code' => $orderHeader->customerid]);
         if (!$owner) {
         if (!$owner) {

+ 2 - 0
app/Services/PackageService.php

@@ -26,6 +26,8 @@ Class PackageService
             'batch_number' => ['like' => ''],
             'batch_number' => ['like' => ''],
             'created_at_start' => ['alias' => 'created_at','startDate' => " 00:00:00"],
             'created_at_start' => ['alias' => 'created_at','startDate' => " 00:00:00"],
             'created_at_end' => ['alias' => 'created_at','endDate' => " 23:59:59"],
             'created_at_end' => ['alias' => 'created_at','endDate' => " 23:59:59"],
+            'weighed_at_start' => ['alias' => 'weighed_at','startDate' => " 00:00:00"],
+            'weighed_at_end' => ['alias' => 'weighed_at','endDate' => " 23:59:59"],
             'id' => ['multi' => ','],
             'id' => ['multi' => ','],
         ];
         ];
         $packages = app(QueryService::class)->query($params,$packages,$columnQueryRules,"order_packages");
         $packages = app(QueryService::class)->query($params,$packages,$columnQueryRules,"order_packages");

+ 2 - 2
app/Services/ProcessStatisticService.php

@@ -40,8 +40,8 @@ Class ProcessStatisticService
             unset($params['process_method_id']);
             unset($params['process_method_id']);
         }
         }
         $columnQueryRules=[
         $columnQueryRules=[
-            'started_at' => ['startDate' => ' 00:00:00'],
-            'ended_at' => ['endDate' => ' 23:59:59'],
+            'started_at_start' => ['alias' => 'started_at','startDate' => ' 00:00:00'],
+            'started_at_end' => ['alias' => 'started_at','endDate' => ' 23:59:59'],
             'process_id' => ['multi' => ','],
             'process_id' => ['multi' => ','],
         ];
         ];
         $query = app(QueryService::class)->query($params,$query,$columnQueryRules,"process_statistics");
         $query = app(QueryService::class)->query($params,$query,$columnQueryRules,"process_statistics");

+ 1 - 3
config/api.php

@@ -31,9 +31,7 @@ return [
 
 
     'haiq'=>[
     'haiq'=>[
         'storage'=>[
         'storage'=>[
-            'out' => "http://59.37.126.227:65448/api/haiqEss/gr/HAIQ_ESS_BIN_OUTBOUND_MSG",
-            //'in' => "http://59.37.126.227:65448/api/haiqEss/gr/HAIQ_ESS_BIN_INBOUND_MSG",
-            'in' => "http://59.37.126.227:65448/api/haiqEss/gr/relocate",
+            'relocate' => "http://59.37.126.227:65448/api/haiqEss/gr/relocate",
         ],
         ],
     ],
     ],
 
 

+ 20 - 0
resources/views/exception/authority.blade.php

@@ -0,0 +1,20 @@
+@extends('layouts.app')
+
+@section('content')
+    <div class="container-fluid">
+        <div class="row justify-content-center">
+            <div class="col-md-8">
+                <div class="card">
+                    <div class="card-body h-100">
+                        <div class="text-center m-auto">
+                            <h2 class="text-danger" style="text-shadow: 1px 1px 0px #212121;">您无权访问!</h2>
+                            <a href="javascript:;" onclick="javascript:history.back(-1);">
+                                <button class="btn btn-dark w-25 mt-5">回到上一页</button>
+                            </a>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+@endsection

+ 2 - 2
resources/views/process/statistic.blade.php

@@ -126,7 +126,7 @@
                 $('#statistics').removeClass('d-none');
                 $('#statistics').removeClass('d-none');
                 let data=[
                 let data=[
                     [
                     [
-                        {name: 'started_at', type: 'dateTime', tip: '选择显示指定日期的起始时间'},
+                        {name: 'started_at_start', type: 'dateTime', tip: '选择显示指定日期的起始时间'},
                         {
                         {
                             name: 'owner_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的客户'],
                             name: 'owner_id', type: 'select_multiple_select', tip: ['输入关键词快速定位下拉列表,回车确定', '选择要显示的客户'],
                             placeholder: ['货主', '定位或多选货主'], data: this.owners
                             placeholder: ['货主', '定位或多选货主'], data: this.owners
@@ -134,7 +134,7 @@
                         {name: 'process_method_id', type: 'select', placeholder: '加工类型', data: this.processMethods},
                         {name: 'process_method_id', type: 'select', placeholder: '加工类型', data: this.processMethods},
                     ],
                     ],
                     [
                     [
-                        {name: 'ended_at', type: 'dateTime', tip: '选择显示指定日期的结束时间'},
+                        {name: 'started_at_end', type: 'dateTime', tip: '选择显示指定日期的结束时间'},
                         {name: 'code', type: 'input', tip: '任务号:可在两侧增加百分号(%)进行模糊搜索', placeholder: '任务号'},
                         {name: 'code', type: 'input', tip: '任务号:可在两侧增加百分号(%)进行模糊搜索', placeholder: '任务号'},
                         {name: 'status', type: 'select', placeholder: '状态', data: this.status},
                         {name: 'status', type: 'select', placeholder: '状态', data: this.status},
                     ],
                     ],

+ 9 - 3
resources/views/waybill/index.blade.php

@@ -197,7 +197,7 @@
                     </div>
                     </div>
                 </div>
                 </div>
             </div>
             </div>
-            <div class="text-info h5 btn btn">{{$waybills->count()}}/{{$waybills->total()}}</div>
+            <div class="text-info h5 btn btn">@{{ ((page-1)*paginate) + count }}/{{$waybills->total()}}</div>
             {{$waybills->appends($paginateParams)->links()}}
             {{$waybills->appends($paginateParams)->links()}}
         </div>
         </div>
     </div>
     </div>
@@ -335,6 +335,9 @@
                 imgs:'',
                 imgs:'',
                 is_ownerSelectShow:true,
                 is_ownerSelectShow:true,
                 sum:{!! $waybills->total() !!},
                 sum:{!! $waybills->total() !!},
+                paginate : 50,
+                page : Number('{{$waybills->currentPage()}}'),
+                count : Number('{{$waybills->count()}}'),
             },
             },
             watch:{
             watch:{
                 checkData:{
                 checkData:{
@@ -365,7 +368,8 @@
                     [
                     [
                         {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的客户'],
                         {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的客户'],
                             placeholder:['货主','定位或多选货主'],data:this.owners},
                             placeholder:['货主','定位或多选货主'],data:this.owners},
-                        {name:'created_at_start',type:'dateTimeLocal',tip:'选择显示指定日期的起始时间'},
+                        {name:'created_at_start',type:'time',tip:['选择显示指定日期的起始时间','选择显示指定日期的起始时间']},
+                        //{name:'created_at_start',type:'dateTimeLocal',tip:'选择显示指定日期的起始时间'},
                         {name:'origination',type:'input',tip:'始发地:可在左侧增加百分号(%)进行模糊搜索',placeholder: '始发地'},
                         {name:'origination',type:'input',tip:'始发地:可在左侧增加百分号(%)进行模糊搜索',placeholder: '始发地'},
                         {name:'carrier_bill',type:'input',tip:'承运商单号:可在左侧增加百分号(%)进行模糊搜索',placeholder: '承运商单号'},
                         {name:'carrier_bill',type:'input',tip:'承运商单号:可在左侧增加百分号(%)进行模糊搜索',placeholder: '承运商单号'},
                         {name:'status',type:'select',placeholder: '运单状态',data:this.status},
                         {name:'status',type:'select',placeholder: '运单状态',data:this.status},
@@ -373,7 +377,8 @@
                     ],
                     ],
                     [
                     [
                         {name:'wms_bill_number',type:'input',tip:'WMS单号:可在两侧增加百分号(%)进行模糊搜索',placeholder: 'WMS单号'},
                         {name:'wms_bill_number',type:'input',tip:'WMS单号:可在两侧增加百分号(%)进行模糊搜索',placeholder: 'WMS单号'},
-                        {name:'created_at_end',type:'dateTimeLocal',tip:'选择显示指定日期的结束时间'},
+                        {name:'created_at_end',type:'time',tip:['选择显示指定日期的结束时间','选择显示指定日期的结束时间']},
+                        //{name:'created_at_end',type:'dateTimeLocal',tip:'选择显示指定日期的结束时间'},
                         {name:'destination',type:'input',tip:'目的地:可在两侧增加百分号(%)进行模糊搜索',placeholder: '目的地'},
                         {name:'destination',type:'input',tip:'目的地:可在两侧增加百分号(%)进行模糊搜索',placeholder: '目的地'},
                         {name:'waybill_number',type:'input',tip:'运单号:可在两侧增加百分号(%)进行模糊搜索',placeholder: '运单号'},
                         {name:'waybill_number',type:'input',tip:'运单号:可在两侧增加百分号(%)进行模糊搜索',placeholder: '运单号'},
                         {name:'carrier_id',type:'select',placeholder: '承运商',data:this.carriers},
                         {name:'carrier_id',type:'select',placeholder: '承运商',data:this.carriers},
@@ -437,6 +442,7 @@
                     });
                     });
                     header.init();
                     header.init();
                 },0);
                 },0);
+                this.paginate = $("#paginate").val();
             },
             },
             methods:{
             methods:{
                 btnRefreshWeightZoomIn(waybill){
                 btnRefreshWeightZoomIn(waybill){

+ 4 - 2
resources/views/weight/package/index.blade.php

@@ -97,12 +97,14 @@
                 $('#list').removeClass('d-none');
                 $('#list').removeClass('d-none');
                 let _this = this;
                 let _this = this;
                 let data = [[
                 let data = [[
-                    {name:'created_at_start',type:'dateTime',tip:'选择显示指定日期的起始时间'},
+                    {name:'created_at_start',type:'dateTime',tip:'选择显示创建日期的起始时间'},
+                    {name:'weighed_at_start',type:'dateTime',tip:'选择显示称重日期的起始时间'},
                     {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的客户'],
                     {name:'owner_id',type:'select_multiple_select',tip:['输入关键词快速定位下拉列表,回车确定','选择要显示的客户'],
                         placeholder:['货主','定位或多选货主'],data:_this.owners},
                         placeholder:['货主','定位或多选货主'],data:_this.owners},
                     {name:'logistic_number',type:'input',tip:'快递单号:可在两侧增加百分号(%)进行模糊搜索',placeholder:'快递单号'},
                     {name:'logistic_number',type:'input',tip:'快递单号:可在两侧增加百分号(%)进行模糊搜索',placeholder:'快递单号'},
                 ],[
                 ],[
-                    {name:'created_at_end',type:'dateTime',tip:'选择显示指定日期的结束时间'},
+                    {name:'created_at_end',type:'dateTime',tip:'选择显示创建日期的结束时间'},
+                    {name:'weighed_at_end',type:'dateTime',tip:'选择显示称重日期的结束时间'},
                     {name:'batch_number',type:'input',tip:'波次号:可在两侧增加百分号(%)进行模糊搜索',placeholder:'波次号'}
                     {name:'batch_number',type:'input',tip:'波次号:可在两侧增加百分号(%)进行模糊搜索',placeholder:'波次号'}
                 ]];
                 ]];
 
 

+ 1 - 2
routes/api/thirdPart/haiq.php

@@ -8,6 +8,5 @@ use Illuminate\Support\Facades\Route;
 
 
 
 
 Route::group(['prefix'=>'storage'],function(){
 Route::group(['prefix'=>'storage'],function(){
-    Route::post('out', "StorageController@out");//出库
-    Route::post('in', "StorageController@in");//入库
+    Route::post('relocate', "StorageController@relocate");//移库
 });
 });

+ 2 - 0
routes/web.php

@@ -29,6 +29,8 @@ Route::group(['prefix'=>'password'],function(){
     Route::post('update', 'Auth\PasswordController@update');
     Route::post('update', 'Auth\PasswordController@update');
 });
 });
 
 
+/** 全局 */
+Route::get('denied',function (){return view('exception.authority');});
 /** 基础设置 */
 /** 基础设置 */
 Route::group(['prefix'=>'maintenance'],function(){
 Route::group(['prefix'=>'maintenance'],function(){
     /** 商品 */
     /** 商品 */

+ 1 - 1
tests/webApi/thirdPart/haiq/storage.http

@@ -5,7 +5,7 @@
 ## * 'ptr' and 'ptrp' create a POST request with a simple or parameter-like body;
 ## * 'ptr' and 'ptrp' create a POST request with a simple or parameter-like body;
 ## * 'mptr' and 'fptr' create a POST request to submit a form with a text or file field (multipart/form-data);
 ## * 'mptr' and 'fptr' create a POST request to submit a form with a text or file field (multipart/form-data);
 
 
-POST http://bswas/api/thirdPart/haiq/storage/in
+POST http://bswas/api/thirdPart/haiq/storage/relocate
 
 
 ###
 ###