فهرست منبع

Merge branch 'master' into Haozi

haozi 4 سال پیش
والد
کامیت
65ff3001ac

+ 1 - 4
app/Filters/WorkOrderFilters.php

@@ -70,10 +70,7 @@ class WorkOrderFilters
             $this->id(explode(',',$this->params['data']));
 
         if (!isset($this->params['owner'])){
-            $owners = app(OwnerService::class)->getAuthorizedOwners();
-            $this->getOrderQuery()->whereIn('owner_id',$owners->map(function($item){
-                return $item->id;
-            }));
+            $this->getOrderQuery()->whereIn('owner_id', app('UserService')->getPermittingOwnerIds(Auth::user())??[]);
         }
     }
 

+ 2 - 0
app/Http/Controllers/MeasureMonitorController.php

@@ -41,9 +41,11 @@ class MeasureMonitorController extends Controller
     public function speech(Request $request,MeasureMonitorService $service): array
     {
         if (app('WorkOrderService')->isIntercept($request['logistic_number'])){
+            app('OrderIssueService')->intercept($request['logistic_number']);
             return $service->getMp3Audio('拦截订单');
         }
         if ( app('OrderIssueService')->isExists($request['logistic_number'])){
+            app('OrderIssueService')->intercept($request['logistic_number']);
             return $service->getMp3Audio('拦截订单');
         }
         return $service->getMp3Audio($request->input('logistic'));

+ 4 - 0
app/Http/Controllers/TestController.php

@@ -136,6 +136,10 @@ sql;
 
     public function test()
     {
+        dd(app("MenuService")->getVisibleFunctionList());
+        $url = 'denied';
+        header('Location: /'.$url,true,302);
+        die();
         TaskTransaction::query()->where("id",">=",280)->delete();
         /*$a= new StorageService();
         $a->clearTask(["HAIB1-01-01"]);

+ 32 - 30
app/Http/Controllers/WaybillController.php

@@ -5,6 +5,7 @@ namespace App\Http\Controllers;
 
 use App\CarType;
 use App\Components\AsyncResponse;
+use App\Http\Requests\GateRequest;
 use App\Owner;
 use App\Region;
 use App\Services\CarTypeService;
@@ -15,7 +16,6 @@ use App\Services\UnitService;
 use App\Services\WaybillPayoffService;
 use App\Services\WaybillPriceModelService;
 use App\Services\WaybillService;
-use App\Traits\ModelLogChanging;
 use App\TerminalPrinter;
 use App\UploadFile;
 use App\WaybillAuditLog;
@@ -36,6 +36,8 @@ use Illuminate\Support\Facades\DB;
 use Illuminate\Support\Facades\Gate;
 use Illuminate\Support\Facades\Storage;
 use Illuminate\Support\Facades\Validator;
+use Illuminate\Validation\ValidationException;
+use Illuminate\View\View;
 use Intervention\Image\Facades\Image;
 use Oursdreams\Export\Export;
 use Ramsey\Uuid\Uuid;
@@ -50,18 +52,18 @@ class WaybillController extends Controller
     }
 
     /**
-     * @param Request $request
+     * @param GateRequest $request
      * @param OwnerService $ownerService
      * @param LogisticService $logisticService
-     * @return \Illuminate\View\View
+     * @return View
      */
-    public function index(Request $request,OwnerService $ownerService,LogisticService $logisticService)
+    public function index(GateRequest $request,OwnerService $ownerService,LogisticService $logisticService): View
     {
         $paginateParams = $request->input();
         $waybills=app('waybillService')->paginate($request->input());
-        $mac_addr = getMacAddr();
+        $macAddress = getMacAddr();
         $print = TerminalPrinter::with(['terminal','logistics'])
-            ->whereHas('terminal',function ($query)use($mac_addr){$query->where('ip',$mac_addr);})
+            ->whereHas('terminal',function ($query)use($macAddress){$query->where('ip',$macAddress);})
             ->whereHas('logistics',function ($query){$query->where('logistic_id',15);})
             ->first();
         $print = $print->printer_name??'EK100B';
@@ -71,13 +73,13 @@ class WaybillController extends Controller
             'owners' => $ownerService->getIntersectPermitting(),
             "carTypes" => CarType::query()->get(),
             'paginateParams'=>$paginateParams,
-            'uriType'=>$request->uriType??'','print_name'=> $print]);
+            'uriType'=>$request->uriType??'',
+            'print_name'=> $print]);
     }
 
 
-    public function create(Request $request,OwnerService $ownerService)
+    public function create(GateRequest $request,OwnerService $ownerService)
     {
-        if(!Gate::allows('运输管理-运单-录入')){ return redirect(url('denied'));  }
         $type=$request->type ?? "";
         if ($type==='ZF')$type='直发车';
         if ($type==='ZX')$type='专线';
@@ -85,6 +87,9 @@ class WaybillController extends Controller
         return view('transport.waybill.create',['owners'=>$ownerService->getIntersectPermitting(),'type'=>$type]);
     }
 
+    /**
+     * @throws ValidationException
+     */
     public function store(Request $request)
     {
         if(!Gate::allows('运输管理-运单-录入')){ return redirect(url('denied'));  }
@@ -96,17 +101,13 @@ class WaybillController extends Controller
 
     public function edit($id,LogisticService $logisticService,CarTypeService $carTypeService,UnitService $unitService)
     {
+        /** @var Waybill|\stdClass $waybill */
         $waybill = app('waybillService')->find($id);
         if ($waybill->order_id){
-            /** @var Waybill $waybill */
             $waybill->load("order.owner");
             $waybill->destination_city_id = app("RegionService")->getCity($waybill->order->city ?? '',$waybill->order->province ?? '');
-        }else{
-            /** @var Waybill $waybill */
-            $waybill->load("owner");
-        }
+        }else $waybill->load("owner");
         if ($waybill->merge_owner)$waybill->merge_owner = implode(",",array_column(Owner::query()->select("name")->whereIn("id",explode(",",$waybill->merge_owner))->get()->toArray(),"name"));
-        /** @var \stdClass $waybill */
         if (!$waybill)return view("exception.default",["code"=>"500","message"=>"数据已被删除或丢失"]);
         if ($waybill->deliver_at){
             $waybill->deliver_at_date=Carbon::parse($waybill->deliver_at)->format('Y-m-d');
@@ -300,7 +301,8 @@ class WaybillController extends Controller
      *          计数二存在,一不存在:
      *              城市价格区间不为空,城市价格区间都为空,城市为空,价格区间为空
      * */
-    public function isWaybillPriceModel(Request $request){
+    public function isWaybillPriceModel(Request $request): array
+    {
         $logistic_id=$request->input('logistic_id');
         $destination_city_id=$request->input('destination_city_id');
         $carrier_weight=$request->input('carrier_weight');
@@ -401,17 +403,16 @@ class WaybillController extends Controller
         $data=$request->input();
         $waybill=app('waybillService')->find($id);
         $waybill->fill($data);
-        if ($waybill->save()){
-            app('LogService')->log(__METHOD__,__FUNCTION__,json_encode($waybill),Auth::user()['id']);
-            return redirect('transport/waybill/index')->with('successTip','运单“'.$waybill->waybill_number.'”修改成功');
-        }
+        $waybill->save();
+        app('LogService')->log(__METHOD__,__FUNCTION__,json_encode($waybill),Auth::user()['id']);
+        return redirect('transport/waybill/index')->with('successTip','运单“'.$waybill->waybill_number.'”修改成功');
     }
 
     public function waybillAudit(Request $request){
         if(!Gate::allows('运输管理-运单-运单审核')){ return redirect(url('/'));  }
         $id=$request->input('id');
         $waybill=app('waybillService')->find($id);
-        $isAudit=WaybillAuditLog::whereRaw('waybill_id = ? and audit_stage = ?',[$id,"运单阶段"])->first();
+        $isAudit=WaybillAuditLog::query()->whereRaw('waybill_id = ? and audit_stage = ?',[$id,"运单阶段"])->first();
         if (empty($isAudit)){
             $waybillAuditLog=new WaybillAuditLog([
                 'waybill_id'=>$id,
@@ -778,7 +779,7 @@ SQL;
 
     private function deliveringQuery(Request $request): Builder
     {
-        $waybills= Waybill::query()->where("type","专线")->with(["order","logistic"])
+        $waybills= Waybill::query()->where("type","专线")->with(["order","logistic","amountUnit"])
         ->whereNotNull("logistic_id")->whereNotNull("deliver_at")->whereIn("status",["已审核","待终审"]);
         if (!Auth::user()->isSuperAdmin()){
             $carriersUsers=DB::table('logistic_user')->where('user_id',Auth::id())->get();
@@ -819,8 +820,9 @@ SQL;
         $errors=Validator::make($request->input(),[
             'id'=>'required|integer',
             'carrier_bill'=>'required',
-            'inquire_tel'=>'nullable',
-            'amount'=>'nullable|integer',
+            'inquire_tel'=>'required',
+            'amount'=>'required|integer',
+            'amount_unit_name'=>'required|string',
             'carrier_weight'=>'required_without:carrier_weight_other|nullable|numeric',
             'carrier_weight_other'=>'required_without:carrier_weight|nullable|numeric',
         ],[
@@ -831,14 +833,16 @@ SQL;
         ],[
             'carrier_bill'=>'运单号',
             'inquire_tel'=>'查件电话',
+            'amount_unit_name'=>'数量单位',
             'amount'=>'件数',
             'carrier_weight'=>'体积',
             'carrier_weight_other'=>'重量',
         ])->errors();
+        if ($request->input("amount_unit_name")!='件' && $request->input("amount_unit_name")!='托')$errors->add("amount_unit_name","非法参数");
+        if (count($errors)>0)return ["errors"=>$errors];
         $unit = app("UnitService")->getUnit("kg");
-        $unit1 = app("UnitService")->getUnit("件");
+        $unit1 = app("UnitService")->getUnit($request->input("amount_unit_name"));
         $unit2 = app("UnitService")->getUnit("m³");
-        if (count($errors)>0)return ["errors"=>$errors];
         $waybill=Waybill::query()->find($request->input('id'));
         if (!$waybill)return ["error"=>"未找到该运单!"];
         $request->offsetSet("carrier_weight_unit_id",$unit2->id);
@@ -1128,8 +1132,7 @@ SQL;
         for ($i=1;$i<$waybills->count();$i++){
             //信息一致性校验
             $identical = ($waybill->order && ($waybills[$i]->order->consignee_name!=$waybill->order->consignee_name
-                        || $waybills[$i]->order->consignee_phone!=$waybill->order->consignee_phone
-                        || $waybills[$i]->order->address!=$waybill->order->address)) ||
+                        || $waybills[$i]->order->consignee_phone!=$waybill->order->consignee_phone)) ||
                 (!$waybill->order && ($waybills[$i]->recipient!=$waybill->recipient
                     || $waybills[$i]->recipient_mobile!=$waybill->recipient_mobile
                     || $waybills[$i]->destination!=$waybill->destination));
@@ -1291,8 +1294,7 @@ SQL;
             foreach ($waybills as $item){
                 //信息一致性校验
                 $identical = ($waybill->order && ($item->order->consignee_name!=$waybill->order->consignee_name
-                            || $item->order->consignee_phone!=$waybill->order->consignee_phone
-                            || $item->order->address!=$waybill->order->address)) ||
+                            || $item->order->consignee_phone!=$waybill->order->consignee_phone)) ||
                     (!$waybill->order && ($item->recipient!=$waybill->recipient
                             || $item->recipient_mobile!=$waybill->recipient_mobile));
                 if ($identical)$this->error("订单信息不一致,无法统一发货");

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

@@ -100,4 +100,13 @@ class WorkOrderController extends Controller
         return ['success' => true,'data' => $items];
     }
 
+    // 删除
+    public function destroyApi($id): array
+    {
+        if (Gate::denies('订单管理-工单处理-删除'))
+            return ['success' => false,'message' => '没有对应权限'];
+        WorkOrder::query()->where('id',$id)->Delete();
+        return ['success' => true];
+    }
+
 }

+ 5 - 5
app/Http/Requests/GateRequest.php

@@ -122,12 +122,12 @@ class GateRequest extends FormRequest
      */
     public function sameOriginMatching()
     {
+        $url = null;
         //目标节点存在
-        if ($this->tracks){
-            $url = $this->searchOrigin(app("MenuService")->getVisibleFunctionList());
-            header('Location: /'.$url);
-            die();
-        }
+        if ($this->tracks)$url = $this->searchOrigin(app("MenuService")->getVisibleFunctionList());
+        if (!$url)$url = 'denied';
+        header('Location: /'.$url,true,301);
+        die();
         //目标节点为空的话说明一级节点都无权访问
         // 此时返回一级同源节点就无意义 会产生误导性,所以前往无权页面
         //正常情况下这个预设不会被正常用户触发

+ 2 - 0
app/Jobs/LogisticSFSync.php

@@ -5,6 +5,7 @@ namespace App\Jobs;
 use App\OrderPackage;
 use App\Services\LogisticSFService;
 use App\Services\LogService;
+use App\Services\OrderPackageReceivedSyncService;
 use Illuminate\Bus\Queueable;
 use Illuminate\Contracts\Queue\ShouldQueue;
 use Illuminate\Foundation\Bus\Dispatchable;
@@ -25,6 +26,7 @@ class LogisticSFSync implements ShouldQueue
      * @var LogisticSFService $logisticSFService
      */
     public $logisticSFService;
+    /** @var $orderPackageReceivedSyncService OrderPackageReceivedSyncService  */
     public $orderPackageReceivedSyncService;
 
     /**

+ 10 - 1
app/OrderIssue.php

@@ -36,7 +36,9 @@ class OrderIssue extends Model
         'logistic_indemnity_money', 'logistic_express_remission',
         'baoshi_indemnity_money', 'baoshi_express_remission', 'user_workgroup_id',
         'custom_code','imported_status','finance_confirm',
-        'hidden_tag','archive_at'];
+        'hidden_tag','archive_at',
+        'is_intercept'
+    ];
     /*
      * second_client_no 二次客户订单号
      * second_logistic_number 二次运单号 【二次运单号可以单独存在,当二次客户订单号有对应的订单信息时,显示的是二次客户订单号对应的运单号,没有的话显示二次原单号】
@@ -50,6 +52,7 @@ class OrderIssue extends Model
      * finance_confirm 财务确认
      * hidden_tag 隐藏标识
      * archive_at 归档时间
+     * is_intercept 是否拦截
      */
     protected $appends = [];
 
@@ -312,4 +315,10 @@ class OrderIssue extends Model
     {
         return $this->belongsToMany(UserWorkgroup::class);
     }
+
+    // 库内拦截
+    public function intercept(): bool
+    {
+        return $this->update(['is_intercept' => 1]);
+    }
 }

+ 2 - 0
app/Services/LogisticSFService.php

@@ -150,6 +150,7 @@ xml;
                 case 31:
                 case 30:
                 case 36:
+                case 106://航空板箱到达
                     $data['status'] = '在途';
                     break;
                 case 33:
@@ -176,6 +177,7 @@ xml;
                     $data['status'] = '其他';
                     break;
                 default:
+                    $data['status'] = '其他';
                     throw new WarningException("未知的丰桥状态码: {$lastRoute['opcode']}->{json_encode($lastRoute)}");
             }
         } catch (WarningException $e) {

+ 8 - 0
app/Services/OrderIssueService.php

@@ -440,5 +440,13 @@ class OrderIssueService
         $order_issue_type_query = OrderIssueType::query()->select('id')->where('name' ,'拦截');
         return OrderIssue::query()->whereIn('order_id',$order_package_query)->whereIn('order_issue_type_id',$order_issue_type_query)->count() ;
     }
+
+    // 已拦截 在 问题件 的显示
+    public function intercept($logistic_number)
+    {
+        $order_package = OrderPackage::query()->select('order_id')->where('logistic_number',$logistic_number)->first();
+        if (!$order_package) return;
+        OrderIssue::query()->where('order_id',$order_package->order_id)->update(['is_intercept' => 1]);
+    }
 }
 

+ 24 - 19
app/Services/OrderPackageReceivedSyncService.php

@@ -25,15 +25,15 @@ class OrderPackageReceivedSyncService
      * 2 如果当前时间小于等于初始化时间,执行初始化脚本,将数据库中全部小于等于初始化时间的数据更新
      * @throws Exception
      */
-    public function syncLogisticRoute($is_to_init=false)
+    public function syncLogisticRoute($is_to_init = false)
     {
         ini_set('max_execution_time', 2 * 60 * 60);
         ini_set('memory_limit', '1024M');
         //  LogService::log(OrderPackageReceivedSyncService::class, "同步快递信息定时方法", '');
         $query = OrderPackage::query()
-            ->select(['logistic_number', 'order_id','id'])
+            ->select(['logistic_number', 'order_id', 'id'])
             ->with(['order' => function ($query) {
-                return $query->select(['id','logistic_id'])->with('logistic:id,name,code');
+                return $query->select(['id', 'logistic_id'])->with('logistic:id,name,code');
             }]);
         if ($is_to_init) {//当前时间小于等于初始化时间
             $initDate = Carbon::parse(config('api_logistic.init_date'));
@@ -79,7 +79,7 @@ class OrderPackageReceivedSyncService
                 $YTOLogisticNumbers = $logisticNumbers['YTO'];
                 //  LogService::log(OrderPackageReceivedSyncService::class, "同步快递信息定时方法-YTO", json_encode($YTOLogisticNumbers));
                 foreach ($YTOLogisticNumbers as $logistic_number) {
-                    if ($logistic_number)LogisticYTOSync::dispatch($logistic_number);
+                    if ($logistic_number) LogisticYTOSync::dispatch($logistic_number);
                 }
             }
         });
@@ -89,10 +89,10 @@ class OrderPackageReceivedSyncService
     {
         ini_set('max_execution_time', 2 * 60 * 60);
         $query = OrderPackage::query()
-            ->select(['logistic_number', 'order_id','id'])
-            ->whereIn('order_id',function ($query){
-                $query->from('orders')->selectRaw('id')->whereIn('logistic_id',function ($builder){
-                    $builder->from('logistics')->selectRaw('id')->where('type','=','快递')->whereNotIn('belong_company',['顺丰','中通','韵达','圆通','京东']);
+            ->select(['logistic_number', 'order_id', 'id'])
+            ->whereIn('order_id', function ($query) {
+                $query->from('orders')->selectRaw('id')->whereIn('logistic_id', function ($builder) {
+                    $builder->from('logistics')->selectRaw('id')->where('type', '=', '快递')->whereNotIn('belong_company', ['顺丰', '中通', '韵达', '圆通', '京东']);
                 });
             });
         $query = $query->where('sent_at', '>=', now()->subDays(config('api_logistic.querying_days')))
@@ -100,31 +100,34 @@ class OrderPackageReceivedSyncService
 
         $query->chunkById(200, function ($orderPackages) {
             //  LogService::log(OrderPackageReceivedSyncService::class, "同步快递信息定时方法-阿里公用接口", json_encode($orderPackages));
-            foreach ($orderPackages as $orderPackage){
-                if ($orderPackage && $orderPackage->logistic_number)LogisticAliJiSuSync::dispatch($orderPackage->logistic_number);
+            foreach ($orderPackages as $orderPackage) {
+                if ($orderPackage && $orderPackage->logistic_number) LogisticAliJiSuSync::dispatch($orderPackage->logistic_number);
             }
         });
         //TODO 暂时不同步京东
 //        $this->syncLogisticRouteJD();
     }
-    public function syncLogisticRouteJD(){
+
+    public function syncLogisticRouteJD()
+    {
         ini_set('max_execution_time', 60);
         $query = OrderPackage::query()
-            ->select(['logistic_number', 'order_id','id'])
-            ->whereIn('order_id',function ($query){
-                $query->from('orders')->selectRaw('id')->whereIn('logistic_id',function ($builder){
-                    $builder->from('logistics')->selectRaw('id')->where('type','!=','物流')->where('belong_company','京东');
+            ->select(['logistic_number', 'order_id', 'id'])
+            ->whereIn('order_id', function ($query) {
+                $query->from('orders')->selectRaw('id')->whereIn('logistic_id', function ($builder) {
+                    $builder->from('logistics')->selectRaw('id')->where('type', '!=', '物流')->where('belong_company', '京东');
                 });
             });
         $query = $query->where('created_at', '>=', now()->subDays(config('api_logistic.querying_days')))
-            ->whereNull('received_at')->where('logistic_number','like','JD%');
+            ->whereNull('received_at')->where('logistic_number', 'like', 'JD%');
         $query->chunkById(200, function ($orderPackages) {
             //  LogService::log(OrderPackageReceivedSyncService::class, "同步快递信息定时方法-JD", json_encode($orderPackages));
-            foreach ($orderPackages as $orderPackage){
-                if ($orderPackage && $orderPackage->logistic_number)LogisticAliJiSuSync::dispatch($orderPackage->logistic_number);
+            foreach ($orderPackages as $orderPackage) {
+                if ($orderPackage && $orderPackage->logistic_number) LogisticAliJiSuSync::dispatch($orderPackage->logistic_number);
             }
         });
     }
+
     /**
      * 根据传递的承运商与快递单号更新快递信息
      * @param array $logisticNumbers 快递单号
@@ -181,7 +184,7 @@ class OrderPackageReceivedSyncService
             if (empty($logisticResponse)) continue;
             $orderPackage = OrderPackage::query()->where('logistic_number', $logisticResponse['logistic_number'])->first();
             //如果已经收货,状态改为已签收
-            if ($logisticResponse['received_at']??false) {
+            if ($logisticResponse['received_at'] ?? false) {
                 $logisticResponse['status'] = '已签收';
             }
             //未查询到路由信息改为  揽件异常
@@ -191,6 +194,8 @@ class OrderPackageReceivedSyncService
                 if (empty($orderPackage->weighed_at)) {
                     $logisticResponse['status'] = '疑似库内丢件';
                 }
+            } else if (count($logisticResponse['transfer_status'])<=3) {//快递记录不为空但是小于3条
+                $logisticResponse['status'] = '揽件异常';
             }
             //标记为手动更新的 status不更新
             if ($orderPackage->is_manual_update) {

+ 2 - 2
app/Services/OrderService.php

@@ -258,7 +258,7 @@ class OrderService
         $sql="SELECT * FROM (select ACT_ALLOCATION_DETAILS.CHECKTIME,DOC_ORDER_HEADER.addtime,DOC_ORDER_HEADER.C_PROVINCE,DOC_ORDER_HEADER.C_CITY,DOC_ORDER_HEADER.MANUALFLAG,DOC_ORDER_HEADER.C_DISTRICT,DOC_ORDER_HEADER.C_CONTACT,DOC_ORDER_HEADER.OrderNo,DOC_ORDER_HEADER.SOStatus,DOC_ORDER_HEADER.WAREHOUSEID,DOC_ORDER_HEADER.CustomerID as header_customer_id
         ,DOC_ORDER_HEADER.C_Tel2,DOC_ORDER_HEADER.C_Tel1,DOC_ORDER_HEADER.CarrierName,DOC_ORDER_HEADER.IssuePartyName,DOC_ORDER_HEADER.EDIREMARKS2,
        DOC_ORDER_HEADER.WaveNo,DOC_ORDER_HEADER.SOReference1
-        ,NVL(ACT_ALLOCATION_DETAILS.PICKTOTRACEID,DOC_ORDER_HEADER.soreference5) as soreference5,DOC_ORDER_HEADER.EDISENDFLAG2,DOC_ORDER_HEADER.EDISendTime2,DOC_ORDER_HEADER.Notes,DOC_ORDER_HEADER.ERPCANCELFLAG,
+        ,NVL(DOC_ORDER_HEADER.soreference5,ACT_ALLOCATION_DETAILS.PICKTOTRACEID) as soreference5,DOC_ORDER_HEADER.EDISENDFLAG2,DOC_ORDER_HEADER.EDISendTime2,DOC_ORDER_HEADER.Notes,DOC_ORDER_HEADER.ERPCANCELFLAG,
        DOC_ORDER_HEADER.Picking_Print_Flag,DOC_ORDER_HEADER.EDISENDFLAG
         ,DOC_ORDER_HEADER.ReleaseStatus,DOC_ORDER_HEADER.C_Address1,DOC_ORDER_HEADER.OrderTime,DOC_Order_Details.CustomerID,
        DOC_Order_Details.SKU,DOC_Order_Details.QtyOrdered,DOC_Order_Details.LOTNUM,DOC_Order_Details.LineStatus,DOC_Order_Details.OrderLineNo,order_code.codename_c as orderCodeName,
@@ -301,7 +301,7 @@ class OrderService
                       GROUP BY ACT_ALLOCATION_DETAILS.CHECKTIME,DOC_ORDER_HEADER.addtime,DOC_ORDER_HEADER.C_PROVINCE,DOC_ORDER_HEADER.C_CITY,DOC_ORDER_HEADER.MANUALFLAG,
                       DOC_ORDER_HEADER.C_DISTRICT,DOC_ORDER_HEADER.C_CONTACT,DOC_ORDER_HEADER.OrderNo,DOC_ORDER_HEADER.SOStatus,DOC_ORDER_HEADER.WAREHOUSEID,
                       DOC_ORDER_HEADER.CustomerID,DOC_ORDER_HEADER.C_Tel2,DOC_ORDER_HEADER.C_Tel1,DOC_ORDER_HEADER.CarrierName,DOC_ORDER_HEADER.IssuePartyName,
-                      DOC_ORDER_HEADER.EDIREMARKS2,DOC_ORDER_HEADER.WaveNo,DOC_ORDER_HEADER.SOReference1, NVL(ACT_ALLOCATION_DETAILS.PICKTOTRACEID,DOC_ORDER_HEADER.soreference5),
+                      DOC_ORDER_HEADER.EDIREMARKS2,DOC_ORDER_HEADER.WaveNo,DOC_ORDER_HEADER.SOReference1, NVL(DOC_ORDER_HEADER.soreference5,ACT_ALLOCATION_DETAILS.PICKTOTRACEID),
                       DOC_ORDER_HEADER.EDISENDFLAG2,DOC_ORDER_HEADER.EDISendTime2,DOC_ORDER_HEADER.Notes,DOC_ORDER_HEADER.ERPCANCELFLAG,
                       DOC_ORDER_HEADER.Picking_Print_Flag,DOC_ORDER_HEADER.EDISENDFLAG,DOC_ORDER_HEADER.ReleaseStatus,DOC_ORDER_HEADER.C_Address1,
                       DOC_ORDER_HEADER.OrderTime,DOC_Order_Details.CustomerID,DOC_Order_Details.SKU,DOC_Order_Details.QtyOrdered,DOC_Order_Details.LOTNUM,

+ 34 - 30
app/Services/WorkOrderService.php

@@ -32,8 +32,9 @@ class WorkOrderService
      * 获取可生成工单的问题件类型
      * @return Builder[]|\Illuminate\Database\Eloquent\Collection
      */
-    public function getIssueType(){
-        return OrderIssueType::query()->whereIn('name',['拦截','信息更改','其他', '快递异常','错漏发','破损'])->get();
+    public function getIssueType()
+    {
+        return OrderIssueType::query()->whereIn('name', ['拦截', '信息更改', '其他', '快递异常', '错漏发', '破损'])->get();
     }
 
     /**
@@ -47,20 +48,20 @@ class WorkOrderService
         $work_order_types = [];
         $data = Carbon::now();
         $creator_id = Auth::user()['id'];
-        $parent = WorkOrderType::query()->firstOrCreate(['name' => '订单','prent_id' => 0,'level' => 1]);
+        $parent = WorkOrderType::query()->firstOrCreate(['name' => '订单', 'prent_id' => 0, 'level' => 1]);
         foreach ($params as $param) {
-            $order = Order::query()->where('code',$param['order_no'])->first();
+            $order = Order::query()->where('code', $param['order_no'])->first();
             $type_name = $param['order_issue_type'];
             if (!$param['order_issue_type']) {
                 $order_issue_type_id = 0;
                 $work_order_type_id = 0;
             } else {
-                if (!array_key_exists($type_name,$types)){
-                    $types[$type_name] = OrderIssueType::query()->where('name',$type_name)->first();
+                if (!array_key_exists($type_name, $types)) {
+                    $types[$type_name] = OrderIssueType::query()->where('name', $type_name)->first();
                     $work_order_type_name = $this->work_type_relation[$type_name] ?? $type_name;
-                    $work_order_types[$type_name] =  WorkOrderType::query()->firstOrCreate(
+                    $work_order_types[$type_name] = WorkOrderType::query()->firstOrCreate(
                         ['name' => $work_order_type_name],
-                        ['prent_id' =>$parent['id'],'table_name' => 'orders','level' => 2]
+                        ['prent_id' => $parent['id'], 'table_name' => 'orders', 'level' => 2]
                     );
                 }
                 $order_issue_type_id = $types[$type_name]['id'] ?? 0;
@@ -94,15 +95,15 @@ class WorkOrderService
                 'order_issue_type_id' => $order_issue_type_id ?? 0,
                 'uniquely_tag' => $order['code'] ?? null,
                 'status' => 1,
-                'created_at' =>  $data,
-                'updated_at' =>  $data,
+                'created_at' => $data,
+                'updated_at' => $data,
             ];
         }
-        if (isset($inner_params)){
+        if (isset($inner_params)) {
             WorkOrder::query()->insert($inner_params);
             return ['success' => true];
         }
-        return ['success' => false,'message' => '参数异常'];
+        return ['success' => false, 'message' => '参数异常'];
     }
 
     /**
@@ -112,12 +113,13 @@ class WorkOrderService
      */
     public function review($wordOrder): array
     {
-        $wordOrder->update(['reviewer_id' => Auth::user()['id'], 'review_at' => Carbon::now(), 'status' => 2,]);
-        $wordOrder = WorkOrder::query()->with(['type', 'creator', 'order' => function ($query) {
+        $wordOrder->update(['reviewer_id' => Auth::user()['id'], 'review_at' => Carbon::now(), 'status' => '2',]);
+        $workOrders = WorkOrder::query()->with(['type', 'creator', 'order' => function ($query) {
             /** @var $query Builder */
             $query->with('packages', 'issue', 'logistic');
-        }, 'reviewer'])->find($wordOrder['id']);
-        return ['success' => true, 'data' => $wordOrder];
+        }, 'reviewer'])->whereIn('id', [$wordOrder['id']])->get();
+        $this->tags($workOrders);
+        return ['success' => true, 'data' => $workOrders->first()];
     }
 
     /**
@@ -130,12 +132,13 @@ class WorkOrderService
         $ids = $workOrders->map(function ($item) {
             return $item->id;
         })->toArray();
-        WorkOrder::query()->whereIn('id', $ids)->update(['review_at' => Carbon::now(), 'reviewer_id' => Auth::user()['id']]);
-        $wordOrder = WorkOrder::query()->with(['type', 'creator', 'order' => function ($query) {
+        WorkOrder::query()->whereIn('id', $ids)->update(['review_at' => Carbon::now(), 'reviewer_id' => Auth::user()['id'], 'status' => '2']);
+        $wordOrders = WorkOrder::query()->with(['type', 'creator', 'order' => function ($query) {
             /** @var $query Builder */
             $query->with('packages', 'issue', 'logistic');
-        }, 'reviewer'])->find($ids);
-        return ['success' => true, 'data' => $wordOrder];
+        }, 'reviewer'])->whereIn('id', $ids)->get();
+        $this->tags($wordOrders);
+        return ['success' => true, 'data' => $wordOrders];
     }
 
 
@@ -153,8 +156,8 @@ class WorkOrderService
                 'result_explain' => $work_order->remark,
             ];
         }
-        if (!isset($inner_params)) return ['success' => false,'message' => '创建问题件失败'];
-        return  app('OrderIssueService')->buildOrderIssue($inner_params);
+        if (!isset($inner_params)) return ['success' => false, 'message' => '创建问题件失败'];
+        return app('OrderIssueService')->buildOrderIssue($inner_params);
     }
 
     /**
@@ -184,17 +187,18 @@ class WorkOrderService
      */
     public function tags(&$workOrders)
     {
-        $order_ids = $workOrders->map(function($item){
+        $order_ids = $workOrders->map(function ($item) {
             return $item->order_id;
         });
-        $order_issues = OrderIssue::query()->whereIn('order_id',$order_ids)->get();
+        $order_issues = OrderIssue::query()->whereIn('order_id', $order_ids)->get();
+
         foreach ($order_issues as $order_issue) {
             $codes[$order_issue->order_id] = true;
         }
-        if (!isset($codes))return;
+        if (!isset($codes)) return;
         foreach ($workOrders as &$workOrder) {
-            if (array_key_exists($workOrder->order_id,$codes))$workOrder->is_issue_order= true;
-            else  $workOrder->is_issue_order= false;
+            if (array_key_exists($workOrder->order_id, $codes)) $workOrder->is_issue_order = true;
+            else  $workOrder->is_issue_order = false;
         }
     }
 
@@ -205,8 +209,8 @@ class WorkOrderService
      */
     public function isIntercept($logistic_number): bool
     {
-        $package_query = OrderPackage::query()->select('order_id')->where('logistic_number',$logistic_number);
-         $order_issue_query = OrderIssueType::query()->select('id')->where('name','拦截');
-        return WorkOrder::query()->whereIn('order_id',$package_query)->whereIn('order_issue_type_id',$order_issue_query)->exists();
+        $package_query = OrderPackage::query()->select('order_id')->where('logistic_number', $logistic_number);
+        $order_issue_query = OrderIssueType::query()->select('id')->where('name', '拦截');
+        return WorkOrder::query()->whereIn('order_id', $package_query)->whereIn('order_issue_type_id', $order_issue_query)->exists();
     }
 }

+ 32 - 0
database/migrations/2021_09_06_135431_add_is_intercept_to_order_issues.php

@@ -0,0 +1,32 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class AddIsInterceptToOrderIssues extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('order_issues', function (Blueprint $table) {
+            $table->tinyInteger('is_intercept')->comment('是否库内拦截');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('order_issues', function (Blueprint $table) {
+            $table->dropColumn('is_intercept');
+        });
+    }
+}

+ 2 - 2
resources/views/order/index/delivering.blade.php

@@ -77,8 +77,8 @@
                         <td class="text-muted text-nowrap"><span>@{{ order.carriername }}</span></td>
                         <td class="text-nowrap">
                             <div v-if="picktotraceidMap[order.orderno] && picktotraceidMap[order.orderno].length>1" class="text-center">
-                                <span v-for="picktotraceid in picktotraceidMap[order.orderno]" v-if="order.is_unfold">
-                                    @{{ picktotraceid }}<br>
+                                <span v-for="(picktotraceid,key) in picktotraceidMap[order.orderno]" v-if="order.is_unfold">
+                                    @{{ order.soreference5 ? (order.soreference5+'#'+(key+1)) : picktotraceid }}<br>
                                 </span>
                                 <button class="btn btn-sm btn-outline-info" :style="order.is_unfold ? 'opacity:0.7' : ''" @click="isUnfold(order)">
                                     <span v-if="order.is_unfold" class="mt-1">收起</span>

+ 2 - 1
resources/views/order/issue/index.blade.php

@@ -228,6 +228,7 @@
                                 @else
                                     <span v-if="orderIssue.is_new_rejecting">@{{ orderIssue.is_new_rejecting }}</span>
                                 @endcan
+                                <span class="badge badge-info" v-if="orderIssue.is_intercept === 1">库内拦截</span>
                             </td>
                             @can("订单管理-问题件-置顶")
                                 <td class="text-muted child-layer-1">
@@ -300,7 +301,7 @@
                             <template v-if="orderIssue.order">
                                 <span :class="orderIssue.order.packages.length > 1 ?'collapse ':''"
                                       :id="'logisticNumbers'+orderIssue.id">
-                                    <span class="m-0 p-0 d-inline-block" v-for="package in orderIssue.order.packages">@{{ package.logistic_number!==orderIssue.order.code ? package.logistic_number:'' }}&nbsp;&nbsp;</span>
+                                    <span class="m-0 p-0 d-inline-block" v-for="(package,key) in orderIssue.order.packages">@{{ orderIssue.custom_code ? orderIssue.custom_code +'-'+(key+1) : (package.logistic_number!==orderIssue.order.code ? package.logistic_number:'') }}&nbsp;&nbsp;</span>
                                 </span>
                                 <button type="button" class="btn btn-sm btn-outline-primary align-middle mt-1"
                                     v-if="orderIssue.order.packages.length > 1"

+ 42 - 2
resources/views/order/workOrder/index.blade.php

@@ -65,6 +65,7 @@
                                             审核
                                         </button>
                                     @endcan
+
                                 </td>
                                 <td class="text-center">@{{ item.status }}</td>
                                 <td class="text-center">@{{ item.owner ? item.owner.name : '' }}</td>
@@ -196,7 +197,15 @@
                                 <td class="text-center">@{{ item.created_at }}</td>
                                 <td>@{{ item.reviewer ? item.reviewer.name : ''}}</td>
                                 <td>@{{ item.review_at }}</td>
+                                @can('订单管理-工单处理-删除')
+                                    <td>
+                                        <button class="btn btn-sm btn-outline-danger"
+                                                @click="destroy(item,i)">
+                                            删除
+                                        </button>
+                                    </td>
 
+                                @endcan
                             </tr>
                         </template>
                         </tbody>
@@ -316,6 +325,9 @@
                     {name: 'submit_at', value: '提交时间',neglect: true},
                     {name: 'reviewer', value: '审核人',neglect: true},
                     {name: 'review_at', value: '审核时间',neglect: true},
+                    @can('订单管理-工单处理-删除')
+                    {name: 'delete_operation', value: '其他操作',neglect: true},
+                    @endcan()
                 ];
 
                 new Header({
@@ -394,6 +406,7 @@
                     else data.ids = checkData;
                     if (!confirm('是否生成对应的问题件')) return;
                     let _this = this;
+                    window.tempTip.waitingTip('生成中........');
                     window.axios.post(url, data).then(res => {
                         if (res.data.success) {
                             res.data.data.forEach(item => {
@@ -405,11 +418,14 @@
                                 });
                             });
                             this.$forceUpdate();
+                            window.tempTip.cancelWaitingTip();
                             window.tempTip.showSuccess('已生成对应的问题件');
                         } else {
+                            window.tempTip.cancelWaitingTip();
                             window.tempTip.show(res.data.message ? res.data.message : '生成问题件异常');
                         }
                     }).catch(err => {
+                        window.tempTip.cancelWaitingTip();
                         window.tempTip.show(err)
                     });
                 },
@@ -520,6 +536,7 @@
                     let _this = this;
                     window.tempTip.setIndex('1999');
                     if (!confirm('是否对当前选中订单进行审核')) return;
+                    window.tempTip.waitingTip('审核中........');
                     window.axios.post(url, data).then(res => {
                         if (res.data.success) {
                             $.each(res.data.data, (i, data) => {
@@ -530,11 +547,14 @@
                                 });
                             });
                             this.$forceUpdate();
+                            window.tempTip.cancelWaitingTip();
                             window.tempTip.showSuccess('审核完成');
                         } else {
+                            window.tempTip.cancelWaitingTip();
                             window.tempTip.show(res.data.message ? res.data.message : '审核出现异常');
                         }
                     }).catch(err => {
+                        window.tempTip.cancelWaitingTip();
                         window.tempTip.show(err);
                     })
                 },
@@ -544,14 +564,18 @@
                         id: item.id,
                         type_id: $(e.target).val()
                     };
+                    window.tempTip.waitingTip('修改中.........');
                     window.axios.post(url, data).then(res => {
                         if (res.data.success) {
+                            window.tempTip.cancelWaitingTip();
                             window.tempTip.showSuccess('修改成功');
                             item.order_issue_type_id = data.type_id;
                         } else {
+                            window.tempTip.cancelWaitingTip();
                             window.tempTip.show(res.data.message ? res.data.message : '修改异常');
                         }
                     }).catch(err => {
+                        window.tempTip.cancelWaitingTip();
                         window.tempTip.show(err);
                     });
                 },
@@ -577,7 +601,6 @@
                     window.axios.post(url, data).then(res => {
                         if (res.data.success) {
                             window.tempTip.showSuccess('修改问题件类型成功');
-
                             res.data.data.forEach(item => {
                                 _this.sortOrder(item);
                                 _this.workOrders.forEach((workOrder, i, array) => {
@@ -595,7 +618,24 @@
                         window.tempTip.show(err)
                     })
                 },
-
+                destroy(item,i){
+                    let url = '{{url('apiLocal/workOrder/')}}'+'/'+item.id;
+                    if(!confirm('是否删除当前工单')) return ;
+                    window.tempTip.waitingTip('删除.........');
+                    window.axios.delete(url).then(res=>{
+                        if (res.data.success){
+                            this.$delete(this.workOrders,i);
+                            window.tempTip.cancelWaitingTip();
+                            window.tempTip.showSuccess('删除成功');
+                        }else {
+                            window.tempTip.cancelWaitingTip();
+                            window.tempTip.show(res.data.message ? res.data.message : '');
+                        }
+                    }).catch(err=>{
+                        window.tempTip.cancelWaitingTip();
+                        window.tempTip.show(err);
+                    })
+                }
             },
         });
     </script>

+ 2 - 2
resources/views/package/logistic/index.blade.php

@@ -157,7 +157,7 @@
                     </td>
                     <!--退件状态-->
                     <td>@{{ package.rejected_bill?'有':'无' }}</td>
-                    <td>@{{ package.order.oracle_d_o_c_order_header.notes??'' }}</td>
+                    <td>@{{ package.order && package.order.oracle_d_o_c_order_header && package.order.oracle_d_o_c_order_header.notes }}</td>
                     <td  class="m-0 p-0 order-package-remarks" style="padding-left: 0 !important;padding-right: 0 !important">
                         @can('包裹管理-快递-客服备注')
                         <label :for="'create_remark_'+package.id" class="btn-create-remark" @click="package.input_remark=!package.input_remark">
@@ -195,7 +195,7 @@
                             v-if="package.order && package.order.issue && package.order.issue.issue_type">@{{ package.order.issue.issue_type.name }}</span>
                     </td>
                     <td class="text-overflow-warp-200">@{{ package.order && package.order.batch && package.order.batch.wms_type }}</td>
-                    <td class="text-overflow-warp-200">@{{ package.order.oracle_d_o_c_order_header.waveno??'' }}</td>
+                    <td class="text-overflow-warp-200">@{{ package.order && package.order.oracle_d_o_c_order_header && package.order.oracle_d_o_c_order_header.waveno }}</td>
                     <td class="text-overflow-warp-200"><span
                             v-if="package.order && package.order.issue && package.order.issue.logs.length >0"><span
                                 v-for="log in package.order.issue.logs">@{{ log.content }}<br></span></span></td>

+ 40 - 50
resources/views/transport/waybill/delivering.blade.php

@@ -36,26 +36,35 @@
                         <div style="transform:scale(0.9);color:#02346a" class="pl-0 form-inline">
                             <div class="mr-3 text-nowrap form-inline">
                                 <label :for="'carrier_bill'+waybill.id">专线运单号:</label>
-                                <input :id="'carrier_bill'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_bill?'is-invalid tooltipTargetError':''"
-                                       v-if="waybill.isBtn || updatePool[waybill.id]" type="text" :value="waybill.carrier_bill"
+                                <input :id="'carrier_bill'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_bill?'is-invalid':''"
+                                       v-if="waybill.isBtn || updatePool[waybill.id]" type="text" v-model="waybill.carrier_bill"
                                         class="form-control form-control-sm " @click="enlarge($event)"  style="width: 50px">
                                 <span v-else  class="text-muted">@{{ waybill.carrier_bill }}</span>
                             </div>
                             <div class="mr-3 text-nowrap form-inline">
                                 <label :for="'inquire_tel'+waybill.id">查&nbsp;件&nbsp;电&nbsp;&nbsp;话:</label>
-                                <input :id="'inquire_tel'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].inquire_tel?'is-invalid tooltipTargetError':''"
-                                       v-if="waybill.isBtn || updatePool[waybill.id]" :value="waybill.inquire_tel"  @click="enlarge($event)"
+                                <input :id="'inquire_tel'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].inquire_tel?'is-invalid':''"
+                                       v-if="waybill.isBtn || updatePool[waybill.id]" v-model="waybill.inquire_tel"  @click="enlarge($event)"
                                        class="form-control form-control-sm" type="text" style="width:50px">
                                 <span v-else  class="text-muted">@{{ waybill.inquire_tel }}</span>
                             </div>
                             <div class="mr-3 text-nowrap form-inline">
                                 <label :for="'amount'+waybill.id">数量:</label>
                                 <div class="input-group input-group-sm" v-if="waybill.isBtn || updatePool[waybill.id]">
-                                    <input :id="'amount'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].amount?'is-invalid tooltipTargetError':''"
-                                     :value="waybill.amount" @click="enlarge($event)"
+                                    <input :id="'amount'+waybill.id" :class="errors['_'+waybill.id]&&(errors['_'+waybill.id].amount || errors['_'+waybill.id].amount_unit_name)?'is-invalid':''"
+                                           v-model="waybill.amount" @click="enlarge($event)"
                                    class="form-control" type="text" style="width:50px">
                                     <span class="input-group-append">
-                                        <span class="input-group-text">件</span>
+                                        <span class="input-group-text">
+                                            <span class="custom-control custom-radio">
+                                                <input :name="'radio-'+waybill.id" type="radio" class="custom-control-input" :id="'radio-one'+waybill.id" v-model="waybill.amount_unit_name" value="件"/>
+                                                <label class="custom-control-label" :for="'radio-one'+waybill.id">件</label>
+                                            </span>
+                                            <span class="custom-control custom-radio">
+                                                <input :name="'radio-'+waybill.id" type="radio" class="custom-control-input" :id="'radio-two'+waybill.id" v-model="waybill.amount_unit_name" value="托"/>
+                                                <label class="custom-control-label" :for="'radio-two'+waybill.id">托</label>
+                                            </span>
+                                        </span>
                                     </span>
                                 </div>
                                 <span v-else class="text-muted"><span v-if="waybill.amount">@{{ waybill.amount }} @{{ waybill.amount_unit_name }}</span></span>
@@ -63,9 +72,9 @@
                             <div class="mr-3 text-nowrap form-inline">
                                 <label :for="'carrier_weight_other'+waybill.id">重量:</label>
                                 <div class="input-group input-group-sm" v-if="waybill.isBtn || updatePool[waybill.id]">
-                                <input :id="'carrier_weight_other'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_weight_other?'is-invalid tooltipTargetError':''"
-                                   :value="waybill.carrier_weight_other" @click="enlarge($event)"
-                                    type="text" class="form-control" style="width:50px">
+                                <input :id="'carrier_weight_other'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_weight_other?'is-invalid':''"
+                                       v-model="waybill.carrier_weight_other" @click="enlarge($event)"
+                                    type="number" step="0.01" min="0" class="form-control" style="width:50px">
                                 <span class="input-group-append">
                                   <span class="input-group-text">KG</span>
                                 </span>
@@ -75,9 +84,9 @@
                             <div class="mr-3 text-nowrap form-inline">
                                 <label :for="'carrier_weight'+waybill.id">体积:</label>
                                 <div class="input-group input-group-sm" v-if="waybill.isBtn || updatePool[waybill.id]">
-                                    <input :id="'carrier_weight'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_weight?'is-invalid tooltipTargetError':''"
-                                           :value="waybill.carrier_weight" @click="enlarge($event)"
-                                           type="text" class="form-control" style="width:50px">
+                                    <input :id="'carrier_weight'+waybill.id" :class="errors['_'+waybill.id]&&errors['_'+waybill.id].carrier_weight?'is-invalid':''"
+                                           v-model="waybill.carrier_weight" @click="enlarge($event)"
+                                           type="number" step="0.01" min="0" class="form-control" style="width:50px">
                                     <span class="input-group-append">
                                       <span class="input-group-text">M³</span>
                                     </span>
@@ -89,13 +98,10 @@
                                 <div class="input-group input-group-sm">
                                     <input :id="'subjoin_fee'+waybill.id" :value="waybill.subjoin_fee"
                                            class="form-control" style="width:150px">
-<!--                                    <span class="input-group-append">
-                                      <span class="input-group-text">元</span>
-                                    </span>-->
                                 </div>
                             </div>
                             <span class="mr-3 text-nowrap">
-                                <button class="btn btn-sm btn-outline-success" @click="submit(date,waybill.isBtn,waybill.id)">提交</button>
+                                <button class="btn btn-sm btn-outline-success" type="button" @click="submit(date,waybill)">提交</button>
                                 <button v-if="!waybill.isBtn && !updatePool[waybill.id]" class="btn btn-sm btn-outline-info" @click="$set(updatePool,waybill.id,true);">修改</button>
                             </span>
                         </div>
@@ -139,7 +145,6 @@
             slideStatus:{},
             dailyBilling:{screenDate:'', billing:''},
             error:{screenDate:'', billing:''},
-            // dailyReady:{},
         },
         mounted:function(){
             $(".tooltipTarget").tooltip({'trigger':'hover'});
@@ -214,6 +219,7 @@
                             carrier_weight_other:waybill.carrier_weight_other,
                             status:waybill.status,
                             amount:waybill.amount,
+                            amount_unit_name:waybill.amount_unit ? waybill.amount_unit.name : '',
                             inquire_tel:waybill.inquire_tel,
                             carrier_name:waybill.logistic ? waybill.logistic.name : '',
                             isBtn:!!!waybill.carrier_bill,
@@ -264,23 +270,18 @@
                     return !this.updatePool[waybillId] ? "附加费添加成功" : '';
                 });
             },
-            submit(date,isBtn,waybillId,id=null){
-                if(!isBtn){this.appendSubjoinFee(date,waybillId);if (!this.updatePool[waybillId])return;}
+            submit(date,waybill){
+                if(!waybill.isBtn){this.appendSubjoinFee(date,waybill.id);if (!this.updatePool[waybill.id])return;}
                 window.tempTip.confirm("确定要提交调配信息吗?",()=>{
                     let data={
-                        id           :  id ? id : waybillId,
-                        carrier_bill :  $("#carrier_bill"+waybillId).val(),
-                        inquire_tel  :  $("#inquire_tel"+waybillId).val(),
-                        amount  :  $("#amount"+waybillId).val(),
-                        carrier_weight  :  $("#carrier_weight"+waybillId).val(),
-                        carrier_weight_other  :  $("#carrier_weight_other"+waybillId).val(),
+                        id           :  waybill.id,
+                        carrier_bill :  waybill.carrier_bill,
+                        inquire_tel  :  waybill.inquire_tel,
+                        amount       :  waybill.amount,
+                        carrier_weight  :  waybill.carrier_weight,
+                        carrier_weight_other  :  waybill.carrier_weight_other,
+                        amount_unit_name : waybill.amount_unit_name
                     };
-                    if (!data["id"]){
-                        window.tempTip.setDuration(3000);
-                        window.tempTip.show("参数异常");
-                        return;
-                    }
-                    this.errors["_"+data['id']]={};
                     axios.post("{{url('transport/waybill/storeCarrierBill')}}",data)
                         .then(response=>{
                             if (response.data.error){
@@ -289,27 +290,16 @@
                                 return;
                             }
                             if (response.data.errors){
-                                this.$set(this.errors,"_"+data['id'],response.data.errors);
-                                setTimeout(function(){
-                                    $(".tooltipTargetError").tooltip('show');
-                                },1);
+                                let key = "_"+data['id']
+                                let errors = {};
+                                errors[key] = response.data.errors;
+                                this.errors = errors;
                                 return;
                             }
-                            this.groups[date].waybills.some(function (waybill) {
-                                if (waybill.id===data['id']){
-                                    waybill.carrier_bill=response.data.carrier_bill;
-                                    waybill.inquire_tel=response.data.inquire_tel;
-                                    waybill.amount=response.data.amount;
-                                    waybill.amount_unit_name=response.data.amount_unit_name;
-                                    waybill.carrier_weight=response.data.carrier_weight;
-                                    waybill.carrier_weight_other=response.data.carrier_weight_other;
-                                    if (waybill.carrier_bill)waybill.isBtn=false;
-                                    return true;
-                                }
-                            });
+                            waybill.isBtn=false;
                             tempTip.setDuration(2000);
-                            if (this.updatePool[waybillId]){
-                                tempTip.showSuccess('修改成功!');this.$set(this.updatePool,waybillId,false);
+                            if (this.updatePool[waybill.id]){
+                                tempTip.showSuccess('修改成功!');this.$set(this.updatePool,waybill.id,false);
                             }else tempTip.showSuccess('录入成功!');
                         }).catch(function (err) {
                             tempTip.setDuration(3000);

+ 41 - 37
resources/views/transport/waybill/index.blade.php

@@ -24,46 +24,49 @@
                     </ul>
                 </div>
             </div>
+
             <div id="form_div"></div>
-            <span class="dropdown">
-                <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
-                        data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
-                    导出Excel
-                </button>
-                <div class="dropdown-menu" style="z-index: 1099">
-                    <a class="dropdown-item" @click="waybillExport(false)" href="javascript:">导出勾选内容</a>
-                    <a class="dropdown-item" @click="waybillExport(true)" href="javascript:">导出所有页</a>
+            <div class="ml-3 form-inline" id="btn">
+                <span class="dropdown">
+                    <button class="btn btn-outline-dark btn-sm form-control-sm dropdown-toggle tooltipTarget"
+                            data-toggle="dropdown" title="导出所有页将会以搜索条件得到的筛选结果,将其全部记录(每一页)导出">
+                        导出Excel
+                    </button>
+                    <div class="dropdown-menu" style="z-index: 1099">
+                        <a class="dropdown-item" @click="waybillExport(false)" href="javascript:">导出勾选内容</a>
+                        <a class="dropdown-item" @click="waybillExport(true)" href="javascript:">导出所有页</a>
+                    </div>
+                </span>
+                <div class="form-check d-inline-block">
+                    <label class="form-check-label">
+                        <input type="checkbox" class="form-check-input" v-model="appendFluxInfo">导出附加FLUX信息
+                    </label>
                 </div>
-            </span>
-            <div class="form-check d-inline-block">
-                <label class="form-check-label">
-                    <input type="checkbox" class="form-check-input" v-model="appendFluxInfo">导出附加FLUX信息
-                </label>
-            </div>
-            @can('运输管理-运单-图片上传')<button class="btn btn-sm btn-outline-info" data-target="#batchUploadImg" data-toggle="modal">批量上传图片</button>@endcan
-            @can('运输管理-运单-图片删除')<button class="btn btn-sm btn-outline-danger" @click="deleteImg()">批量删除图片</button>@endcan
-            @if($uriType=='' || $uriType=='专线')
-                @can('运输管理-运单-按日计算专线费')
-                    <button class="btn btn-sm btn-outline-success tooltipTarget" data-target="#dailyBilling" data-toggle="modal"
-                            title="计算指定日期下的所有专线费,不考虑有无货主权限">按日输入专线费</button>@endcan
-            @endif
-            @can('运输管理-编辑')<button class="btn btn-sm btn-outline-info tooltipTarget"
-                        title="合并多条运单至一条,已填写信息将被累加处理" @click="waybillMerge()">运单合并</button>
-            <button class="btn btn-sm btn-outline-info tooltipTarget"
-                    title="将已合并运单拆分返回原状态" @click="waybillSplit()">拆单返回</button>
-            @endcan
-            @if($uriType=='' || $uriType=='德邦物流')
+                @can('运输管理-运单-图片上传')<button class="btn btn-sm btn-outline-info" data-target="#batchUploadImg" data-toggle="modal">批量上传图片</button>@endcan
+                @can('运输管理-运单-图片删除')<button class="btn btn-sm btn-outline-danger" @click="deleteImg()">批量删除图片</button>@endcan
+                @if($uriType=='' || $uriType=='专线')
+                    @can('运输管理-运单-按日计算专线费')
+                        <button class="btn btn-sm btn-outline-success tooltipTarget" data-target="#dailyBilling" data-toggle="modal"
+                                title="计算指定日期下的所有专线费,不考虑有无货主权限">按日输入专线费</button>@endcan
+                @endif
+                @can('运输管理-编辑')<button class="btn btn-sm btn-outline-info tooltipTarget"
+                                       title="合并多条运单至一条,已填写信息将被累加处理" @click="waybillMerge()">运单合并</button>
                 <button class="btn btn-sm btn-outline-info tooltipTarget"
-                        title="打印快递面单" @click="expressFaceList()">打印快递面单</button>
-            @endif
-            <div>
-                @if(Session::has('successTip'))
-                    <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
+                        title="将已合并运单拆分返回原状态" @click="waybillSplit()">拆单返回</button>
+                @endcan
+                @if($uriType=='' || $uriType=='德邦物流')
+                    <button class="btn btn-sm btn-outline-info tooltipTarget"
+                            title="打印快递面单" @click="expressFaceList()">打印快递面单</button>
                 @endif
+                <div>
+                    @if(Session::has('successTip'))
+                        <div class="alert alert-success h1">{{Session::get('successTip')}}</div>
+                    @endif
+                </div>
+                {{--    德邦面单--}}
+                <div id="lodopTips"></div>
+                {{--    德邦面单--}}
             </div>
-            {{--    德邦面单--}}
-            <div id="lodopTips"></div>
-            {{--    德邦面单--}}
 
             <table class="table table-striped table-bordered table-hover text-nowrap waybill-table td-min-width-80" style="background: #fff;" id="table">
                 <tr v-for="(waybill,i) in waybills" :class="[waybill.status=='待重审'?'td-red':''||waybill.status=='已完结'?'td-green':'',selectTr==waybill.id ? 'tr-select' : '']"
@@ -686,6 +689,7 @@
                     el:"#form_div",
                     condition:data,
                     param:param,
+                    appendDom : "btn",
                 });
                 this.form.init();
                 this.rendingHeader();
@@ -889,7 +893,7 @@
                         column: column,
                         data: this.waybills,
                         restorationColumn: 'id',
-                        fixedTop:($('#form_div').height())+2,
+                        fixedTop:($('#form_div').height()) + ($('#btn').height())+2,
                         before : [
                             {colspan:'4',value: '', class:"table-header-layer-1"},
                             {colspan:'15',value: '运单信息',font:"fa fa-file-text-o", class:"table-header-layer-1"},
@@ -1434,7 +1438,7 @@
                     });
                     return val;
                 },
-            }
+            },
         });
         // modal 隐藏时修改 input 为空
         $("#exampleModal").on('hide.bs.modal',function(e){

+ 1 - 0
routes/apiLocal.php

@@ -267,4 +267,5 @@ Route::prefix('workOrder')->group(function(){
     Route::post('buildOrderIssue','WorkOrderController@buildOrderIssueApi')->name('workOrder.buildOrderIssueApi');  // 生成问题件
     Route::post('updateIssueType','WorkOrderController@updateIssueTypeApi')->name('workOrder.updateIssueTypeApi'); // 修改问题类型
     Route::post('batchUpdateIssueType','WorkOrderController@batchUpdateIssueTypeApi')->name('workOrder.batchUpdateIssueTypeApi'); // 修改问题类型
+    Route::delete('/{id}','WorkOrderController@destroyApi')->name('workOrder.destroyApi');
  });