Browse Source

入库

master
tianyi@bogon 3 years ago
parent
commit
dc0cf67caf
  1. 75
      pages/inventory/addinventory.vue

75
pages/inventory/addinventory.vue

@ -147,7 +147,9 @@
productId: this.carList1[i].id,
productName: this.carList1[i].productName,
productPicture: this.carList1[i].productPicture,
stockLogList: new Map()
productSn:this.carList1[i].productSn,
stockLogList: new Map(),
stockLogList1:[]
}
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].name,this.carList1[i].saleDetailQueryDTO[m].productCount)
@ -156,7 +158,8 @@
this.carList.set(this.carList1[i].id, obj)
console.log(this.carList)
// this.lsList.set(this.carList1[i].id, obj)
}
}
this.carList1 = []
} else { //当前页有数据
for (let i = 0; i < this.carList1.length; i++) {
if(this.carList.has(this.carList1[i].id) == true){ //商品相同
@ -176,7 +179,8 @@
productId: this.carList1[i].id,
productName: this.carList1[i].productName,
productPicture: this.carList1[i].productPicture,
stockLogList: new Map()
stockLogList: new Map(),
stockLogList1:[]
}
for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
obj.stockLogList.set(this.carList1[i].saleDetailQueryDTO[m].name,this.carList1[i].saleDetailQueryDTO[m].productCount)
@ -184,54 +188,8 @@
this.carList.set(this.carList1[i].id,obj)
}
}
// for (let i = 0; i < this.carList1.length; i++) {
// for (let m = 0; m < this.carList1[i].saleDetailQueryDTO.length; m++) {
// if(this.carList.has(this.carList1[i].id) ==true){ //商品相同
// this.lsList.get(this.carList1[i].id).forEach(function(value, key) {
// if(value.name == that.carList1[i].saleDetailQueryDTO[m].name){ //规格相同,数量相加
// value.productCount = value.productCount + that.carList1[i].saleDetailQueryDTO[m].productCount
// }else{ //规格不同,直接set
// console.log("规格不同")
// that.lsList.set(that.carList1[i].id,that.carList1[i].saleDetailQueryDTO)
// }
// })
// }else{ //商品不同
// this.carList.set(this.carList1[i].id,this.carList1[i])
// }
// }
// }
// if (that.carList.has(that.carList1[i].id) == true) {
// console.log("商品相同")
// that.lsList.forEach(function(value, key) {
// for (let m = 0; m <= that.carList1[i].saleDetailQueryDTO.length; m++) {
// if (value.name == that.carList1[i].saleDetailQueryDTO[m].name) {
// console.log("规格相同")
// that.lsList.get(that.carList1[i].id)[key].productCount = that.lsList.get(that
// .carList1[i].id)[key].productCount + value.productCount
// } else {
// console.log('key', key)
// console.log("规格不同")
// console.log(that.carList1[i].saleDetailQueryDTO[m])
// if (key + 1 == that.lsList.size) {
// that.lsList.set(that.carList1[i].id, that.carList1[i].saleDetailQueryDTO[
// m])
// }
// }
// }
// })
// } else { //商品id不同
// console.log("商品不同")
// this.carList.set(this.carList1[i].id, this.carList1[i])
// this.lsList.set(this.carList1[i].id, this.carList1[i].saleDetailQueryDTO)
// }
}
this.carList1 = []
}
console.log('carList1', this.carList1)
@ -311,9 +269,20 @@
// purchaseDetails.push(obj)
// }
let purchaseDetails = [];
this.carList.forEach(function(value,key){
this.carList.forEach(function(value, key){
console.log(value.stockLogList)
value.stockLogList.forEach(function(values, keys){
let obj={
productSpecs:values,
changeStock:keys
}
value.stockLogList1.push(obj)
})
console.log(value)
purchaseDetails.push(value)
})
})
console.log(purchaseDetails)
this.tui.request("/app/stock/putInOfProduct", "post", {
purchase: purchase,
purchaseDetails: purchaseDetails

Loading…
Cancel
Save