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

入库管理-快速入库,直接读取FLUX数据库,废弃WMS下发映射表w_m_s_reflect_receive_skus与w_m_s_reflect_receives

Zhouzhendong преди 5 години
родител
ревизия
4985647525

+ 167 - 127
app/Http/Controllers/StoreController.php

@@ -9,6 +9,7 @@ use App\Store;
 use App\StoreItems;
 use App\Warehouse;
 use App\WMSReflectReceive;
+use Carbon\Carbon;
 use Illuminate\Contracts\Foundation\Application;
 use Illuminate\Contracts\View\Factory;
 use Illuminate\Http\RedirectResponse;
@@ -52,16 +53,16 @@ class StoreController extends Controller
      * @return RedirectResponse|Response|Redirector
      */
     public function store(Request $request)
-    {
+    { //TODO 不依赖于FLUX的下发,was主动读取oracle并校验参数,此情况会导致was stores内仅存在已入库单
         if(!Gate::allows('入库管理-快速入库-录入')){ return redirect(url('/'));  }
         $this->validator($request);
-        $result = $this->quickStorage($request->input('asn_code'),$request->input('quality'),$request->input('depository_code'));
+        $result = $this->quickStorage($request->input('asn_code'),$request->input('quality') == '正品' ? 'ZP' : 'CC',$request->input('depository_code'));
         $response = redirect('store/fast/create');
         if ($result['success'])return redirect('store/fast/create')->with('successTip',$result['data']);
         else return $response->with('successError',$result['data']);
     }
 
-    public function quickStorage($asn,$quality,$depository_code){
+    public function quickStorage_temp($asn,$quality,$depository_code){
         $WMSReflectReceive=WMSReflectReceive::with('skus')->where('ASNNO',$asn)->first();
         if (!$WMSReflectReceive)return ['success'=>false, 'data'=>"ASN编号不存在!"];
         $warehouse=Warehouse::query()->where('code',$WMSReflectReceive->WAREHOUSEID)->first();
@@ -153,15 +154,16 @@ class StoreController extends Controller
         return ['success'=>false, 'data'=>"失败!请检查错误日志"];
     }
 
-    public function fluxReceiving($asnno,$quality,$depository_code)
+    public function quickStorage($asnno,$quality,$depository_code)
     {
         $db = DB::connection('oracle');
-        $query = DB::raw("SELECT asnstatus FROM DOC_ASN_HEADER WHERE ASNNO = ?");
+        $query = DB::raw("SELECT * FROM DOC_ASN_HEADER WHERE ASNNO = ?");
         $asn = $db->selectOne($query,[$asnno]);
         if (!$asn) return ['success'=>false, 'data'=>"单据号不存在"];
-        if ((int)$asn->asnstatus > 40)return ['success'=>false, 'data'=>'单据号已完成收货'];
-        $query = DB::raw("SELECT h.WAREHOUSEID,h.asnno,d.ASNLINENO,h.CUSTOMERID,d.SKU,d.PACKID,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 INNER JOIN DOC_ASN_HEADER h ON d.ASNNO = h.ASNNO WHERE h.ASNNO = ?");
+        if ((int)$asn->asnstatus >= 40)return ['success'=>false, 'data'=>'单据号已完成收货'];
+        $query = DB::raw("SELECT b.ALTERNATE_SKU1,h.WAREHOUSEID,h.asnno,d.ASNLINENO,d.SKUDESCRC,h.CUSTOMERID,d.SKU,d.PACKID,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 = ?");
         $details = $db->select($query,[$asnno]);
 
         $username = config('database.connections.oracle.username');
@@ -175,132 +177,170 @@ class StoreController extends Controller
             ":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;";
+        $items = [];
+        $toDay = Carbon::now()->toDateTimeString();
+        $depositories = [];
         foreach ($details as $detail) {
-            $IN_Warehouse = $detail->warehouseid ?? '';
-            $In_Process_Action = '3';
-            $In_ASNNo_C = $detail->asnno ?? '';
-            $In_ASNLineNo_C = $detail->asnlineno ?? '';
-            $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 = $detail->customerid ?? '';
-            $In_SKU = $detail->sku ?? '';
-            $In_ReceivedQty = $detail->expectedqty_each ?? '';
-            $In_RejectedQty = '';
-            $In_UOM = 'EA';
-            $In_PackID = $detail->packid ?? '';
-            $In_ContainerID = '';
-            $In_LotAtt01_C = $detail->lotatt01 ?? '';
-            $In_LotAtt02_C = $detail->lotatt02 ?? '';
-            $In_LotAtt03_C = '';
-            $In_LotAtt04_C = $detail->lotatt04 ?? '';
-            $In_LotAtt05_C = $detail->lotatt05 ?? '';
-            $In_LotAtt06_C = '';
-            $In_LotAtt07_C = '';
-            $In_LotAtt08_C = $detail->lotatt08 ?? '';
-            $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 = $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;
-            $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 = '';
-            if ($depository_code && (strtoupper($depository_code) != strtoupper($detail->receivinglocation))){
-                $query = DB::raw("UPDATE DOC_ASN_DETAILS SET RECEIVINGLOCATION = ?  WHERE ASNNO = ? AND ASNLINENO = ?");
-                $db->update($query,[$depository_code,$detail->asnno,$detail->asnlineno]);
-                $db->commit();
-                LogService::log(__METHOD__,"快速入库-修改FULX属性仓","ASNNO:".$asnno.";原仓:".$detail->receivinglocation.";修改为:".$depository_code);
-            }
-            if ($quality && ($quality != $detail->lotatt08)){
-                $query = DB::raw("UPDATE DOC_ASN_DETAILS SET LOTATT08 = ?  WHERE ASNNO = ? AND ASNLINENO = ?");
-                $db->update($query,[$query,$detail->asnno,$detail->asnlineno]);
-                $db->commit();
-                LogService::log(__METHOD__,"快速入库-修改FULX质量状态","ASNNO:".$asnno.";原质量:".$detail->lotatt08.";修改为:".$quality);
-                $In_LotAtt08_C = $query;
-            }
-            $stmt = oci_parse($conn, $sql_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);
+            $result = $this->executeSP($detail,$asnno,$depository_code,$db,$quality,$conn,$sql_sp);
             if (substr($result, 0, 3) != '000') {
                 oci_close($conn);
                 LogService::log(__METHOD__,"快速入库-FLUX收货失败","ASNNO:".$asnno.";ERROR:".$result);
-                return ['success' => false, 'data' => $In_ASNLineNo_C.'收货失败', 'code' => $result];
+                return ['success' => false, 'data' => $detail->asnlineno.'收货失败,错误代码:'.$result];
             }
+            if (!isset($depositories[$detail->lotatt05])){
+                $depository = app('depositoryService')->firstOrCreate(["code"=>$detail->lotatt05],["code"=>$detail->lotatt05,"name"=>$detail->lotatt05]);
+                $depositories[$detail->lotatt05] = $depository->id;
+            }
+            $items[] = [
+                "asn_line_code" => $detail->asnlineno,
+                "name" => $detail->skudescrc,
+                "sku" => $detail->sku,
+                "barcode" => $detail->alternate_sku1,
+                "depository_id" => $depositories[$detail->lotatt05],
+                "amount" => $detail->expectedqty_each,
+                "quality" => $quality == 'ZP' ? '正品' : '残次',
+                "status" => "已入库",
+                "created_at" => $toDay
+            ];
         }
         oci_close($conn);
-        return ['success'=>true];
+        $warehouse = app('warehouseService')->firstOrCreate(["code"=>$asn->warehouseid],["code"=>$asn->warehouseid,"name"=>$asn->warehouseid]);
+        $owner = app('ownerService')->firstOrCreate(['code'=>$asn->customerid],['code'=>$asn->customerid,"name"=>$asn->customerid]);
+        $store = app('storeService')->create([
+            'asn_code'=>$asnno,
+            'warehouse_id'=>$warehouse->id,
+            'owner_id'=>$owner->id,
+            'stored_method'=>'快速入库',
+            'status'=>'已入库',
+            'remark'=>$asn->notes,
+        ]);
+        LogService::log(__METHOD__,"快速入库",json_encode($store));
+        foreach ($items as $item){
+            $item["store_id"] = $store->id;
+        }
+        app('storeItemService')->insert($items);
+        return ['success'=>true,"data"=>"已成功将“".$asnno."”入库"];
+    }
+
+    private function executeSP($detail, $asnno, $depository_code, $db, $quality, $conn, $sql_sp){
+        $IN_Warehouse = $detail->warehouseid ?? '';
+        $In_Process_Action = '3';
+        $In_ASNNo_C = $detail->asnno ?? '';
+        $In_ASNLineNo_C = $detail->asnlineno ?? '';
+        $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 = $detail->customerid ?? '';
+        $In_SKU = $detail->sku ?? '';
+        $In_ReceivedQty = $detail->expectedqty_each ?? '';
+        $In_RejectedQty = '';
+        $In_UOM = 'EA';
+        $In_PackID = $detail->packid ?? '';
+        $In_ContainerID = '';
+        $In_LotAtt01_C = $detail->lotatt01 ?? '';
+        $In_LotAtt02_C = $detail->lotatt02 ?? '';
+        $In_LotAtt03_C = '';
+        $In_LotAtt04_C = $detail->lotatt04 ?? '';
+        $In_LotAtt05_C = $detail->lotatt05 ?? '';
+        $In_LotAtt06_C = '';
+        $In_LotAtt07_C = '';
+        $In_LotAtt08_C = $detail->lotatt08 ?? '';
+        $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 = $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;
+        $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 = '';
+        if ($depository_code && (strtoupper($depository_code) != strtoupper($detail->receivinglocation))){
+            $query = DB::raw("UPDATE DOC_ASN_DETAILS SET RECEIVINGLOCATION = ?  WHERE ASNNO = ? AND ASNLINENO = ?");
+            $db->update($query,[$depository_code,$detail->asnno,$detail->asnlineno]);
+            $db->commit();
+            LogService::log(__METHOD__,"快速入库-修改FULX属性仓","ASNNO:".$asnno.";原仓:".$detail->receivinglocation.";修改为:".$depository_code);
+        }
+        if ($quality && ($quality != $detail->lotatt08)){
+            $query = DB::raw("UPDATE DOC_ASN_DETAILS SET LOTATT08 = ?  WHERE ASNNO = ? AND ASNLINENO = ?");
+            $db->update($query,[$quality,$detail->asnno,$detail->asnlineno]);
+            $db->commit();
+            LogService::log(__METHOD__,"快速入库-修改FULX质量状态","ASNNO:".$asnno.";原质量:".$detail->lotatt08.";修改为:".$quality);
+            $In_LotAtt08_C = $quality;
+        }
+        $stmt = oci_parse($conn, $sql_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);
+        return $result;
     }
 
 

+ 0 - 85
app/Http/Controllers/WMSReflectReceiveController.php

@@ -1,85 +0,0 @@
-<?php
-
-namespace App\Http\Controllers;
-
-use App\WMSReflectReceive;
-use Illuminate\Http\Request;
-
-class WMSReflectReceiveController extends Controller
-{
-    /**
-     * Display a listing of the resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function index()
-    {
-        //
-    }
-
-    /**
-     * Show the form for creating a new resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function create()
-    {
-        //
-    }
-
-    /**
-     * Store a newly created resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @return \Illuminate\Http\Response
-     */
-    public function store(Request $request)
-    {
-        //
-    }
-
-    /**
-     * Display the specified resource.
-     *
-     * @param  \App\WMSReflectReceive  $wMSReflectReceive
-     * @return \Illuminate\Http\Response
-     */
-    public function show(WMSReflectReceive $wMSReflectReceive)
-    {
-        //
-    }
-
-    /**
-     * Show the form for editing the specified resource.
-     *
-     * @param  \App\WMSReflectReceive  $wMSReflectReceive
-     * @return \Illuminate\Http\Response
-     */
-    public function edit(WMSReflectReceive $wMSReflectReceive)
-    {
-        //
-    }
-
-    /**
-     * Update the specified resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  \App\WMSReflectReceive  $wMSReflectReceive
-     * @return \Illuminate\Http\Response
-     */
-    public function update(Request $request, WMSReflectReceive $wMSReflectReceive)
-    {
-        //
-    }
-
-    /**
-     * Remove the specified resource from storage.
-     *
-     * @param  \App\WMSReflectReceive  $wMSReflectReceive
-     * @return \Illuminate\Http\Response
-     */
-    public function destroy(WMSReflectReceive $wMSReflectReceive)
-    {
-        //
-    }
-}

+ 0 - 85
app/Http/Controllers/WMSReflectReceiveSkuController.php

@@ -1,85 +0,0 @@
-<?php
-
-namespace App\Http\Controllers;
-
-use App\WMSReflectReceiveSku;
-use Illuminate\Http\Request;
-
-class WMSReflectReceiveSkuController extends Controller
-{
-    /**
-     * Display a listing of the resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function index()
-    {
-        //
-    }
-
-    /**
-     * Show the form for creating a new resource.
-     *
-     * @return \Illuminate\Http\Response
-     */
-    public function create()
-    {
-        //
-    }
-
-    /**
-     * Store a newly created resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @return \Illuminate\Http\Response
-     */
-    public function store(Request $request)
-    {
-        //
-    }
-
-    /**
-     * Display the specified resource.
-     *
-     * @param  \App\WMSReflectReceiveSku  $wMSReflectReceiveSku
-     * @return \Illuminate\Http\Response
-     */
-    public function show(WMSReflectReceiveSku $wMSReflectReceiveSku)
-    {
-        //
-    }
-
-    /**
-     * Show the form for editing the specified resource.
-     *
-     * @param  \App\WMSReflectReceiveSku  $wMSReflectReceiveSku
-     * @return \Illuminate\Http\Response
-     */
-    public function edit(WMSReflectReceiveSku $wMSReflectReceiveSku)
-    {
-        //
-    }
-
-    /**
-     * Update the specified resource in storage.
-     *
-     * @param  \Illuminate\Http\Request  $request
-     * @param  \App\WMSReflectReceiveSku  $wMSReflectReceiveSku
-     * @return \Illuminate\Http\Response
-     */
-    public function update(Request $request, WMSReflectReceiveSku $wMSReflectReceiveSku)
-    {
-        //
-    }
-
-    /**
-     * Remove the specified resource from storage.
-     *
-     * @param  \App\WMSReflectReceiveSku  $wMSReflectReceiveSku
-     * @return \Illuminate\Http\Response
-     */
-    public function destroy(WMSReflectReceiveSku $wMSReflectReceiveSku)
-    {
-        //
-    }
-}

+ 0 - 159
app/Http/Controllers/api/thirdPart/flux/StoreController.php

@@ -129,163 +129,4 @@ class StoreController extends Controller
 
         return $success;
     }
-
-    public function quickStorage_temp($docno)
-    {
-        $db = DB::connection('oracle');
-        //判断单据有效性
-        $cus_bs_asnheader = $db->select(DB::raw("SELECT t.addwho FROM CUS_BS_ASNHEADER t WHERE t.ASNREFERENCE1 = '" . $docno . "'"));
-        if (!$cus_bs_asnheader) return ['success' => false, 'data' => '单据不存在'];
-        $addwho = $cus_bs_asnheader[0]->addwho;
-        if ($addwho == "WCS") {
-            //判断单据状态
-            $cus_bs_asnheader = $db->select(
-                DB::raw("SELECT 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->select(DB::raw($sql));
-            $db->beginTransaction();
-            try {
-                $username = config('database.connections.oracle.username');
-                $password = config('database.connections.oracle.password');
-                $host = config('database.connections.oracle.host');
-                $service_name = config('database.connections.oracle.service_name');
-                $conn = oci_connect($username, $password, $host . '/' . $service_name);
-                $sql_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;";
-                foreach ($doc_asn_details as $doc_asn_detail) {
-                    $IN_Warehouse = $doc_asn_detail->warehouseid ?? '';
-                    $In_Process_Action = '3';
-                    $In_ASNNo_C = $doc_asn_detail->docno ?? '';
-                    $In_ASNLineNo_C = $doc_asn_detail->asnlineno ?? '';
-                    $In_FMTraceID_C = '';
-                    $In_New_TraceID_C = $doc_asn_detail->new_traceid ?? '';
-                    $In_ProductStatus = '00';
-                    $In_ProductStatus_Descr = '正常';
-                    $In_HoldRejectCode_C = 'OK';
-                    $In_HoldRejectReason_C = '正常';
-                    $In_PONo_C = '';
-                    $In_CustomerID = $doc_asn_detail->customerid ?? '';
-                    $In_SKU = $doc_asn_detail->sku ?? '';
-                    $In_ReceivedQty = $doc_asn_detail->receivedqty_each ?? '';
-                    $In_RejectedQty = '';
-                    $In_UOM = 'EA';
-                    $In_PackID = $doc_asn_detail->packid ?? '';
-                    $In_ContainerID = '';
-                    $In_LotAtt01_C = $doc_asn_detail->lotatt01 ?? '';
-                    $In_LotAtt02_C = $doc_asn_detail->lotatt02 ?? '';
-                    $In_LotAtt03_C = '';
-                    $In_LotAtt04_C = $doc_asn_detail->lotatt04 ?? '';
-                    $In_LotAtt05_C = $doc_asn_detail->lotatt05 ?? '';
-                    $In_LotAtt06_C = '';
-                    $In_LotAtt07_C = '';
-                    $In_LotAtt08_C = $doc_asn_detail->lotatt08 ?? '';
-                    $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 = $doc_asn_detail->userdefine1 ?? '';
-                    $In_UserDefine2 = $doc_asn_detail->userdefine2 ?? '';
-                    $In_UserDefine3 = $doc_asn_detail->userdefine3 ?? '';
-                    $In_UserDefine4 = $doc_asn_detail->userdefine4 ?? '';
-                    $In_UserDefine5 = $doc_asn_detail->userdefine5 ?? '';
-                    $In_FMLocation = 'STAGE' . $doc_asn_detail->warehouseid;
-                    $In_TOLocation_C = 'STAGE' . $doc_asn_detail->warehouseid;
-                    $In_QC_Type_C = 'OK';
-                    $In_PlanToLoc_C = '';
-                    $In_ReceivingTime = '';
-                    $In_LPN = '*';
-                    $In_Operator = $doc_asn_detail->addwho ?? '';
-                    $IN_RCVModule = '';
-                    $IN_RCVStation = '';
-                    $In_Language = 'cn';
-                    $In_UserID = $doc_asn_detail->addwho ?? '';
-                    $result = '';
-                    $stmt = oci_parse($conn, $sql_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);
-                    oci_execute($stmt);
-                    oci_close($conn);
-                    if (substr($result, 0, 3) == '000') {
-                        $query = DB::raw("update cus_bs_asndetails t set t.rcvflag = 'Y' where t.asnno = ? and t.asnlineno = ?");
-                        $db->update($query, [$doc_asn_detail->docno, $doc_asn_detail->asnlineno]);
-                    } else {
-                        $query = DB::raw("update cus_bs_asndetails t set t.rcvflag = 'W' where t.asnno = ? and t.asnlineno = ?");
-                        $db->update($query, [$doc_asn_detail->docno, $doc_asn_detail->asnlineno]);
-                        $db->rollBack();
-                        return ['success' => false, 'data' => '收货失败', 'code' => $result];
-                    }
-                }
-                $db->commit();
-                return ['success' => true];
-            } catch (\Exception $e) {
-                $db->rollBack();
-                return ['success' => false, 'data' => $e->getMessage()];
-            }
-        }
-    }
 }

+ 6 - 0
app/Providers/AppServiceProvider.php

@@ -37,6 +37,9 @@ use App\Services\ShopService;
 use App\Services\RejectedService;
 use App\Services\StoreCheckingReceiveItemService;
 use App\Services\StoreCheckingReceiveService;
+use App\Services\StoreItemService;
+use App\Services\StoreService;
+use App\Services\WarehouseService;
 use App\Services\WaybillFinancialService;
 use App\Services\WeighExceptedService;
 use Illuminate\Queue\Events\JobFailed;
@@ -117,6 +120,9 @@ class AppServiceProvider extends ServiceProvider
         app()->singleton('oracleDocAsnDetailService',OracleDocAsnDetailService::class);
         app()->singleton('inventoryAccountMissionService',InventoryAccountMissionService::class);
         app()->singleton('processesContentService',ProcessesContentService::class);
+        app()->singleton('storeService',StoreService::class);
+        app()->singleton('warehouseService',WarehouseService::class);
+        app()->singleton('storeItemService',StoreItemService::class);
 
         $this->loadingOrderModuleService();
         $this->loadingBasedModuleService();

+ 13 - 0
app/Services/StoreItemService.php

@@ -0,0 +1,13 @@
+<?php 
+
+namespace App\Services; 
+
+use Illuminate\Support\Facades\DB;
+
+Class StoreItemService
+{ 
+    public function insert(array $params){
+        return DB::table('store_items')->insert($params);
+    }
+
+}

+ 13 - 0
app/Services/StoreService.php

@@ -0,0 +1,13 @@
+<?php 
+
+namespace App\Services; 
+
+use App\Store;
+
+Class StoreService
+{ 
+    public function create(array $params){
+        return Store::query()->create($params);
+    }
+
+}

+ 14 - 0
app/Services/WarehouseService.php

@@ -0,0 +1,14 @@
+<?php 
+
+namespace App\Services; 
+
+use App\Warehouse;
+
+Class WarehouseService
+{ 
+    public function firstOrCreate(array $params, array $values = null){
+        if ($values)return Warehouse::query()->firstOrCreate($params,$values);
+        return Warehouse::query()->firstOrCreate($params);
+    }
+
+}