web,app,后端更改二维码唯一
This commit is contained in:
@@ -55,7 +55,7 @@
|
||||
<span class="info-value">{{ currentInfo.netWeight ? currentInfo.netWeight + ' t' : '—' }}</span>
|
||||
</div>
|
||||
<div class="info-row">
|
||||
<span class="info-label">目标库区:</span>
|
||||
<span class="info-label">逻辑库区:</span>
|
||||
<span class="info-value">{{ currentInfo.nextWarehouseName || '—' }}</span>
|
||||
</div>
|
||||
<div class="info-row" v-if="currentInfo.remark">
|
||||
@@ -122,8 +122,8 @@
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="目标库位" prop="warehouseId">
|
||||
<el-select v-model="updateForm.warehouseId" placeholder="请选择目标库区" style="width: 100%" filterable
|
||||
<el-form-item label="逻辑库区" prop="warehouseId">
|
||||
<el-select v-model="updateForm.warehouseId" placeholder="请选择逻辑库区" style="width: 100%" filterable
|
||||
:disabled="readonly">
|
||||
<el-option v-for="warehouse in warehouseList" :key="warehouse.warehouseId"
|
||||
:label="warehouse.warehouseName" :value="warehouse.warehouseId" />
|
||||
@@ -256,7 +256,7 @@ export default {
|
||||
{ type: 'number', message: '净重必须为数字', trigger: 'blur' }
|
||||
],
|
||||
warehouseId: [
|
||||
{ required: true, message: '请选择目标库区', trigger: 'change' }
|
||||
{ required: true, message: '请选择逻辑库区', trigger: 'change' }
|
||||
],
|
||||
actualWarehouseId: [
|
||||
{ required: true, message: '请选择真实库区', trigger: 'change' }
|
||||
@@ -279,12 +279,12 @@ export default {
|
||||
if (this.updateForm.itemType === 'raw_material') {
|
||||
return this.rawMaterialList.map(item => ({
|
||||
id: item.rawMaterialId,
|
||||
name: item.rawMaterialName
|
||||
name: this.formatItemName(item)
|
||||
}));
|
||||
} else if (this.updateForm.itemType === 'product') {
|
||||
return this.productList.map(item => ({
|
||||
id: item.productId,
|
||||
name: item.productName
|
||||
name: this.formatItemName(item)
|
||||
}));
|
||||
}
|
||||
return [];
|
||||
@@ -395,6 +395,49 @@ export default {
|
||||
return warehouse ? warehouse.warehouseName : '';
|
||||
},
|
||||
|
||||
// 格式化物品名称(添加规格和BOM信息)
|
||||
formatItemName(name, bomItems) {
|
||||
if (!name) return '';
|
||||
|
||||
let displayName = name;
|
||||
|
||||
// 如果有BOM参数,添加到名称后面
|
||||
if (bomItems && bomItems.length > 0) {
|
||||
const specs = [];
|
||||
|
||||
// 查找规格参数
|
||||
const specItem = bomItems.find(item =>
|
||||
item.attrKey === '规格' ||
|
||||
item.attrKey === 'spec' ||
|
||||
item.attrKey === '型号'
|
||||
);
|
||||
if (specItem && specItem.attrValue) {
|
||||
specs.push(specItem.attrValue);
|
||||
}
|
||||
|
||||
// 添加其他关键参数(最多3个)
|
||||
const otherParams = bomItems
|
||||
.filter(item =>
|
||||
item.attrKey !== '规格' &&
|
||||
item.attrKey !== 'spec' &&
|
||||
item.attrKey !== '型号'
|
||||
)
|
||||
.slice(0, 2); // 最多2个其他参数
|
||||
|
||||
otherParams.forEach(param => {
|
||||
if (param.attrValue) {
|
||||
specs.push(`${param.attrKey}:${param.attrValue}`);
|
||||
}
|
||||
});
|
||||
|
||||
if (specs.length > 0) {
|
||||
displayName += `(${specs.join(' ')})`;
|
||||
}
|
||||
}
|
||||
|
||||
return displayName;
|
||||
},
|
||||
|
||||
// 加载库区列表
|
||||
async loadWarehouses() {
|
||||
try {
|
||||
@@ -411,16 +454,26 @@ export default {
|
||||
// 加载物品列表(根据类型)
|
||||
async loadItemList(itemType) {
|
||||
if (!itemType) return;
|
||||
|
||||
|
||||
try {
|
||||
this.itemSearchLoading = true;
|
||||
if (itemType === 'raw_material') {
|
||||
const response = await listRawMaterial({ pageNum: 1, pageSize: 100 });
|
||||
// 使用带BOM的接口
|
||||
const response = await listRawMaterial({
|
||||
pageNum: 1,
|
||||
pageSize: 100,
|
||||
withBom: true // 请求包含BOM信息
|
||||
});
|
||||
if (response.code === 200) {
|
||||
this.rawMaterialList = response.rows || [];
|
||||
}
|
||||
} else if (itemType === 'product') {
|
||||
const response = await listProduct({ pageNum: 1, pageSize: 100 });
|
||||
// 使用带BOM的接口
|
||||
const response = await listProduct({
|
||||
pageNum: 1,
|
||||
pageSize: 100,
|
||||
withBom: true // 请求包含BOM信息
|
||||
});
|
||||
if (response.code === 200) {
|
||||
this.productList = response.rows || [];
|
||||
}
|
||||
@@ -432,29 +485,37 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
// 搜索物品
|
||||
// 搜索物品(支持名称和规格搜索)
|
||||
async searchItems(query) {
|
||||
if (!this.updateForm.itemType) {
|
||||
this.$message.warning('请先选择物品类型');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!query || query.trim() === '') {
|
||||
// 如果搜索为空,加载默认列表
|
||||
this.loadItemList(this.updateForm.itemType);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
this.itemSearchLoading = true;
|
||||
if (this.updateForm.itemType === 'raw_material') {
|
||||
const response = await listRawMaterial({
|
||||
rawMaterialName: query,
|
||||
pageNum: 1,
|
||||
pageSize: 50
|
||||
const response = await listRawMaterial({
|
||||
rawMaterialName: query, // 按名称搜索
|
||||
pageNum: 1,
|
||||
pageSize: 50,
|
||||
withBom: true
|
||||
});
|
||||
if (response.code === 200) {
|
||||
this.rawMaterialList = response.rows || [];
|
||||
}
|
||||
} else if (this.updateForm.itemType === 'product') {
|
||||
const response = await listProduct({
|
||||
productName: query,
|
||||
pageNum: 1,
|
||||
pageSize: 50
|
||||
const response = await listProduct({
|
||||
productName: query, // 按名称搜索
|
||||
pageNum: 1,
|
||||
pageSize: 50,
|
||||
withBom: true
|
||||
});
|
||||
if (response.code === 200) {
|
||||
this.productList = response.rows || [];
|
||||
@@ -534,24 +595,26 @@ export default {
|
||||
try {
|
||||
this.loading = true;
|
||||
|
||||
// 构造更新数据(使用标准update接口,会创建历史版本)
|
||||
// 构造更新数据(使用标准update接口,直接更新原记录)
|
||||
const updateData = {
|
||||
coilId: this.currentInfo.coilId,
|
||||
enterCoilNo: this.currentInfo.enterCoilNo, // 入场钢卷号,从当前信息获取(必填)
|
||||
supplierCoilNo: this.currentInfo.supplierCoilNo, // 厂家原料卷号(保持不变)
|
||||
enterCoilNo: this.currentInfo.enterCoilNo,
|
||||
supplierCoilNo: this.currentInfo.supplierCoilNo,
|
||||
currentCoilNo: this.updateForm.currentCoilNo,
|
||||
team: this.updateForm.team,
|
||||
itemType: this.updateForm.itemType,
|
||||
itemId: this.updateForm.itemId,
|
||||
grossWeight: this.updateForm.grossWeight,
|
||||
netWeight: this.updateForm.netWeight,
|
||||
// warehouseId: this.currentInfo.warehouseId, // 当前库区ID(保持不变)
|
||||
actualWarehouseId: this.updateForm.actualWarehouseId, // 真实库区ID
|
||||
warehouseId: this.updateForm.warehouseId, // 目标库区ID
|
||||
warehouseId: this.updateForm.warehouseId,
|
||||
actualWarehouseId: this.updateForm.actualWarehouseId,
|
||||
remark: this.updateForm.remark
|
||||
// 注意:不要传newCoils,否则会走批量更新逻辑
|
||||
};
|
||||
|
||||
|
||||
console.log('=== 正常更新操作 ===');
|
||||
console.log('提交的更新数据:', updateData);
|
||||
console.log('是否有newCoils:', updateData.newCoils);
|
||||
|
||||
const response = await updateMaterialCoil(updateData);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user