|
|
@@ -2,17 +2,22 @@
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
-use App\Batch;
|
|
|
use App\Components\AsyncResponse;
|
|
|
use App\Components\Database;
|
|
|
use App\Components\ErrorPush;
|
|
|
-use App\Order;
|
|
|
-use App\OrderBin;
|
|
|
-use App\Services\WorkOrderService;
|
|
|
-use App\WorkOrder;
|
|
|
+use App\MaterialBox;
|
|
|
+use App\MaterialBoxModel;
|
|
|
+use App\Services\RejectedService;
|
|
|
+use App\User;
|
|
|
+use App\Waybill;
|
|
|
+use Illuminate\Database\Capsule\Manager;
|
|
|
+use Illuminate\Database\DatabaseManager;
|
|
|
+use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
|
|
use Illuminate\Http\Request;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
-
|
|
|
+use Illuminate\Support\Facades\Hash;
|
|
|
+use Illuminate\Support\Facades\Log;
|
|
|
+use Oursdreams\Export\Export;
|
|
|
|
|
|
class TestController extends Controller
|
|
|
{
|
|
|
@@ -33,86 +38,62 @@ class TestController extends Controller
|
|
|
dd("方法不存在");
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- public function assignBatch($code)
|
|
|
+ public function test($main, $x)
|
|
|
{
|
|
|
- $batches = Batch::query()->where("code",$code)->get();
|
|
|
- if (!$batches->count()){
|
|
|
- $wave = DB::connection("oracle")->selectOne(DB::raw("select * from DOC_WAVE_HEADER where WAVENO = ?"),[$code]);
|
|
|
- if (!$wave){
|
|
|
- dd("FLUX无波次");
|
|
|
- }
|
|
|
- $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){
|
|
|
- $obj["code"] = $code;
|
|
|
- $wave = Batch::query()->create($obj);
|
|
|
+ return;
|
|
|
+ $db = DB::connection("aliyunMysql");
|
|
|
+ foreach ($db->select(DB::raw("select * from equipments where code like 'W4%' and info is not null and id <= 4972")) as $eq){
|
|
|
+ $arr = str_split ($eq->code);
|
|
|
+ if (strlen($main)==2){
|
|
|
+ $arr1 = str_split ($main);
|
|
|
+ $arr[4] = $arr1[0];
|
|
|
+ $arr[5] = $arr1[1];
|
|
|
}else{
|
|
|
- Batch::query()->where("code",$code)->update($obj);
|
|
|
+ $arr[5] = $main;
|
|
|
}
|
|
|
- $ordernos = array_column(DB::connection("oracle")->select(DB::raw("select orderno from DOC_WAVE_DETAILS where WAVENO = ?"),[$code]),"orderno");
|
|
|
- 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,
|
|
|
- ]);
|
|
|
- }
|
|
|
+ $code = implode("",$arr);
|
|
|
+
|
|
|
+ $obj = json_decode($eq->info);
|
|
|
+ $obj->x +=$x;
|
|
|
+ $db->insert("insert into equipments(code,parent_id,info,depth,width,created_at,updated_at,warehouse_detail_id)
|
|
|
+values(?,null,?,?,?,?,?,1)",[$code,json_encode($obj),$eq->depth,$eq->width,now()->toDateTimeString(),now()->toDateTimeString()]);
|
|
|
+
|
|
|
+ $a = $db->selectOne("select * from equipments where parent_id is null and code = ? ",[$code]);
|
|
|
+ foreach ($db->select("select * from equipments where parent_id = ?",[$eq->id]) as $item){
|
|
|
+ $arr = str_split ($item->code);
|
|
|
+ if (strlen($main)==2){
|
|
|
+ $arr1 = str_split ($main);
|
|
|
+ $arr[4] = $arr1[0];
|
|
|
+ $arr[5] = $arr1[1];
|
|
|
+ }else{
|
|
|
+ $arr[5] = $main;
|
|
|
}
|
|
|
- });
|
|
|
- $batches = Batch::query()->where("code",$code)->get();
|
|
|
+ $code = implode("",$arr);
|
|
|
+ $db->insert("insert into equipments(code,parent_id,info,depth,width,height,location_tab,created_at,updated_at,warehouse_detail_id)
|
|
|
+values(?,?,null,?,?,?,?,?,?,2)",[$code,$a->id,$item->depth,$item->width,$item->height,$item->location_tab,now()->toDateTimeString(),now()->toDateTimeString()]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public function test2(){
|
|
|
+ return;
|
|
|
+ $db = DB::connection("aliyunMysql");
|
|
|
+ foreach ($db->select("select * from equipments where (code like 'W3%') and info is not null") as $eq){
|
|
|
+ $obj = json_decode($eq->info);
|
|
|
+ $obj->x -= 105;
|
|
|
+ $db->update("UPDATE equipments SET info = ? where id = ?",[json_encode($obj),$eq->id]);
|
|
|
}
|
|
|
- app("BatchService")->assignTasks($batches);
|
|
|
}
|
|
|
|
|
|
- public function syncWorkOrder(){
|
|
|
-
|
|
|
- WorkOrder::query()
|
|
|
- ->where('work_order_status','1')
|
|
|
- ->where('bao_shi_tag', 1)
|
|
|
- ->update(['bao_shi_tag' => 3]);
|
|
|
- WorkOrder::query()
|
|
|
- ->whereIn('status',[1,4] )
|
|
|
- ->where('work_order_status','<>','1')
|
|
|
- ->update(['bao_shi_tag' => 2]);
|
|
|
-
|
|
|
-
|
|
|
- WorkOrder::query()
|
|
|
- ->where('work_order_status','1')
|
|
|
- ->where('owner_tag', 1)
|
|
|
- ->update(['owner_tag' => 3]);
|
|
|
- WorkOrder::query()
|
|
|
- ->whereIn('status',[2,6] )
|
|
|
- ->where('work_order_status','<>','1')
|
|
|
- ->update(['bao_shi_tag' => 2]);
|
|
|
-
|
|
|
-
|
|
|
- WorkOrder::query()
|
|
|
- ->where('work_order_status','1')
|
|
|
- ->where('logistic_tag', 1)
|
|
|
- ->update(['logistic_tag' => 3]);
|
|
|
- WorkOrder::query()
|
|
|
- ->whereIn('status',[3] )
|
|
|
- ->where('work_order_status','<>','1')
|
|
|
- ->update(['logistic_tag' => 2]);
|
|
|
-
|
|
|
+ public function test1(Request $request){
|
|
|
+ return;
|
|
|
+ $x = 0;
|
|
|
+ $a1 = 8 + 30;
|
|
|
+ $a2 = 80 + 30;
|
|
|
+ $a3 = 32 + 30;
|
|
|
}
|
|
|
- public function baoHandler(){
|
|
|
- $service = new WorkOrderService();
|
|
|
- $service->timingTask();
|
|
|
+ use AuthenticatesUsers;
|
|
|
+ public function test3($request){
|
|
|
+ dd(Hash::make("wangyan"));
|
|
|
}
|
|
|
}
|
|
|
|