king пре 4 година
родитељ
комит
68557097ff

+ 8 - 3
app/Http/Controllers/WaybillController.php

@@ -170,8 +170,8 @@ class WaybillController extends Controller
             if ($waybill->type=='德邦物流' && !$oldBill){
                 $bill = app('DbOpenService')->getDbOrderNo($waybill);
                 if (!$bill){DB::rollBack();return "获取德邦单号失败,德邦服务异常";}
-                $waybill->update(["carrier_bill"=>$bill,'waybill_number'=>$bill]);
-                $msg =  "【申请德邦物流单号:".$bill."】";
+                $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']]);
+                $msg =  "【申请德邦物流单号:".$bill['mailNo']."】";
                 if (!app("WaybillService")->notifyFlux($waybill))$msg .= ",通知FLUX失败";
                 $stage = '发起德邦调度';
             }
@@ -1130,7 +1130,12 @@ class WaybillController extends Controller
         $ids = $request->input("ids");
         try {
             /** @var Collection $waybills */
-            $waybills = Waybill::query()->where('type','德邦物流')->whereIn("id",$ids)->get();
+            $waybills = Waybill::query()->where('type','德邦物流')
+                ->whereIn("id",$ids)
+                ->whereHas("waybillAuditLogs",function ($query){
+                    $query->where("audit_stage","发起德邦调度");
+                })
+                ->get();
             if ($waybills->count()==0)$this->error("运单不存在或运单类型不正确");
             foreach ($waybills as $waybill){
                 $waybill->loadMissing([

+ 5 - 5
app/Services/DbOpenService.php

@@ -35,7 +35,7 @@ class DbOpenService
         try {
             $response = httpPost(config('api_logistic.DB.prod.uri')['create_order'], $body, $header);
             if (!$response["result"])return null;
-            return $response['mailNo'] ?? '';
+            return $response ?? '';
             //OracleDOCOrderHeader::query()->where('orderno', $order_no)->update(['edittime' => Carbon::now(), 'soreference5' => $mail_no]);
         }catch (\Exception $e){
             $this->push(__METHOD__."->".__LINE__,"德邦接口请求失败",$e->getMessage() . ' | '.json_encode($response ?? ''));
@@ -88,11 +88,11 @@ class DbOpenService
             'transportType' =>      $waybill->transport_type,
             'customerCode'  =>      config('api_logistic.DB.prod.customer_Code'),
             'sender'        =>      [
-                'companyName'       => $waybill->order->shop->name ?? '',
+                'companyName'       => '宝时物流',
                 'businessNetworkNo' => '',
-                'name'              => $waybill->owner->name ?? '',
-                'mobile'            => $waybill->owner->phone_number ?? '',
-                'phone'             => $waybill->owner->phone_number ?? '',
+                'name'              => '宝时物流',
+                'mobile'            => '',
+                'phone'             => '021-6316561',
                 'province'          => $waybill->order->warehouse->province->name ?? '',
                 'city'              => $waybill->order->warehouse->city->name ?? '',
                 'country'           => $waybill->order->warehouse->county->name ?? '',

+ 4 - 1
app/Waybill.php

@@ -70,7 +70,10 @@ class Waybill extends Model
         'pay_type',
         'back_sign_bill',
         'package_service',
-        'express_face_list'
+        'express_face_list',
+        'arrived_org_simple_name',
+        'much_higher_delivery',
+        'station_no'
     ];
 
     public function district()

+ 36 - 0
database/migrations/2021_08_11_153350_change_dbwl_column_in_waybills_table.php

@@ -0,0 +1,36 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+class ChangeDbwlColumnInWaybillsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::table('waybills', function (Blueprint $table) {
+            $table->string('station_no')->nullable()->comment('提货网点编码');
+            $table->string('much_higher_delivery')->nullable()->comment('超远派送金额');
+            $table->string('arrived_org_simple_name')->nullable()->comment('目的站部门简称');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::table('waybills', function (Blueprint $table) {
+            $table->dropColumn('station_no');
+            $table->dropColumn('much_higher_delivery');
+            $table->dropColumn('arrived_org_simple_name');
+        });
+    }
+}

+ 8 - 8
resources/js/lodop/myPrintKit.js

@@ -273,14 +273,14 @@ function printTest(item = '') {
     var printOrder = {};
 
     printOrder.waybillNumber = item.waybill_number??'';
-    printOrder.shipperCompanyPhone = item.owner.phone_number;
+    printOrder.shipperCompanyPhone = '021-6316561';
     printOrder.shipperCompanyAddress = item.order.warehouse.province.name +'-'+item.order.warehouse.city.name+'-'+item.order.warehouse.county.name+'-'+item.order.warehouse.address
-    printOrder.shipperTel = item.owner.phone_number;
+    printOrder.shipperTel = '021-6316561';
     printOrder.saddress = item.order.warehouse.province.name +'-'+item.order.warehouse.city.name+'-'+item.order.warehouse.county.name+'-'+item.order.warehouse.address;
-    printOrder.shipperPhone = item.owner.phone_number;
+    printOrder.shipperPhone = '021-6316561';
     printOrder.conPhone = item.order.consignee_phone;
     printOrder.conTel = item.order.consignee_phone;
-    printOrder.shipperName = item.owner.name;
+    printOrder.shipperName = '宝时物流';
     printOrder.conName = item.order.consignee_name;
     printOrder.caddress = item.order.province+'-'+item.order.city+'-'+item.order.district+'-'+item.order.address;
     printOrder.cargoName = item.cargo_name;
@@ -294,11 +294,11 @@ function printTest(item = '') {
     printOrder.totalCharge = item.charge;
     printOrder.insuranceMoney = 0; //保价
     printOrder.signSheet = item.back_sign_bill ? (item.back_sign_bill == 1 ? '签收单原件返回' : '电子签收单' ) : '无需返单';
-    printOrder.outerField1 = '德邦货运'; //受理部门
-    printOrder.lastOutLoadOrgName = '上海市';  //最终外场
+    printOrder.outerField1 = ''; //受理部门
+    printOrder.lastOutLoadOrgName = item.arrived_org_simple_name??'';  //最终外场
     printOrder.departCityName = '上海市'; //原寄地
-    printOrder.secondLoadOrgName = '上海市';  //第二外场
-    printOrder.stationNumber = 1; //提货网点id
+    printOrder.secondLoadOrgName = '';  //第二外场
+    printOrder.stationNumber = item.station_no??''; //提货网点id
     printOrder.custOrderLine = item.wms_bill_number;
     printOrder.transNote = item.ordering_remark;
     printOrder.markerPen = item.origination;