|
|
@@ -36,13 +36,23 @@ class UpdatePickZone implements ToCollection,WithHeadingRow
|
|
|
$errors = [];
|
|
|
$ids = [];
|
|
|
foreach ($collection as $index=>$item){
|
|
|
+ if (!$item["订单编号"] && !$item["生产日期"] && !$item["失效日期"] && !$item["商品条码"] && !$item["数量"])continue;
|
|
|
+ if (!$item["订单编号"]){
|
|
|
+ $errors[] = "第“" . ($index + 2) . "”行订单编号为空";
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (!$item["商品条码"]){
|
|
|
+ $errors[] = "“{$item['订单编号']}”商品条码为空";
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
if ($item["生产日期"]){
|
|
|
if (is_numeric($item["生产日期"]))$item["生产日期"] = formatExcelDate($item["生产日期"]);
|
|
|
else{
|
|
|
try{
|
|
|
$item["生产日期"]=Carbon::parse($item["生产日期"])->format('Y-m-d');
|
|
|
}catch (\Exception $e){
|
|
|
- $errors[] = "第“" . ($index + 2) . "”生产日期无法识别";
|
|
|
+ $errors[] = "“{$item["订单编号"]}”生产日期无法识别";
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
@@ -53,22 +63,14 @@ class UpdatePickZone implements ToCollection,WithHeadingRow
|
|
|
try{
|
|
|
$item["失效日期"]=Carbon::parse($item["失效日期"])->format('Y-m-d');
|
|
|
}catch (\Exception $e){
|
|
|
- $errors[] = "第“" . ($index + 2) . "”失效日期无法识别";
|
|
|
+ $errors[] = "“{$item['订单编号']}”失效日期无法识别";
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (!$item["订单编号"]){
|
|
|
- $errors[] = "第“" . ($index + 2) . "”行订单编号为空";
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (!$item["商品条码"]){
|
|
|
- $errors[] = "第“" . ($index + 2) . "”行商品条码为空";
|
|
|
- continue;
|
|
|
- }
|
|
|
if (!$item["生产日期"] && !$item["失效日期"]){
|
|
|
- $errors[] = "第“" . ($index + 2) . "”行不存在日期";
|
|
|
+ $errors[] = "“{$item['订单编号']}”不存在日期";
|
|
|
continue;
|
|
|
}
|
|
|
$detail = OracleDOCOrderDetail::query()->select("DOC_ORDER_DETAILS.customerid","DOC_ORDER_DETAILS.sku","DOC_ORDER_DETAILS.orderno","DOC_ORDER_DETAILS.orderlineno","sostatus")
|
|
|
@@ -78,11 +80,11 @@ class UpdatePickZone implements ToCollection,WithHeadingRow
|
|
|
$query->where("alternate_sku1",$item["商品条码"]);
|
|
|
})->leftJoin("DOC_ORDER_HEADER","DOC_ORDER_DETAILS.ORDERNO","=","DOC_ORDER_HEADER.ORDERNO")->first();
|
|
|
if (!$detail){
|
|
|
- $errors[] = "第“" . ($index + 2) . "”行未知订单商品";
|
|
|
+ $errors[] = "“{$item['订单编号']}”未知订单商品";
|
|
|
continue;
|
|
|
}
|
|
|
if ($detail->sostatus != '00'){
|
|
|
- $errors[] = "第“" . ($index + 2) . "”行订单状态不为创建订单";
|
|
|
+ $errors[] = "“{$item['订单编号']}”订单状态不为创建订单";
|
|
|
continue;
|
|
|
}
|
|
|
$sql = "select BAS_ZONE.DESCR,INV_LOT_LOC_ID.LOCATIONID,INV_LOT_LOC_ID.LOTNUM,BAS_LOCATION.PICKZONE,(INV_LOT_LOC_ID.QTY-INV_LOT_LOC_ID.QTYALLOCATED-QTYONHOLD-QTYRPOUT-QTYMVOUT) AS qty from INV_LOT_ATT LEFT JOIN
|
|
|
@@ -101,7 +103,7 @@ class UpdatePickZone implements ToCollection,WithHeadingRow
|
|
|
|
|
|
$lots = DB::connection("oracle")->select(DB::raw($sql),$bindings);
|
|
|
if (!$lots){
|
|
|
- $errors[] = "第“" . ($index + 2) . "”行未找到库位";
|
|
|
+ $errors[] = "“{$item['订单编号']}”未找到库位";
|
|
|
continue;
|
|
|
}
|
|
|
$result = null;
|
|
|
@@ -135,12 +137,12 @@ class UpdatePickZone implements ToCollection,WithHeadingRow
|
|
|
LogService::log(__METHOD__,"SUCCESS-指定效期分配修改库位",json_encode($detail)." | ".json_encode($result));
|
|
|
$order = app("OrderService")->first(["code"=>$item["订单编号"]]);
|
|
|
if (!$order){
|
|
|
- $errors[] = "第“" . ($index + 2) . "”行已成功修改FLUX库位但在本地未找到订单";
|
|
|
+ $errors[] = "“{$item['订单编号']}”已成功修改FLUX库位但在本地未找到订单";
|
|
|
continue;
|
|
|
}
|
|
|
$barcode = app("CommodityBarcodeService")->first(["code"=>$item["商品条码"]]);
|
|
|
if (!$barcode){
|
|
|
- $errors[] = "第“" . ($index + 2) . "”行已成功修改FLUX库位但在本地未找到条码";
|
|
|
+ $errors[] = "“{$item['订单编号']}”已成功修改FLUX库位但在本地未找到条码";
|
|
|
continue;
|
|
|
}
|
|
|
$model = app("OrderCommodityAssignService")->create([
|
|
|
@@ -159,23 +161,25 @@ class UpdatePickZone implements ToCollection,WithHeadingRow
|
|
|
}catch (\Exception $e){
|
|
|
LogService::log(__METHOD__,"ERROR-指定效期分配修改库位",json_encode($detail)." | ".json_encode($result));
|
|
|
}
|
|
|
- }else $errors[] = "第“" . ($index + 2) . "”行未找到可分配库位";
|
|
|
+ }else $errors[] = "“{$item['订单编号']}”未找到可分配库位";
|
|
|
}
|
|
|
- $assigns = app("OrderCommodityAssignService")->get(["id"=>$ids]);
|
|
|
$models = [];
|
|
|
- foreach ($assigns as $assign){
|
|
|
- $models[] = [
|
|
|
- "orderNumber" => $assign->order ? $assign->order->code : '',
|
|
|
- "barcode" => $assign->commodity ? $assign->commodity->barcode : '',
|
|
|
- "amount" => $assign->amount,
|
|
|
- "producedAt" => $assign->produced_at,
|
|
|
- "validAt" => $assign->valid_at,
|
|
|
- "batchNumber" => $assign->batch_number,
|
|
|
- "location" => $assign->location,
|
|
|
- "region" => $assign->region,
|
|
|
- "createdAt" => $assign->created_at,
|
|
|
- "userName" => $assign->user ? $assign->user->name : 'system',
|
|
|
- ];
|
|
|
+ if ($ids){
|
|
|
+ $assigns = app("OrderCommodityAssignService")->get(["id"=>$ids]);
|
|
|
+ foreach ($assigns as $assign){
|
|
|
+ $models[] = [
|
|
|
+ "orderNumber" => $assign->order ? $assign->order->code : '',
|
|
|
+ "barcode" => $assign->commodity ? $assign->commodity->barcode : '',
|
|
|
+ "amount" => $assign->amount,
|
|
|
+ "producedAt" => $assign->produced_at,
|
|
|
+ "validAt" => $assign->valid_at,
|
|
|
+ "batchNumber" => $assign->batch_number,
|
|
|
+ "location" => $assign->location,
|
|
|
+ "region" => $assign->region,
|
|
|
+ "createdAt" => $assign->created_at,
|
|
|
+ "userName" => $assign->user ? $assign->user->name : 'system',
|
|
|
+ ];
|
|
|
+ }
|
|
|
}
|
|
|
Cache::put("commodityAssign",["success"=>true,"data"=>$models,"errors"=>$errors]);
|
|
|
}
|