|
@@ -1851,6 +1851,22 @@
|
|
|
this.$message.warning('未获取到物品类型!');
|
|
this.$message.warning('未获取到物品类型!');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ const mergedList = [];
|
|
|
|
|
+ this.detailList.forEach((item) => {
|
|
|
|
|
+ const key = `${item.productCode}_${item.batchNo}_${item.colorKey}_${item.warehouseId}_${item.modelType}`;
|
|
|
|
|
+ const existIndex = mergedList.findIndex(
|
|
|
|
|
+ (m) => `${m.productCode}_${m.batchNo}_${m.colorKey}_${m.warehouseId}_${m.modelType}` === key
|
|
|
|
|
+ );
|
|
|
|
|
+ if (existIndex > -1) {
|
|
|
|
|
+ mergedList[existIndex].quantity += item.quantity;
|
|
|
|
|
+ mergedList[existIndex].packingWeight += item.packingWeight;
|
|
|
|
|
+ mergedList[existIndex].packingQuantity += item.packingQuantity;
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+ mergedList.push({ ...item });
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
// 包装列表 this.detailList
|
|
// 包装列表 this.detailList
|
|
|
// 获取主数据物品详情
|
|
// 获取主数据物品详情
|
|
|
// let { category } = await getDetails(this.form.categoryId);
|
|
// let { category } = await getDetails(this.form.categoryId);
|
|
@@ -1859,8 +1875,7 @@
|
|
|
});
|
|
});
|
|
|
storageApi
|
|
storageApi
|
|
|
.getListByNameOrModeType({
|
|
.getListByNameOrModeType({
|
|
|
- codeList,
|
|
|
|
|
- queryConditions: this.detailList
|
|
|
|
|
|
|
+ codeList
|
|
|
})
|
|
})
|
|
|
.then(async (res) => {
|
|
.then(async (res) => {
|
|
|
console.log(res, 'detailList-res');
|
|
console.log(res, 'detailList-res');
|
|
@@ -1878,11 +1893,20 @@
|
|
|
await storageApi.getCategoryPackageDisposition({
|
|
await storageApi.getCategoryPackageDisposition({
|
|
|
categoryIds: res.map((item) => item.id)
|
|
categoryIds: res.map((item) => item.id)
|
|
|
});
|
|
});
|
|
|
- this.packingSpecificationOption = res.map((item) => {
|
|
|
|
|
- return packingSpecification
|
|
|
|
|
- .filter((ite) => item.id == ite.categoryId)
|
|
|
|
|
- .sort((a, b) => a.sort - b.sort);
|
|
|
|
|
|
|
+ let packingSpecificationOption = res.map((item) => {
|
|
|
|
|
+ return {
|
|
|
|
|
+ id: item.id,
|
|
|
|
|
+ packingSpecification: packingSpecification
|
|
|
|
|
+ .filter((ite) => item.id == ite.categoryId)
|
|
|
|
|
+ .sort((a, b) => a.sort - b.sort)
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
|
|
+ console.log(packingSpecificationOption,'packingSpecificationOption')
|
|
|
|
|
+ // this.packingSpecificationOption = res.map((item) => {
|
|
|
|
|
+ // return packingSpecification
|
|
|
|
|
+ // .filter((ite) => item.id == ite.categoryId)
|
|
|
|
|
+ // .sort((a, b) => a.sort - b.sort);
|
|
|
|
|
+ // });
|
|
|
// 获取相同仓库
|
|
// 获取相同仓库
|
|
|
let warehouseIds = [];
|
|
let warehouseIds = [];
|
|
|
let warehouseNames = [];
|
|
let warehouseNames = [];
|
|
@@ -1907,22 +1931,41 @@
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- const newSpecificationOption = this.getNewSpecificationOption(
|
|
|
|
|
- this.packingSpecificationOption
|
|
|
|
|
- );
|
|
|
|
|
|
|
+ // const newSpecificationOption = this.getNewSpecificationOption(
|
|
|
|
|
+ // this.packingSpecificationOption
|
|
|
|
|
+ // );
|
|
|
|
|
|
|
|
// 生成产品列表
|
|
// 生成产品列表
|
|
|
- this.productList = res.map((item, index) => {
|
|
|
|
|
|
|
+ this.productList = mergedList.map((filtersItem, index) => {
|
|
|
|
|
+ let item = res.find(
|
|
|
|
|
+ (detailItem) =>
|
|
|
|
|
+ detailItem.code == filtersItem.productCode ||
|
|
|
|
|
+ detailItem.code == filtersItem.categoryCode
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
// 显示规格
|
|
// 显示规格
|
|
|
- let packingSpecificationLabel = this.packingSpecificationOption[
|
|
|
|
|
- index
|
|
|
|
|
- ]
|
|
|
|
|
- .map((item) => {
|
|
|
|
|
- if (item.sort > 0) {
|
|
|
|
|
- return `${item.packageCell}${item.packageUnit}/${item.conversionUnit}`;
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- .filter((item) => !!item);
|
|
|
|
|
|
|
+ // let packingSpecificationLabel = this.packingSpecificationOption[
|
|
|
|
|
+ // index
|
|
|
|
|
+ // ]
|
|
|
|
|
+ // .map((item) => {
|
|
|
|
|
+ // if (item.sort > 0) {
|
|
|
|
|
+ // return `${item.packageCell}${item.packageUnit}/${item.conversionUnit}`;
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })
|
|
|
|
|
+ // .filter((item) => !!item);
|
|
|
|
|
+ const packingSpecificationItem = packingSpecificationOption.find(packingSpecificationItem=>packingSpecificationItem.id==filtersItem.productId)?.packingSpecification
|
|
|
|
|
+
|
|
|
|
|
+ // 显示规格
|
|
|
|
|
+ let packingSpecificationLabel = packingSpecificationItem
|
|
|
|
|
+ .map((item) => {
|
|
|
|
|
+ if (item.sort > 0) {
|
|
|
|
|
+ return `${item.packageCell}${item.packageUnit}/${item.conversionUnit}`;
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ .filter((item) => !!item);
|
|
|
|
|
+
|
|
|
|
|
+ const newSpecificationOption = packingSpecificationItem;
|
|
|
|
|
+
|
|
|
// 换算重量
|
|
// 换算重量
|
|
|
let weight = 0;
|
|
let weight = 0;
|
|
|
if (
|
|
if (
|
|
@@ -1931,7 +1974,7 @@
|
|
|
) {
|
|
) {
|
|
|
weight = this.form.totalWeight;
|
|
weight = this.form.totalWeight;
|
|
|
} else {
|
|
} else {
|
|
|
- switch (item.weightUnit.toUpperCase()) {
|
|
|
|
|
|
|
+ switch (filtersItem.weightUnit.toUpperCase()) {
|
|
|
case 'KG':
|
|
case 'KG':
|
|
|
if (this.form.totalWeight > -1) {
|
|
if (this.form.totalWeight > -1) {
|
|
|
weight = this.$math.format(
|
|
weight = this.$math.format(
|
|
@@ -1994,8 +2037,8 @@
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- let packingUnit = item.packingUnit;
|
|
|
|
|
- let singleWeight = item.singleWeight || 0; // 单重重量
|
|
|
|
|
|
|
+ let packingUnit = filtersItem.packingUnit;
|
|
|
|
|
+ let singleWeight = filtersItem.singleWeight || 0; // 单重重量
|
|
|
|
|
|
|
|
return {
|
|
return {
|
|
|
index: this.productList.length + index,
|
|
index: this.productList.length + index,
|
|
@@ -2011,72 +2054,67 @@
|
|
|
? this.form.colorKey
|
|
? this.form.colorKey
|
|
|
? this.form.colorKey
|
|
? this.form.colorKey
|
|
|
: ''
|
|
: ''
|
|
|
- : item.colorKey
|
|
|
|
|
- ? item.colorKey
|
|
|
|
|
|
|
+ : filtersItem.colorKey
|
|
|
|
|
+ ? filtersItem.colorKey
|
|
|
: '', // 颜色
|
|
: '', // 颜色
|
|
|
modelKey:
|
|
modelKey:
|
|
|
this.bizType == 1
|
|
this.bizType == 1
|
|
|
? this.form.modelKey
|
|
? this.form.modelKey
|
|
|
? this.form.modelKey
|
|
? this.form.modelKey
|
|
|
: ''
|
|
: ''
|
|
|
- : item.modelKey
|
|
|
|
|
- ? item.modelKey
|
|
|
|
|
|
|
+ : filtersItem.modelKey
|
|
|
|
|
+ ? filtersItem.modelKey
|
|
|
: '', // 机型
|
|
: '', // 机型
|
|
|
batchNo: [1, 3, 6].includes(this.bizType)
|
|
batchNo: [1, 3, 6].includes(this.bizType)
|
|
|
? this.detailList[0]?.batchNo || batchNo
|
|
? this.detailList[0]?.batchNo || batchNo
|
|
|
: batchNo, // 批次号
|
|
: batchNo, // 批次号
|
|
|
supplierListOptions: supplierList[item.id], // 供应商列表
|
|
supplierListOptions: supplierList[item.id], // 供应商列表
|
|
|
supplierId:
|
|
supplierId:
|
|
|
- this.detailList.find((val) => val.categoryCode == item.code)
|
|
|
|
|
- ?.supplierId || item.supplierId, // 供应商id
|
|
|
|
|
|
|
+ filtersItem?.supplierId || item.supplierId, // 供应商id
|
|
|
supplierCode:
|
|
supplierCode:
|
|
|
- this.detailList.find((val) => val.categoryCode == item.code)
|
|
|
|
|
- ?.supplierCode || item.supplierCode,
|
|
|
|
|
|
|
+ filtersItem?.supplierCode || item.supplierCode,
|
|
|
supplierName:
|
|
supplierName:
|
|
|
- this.detailList.find((val) => val.categoryCode == item.code)
|
|
|
|
|
- ?.supplierName || item.supplierName, // 供应商名称
|
|
|
|
|
|
|
+ filtersItem?.supplierName || item.supplierName, // 供应商名称
|
|
|
approvalNumber: item.approvalNumber, // 批准文号
|
|
approvalNumber: item.approvalNumber, // 批准文号
|
|
|
- productionRequirements: this.form.productionRequirements,
|
|
|
|
|
|
|
+ productionRequirements: filtersItem.productionRequirements,
|
|
|
packingSpecification: item.packingSpecification, // 包装规格
|
|
packingSpecification: item.packingSpecification, // 包装规格
|
|
|
- packingSpecificationOption: newSpecificationOption[index], // 包装规格选项
|
|
|
|
|
|
|
+ packingSpecificationOption: newSpecificationOption, // 包装规格选项
|
|
|
packingSpecificationLabel: packingSpecificationLabel, // 包装规格显示
|
|
packingSpecificationLabel: packingSpecificationLabel, // 包装规格显示
|
|
|
// minPackingQuantity: 1, // 最小包装单元数量
|
|
// minPackingQuantity: 1, // 最小包装单元数量
|
|
|
- packingQuantity: this.isMoreProduct
|
|
|
|
|
- ? this.detailList.filter(
|
|
|
|
|
- (val) => val.productCode == item.code
|
|
|
|
|
- ).length
|
|
|
|
|
- : this.detailList.length || this.form.detailList.length, // 包装数量
|
|
|
|
|
|
|
+ // packingQuantity: this.isMoreProduct
|
|
|
|
|
+ // ? this.detailList.filter(
|
|
|
|
|
+ // (val) => val.productCode == item.code
|
|
|
|
|
+ // ).length
|
|
|
|
|
+ // : this.detailList.length || this.form.detailList.length, // 包装数量
|
|
|
|
|
+
|
|
|
|
|
+ packingQuantity: this.isMoreProduct ? filtersItem.packingQuantity : this.detailList.length || this.detailList.length,
|
|
|
packingUnit: packingUnit, // 单位
|
|
packingUnit: packingUnit, // 单位
|
|
|
measureQuantity: this.isMoreProduct
|
|
measureQuantity: this.isMoreProduct
|
|
|
- ? this.getMeasureQuantity(item.code)
|
|
|
|
|
|
|
+ ? filtersItem.quantity
|
|
|
: this.form.totalCount, // 计量数量
|
|
: this.form.totalCount, // 计量数量
|
|
|
- measureUnit: item.measuringUnit, // 计量单位
|
|
|
|
|
|
|
+ measureUnit: filtersItem.measuringUnit, // 计量单位
|
|
|
measureType: item.measureType, // 计量方式
|
|
measureType: item.measureType, // 计量方式
|
|
|
netWeight: item.netWeight > -1 ? item.netWeight : 0, // 净重
|
|
netWeight: item.netWeight > -1 ? item.netWeight : 0, // 净重
|
|
|
weight: weight || 0, // 重量
|
|
weight: weight || 0, // 重量
|
|
|
singleWeight: singleWeight || 0,
|
|
singleWeight: singleWeight || 0,
|
|
|
weightUnit: item.weightUnit, // 重量单位
|
|
weightUnit: item.weightUnit, // 重量单位
|
|
|
- totalMoney: item.totalPrice, // 总价
|
|
|
|
|
- unitPrice: item.unitPrice, // 单价
|
|
|
|
|
|
|
+ totalMoney: filtersItem.totalPrice, // 总价
|
|
|
|
|
+ unitPrice: filtersItem.unitPrice, // 单价
|
|
|
purpose: '', // 用途
|
|
purpose: '', // 用途
|
|
|
isUnpack: item.isUnpack, // 是否允许拆包
|
|
isUnpack: item.isUnpack, // 是否允许拆包
|
|
|
warehouseId: this.isMoreProduct
|
|
warehouseId: this.isMoreProduct
|
|
|
- ? this.detailList.find(
|
|
|
|
|
- (val) => val.productCode == item.code
|
|
|
|
|
- )?.warehouseId
|
|
|
|
|
|
|
+ ? filtersItem?.warehouseId
|
|
|
: this.form.warehouseId, // 仓库id
|
|
: this.form.warehouseId, // 仓库id
|
|
|
warehouseName: this.isMoreProduct
|
|
warehouseName: this.isMoreProduct
|
|
|
- ? this.detailList.find(
|
|
|
|
|
- (val) => val.productCode == item.code
|
|
|
|
|
- )?.warehouseName
|
|
|
|
|
|
|
+ ? filtersItem?.warehouseName
|
|
|
: this.form.warehouseName, // 仓库名称
|
|
: this.form.warehouseName, // 仓库名称
|
|
|
warehouseIds: this.isMoreProduct
|
|
warehouseIds: this.isMoreProduct
|
|
|
- ? this.detailList
|
|
|
|
|
|
|
+ ? mergedList
|
|
|
.filter((val) => val.productCode == item.code)
|
|
.filter((val) => val.productCode == item.code)
|
|
|
.map((item) => item.warehouseId)
|
|
.map((item) => item.warehouseId)
|
|
|
: warehouseIds,
|
|
: warehouseIds,
|
|
|
warehouseNames: this.isMoreProduct
|
|
warehouseNames: this.isMoreProduct
|
|
|
- ? this.detailList
|
|
|
|
|
|
|
+ ? mergedList
|
|
|
.filter((val) => val.productCode == item.code)
|
|
.filter((val) => val.productCode == item.code)
|
|
|
.map((item) => item.warehouseName)
|
|
.map((item) => item.warehouseName)
|
|
|
: warehouseNames
|
|
: warehouseNames
|
|
@@ -2228,7 +2266,7 @@
|
|
|
(val) => val.categoryCode == item.productCode
|
|
(val) => val.categoryCode == item.productCode
|
|
|
).index
|
|
).index
|
|
|
: this.productList[0].index, // 产品索引
|
|
: this.productList[0].index, // 产品索引
|
|
|
- batchNo: this.productList[0].batchNo, // 批次号
|
|
|
|
|
|
|
+ batchNo: item.batchNo || this.productList[0].batchNo, // 批次号
|
|
|
packageNo:
|
|
packageNo:
|
|
|
item.packageNo ||
|
|
item.packageNo ||
|
|
|
item.packingCode ||
|
|
item.packingCode ||
|
|
@@ -2250,13 +2288,13 @@
|
|
|
)?.packingSpecificationOption
|
|
)?.packingSpecificationOption
|
|
|
: this.productList[0].packingSpecificationOption, // 包装规格
|
|
: this.productList[0].packingSpecificationOption, // 包装规格
|
|
|
|
|
|
|
|
- netWeight: this.productList[0].netWeight, // 净重
|
|
|
|
|
|
|
+ netWeight: item.netWeight || this.productList[0].netWeight, // 净重
|
|
|
barcodes: item.barcodes || item.sendCode, // 发货条码
|
|
barcodes: item.barcodes || item.sendCode, // 发货条码
|
|
|
clientCode: clientCode, // 客户代号
|
|
clientCode: clientCode, // 客户代号
|
|
|
materielDesignation:
|
|
materielDesignation:
|
|
|
item.materielDesignation || item.extInfo?.materielCode, // 物料代号
|
|
item.materielDesignation || item.extInfo?.materielCode, // 物料代号
|
|
|
engrave: item.engrave || item.extInfo?.engrave, // 刻码
|
|
engrave: item.engrave || item.extInfo?.engrave, // 刻码
|
|
|
- isUnpack: this.productList[0].isUnpack, // 是否允许拆包
|
|
|
|
|
|
|
+ isUnpack: item.isUnpack || this.productList[0].isUnpack, // 是否允许拆包
|
|
|
productionDate: productionDate, // 生产日期
|
|
productionDate: productionDate, // 生产日期
|
|
|
purchaseDate: purchaseDate, // 采购时间
|
|
purchaseDate: purchaseDate, // 采购时间
|
|
|
result: 1, // 结果(1合格 2不合格)
|
|
result: 1, // 结果(1合格 2不合格)
|