Zhouzhendong 4 роки тому
батько
коміт
e1373d969e

+ 9 - 0
app/Http/Controllers/StationController.php

@@ -101,4 +101,13 @@ SQL;
         Cache::tags("loadBoxMonitor")->put($cacheKey,$locations,1800);
         $this->success($locations);
     }
+
+    public function getBoxes()
+    {
+        $arr = \request("arr");
+        if (!$arr)$this->error("无可用箱");
+        $ks = DB::connection("mysql_haiRobotics")->table("ks_bin")->select("ks_bin_code")
+            ->whereIn("ks_bin_space_code",$arr)->pluck("ks_bin_code")->toArray();
+        $this->success(implode(" ",$ks));
+    }
 }

+ 3 - 379
app/Http/Controllers/TestController.php

@@ -2,162 +2,15 @@
 
 namespace App\Http\Controllers;
 
-use App\Authority;
-use App\Batch;
-use App\Commodity;
-use App\CommodityBarcode;
-use App\CommodityMaterialBoxModel;
 use App\Components\AsyncResponse;
 use App\Components\Database;
 use App\Components\ErrorPush;
-use App\DeliveryAppointmentCar;
-use App\ErrorTemp;
-use App\Feature;
-use App\Http\ApiControllers\LoginController;
-use App\Http\Controllers\api\thirdPart\haochuang\SortingController;
-use App\Http\Controllers\api\thirdPart\syrius\beans\StorageTypeCell;
-use App\Http\Controllers\api\thirdPart\syrius\beans\StorageTypeRelation;
-use App\Http\Controllers\api\thirdPart\syrius\beans\Task;
-use App\Http\Controllers\api\thirdPart\syrius\beans\TaskItem;
-use App\Http\Controllers\api\thirdPart\syrius\producer\StorageTypeController;
-use App\Http\Controllers\api\thirdPart\syrius\units\Signature;
-use App\Http\Controllers\api\thirdPart\syrius\units\StorageTypeAttribute;
-use App\Http\Requests\AndroidGateRequest;
-use App\Http\Requests\OrderDelivering;
-use App\InventoryAccount;
-use App\InventoryAccountMission;
-use App\Jobs\BatchTaskJob;
-use App\Jobs\BroadcastBatchToZhengCangJob;
-use App\Jobs\CacheShelfTaskJob;
-use App\Jobs\OrderCreateInstantBill;
-use App\Jobs\OrderCreateWaybill;
-use App\Jobs\SettlementBillReportJob;
-use App\Jobs\StoreCreateInstantBill;
-use App\Jobs\TestJob;
-use App\Jobs\WeightUpdateInstantBill;
-use App\LaborCompanyDispatch;
-use App\LaborReport;
-use App\LaborReportStatus;
-use App\Logistic;
 use App\MaterialBox;
 use App\MaterialBoxModel;
-use App\Notifications\RoutineNotification;
-use App\Observers\WaybillObserver;
-use App\OracleDOCASNDetail;
-use App\OracleDOCASNHeader;
-use App\OracleDOCOrderHeader;
-use App\OracleDocOrderPackingSummary;
-use App\OracleDOCWaveDetails;
-use App\Order;
-use App\OrderBin;
-use App\OrderCommodity;
-use App\OrderIssue;
-use App\OrderIssueProcessLog;
-use App\OrderIssueType;
-use App\OrderPackage;
-use App\Owner;
-use App\OwnerAreaReport;
-use App\OwnerBillReport;
-use App\OwnerFeeDetail;
-use App\OwnerFeeDetailLogistic;
-use App\OwnerFeeExpress;
-use App\OwnerFeeLogistic;
-use App\OwnerFeeOperation;
-use App\OwnerFeeOperationDetail;
-use App\OwnerFeeStorage;
-use App\OwnerPriceExpress;
-use App\OwnerPriceOperation;
-use App\OrderPackageCountingRecord;
-use App\OwnerReport;
-use App\ProcurementCheckSheet;
-use App\ProcurementDeliverie;
-use App\ReceiveRecord;
-use App\RejectedBill;
-use App\SeeLog;
-use App\Services\AndroidInventoryService;
-use App\Services\AuthorityService;
-use App\Services\BatchService;
-use App\Services\CacheShelfService;
-use App\Services\common\BatchUpdateService;
-use App\Services\ForeignHaiRoboticsService;
-use App\Services\ForeignZhenCangService;
-use App\Services\LogisticService;
-use App\Services\LogService;
-use App\Services\MenuService;
-use App\Services\NotificationService;
-use App\Services\OracleDOCOrderHeaderService;
-use App\Services\OrderPackageCommoditiesService;
-use App\Services\OrderPackageReceivedSyncService;
-use App\Services\OrderPackageService;
-use App\Services\OrderService;
-use App\Services\OrderTrackingService;
-use App\Services\OwnerFeeTotalService;
-use App\Services\OwnerLogisticFeeReportService;
-use App\Services\OwnerPriceOperationService;
-use App\Services\OwnerService;
-use App\Services\OwnerStoreFeeReportService;
-use App\Services\OwnerStoreOutFeeReportService;
-use App\Services\ReceivingTaskService;
-use App\Services\ReplenishmentService;
-use App\Services\ReviewService;
-use App\Services\StationService;
-use App\Services\StorageService;
-use App\Services\StoreItemService;
-use App\Services\StoreService;
-use App\Services\SyriusTaskService;
-use App\Services\UserService;
-use App\Services\WorkOrderService;
-use App\SortingStation;
-use App\Station;
-use App\StationTask;
-use App\StationTaskMaterialBox;
-use App\Store;
-use App\StoreItem;
-use App\TaskTransaction;
-use App\Unit;
 use App\User;
-use App\UserDetail;
-use App\UserDutyCheck;
-use App\ValueStore;
-use App\Waybill;
-use App\WorkOrder;
-use App\WorkOrderCommodities;
-use App\WorkOrderDetail;
-use App\WorkOrderImage;
-use App\WorkOrderLog;
-use Carbon\Carbon;
-use Carbon\CarbonPeriod;
-use Decimal\Decimal;
-use Doctrine\DBAL\Driver\AbstractDB2Driver;
-use Doctrine\DBAL\Exception;
-use Firebase\JWT\ExpiredException;
-use Firebase\JWT\JWT;
-use Illuminate\Database\Eloquent\Builder;
-use Illuminate\Database\Eloquent\Collection;
-use Illuminate\Database\Eloquent\HigherOrderBuilderProxy;
-use Illuminate\Database\Eloquent\Model;
-use Illuminate\Database\QueryException;
-use Illuminate\Foundation\Http\FormRequest;
 use Illuminate\Http\Request;
-use Illuminate\Support\Facades\Broadcast;
-use Illuminate\Support\Facades\Cache;
-use Illuminate\Support\Facades\Auth;
-use Illuminate\Support\Facades\Cookie;
 use Illuminate\Support\Facades\DB;
-use Illuminate\Support\Facades\Hash;
-use Illuminate\Support\Facades\Http;
 use Illuminate\Support\Facades\Log;
-use Illuminate\Support\Facades\Notification;
-use Illuminate\Support\Facades\URL;
-use Illuminate\Support\Facades\Validator;
-use Illuminate\Support\Str;
-use Laravel\Horizon\Events\JobFailed;
-use Monolog\Handler\IFTTTHandler;
-use phpDocumentor\Reflection\Types\Resource_;
-use PhpOffice\PhpSpreadsheet\Calculation\Web\Service;
-use PhpParser\Node\Stmt\DeclareDeclare;
-use Ramsey\Uuid\Uuid;
-use Symfony\Component\ErrorHandler\Error\FatalError;
 
 class TestController extends Controller
 {
@@ -178,240 +31,11 @@ class TestController extends Controller
             dd("方法不存在");
         }
     }
-
-    public function test1(\Closure $c,string $a){
-        dd($c($a));
-    }
-    private function paramDefault(&$waybill):array
-    {
-        $update = [];
-        if (!$waybill->order_type){
-            $update["order_type"] = $waybill->order_type = Waybill::ORDER_TYPE_DEFAULT;
-        }
-        if (!$waybill->transport_type){
-            $update["transport_type"] = $waybill->transport_type = "JZKH";
-        }
-        if (!$waybill->cargo_name){
-            $update["cargo_name"] = $waybill->cargo_name = "补货";
-        }
-        if (!$waybill->total_number){
-            $update["total_number"] = $waybill->total_number = 1;
-        }
-        if (!$waybill->total_weight){
-            $update["total_weight"] = $waybill->total_weight = 1;
-        }
-        if (!$waybill->package_service){
-            $update["package_service"] = $waybill->package_service = '托膜';
-        }
-        if (!$waybill->deliveryType){
-            $update["deliveryType_id"] = $waybill->deliveryType_id = 3;
-        }
-        if (!$waybill->pay_type){
-            $update["pay_type"] = $waybill->pay_type = Waybill::PAY_TYPE_DEFAULT;
-        }
-        if (!$waybill->back_sign_bill){
-            $update["back_sign_bill"] = $waybill->back_sign_bill = Waybill::BACK_SIGN_BILL_DEFAULT;
-        }
-        return $update;
-    }
-    /**
-     * @param Model|\stdClass $waybill
-     */
-    private function formatWaybillData($waybill):array
-    {
-        $waybill->loadMissing([
-            "order.shop","owner","order.warehouse.province","order.warehouse.city","order.warehouse.county"
-        ]);
-        $date = date('Y-m-d H:i:s', $waybill->deliver_at ? strtotime($waybill->deliver_at) : now()->getTimestamp());
-        $data =  [
-            'logisticID'    =>      config('api_logistic.DB.prod.sign').date("YmdHis").mt_rand(1000, 9999).$waybill->order->id,
-            'custOrderNo'   =>      $waybill->order->client_code ?? '',
-            'needTraceInfo' =>      config('api_logistic.DB.prod.needTraceInfo'),
-            'companyCode'   =>      config('api_logistic.DB.prod.company_code'),
-            'orderType'     =>      $waybill->order_type,
-            'transportType' =>      $waybill->transport_type,
-            'customerCode'  =>      config('api_logistic.DB.prod.customer_Code'),
-            'sender'        =>      [
-                'companyName'       => '宝时物流',
-                'businessNetworkNo' => '',
-                'name'              => '宝时物流',
-                'mobile'            => '',
-                'phone'             => '021-6316561',
-                'province'          => $waybill->order->warehouse->province->name ?? '',
-                'city'              => $waybill->order->warehouse->city->name ?? '',
-                'country'           => $waybill->order->warehouse->county->name ?? '',
-                'town'              => '',
-                'address'           => $waybill->order->warehouse->address ?? '',
-            ],
-            'receiver' => [
-                'toNetworkNo'       => '',
-                'name'              => $waybill->order->consignee_name ?? '',
-                'phone'             => $waybill->order->consignee_phone ?? '',
-                'mobile'            => $waybill->order->consignee_phone ?? '',
-                'province'          => $waybill->order->province ?? '',
-                'city'              => $waybill->order->city ?? "",
-                'county'            => $waybill->order->district ?? '',
-                'town'              => '',
-                'address'           => $waybill->order->address ?? '',
-                'companyName'       => ''
-            ],
-            'packageInfo' => [
-                'cargoName'         => $waybill->cargo_name ?? '',
-                'totalNumber'       => $waybill->total_number ?? '',
-                'totalWeight'       => $waybill->total_weight ?? '',
-                'totalVolume'       => '',
-                'packageService'    => $waybill->package_service ?? '',
-                'deliveryType'      => $waybill->deliveryType_id,
-            ],
-            'gmtCommit'     =>  $date,
-            'payType'       =>  $waybill->pay_type,
-            'addServices'   =>  [
-                'insuranceValue'    => '',
-                'codType'           => '',
-                'reciveLoanAccount' => '',
-                'accountName'       => '',
-                'codValue'          => '',
-                'backSignBill'      => $waybill->back_sign_bill
-            ],
-            'smsNotify'     => config('api_logistic.DB.prod.smsNotify'),
-            'sendStartTime' => $date,
-            'sendEndTime'   => date('Y-m-d ', $waybill->deliver_at ? strtotime($waybill->deliver_at) : now()->getTimestamp()).'23:59:59',
-            'originalWaybillNumber' => $waybill->wms_bill_number ?? '',
-            'remark'        => $waybill->dispatch_remark ?? '',
-            'isOut'         => 'N',
-            'passwordSigning' => config('api_logistic.DB.prod.passwordSigning'),
-            'isdispatched'  => '',
-            'ispresaleorder'=> '',
-            'isCenterDelivery' => '',
-//            'orderExtendFields' => [
-//                'value'     => '',
-//                'key'       => ''
-//            ]
-        ];
-        $param = json_encode($data);
-        $timestamp = (integer)getMillisecond();
-        return ["params"=>$param,"timestamp"=>$timestamp,
-            "digest"=>base64_encode(md5($param.config('api_logistic.DB.prod.app_key').$timestamp)),
-            "companyCode" => config('api_logistic.DB.prod.company_code')];
-    }
     public function test(Request $request)
     {
-        $waybill = Waybill::query()->where("waybill_number","BSDB2112284814")
-            ->first();
-        $waybill->load("order");
-        if (!$waybill->order){
-            dd("德邦单号获取失败1");
-            return;
-        }
-        $update = $this->paramDefault($waybill);
-        $waybill->update($update);
-        $bill = app('DbOpenService')->getDbOrderNo($waybill);
-        if (!$bill || $bill["result"]=="false"){
-            dd($bill);
-            return;
-        }
-        $waybill->update([
-            "carrier_bill"=>$bill['mailNo'],
-            "waybill_number"=>$bill['mailNo'],
-            "station_no"=>$bill['stationNo'],
-            "arrived_org_simple_name"=>$bill['arrivedOrgSimpleName'],
-            "much_higher_delivery"=>$bill['muchHigherDelivery'],
-        ]);
-        if (!app("WaybillService")->notifyFlux($waybill)){
-            dd("德邦单号回传FLUX失败");
-            return;
-        }
-        dd(1);
-        $c = "test";
-        $a = function ($b)use($c){
-            return $b.$c;
-        };
-        $this->test1($a,"a");
-        dd(2);
-        $w = Waybill::query()->get();
-        foreach ($w->chunk(50) as $a){
-            dd($a);
-        }
-        $path = '';
-        $id = 252;
-
-        $file = fopen($path, "r");
-        $user=array();
-        $i=0;
-        //输出文本中所有的行,直到文件结束为止。
-        while(! feof($file)){
-            $user[$i]= trim(fgets($file));//fgets()函数从文件指针中读取一行
-            $i++;
-        }
-        fclose($file);
-        foreach ($user as $item){
-            $arr = explode(",",$item);
-            if (count($arr)!=2){
-                dump($item);
-                continue;
-            }
-            DB::table("details")->insert([
-                "name" => $arr[0],
-                "size" => $arr[1],
-                "created_at" => date("Y-m-d H:i:s"),
-                "updated_at" => date("Y-m-d H:i:s"),
-                "header_id" => $id
-            ]);
-        }
-    }
-
-    public function test123(){
-        $rejected_bill = RejectedBill::query()->find(2);
-        $service = new WorkOrderService();
-        $service->syncWorkOrder($rejected_bill);
-    }
-
-
-    public function assignBatch($code)
-    {
-        $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);
-            }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");
-            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,
-                        ]);
-                    }
-                }
-            });
-            $batches = Batch::query()->where("code",$code)->get();
-        }
-        app("BatchService")->assignTasks($batches);
+        dd(implode(" ",User::query()->select("id")->pluck("id")->toArray()));
+        Log::error(json_encode($request->header(),JSON_UNESCAPED_UNICODE));
+        return json_encode($request->header(),JSON_UNESCAPED_UNICODE);
     }
-
-
-
 }
 

+ 14 - 0
app/Services/BatchService.php

@@ -5,6 +5,7 @@ namespace App\Services;
 use App\Batch;
 use App\Events\BroadcastToStation;
 use App\Exceptions\ErrorException;
+use App\Http\Controllers\api\thirdPart\haochuang\SortingController;
 use App\Jobs\BatchTaskJob;
 use App\OracleActAllocationDetails;
 use App\Order;
@@ -184,4 +185,17 @@ class BatchService
         }
         return true;
     }
+
+    public function assignBatch($code)
+    {
+        $batches = Batch::query()->where("code",$code)->get();
+        if (!$batches->count()){
+            $s = new SortingController();
+            $s->syncOrderBin($code);
+            $batches = Batch::query()->where("code",$code)->get();
+        }
+        if ($batches->count()>0){
+            app("BatchService")->assignTasks($batches);
+        }
+    }
 }

+ 30 - 3
resources/views/station/monitor/visual.blade.php

@@ -18,7 +18,7 @@
                 <div class="col-1">非空</div>
                 <div class="col-1 bg-warning offset-2 text-dark font-weight-bold">@{{ this.statistic.number2 }}</div>
                 <div class="col-1">空架</div>
-                <div class="col-1 bg-success offset-2 text-white  font-weight-bold">@{{ this.statistic.number3 }}</div>
+                <div class="col-1 bg-success offset-2 text-white  font-weight-bold cursor-pointer" @click="getBoxes()">@{{ this.statistic.number3 }}</div>
                 <div class="col-1">空箱</div>
             </div>
         </div>
@@ -44,7 +44,7 @@
 
 @section('lastScript')
     <script>
-        new Vue({
+        let vue = new Vue({
             el:"#container",
             data:{
                 rowSize:8, //单排大小:X列
@@ -217,7 +217,7 @@
                     n=(r1>=r2)?r1:r2;
                     return ((arg1*m-arg2*m)/m).toFixed(n);
                 },
-                 accDivCoupon(arg1,arg2){
+                accDivCoupon(arg1,arg2){
                     let t1=0,t2=0,r1,r2;
                     try{t1=arg1.toString().split(".")[1].length;}catch(e){}
                     try{t2=arg2.toString().split(".")[1].length;}catch(e){}
@@ -227,6 +227,33 @@
                         return Math.round((r1/r2)*pow(10,t2-t1)*10000)/100;
                     }
                 },
+                getBoxes(){
+                    console.warn("稍等下......");
+                    $("#modal").hide();
+                    for (let i=0;i<vue.data.length;i++){
+                        for (let j=0;j<vue.data[i].length;j++){
+                            if (vue.data[i][j][2]>0){
+                                vue.loadDetail(i,j);
+                            }
+                        }
+                    }
+                    setTimeout(()=>{
+                        let loc = [];
+                        for (let key in vue.details){
+                            for (let i=0;i<vue.details[key].length;i++){
+                                for (let j=0;j<vue.details[key][i].length;j++){
+                                    let obj = vue.details[key][i][j];
+                                    if (obj.status===false){
+                                        loc.push(obj.location);
+                                    }
+                                }
+                            }
+                        }
+                        window.tempTip.postBasicRequest("{{url('station/monitor/visual/getBoxes')}}",{arr:loc},res=>{
+                            console.log(res);
+                        });
+                    },3000)
+                }
             },
             filters:{
                 reduce(val){

+ 1 - 0
routes/web.php

@@ -1104,6 +1104,7 @@ Route::group(['middleware' => 'auth'], function ($route) {
                     return view("station.monitor.visual");
                 });
                 Route::post('getData', 'StationController@getVisual');
+                Route::post('getBoxes', 'StationController@getBoxes');
                 Route::post('getDetail', 'StationController@getDetail');
             });
         });