|
@@ -477,13 +477,13 @@ export const BillModalMixin = {
|
|
|
}
|
|
|
},
|
|
|
//根据【仓库名】带出对应的【仓位货架】
|
|
|
- async setProPosition(barCode, depotId){
|
|
|
+ async setProPosition(barCode, depotId, event){
|
|
|
+ const { row, column, value, target } = event
|
|
|
const res = await getMaterialBySelect({
|
|
|
q: barCode,
|
|
|
page: 1,
|
|
|
rows: 20
|
|
|
})
|
|
|
- debugger
|
|
|
let proDetail
|
|
|
if (res && res.rows) {
|
|
|
proDetail = res.rows[0]? res.rows[0] : {}
|
|
@@ -493,6 +493,15 @@ export const BillModalMixin = {
|
|
|
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 },
|
|
|
+ },
|
|
|
+ ])
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
},
|
|
@@ -515,7 +524,7 @@ export const BillModalMixin = {
|
|
|
// getAction('/material/getPositionByDidAndMid',{mid:row.mid,did:row.depotId}).then((res) => {
|
|
|
// console.log('res========', res)
|
|
|
// })
|
|
|
- this.setProPosition(row.barCode, row.depotId)
|
|
|
+ this.setProPosition(row.barCode, row.depotId, event)
|
|
|
}
|
|
|
break
|
|
|
case 'batchNumber':
|
|
@@ -610,77 +619,45 @@ export const BillModalMixin = {
|
|
|
getMaterialByBarCode(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
|
|
|
- console.log('values========', 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.mid = mInfo.id
|
|
|
- mObj.inventory = mInfo.inventory
|
|
|
- mArr.push(mObj)
|
|
|
+ target.getValues((error, values) => {
|
|
|
+ const clickRowIndex = values.findIndex((item) => item.id === row.id) //获取当前行的索引
|
|
|
+ // values.pop() //移除最后一行数据
|
|
|
+ values.splice(clickRowIndex, 1) //移除当前行数据
|
|
|
+ let mArr = values // 新加的行
|
|
|
+ for (let i = 0; i < mList.length; i++) {
|
|
|
+ let mInfo = mList[i]
|
|
|
+ if (mInfo.unitId) {
|
|
|
+ mInfo.unitList = JSON.stringify(mInfo.unitList)
|
|
|
}
|
|
|
- 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
|
|
|
+ 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 {
|
|
|
- target.statisticsColumns.taxLastMoney = taxLastMoneyTotal
|
|
|
- }
|
|
|
- that.autoChangePrice(target)
|
|
|
- //强制渲染
|
|
|
- target.$forceUpdate()
|
|
|
- })
|
|
|
- } else {
|
|
|
- //单个条码
|
|
|
- let depotIdSelected = row.depotId || ''
|
|
|
- findStockByDepotAndBarCode({ depotId: depotIdSelected, barCode: row.barCode }).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()
|
|
|
+ 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()
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
break
|