|
@@ -18,7 +18,7 @@
|
|
|
<a-col :md="6" :sm="8">
|
|
|
<!-- required 必填项 disabled 禁用 -->
|
|
|
<a-form-model-item label="单据号" prop="documentNo">
|
|
|
- <a-input placeholder="自动生成" v-model="addShipDet.documentNo" readOnly></a-input>
|
|
|
+ <a-input placeholder="自动生成" v-model="addShipDet.documentNo" ></a-input>
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
|
|
@@ -35,7 +35,8 @@
|
|
|
|
|
|
<a-col :md="6" :sm="8">
|
|
|
<a-form-model-item label="客户" prop="customer">
|
|
|
- <a-input placeholder="请输入客户" v-model="addShipDet.customer" readOnly></a-input>
|
|
|
+ {{addShipDet.customer | ellipsis }}
|
|
|
+ <!-- <a-input placeholder="请输入客户" v-model="addShipDet.customer" readOnly></a-input> -->
|
|
|
</a-form-model-item>
|
|
|
</a-col>
|
|
|
|
|
@@ -61,11 +62,11 @@
|
|
|
</a-form-model-item>
|
|
|
</a-col> -->
|
|
|
|
|
|
- <a-col :md="6" :sm="8">
|
|
|
+ <!-- <a-col :md="6" :sm="8">
|
|
|
<a-form-model-item label="订单类型" prop="orderType">
|
|
|
<a-input placeholder="请输入订单类型" v-model="addShipDet.orderType" readOnly></a-input>
|
|
|
</a-form-model-item>
|
|
|
- </a-col>
|
|
|
+ </a-col> -->
|
|
|
|
|
|
<!-- <a-col :md="6" :sm="8">
|
|
|
<a-form-model-item label="成衣工厂" prop="garmentFactory">
|
|
@@ -280,9 +281,10 @@ export default {
|
|
|
let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} />
|
|
|
return {
|
|
|
id: '',
|
|
|
+ judge : 0,
|
|
|
validatorRules:{
|
|
|
documentDate:[{required: true, message: '请输入单据日期!'}],
|
|
|
- customer:[{required: true, message: '请输入客户!', trigger: 'change'}],
|
|
|
+ customer:[{required: true, message: '客户为空!', trigger: 'change'}],
|
|
|
// preDeliveryDate:[{required: true, message: '请选择预发货时间!'}],
|
|
|
// preCompletionDate:[{required: true, message: '请选择预完工日期!'}],
|
|
|
// orderType:[{required: true, message: '请输入订单类型!'}],
|
|
@@ -474,12 +476,12 @@ export default {
|
|
|
className: 'replacecolor',
|
|
|
customRender: t => ellipsis(t),
|
|
|
},
|
|
|
- {
|
|
|
- title: '汇率',
|
|
|
- dataIndex: 'exchangeRate',
|
|
|
- width: 120,
|
|
|
- className: 'replacecolor'
|
|
|
- },
|
|
|
+ // {
|
|
|
+ // title: '汇率',
|
|
|
+ // dataIndex: 'exchangeRate',
|
|
|
+ // width: 120,
|
|
|
+ // className: 'replacecolor'
|
|
|
+ // },
|
|
|
|
|
|
{
|
|
|
title: '销售部门',
|
|
@@ -513,24 +515,24 @@ export default {
|
|
|
align: 'left',
|
|
|
className: 'replacecolor'
|
|
|
},
|
|
|
- {
|
|
|
- title: '定金比例(%)',
|
|
|
- dataIndex: 'depositRatio',
|
|
|
- width: 120,
|
|
|
- className: 'replacecolor'
|
|
|
- },
|
|
|
- {
|
|
|
- title: '定金',
|
|
|
- dataIndex: 'deposit',
|
|
|
- width: 120,
|
|
|
- className: 'replacecolor'
|
|
|
- },
|
|
|
- {
|
|
|
- title: '协同路线',
|
|
|
- dataIndex: 'collaborativeRoute',
|
|
|
- width: 120,
|
|
|
- className: 'replacecolor'
|
|
|
- },
|
|
|
+ // {
|
|
|
+ // title: '定金比例(%)',
|
|
|
+ // dataIndex: 'depositRatio',
|
|
|
+ // width: 120,
|
|
|
+ // className: 'replacecolor'
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // title: '定金',
|
|
|
+ // dataIndex: 'deposit',
|
|
|
+ // width: 120,
|
|
|
+ // className: 'replacecolor'
|
|
|
+ // },
|
|
|
+ // {
|
|
|
+ // title: '协同路线',
|
|
|
+ // dataIndex: 'collaborativeRoute',
|
|
|
+ // width: 120,
|
|
|
+ // className: 'replacecolor'
|
|
|
+ // },
|
|
|
|
|
|
|
|
|
|
|
@@ -652,8 +654,8 @@ export default {
|
|
|
this.manualYarnDisabled = false //初始化manualYarnDisabled
|
|
|
var copyValList = JSON.parse(JSON.stringify(val));
|
|
|
this.$set( this.addShipDet,'customer',copyValList[0].customerName)
|
|
|
+ this.$set( this.addShipDet,'orderType',copyValList[0].orderType)
|
|
|
// this.addShipDet.customer = copyValList[0].customerName;
|
|
|
- console.log(copyValList);
|
|
|
for (var i in copyValList) {
|
|
|
copyValList[i]['orderQuantity'] = copyValList[i].quantity
|
|
|
copyValList[i]['orderRemainingQuantity'] = copyValList[i].surplusNum
|
|
@@ -692,7 +694,7 @@ export default {
|
|
|
const that = this;
|
|
|
console.log(this.addShipDet)
|
|
|
// 触发表单验证
|
|
|
- this.$refs.form.validate(valid => {
|
|
|
+ this.$refs.form.validate(async valid => {
|
|
|
if (valid) {
|
|
|
var newObj = {} // 新增对象
|
|
|
newObj.documentNo = this.addShipDet.documentNo
|
|
@@ -706,7 +708,7 @@ export default {
|
|
|
newObj.wholeOrderTotal = this.addShipDet.wholeOrderTotal
|
|
|
newObj.memo = this.addShipDet.memo // U8系统适用
|
|
|
newObj.syShippingDetailsItemList = this.syShippingDetailsItemList // 子表信息赋值
|
|
|
-
|
|
|
+
|
|
|
// 必须选择子表 --- 参照订单数据
|
|
|
if (newObj.syShippingDetailsItemList.length == 0) {
|
|
|
this.$message.error('请选择参照订单数据')
|
|
@@ -718,131 +720,10 @@ export default {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- // 根据syOrderDataItemId判断重复子表id
|
|
|
- for (var i=0; i<newObj.syShippingDetailsItemList.length; i++){
|
|
|
- var rowData = newObj.syShippingDetailsItemList[i];
|
|
|
- for (var j=i+1;j<newObj.syShippingDetailsItemList.length; j++){
|
|
|
- var nextData = newObj.syShippingDetailsItemList[j];
|
|
|
- if (rowData.smallPo == nextData.smallPo && rowData.orderNumber == nextData.orderNumber &&
|
|
|
- rowData.preDeliveryDate == nextData.preDeliveryDate && rowData.preCompletionDate == nextData.preCompletionDate &&
|
|
|
- rowData.itemNumber == nextData.itemNumber && rowData.inventoryCode == nextData.inventoryCode&&
|
|
|
- rowData.colour == nextData.colour&& rowData.size == nextData.size){
|
|
|
- this.$message.error('第'+(i+1)+'行和第'+(j+1)+'行数据相同,无法保存');
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- for(var i=0; i<newObj.syShippingDetailsItemList.length; i++){
|
|
|
- var rowData = newObj.syShippingDetailsItemList[i];
|
|
|
- //判断输入报关单价是否为数字
|
|
|
- if(isNaN(Number(rowData.customsDeclarationUnitPrice,10)) && rowData.customsDeclarationUnitPrice){
|
|
|
- this.$message.error('第'+(i+1)+'行报关单价必须为数字!');
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- //判断输入发货数量是否为数字
|
|
|
- if(isNaN(Number(rowData.shipmentQuantity,10)) && rowData.shipmentQuantity){
|
|
|
- this.$message.error('第'+(i+1)+'行发货数量必须为数字!');
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- //判断输入套装件数是否为数字
|
|
|
- if(isNaN(Number(rowData.numberOfSets,10)) && rowData.numberOfSets){
|
|
|
- this.$message.error('第'+(i+1)+'行套装件数必须为数字!');
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- //判断输入工厂单价是否为数字
|
|
|
- if(isNaN(Number(rowData.factoryUnitPrice,10)) && rowData.factoryUnitPrice){
|
|
|
- this.$message.error('第'+(i+1)+'行工厂单价必须为数字!');
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- //判断输入工厂单价是否为数字
|
|
|
- if(isNaN(Number(rowData.manualYarnUnitPrice,10)) && rowData.manualYarnUnitPrice){
|
|
|
- this.$message.error('手册纱单价必须为数字!');
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- //报关单价不超过四位小数
|
|
|
- if(!Number.isInteger(Number(rowData.customsDeclarationUnitPrice)) && rowData.customsDeclarationUnitPrice !== '' && rowData.customsDeclarationUnitPrice !== undefined){
|
|
|
- console.log(rowData.customsDeclarationUnitPrice)
|
|
|
- var position = rowData.customsDeclarationUnitPrice.toString().indexOf('.') + 1; //小数点的位置
|
|
|
- var digit = rowData.customsDeclarationUnitPrice.toString().length - position; //小数的位数
|
|
|
- if(digit > 4){
|
|
|
- this.$message.error('第'+(i+1)+'行报关单价超过四位小数!');
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // //发货数量必须是整数
|
|
|
- // if(!Number.isInteger(Number(rowData.shipmentQuantity)) && rowData.shipmentQuantity !== '' && rowData.shipmentQuantity !== undefined){
|
|
|
- // this.$message.error('第'+(i+1)+'行发货数量不为整数!');
|
|
|
- // return
|
|
|
- // }
|
|
|
- //套装件数必须为整数
|
|
|
- if(!Number.isInteger(Number(rowData.numberOfSets)) && rowData.numberOfSets !== '' && rowData.numberOfSets !== undefined){
|
|
|
- this.$message.error('第'+(i+1)+'行套装件数不为整数!');
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- //工厂单价不超过四位小数
|
|
|
- if(!Number.isInteger(Number(rowData.factoryUnitPrice)) && rowData.factoryUnitPrice !== '' && rowData.factoryUnitPrice !== undefined){
|
|
|
- var position = rowData.factoryUnitPrice.toString().indexOf('.') + 1; //小数点的位置
|
|
|
- var digit = rowData.factoryUnitPrice.toString().length - position; //小数的位数
|
|
|
- if(digit > 4){
|
|
|
- this.$message.error('第'+(i+1)+'行工厂单价超过四位小数!');
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //手册纱单价不超过四位小数
|
|
|
- if(!Number.isInteger(Number(rowData.manualYarnUnitPrice)) && rowData.manualYarnUnitPrice !== '' && rowData.manualYarnUnitPrice !== undefined){
|
|
|
- console.log(rowData.factoryUnitPrice)
|
|
|
- var position = rowData.manualYarnUnitPrice.toString().indexOf('.') + 1; //小数点的位置
|
|
|
- var digit = rowData.manualYarnUnitPrice.toString().length - position; //小数的位数
|
|
|
- if(digit > 4){
|
|
|
- this.$message.error('手册纱单价超过四位小数!');
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //必填项
|
|
|
- for (var i=0; i<newObj.syShippingDetailsItemList.length; i++){
|
|
|
- var rowData = newObj.syShippingDetailsItemList[i];
|
|
|
- if(rowData.purOrSubOrder == '' || !rowData.purOrSubOrder){
|
|
|
- this.$message.error('第'+(i+1)+'行采购委外订单号未填!');
|
|
|
- return
|
|
|
- }
|
|
|
- if(rowData.garmentFactory == '' || !rowData.garmentFactory){
|
|
|
- this.$message.error('第'+(i+1)+'行成衣工厂未填!');
|
|
|
- return
|
|
|
- }
|
|
|
- if(rowData.shipmentQuantity == '' || !rowData.shipmentQuantity || rowData.shipmentQuantity == 0){
|
|
|
- this.$message.error('第'+(i+1)+'行发货数量未填!');
|
|
|
- return
|
|
|
- }
|
|
|
- if(rowData.numberOfSets == '' || !rowData.numberOfSets || rowData.numberOfSets == 0){
|
|
|
- this.$message.error('第'+(i+1)+'行套装件数未填!');
|
|
|
- return
|
|
|
- }
|
|
|
- if(!rowData.hasOwnProperty("isTc") || rowData.isTc == ""){
|
|
|
- this.$message.error('第'+(i+1)+'行是否TC功能未选择!');
|
|
|
- return
|
|
|
- }
|
|
|
- // if((rowData.manualYarnFlag === 1 && !rowData.manualYarnUnitPrice) || (rowData.manualYarnFlag === 1 && rowData.manualYarnUnitPrice === '')|| (rowData.manualYarnFlag === 1 && rowData.manualYarnProportion === "0") || (rowData.manualYarnFlag === 1 && rowData.manualYarnProportion === 0) ){
|
|
|
- // this.$message.error('手册纱单价为必填项');
|
|
|
- // return
|
|
|
- // }else if((rowData.manualYarnFlag === 1 && !rowData.manualYarnProportion) || (rowData.manualYarnFlag === 1 && rowData.manualYarnProportion === '') || (rowData.manualYarnFlag === 1 && rowData.manualYarnProportion === "0") || (rowData.manualYarnFlag === 1 && rowData.manualYarnProportion === 0)){
|
|
|
- // this.$message.error('手册纱占比为必填项');
|
|
|
- // return
|
|
|
- // }
|
|
|
- }
|
|
|
-
|
|
|
- addShipmentList(newObj).then(res => {
|
|
|
- if (res.success) {
|
|
|
+ await this.JudgeVluabled()
|
|
|
+ if(this.judge == 0){
|
|
|
+ addShipmentList(newObj).then(res => {
|
|
|
+ if (res.success) {
|
|
|
this.$message.success('新增成功');
|
|
|
this.close();
|
|
|
// 清空信息
|
|
@@ -854,19 +735,15 @@ export default {
|
|
|
this.$message.error(res.message);
|
|
|
}
|
|
|
})
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}else{
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
- // const that = this
|
|
|
- // // 触发表单验证
|
|
|
- // this.$refs.form.validate(valid => {
|
|
|
- // if (valid) {
|
|
|
- // that.confirmLoading = true
|
|
|
- // }
|
|
|
- // })
|
|
|
+
|
|
|
+
|
|
|
},
|
|
|
// 校验复制行数量和不能超订单,根据syOrderDataItemId判断
|
|
|
|
|
@@ -910,6 +787,115 @@ export default {
|
|
|
// this.syShippingDetailsItemList.push(addrow)
|
|
|
// },
|
|
|
// --------------------------------------
|
|
|
+
|
|
|
+
|
|
|
+ JudgeVluabled(){
|
|
|
+ this.judge = 0
|
|
|
+ for (var i=0; i<this.syShippingDetailsItemList.length;i++){
|
|
|
+ var tableRow = this.syShippingDetailsItemList[i];
|
|
|
+ for (var j=i+1;j<this.syShippingDetailsItemList.length; j++){
|
|
|
+ var nextData = this.syShippingDetailsItemList[j];
|
|
|
+ if (tableRow.smallPo == nextData.smallPo && tableRow.orderNumber == nextData.orderNumber &&
|
|
|
+ tableRow.preDeliveryDate == nextData.preDeliveryDate && tableRow.preCompletionDate == nextData.preCompletionDate &&
|
|
|
+ tableRow.itemNumber == nextData.itemNumber && tableRow.inventoryCode == nextData.inventoryCode&&
|
|
|
+ tableRow.colour == nextData.colour&& tableRow.size == nextData.size){
|
|
|
+ this.$message.error('第'+(i+1)+'行和第'+(j+1)+'行数据相同,无法保存');
|
|
|
+ this.judge += 1
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (var i=0; i<this.syShippingDetailsItemList.length;i++){
|
|
|
+ var tableRow = this.syShippingDetailsItemList[i];
|
|
|
+ //是否未填
|
|
|
+ var required = [
|
|
|
+ {key:'account',value:'账套'},
|
|
|
+ {key:'orderNumber',value:'订单号'},
|
|
|
+ {key:'itemNumber',value:'款号'},
|
|
|
+ {key:'orderDate',value:'订单日期'},
|
|
|
+ {key:'preDeliveryDate',value:'预发货日期'},
|
|
|
+ {key:'preCompletionDate',value:'预完工日期'},
|
|
|
+ {key:'garmentFactory',value:'成衣工厂'},
|
|
|
+ {key:'businessTypeText',value:'业务类型'},
|
|
|
+ {key:'smallPo',value:'小po'},
|
|
|
+ {key:'packId',value:'Pack id'},
|
|
|
+ {key:'distributionPoint',value:'分销点'},
|
|
|
+ {key:'purOrSubOrder',value:'采购/委外订单'},
|
|
|
+ {key:'customsDeclarationUnitPrice',value:'报关单价'},
|
|
|
+ {key:'shipmentQuantity',value:'发货数量'},
|
|
|
+ {key:'numberOfSets',value:'套装件数'},
|
|
|
+ {key:'isTc',value:'是否TC功能'},
|
|
|
+ {key:'materialComposition',value:'物料成分'},
|
|
|
+ {key:'salesTypeText',value:'销售类型'},
|
|
|
+ {key:'customerAbbreviation',value:'客户简称'},
|
|
|
+ {key:'customerName',value:'客户名称'},
|
|
|
+ {key:'exchangeRate',value:'汇率'},
|
|
|
+ {key:'salesDepartment',value:'销售部门'},
|
|
|
+ {key:'salesman',value:'业务员'},
|
|
|
+ {key:'currencyText',value:'币种'},
|
|
|
+ ]
|
|
|
+ for(var j=0 ; j<required.length;j++){
|
|
|
+ if(tableRow[required[j].key] == null || tableRow[required[j].key] == "" || tableRow[required[j].key] == undefined){
|
|
|
+ this.$message.error('第'+(i+1)+'行'+required[j].value+'无值,无法保存');
|
|
|
+ this.judge+=1
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //是否为数字
|
|
|
+ var number = [
|
|
|
+ // {key:'customsDeclarationUnitPrice',value:'报关单价'},
|
|
|
+ {key:'shipmentQuantity',value:'发货数量'},
|
|
|
+ {key:'numberOfSets',value:'套装件数'},
|
|
|
+ // {key:'factoryUnitPrice',value:'工厂单价'},
|
|
|
+ {key:'manualYarnUnitPrice',value:'手册纱单价'},
|
|
|
+ ]
|
|
|
+ for(var j=0 ; j<number.length;j++){
|
|
|
+ if(isNaN(Number(tableRow[number[j].key],10)) && tableRow[number[j].key]){
|
|
|
+ this.$message.error('第'+(i+1)+'行发货数量必须为数字!');
|
|
|
+ this.judge += 1
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ //是否为整
|
|
|
+ var integer = [
|
|
|
+ {key:'numberOfSets',value:'套装件数'},
|
|
|
+ {key:'shipmentQuantity',value:'发货数量'},
|
|
|
+ ]
|
|
|
+ for(var v=0 ; v<integer.length;v++){
|
|
|
+ if(!Number.isInteger(Number(tableRow[integer[v].key]))){
|
|
|
+ this.$message.error('第'+(i+1)+'行'+integer[v].value+'不为整数,无法保存');
|
|
|
+ this.judge+=1
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // //判断小数位数
|
|
|
+ var Several = [
|
|
|
+ // {key:'customsDeclarationUnitPrice',value:'报关单价',dig:4},
|
|
|
+ // {key:'factoryUnitPrice',value:'工厂单价',dig:4},
|
|
|
+ {key:'manualYarnUnitPrice',value:'手册纱单价',dig:4}
|
|
|
+ ]
|
|
|
+ for(var s=0 ; s<Several.length;s++){
|
|
|
+ if(tableRow.manualYarnFlag !== 0 && tableRow.manualYarnUnitPrice){
|
|
|
+ var position = tableRow[Several[s].key].toString().indexOf('.') + 1; //小数点的位置
|
|
|
+ var digit = tableRow[Several[s].key].toString().length - position; //小数的位值
|
|
|
+ if(digit > Several[s].dig && position!==0 ){
|
|
|
+ this.$message.error('第'+(i+1)+'行'+Several[s].value+'小数超过两位,无法保存');
|
|
|
+ this.judge+=1
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
// 操作 删除
|
|
|
handleDelete(index) {
|
|
|
return this.syShippingDetailsItemList.splice(index, 1)
|