|
|
@@ -155,8 +155,50 @@ class TestController extends Controller
|
|
|
}
|
|
|
public function test()
|
|
|
{
|
|
|
- app("CacheShelfService")->_stationCacheLightOn("HAIB1-01-03","IDE0004463");
|
|
|
- dd();
|
|
|
+ $batches = Batch::query()->where("created_at",'>=',"2021-05-28 11:00:00")->get();
|
|
|
+ foreach ($batches as $batch){
|
|
|
+ $code = $batch->code;
|
|
|
+ $wave = DB::connection("oracle")->selectOne(DB::raw("select * from DOC_WAVE_HEADER where WAVENO = ?"),[$code]);
|
|
|
+ if (!$wave){
|
|
|
+ $error[] = $code."FLUX无波次";
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ $owner = app("OwnerService")->codeGetOwner($wave->customerid);
|
|
|
+ $obj = [
|
|
|
+ "wms_status" => $this->wms_status($wave),
|
|
|
+ "wms_type"=>$wave->descr,
|
|
|
+ "created_at"=>date("Y-m-d H:i:s"),
|
|
|
+ "wms_created_at"=>$wave->addtime,
|
|
|
+ "updated_at"=>$wave->edittime,
|
|
|
+ "owner_id"=>$owner->id,
|
|
|
+ ];
|
|
|
+ $wave = Batch::query()->where("code",$code)->first();
|
|
|
+ if (!$wave){
|
|
|
+ $error[] = $code."本地无波次";
|
|
|
+ $obj["code"] = $code;
|
|
|
+ $wave = Batch::query()->create($obj);
|
|
|
+ }else{
|
|
|
+ Batch::query()->where("code",$code)->update($obj);
|
|
|
+ }
|
|
|
+ $ordernos = array_column(DB::connection("oracle")->select(DB::raw("select orderno from DOC_WAVE_DETAILS where WAVENO = ?"),[$code]),"orderno");
|
|
|
+ $count = Order::query()->whereIn("code",$ordernos)->count();
|
|
|
+ if (count($ordernos)!=$count)$error[] = $code."本地订单缺失";
|
|
|
+ Order::query()->whereIn("code",$ordernos)->update([
|
|
|
+ "batch_id"=>$wave->id
|
|
|
+ ]);
|
|
|
+ Order::query()->with(["batch","bin"])->whereIn("code",$ordernos)->get()->each(function ($order){
|
|
|
+ if (!$order->bin){
|
|
|
+ $bin = DB::connection("oracle")->selectOne(DB::raw("select seqno from DOC_WAVE_DETAILS where waveno = ? and orderno = ?"),[$order->batch->code,$order->code]);
|
|
|
+ if ($bin){
|
|
|
+ OrderBin::query()->create([
|
|
|
+ 'order_id' => $order->id,
|
|
|
+ 'number' => $bin->seqno,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ dd("OK");
|
|
|
$asnno = "ASN2105240178";
|
|
|
$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,".
|
|
|
"d.lotatt05,d.lotatt08,d.USERDEFINE1,d.USERDEFINE2,d.USERDEFINE3,d.USERDEFINE4,d.USERDEFINE5,d.RECEIVINGLOCATION FROM DOC_ASN_DETAILS d ".
|