|
|
@@ -180,8 +180,28 @@ class TestController extends Controller
|
|
|
}
|
|
|
public function test()
|
|
|
{
|
|
|
- $time = explode("-",DeliveryAppointment::PERIOD[1])[1];
|
|
|
- dd("2021-05-16"." ".$time.":00:00",Carbon::now()->gt(Carbon::parse("2021-05-15"." ".$time.":00:00")));
|
|
|
+ DeliveryAppointment::query()->where("created_at",">=","2021-05-17 00:00:00")
|
|
|
+ ->whereNotNull("asn_number")->get()->each(function ($model){
|
|
|
+ $asn = preg_split('/[,, ]+/is', $model->asn_number);
|
|
|
+ $query = Store::query()->whereIn("asn_code",$asn);
|
|
|
+ if ($model->owner_id)$query->where("owner_id",$model->owner_id);
|
|
|
+ $stores = $query->with("storeItems")->get();
|
|
|
+ if ($stores){
|
|
|
+ $items = [];
|
|
|
+ $stores->each(function ($store)use(&$items){
|
|
|
+ if ($store->storeItems)foreach($store->storeItems as $it){
|
|
|
+ $items[] = [
|
|
|
+ "name"=>"",
|
|
|
+ "amount"=>$it->amount,
|
|
|
+ "bar_code"=>"",
|
|
|
+ "commodity_id"=>$it->commodity_id,
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ });
|
|
|
+ app("DeliveryAppointmentService")->insertDetails($model,$items);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ dd("OK");
|
|
|
$asnno = "ASN2105141388";
|
|
|
$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 ".
|