|
@@ -474,34 +474,19 @@ export const BillModalMixin = {
|
|
|
// })
|
|
|
// }
|
|
|
},
|
|
|
- //根据【仓库名】带出对应的【仓位货架】
|
|
|
+ //根据仓库名、商品条码带出对应的仓位货架、库存数量
|
|
|
async setProPosition(barCode, depotId, event){
|
|
|
const { row, column, value, target } = event
|
|
|
- const res = await getMaterialBySelect({
|
|
|
- q: barCode,
|
|
|
- page: 1,
|
|
|
- rows: 20
|
|
|
+ findStockByDepotAndBarCode({ depotId: depotId, barCode: barCode }).then(res => {
|
|
|
+ const {position,stock} = res.data
|
|
|
+ target.setValues([
|
|
|
+ {
|
|
|
+ rowKey: row.id,
|
|
|
+ values: { position,inventory: stock },
|
|
|
+ },
|
|
|
+ ])
|
|
|
+ target.$forceUpdate()
|
|
|
})
|
|
|
- let proDetail
|
|
|
- if (res && res.rows) {
|
|
|
- proDetail = res.rows[0]? res.rows[0] : {}
|
|
|
- }
|
|
|
- // 商品id
|
|
|
- if(proDetail.mid){
|
|
|
- const res2 = await getAction('/material/getPositionByDidAndMid', { mid: proDetail.mid, did: depotId })
|
|
|
- console.log('getPositionByDidAndMid======',res2)
|
|
|
- if (res2 && res2.code === 200) {
|
|
|
- const msg = res2.msg
|
|
|
- if(msg){
|
|
|
- target.setValues([
|
|
|
- {
|
|
|
- rowKey: row.id,
|
|
|
- values: { position: msg },
|
|
|
- },
|
|
|
- ])
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
},
|
|
|
//单元值改变一个字符就触发一次
|
|
|
onValueChange(event) {
|
|
@@ -511,98 +496,95 @@ export const BillModalMixin = {
|
|
|
switch (column.key) {
|
|
|
case 'depotId':
|
|
|
that.currentSelectDepotId = row.depotId
|
|
|
- if (row.barCode) {
|
|
|
- that.getStockByDepotBarCode(row, target)
|
|
|
- }
|
|
|
console.log('row========', row)
|
|
|
// // 选择商品自动带出barCode、商品ID
|
|
|
- if(row.depotId&&row.barCode){
|
|
|
+ if(row.depotId&&row.barCode&&type=='select'){
|
|
|
// // 根据仓库id自动带出仓位货架(若有)参数:商品id、仓库id
|
|
|
this.setProPosition(row.barCode, row.depotId, event)
|
|
|
}
|
|
|
break
|
|
|
- case 'batchNumber':
|
|
|
- param = {
|
|
|
- batchNumber: value,
|
|
|
- organId: this.form.getFieldValue('organId'),
|
|
|
- mpList: getMpListShort(Vue.ls.get('materialPropertyList')), //扩展属性
|
|
|
- prefixNo: this.prefixNo,
|
|
|
- }
|
|
|
- getMaterialByBatchNumber(param).then((res) => {
|
|
|
- if (res && res.code === 200) {
|
|
|
- let mList = res.data
|
|
|
+ // case 'batchNumber':
|
|
|
+ // param = {
|
|
|
+ // batchNumber: value,
|
|
|
+ // organId: this.form.getFieldValue('organId'),
|
|
|
+ // mpList: getMpListShort(Vue.ls.get('materialPropertyList')), //扩展属性
|
|
|
+ // prefixNo: this.prefixNo,
|
|
|
+ // }
|
|
|
+ // getMaterialByBatchNumber(param).then((res) => {
|
|
|
+ // if (res && res.code === 200) {
|
|
|
+ // let mList = res.data
|
|
|
|
|
|
- if (value.indexOf(',') > -1) {
|
|
|
- //多个条码
|
|
|
- this.$refs.materialDataTable.getValues((error, values) => {
|
|
|
- values.pop() //移除最后一行数据
|
|
|
- let mArr = values
|
|
|
- for (let i = 0; i < mList.length; i++) {
|
|
|
- let mInfo = mList[i]
|
|
|
- if (mInfo.unitId) {
|
|
|
- mInfo.unitList = JSON.stringify(mInfo.unitList)
|
|
|
- }
|
|
|
- this.changeColumnShow(mInfo)
|
|
|
- let mObj = this.parseInfoToObj(mInfo)
|
|
|
- mObj.depotId = mInfo.depotId
|
|
|
- mObj.stock = mInfo.stock
|
|
|
- mObj.inventory = mInfo.inventory
|
|
|
- mArr.push(mObj)
|
|
|
- }
|
|
|
- let allPriceTotal = 0
|
|
|
- let taxLastMoneyTotal = 0
|
|
|
- for (let j = 0; j < mArr.length; j++) {
|
|
|
- allPriceTotal += mArr[j].allPrice - 0
|
|
|
- taxLastMoneyTotal += mArr[j].taxLastMoney - 0
|
|
|
- //组合和拆分单据给商品类型进行重新赋值
|
|
|
- if (j === 0) {
|
|
|
- mArr[0].mType = '组合件'
|
|
|
- } else {
|
|
|
- mArr[j].mType = '普通子件'
|
|
|
- }
|
|
|
- }
|
|
|
+ // if (value.indexOf(',') > -1) {
|
|
|
+ // //多个条码
|
|
|
+ // this.$refs.materialDataTable.getValues((error, values) => {
|
|
|
+ // values.pop() //移除最后一行数据
|
|
|
+ // let mArr = values
|
|
|
+ // for (let i = 0; i < mList.length; i++) {
|
|
|
+ // let mInfo = mList[i]
|
|
|
+ // if (mInfo.unitId) {
|
|
|
+ // mInfo.unitList = JSON.stringify(mInfo.unitList)
|
|
|
+ // }
|
|
|
+ // this.changeColumnShow(mInfo)
|
|
|
+ // let mObj = this.parseInfoToObj(mInfo)
|
|
|
+ // mObj.depotId = mInfo.depotId
|
|
|
+ // mObj.stock = mInfo.stock
|
|
|
+ // mObj.inventory = mInfo.inventory
|
|
|
+ // mArr.push(mObj)
|
|
|
+ // }
|
|
|
+ // let allPriceTotal = 0
|
|
|
+ // let taxLastMoneyTotal = 0
|
|
|
+ // for (let j = 0; j < mArr.length; j++) {
|
|
|
+ // allPriceTotal += mArr[j].allPrice - 0
|
|
|
+ // taxLastMoneyTotal += mArr[j].taxLastMoney - 0
|
|
|
+ // //组合和拆分单据给商品类型进行重新赋值
|
|
|
+ // if (j === 0) {
|
|
|
+ // mArr[0].mType = '组合件'
|
|
|
+ // } else {
|
|
|
+ // mArr[j].mType = '普通子件'
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
- this.materialTable.dataSource = mArr
|
|
|
- if (this.prefixNo === 'LSCK' || this.prefixNo === 'LSTH') {
|
|
|
- target.statisticsColumns.allPrice = allPriceTotal
|
|
|
- } else {
|
|
|
- target.statisticsColumns.taxLastMoney = taxLastMoneyTotal
|
|
|
- }
|
|
|
- that.autoChangePrice(target)
|
|
|
- //强制渲染
|
|
|
- target.$forceUpdate()
|
|
|
- })
|
|
|
- } else {
|
|
|
- //单个条码
|
|
|
- let depotIdSelected = row.depotId || ''
|
|
|
- findStockByDepotAndBarCode({ depotId: depotIdSelected, barCode: row.batchNumber }).then((res) => {
|
|
|
- if (res && res.code === 200) {
|
|
|
- let mArr = []
|
|
|
- let mInfo = mList[0]
|
|
|
- if (mInfo.unitId) {
|
|
|
- mInfo.unitList = JSON.stringify(mInfo.unitList)
|
|
|
- }
|
|
|
- this.changeColumnShow(mInfo)
|
|
|
- let mInfoEx = this.parseInfoToObj(mInfo)
|
|
|
- mInfoEx.stock = res.data.stock
|
|
|
- mInfoEx.inventory = mInfo.inventory
|
|
|
- let mObj = {
|
|
|
- rowKey: row.id,
|
|
|
- values: mInfoEx,
|
|
|
- }
|
|
|
- mArr.push(mObj)
|
|
|
- target.setValues(mArr)
|
|
|
- target.recalcAllStatisticsColumns()
|
|
|
- that.autoChangePrice(target)
|
|
|
- target.autoSelectBySpecialKey('operNumber', row.orderNum)
|
|
|
- //强制渲染
|
|
|
- target.$forceUpdate()
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- break
|
|
|
+ // this.materialTable.dataSource = mArr
|
|
|
+ // if (this.prefixNo === 'LSCK' || this.prefixNo === 'LSTH') {
|
|
|
+ // target.statisticsColumns.allPrice = allPriceTotal
|
|
|
+ // } else {
|
|
|
+ // target.statisticsColumns.taxLastMoney = taxLastMoneyTotal
|
|
|
+ // }
|
|
|
+ // that.autoChangePrice(target)
|
|
|
+ // //强制渲染
|
|
|
+ // target.$forceUpdate()
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // //单个条码
|
|
|
+ // let depotIdSelected = row.depotId || ''
|
|
|
+ // // findStockByDepotAndBarCode({ depotId: depotIdSelected, barCode: row.batchNumber }).then((res) => {
|
|
|
+ // // if (res && res.code === 200) {
|
|
|
+ // // let mArr = []
|
|
|
+ // // let mInfo = mList[0]
|
|
|
+ // // if (mInfo.unitId) {
|
|
|
+ // // mInfo.unitList = JSON.stringify(mInfo.unitList)
|
|
|
+ // // }
|
|
|
+ // // this.changeColumnShow(mInfo)
|
|
|
+ // // let mInfoEx = this.parseInfoToObj(mInfo)
|
|
|
+ // // mInfoEx.stock = res.data.stock
|
|
|
+ // // mInfoEx.inventory = mInfo.inventory
|
|
|
+ // // let mObj = {
|
|
|
+ // // rowKey: row.id,
|
|
|
+ // // values: mInfoEx,
|
|
|
+ // // }
|
|
|
+ // // mArr.push(mObj)
|
|
|
+ // // target.setValues(mArr)
|
|
|
+ // // target.recalcAllStatisticsColumns()
|
|
|
+ // // that.autoChangePrice(target)
|
|
|
+ // // target.autoSelectBySpecialKey('operNumber', row.orderNum)
|
|
|
+ // // //强制渲染
|
|
|
+ // // target.$forceUpdate()
|
|
|
+ // // }
|
|
|
+ // // })
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // break
|
|
|
case 'barCode':
|
|
|
param = {
|
|
|
barCode: value,
|
|
@@ -629,8 +611,9 @@ export const BillModalMixin = {
|
|
|
mObj.depotId = mInfo.depotId
|
|
|
mObj.stock = mInfo.stock
|
|
|
mObj.inventory = mInfo.inventory
|
|
|
- mObj.allPrice = mInfo.allPrice||0
|
|
|
- mObj.taxLastMoney = mInfo.taxLastMoney||0
|
|
|
+ const unitPrice = (mObj.unitPrice||0)- 0
|
|
|
+ mObj.allPrice = (unitPrice * mObj.operNumber).toFixed(2)
|
|
|
+ // mObj.taxLastMoney = mInfo.taxLastMoney||0
|
|
|
mArr.push(mObj)
|
|
|
}
|
|
|
let allPriceTotal = 0
|
|
@@ -908,15 +891,6 @@ export const BillModalMixin = {
|
|
|
target.recalcAllStatisticsColumns()
|
|
|
this.autoChangePrice(target)
|
|
|
},
|
|
|
- //根据仓库和条码查询库存
|
|
|
- getStockByDepotBarCode(row, target) {
|
|
|
- findStockByDepotAndBarCode({ depotId: row.depotId, barCode: row.batchNumber }).then((res) => {
|
|
|
- if (res && res.code === 200) {
|
|
|
- target.setValues([{ rowKey: row.id, values: { stock: res.data.stock } }])
|
|
|
- target.recalcAllStatisticsColumns()
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
//改变优惠、本次付款、欠款的值
|
|
|
autoChangePrice(target) {
|
|
|
let allTaxLastMoney = target.statisticsColumns.taxLastMoney - 0
|