|
|
@@ -1214,9 +1214,11 @@ SQL;
|
|
|
*/
|
|
|
public function shipmentAndMerge()
|
|
|
{
|
|
|
+ $this->gate("运输管理-编辑");
|
|
|
$waybill = Waybill::query()->where("waybill_number",\request("waybill"))->whereNull("deliver_at")
|
|
|
->whereNotIn("status",["已完结","无模型"])->first();
|
|
|
if (!$waybill)$this->error("运单禁止操作");
|
|
|
+ if ($waybill->deliver_at)$this->error("运单已发货,请勿重复调配");
|
|
|
$codes = explode("\n",\request("order"));
|
|
|
$waybills = Waybill::query()->whereIn("wms_bill_number",$codes)
|
|
|
->where("id","!=",$waybill->id)
|
|
|
@@ -1273,4 +1275,51 @@ SQL;
|
|
|
{
|
|
|
return view("transport.waybill.android.dispatch");
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 搜索运单获取信息
|
|
|
+ */
|
|
|
+ public function searchWaybill()
|
|
|
+ {
|
|
|
+ $this->success($this->dispatchCheck(\request("bill")));
|
|
|
+ }
|
|
|
+
|
|
|
+ private function dispatchCheck($bill)
|
|
|
+ {
|
|
|
+ if (!$bill)$this->error("参数异常");
|
|
|
+ $waybill = Waybill::query()->select(["carrier_bill","inquire_tel","carrier_weight_other","carrier_weight","amount","deliver_at"])
|
|
|
+ ->where("code",$bill)->whereNotIn("status",["已完结","无模型"])->first();
|
|
|
+ if(!$waybill)$this->error("非法运单号");
|
|
|
+ if ($waybill->carrier_bill)$this->error("运单已发货,请勿重复调配");
|
|
|
+ if (!$waybill->deliver_at)$this->error("运单未发货,无法调配");
|
|
|
+ return $waybill;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 调配
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public function dispatchSubmit()
|
|
|
+ {
|
|
|
+ $this->gate("运输管理-编辑");
|
|
|
+ $waybill = $this->dispatchCheck(\request("waybill"));
|
|
|
+ $unit = app("UnitService")->getUnit("kg");
|
|
|
+ $unit1 = app("UnitService")->getUnit("件");
|
|
|
+ $waybill->update([
|
|
|
+ "carrier_bill" => \request("waybill"),
|
|
|
+ "inquire_tel" => \request("phone"),
|
|
|
+ "carrier_weight_other" => \request("volume"),
|
|
|
+ "carrier_weight" => \request("weight"),
|
|
|
+ "amount" => \request("amount"),
|
|
|
+ "amount_unit_id" => $unit->id,
|
|
|
+ "carrier_weight_unit_id" => $unit->id,
|
|
|
+ "carrier_weight_unit_id_other" => $unit1->id,
|
|
|
+ ]);
|
|
|
+ WaybillAuditLog::query()->create([
|
|
|
+ 'waybill_id'=>$waybill->id,
|
|
|
+ 'audit_stage'=>'调度阶段',
|
|
|
+ 'user_id'=>Auth::id(),
|
|
|
+ ]);
|
|
|
+ $this->success();
|
|
|
+ }
|
|
|
}
|