|
|
@@ -77,18 +77,22 @@ sql
|
|
|
$map = [];
|
|
|
$batches = $this->batchService->get(["code"=>$codes]);
|
|
|
if ($batches){
|
|
|
- foreach ($batches as $batch)$map[$batch->code] = $batch->id;
|
|
|
+ foreach ($batches as $index=>$batch)$map[$batch->code] = $index;
|
|
|
}
|
|
|
$update = [["id","wms_status","remark","updated_at"]];
|
|
|
$insert = [];
|
|
|
foreach ($waves as $wave){
|
|
|
if (isset($map[$wave->waveno])){
|
|
|
- $update[] = [
|
|
|
- "id" => $map[$wave->waveno],
|
|
|
- "wms_status" => $this->wms_status($wave),
|
|
|
- "remark"=>$wave->descr,
|
|
|
- "updated_at"=>$wave->edittime,
|
|
|
- ];
|
|
|
+ $bat = $batches[$map[$wave->waveno]];
|
|
|
+ $wms_status = $this->wms_status($wave);
|
|
|
+ if ($bat->wms_status != $wms_status || $bat->remark != $wave->descr){
|
|
|
+ $update[] = [
|
|
|
+ "id" => $bat->id,
|
|
|
+ "wms_status" => $this->wms_status($wave),
|
|
|
+ "remark"=>$wave->descr,
|
|
|
+ "updated_at"=>$wave->edittime,
|
|
|
+ ];
|
|
|
+ }
|
|
|
continue;
|
|
|
}
|
|
|
$owner = app("OwnerService")->codeGetOwner($wave->customerid);
|
|
|
@@ -106,7 +110,7 @@ sql
|
|
|
//存在则更新
|
|
|
if (count($update)>1){
|
|
|
$bool = app(BatchUpdateService::class)->batchUpdate("batches",$update);
|
|
|
- if ($bool)LogService::log(__METHOD__,"SUCCESS-同步更新波次成功",json_encode($update));
|
|
|
+ if ($bool!==false)LogService::log(__METHOD__,"SUCCESS-同步更新波次成功",json_encode($update));
|
|
|
else LogService::log(__METHOD__,"ERROR-同步更新波次失败",json_encode($update));
|
|
|
}
|
|
|
|
|
|
@@ -162,7 +166,6 @@ sql;
|
|
|
$batchMapping[$detail->orderno] = $detail->waveno;
|
|
|
}
|
|
|
$orders = Order::query()->select("id","batch_id","code")->whereIn("code",$orderCodes)->get();
|
|
|
- //if (count($orderCodes) != count($orders))LogService::log(__METHOD__,"波次同步-本地订单缺失",json_encode($orderCodes)." | ".count($orderCodes)." | ".count($orders));
|
|
|
if ($orders){
|
|
|
$orderIds = [];
|
|
|
$orderMap = [];
|