StoreController.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. <?php
  2. namespace App\Http\Controllers;
  3. use App\Components\ErrorPush;
  4. use App\Depository;
  5. use App\Owner;
  6. use App\Services\common\BatchUpdateService;
  7. use App\Services\OwnerService;
  8. use App\Services\StoreService;
  9. use App\Station;
  10. use App\Store;
  11. use App\StoreItem;
  12. use App\Warehouse;
  13. use App\WMSReflectReceive;
  14. use Carbon\Carbon;
  15. use Illuminate\Contracts\Foundation\Application;
  16. use Illuminate\Contracts\View\Factory;
  17. use Illuminate\Database\Eloquent\Builder;
  18. use Illuminate\Http\RedirectResponse;
  19. use Illuminate\Http\Request;
  20. use Illuminate\Http\Response;
  21. use Illuminate\Routing\Redirector;
  22. use Illuminate\Support\Facades\Auth;
  23. use Illuminate\Support\Facades\DB;
  24. use Illuminate\Support\Facades\Gate;
  25. use Illuminate\Support\Facades\Validator;
  26. use Illuminate\View\View;
  27. use App\Http\Controllers\api\thirdPart\flux\StoreController as FStoreController;
  28. class StoreController extends Controller
  29. {
  30. use ErrorPush;
  31. public function storage(Request $request)
  32. {
  33. if(!Gate::allows('入库管理-入库-查询')){ return redirect(url('/')); }
  34. /** @var StoreService $storeService */
  35. $paginateParams=$request->input();
  36. $storeService=app(StoreService::class);
  37. $stores=$storeService->paginate($request->input());
  38. $warehouses=Warehouse::query()->get();
  39. /** @var OwnerService $service */
  40. $service = app("OwnerService");
  41. $owners=Owner::query()->select(["id","name","is_check_asn"])->whereIn('id', $service->getQuery())->whereNull('deleted_at')->get();
  42. return view('store.inStorage.index',compact('stores','warehouses','owners','paginateParams'));
  43. }
  44. /**
  45. * Display a listing of the resource.
  46. *
  47. * @return Application|Factory|Response|View
  48. */
  49. public function index()
  50. {
  51. if(!Gate::allows('入库管理-快速入库-查询')){ return redirect(url('/')); }
  52. $stores=Store::query()->with(['warehouse','owner'])
  53. ->where('is_fast_stored','快速入库')
  54. ->orderBy('id','DESC')->paginate(50);
  55. return view('store.fast.index',['stores'=>$stores]);
  56. }
  57. /**
  58. * Show the form for creating a new resource.
  59. *
  60. * @return Application|Factory|Response|View
  61. */
  62. public function create()
  63. {
  64. if(!Gate::allows('入库管理-快速入库-录入')){ return redirect(url('/')); }
  65. return view('store.fast.create');
  66. }
  67. /**
  68. * Store a newly created resource in storage.
  69. *
  70. * @param Request $request
  71. * @return RedirectResponse|Response|Redirector
  72. */
  73. public function store(Request $request)
  74. {
  75. if(!Gate::allows('入库管理-快速入库-录入')){ return redirect(url('/')); }
  76. $this->validator($request);
  77. if ($request->test)$result = $this->quickStorage($request->input('asn_code'),$request->input('quality') == '正品' ? 'ZP' : 'CC',$request->input('depository_code'));
  78. else $result = $this->quickStorage_temp($request->input('asn_code'),$request->input('quality'),$request->input('depository_code'));
  79. $response = redirect('store/fast/create');
  80. if ($result['success'])return redirect('store/fast/create')->with('successTip',$result['data']);
  81. return $response->with('successError',$result['data']);
  82. }
  83. public function quickStorage_temp($asn,$quality,$depository_code){
  84. $WMSReflectReceive=WMSReflectReceive::with('skus')->where('ASNNO',$asn)->first();
  85. if (!$WMSReflectReceive)return ['success'=>false, 'data'=>"ASN编号不存在!"];
  86. $warehouse=Warehouse::query()->where('code',$WMSReflectReceive->WAREHOUSEID)->first();
  87. if (!$warehouse&&$WMSReflectReceive->WAREHOUSEID){
  88. $warehouse=new Warehouse([
  89. 'name'=>$WMSReflectReceive->WAREHOUSEID,
  90. 'code'=>$WMSReflectReceive->WAREHOUSEID
  91. ]);
  92. $warehouse->save();
  93. }
  94. $owner=Owner::query()->where('code',$WMSReflectReceive->CUSTOMERID)->first();
  95. if (!$owner&&$WMSReflectReceive->CUSTOMERID){
  96. $owner=new Owner([
  97. 'name'=>$WMSReflectReceive->CUSTOMERID,
  98. 'code'=>$WMSReflectReceive->CUSTOMERID
  99. ]);
  100. $owner->save();
  101. }
  102. $store=Store::query()->where('asn_code',$WMSReflectReceive->ASNNO)->first();
  103. if(!$store){
  104. $store=new Store([
  105. 'asn_code'=>$WMSReflectReceive->ASNNO,
  106. 'warehouse_id'=>$warehouse->id,
  107. 'owner_id'=>$owner->id,
  108. 'stored_method'=>'快速入库',
  109. 'status'=>'未入库',
  110. 'remark'=>$WMSReflectReceive->NOTES,
  111. 'is_fast_stored'=>'快速入库',
  112. ]);
  113. $store->save();
  114. $customDepository=(function()use($depository_code){
  115. $customDepository=Depository::query()->where('code',$depository_code)->first();
  116. if($depository_code){
  117. if (!$customDepository){
  118. $depository=new Depository([
  119. 'name'=>$depository_code,
  120. 'code'=>$depository_code
  121. ]);
  122. $depository->save();
  123. }
  124. }
  125. return $customDepository;
  126. })();
  127. if ($WMSReflectReceive->skus){
  128. foreach ($WMSReflectReceive->skus as $sku){
  129. $depository=(function()use($sku,$customDepository){
  130. if($customDepository)return $customDepository;
  131. $depository=Depository::query()->where('code',$sku->LOTATT05)->first();
  132. if (!$depository){
  133. if (!$sku->LOTATT05)return $depository;
  134. $depository=new Depository([
  135. 'name'=>$sku->LOTATT05,
  136. 'code'=>$sku->LOTATT05
  137. ]);
  138. $depository->save();
  139. }
  140. return $depository;
  141. })();
  142. $storeItem=new StoreItem([
  143. 'store_id'=>$store->id,
  144. 'asn_line_code'=>$sku->ASNLINENO,
  145. 'name'=>$sku->SKUDESCRC,
  146. 'sku'=>$sku->SKU,
  147. 'barcode'=>$sku->ALTERNATE_SKU1,
  148. 'quality'=>$quality,
  149. 'status'=>'未入库',
  150. ]);
  151. if ($depository)$storeItem->depository_id=$depository->id;
  152. $storeItem->save();
  153. }
  154. }
  155. }
  156. /** @var Store $store */
  157. $store=Store::with('storeItems')->where('asn_code',$asn)->first();
  158. $storeApi=new FStoreController();
  159. $result=$storeApi->accomplishToWMS($store,[
  160. 'quality'=>$quality,
  161. 'depository_code'=>$depository_code,
  162. 'follow_code'=>$store['id'],
  163. ]);
  164. if ($result){
  165. $store->status='已入库';
  166. $store->save();
  167. if ($store->storeItems){
  168. $store->storeItems->each(function ($storeItem)use($quality){
  169. $storeItem->status='已入库';
  170. $storeItem->quality=$quality;
  171. $storeItem->save();
  172. });
  173. }
  174. return ['success'=>true, 'data'=>"成功!"];
  175. }
  176. return ['success'=>false, 'data'=>"失败!请检查错误日志"];
  177. }
  178. public function quickStorage($asnno,$quality,$depository_code,$isVerification = true)
  179. {
  180. $task = Store::query()->where("asn_code",$asnno)
  181. ->where(function ($query){
  182. /** @var Builder $query */
  183. $query->where("stored_method","快速入库")
  184. ->orWhere('is_fast_stored','快速入库');
  185. })
  186. ->where("status","已入库")->first();
  187. if ($task)return ['success'=>false, 'data'=>"已被快速入库"];
  188. $db = DB::connection('oracle');
  189. $query = DB::raw("SELECT * FROM DOC_ASN_HEADER WHERE ASNNO = ?");
  190. $asn = $db->selectOne($query,[$asnno]);
  191. if (!$asn) return ['success'=>false, 'data'=>"单据号不存在"];
  192. if ($asn->asnstatus != '00')return ['success'=>false, 'data'=>'单据号状态非创建订单'];
  193. if ($isVerification){
  194. if (array_search($asn->customerid,array_values(config('stores.owners'))) === false)return ['success'=>false, 'data'=>"不允许该货主快速入库"];
  195. if (array_search($asn->asntype,array_values(config('stores.types'))) === false)return ['success'=>false, 'data'=>"该单据类型不允许被入库"];
  196. }
  197. $query = DB::raw("SELECT b.ALTERNATE_SKU1,h.WAREHOUSEID,h.asnno,d.ASNLINENO,d.SKUDESCRC,h.CUSTOMERID,d.SKU,d.PACKID,d.RECEIVEDQTY_EACH,d.EXPECTEDQTY_EACH,d.LOTATT01,d.LOTATT02,d.lotatt04,".
  198. "d.lotatt05,d.lotatt08,d.USERDEFINE1,d.USERDEFINE2,d.USERDEFINE3,d.USERDEFINE4,d.USERDEFINE5,d.RECEIVINGLOCATION FROM DOC_ASN_DETAILS d ".
  199. " 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 = ?");
  200. $details = $db->select($query,[$asnno]);
  201. $username = config('database.connections.oracle.username');
  202. $password = config('database.connections.oracle.password');
  203. $host = config('database.connections.oracle.host');
  204. $service_name = config('database.connections.oracle.service_name');
  205. $conn = oci_connect($username, $password, $host . '/' . $service_name,"utf8");
  206. $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," .
  207. ":In_ProductStatus_Descr, :In_HoldRejectCode_C, :In_HoldRejectReason_C, :In_PONo_C, :In_CustomerID, :In_SKU, :In_ReceivedQty, :In_RejectedQty,:In_UOM, :In_PackID," .
  208. " :In_ContainerID, :In_LotAtt01_C, :In_LotAtt02_C, :In_LotAtt03_C, :In_LotAtt04_C, :In_LotAtt05_C, :In_LotAtt06_C," .
  209. ":In_LotAtt07_C, :In_LotAtt08_C, :In_LotAtt09_C, :In_LotAtt10_C, :In_LotAtt11_C, :In_LotAtt12_C," .
  210. ":In_TotalCubic, :In_TotalGrossWeight, :In_TotalNetWeight, :In_TotalPrice, :In_UserDefine1, :In_UserDefine2,:In_UserDefine3, :In_UserDefine4, :In_UserDefine5, :In_FMLocation," .
  211. ":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;";
  212. $items = [];
  213. $toDay = Carbon::now()->toDateTimeString();
  214. $depositories = [];
  215. $traceId = 'W'.rand(0,9).date('ymd').substr($asnno,-4).rand(0,9);
  216. foreach ($details as $detail) {
  217. $result = $this->executeSP($detail,$asnno,$depository_code,$db,$quality,$conn,$sql_sp,$traceId);
  218. if (substr($result, 0, 3) != '000') {
  219. oci_close($conn);
  220. $this->push(__METHOD__."->".__LINE__,"快速入库-FLUX收货失败","ASNNO:".$asnno."Trace:{$traceId}".";ERROR:".$result);
  221. return ['success' => false, 'data' => $detail->asnlineno.'收货失败,错误代码:'.$result];
  222. }
  223. if (!isset($depositories[$detail->lotatt05]) && $detail->lotatt05){
  224. $depository = app('DepositoryService')->firstOrCreate(["code"=>$detail->lotatt05],["code"=>$detail->lotatt05,"name"=>$detail->lotatt05]);
  225. $depositories[$detail->lotatt05] = $depository->id;
  226. }
  227. $item = [
  228. "asn_line_code" => $detail->asnlineno,
  229. "name" => $detail->skudescrc,
  230. "sku" => $detail->sku,
  231. "barcode" => $detail->alternate_sku1,
  232. "amount" => $detail->expectedqty_each,
  233. "quality" => $quality == 'ZP' ? '正品' : '残次',
  234. "status" => "已入库",
  235. "created_at" => $toDay
  236. ];
  237. if (isset($depositories[$detail->lotatt05]))$item["depository_id"] = $depositories[$detail->lotatt05];
  238. $items[] = $item;
  239. }
  240. oci_close($conn);
  241. $warehouse = app('WarehouseService')->firstOrCreate(["code"=>$asn->warehouseid],["code"=>$asn->warehouseid,"name"=>$asn->warehouseid]);
  242. $owner = app('OwnerService')->firstOrCreate(['code'=>$asn->customerid],['code'=>$asn->customerid,"name"=>$asn->customerid]);
  243. $store = Store::query()->with("storeItems")->where("asn_code",$asnno)->first();
  244. if (!$store){
  245. $store = app('StoreService')->create([
  246. 'asn_code'=>$asnno,
  247. 'warehouse_id'=>$warehouse->id,
  248. 'owner_id'=>$owner->id,
  249. 'stored_method'=>'快速入库',
  250. 'status'=>'已入库',
  251. 'remark'=>$asn->notes,
  252. ]);
  253. app('LogService')->log(__METHOD__,"快速入库",json_encode($store));
  254. foreach ($items as &$item){
  255. $item["store_id"] = $store->id;
  256. }
  257. app('StoreItemService')->insert($items);
  258. app('LogService')->log(__METHOD__,"快速录入子项",json_encode($items));
  259. }else{
  260. $store->update([
  261. 'asn_code'=>$asnno,
  262. 'warehouse_id'=>$warehouse->id,
  263. 'owner_id'=>$owner->id,
  264. 'stored_method'=>'快速入库',
  265. 'status'=>'已入库',
  266. 'remark'=>$asn->notes,
  267. ]);
  268. $insertItem = [];
  269. if ($store->storeItems){
  270. $updateItem = [["id","asn_line_code","name","sku","barcode","amount","quality","status"]];
  271. $existItem = [];
  272. $store->storeItems->each(function ($item)use(&$existItem){
  273. $existItem[$item->asn_line_code] = $item->id;
  274. });
  275. foreach ($items as $item){
  276. if (isset($existItem[$item['asn_line_code']])){
  277. $item["id"] = $existItem[$item['asn_line_code']];
  278. $updateItem[] = $item;
  279. }else {
  280. $item["store_id"] = $store->id;
  281. $insertItem[] = $item;
  282. }
  283. }
  284. if (count($updateItem) > 1) app(BatchUpdateService::class)->batchUpdate("store_items",$updateItem);
  285. }else{
  286. foreach ($items as $item){
  287. $item["store_id"] = $store->id;
  288. $insertItem[] = $item;
  289. }
  290. }
  291. if ($insertItem)app('StoreItemService')->insert($items);
  292. }
  293. return ['success'=>true,"data"=>"已成功将“".$asnno."”入库"];
  294. }
  295. private function executeSP($detail, $asnno, $depository_code, $db, $quality, $conn, $sql_sp,$traceId){
  296. $IN_Warehouse = $detail->warehouseid ?? '';
  297. $In_Process_Action = '3';
  298. $In_ASNNo_C = $detail->asnno ?? '';
  299. $In_ASNLineNo_C = $detail->asnlineno ?? '';
  300. $In_FMTraceID_C = '';
  301. $In_New_TraceID_C = $traceId;
  302. $In_ProductStatus = '00';
  303. $In_ProductStatus_Descr = '正常';
  304. $In_HoldRejectCode_C = 'OK';
  305. $In_HoldRejectReason_C = '正常';
  306. $In_PONo_C = '';
  307. $In_CustomerID = $detail->customerid ?? '';
  308. $In_SKU = $detail->sku ?? '';
  309. $In_ReceivedQty = (string)((int)$detail->expectedqty_each - (int)$detail->receivedqty_each) ?? '';
  310. $In_RejectedQty = '';
  311. $In_UOM = 'EA';
  312. $In_PackID = $detail->packid ?? '';
  313. $In_ContainerID = '';
  314. $In_LotAtt01_C = $detail->lotatt01 ?? '';
  315. $In_LotAtt02_C = $detail->lotatt02 ?? '';
  316. $In_LotAtt03_C = '';
  317. $In_LotAtt04_C = $detail->lotatt04 ?? '';
  318. $In_LotAtt05_C = $detail->lotatt05 ?? '';
  319. $In_LotAtt06_C = '';
  320. $In_LotAtt07_C = '';
  321. $In_LotAtt08_C = $detail->lotatt08 ?? '';
  322. $In_LotAtt09_C = '';
  323. $In_LotAtt10_C = '';
  324. $In_LotAtt11_C = '';
  325. $In_LotAtt12_C = '';
  326. $In_TotalCubic = '0.00';
  327. $In_TotalGrossWeight = '0.00';
  328. $In_TotalNetWeight = '0.00';
  329. $In_TotalPrice = '0.00';
  330. $In_UserDefine1 = $detail->userdefine1 ?? '';
  331. $In_UserDefine2 = $detail->userdefine2 ?? '';
  332. $In_UserDefine3 = $detail->userdefine3 ?? '';
  333. $In_UserDefine4 = $detail->userdefine4 ?? '';
  334. $In_UserDefine5 = $detail->userdefine5 ?? '';
  335. $In_FMLocation = 'STAGE' . $detail->warehouseid;
  336. $In_TOLocation_C = 'STAGE' . $detail->warehouseid;
  337. $In_QC_Type_C = 'OK';
  338. $In_PlanToLoc_C = '';
  339. $In_ReceivingTime = '';
  340. $In_LPN = '*';
  341. $In_Operator = 'WCS';
  342. $IN_RCVModule = '';
  343. $IN_RCVStation = '';
  344. $In_Language = 'cn';
  345. $In_UserID = 'WCS';
  346. $result = '';
  347. if ($depository_code && (strtoupper($depository_code) != strtoupper($detail->receivinglocation))){
  348. $query = DB::raw("UPDATE DOC_ASN_DETAILS SET RECEIVINGLOCATION = ? WHERE ASNNO = ? AND ASNLINENO = ?");
  349. $db->update($query,[$depository_code,$detail->asnno,$detail->asnlineno]);
  350. $db->commit();
  351. app('LogService')->log(__METHOD__,"快速入库-修改FULX属性仓","ASNNO:".$asnno.";原仓:".$detail->receivinglocation.";修改为:".$depository_code);
  352. }
  353. if ($quality && ($quality != $detail->lotatt08)){
  354. $query = DB::raw("UPDATE DOC_ASN_DETAILS SET LOTATT08 = ? WHERE ASNNO = ? AND ASNLINENO = ?");
  355. $db->update($query,[$quality,$detail->asnno,$detail->asnlineno]);
  356. $db->commit();
  357. app('LogService')->log(__METHOD__,"快速入库-修改FULX质量状态","ASNNO:".$asnno.";原质量:".$detail->lotatt08.";修改为:".$quality);
  358. $In_LotAtt08_C = $quality;
  359. }
  360. $stmt = oci_parse($conn, $sql_sp);
  361. oci_bind_by_name($stmt, ':IN_Warehouse', $IN_Warehouse);
  362. oci_bind_by_name($stmt, ':In_Process_Action', $In_Process_Action);
  363. oci_bind_by_name($stmt, ':In_ASNNo_C', $In_ASNNo_C);
  364. oci_bind_by_name($stmt, ':In_ASNLineNo_C', $In_ASNLineNo_C);
  365. oci_bind_by_name($stmt, ':In_FMTraceID_C', $In_FMTraceID_C);
  366. oci_bind_by_name($stmt, ':In_New_TraceID_C', $In_New_TraceID_C);
  367. oci_bind_by_name($stmt, ':In_ProductStatus', $In_ProductStatus);
  368. oci_bind_by_name($stmt, ':In_ProductStatus_Descr', $In_ProductStatus_Descr);
  369. oci_bind_by_name($stmt, ':In_HoldRejectCode_C', $In_HoldRejectCode_C);
  370. oci_bind_by_name($stmt, ':In_HoldRejectReason_C', $In_HoldRejectReason_C);
  371. oci_bind_by_name($stmt, ':In_PONo_C', $In_PONo_C);
  372. oci_bind_by_name($stmt, ':In_CustomerID', $In_CustomerID);
  373. oci_bind_by_name($stmt, ':In_SKU', $In_SKU);
  374. oci_bind_by_name($stmt, ':In_ReceivedQty', $In_ReceivedQty);
  375. oci_bind_by_name($stmt, ':In_RejectedQty', $In_RejectedQty);
  376. oci_bind_by_name($stmt, ':In_UOM', $In_UOM);
  377. oci_bind_by_name($stmt, ':In_PackID', $In_PackID);
  378. oci_bind_by_name($stmt, ':In_ContainerID', $In_ContainerID);
  379. oci_bind_by_name($stmt, ':In_LotAtt01_C', $In_LotAtt01_C);
  380. oci_bind_by_name($stmt, ':In_LotAtt02_C', $In_LotAtt02_C);
  381. oci_bind_by_name($stmt, ':In_LotAtt03_C', $In_LotAtt03_C);
  382. oci_bind_by_name($stmt, ':In_LotAtt04_C', $In_LotAtt04_C);
  383. oci_bind_by_name($stmt, ':In_LotAtt05_C', $In_LotAtt05_C);
  384. oci_bind_by_name($stmt, ':In_LotAtt06_C', $In_LotAtt06_C);
  385. oci_bind_by_name($stmt, ':In_LotAtt07_C', $In_LotAtt07_C);
  386. oci_bind_by_name($stmt, ':In_LotAtt08_C', $In_LotAtt08_C);
  387. oci_bind_by_name($stmt, ':In_LotAtt09_C', $In_LotAtt09_C);
  388. oci_bind_by_name($stmt, ':In_LotAtt10_C', $In_LotAtt10_C);
  389. oci_bind_by_name($stmt, ':In_LotAtt11_C', $In_LotAtt11_C);
  390. oci_bind_by_name($stmt, ':In_LotAtt12_C', $In_LotAtt12_C);
  391. oci_bind_by_name($stmt, ':In_TotalCubic', $In_TotalCubic);
  392. oci_bind_by_name($stmt, ':In_TotalGrossWeight', $In_TotalGrossWeight);
  393. oci_bind_by_name($stmt, ':In_TotalNetWeight', $In_TotalNetWeight);
  394. oci_bind_by_name($stmt, ':In_TotalPrice', $In_TotalPrice);
  395. oci_bind_by_name($stmt, ':In_UserDefine1', $In_UserDefine1);
  396. oci_bind_by_name($stmt, ':In_UserDefine2', $In_UserDefine2);
  397. oci_bind_by_name($stmt, ':In_UserDefine3', $In_UserDefine3);
  398. oci_bind_by_name($stmt, ':In_UserDefine4', $In_UserDefine4);
  399. oci_bind_by_name($stmt, ':In_UserDefine5', $In_UserDefine5);
  400. oci_bind_by_name($stmt, ':In_FMLocation', $In_FMLocation);
  401. oci_bind_by_name($stmt, ':In_TOLocation_C', $In_TOLocation_C);
  402. oci_bind_by_name($stmt, ':In_QC_Type_C', $In_QC_Type_C);
  403. oci_bind_by_name($stmt, ':In_PlanToLoc_C', $In_PlanToLoc_C);
  404. oci_bind_by_name($stmt, ':In_ReceivingTime', $In_ReceivingTime);
  405. oci_bind_by_name($stmt, ':In_LPN', $In_LPN);
  406. oci_bind_by_name($stmt, ':In_Operator', $In_Operator);
  407. oci_bind_by_name($stmt, ':IN_RCVModule', $IN_RCVModule);
  408. oci_bind_by_name($stmt, ':IN_RCVStation', $IN_RCVStation);
  409. oci_bind_by_name($stmt, ':In_Language', $In_Language);
  410. oci_bind_by_name($stmt, ':In_UserID', $In_UserID);
  411. oci_bind_by_name($stmt, ':OUT_Return_Code', $result,300);
  412. oci_execute($stmt);
  413. return $result;
  414. }
  415. public function validator(Request $request){
  416. $validator=Validator::make($request->input(),[
  417. 'asn_code'=>['required'],
  418. 'quality'=>['required'],
  419. 'depository_code'=>['nullable','string'],
  420. ],[
  421. 'required'=>':attribute 为必填项',
  422. 'unique'=>':attribute 已存在',
  423. ],[
  424. 'asn_code'=>'ASN编号',
  425. 'quality'=>'货物类型'
  426. ])->validate();
  427. return $validator;
  428. }
  429. /**
  430. * 缓存架入库表单
  431. */
  432. public function cacheRackStorage()
  433. {
  434. $stations = Station::query()->where("parent_id",6)->get();
  435. return \view("store.inStorage.cacheRackStorage",compact("stations"));
  436. }
  437. /**
  438. * 缓存架半箱入库
  439. */
  440. public function halfChestStorage()
  441. {
  442. $stations = app("StationService")->getCacheShelf();
  443. return \view("store.inStorage.halfChestStorage",compact("stations"));
  444. }
  445. }