app三级后端修改
This commit is contained in:
@@ -70,11 +70,9 @@
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="操作类型" align="center" prop="actionType" width="100">
|
||||
<el-table-column label="操作类型" align="center" prop="actionType" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.actionType === 4 || scope.row.actionType === '4'">发货操作</span>
|
||||
<span v-else-if="scope.row.actionType === 5 || scope.row.actionType === '5'">移库操作</span>
|
||||
<dict-tag v-else :options="dict.type.action_type" :value="scope.row.actionType"/>
|
||||
<span>{{ getActionTypeText(scope.row.actionType) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
@@ -191,7 +189,7 @@
|
||||
<el-form-item label="操作类型" prop="actionType">
|
||||
<el-select v-model="form.actionType" placeholder="请选择操作类型">
|
||||
<el-option label="合卷" :value="1" />
|
||||
<el-option label="分卷" :value="2" />
|
||||
<el-option label="分条" :value="2" />
|
||||
<el-option label="更新" :value="3" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
@@ -398,27 +396,27 @@ export default {
|
||||
console.log('操作类型:', row.actionType);
|
||||
console.log('钢卷ID:', row.coilId);
|
||||
|
||||
const actionType = parseInt(row.actionType);
|
||||
|
||||
// 特殊处理:发货和移库操作不需要跳转
|
||||
if (row.actionType === 4 || row.actionType === '4') {
|
||||
this.$message.info('发货操作已在移动端完成');
|
||||
return;
|
||||
}
|
||||
if (row.actionType === 5 || row.actionType === '5') {
|
||||
this.$message.info('移库操作已在移动端完成');
|
||||
if (actionType === 4 || actionType === 5) {
|
||||
this.$message.info(actionType === 4 ? '发货操作已在移动端完成' : '移库操作已在移动端完成');
|
||||
return;
|
||||
}
|
||||
|
||||
// 根据操作类型跳转到不同页面
|
||||
let path = '';
|
||||
// 注意:action_type字典中 1=合卷, 2=分卷, 3=更新
|
||||
if (row.actionType === 1 || row.actionType === '1') {
|
||||
// 合卷
|
||||
path = '/wms/merge';
|
||||
} else if (row.actionType === 2 || row.actionType === '2') {
|
||||
// 分卷
|
||||
|
||||
// 分条操作:100-199
|
||||
if (actionType >= 100 && actionType <= 199) {
|
||||
path = '/wms/split';
|
||||
} else if (row.actionType === 3 || row.actionType === '3') {
|
||||
// 更新
|
||||
}
|
||||
// 合卷操作:200-299
|
||||
else if (actionType >= 200 && actionType <= 299) {
|
||||
path = '/wms/merge';
|
||||
}
|
||||
// 其他操作类型
|
||||
else if (actionType === 3) {
|
||||
path = '/wms/typing';
|
||||
}
|
||||
|
||||
@@ -497,6 +495,32 @@ export default {
|
||||
handleCoilSelect(coil) {
|
||||
this.form.coilId = coil.coilId;
|
||||
this.form.currentCoilNo = coil.currentCoilNo;
|
||||
},
|
||||
/** 获取操作类型文本 */
|
||||
getActionTypeText(actionType) {
|
||||
const type = parseInt(actionType);
|
||||
if (type >= 100 && type <= 199) {
|
||||
return '分条操作';
|
||||
} else if (type >= 200 && type <= 299) {
|
||||
return '合卷操作';
|
||||
} else if (type === 3) {
|
||||
return '更新信息';
|
||||
} else if (type === 4) {
|
||||
return '发货操作';
|
||||
} else if (type === 5) {
|
||||
return '移库操作';
|
||||
}
|
||||
return '未知操作';
|
||||
},
|
||||
/** 获取状态文本 */
|
||||
getStatusText(status) {
|
||||
const statusMap = {
|
||||
0: '待处理',
|
||||
1: '处理中',
|
||||
2: '已完成',
|
||||
3: '已取消'
|
||||
};
|
||||
return statusMap[status] || '未知';
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -147,22 +147,25 @@
|
||||
<el-form-item label="班组">
|
||||
<el-input v-model="targetCoil.team" placeholder="请输入班组名称" :disabled="readonly"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="物品类型">
|
||||
<el-select v-model="targetCoil.itemType" placeholder="请选择物品类型" style="width: 100%" :disabled="readonly">
|
||||
<el-option label="原材料" value="raw_material" />
|
||||
<el-option label="产品" value="product" />
|
||||
<el-form-item label="材料类型">
|
||||
<el-select v-model="targetCoil.materialType" placeholder="请选择材料类型" style="width: 100%" :disabled="readonly">
|
||||
<el-option label="原料" value="原料" />
|
||||
<el-option label="成品" value="成品" />
|
||||
<el-option label="废品" value="废品" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="物品">
|
||||
<!-- 物品类型由材料类型自动联动,隐藏此选择框 -->
|
||||
|
||||
<el-form-item :label="getItemLabel">
|
||||
<el-select
|
||||
v-model="targetCoil.itemId"
|
||||
placeholder="请选择物品"
|
||||
:placeholder="getItemPlaceholder"
|
||||
filterable
|
||||
remote
|
||||
:remote-method="searchItems"
|
||||
:loading="itemSearchLoading"
|
||||
style="width: 100%"
|
||||
:disabled="readonly"
|
||||
:disabled="readonly || !targetCoil.materialType"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in currentItemList"
|
||||
@@ -264,6 +267,7 @@ export default {
|
||||
targetCoil: {
|
||||
currentCoilNo: '',
|
||||
team: '',
|
||||
materialType: null,
|
||||
itemType: null,
|
||||
itemId: null,
|
||||
grossWeight: null,
|
||||
@@ -290,6 +294,26 @@ export default {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 动态显示标签
|
||||
getItemLabel() {
|
||||
if (this.targetCoil.materialType === '成品') {
|
||||
return '产品类型';
|
||||
} else if (this.targetCoil.materialType === '原料' || this.targetCoil.materialType === '废品') {
|
||||
return '原料类型';
|
||||
}
|
||||
return '物品';
|
||||
},
|
||||
// 动态显示占位符
|
||||
getItemPlaceholder() {
|
||||
if (this.targetCoil.materialType === '成品') {
|
||||
return '请选择产品类型';
|
||||
} else if (this.targetCoil.materialType === '原料') {
|
||||
return '请选择原料类型';
|
||||
} else if (this.targetCoil.materialType === '废品') {
|
||||
return '请选择原料类型(非必填)';
|
||||
}
|
||||
return '请先选择材料类型';
|
||||
},
|
||||
// 当前物品列表(根据物品类型动态切换)
|
||||
currentItemList() {
|
||||
if (this.targetCoil.itemType === 'raw_material') {
|
||||
@@ -307,18 +331,50 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 监听材料类型变化,自动设置物料类型
|
||||
'targetCoil.materialType'(newVal, oldVal) {
|
||||
console.log('🔥 merge.vue watch 触发! materialType 变化:', oldVal, '->', newVal);
|
||||
|
||||
// 先清空物品选择
|
||||
this.$set(this.targetCoil, 'itemId', null);
|
||||
|
||||
// 设置物料类型
|
||||
if (newVal === '成品') {
|
||||
this.$set(this.targetCoil, 'itemType', 'product');
|
||||
console.log('✅ 设置 itemType = product');
|
||||
} else if (newVal === '原料' || newVal === '废品') {
|
||||
this.$set(this.targetCoil, 'itemType', 'raw_material');
|
||||
console.log('✅ 设置 itemType = raw_material');
|
||||
}
|
||||
|
||||
console.log('📊 当前 targetCoil:', {
|
||||
materialType: this.targetCoil.materialType,
|
||||
itemType: this.targetCoil.itemType,
|
||||
itemId: this.targetCoil.itemId
|
||||
});
|
||||
|
||||
console.log('📦 数据列表:', {
|
||||
rawMaterialList: this.rawMaterialList.length,
|
||||
productList: this.productList.length
|
||||
});
|
||||
},
|
||||
// 监听物品类型变化,加载对应的列表
|
||||
'targetCoil.itemType'(newVal, oldVal) {
|
||||
if (newVal !== oldVal) {
|
||||
if (newVal !== oldVal && newVal) {
|
||||
this.targetCoil.itemId = null; // 清空物品ID
|
||||
this.loadItemList(newVal);
|
||||
}
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
console.log('🚀 merge.vue created 钩子执行');
|
||||
|
||||
// 加载库区列表
|
||||
await this.loadWarehouses();
|
||||
|
||||
// 🔥 页面加载时直接加载所有原料和产品列表
|
||||
await this.loadAllItems();
|
||||
|
||||
// 从路由参数获取coilId、actionId和readonly
|
||||
const coilId = this.$route.query.coilId;
|
||||
const actionId = this.$route.query.actionId;
|
||||
@@ -567,9 +623,38 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
// 页面加载时一次性加载所有原料和产品列表
|
||||
async loadAllItems() {
|
||||
console.log('🔥 merge.vue 开始加载所有物品列表');
|
||||
try {
|
||||
// 同时加载原料和产品
|
||||
const [rawMaterialRes, productRes] = await Promise.all([
|
||||
listRawMaterial({ pageNum: 1, pageSize: 99999, withBom: true }),
|
||||
listProduct({ pageNum: 1, pageSize: 99999, withBom: true })
|
||||
]);
|
||||
|
||||
if (rawMaterialRes.code === 200) {
|
||||
this.rawMaterialList = rawMaterialRes.rows || [];
|
||||
console.log('✅ merge.vue 原材料列表加载成功,数量:', this.rawMaterialList.length);
|
||||
}
|
||||
|
||||
if (productRes.code === 200) {
|
||||
this.productList = productRes.rows || [];
|
||||
console.log('✅ merge.vue 产品列表加载成功,数量:', this.productList.length);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('❌ merge.vue 加载物品列表失败', error);
|
||||
}
|
||||
},
|
||||
|
||||
// 加载物品列表(根据类型)
|
||||
async loadItemList(itemType) {
|
||||
if (!itemType) return;
|
||||
if (!itemType) {
|
||||
console.log('merge.vue loadItemList: itemType 为空');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('merge.vue 开始加载物品列表,类型:', itemType);
|
||||
|
||||
try {
|
||||
this.itemSearchLoading = true;
|
||||
@@ -579,8 +664,10 @@ export default {
|
||||
pageSize: 100,
|
||||
withBom: true
|
||||
});
|
||||
console.log('merge.vue 原材料列表响应:', response);
|
||||
if (response.code === 200) {
|
||||
this.rawMaterialList = response.rows || [];
|
||||
console.log('merge.vue 原材料列表加载成功,数量:', this.rawMaterialList.length);
|
||||
}
|
||||
} else if (itemType === 'product') {
|
||||
const response = await listProduct({
|
||||
@@ -588,12 +675,14 @@ export default {
|
||||
pageSize: 100,
|
||||
withBom: true
|
||||
});
|
||||
console.log('merge.vue 产品列表响应:', response);
|
||||
if (response.code === 200) {
|
||||
this.productList = response.rows || [];
|
||||
console.log('merge.vue 产品列表加载成功,数量:', this.productList.length);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载物品列表失败', error);
|
||||
console.error('merge.vue 加载物品列表失败', error);
|
||||
} finally {
|
||||
this.itemSearchLoading = false;
|
||||
}
|
||||
@@ -602,7 +691,7 @@ export default {
|
||||
// 搜索物品
|
||||
async searchItems(query) {
|
||||
if (!this.targetCoil.itemType) {
|
||||
this.$message.warning('请先选择物品类型');
|
||||
this.$message.warning('请先选择材料类型');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -745,6 +834,7 @@ export default {
|
||||
enterCoilNo: enterCoilNos, // 拼接的入场钢卷号
|
||||
currentCoilNo: this.targetCoil.currentCoilNo,
|
||||
team: this.targetCoil.team,
|
||||
materialType: this.targetCoil.materialType,
|
||||
itemType: this.targetCoil.itemType,
|
||||
itemId: this.targetCoil.itemId,
|
||||
grossWeight: this.targetCoil.grossWeight,
|
||||
|
||||
@@ -73,11 +73,7 @@
|
||||
<el-table-column label="厂家卷号" align="center" prop="supplierCoilNo" />
|
||||
<el-table-column label="逻辑库位" align="center" prop="warehouseName" v-if="!hideWarehouseQuery"/>
|
||||
<el-table-column label="实际库区" align="center" prop="actualWarehouseName" v-if="!hideWarehouseQuery"/>
|
||||
<el-table-column label="物料类型" align="center" prop="itemType">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.itemType == 'product' ? '成品' : '原料' }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="物料类型" align="center" prop="materialType"/>
|
||||
<el-table-column label="产品类型" align="center" prop="itemName">
|
||||
<template slot-scope="scope">
|
||||
<ProductInfo v-if="scope.row.itemType == 'product'" :productId="scope.row.itemId">
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
<div class="header-bar">
|
||||
<div class="header-title">
|
||||
<i class="el-icon-s-operation"></i>
|
||||
<span>钢卷分卷</span>
|
||||
<span>钢卷分条</span>
|
||||
</div>
|
||||
<div class="header-actions">
|
||||
<el-button v-if="!readonly" type="primary" size="small" @click="handleSave" :loading="loading">保存分卷</el-button>
|
||||
<el-button v-if="!readonly" type="primary" size="small" @click="handleSave" :loading="loading">保存分条</el-button>
|
||||
<el-button size="small" @click="handleCancel" :disabled="loading">{{ readonly ? '返回' : '取消' }}</el-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -115,7 +115,36 @@
|
||||
<el-input v-model="item.team" placeholder="输入班组名称" :disabled="readonly"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<MaterialSelect :hideType="hideType" :itemId.sync="item.itemId" :itemType.sync="item.itemType" />
|
||||
<el-form-item label="材料类型" required>
|
||||
<el-select v-model="item.materialType" placeholder="请选择材料类型" style="width: 100%" :disabled="readonly">
|
||||
<el-option label="原料" value="原料" />
|
||||
<el-option label="成品" value="成品" />
|
||||
<el-option label="废品" value="废品" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 物品类型由材料类型自动决定,不显示选择框 -->
|
||||
<el-form-item
|
||||
:label="getItemLabel(item.materialType)"
|
||||
:required="item.materialType !== '废品'">
|
||||
<el-select
|
||||
v-model="item.itemId"
|
||||
:placeholder="getItemPlaceholder(item.materialType)"
|
||||
filterable
|
||||
remote
|
||||
:remote-method="(query) => searchItemsForSplit(query, index)"
|
||||
:loading="itemSearchLoading"
|
||||
style="width: 100%"
|
||||
:disabled="readonly || !item.materialType"
|
||||
>
|
||||
<el-option
|
||||
v-for="option in getItemListForSplit(item.itemType)"
|
||||
:key="option.id"
|
||||
:label="option.name"
|
||||
:value="option.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="毛重(t)" required>
|
||||
<el-input
|
||||
@@ -195,14 +224,12 @@ import { listProduct } from '@/api/wms/product';
|
||||
import { completeAction } from '@/api/wms/pendingAction';
|
||||
import CoilSelector from '@/components/CoilSelector';
|
||||
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
|
||||
import MaterialSelect from "@/components/KLPService/MaterialSelect";
|
||||
|
||||
export default {
|
||||
name: 'SplitCoil',
|
||||
components: {
|
||||
CoilSelector,
|
||||
ActualWarehouseSelect,
|
||||
MaterialSelect
|
||||
ActualWarehouseSelect
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -227,6 +254,7 @@ export default {
|
||||
{
|
||||
currentCoilNo: '',
|
||||
team: '',
|
||||
materialType: null,
|
||||
itemType: null,
|
||||
itemId: null,
|
||||
grossWeight: null,
|
||||
@@ -253,9 +281,14 @@ export default {
|
||||
computed: {
|
||||
},
|
||||
async created() {
|
||||
console.log('🚀 split.vue created 钩子执行');
|
||||
|
||||
// 先加载库区列表
|
||||
await this.loadWarehouses();
|
||||
|
||||
// 🔥 页面加载时直接加载所有原料和产品列表
|
||||
await this.loadAllItems();
|
||||
|
||||
// 从路由参数获取coilId、actionId和readonly
|
||||
const coilId = this.$route.query.coilId;
|
||||
const actionId = this.$route.query.actionId;
|
||||
@@ -275,20 +308,107 @@ export default {
|
||||
this.readonly = true;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 深度监听子卷列表中每个元素的 materialType 变化
|
||||
splitList: {
|
||||
handler(newList, oldList) {
|
||||
console.log('🔥 split.vue watch 触发! splitList 变化', {
|
||||
newList: newList.map(i => ({materialType: i.materialType, itemType: i.itemType})),
|
||||
oldList: oldList?.map(i => ({materialType: i.materialType, itemType: i.itemType}))
|
||||
});
|
||||
|
||||
newList.forEach((item, index) => {
|
||||
// 检查 materialType 是否变化
|
||||
const oldItem = oldList && oldList[index];
|
||||
const materialTypeChanged = !oldItem || oldItem.materialType !== item.materialType;
|
||||
|
||||
// 检查 itemType 是否需要设置(materialType有值但itemType为空)
|
||||
const needSetItemType = item.materialType && !item.itemType;
|
||||
|
||||
console.log(`👀 子卷${index} 检查:`, {
|
||||
materialTypeChanged,
|
||||
needSetItemType,
|
||||
'oldItem?.materialType': oldItem?.materialType,
|
||||
'item.materialType': item.materialType,
|
||||
'item.itemType': item.itemType
|
||||
});
|
||||
|
||||
if (materialTypeChanged) {
|
||||
console.log(`🔥 split.vue 子卷${index} materialType 变化:`, oldItem?.materialType, '->', item.materialType);
|
||||
}
|
||||
|
||||
// 如果 materialType 变化了,或者 itemType 需要设置
|
||||
if ((materialTypeChanged || needSetItemType) && item.materialType) {
|
||||
// 使用 Vue.set 确保响应式更新
|
||||
this.$set(item, 'itemId', null);
|
||||
|
||||
// 设置物料类型
|
||||
if (item.materialType === '成品') {
|
||||
this.$set(item, 'itemType', 'product');
|
||||
console.log(`✅ 子卷${index} 使用$set设置 itemType = product`);
|
||||
} else if (item.materialType === '原料' || item.materialType === '废品') {
|
||||
this.$set(item, 'itemType', 'raw_material');
|
||||
console.log(`✅ 子卷${index} 使用$set设置 itemType = raw_material`);
|
||||
}
|
||||
|
||||
console.log(`📊 子卷${index} 当前状态:`, {
|
||||
materialType: item.materialType,
|
||||
itemType: item.itemType,
|
||||
itemId: item.itemId
|
||||
});
|
||||
|
||||
// 验证数据是否正确
|
||||
console.log(`📦 原材料列表数量:`, this.rawMaterialList.length);
|
||||
console.log(`📦 产品列表数量:`, this.productList.length);
|
||||
}
|
||||
});
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 动态获取标签
|
||||
getItemLabel(materialType) {
|
||||
if (materialType === '成品') {
|
||||
return '产品类型';
|
||||
} else if (materialType === '原料' || materialType === '废品') {
|
||||
return '原料类型';
|
||||
}
|
||||
return '物品';
|
||||
},
|
||||
// 动态获取占位符
|
||||
getItemPlaceholder(materialType) {
|
||||
if (materialType === '成品') {
|
||||
return '请选择产品类型';
|
||||
} else if (materialType === '原料') {
|
||||
return '请选择原料类型';
|
||||
} else if (materialType === '废品') {
|
||||
return '请选择原料类型(非必填)';
|
||||
}
|
||||
return '请先选择材料类型';
|
||||
},
|
||||
// 获取子卷的物品列表
|
||||
getItemListForSplit(itemType) {
|
||||
console.log(`📋 getItemListForSplit 被调用,itemType:`, itemType);
|
||||
console.log(`📋 rawMaterialList 长度:`, this.rawMaterialList?.length);
|
||||
console.log(`📋 productList 长度:`, this.productList?.length);
|
||||
|
||||
if (itemType === 'raw_material') {
|
||||
return this.rawMaterialList.map(item => ({
|
||||
const list = this.rawMaterialList.map(item => ({
|
||||
id: item.rawMaterialId,
|
||||
name: this.formatItemName(item)
|
||||
}));
|
||||
console.log(`📋 返回原材料列表,数量:`, list.length);
|
||||
return list;
|
||||
} else if (itemType === 'product') {
|
||||
return this.productList.map(item => ({
|
||||
const list = this.productList.map(item => ({
|
||||
id: item.productId,
|
||||
name: this.formatItemName(item)
|
||||
}));
|
||||
console.log(`📋 返回产品列表,数量:`, list.length);
|
||||
return list;
|
||||
}
|
||||
console.log(`📋 返回空列表`);
|
||||
return [];
|
||||
},
|
||||
|
||||
@@ -335,9 +455,17 @@ export default {
|
||||
|
||||
// 搜索子卷物品
|
||||
async searchItemsForSplit(query, index) {
|
||||
const itemType = this.splitList[index].itemType;
|
||||
const item = this.splitList[index];
|
||||
console.log(`🔍 searchItemsForSplit 调用,子卷${index}:`, {
|
||||
materialType: item.materialType,
|
||||
itemType: item.itemType,
|
||||
query: query
|
||||
});
|
||||
|
||||
const itemType = item.itemType;
|
||||
if (!itemType) {
|
||||
this.$message.warning('请先选择物品类型');
|
||||
console.log(`❌ 子卷${index} itemType 为空!`);
|
||||
this.$message.warning('请先选择材料类型');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -376,9 +504,38 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
// 页面加载时一次性加载所有原料和产品列表
|
||||
async loadAllItems() {
|
||||
console.log('🔥 split.vue 开始加载所有物品列表');
|
||||
try {
|
||||
// 同时加载原料和产品
|
||||
const [rawMaterialRes, productRes] = await Promise.all([
|
||||
listRawMaterial({ pageNum: 1, pageSize: 99999, withBom: true }),
|
||||
listProduct({ pageNum: 1, pageSize: 99999, withBom: true })
|
||||
]);
|
||||
|
||||
if (rawMaterialRes.code === 200) {
|
||||
this.rawMaterialList = rawMaterialRes.rows || [];
|
||||
console.log('✅ split.vue 原材料列表加载成功,数量:', this.rawMaterialList.length);
|
||||
}
|
||||
|
||||
if (productRes.code === 200) {
|
||||
this.productList = productRes.rows || [];
|
||||
console.log('✅ split.vue 产品列表加载成功,数量:', this.productList.length);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('❌ split.vue 加载物品列表失败', error);
|
||||
}
|
||||
},
|
||||
|
||||
// 加载子卷物品列表
|
||||
async loadItemListForSplit(itemType) {
|
||||
if (!itemType) return;
|
||||
if (!itemType) {
|
||||
console.log('loadItemListForSplit: itemType 为空');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('split.vue 开始加载物品列表,类型:', itemType);
|
||||
|
||||
try {
|
||||
this.itemSearchLoading = true;
|
||||
@@ -388,8 +545,10 @@ export default {
|
||||
pageSize: 100,
|
||||
withBom: true
|
||||
});
|
||||
console.log('split.vue 原材料列表响应:', response);
|
||||
if (response.code === 200) {
|
||||
this.rawMaterialList = response.rows || [];
|
||||
console.log('split.vue 原材料列表加载成功,数量:', this.rawMaterialList.length);
|
||||
}
|
||||
} else if (itemType === 'product') {
|
||||
const response = await listProduct({
|
||||
@@ -397,12 +556,14 @@ export default {
|
||||
pageSize: 100,
|
||||
withBom: true
|
||||
});
|
||||
console.log('split.vue 产品列表响应:', response);
|
||||
if (response.code === 200) {
|
||||
this.productList = response.rows || [];
|
||||
console.log('split.vue 产品列表加载成功,数量:', this.productList.length);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('加载物品列表失败', error);
|
||||
console.error('split.vue 加载物品列表失败', error);
|
||||
} finally {
|
||||
this.itemSearchLoading = false;
|
||||
}
|
||||
@@ -482,6 +643,7 @@ export default {
|
||||
this.splitList.push({
|
||||
currentCoilNo: '',
|
||||
team: '',
|
||||
materialType: null,
|
||||
itemType: null,
|
||||
itemId: null,
|
||||
grossWeight: null,
|
||||
@@ -500,7 +662,7 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
// 保存分卷
|
||||
// 保存分条
|
||||
async handleSave() {
|
||||
// 验证母卷信息
|
||||
if (!this.motherCoil.coilId) {
|
||||
@@ -549,23 +711,24 @@ export default {
|
||||
|
||||
const loadingInstance = this.$loading({
|
||||
lock: true,
|
||||
text: '正在分卷,请稍后...',
|
||||
text: '正在分条,请稍后...',
|
||||
background: 'rgba(0, 0, 0, 0.7)'
|
||||
})
|
||||
|
||||
try {
|
||||
this.loading = true;
|
||||
|
||||
// 构造分卷数据
|
||||
// 构造分条数据
|
||||
const splitData = {
|
||||
coilId: this.motherCoil.coilId,
|
||||
enterCoilNo: this.motherCoil.enterCoilNo, // 入场钢卷号(必填)
|
||||
currentCoilNo: this.motherCoil.currentCoilNo,
|
||||
hasMergeSplit: 1, // 1表示分卷
|
||||
hasMergeSplit: 1, // 1表示分条
|
||||
newCoils: this.splitList.map(item => ({
|
||||
enterCoilNo: this.motherCoil.enterCoilNo, // 子卷继承母卷的入场钢卷号
|
||||
currentCoilNo: item.currentCoilNo,
|
||||
team: item.team,
|
||||
materialType: item.materialType,
|
||||
itemType: item.itemType || this.motherCoil.itemType,
|
||||
itemId: item.itemId || this.motherCoil.itemId,
|
||||
grossWeight: item.grossWeight,
|
||||
@@ -576,11 +739,11 @@ export default {
|
||||
}))
|
||||
};
|
||||
|
||||
console.log('提交的分卷数据:', splitData);
|
||||
console.log('提交的分条数据:', splitData);
|
||||
|
||||
const response = await splitMaterialCoil(splitData);
|
||||
if (response.code === 200) {
|
||||
this.$message.success('分卷保存成功');
|
||||
this.$message.success('分条保存成功');
|
||||
|
||||
// 如果是从待操作列表进来的,标记操作为完成
|
||||
if (this.actionId) {
|
||||
@@ -592,11 +755,11 @@ export default {
|
||||
this.$router.back();
|
||||
}, 1000);
|
||||
} else {
|
||||
this.$message.error(response.msg || '分卷保存失败');
|
||||
this.$message.error(response.msg || '分条保存失败');
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
this.$message.error('分卷保存失败');
|
||||
this.$message.error('分条保存失败');
|
||||
console.error(error);
|
||||
} finally {
|
||||
this.loading = false;
|
||||
@@ -628,13 +791,7 @@ export default {
|
||||
item.team = this.motherCoil.team;
|
||||
}
|
||||
|
||||
// 复制物品类型和物品ID
|
||||
if (!item.itemType) {
|
||||
item.itemType = this.motherCoil.itemType;
|
||||
}
|
||||
if (!item.itemId) {
|
||||
item.itemId = this.motherCoil.itemId;
|
||||
}
|
||||
// 不复制 itemType 和 itemId,让它们由 materialType 自动决定
|
||||
});
|
||||
|
||||
// 加载物品列表
|
||||
|
||||
@@ -93,20 +93,37 @@
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item label="物品类型" prop="itemType">
|
||||
<el-select v-model="updateForm.itemType" placeholder="请选择物品类型" style="width: 100%" :disabled="readonly">
|
||||
<el-option label="原材料" value="raw_material" />
|
||||
<el-option label="产品" value="product" />
|
||||
<el-form-item label="材料类型" prop="materialType">
|
||||
<el-select
|
||||
v-model="updateForm.materialType"
|
||||
placeholder="请选择材料类型"
|
||||
style="width: 100%"
|
||||
:disabled="readonly"
|
||||
@change="handleMaterialTypeChange">
|
||||
<el-option label="原料" value="原料" />
|
||||
<el-option label="成品" value="成品" />
|
||||
<el-option label="废品" value="废品" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="物品" prop="itemId">
|
||||
<el-select v-model="updateForm.itemId" placeholder="请选择物品" filterable remote :remote-method="searchItems"
|
||||
:loading="itemSearchLoading" style="width: 100%" :disabled="readonly">
|
||||
<!-- 物品类型由材料类型自动决定,不显示选择框 -->
|
||||
|
||||
<el-form-item
|
||||
:label="getItemLabel"
|
||||
:prop="updateForm.materialType === '废品' ? '' : 'itemId'"
|
||||
:rules="updateForm.materialType === '废品' ? [] : rules.itemId">
|
||||
<el-select
|
||||
v-model="updateForm.itemId"
|
||||
:placeholder="getItemPlaceholder"
|
||||
filterable
|
||||
remote
|
||||
:remote-method="searchItems"
|
||||
:loading="itemSearchLoading"
|
||||
style="width: 100%"
|
||||
:disabled="readonly || !updateForm.materialType">
|
||||
<el-option v-for="item in currentItemList" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<MaterialSelect :hideType="hideType" :itemId.sync="updateForm.itemId" :itemType.sync="updateForm.itemType" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="毛重(t)" prop="grossWeight">
|
||||
<el-input v-model.number="updateForm.grossWeight" placeholder="请输入毛重" type="number" step="0.01"
|
||||
@@ -192,13 +209,11 @@ import { listWarehouse } from '@/api/wms/warehouse';
|
||||
import { listRawMaterial } from '@/api/wms/rawMaterial';
|
||||
import { listProduct } from '@/api/wms/product';
|
||||
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
|
||||
import MaterialSelect from "@/components/KLPService/MaterialSelect";
|
||||
|
||||
export default {
|
||||
name: 'TypingCoil',
|
||||
components: {
|
||||
ActualWarehouseSelect,
|
||||
MaterialSelect
|
||||
ActualWarehouseSelect
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -226,6 +241,7 @@ export default {
|
||||
updateForm: {
|
||||
currentCoilNo: '',
|
||||
team: '',
|
||||
materialType: null,
|
||||
itemType: null,
|
||||
itemId: null,
|
||||
grossWeight: null,
|
||||
@@ -241,6 +257,9 @@ export default {
|
||||
team: [
|
||||
{ required: true, message: '请输入班组', trigger: 'blur' }
|
||||
],
|
||||
materialType: [
|
||||
{ required: true, message: '请选择材料类型', trigger: 'change' }
|
||||
],
|
||||
itemType: [
|
||||
{ required: true, message: '请选择物品类型', trigger: 'change' }
|
||||
],
|
||||
@@ -274,6 +293,26 @@ export default {
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 动态显示标签
|
||||
getItemLabel() {
|
||||
if (this.updateForm.materialType === '成品') {
|
||||
return '产品类型';
|
||||
} else if (this.updateForm.materialType === '原料' || this.updateForm.materialType === '废品') {
|
||||
return '原料类型';
|
||||
}
|
||||
return '物品';
|
||||
},
|
||||
// 动态显示占位符
|
||||
getItemPlaceholder() {
|
||||
if (this.updateForm.materialType === '成品') {
|
||||
return '请选择产品类型';
|
||||
} else if (this.updateForm.materialType === '原料') {
|
||||
return '请选择原料类型';
|
||||
} else if (this.updateForm.materialType === '废品') {
|
||||
return '请选择原料类型(非必填)';
|
||||
}
|
||||
return '请先选择材料类型';
|
||||
},
|
||||
// 当前物品列表(根据物品类型动态切换)
|
||||
currentItemList() {
|
||||
if (this.updateForm.itemType === 'raw_material') {
|
||||
@@ -291,18 +330,50 @@ export default {
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 监听材料类型变化,自动设置物料类型
|
||||
'updateForm.materialType'(newVal, oldVal) {
|
||||
console.log('🔥 typing.vue watch 触发! materialType 变化:', oldVal, '->', newVal);
|
||||
|
||||
// 先清空物品选择
|
||||
this.$set(this.updateForm, 'itemId', null);
|
||||
|
||||
// 设置物料类型
|
||||
if (newVal === '成品') {
|
||||
this.$set(this.updateForm, 'itemType', 'product');
|
||||
console.log('✅ 设置 itemType = product');
|
||||
} else if (newVal === '原料' || newVal === '废品') {
|
||||
this.$set(this.updateForm, 'itemType', 'raw_material');
|
||||
console.log('✅ 设置 itemType = raw_material');
|
||||
}
|
||||
|
||||
console.log('📊 当前 updateForm:', {
|
||||
materialType: this.updateForm.materialType,
|
||||
itemType: this.updateForm.itemType,
|
||||
itemId: this.updateForm.itemId
|
||||
});
|
||||
|
||||
console.log('📦 数据列表:', {
|
||||
rawMaterialList: this.rawMaterialList.length,
|
||||
productList: this.productList.length
|
||||
});
|
||||
},
|
||||
// 监听物品类型变化,加载对应的列表
|
||||
'updateForm.itemType'(newVal, oldVal) {
|
||||
if (newVal !== oldVal) {
|
||||
if (newVal !== oldVal && newVal) {
|
||||
this.updateForm.itemId = null;
|
||||
this.loadItemList(newVal);
|
||||
}
|
||||
}
|
||||
},
|
||||
async created() {
|
||||
console.log('🚀 typing.vue created 钩子执行');
|
||||
|
||||
// 先加载库区列表
|
||||
await this.loadWarehouses();
|
||||
|
||||
// 🔥 页面加载时直接加载所有原料和产品列表
|
||||
await this.loadAllItems();
|
||||
|
||||
// 从路由参数获取coilId和actionId
|
||||
const coilId = this.$route.query.coilId;
|
||||
const actionId = this.$route.query.actionId;
|
||||
@@ -451,9 +522,38 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
// 页面加载时一次性加载所有原料和产品列表
|
||||
async loadAllItems() {
|
||||
console.log('🔥 开始加载所有物品列表');
|
||||
try {
|
||||
// 同时加载原料和产品
|
||||
const [rawMaterialRes, productRes] = await Promise.all([
|
||||
listRawMaterial({ pageNum: 1, pageSize: 99999, withBom: true }),
|
||||
listProduct({ pageNum: 1, pageSize: 99999, withBom: true })
|
||||
]);
|
||||
|
||||
if (rawMaterialRes.code === 200) {
|
||||
this.rawMaterialList = rawMaterialRes.rows || [];
|
||||
console.log('✅ 原材料列表加载成功,数量:', this.rawMaterialList.length);
|
||||
}
|
||||
|
||||
if (productRes.code === 200) {
|
||||
this.productList = productRes.rows || [];
|
||||
console.log('✅ 产品列表加载成功,数量:', this.productList.length);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('❌ 加载物品列表失败', error);
|
||||
}
|
||||
},
|
||||
|
||||
// 加载物品列表(根据类型)
|
||||
async loadItemList(itemType) {
|
||||
if (!itemType) return;
|
||||
if (!itemType) {
|
||||
console.log('loadItemList: itemType 为空');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('开始加载物品列表,类型:', itemType);
|
||||
|
||||
try {
|
||||
this.itemSearchLoading = true;
|
||||
@@ -464,8 +564,10 @@ export default {
|
||||
pageSize: 100,
|
||||
withBom: true // 请求包含BOM信息
|
||||
});
|
||||
console.log('原材料列表响应:', response);
|
||||
if (response.code === 200) {
|
||||
this.rawMaterialList = response.rows || [];
|
||||
console.log('原材料列表加载成功,数量:', this.rawMaterialList.length);
|
||||
}
|
||||
} else if (itemType === 'product') {
|
||||
// 使用带BOM的接口
|
||||
@@ -474,8 +576,10 @@ export default {
|
||||
pageSize: 100,
|
||||
withBom: true // 请求包含BOM信息
|
||||
});
|
||||
console.log('产品列表响应:', response);
|
||||
if (response.code === 200) {
|
||||
this.productList = response.rows || [];
|
||||
console.log('产品列表加载成功,数量:', this.productList.length);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -488,7 +592,7 @@ export default {
|
||||
// 搜索物品(支持名称和规格搜索)
|
||||
async searchItems(query) {
|
||||
if (!this.updateForm.itemType) {
|
||||
this.$message.warning('请先选择物品类型');
|
||||
this.$message.warning('请先选择材料类型');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -561,8 +665,10 @@ export default {
|
||||
this.updateForm = {
|
||||
currentCoilNo: this.currentInfo.currentCoilNo,
|
||||
team: this.currentInfo.team,
|
||||
itemType: this.currentInfo.itemType,
|
||||
itemId: this.currentInfo.itemId,
|
||||
materialType: this.currentInfo.materialType,
|
||||
// 不复制 itemType 和 itemId,让它们由 materialType 自动决定
|
||||
itemType: null,
|
||||
itemId: null,
|
||||
grossWeight: parseFloat(this.currentInfo.grossWeight) || null,
|
||||
netWeight: parseFloat(this.currentInfo.netWeight) || null,
|
||||
warehouseId: this.currentInfo.warehouseId,
|
||||
@@ -571,11 +677,7 @@ export default {
|
||||
|
||||
console.log('复制的表单数据:', this.updateForm);
|
||||
|
||||
// 加载对应的物品列表
|
||||
if (this.updateForm.itemType) {
|
||||
this.loadItemList(this.updateForm.itemType);
|
||||
}
|
||||
|
||||
// materialType 会触发 watch,自动设置 itemType 并加载物品列表
|
||||
this.$message.success('已复制当前信息');
|
||||
},
|
||||
|
||||
@@ -602,6 +704,7 @@ export default {
|
||||
supplierCoilNo: this.currentInfo.supplierCoilNo,
|
||||
currentCoilNo: this.updateForm.currentCoilNo,
|
||||
team: this.updateForm.team,
|
||||
materialType: this.updateForm.materialType,
|
||||
itemType: this.updateForm.itemType,
|
||||
itemId: this.updateForm.itemId,
|
||||
grossWeight: this.updateForm.grossWeight,
|
||||
|
||||
@@ -558,8 +558,13 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
// 继承原钢卷的基本信息(强制继承,不能修改的字段)
|
||||
newCoil.setEnterCoilNo(oldCoil.getEnterCoilNo());
|
||||
newCoil.setSupplierCoilNo(oldCoil.getSupplierCoilNo()); // 保留厂家原料卷号
|
||||
newCoil.setItemType(oldCoil.getItemType());
|
||||
newCoil.setItemId(oldCoil.getItemId());
|
||||
// materialType, itemType 和 itemId 使用前端传递的值,不强制继承
|
||||
if (newCoil.getItemType() == null) {
|
||||
newCoil.setItemType(oldCoil.getItemType());
|
||||
}
|
||||
if (newCoil.getItemId() == null) {
|
||||
newCoil.setItemId(oldCoil.getItemId());
|
||||
}
|
||||
// 如果前端没传team,使用原钢卷的team
|
||||
if (newCoil.getTeam() == null) {
|
||||
newCoil.setTeam(oldCoil.getTeam());
|
||||
|
||||
@@ -68,6 +68,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
mc.current_coil_no,
|
||||
mc.supplier_coil_no,
|
||||
mc.data_type,
|
||||
mc.material_type,
|
||||
mc.next_warehouse_id,
|
||||
mc.qrcode_record_id,
|
||||
mc.team,
|
||||
|
||||
Reference in New Issue
Block a user