|
@@ -23,7 +23,7 @@
|
|
|
<span class="text">派车数</span>
|
|
|
<el-input v-model="carNumber"></el-input>
|
|
|
<span class="text">每车重量</span>
|
|
|
- <el-input v-model="uniteOrderPlanWeight"></el-input>
|
|
|
+ <el-input v-model="uniteOrderPlanWeight" disabled></el-input>
|
|
|
<span class="text">截止日期</span>
|
|
|
<el-date-picker type="date" v-model="uniteSaleDateOfReceipt" style="width:150px"></el-date-picker>
|
|
|
<el-button type="primary" @click="AddTruckClick" style="margin-top: 10px;">确定</el-button>
|
|
@@ -105,6 +105,7 @@
|
|
|
@input="onInput"
|
|
|
placeholder="(必填)"
|
|
|
v-model.number="scope.row.orderPlanWeight"
|
|
|
+ disabled
|
|
|
></el-input>
|
|
|
</template>
|
|
|
|
|
@@ -352,7 +353,7 @@ export default {
|
|
|
//统一截止日期
|
|
|
uniteSaleDateOfReceipt:null,
|
|
|
//统一每车重量
|
|
|
- uniteOrderPlanWeight:null,
|
|
|
+ uniteOrderPlanWeight:60,
|
|
|
//线路名称
|
|
|
lineName:null,
|
|
|
lineId:null,
|
|
@@ -512,7 +513,6 @@ export default {
|
|
|
this.axios
|
|
|
.post("/api/v1/rms/getAllLineDesk?apiId=249&lineType=3&con="+'销售副产品单拼路线')
|
|
|
.then((res)=>{
|
|
|
- console.log("res.data.data.list[0].lineName",res.data.data.list[0].lineName)
|
|
|
this.lineName = res.data.data.list[0].lineName +" "+ res.data.data.list[0].lineDesk;
|
|
|
this.lineId = res.data.data.list[0].lineId;
|
|
|
});
|
|
@@ -520,10 +520,12 @@ export default {
|
|
|
//校验是否为车牌
|
|
|
isVehicleNumber(vehicleNumber) {
|
|
|
var result = false;
|
|
|
- if (vehicleNumber.length == 7) {
|
|
|
- var express =
|
|
|
- /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/;
|
|
|
- result = express.test(vehicleNumber);
|
|
|
+ if(vehicleNumber!=null){
|
|
|
+ if (vehicleNumber.length == 7) {
|
|
|
+ var express =
|
|
|
+ /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/;
|
|
|
+ result = express.test(vehicleNumber);
|
|
|
+ }
|
|
|
}
|
|
|
return result;
|
|
|
},
|
|
@@ -677,11 +679,16 @@ export default {
|
|
|
|
|
|
//点击确定按钮的事件
|
|
|
makeSure(){
|
|
|
- var canDo = (this.totalWeight/this.number).toFixed(2);
|
|
|
+ //获取当前派车的数量和预估吨位的总和
|
|
|
+ var sendCount = this.selectionList.length*this.uniteOrderPlanWeight;
|
|
|
+ //判断是否达到95%
|
|
|
+ var canDo = ((this.totalWeight+sendCount)/this.number).toFixed(2);
|
|
|
if(canDo>0.95){
|
|
|
- this.$message.error('当前已派发吨数接近订单总吨数,不可继续派单!')
|
|
|
+ var canSend = Math.floor(((this.number*0.95)-this.totalWeight)/this.uniteOrderPlanWeight);
|
|
|
+ this.$message.error('当前已派发吨数接近订单总吨数,最多还可派 ('+canSend+') 辆车!')
|
|
|
}else{
|
|
|
let state = false;
|
|
|
+ var beReady = 0;
|
|
|
this.selectionList.forEach((e)=>{
|
|
|
if(!isNumber(e.orderPlanWeight)){ //判定重量合法
|
|
|
this.$message.error('重量请输入数字')
|
|
@@ -705,6 +712,9 @@ export default {
|
|
|
if(isIntegerNumber(e.carrierName)){
|
|
|
e.carrierId = e.carrierName
|
|
|
}
|
|
|
+ if(e.capacityNumber){
|
|
|
+ beReady++;
|
|
|
+ }
|
|
|
})
|
|
|
if(state){
|
|
|
//校验是否自提,是自提,则运输单价必选,非自提,运输单价为空
|
|
@@ -713,11 +723,11 @@ export default {
|
|
|
e.priceValue = null;
|
|
|
e.priceId = null;
|
|
|
})
|
|
|
- this.sendRequest();
|
|
|
+ this.sendRequest(beReady);
|
|
|
}else{
|
|
|
//判断是否全部完成运输单价的选择
|
|
|
if(this.choosePriceCount==this.selectionList.length){
|
|
|
- this.sendRequest();
|
|
|
+ this.sendRequest(beReady);
|
|
|
}else{
|
|
|
this.$message.warning('还有运输单价未被选定!')
|
|
|
}
|
|
@@ -729,11 +739,12 @@ export default {
|
|
|
|
|
|
},
|
|
|
//发送请求
|
|
|
- sendRequest(){
|
|
|
- this.axios.post('/api/v1/ams/dispatchTruckOrderBySale',{
|
|
|
+ sendRequest(beReady){
|
|
|
+ if(beReady==this.selectionList.length){
|
|
|
+ this.axios.post('/api/v1/ams/dispatchTruckOrderBySale',{
|
|
|
saleOrderId:this.$route.params.saleOrderId,
|
|
|
mapList:this.selectionList,
|
|
|
- }).then((res)=>{
|
|
|
+ }).then((res)=>{
|
|
|
if(res.data.code == '200'){
|
|
|
this.$message.success('派车成功')
|
|
|
this.cancel();
|
|
@@ -766,6 +777,9 @@ export default {
|
|
|
|
|
|
}
|
|
|
})
|
|
|
+ }else{
|
|
|
+ this.$message.error('还有车牌号未填写!')
|
|
|
+ }
|
|
|
},
|
|
|
//点击取消按钮的事件
|
|
|
cancel(){
|