|
|
@@ -144,7 +144,7 @@
|
|
|
:model="{ productList: productList }"
|
|
|
:show-message="false"
|
|
|
>
|
|
|
- <div style="text-align: right;margin-bottom: 10px;">
|
|
|
+ <div style="text-align: right; margin-bottom: 10px">
|
|
|
<el-button
|
|
|
v-if="productList.length != 0"
|
|
|
type="success"
|
|
|
@@ -173,7 +173,10 @@
|
|
|
@columns-change="handleColumnChange"
|
|
|
>
|
|
|
<!-- 包装完好与否 -->
|
|
|
- <template v-slot:ifPackageOk="{ row, $index }" v-if="isShowPackage">
|
|
|
+ <template
|
|
|
+ v-slot:ifPackageOk="{ row, $index }"
|
|
|
+ v-if="isShowPackage"
|
|
|
+ >
|
|
|
<el-form-item
|
|
|
:prop="'productList.' + $index + '.ifPackageOk'"
|
|
|
:rules="{
|
|
|
@@ -195,7 +198,10 @@
|
|
|
</template>
|
|
|
|
|
|
<!-- 拆包装责任人 -->
|
|
|
- <template v-slot:unpackUserName="{ row, $index }" v-if="isShowPackage">
|
|
|
+ <template
|
|
|
+ v-slot:unpackUserName="{ row, $index }"
|
|
|
+ v-if="isShowPackage"
|
|
|
+ >
|
|
|
<el-form-item
|
|
|
:prop="'productList.' + $index + '.unpackUserName'"
|
|
|
:rules="{
|
|
|
@@ -255,13 +261,7 @@
|
|
|
:ref="'packingQuantity' + $index"
|
|
|
type="number"
|
|
|
@keyup.native="
|
|
|
- moveFocus(
|
|
|
- $event,
|
|
|
- $index,
|
|
|
- 'packingQuantity',
|
|
|
- '产品',
|
|
|
- row
|
|
|
- )
|
|
|
+ moveFocus($event, $index, 'packingQuantity', '产品', row)
|
|
|
"
|
|
|
v-model="row.packingQuantity"
|
|
|
@input="computeNum(row, $index, true)"
|
|
|
@@ -360,9 +360,7 @@
|
|
|
@click="handleWareHouse(row, $index)"
|
|
|
>
|
|
|
<span>
|
|
|
- {{
|
|
|
- row.warehouseName ? row.warehouseName : '请选择仓库'
|
|
|
- }}
|
|
|
+ {{ row.warehouseName ? row.warehouseName : '请选择仓库' }}
|
|
|
</span>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
@@ -1072,13 +1070,51 @@
|
|
|
},
|
|
|
columns() {
|
|
|
return [
|
|
|
- { width: 50, type: 'index', columnKey: 'index', align: 'center', fixed: 'left' },
|
|
|
- { label: '编码', prop: 'categoryCode', align: 'center', width: 130, showOverflowTooltip: true, fixed: 'left' },
|
|
|
- { label: '名称', prop: 'categoryName', align: 'center', width: 200, showOverflowTooltip: true, fixed: 'left' },
|
|
|
- { label: '牌号', prop: 'brandNum', align: 'center', width: 100, showOverflowTooltip: true },
|
|
|
- { label: '型号', prop: 'categoryModel', align: 'center', width: 100, showOverflowTooltip: true },
|
|
|
- { label: '规格', prop: 'specification', align: 'center', width: 100, showOverflowTooltip: true },
|
|
|
- ...this.newColumns.map(item => ({
|
|
|
+ {
|
|
|
+ width: 50,
|
|
|
+ type: 'index',
|
|
|
+ columnKey: 'index',
|
|
|
+ align: 'center',
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '编码',
|
|
|
+ prop: 'categoryCode',
|
|
|
+ align: 'center',
|
|
|
+ width: 130,
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '名称',
|
|
|
+ prop: 'categoryName',
|
|
|
+ align: 'center',
|
|
|
+ width: 200,
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ fixed: 'left'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '牌号',
|
|
|
+ prop: 'brandNum',
|
|
|
+ align: 'center',
|
|
|
+ width: 100,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '型号',
|
|
|
+ prop: 'categoryModel',
|
|
|
+ align: 'center',
|
|
|
+ width: 100,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '规格',
|
|
|
+ prop: 'specification',
|
|
|
+ align: 'center',
|
|
|
+ width: 100,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ ...this.newColumns.map((item) => ({
|
|
|
...item,
|
|
|
prop: item.prop,
|
|
|
showOverflowTooltip: true
|
|
|
@@ -1102,35 +1138,128 @@
|
|
|
show: this.isShowPackage
|
|
|
},
|
|
|
// 批次号
|
|
|
- { label: '批次号', prop: 'batchNo', slot: 'batchNo', align: 'center', width: 100 },
|
|
|
+ {
|
|
|
+ label: '批次号',
|
|
|
+ prop: 'batchNo',
|
|
|
+ slot: 'batchNo',
|
|
|
+ align: 'center',
|
|
|
+ width: 100
|
|
|
+ },
|
|
|
// 数量
|
|
|
- { label: '数量', prop: 'packingQuantity', slot: 'packingQuantity', align: 'center', width: 100 },
|
|
|
+ {
|
|
|
+ label: '数量',
|
|
|
+ prop: 'packingQuantity',
|
|
|
+ slot: 'packingQuantity',
|
|
|
+ align: 'center',
|
|
|
+ width: 100
|
|
|
+ },
|
|
|
// 单位
|
|
|
- { label: '单位', prop: 'packingUnit', slot: 'packingUnit', align: 'center', width: 100 },
|
|
|
+ {
|
|
|
+ label: '单位',
|
|
|
+ prop: 'packingUnit',
|
|
|
+ slot: 'packingUnit',
|
|
|
+ align: 'center',
|
|
|
+ width: 100
|
|
|
+ },
|
|
|
// 包装规格
|
|
|
- { label: '包装规格', prop: 'packingSpecificationLabel', slot: 'packingSpecificationLabel', align: 'center', width: 300, showOverflowTooltip: true },
|
|
|
+ {
|
|
|
+ label: '包装规格',
|
|
|
+ prop: 'packingSpecificationLabel',
|
|
|
+ slot: 'packingSpecificationLabel',
|
|
|
+ align: 'center',
|
|
|
+ width: 300,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
// 允许拆包
|
|
|
- { label: '允许拆包', prop: 'isUnpack', align: 'center', width: 80, formatter: (row) => row.isUnpack == 1 ? '是' : '否' },
|
|
|
+ {
|
|
|
+ label: '允许拆包',
|
|
|
+ prop: 'isUnpack',
|
|
|
+ align: 'center',
|
|
|
+ width: 80,
|
|
|
+ formatter: (row) => (row.isUnpack == 1 ? '是' : '否')
|
|
|
+ },
|
|
|
// 计量数量
|
|
|
- { label: '计量数量', prop: 'measureQuantity', align: 'center', width: 100, showOverflowTooltip: true },
|
|
|
+ {
|
|
|
+ label: '计量数量',
|
|
|
+ prop: 'measureQuantity',
|
|
|
+ align: 'center',
|
|
|
+ width: 100,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
// 计量单位
|
|
|
- { label: '计量单位', prop: 'measureUnit', align: 'center', width: 80, showOverflowTooltip: true },
|
|
|
+ {
|
|
|
+ label: '计量单位',
|
|
|
+ prop: 'measureUnit',
|
|
|
+ align: 'center',
|
|
|
+ width: 80,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
// 单重
|
|
|
- { label: '单重', prop: 'singleWeight', slot: 'singleWeight', align: 'center', width: 120, showOverflowTooltip: true },
|
|
|
+ {
|
|
|
+ label: '单重',
|
|
|
+ prop: 'singleWeight',
|
|
|
+ slot: 'singleWeight',
|
|
|
+ align: 'center',
|
|
|
+ width: 120,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
// 总重
|
|
|
- { label: '总重', prop: 'weight', slot: 'weight', align: 'center', width: 120, showOverflowTooltip: true },
|
|
|
+ {
|
|
|
+ label: '总重',
|
|
|
+ prop: 'weight',
|
|
|
+ slot: 'weight',
|
|
|
+ align: 'center',
|
|
|
+ width: 120,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
// 重量单位
|
|
|
- { label: '重量单位', prop: 'weightUnit', align: 'center', width: 80, showOverflowTooltip: true },
|
|
|
+ {
|
|
|
+ label: '重量单位',
|
|
|
+ prop: 'weightUnit',
|
|
|
+ align: 'center',
|
|
|
+ width: 80,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
// 生产要求
|
|
|
- { label: '生产要求', prop: 'productionRequirements', align: 'center', width: 200, showOverflowTooltip: true },
|
|
|
+ {
|
|
|
+ label: '生产要求',
|
|
|
+ prop: 'productionRequirements',
|
|
|
+ align: 'center',
|
|
|
+ width: 200,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
// 机型
|
|
|
- { label: '机型', prop: 'modelKey', slot: 'modelKey', align: 'center', width: 300 },
|
|
|
+ {
|
|
|
+ label: '机型',
|
|
|
+ prop: 'modelKey',
|
|
|
+ slot: 'modelKey',
|
|
|
+ align: 'center',
|
|
|
+ width: 300
|
|
|
+ },
|
|
|
// 颜色
|
|
|
- { label: '颜色', prop: 'colorKey', slot: 'colorKey', align: 'center', width: 300 },
|
|
|
+ {
|
|
|
+ label: '颜色',
|
|
|
+ prop: 'colorKey',
|
|
|
+ slot: 'colorKey',
|
|
|
+ align: 'center',
|
|
|
+ width: 300
|
|
|
+ },
|
|
|
// 供应商
|
|
|
- { label: '供应商', prop: 'supplierId', align: 'center', width: 200, showOverflowTooltip: true },
|
|
|
+ {
|
|
|
+ label: '供应商',
|
|
|
+ prop: 'supplierName',
|
|
|
+ align: 'center',
|
|
|
+ width: 200,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
// 供应商代号
|
|
|
- { label: '供应商代号', prop: 'supplierCode', align: 'center', width: 120, showOverflowTooltip: true },
|
|
|
+ {
|
|
|
+ label: '供应商代号',
|
|
|
+ prop: 'supplierCode',
|
|
|
+ align: 'center',
|
|
|
+ width: 120,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
// 产地
|
|
|
{
|
|
|
label: '产地',
|
|
|
@@ -1141,15 +1270,31 @@
|
|
|
show: this.bizType == 2,
|
|
|
formatter: (row) => {
|
|
|
if (row.provenance) {
|
|
|
- return row.provenance.map((item) => this.getDictValue('产地', item)).join(',');
|
|
|
+ return row.provenance
|
|
|
+ .map((item) => this.getDictValue('产地', item))
|
|
|
+ .join(',');
|
|
|
}
|
|
|
return '';
|
|
|
}
|
|
|
},
|
|
|
// 仓库
|
|
|
- { label: '仓库', prop: 'warehouseName', slot: 'warehouseName', align: 'center', width: 300, showOverflowTooltip: true },
|
|
|
+ {
|
|
|
+ label: '仓库',
|
|
|
+ prop: 'warehouseName',
|
|
|
+ slot: 'warehouseName',
|
|
|
+ align: 'center',
|
|
|
+ width: 300,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
// 采购原因
|
|
|
- { label: '采购原因', prop: 'purpose', slot: 'purpose', align: 'center', width: 200, showOverflowTooltip: true },
|
|
|
+ {
|
|
|
+ label: '采购原因',
|
|
|
+ prop: 'purpose',
|
|
|
+ slot: 'purpose',
|
|
|
+ align: 'center',
|
|
|
+ width: 200,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
// 是否质检
|
|
|
{
|
|
|
label: '是否质检',
|
|
|
@@ -1165,14 +1310,39 @@
|
|
|
}
|
|
|
},
|
|
|
// 生产日期
|
|
|
- { label: '生产日期', prop: 'detailProductionDate', slot: 'detailProductionDate', align: 'center', width: 220 },
|
|
|
+ {
|
|
|
+ label: '生产日期',
|
|
|
+ prop: 'detailProductionDate',
|
|
|
+ slot: 'detailProductionDate',
|
|
|
+ align: 'center',
|
|
|
+ width: 220
|
|
|
+ },
|
|
|
// 采购日期
|
|
|
- { label: '采购日期', prop: 'detailPurchaseDate', slot: 'detailPurchaseDate', align: 'center', width: 220 },
|
|
|
+ {
|
|
|
+ label: '采购日期',
|
|
|
+ prop: 'detailPurchaseDate',
|
|
|
+ slot: 'detailPurchaseDate',
|
|
|
+ align: 'center',
|
|
|
+ width: 220
|
|
|
+ },
|
|
|
// 失效日期
|
|
|
- { label: '失效日期', prop: 'detailExpireDate', slot: 'detailExpireDate', align: 'center', width: 220 },
|
|
|
+ {
|
|
|
+ label: '失效日期',
|
|
|
+ prop: 'detailExpireDate',
|
|
|
+ slot: 'detailExpireDate',
|
|
|
+ align: 'center',
|
|
|
+ width: 220
|
|
|
+ },
|
|
|
// 操作
|
|
|
- { label: '操作', columnKey: 'action', slot: 'action', width: 140, align: 'center', fixed: 'right' }
|
|
|
- ].filter(col => col.show !== false);
|
|
|
+ {
|
|
|
+ label: '操作',
|
|
|
+ columnKey: 'action',
|
|
|
+ slot: 'action',
|
|
|
+ width: 140,
|
|
|
+ align: 'center',
|
|
|
+ fixed: 'right'
|
|
|
+ }
|
|
|
+ ].filter((col) => col.show !== false);
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
@@ -1402,7 +1572,7 @@
|
|
|
showOverflowTooltip: true
|
|
|
};
|
|
|
});
|
|
|
- this.newColumns = [...newRes];
|
|
|
+ this.newColumns = [...newRes].filter(item => item.prop != 'extField.packingSpecification');
|
|
|
});
|
|
|
},
|
|
|
// 初始化信息
|
|
|
@@ -1473,6 +1643,7 @@
|
|
|
this.formData.extInfo.assetType = Array.from(
|
|
|
new Set(res.map((item) => item.categoryLevelPathIdParent))
|
|
|
);
|
|
|
+ console.log(this.formData.extInfo.assetType, '类型类型');
|
|
|
|
|
|
// 获取批次号
|
|
|
const batchNo1 = await getCode('lot_number_code');
|
|
|
@@ -1485,113 +1656,187 @@
|
|
|
await storageApi.getCategoryPackageDisposition({
|
|
|
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')
|
|
|
|
|
|
- // 预处理:建立 res 的 Map 索引,用于快速查找物品详情
|
|
|
- const resMap = new Map(
|
|
|
- res.map((item) => [item.code, item])
|
|
|
- );
|
|
|
+ this.productList = this.saleProductList.map(
|
|
|
+ (filtersItem, index) => {
|
|
|
+ let item = res.find(
|
|
|
+ (detailItem) =>
|
|
|
+ detailItem.code == filtersItem.productCode ||
|
|
|
+ detailItem.code == filtersItem.categoryCode
|
|
|
+ );
|
|
|
+ const packingSpecificationItem = packingSpecificationOption.find(packingSpecificationItem=>packingSpecificationItem.id==filtersItem.productId)?.packingSpecification
|
|
|
|
|
|
- // 预处理:获取包装规格选项
|
|
|
- const newSpecificationOption = this.getNewSpecificationOption(this.packingSpecificationOption);
|
|
|
+ // 显示规格
|
|
|
+ let packingSpecificationLabel = packingSpecificationItem
|
|
|
+ .map((item) => {
|
|
|
+ if (item.sort > 0) {
|
|
|
+ return `${item.packageCell}${item.packageUnit}/${item.conversionUnit}`;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .filter((item) => !!item);
|
|
|
|
|
|
- // 预处理:计算包装规格显示标签
|
|
|
- const packingSpecificationLabels = (this.packingSpecificationOption || []).map((specArr) =>
|
|
|
- (specArr || [])
|
|
|
- .filter((s) => s.sort > 0)
|
|
|
- .map((s) => `${s.packageCell}${s.packageUnit}/${s.conversionUnit}`)
|
|
|
- );
|
|
|
+ const newSpecificationOption = packingSpecificationItem;
|
|
|
+ console.log(
|
|
|
+ newSpecificationOption,
|
|
|
+ '啵啵啵啵啵啵啵啵啵啵啵啵2'
|
|
|
+ );
|
|
|
|
|
|
- // 以 saleProductList 为主循环,匹配 res 中的物品信息
|
|
|
- this.productList = this.saleProductList.map((saleItem, index) => {
|
|
|
- // 通过 productCode 或 categoryCode 匹配 res 中的物品详情
|
|
|
- const item = resMap.get(saleItem.productCode) || resMap.get(saleItem.categoryCode);
|
|
|
+ console.log(filtersItem, 'filtersItemfiltersItemfiltersItem');
|
|
|
|
|
|
- if (!item) return null;
|
|
|
+ let warehouseId = filtersItem.warehouseId;
|
|
|
+ let warehouseName = filtersItem.warehouseName;
|
|
|
+ let measureQuantity =
|
|
|
+ filtersItem.totalCountNew || filtersItem.totalCount || 0;
|
|
|
+ // let measureQuantityOld = filtersItem.totalCount || 0;
|
|
|
+ if (
|
|
|
+ (filtersItem.sendTotalWeight ||
|
|
|
+ filtersItem.receiveTotalWeight) &&
|
|
|
+ item.weightUnit == item.measuringUnit
|
|
|
+ ) {
|
|
|
+ measureQuantity =
|
|
|
+ filtersItem.sendTotalWeight ||
|
|
|
+ filtersItem.receiveTotalWeight;
|
|
|
+ }
|
|
|
+ let packingQuantity =
|
|
|
+ filtersItem.totalCountNew ||
|
|
|
+ filtersItem.purchaseCount ||
|
|
|
+ filtersItem.totalCount ||
|
|
|
+ 0;
|
|
|
+ console.log(packingQuantity, 'packingQudasdasdantity');
|
|
|
+ let packingUnit =
|
|
|
+ filtersItem.purchaseUnit || filtersItem.measuringUnit || '';
|
|
|
|
|
|
- // 显示规格
|
|
|
- let packingSpecificationLabel = packingSpecificationLabels[index] || [];
|
|
|
+ let unitPrice = filtersItem.singlePrice || 0;
|
|
|
+ let pricingWay = filtersItem.pricingWay || '';
|
|
|
+ let singleWeight =
|
|
|
+ filtersItem.singleWeight ||
|
|
|
+ this.detailProductList[0]?.singleWeight ||
|
|
|
+ 0;
|
|
|
+ let weight =
|
|
|
+ filtersItem.sendTotalWeight ||
|
|
|
+ filtersItem.receiveTotalWeight ||
|
|
|
+ singleWeight * measureQuantity;
|
|
|
+ console.log(weight, 'weight');
|
|
|
+ // if(weight){
|
|
|
|
|
|
- let warehouseId = saleItem.warehouseId;
|
|
|
- let warehouseName = saleItem.warehouseName;
|
|
|
- let measureQuantity = saleItem.totalCountNew || saleItem.totalCount || 0;
|
|
|
- if (
|
|
|
- (saleItem.sendTotalWeight || saleItem.receiveTotalWeight) &&
|
|
|
- item.weightUnit == item.measuringUnit
|
|
|
- ) {
|
|
|
- measureQuantity = saleItem.sendTotalWeight || saleItem.receiveTotalWeight;
|
|
|
- }
|
|
|
- let packingQuantity = saleItem.totalCountNew || saleItem.purchaseCount || saleItem.totalCount || 0;
|
|
|
- let packingUnit = saleItem.purchaseUnit || saleItem.measuringUnit || '';
|
|
|
- let unitPrice = saleItem.singlePrice || 0;
|
|
|
- let pricingWay = saleItem.pricingWay || '';
|
|
|
- let singleWeight = saleItem.singleWeight || this.detailProductList[0]?.singleWeight || 0;
|
|
|
- let weight = saleItem.sendTotalWeight || saleItem.receiveTotalWeight || singleWeight * measureQuantity;
|
|
|
+ // }
|
|
|
+ // 获取相同仓库
|
|
|
+ let warehouseIds = [];
|
|
|
+ let warehouseNames = [];
|
|
|
+ for (let i = 0; i < filtersItem.totalCount; i++) {
|
|
|
+ warehouseIds.push(filtersItem.warehouseId);
|
|
|
+ warehouseNames.push(filtersItem.warehouseName);
|
|
|
+ }
|
|
|
+ let totalMoney = filtersItem.totalPrice || 0;
|
|
|
+ console.log(
|
|
|
+ filtersItem,
|
|
|
+ 'filtersItemfiltersItemfiltersItemfiltersItemfiltersItem'
|
|
|
+ );
|
|
|
|
|
|
- // 获取相同仓库
|
|
|
- let warehouseIds = [];
|
|
|
- let warehouseNames = [];
|
|
|
- for (let i = 0; i < saleItem.totalCount; i++) {
|
|
|
- warehouseIds.push(saleItem.warehouseId);
|
|
|
- warehouseNames.push(saleItem.warehouseName);
|
|
|
- }
|
|
|
- let totalMoney = saleItem.totalPrice || 0;
|
|
|
- let batchNo = saleItem.batchNo || batchNo1;
|
|
|
+ let batchNo = '';
|
|
|
+ if (filtersItem.batchNo) {
|
|
|
+ batchNo = filtersItem.batchNo;
|
|
|
+ } else {
|
|
|
+ batchNo = batchNo1;
|
|
|
+ }
|
|
|
+ console.log(newSpecificationOption,'dsd')
|
|
|
|
|
|
- return {
|
|
|
- index: index,
|
|
|
- categoryId: item.id, // 物品id
|
|
|
- categoryName: item.name, // 物品名称
|
|
|
- categoryCode: item.code, // 物品编码
|
|
|
- categoryModel: item.modelType, // 物品型号
|
|
|
- specification: item.specification, // 规格
|
|
|
- brandNum: item.brandNum, // 牌号
|
|
|
- batchNo: batchNo, // 批次号
|
|
|
- supplierListOptions: supplierList[item.id], // 供应商列表
|
|
|
- supplierId: this.form.supplierId, // 供应商id
|
|
|
- productionRequirements: saleItem.productionRequirements, // 生产要求
|
|
|
- supplierCode: this.bizType == 2 || this.bizType == 7 ? saleItem.supplierMark : item.supplierCode, // 供应商代号
|
|
|
- supplierName: this.form.supplierName, // 供应商名称
|
|
|
- approvalNumber: item.approvalNumber, // 批准文号
|
|
|
- packingSpecification: item.packingSpecification, // 包装规格
|
|
|
- packingSpecificationOption: newSpecificationOption?.[index] || [], // 包装规格选项
|
|
|
- packingSpecificationLabel: packingSpecificationLabel, // 包装规格显示
|
|
|
- packingQuantity: saleItem.isAllPackageData == 1 ? saleItem.packingCount : packingQuantity, // 包装数量
|
|
|
- packingUnit: saleItem.isAllPackageData == 1 ? saleItem.packingUnit : packingUnit, // 单位
|
|
|
- measureQuantity: saleItem.isAllPackageData == 1 ? saleItem.quantity : measureQuantity, // 计量数量
|
|
|
- measureUnit: saleItem.isAllPackageData == 1 ? saleItem.measuringUnit : item.measuringUnit, // 计量单位
|
|
|
- packingUnitId: saleItem.purchaseUnitId || saleItem.saleUnitId,
|
|
|
- modelKey: saleItem.modelKey ? saleItem.modelKey.split(',') : [], // 机型
|
|
|
- colorKey: saleItem.colorKey ? saleItem.colorKey.split(',') : [], // 颜色
|
|
|
- measureType: item.measureType, // 计量方式
|
|
|
- netWeight: item.netWeight > -1 ? item.netWeight : 0, // 净重
|
|
|
- singleWeight: singleWeight || 0, // 单重重量
|
|
|
- weight: weight || 0, // 总重量
|
|
|
- weightUnit: item.weightUnit, // 重量单位
|
|
|
- totalMoney: totalMoney, // 总价
|
|
|
- unitPrice: item.unitPrice || unitPrice, // 单价
|
|
|
- pricingWay: pricingWay, // 计价方式
|
|
|
- purpose: '', // 用途
|
|
|
- detailPurchaseDate,
|
|
|
- detailExpireDate: saleItem.guaranteePeriodDeadline, // 保质期截止日期
|
|
|
- detailProductionDate: saleItem.productionDate, // 生产日期
|
|
|
- provenance: saleItem.provenance, // 产地
|
|
|
- isUnpack: item.isUnpack, // 是否允许拆包
|
|
|
- warehouseId, // 仓库id
|
|
|
- warehouseName, // 仓库名称
|
|
|
- warehouseIds,
|
|
|
- warehouseNames,
|
|
|
- qualityControl: saleItem?.isComeCheck // 是否需要质检
|
|
|
- };
|
|
|
- }).filter(Boolean);
|
|
|
+ return {
|
|
|
+ index: this.productList.length + index,
|
|
|
+ categoryId: item.id, // 物品id
|
|
|
+ categoryName: item.name, // 物品名称
|
|
|
+ categoryCode: item.code, // 物品编码
|
|
|
+ categoryModel: item.modelType, // 物品型号
|
|
|
+ specification: item.specification, // 规格
|
|
|
+ brandNum: item.brandNum, // 牌号
|
|
|
+ batchNo: batchNo, // 批次号
|
|
|
+ supplierListOptions: supplierList[item.id], // 供应商列表
|
|
|
+ supplierId: this.form.supplierId, // 供应商id
|
|
|
+ productionRequirements: filtersItem.productionRequirements, //生产要求
|
|
|
+ supplierCode:
|
|
|
+ this.bizType == 2 || this.bizType == 7
|
|
|
+ ? filtersItem.supplierMark
|
|
|
+ : item.supplierCode, // 供应商代号
|
|
|
+ supplierName: this.form.supplierName, // 供应商名称
|
|
|
+ approvalNumber: item.approvalNumber, // 批准文号
|
|
|
+ packingSpecification: item.packingSpecification, // 包装规格
|
|
|
+ packingSpecificationOption: newSpecificationOption, // 包装规格选项
|
|
|
+ packingSpecificationLabel: packingSpecificationLabel, // 包装规格显示
|
|
|
+ // minPackingQuantity: minPackingQuantity, // 最小包装单元数量
|
|
|
+ packingQuantity:
|
|
|
+ filtersItem &&
|
|
|
+ filtersItem.isAllPackageData &&
|
|
|
+ filtersItem.isAllPackageData == 1
|
|
|
+ ? filtersItem.packingCount
|
|
|
+ : packingQuantity, // 包装数量
|
|
|
+ packingUnit:
|
|
|
+ filtersItem &&
|
|
|
+ filtersItem.isAllPackageData &&
|
|
|
+ filtersItem.isAllPackageData == 1
|
|
|
+ ? filtersItem.packingUnit
|
|
|
+ : packingUnit, // 单位
|
|
|
+ measureQuantity:
|
|
|
+ filtersItem &&
|
|
|
+ filtersItem.isAllPackageData &&
|
|
|
+ filtersItem.isAllPackageData == 1
|
|
|
+ ? filtersItem.quantity
|
|
|
+ : measureQuantity, // 计量数量
|
|
|
+ // measureQuantityOld,
|
|
|
+ measureUnit:
|
|
|
+ filtersItem &&
|
|
|
+ filtersItem.isAllPackageData &&
|
|
|
+ filtersItem.isAllPackageData == 1
|
|
|
+ ? filtersItem.measuringUnit
|
|
|
+ : item.measuringUnit, // 计量单位
|
|
|
+ packingUnitId:
|
|
|
+ filtersItem.purchaseUnitId || filtersItem.saleUnitId,
|
|
|
+ modelKey: filtersItem.modelKey
|
|
|
+ ? filtersItem.modelKey.split(',')
|
|
|
+ : '', // 机型
|
|
|
+ colorKey: filtersItem.colorKey
|
|
|
+ ? filtersItem.colorKey.split(',')
|
|
|
+ : '', // 颜色
|
|
|
+ measureType: item.measureType, // 计量方式
|
|
|
+ netWeight: item.netWeight > -1 ? item.netWeight : 0, // 净重
|
|
|
+ singleWeight: singleWeight || 0, // 单重重量
|
|
|
+ weight: weight || 0, // 总重量
|
|
|
+ weightUnit: item.weightUnit, // 重量单位
|
|
|
+ totalMoney: totalMoney, // 总价
|
|
|
+ unitPrice: item.unitPrice || unitPrice, // 单价
|
|
|
+ pricingWay: pricingWay, //计价方式
|
|
|
+ purpose: '', // 用途
|
|
|
+ detailPurchaseDate,
|
|
|
+ detailExpireDate: this.saleProductList.find(
|
|
|
+ (product) => product.productId == item.id
|
|
|
+ )?.guaranteePeriodDeadline,
|
|
|
+ detailProductionDate: this.saleProductList.find(
|
|
|
+ (product) => product.productId == item.id
|
|
|
+ )?.productionDate,
|
|
|
|
|
|
+ provenance: filtersItem.provenance, //产地
|
|
|
+ isUnpack: item.isUnpack, // 是否允许拆包
|
|
|
+ warehouseId, // 仓库id
|
|
|
+ warehouseName, // 仓库名称
|
|
|
+ warehouseIds,
|
|
|
+ warehouseNames,
|
|
|
+ qualityControl: filtersItem?.isComeCheck // 是否需要质检
|
|
|
+ };
|
|
|
+ }
|
|
|
+ );
|
|
|
+ console.log(this.productList, 'this.productListtttttttttttt');
|
|
|
this.$nextTick(() => {
|
|
|
this.batchSave();
|
|
|
+ // this.listSaveArrs()
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
@@ -1616,409 +1861,451 @@
|
|
|
let codeList = this.detailList.map((item) => {
|
|
|
return item.productCode || item.categoryCode;
|
|
|
});
|
|
|
- storageApi.getListByNameOrModeType({ codeList, queryConditions: this.detailList }).then(async (res) => {
|
|
|
- console.log(res, 'detailList-res');
|
|
|
- console.log(this.form, 'this.form.warehouseId');
|
|
|
- console.log(this.bizType, 'this.bizType~~~');
|
|
|
- // 获取批次号
|
|
|
- const batchNo = await getCode('lot_number_code');
|
|
|
- // 获取供应商
|
|
|
- const supplierList = await storageApi.contactQueryByCategoryIdsAPI({
|
|
|
- categoryIds: res.map((item) => item.id)
|
|
|
- });
|
|
|
- // 获取包装规格
|
|
|
- let packingSpecification =
|
|
|
- await storageApi.getCategoryPackageDisposition({
|
|
|
- categoryIds: res.map((item) => item.id)
|
|
|
+ storageApi
|
|
|
+ .getListByNameOrModeType({
|
|
|
+ codeList
|
|
|
+ })
|
|
|
+ .then(async (res) => {
|
|
|
+ console.log(res, 'detailList-res');
|
|
|
+ console.log(this.form, 'this.form.warehouseId');
|
|
|
+ console.log(this.bizType, 'this.bizType~~~');
|
|
|
+ // 获取批次号
|
|
|
+ const batchNo = await getCode('lot_number_code');
|
|
|
+ // 获取供应商
|
|
|
+ const supplierList =
|
|
|
+ await storageApi.contactQueryByCategoryIdsAPI({
|
|
|
+ categoryIds: res.map((item) => item.id)
|
|
|
+ });
|
|
|
+ // 获取包装规格
|
|
|
+ // let packingSpecification =
|
|
|
+ // await storageApi.getCategoryPackageDisposition({
|
|
|
+ // 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 packingSpecification =
|
|
|
+ await storageApi.getCategoryPackageDisposition({
|
|
|
+ categoryIds: res.map((item) => item.id)
|
|
|
+ });
|
|
|
+
|
|
|
+ let packingSpecificationOption = res.map((item) => {
|
|
|
+ return {
|
|
|
+ id: item.id,
|
|
|
+ packingSpecification: packingSpecification
|
|
|
+ .filter((ite) => item.id == ite.categoryId)
|
|
|
+ .sort((a, b) => a.sort - b.sort)
|
|
|
+ }
|
|
|
});
|
|
|
- this.packingSpecificationOption = res.map((item) => {
|
|
|
- return packingSpecification
|
|
|
- .filter((ite) => item.id == ite.categoryId)
|
|
|
- .sort((a, b) => a.sort - b.sort);
|
|
|
- });
|
|
|
- // 获取相同仓库
|
|
|
- let warehouseIds = [];
|
|
|
- let warehouseNames = [];
|
|
|
- console.log(this.form.totalCount, 'this.form.warehouseId');
|
|
|
- for (let index = 0; index < this.form.totalCount; index++) {
|
|
|
- warehouseIds.push(this.form.warehouseId);
|
|
|
- warehouseNames.push(this.form.warehouseName);
|
|
|
- }
|
|
|
- if (this.bizType == 4 || this.bizType == 1) {
|
|
|
- warehouseIds.push(this.form.warehouseId);
|
|
|
- warehouseNames.push(this.form.warehouseName);
|
|
|
- }
|
|
|
- if (this.isMoreProduct) {
|
|
|
- this.formData.extInfo.assetType = [];
|
|
|
- res.map((item) => {
|
|
|
- this.formData.extInfo.assetType.push(
|
|
|
- item.categoryLevelPathIdParent
|
|
|
+ console.log(packingSpecificationOption,'packingSpecificationOption')
|
|
|
+ // 获取相同仓库
|
|
|
+ let warehouseIds = [];
|
|
|
+ let warehouseNames = [];
|
|
|
+ console.log(this.form.totalCount, 'this.form.warehouseId');
|
|
|
+ for (let index = 0; index < this.form.totalCount; index++) {
|
|
|
+ warehouseIds.push(this.form.warehouseId);
|
|
|
+ warehouseNames.push(this.form.warehouseName);
|
|
|
+ }
|
|
|
+ if (this.bizType == 4 || this.bizType == 1) {
|
|
|
+ warehouseIds.push(this.form.warehouseId);
|
|
|
+ warehouseNames.push(this.form.warehouseName);
|
|
|
+ }
|
|
|
+ if (this.isMoreProduct) {
|
|
|
+ this.formData.extInfo.assetType = [];
|
|
|
+ res.map((item) => {
|
|
|
+ this.formData.extInfo.assetType.push(
|
|
|
+ item.categoryLevelPathIdParent
|
|
|
+ );
|
|
|
+ });
|
|
|
+ this.formData.extInfo.assetType = Array.from(
|
|
|
+ new Set(...this.formData.extInfo.assetType)
|
|
|
);
|
|
|
- });
|
|
|
- this.formData.extInfo.assetType = Array.from(
|
|
|
- new Set(...this.formData.extInfo.assetType)
|
|
|
- );
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
- const newSpecificationOption = this.getNewSpecificationOption(
|
|
|
- this.packingSpecificationOption
|
|
|
- );
|
|
|
+ // const newSpecificationOption = this.getNewSpecificationOption(
|
|
|
+ // this.packingSpecificationOption
|
|
|
+ // );
|
|
|
+
|
|
|
+ // 生成产品列表
|
|
|
+ this.productList = this.detailList.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);
|
|
|
+ const packingSpecificationItem = packingSpecificationOption.find(packingSpecificationItem=>packingSpecificationItem.id==filtersItem.productId)?.packingSpecification
|
|
|
|
|
|
- // 生成产品列表
|
|
|
- this.productList = res.map((item, index) => {
|
|
|
- // 显示规格
|
|
|
- let packingSpecificationLabel = this.packingSpecificationOption[
|
|
|
- index
|
|
|
- ]
|
|
|
+ // 显示规格
|
|
|
+ let packingSpecificationLabel = packingSpecificationItem
|
|
|
.map((item) => {
|
|
|
if (item.sort > 0) {
|
|
|
return `${item.packageCell}${item.packageUnit}/${item.conversionUnit}`;
|
|
|
}
|
|
|
})
|
|
|
.filter((item) => !!item);
|
|
|
- // 换算重量
|
|
|
- let weight = 0;
|
|
|
- if (
|
|
|
- this.form?.weightUnit?.toUpperCase() ==
|
|
|
- item?.weightUnit.toUpperCase()
|
|
|
- ) {
|
|
|
- weight = this.form.totalWeight;
|
|
|
- } else {
|
|
|
- switch (item.weightUnit.toUpperCase()) {
|
|
|
- case 'KG':
|
|
|
- if (this.form.totalWeight > -1) {
|
|
|
- weight = this.$math.format(
|
|
|
- this.form.totalWeight / 1000,
|
|
|
- 14
|
|
|
- );
|
|
|
- } else {
|
|
|
- weight = 0;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 'G':
|
|
|
- if (this.form.totalWeight > -1) {
|
|
|
- weight = this.$math.format(
|
|
|
- this.form.totalWeight * 1000,
|
|
|
- 14
|
|
|
- );
|
|
|
- } else {
|
|
|
- weight = 0;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 'L':
|
|
|
- if (this.form.totalWeight > -1) {
|
|
|
- weight = this.$math.format(
|
|
|
- this.form.totalWeight * 1000,
|
|
|
- 14
|
|
|
- );
|
|
|
- } else {
|
|
|
- weight = 0;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 'l':
|
|
|
- if (this.form.totalWeight > -1) {
|
|
|
- weight = this.$math.format(
|
|
|
- this.form.totalWeight * 1000,
|
|
|
- 14
|
|
|
- );
|
|
|
- } else {
|
|
|
- weight = 0;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 'ML':
|
|
|
- if (this.form.totalWeight > -1) {
|
|
|
- weight = this.$math.format(
|
|
|
- this.form.totalWeight * 1000,
|
|
|
- 14
|
|
|
- );
|
|
|
- } else {
|
|
|
- weight = 0;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 'ml':
|
|
|
- if (this.form.totalWeight > -1) {
|
|
|
- weight = this.$math.format(
|
|
|
- this.form.totalWeight * 1000,
|
|
|
- 14
|
|
|
- );
|
|
|
- } else {
|
|
|
- weight = 0;
|
|
|
- }
|
|
|
- break;
|
|
|
+
|
|
|
+ const newSpecificationOption = packingSpecificationItem;
|
|
|
+ // 换算重量
|
|
|
+ let weight = 0;
|
|
|
+ if (
|
|
|
+ this.form?.weightUnit?.toUpperCase() ==
|
|
|
+ item?.weightUnit.toUpperCase()
|
|
|
+ ) {
|
|
|
+ weight = this.form.totalWeight;
|
|
|
+ } else {
|
|
|
+ switch (item.weightUnit.toUpperCase()) {
|
|
|
+ case 'KG':
|
|
|
+ if (this.form.totalWeight > -1) {
|
|
|
+ weight = this.$math.format(
|
|
|
+ this.form.totalWeight / 1000,
|
|
|
+ 14
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ weight = 0;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 'G':
|
|
|
+ if (this.form.totalWeight > -1) {
|
|
|
+ weight = this.$math.format(
|
|
|
+ this.form.totalWeight * 1000,
|
|
|
+ 14
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ weight = 0;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 'L':
|
|
|
+ if (this.form.totalWeight > -1) {
|
|
|
+ weight = this.$math.format(
|
|
|
+ this.form.totalWeight * 1000,
|
|
|
+ 14
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ weight = 0;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 'l':
|
|
|
+ if (this.form.totalWeight > -1) {
|
|
|
+ weight = this.$math.format(
|
|
|
+ this.form.totalWeight * 1000,
|
|
|
+ 14
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ weight = 0;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 'ML':
|
|
|
+ if (this.form.totalWeight > -1) {
|
|
|
+ weight = this.$math.format(
|
|
|
+ this.form.totalWeight * 1000,
|
|
|
+ 14
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ weight = 0;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 'ml':
|
|
|
+ if (this.form.totalWeight > -1) {
|
|
|
+ weight = this.$math.format(
|
|
|
+ this.form.totalWeight * 1000,
|
|
|
+ 14
|
|
|
+ );
|
|
|
+ } else {
|
|
|
+ weight = 0;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- let packingUnit = item.packingUnit;
|
|
|
- let singleWeight = item.singleWeight || 0; // 单重重量
|
|
|
+ let packingUnit = item.packingUnit;
|
|
|
+ let singleWeight = item.singleWeight || 0; // 单重重量
|
|
|
|
|
|
- return {
|
|
|
- index: this.productList.length + index,
|
|
|
- isSave: true,
|
|
|
- categoryId: item.id, // 物品id
|
|
|
- categoryName: item.name, // 物品名称
|
|
|
- categoryCode: item.code, // 物品编码
|
|
|
- categoryModel: item.modelType, // 物品型号
|
|
|
- specification: item.specification, // 规格
|
|
|
- brandNum: item.brandNum, // 牌号
|
|
|
- colorKey:
|
|
|
- this.bizType == 1
|
|
|
- ? this.form.colorKey
|
|
|
- ? this.form.colorKey.split(',')
|
|
|
- : ''
|
|
|
- : item.colorKey
|
|
|
- ? item.colorKey.split(',')
|
|
|
- : '', // 颜色
|
|
|
- modelKey:
|
|
|
- this.bizType == 1
|
|
|
- ? this.form.modelKey
|
|
|
- ? this.form.modelKey.split(',')
|
|
|
- : ''
|
|
|
- : item.modelKey
|
|
|
- ? item.modelKey.split(',')
|
|
|
- : '', // 机型
|
|
|
- batchNo: [1, 3, 6].includes(this.bizType)
|
|
|
- ? this.detailList[0]?.batchNo || batchNo
|
|
|
- : batchNo, // 批次号
|
|
|
- supplierListOptions: supplierList[item.id], // 供应商列表
|
|
|
- supplierId:
|
|
|
- this.detailList.find((val) => val.categoryCode == item.code)
|
|
|
- ?.supplierId || item.supplierId, // 供应商id
|
|
|
- supplierCode:
|
|
|
- this.detailList.find((val) => val.categoryCode == item.code)
|
|
|
- ?.supplierCode || item.supplierCode,
|
|
|
- supplierName:
|
|
|
- this.detailList.find((val) => val.categoryCode == item.code)
|
|
|
- ?.supplierName || item.supplierName, // 供应商名称
|
|
|
- approvalNumber: item.approvalNumber, // 批准文号
|
|
|
- productionRequirements: this.form.productionRequirements,
|
|
|
- packingSpecification: item.packingSpecification, // 包装规格
|
|
|
- packingSpecificationOption: newSpecificationOption[index], // 包装规格选项
|
|
|
- packingSpecificationLabel: packingSpecificationLabel, // 包装规格显示
|
|
|
- // minPackingQuantity: 1, // 最小包装单元数量
|
|
|
- packingQuantity: this.isMoreProduct
|
|
|
- ? this.detailList.filter(
|
|
|
- (val) => val.productCode == item.code
|
|
|
- ).length
|
|
|
- : this.detailList.length || this.form.detailList.length, // 包装数量
|
|
|
- packingUnit: packingUnit, // 单位
|
|
|
- measureQuantity: this.isMoreProduct
|
|
|
- ? this.getMeasureQuantity(item.code)
|
|
|
- : this.form.totalCount, // 计量数量
|
|
|
- measureUnit: item.measuringUnit, // 计量单位
|
|
|
- measureType: item.measureType, // 计量方式
|
|
|
- netWeight: item.netWeight > -1 ? item.netWeight : 0, // 净重
|
|
|
- weight: weight || 0, // 重量
|
|
|
- singleWeight: singleWeight || 0,
|
|
|
- weightUnit: item.weightUnit, // 重量单位
|
|
|
- totalMoney: item.totalPrice, // 总价
|
|
|
- unitPrice: item.unitPrice, // 单价
|
|
|
- purpose: '', // 用途
|
|
|
- isUnpack: item.isUnpack, // 是否允许拆包
|
|
|
- warehouseId: this.isMoreProduct
|
|
|
- ? this.detailList.find((val) => val.productCode == item.code)
|
|
|
- ?.warehouseId
|
|
|
- : this.form.warehouseId, // 仓库id
|
|
|
- warehouseName: this.isMoreProduct
|
|
|
- ? this.detailList.find((val) => val.productCode == item.code)
|
|
|
- ?.warehouseName
|
|
|
- : this.form.warehouseName, // 仓库名称
|
|
|
- warehouseIds: this.isMoreProduct
|
|
|
- ? this.detailList
|
|
|
- .filter((val) => val.productCode == item.code)
|
|
|
- .map((item) => item.warehouseId)
|
|
|
- : warehouseIds,
|
|
|
- warehouseNames: this.isMoreProduct
|
|
|
- ? this.detailList
|
|
|
- .filter((val) => val.productCode == item.code)
|
|
|
- .map((item) => item.warehouseName)
|
|
|
- : warehouseNames
|
|
|
- };
|
|
|
- });
|
|
|
+ return {
|
|
|
+ index: this.productList.length + index,
|
|
|
+ isSave: true,
|
|
|
+ categoryId: item.id, // 物品id
|
|
|
+ categoryName: item.name, // 物品名称
|
|
|
+ categoryCode: item.code, // 物品编码
|
|
|
+ categoryModel: item.modelType, // 物品型号
|
|
|
+ specification: item.specification, // 规格
|
|
|
+ brandNum: item.brandNum, // 牌号
|
|
|
+ colorKey:
|
|
|
+ this.bizType == 1
|
|
|
+ ? this.form.colorKey
|
|
|
+ ? this.form.colorKey.split(',')
|
|
|
+ : ''
|
|
|
+ : filtersItem.colorKey
|
|
|
+ ? filtersItem.colorKey.split(',')
|
|
|
+ : '', // 颜色
|
|
|
+ modelKey:
|
|
|
+ this.bizType == 1
|
|
|
+ ? this.form.modelKey
|
|
|
+ ? this.form.modelKey.split(',')
|
|
|
+ : ''
|
|
|
+ : filtersItem.modelKey
|
|
|
+ ? filtersItem.modelKey.split(',')
|
|
|
+ : '', // 机型
|
|
|
+ batchNo: [1, 3, 6].includes(this.bizType)
|
|
|
+ ? filtersItem.batchNo || batchNo
|
|
|
+ : batchNo, // 批次号
|
|
|
+ supplierListOptions: supplierList[item.id], // 供应商列表
|
|
|
+ supplierId:
|
|
|
+ filtersItem
|
|
|
+ ?.supplierId || item.supplierId, // 供应商id
|
|
|
+ supplierCode:
|
|
|
+ filtersItem
|
|
|
+ ?.supplierCode || item.supplierCode,
|
|
|
+ supplierName:
|
|
|
+ filtersItem
|
|
|
+ ?.supplierName || item.supplierName, // 供应商名称
|
|
|
+ approvalNumber: item.approvalNumber, // 批准文号
|
|
|
+ productionRequirements: filtersItem.productionRequirements,
|
|
|
+ packingSpecification: item.packingSpecification, // 包装规格
|
|
|
+ packingSpecificationOption: newSpecificationOption, // 包装规格选项
|
|
|
+ packingSpecificationLabel: packingSpecificationLabel, // 包装规格显示
|
|
|
+ // minPackingQuantity: 1, // 最小包装单元数量
|
|
|
+ packingQuantity: this.isMoreProduct
|
|
|
+ ? this.detailList.filter(
|
|
|
+ (val) => val.productCode == item.code
|
|
|
+ ).length
|
|
|
+ : this.detailList.length || this.form.detailList.length, // 包装数量
|
|
|
+ packingUnit: packingUnit, // 单位
|
|
|
+ measureQuantity: this.isMoreProduct
|
|
|
+ ? this.getMeasureQuantity(item.code)
|
|
|
+ : this.form.totalCount, // 计量数量
|
|
|
+ measureUnit: item.measuringUnit, // 计量单位
|
|
|
+ measureType: item.measureType, // 计量方式
|
|
|
+ netWeight: item.netWeight > -1 ? item.netWeight : 0, // 净重
|
|
|
+ weight: weight || 0, // 重量
|
|
|
+ singleWeight: singleWeight || 0,
|
|
|
+ weightUnit: item.weightUnit, // 重量单位
|
|
|
+ totalMoney: item.totalPrice, // 总价
|
|
|
+ unitPrice: item.unitPrice, // 单价
|
|
|
+ purpose: '', // 用途
|
|
|
+ isUnpack: item.isUnpack, // 是否允许拆包
|
|
|
+ warehouseId: this.isMoreProduct
|
|
|
+ ? this.detailList.find(
|
|
|
+ (val) => val.productCode == item.code
|
|
|
+ )?.warehouseId
|
|
|
+ : this.form.warehouseId, // 仓库id
|
|
|
+ warehouseName: this.isMoreProduct
|
|
|
+ ? this.detailList.find(
|
|
|
+ (val) => val.productCode == item.code
|
|
|
+ )?.warehouseName
|
|
|
+ : this.form.warehouseName, // 仓库名称
|
|
|
+ warehouseIds: this.isMoreProduct
|
|
|
+ ? this.detailList
|
|
|
+ .filter((val) => val.productCode == item.code)
|
|
|
+ .map((item) => item.warehouseId)
|
|
|
+ : warehouseIds,
|
|
|
+ warehouseNames: this.isMoreProduct
|
|
|
+ ? this.detailList
|
|
|
+ .filter((val) => val.productCode == item.code)
|
|
|
+ .map((item) => item.warehouseName)
|
|
|
+ : warehouseNames
|
|
|
+ };
|
|
|
+ });
|
|
|
|
|
|
- console.log('this.isMoreProduct', this.isMoreProduct);
|
|
|
+ console.log('this.isMoreProduct', this.isMoreProduct);
|
|
|
|
|
|
- let getAssetNumPr = this.isMoreProduct
|
|
|
- ? this.detailList.map((val) => {
|
|
|
- console.log('val', val);
|
|
|
- return {
|
|
|
- assetCode: val.productCode,
|
|
|
- batchNum: val.productBrand ? val.productBrand : val.batchNo,
|
|
|
- num: 1
|
|
|
- };
|
|
|
- })
|
|
|
- : [
|
|
|
- {
|
|
|
- assetCode:
|
|
|
- this.productList[0].categoryCode +
|
|
|
- this.productList[0].index,
|
|
|
- batchNum: this.productList[0].batchNo,
|
|
|
- num: this.detailList.length
|
|
|
- }
|
|
|
- ];
|
|
|
- console.log(this.productList, 'this.productList');
|
|
|
- console.log(this.detailList, 'this.detailList');
|
|
|
- console.log(this.detailList.length, 'this.detailList');
|
|
|
- console.log(getAssetNumPr, 'getAssetNumPr');
|
|
|
-
|
|
|
- // 生成包装编码
|
|
|
- const { data } = await storageApi.getAssetNum(getAssetNumPr);
|
|
|
- let packingCodeList = data;
|
|
|
- // 生产包装
|
|
|
- this.packingList = this.detailList.map((item, index) => {
|
|
|
- // if (item.isAllPackageData != 1) {
|
|
|
- // console.log(item, 'itemitemitemitemitemitem1');
|
|
|
- // console.log(item.packingUnit, 'itemitemitemitemitemitem2');
|
|
|
- // 换算重量
|
|
|
- let weight = 0;
|
|
|
- if (
|
|
|
- this.productList[0].weightUnit.toUpperCase() ==
|
|
|
- item.weightUnit.toUpperCase()
|
|
|
- ) {
|
|
|
- weight = this.form.totalWeight;
|
|
|
- } else {
|
|
|
- switch (this.productList[0].weightUnit.toUpperCase()) {
|
|
|
- case 'KG':
|
|
|
- if (item.weightUnit > -1) {
|
|
|
- weight = this.$math.format(item.weightUnit / 1000, 14);
|
|
|
- } else {
|
|
|
- weight = 0;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 'G':
|
|
|
- if (item.weightUnit > -1) {
|
|
|
- weight = this.$math.format(item.weightUnit * 1000, 14);
|
|
|
- } else {
|
|
|
- weight = 0;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 'L':
|
|
|
- if (item.weightUnit > -1) {
|
|
|
- weight = this.$math.format(item.weightUnit / 1000, 14);
|
|
|
- } else {
|
|
|
- weight = 0;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 'l':
|
|
|
- if (item.weightUnit > -1) {
|
|
|
- weight = this.$math.format(item.weightUnit / 1000, 14);
|
|
|
- } else {
|
|
|
- weight = 0;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 'ML':
|
|
|
- if (item.weightUnit > -1) {
|
|
|
- weight = this.$math.format(item.weightUnit / 1000, 14);
|
|
|
- } else {
|
|
|
- weight = 0;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 'ml':
|
|
|
- if (item.weightUnit > -1) {
|
|
|
- weight = this.$math.format(item.weightUnit / 1000, 14);
|
|
|
- } else {
|
|
|
- weight = 0;
|
|
|
+ let getAssetNumPr = this.isMoreProduct
|
|
|
+ ? this.detailList.map((val) => {
|
|
|
+ console.log('val', val);
|
|
|
+ return {
|
|
|
+ assetCode: val.productCode,
|
|
|
+ batchNum: val.productBrand
|
|
|
+ ? val.productBrand
|
|
|
+ : val.batchNo,
|
|
|
+ num: 1
|
|
|
+ };
|
|
|
+ })
|
|
|
+ : [
|
|
|
+ {
|
|
|
+ assetCode:
|
|
|
+ this.productList[0].categoryCode +
|
|
|
+ this.productList[0].index,
|
|
|
+ batchNum: this.productList[0].batchNo,
|
|
|
+ num: this.detailList.length
|
|
|
}
|
|
|
- break;
|
|
|
+ ];
|
|
|
+ console.log(this.productList, 'this.productList');
|
|
|
+ console.log(this.detailList, 'this.detailList');
|
|
|
+ console.log(this.detailList.length, 'this.detailList');
|
|
|
+ console.log(getAssetNumPr, 'getAssetNumPr');
|
|
|
+
|
|
|
+ // 生成包装编码
|
|
|
+ const { data } = await storageApi.getAssetNum(getAssetNumPr);
|
|
|
+ let packingCodeList = data;
|
|
|
+ // 生产包装
|
|
|
+ this.packingList = this.detailList.map((item, index) => {
|
|
|
+ // if (item.isAllPackageData != 1) {
|
|
|
+ // console.log(item, 'itemitemitemitemitemitem1');
|
|
|
+ // console.log(item.packingUnit, 'itemitemitemitemitemitem2');
|
|
|
+ // 换算重量
|
|
|
+ let weight = 0;
|
|
|
+ if (
|
|
|
+ this.productList[0].weightUnit.toUpperCase() ==
|
|
|
+ item.weightUnit.toUpperCase()
|
|
|
+ ) {
|
|
|
+ weight = this.form.totalWeight;
|
|
|
+ } else {
|
|
|
+ switch (this.productList[0].weightUnit.toUpperCase()) {
|
|
|
+ case 'KG':
|
|
|
+ if (item.weightUnit > -1) {
|
|
|
+ weight = this.$math.format(item.weightUnit / 1000, 14);
|
|
|
+ } else {
|
|
|
+ weight = 0;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 'G':
|
|
|
+ if (item.weightUnit > -1) {
|
|
|
+ weight = this.$math.format(item.weightUnit * 1000, 14);
|
|
|
+ } else {
|
|
|
+ weight = 0;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 'L':
|
|
|
+ if (item.weightUnit > -1) {
|
|
|
+ weight = this.$math.format(item.weightUnit / 1000, 14);
|
|
|
+ } else {
|
|
|
+ weight = 0;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 'l':
|
|
|
+ if (item.weightUnit > -1) {
|
|
|
+ weight = this.$math.format(item.weightUnit / 1000, 14);
|
|
|
+ } else {
|
|
|
+ weight = 0;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 'ML':
|
|
|
+ if (item.weightUnit > -1) {
|
|
|
+ weight = this.$math.format(item.weightUnit / 1000, 14);
|
|
|
+ } else {
|
|
|
+ weight = 0;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 'ml':
|
|
|
+ if (item.weightUnit > -1) {
|
|
|
+ weight = this.$math.format(item.weightUnit / 1000, 14);
|
|
|
+ } else {
|
|
|
+ weight = 0;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 代入时间
|
|
|
+ let obj = this.getNowDate();
|
|
|
+ let productionDate = '';
|
|
|
+ let purchaseDate = '';
|
|
|
+ if (this.formData.bizType == '1') {
|
|
|
+ // 生产入库
|
|
|
+ productionDate = `${obj.year}-${obj.month}-${obj.strDate} ${obj.hour}:${obj.minute}:${obj.second}`;
|
|
|
+ // this.curDateType = 'productionDate';
|
|
|
+ } else if (this.formData.bizType == '2') {
|
|
|
+ // 采购入库
|
|
|
+ const defaultTime = '00:00:00';
|
|
|
+ purchaseDate =
|
|
|
+ this.form.purchaseDate ||
|
|
|
+ `${this.form.receiveDate} ${defaultTime}`;
|
|
|
+ // this.curDateType = 'purchaseDate';
|
|
|
}
|
|
|
- }
|
|
|
- // 代入时间
|
|
|
- let obj = this.getNowDate();
|
|
|
- let productionDate = '';
|
|
|
- let purchaseDate = '';
|
|
|
- if (this.formData.bizType == '1') {
|
|
|
- // 生产入库
|
|
|
- productionDate = `${obj.year}-${obj.month}-${obj.strDate} ${obj.hour}:${obj.minute}:${obj.second}`;
|
|
|
- // this.curDateType = 'productionDate';
|
|
|
- } else if (this.formData.bizType == '2') {
|
|
|
- // 采购入库
|
|
|
- const defaultTime = '00:00:00';
|
|
|
- purchaseDate =
|
|
|
- this.form.purchaseDate ||
|
|
|
- `${this.form.receiveDate} ${defaultTime}`;
|
|
|
- // this.curDateType = 'purchaseDate';
|
|
|
- }
|
|
|
|
|
|
- let clientCode = '';
|
|
|
- if (this.bizType == 2) {
|
|
|
- clientCode = item.customerMark;
|
|
|
- } else if (this.bizType != 2) {
|
|
|
- clientCode = item.clientCode || item.extInfo?.clientCode;
|
|
|
- }
|
|
|
+ let clientCode = '';
|
|
|
+ if (this.bizType == 2) {
|
|
|
+ clientCode = item.customerMark;
|
|
|
+ } else if (this.bizType != 2) {
|
|
|
+ clientCode = item.clientCode || item.extInfo?.clientCode;
|
|
|
+ }
|
|
|
|
|
|
- return {
|
|
|
- index: this.isMoreProduct
|
|
|
- ? this.productList.find(
|
|
|
- (val) => val.categoryCode == item.productCode
|
|
|
- ).index +
|
|
|
- '-' +
|
|
|
- index
|
|
|
- : this.productList[0].index + '-' + index, // 包装索引
|
|
|
- warehouseId:
|
|
|
- item.warehouseId || this.productList[0].warehouseIds[index], // 仓库id
|
|
|
- warehouseName:
|
|
|
- item.warehouseName ||
|
|
|
- this.productList[0].warehouseNames[index], // 仓库名称
|
|
|
- categoryName:
|
|
|
- item.productName || this.productList[0].categoryName, // 产品名称
|
|
|
- categoryCode:
|
|
|
- item.productCode || this.productList[0].categoryCode, // 产品编码
|
|
|
- categoryModel:
|
|
|
- item.modelType || this.productList[0].categoryModel, // 物品型号
|
|
|
- specification:
|
|
|
- item.specification || this.productList[0].specification, // 规格
|
|
|
- brandNum: item.productBrand || this.productList[0].brandNum, // 牌号
|
|
|
- colorKey:
|
|
|
- (item.colorKey ? item.colorKey.split(',') : '') ||
|
|
|
- this.productList[0].colorKey, // 颜色
|
|
|
- modelKey:
|
|
|
- (item.modelKey ? item.modelKey.split(',') : '') ||
|
|
|
- this.productList[0].modelKey, // 机型
|
|
|
- parentIndex: this.isMoreProduct
|
|
|
- ? this.productList.find(
|
|
|
- (val) => val.categoryCode == item.productCode
|
|
|
- ).index
|
|
|
- : this.productList[0].index, // 产品索引
|
|
|
- batchNo: this.productList[0].batchNo, // 批次号
|
|
|
- packageNo:
|
|
|
- item.packageNo ||
|
|
|
- item.packingCode ||
|
|
|
- packingCodeList[index]?.onlyCode, // 包装编码
|
|
|
- packingQuantity: 1, // 包装数量
|
|
|
- packingUnit: item.packingUnit, // 单位
|
|
|
- measureQuantity: item.quantity || item.measureQuantity, // 计量数量
|
|
|
- measureUnit: item.measuringUnit || item.measureUnit, // 计量单位
|
|
|
- supplierCode: item.supplierCode,
|
|
|
- supplierId: item.supplierId,
|
|
|
- supplierName: item.supplierName,
|
|
|
- weight: item.packingWeight || 0, // 重量
|
|
|
- singleWeight: item.singleWeight || 0,
|
|
|
- pricingWay: item.pricingWay,
|
|
|
- weightUnit: item.weightUnit || this.productList[0].weightUnit, // 重量单位
|
|
|
- packingSpecificationOption: this.isMoreProduct
|
|
|
- ? this.productList.find(
|
|
|
- (val) => val.categoryCode == item.productCode
|
|
|
- )?.packingSpecificationOption
|
|
|
- : this.productList[0].packingSpecificationOption, // 包装规格
|
|
|
-
|
|
|
- netWeight: this.productList[0].netWeight, // 净重
|
|
|
- barcodes: item.barcodes || item.sendCode, // 发货条码
|
|
|
- clientCode: clientCode, // 客户代号
|
|
|
- materielDesignation:
|
|
|
- item.materielDesignation || item.extInfo?.materielCode, // 物料代号
|
|
|
- engrave: item.engrave || item.extInfo?.engrave, // 刻码
|
|
|
- isUnpack: this.productList[0].isUnpack, // 是否允许拆包
|
|
|
- productionDate: productionDate, // 生产日期
|
|
|
- purchaseDate: purchaseDate, // 采购时间
|
|
|
- result: 1, // 结果(1合格 2不合格)
|
|
|
- status: 2, // 状态(0=未质检 1待检 2已检)
|
|
|
- serialNumber: item.productSequence // 产品序号
|
|
|
- };
|
|
|
- // }
|
|
|
- });
|
|
|
- console.log(this.packingList, '包装明细列表');
|
|
|
- this.packingList.forEach((item) => {
|
|
|
- this.packingWeightCahnge('', item);
|
|
|
+ return {
|
|
|
+ index: this.isMoreProduct
|
|
|
+ ? this.productList.find(
|
|
|
+ (val) => val.categoryCode == item.productCode
|
|
|
+ ).index +
|
|
|
+ '-' +
|
|
|
+ index
|
|
|
+ : this.productList[0].index + '-' + index, // 包装索引
|
|
|
+ warehouseId:
|
|
|
+ item.warehouseId || this.productList[0].warehouseIds[index], // 仓库id
|
|
|
+ warehouseName:
|
|
|
+ item.warehouseName ||
|
|
|
+ this.productList[0].warehouseNames[index], // 仓库名称
|
|
|
+ categoryName:
|
|
|
+ item.productName || this.productList[0].categoryName, // 产品名称
|
|
|
+ categoryCode:
|
|
|
+ item.productCode || this.productList[0].categoryCode, // 产品编码
|
|
|
+ categoryModel:
|
|
|
+ item.modelType || this.productList[0].categoryModel, // 物品型号
|
|
|
+ specification:
|
|
|
+ item.specification || this.productList[0].specification, // 规格
|
|
|
+ brandNum: item.productBrand || this.productList[0].brandNum, // 牌号
|
|
|
+ colorKey:
|
|
|
+ (item.colorKey ? item.colorKey.split(',') : '') ||
|
|
|
+ this.productList[0].colorKey, // 颜色
|
|
|
+ modelKey:
|
|
|
+ (item.modelKey ? item.modelKey.split(',') : '') ||
|
|
|
+ this.productList[0].modelKey, // 机型
|
|
|
+ parentIndex: this.isMoreProduct
|
|
|
+ ? this.productList.find(
|
|
|
+ (val) => val.categoryCode == item.productCode
|
|
|
+ ).index
|
|
|
+ : this.productList[0].index, // 产品索引
|
|
|
+ batchNo: this.productList[0].batchNo, // 批次号
|
|
|
+ packageNo:
|
|
|
+ item.packageNo ||
|
|
|
+ item.packingCode ||
|
|
|
+ packingCodeList[index]?.onlyCode, // 包装编码
|
|
|
+ packingQuantity: 1, // 包装数量
|
|
|
+ packingUnit: item.packingUnit, // 单位
|
|
|
+ measureQuantity: item.quantity || item.measureQuantity, // 计量数量
|
|
|
+ measureUnit: item.measuringUnit || item.measureUnit, // 计量单位
|
|
|
+ supplierCode: item.supplierCode,
|
|
|
+ supplierId: item.supplierId,
|
|
|
+ supplierName: item.supplierName,
|
|
|
+ weight: item.packingWeight || 0, // 重量
|
|
|
+ singleWeight: item.singleWeight || 0,
|
|
|
+ pricingWay: item.pricingWay,
|
|
|
+ weightUnit: item.weightUnit || this.productList[0].weightUnit, // 重量单位
|
|
|
+ packingSpecificationOption: this.isMoreProduct
|
|
|
+ ? this.productList.find(
|
|
|
+ (val) => val.categoryCode == item.productCode
|
|
|
+ )?.packingSpecificationOption
|
|
|
+ : this.productList[0].packingSpecificationOption, // 包装规格
|
|
|
+
|
|
|
+ netWeight: this.productList[0].netWeight, // 净重
|
|
|
+ barcodes: item.barcodes || item.sendCode, // 发货条码
|
|
|
+ clientCode: clientCode, // 客户代号
|
|
|
+ materielDesignation:
|
|
|
+ item.materielDesignation || item.extInfo?.materielCode, // 物料代号
|
|
|
+ engrave: item.engrave || item.extInfo?.engrave, // 刻码
|
|
|
+ isUnpack: this.productList[0].isUnpack, // 是否允许拆包
|
|
|
+ productionDate: productionDate, // 生产日期
|
|
|
+ purchaseDate: purchaseDate, // 采购时间
|
|
|
+ result: 1, // 结果(1合格 2不合格)
|
|
|
+ status: 2, // 状态(0=未质检 1待检 2已检)
|
|
|
+ serialNumber: item.productSequence // 产品序号
|
|
|
+ };
|
|
|
+ // }
|
|
|
+ });
|
|
|
+ console.log(this.packingList, '包装明细列表');
|
|
|
+ this.packingList.forEach((item) => {
|
|
|
+ this.packingWeightCahnge('', item);
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
}
|
|
|
},
|
|
|
//获取计量数量
|