|
|
@ -6,7 +6,7 @@ |
|
|
|
<!-- start 添加修改按钮 --> |
|
|
|
<div> |
|
|
|
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate">保存</el-button> |
|
|
|
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveOrUpdate">确认</el-button> |
|
|
|
<el-button type="primary" size="small" :disabled="submitdisabled" @click="submit">确认</el-button> |
|
|
|
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button> |
|
|
|
</div> |
|
|
|
<!-- end 添加修改按钮 --> |
|
|
@ -197,14 +197,14 @@ |
|
|
|
<el-input ref="focusAssumptionInput" v-model="scope.row.packageRemark" clearable placeholder="" /> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="入库价" align="center" width="100"> |
|
|
|
<el-table-column label="入库价" align="center" width="150"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-input ref="focusAssumptionInput" @input="commodityComputeYHAndXSJE3(scope.row,$event)" |
|
|
|
v-model="scope.row.cost" clearable placeholder="" |
|
|
|
oninput="value=value.replace(/[^\d.]/g, '').replace(/\.{2,}/g, '.').replace('.', '$#$').replace(/\./g, '').replace('$#$', '.').replace(/^(\-)*(\d+)\.(\d\d).*$/, '$1$2.$3').replace(/^\./g, '')" /> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="税额" align="center" width="100"> |
|
|
|
<el-table-column label="税额" align="center" width="150"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-input ref="focusAssumptionInput" @input="commodityComputeYHAndXSJE4(scope.row,$event)" |
|
|
|
v-model="scope.row.taxAmount" clearable placeholder="" |
|
|
@ -212,8 +212,8 @@ |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="含税单价" prop="taxPrice" @input="commodityComputeYHAndXSJE5(scope.row,$event)" |
|
|
|
align="center" width="100" /> |
|
|
|
<el-table-column label="入库金额" prop="amount" align="center" width="100" /> |
|
|
|
align="center" width="150" /> |
|
|
|
<el-table-column label="入库金额" prop="amount" align="center" width="150" /> |
|
|
|
</el-table> |
|
|
|
|
|
|
|
|
|
|
@ -261,17 +261,14 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import req from '@/api/storage/receivingGoods.js' |
|
|
|
import req2 from '@/api/storage/allocation.js' |
|
|
|
import req from '@/api/receivingGoods/receivingGoods.js' |
|
|
|
import req2 from '@/api/warehouse/allocation/allocation.js' |
|
|
|
export default { |
|
|
|
components: {}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
title: "【新增】", |
|
|
|
listLoading: false, |
|
|
|
submitdisabled: false, |
|
|
|
tableKey: 0, |
|
|
|
index: 0, |
|
|
|
formobj: { |
|
|
|
"sid": "", |
|
|
|
"billNo": "", |
|
|
@ -323,36 +320,6 @@ |
|
|
|
} |
|
|
|
}, |
|
|
|
created() {}, |
|
|
|
computed: { |
|
|
|
// 调拨数量 |
|
|
|
totalQuantity() { |
|
|
|
let quantity = 0 |
|
|
|
if (this.formobj.list.length > 0) { |
|
|
|
this.formobj.list.forEach((e) => { |
|
|
|
quantity += Number(e.count) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
this.formobj.count = quantity |
|
|
|
|
|
|
|
return quantity |
|
|
|
}, |
|
|
|
// 调拨金额 |
|
|
|
materialCost() { |
|
|
|
let material = 0 |
|
|
|
if (this.formobj.list.length > 0) { |
|
|
|
this.formobj.list.forEach((e) => { |
|
|
|
material += Number((Number(e.count) * Number(e.taxPrice))) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
this.formobj.amount = material.toFixed(2) |
|
|
|
|
|
|
|
return material.toFixed(2) |
|
|
|
}, |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
|
|
|
|
commodityInput(value) { |
|
|
@ -374,10 +341,11 @@ |
|
|
|
this.formobj.list.splice(index, 1) |
|
|
|
}, |
|
|
|
commodityCurrentChange(value, row) { |
|
|
|
row.goodsSpuSid = value.goodsSpuSid |
|
|
|
row.goodsSpuName = value.goodsSpuName |
|
|
|
console.log("commodityCurrentChange》》》》", value) |
|
|
|
console.log("commodityCurrentChange》》》》", row) |
|
|
|
row.goodsSkuSid = value.goodsSkuSid |
|
|
|
row.goodsSkuTitle = value.goodsSkuTitle |
|
|
|
row.goodsSkuTitle = value.goodsSpuName |
|
|
|
row.goodsSpuName = value.goodsSpuName |
|
|
|
row.goodsSkuCode = value.goodsSkuCode |
|
|
|
row.goodsSkuOwnSpec = value.goodsSkuOwnSpec |
|
|
|
row.unit = value.unit |
|
|
@ -385,12 +353,17 @@ |
|
|
|
row.warehouseName = value.warehouseName |
|
|
|
row.warehouseRackSid = value.warehouseRackSid |
|
|
|
row.warehouseRackName = value.warehouseRackName |
|
|
|
row.actualInCount = 0 |
|
|
|
row.rejectCount = 0 |
|
|
|
row.rejectReason = '' |
|
|
|
row.isQuality = 0 |
|
|
|
row.qualityState = 0 |
|
|
|
row.packageRemark = '' |
|
|
|
row.cost = value.cost |
|
|
|
row.taxAmount = value.taxAmount |
|
|
|
row.taxPrice = value.taxPrice |
|
|
|
row.amount = value.amount |
|
|
|
row.shelfLife = value.shelfLife |
|
|
|
document.body.click() |
|
|
|
}, |
|
|
|
|
|
|
@ -423,19 +396,20 @@ |
|
|
|
"warehouseName": "", |
|
|
|
"warehouseRackSid": "", |
|
|
|
"warehouseRackName": "", |
|
|
|
"actualInCount": "", |
|
|
|
"rejectCount": "", |
|
|
|
"actualInCount": 0, |
|
|
|
"rejectCount": 0, |
|
|
|
"rejectReason": "", |
|
|
|
"isQuality": 0, |
|
|
|
"qualityState": 0, |
|
|
|
"packageRemark": "", |
|
|
|
"state": 0, |
|
|
|
"xh": "", |
|
|
|
"orderCount": "", |
|
|
|
"cost": "", |
|
|
|
"taxAmount": "", |
|
|
|
"taxPrice": "", |
|
|
|
"amount": "" |
|
|
|
"orderCount": 0, |
|
|
|
"cost": 0, |
|
|
|
"taxAmount": 0, |
|
|
|
"taxPrice": 0, |
|
|
|
"amount": 0, |
|
|
|
'shelfLife': 0 |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
@ -452,7 +426,7 @@ |
|
|
|
this.formobj.list.splice(index, 1) |
|
|
|
|
|
|
|
for (var i = this.formobj.pcList.length - 1; i >= 0; i--) { |
|
|
|
if (this.formobj.pcList[i].number === (index + 1)) { |
|
|
|
if (this.formobj.pcList[i].xh === (index + 1)) { |
|
|
|
this.formobj.pcList.splice(i, 1); |
|
|
|
} |
|
|
|
} |
|
|
@ -466,25 +440,302 @@ |
|
|
|
saveOrUpdate() { |
|
|
|
console.log('>>>>>>>>>saveOrUpdate', this.formobj) |
|
|
|
|
|
|
|
// this.submitdisabled = true |
|
|
|
// req.save(this.formobj) |
|
|
|
// .then(resp => { |
|
|
|
// if (resp.success) { |
|
|
|
// this.submitdisabled = false |
|
|
|
// this.$message({ |
|
|
|
// showClose: true, |
|
|
|
// type: 'success', |
|
|
|
// message: resp.msg |
|
|
|
// }) |
|
|
|
// this.handleReturn('true') |
|
|
|
// } else { |
|
|
|
// this.submitdisabled = false |
|
|
|
// // 根据resp.code进行异常情况处理 |
|
|
|
// } |
|
|
|
|
|
|
|
// if (this.formobj.createByName == '') { |
|
|
|
// this.$message({ |
|
|
|
// showClose: true, |
|
|
|
// type: 'error', |
|
|
|
// message: '制单人姓名不能为空' |
|
|
|
// }) |
|
|
|
// .catch(() => { |
|
|
|
// this.submitdisabled = false |
|
|
|
|
|
|
|
// return |
|
|
|
// } |
|
|
|
|
|
|
|
// if (this.formobj.createTime == '') { |
|
|
|
// this.$message({ |
|
|
|
// showClose: true, |
|
|
|
// type: 'error', |
|
|
|
// message: '单据日期不能为空' |
|
|
|
// }) |
|
|
|
|
|
|
|
// return |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
// if (this.formobj.busTypeKey == '' || this.formobj.busTypeValue == '') { |
|
|
|
// this.$message({ |
|
|
|
// showClose: true, |
|
|
|
// type: 'error', |
|
|
|
// message: '业务类型不能为空' |
|
|
|
// }) |
|
|
|
|
|
|
|
// return |
|
|
|
// } |
|
|
|
|
|
|
|
// if (this.formobj.supplierSid == '' || this.formobj.supplierName == '') { |
|
|
|
// this.$message({ |
|
|
|
// showClose: true, |
|
|
|
// type: 'error', |
|
|
|
// message: '供应商不能为空' |
|
|
|
// }) |
|
|
|
|
|
|
|
// return |
|
|
|
// } |
|
|
|
|
|
|
|
// if (this.formobj.deliveryDate == '') { |
|
|
|
// this.$message({ |
|
|
|
// showClose: true, |
|
|
|
// type: 'error', |
|
|
|
// message: '到货日期不能为空' |
|
|
|
// }) |
|
|
|
|
|
|
|
// return |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
// for (var i = 0; i < this.formobj.pcList.length; i++) { |
|
|
|
// var item = this.formobj.pcList[i] |
|
|
|
|
|
|
|
// if (item.manufactureDate == '') { |
|
|
|
// this.$message({ |
|
|
|
// showClose: true, |
|
|
|
// type: 'error', |
|
|
|
// message: '生产日期不能为空' |
|
|
|
// }) |
|
|
|
|
|
|
|
// return |
|
|
|
// } |
|
|
|
|
|
|
|
// if (Number(item.batchCount) == 0) { |
|
|
|
// this.$message({ |
|
|
|
// showClose: true, |
|
|
|
// type: 'error', |
|
|
|
// message: '商品批次数量不能为0' |
|
|
|
// }) |
|
|
|
|
|
|
|
// return |
|
|
|
// } |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
// for (var i = 0; i < this.formobj.list.length; i++) { |
|
|
|
// var index = i |
|
|
|
// var num = 0 |
|
|
|
// const choose = this.formobj.pcList.filter((item) => Number(item.xh) == (index + 1)) |
|
|
|
// for (var j = 0; j < choose.length; j++) { |
|
|
|
|
|
|
|
// num += Number(choose[j].batchCount) |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
// console.log('>>>>>>>>>saveOrUpdate', num) |
|
|
|
|
|
|
|
// if (num > Number(this.formobj.list[i].actualInCount)) { |
|
|
|
// this.$message({ |
|
|
|
// showClose: true, |
|
|
|
// type: 'error', |
|
|
|
// message: '商品批次数量不能大于商品实收数量' |
|
|
|
// }) |
|
|
|
|
|
|
|
// return |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
this.$refs['form_obj'].validate((valid) => { |
|
|
|
if (valid) { |
|
|
|
this.submitdisabled = true |
|
|
|
req.save(this.formobj).then((res) => { |
|
|
|
if (res.success) { |
|
|
|
this.$message({ |
|
|
|
showClose: true, |
|
|
|
type: 'success', |
|
|
|
message: '保存成功' |
|
|
|
}) |
|
|
|
this.handleReturn('true') |
|
|
|
} else { |
|
|
|
this.submitdisabled = false |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
this.submitdisabled = false |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
submit() { |
|
|
|
|
|
|
|
if (this.formobj.createByName == '') { |
|
|
|
this.$message({ |
|
|
|
showClose: true, |
|
|
|
type: 'error', |
|
|
|
message: '制单人姓名不能为空' |
|
|
|
}) |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if (this.formobj.createTime == '') { |
|
|
|
this.$message({ |
|
|
|
showClose: true, |
|
|
|
type: 'error', |
|
|
|
message: '单据日期不能为空' |
|
|
|
}) |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.formobj.busTypeKey == '' || this.formobj.busTypeValue == '') { |
|
|
|
this.$message({ |
|
|
|
showClose: true, |
|
|
|
type: 'error', |
|
|
|
message: '业务类型不能为空' |
|
|
|
}) |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if (this.formobj.supplierSid == '' || this.formobj.supplierName == '') { |
|
|
|
this.$message({ |
|
|
|
showClose: true, |
|
|
|
type: 'error', |
|
|
|
message: '供应商不能为空' |
|
|
|
}) |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if (this.formobj.deliveryDate == '') { |
|
|
|
this.$message({ |
|
|
|
showClose: true, |
|
|
|
type: 'error', |
|
|
|
message: '到货日期不能为空' |
|
|
|
}) |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if (this.formobj.list.length == 0) { |
|
|
|
this.$message({ |
|
|
|
showClose: true, |
|
|
|
type: 'error', |
|
|
|
message: '请添加商品' |
|
|
|
}) |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
for (var i = 0; i < this.formobj.list.length; i++) { |
|
|
|
var item = this.formobj.list[i] |
|
|
|
if (item.goodsSkuSid == '') { |
|
|
|
this.$message({ |
|
|
|
showClose: true, |
|
|
|
type: 'error', |
|
|
|
message: '请添加商品' |
|
|
|
}) |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if (item.actualInCount == 0) { |
|
|
|
this.$message({ |
|
|
|
showClose: true, |
|
|
|
type: 'error', |
|
|
|
message: '请添加商品实收数量' |
|
|
|
}) |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if (this.isUpdata) { |
|
|
|
if (item.actualInCount + item.rejectCount > item.orderCount) { |
|
|
|
this.$message({ |
|
|
|
showClose: true, |
|
|
|
type: 'error', |
|
|
|
message: '商品实收数量或拒收数量错误' |
|
|
|
}) |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < this.formobj.pcList.length; i++) { |
|
|
|
var item = this.formobj.pcList[i] |
|
|
|
|
|
|
|
if (item.manufactureDate == '') { |
|
|
|
this.$message({ |
|
|
|
showClose: true, |
|
|
|
type: 'error', |
|
|
|
message: '生产日期不能为空' |
|
|
|
}) |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
if (Number(item.batchCount) == 0) { |
|
|
|
this.$message({ |
|
|
|
showClose: true, |
|
|
|
type: 'error', |
|
|
|
message: '商品批次数量不能为0' |
|
|
|
}) |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < this.formobj.list.length; i++) { |
|
|
|
var index = i |
|
|
|
var num = 0 |
|
|
|
const choose = this.formobj.pcList.filter((item) => Number(item.xh) == (index + 1)) |
|
|
|
for (var j = 0; j < choose.length; j++) { |
|
|
|
|
|
|
|
num += Number(choose[j].batchCount) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
console.log('>>>>>>>>>saveOrUpdate', num) |
|
|
|
|
|
|
|
if (num > Number(this.formobj.list[i].actualInCount)) { |
|
|
|
this.$message({ |
|
|
|
showClose: true, |
|
|
|
type: 'error', |
|
|
|
message: '商品批次数量不能大于商品实收数量' |
|
|
|
}) |
|
|
|
|
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.$refs['form_obj'].validate((valid) => { |
|
|
|
if (valid) { |
|
|
|
this.submitdisabled = true |
|
|
|
req.submit(this.formobj).then((res) => { |
|
|
|
if (res.success) { |
|
|
|
this.$message({ |
|
|
|
showClose: true, |
|
|
|
type: 'success', |
|
|
|
message: '保存成功' |
|
|
|
}) |
|
|
|
this.handleReturn('true') |
|
|
|
} else { |
|
|
|
this.submitdisabled = false |
|
|
|
} |
|
|
|
}).catch(() => { |
|
|
|
this.submitdisabled = false |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
handleReturn(isreload) { |
|
|
|
if (isreload === 'true') this.$emit('reloadlist') |
|
|
@ -508,29 +759,19 @@ |
|
|
|
"list": [], |
|
|
|
"pcList": [] |
|
|
|
} |
|
|
|
this.submitdisabled = false |
|
|
|
this.isUpdata = false |
|
|
|
this.$emit('doback') |
|
|
|
}, |
|
|
|
|
|
|
|
showAdd() { |
|
|
|
this.isUpdata = false |
|
|
|
this.title = "【新增】" |
|
|
|
this.getWarehouseList() |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs.dataTable.doLayout() |
|
|
|
}) |
|
|
|
|
|
|
|
console.log("showAdd", this.isUpdata); |
|
|
|
this.getsupplierLust() |
|
|
|
}, |
|
|
|
showEdit(row) { |
|
|
|
this.isUpdata = true |
|
|
|
this.title = "【编辑】" |
|
|
|
this.$nextTick(() => { |
|
|
|
this.$refs.dataTable.doLayout() |
|
|
|
}) |
|
|
|
|
|
|
|
this.getWarehouseList() |
|
|
|
|
|
|
|
this.getsupplierLust() |
|
|
|
console.log("showEdit", this.isUpdata); |
|
|
|
var params = { |
|
|
|
sid: row.sid |
|
|
@ -549,16 +790,32 @@ |
|
|
|
busTypeSelect(val) { |
|
|
|
const choose = this.busTypeList.filter((item) => item.sid == val) |
|
|
|
console.log('>>>>>>>>>busTypeSelect', choose) |
|
|
|
this.busTypeKey = choose[0].sid |
|
|
|
this.busTypeValue = choose[0].name |
|
|
|
this.formobj.busTypeKey = choose[0].sid |
|
|
|
this.formobj.busTypeValue = choose[0].name |
|
|
|
|
|
|
|
}, |
|
|
|
supplierNameSelect(row, val) { |
|
|
|
supplierNameSelect(val) { |
|
|
|
|
|
|
|
console.log("supplierNameSelect", val); |
|
|
|
const choose = this.supplierList.filter((item) => item.sid == val) |
|
|
|
console.log('>>>>>>>>>supplierNameSelect', choose) |
|
|
|
this.supplierSid = choose[0].areaCode |
|
|
|
this.supplierName = choose[0].sid |
|
|
|
this.formobj.supplierName = choose[0].supplierName |
|
|
|
this.formobj.supplierSid = choose[0].sid |
|
|
|
|
|
|
|
}, |
|
|
|
getsupplierLust() { |
|
|
|
var params = { |
|
|
|
createOrgSid: "" |
|
|
|
} |
|
|
|
req.choiceSupplier(params).then((res) => { |
|
|
|
if (res.success) { |
|
|
|
this.supplierList = res.data |
|
|
|
|
|
|
|
console.log("aaaaaa", this.supplierList); |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
getWarehouseList() { |
|
|
|
req2.getWarehouses().then((res) => { |
|
|
|
if (res.success) { |
|
|
@ -591,7 +848,7 @@ |
|
|
|
row.warehouseSid = choose[0].sid |
|
|
|
|
|
|
|
}, |
|
|
|
selectWarehouseAreaCode(row, val) { |
|
|
|
selectWarehouseAreaCode(val) { |
|
|
|
console.log("selectWarehouseAreaCode", val); |
|
|
|
|
|
|
|
const choose = this.warehouseRackList.filter((item) => item.sid == val) |
|
|
@ -669,6 +926,7 @@ |
|
|
|
manufactureDateChange(row, val) { |
|
|
|
|
|
|
|
console.log("manufactureDateChange》》》》", val) |
|
|
|
console.log("manufactureDateChange》》》》", row) |
|
|
|
|
|
|
|
row.manufactureDate = val |
|
|
|
row.expirationDate = this.addDate(val, row.shelfLife) |
|
|
@ -732,21 +990,25 @@ |
|
|
|
console.log("aaa", row); |
|
|
|
console.log("aaa", val); |
|
|
|
|
|
|
|
if (Number(row.actualInCount) > Number(row.orderCount)) { |
|
|
|
row.actualInCount = row.orderCount |
|
|
|
if (this.isUpdata) { |
|
|
|
if (Number(row.actualInCount) > Number(row.orderCount)) { |
|
|
|
row.actualInCount = row.orderCount |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
row.amount = (Number(row.actualInCount) * Number(row.taxPrice)).toFixed(2) |
|
|
|
}, |
|
|
|
|
|
|
|
commodityComputeYHAndXSJE2(row, val) { |
|
|
|
console.log("aaa", row); |
|
|
|
console.log("aaa", val); |
|
|
|
|
|
|
|
if ((Number(row.rejectCount) + Number(row.actualInCount)) > Number(row.orderCount)) { |
|
|
|
row.rejectCount = Number(row.orderCount) - Number(row.actualInCount) |
|
|
|
if (this.isUpdata) { |
|
|
|
if ((Number(row.rejectCount) + Number(row.actualInCount)) > Number(row.orderCount)) { |
|
|
|
row.rejectCount = Number(row.orderCount) - Number(row.actualInCount) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
commodityComputeYHAndXSJE3(row, val) { |
|
|
|