|
|
@@ -28,6 +28,7 @@ use App\LaborReportStatus;
|
|
|
use App\Log;
|
|
|
use App\Logistic;
|
|
|
use App\MaterialBox;
|
|
|
+use App\MaterialBoxModel;
|
|
|
use App\MeasuringMachine;
|
|
|
use App\Menu;
|
|
|
use App\Notifications\SendEmailNotification;
|
|
|
@@ -127,7 +128,35 @@ class TestController extends Controller
|
|
|
}
|
|
|
public function test()
|
|
|
{
|
|
|
- \App\Authority::query()->firstOrCreate(["name" => "入库管理-入库预约-预约管理-卸货完成"],["name" => "入库管理-入库预约-预约管理-卸货完成","alias_name"=>"入库管理-入库预约-预约管理-卸货完成"]);
|
|
|
+ ini_set('max_execution_time', 2500);
|
|
|
+ $model = MaterialBoxModel::query()->create([
|
|
|
+ "code" => "common"
|
|
|
+ ]);
|
|
|
+ $sql = <<<sql
|
|
|
+ select * from INV_LOT_LOC_ID where traceid = '*' and locationid like 'IDE%'
|
|
|
+sql;
|
|
|
+ foreach (DB::connection("oracle")->select(DB::raw($sql)) as $inv){
|
|
|
+ $materialBox = MaterialBox::query()->firstOrCreate(["code"=>$inv->locationid],[
|
|
|
+ "code" => $inv->locationid,
|
|
|
+ "material_box_model_id"=>$model
|
|
|
+ ]);
|
|
|
+ $owner = Owner::query()->firstOrCreate([
|
|
|
+ "code" => $inv->customerid
|
|
|
+ ],[
|
|
|
+ "code" => $inv->customerid,
|
|
|
+ "name" => $inv->customerid,
|
|
|
+ ]);
|
|
|
+ $commodity = Commodity::query()->where("owner_id",$owner->id)->where("sku",$inv->sku)->first();
|
|
|
+ if (!$commodity){
|
|
|
+ dump($inv->customerid." | ".$inv->sku);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ \App\Storage::query()->create([
|
|
|
+ "material_box_id" => $materialBox->id,
|
|
|
+ "commodity_id" => $commodity->id,
|
|
|
+ "amount" => $inv->qty,
|
|
|
+ ]);
|
|
|
+ }
|
|
|
}
|
|
|
public function orderCreateBill()
|
|
|
{
|