StoreController.php 22 KB

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