Merge branch '0.8.X' of https://gitee.com/hdka/klp-oa into 0.8.X
This commit is contained in:
@@ -61,7 +61,7 @@ public class SysDictDataController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@SaCheckPermission("system:dict:query")
|
@SaCheckPermission("system:dict:query")
|
||||||
@GetMapping(value = "/{dictCode}")
|
@GetMapping(value = "/{dictCode}")
|
||||||
public R<SysDictData> getInfo(@PathVariable Long dictCode) {
|
public R<SysDictData> getInfo(@PathVariable("dictCode") Long dictCode) {
|
||||||
return R.ok(dictDataService.selectDictDataById(dictCode));
|
return R.ok(dictDataService.selectDictDataById(dictCode));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ public class SysDictDataController extends BaseController {
|
|||||||
* @param dictType 字典类型
|
* @param dictType 字典类型
|
||||||
*/
|
*/
|
||||||
@GetMapping(value = "/type/{dictType}")
|
@GetMapping(value = "/type/{dictType}")
|
||||||
public R<List<SysDictData>> dictType(@PathVariable String dictType) {
|
public R<List<SysDictData>> dictType(@PathVariable("dictType") String dictType) {
|
||||||
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
|
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
|
||||||
if (ObjectUtil.isNull(data)) {
|
if (ObjectUtil.isNull(data)) {
|
||||||
data = new ArrayList<>();
|
data = new ArrayList<>();
|
||||||
@@ -109,7 +109,7 @@ public class SysDictDataController extends BaseController {
|
|||||||
@SaCheckPermission("system:dict:remove")
|
@SaCheckPermission("system:dict:remove")
|
||||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{dictCodes}")
|
@DeleteMapping("/{dictCodes}")
|
||||||
public R<Void> remove(@PathVariable Long[] dictCodes) {
|
public R<Void> remove(@PathVariable("dictCodes") Long[] dictCodes) {
|
||||||
dictDataService.deleteDictDataByIds(dictCodes);
|
dictDataService.deleteDictDataByIds(dictCodes);
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,13 +44,32 @@
|
|||||||
<span class="detail-value">{{ item.enterCoilNo || '—' }}</span>
|
<span class="detail-value">{{ item.enterCoilNo || '—' }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="source-detail-row">
|
<div class="source-detail-row">
|
||||||
<span class="detail-label">当前库区:</span>
|
<span class="detail-label">逻辑库区:</span>
|
||||||
<span class="detail-value">{{ item.warehouseName || '未分配' }}</span>
|
<span class="detail-value">{{ item.warehouseName || '—' }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="source-detail-row" v-if="item.materialName || item.productName">
|
<div class="source-detail-row">
|
||||||
|
<span class="detail-label">真实库区:</span>
|
||||||
|
<span class="detail-value">{{ item.actualWarehouseName || '—' }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="source-detail-row">
|
||||||
<span class="detail-label">物料名称:</span>
|
<span class="detail-label">物料名称:</span>
|
||||||
<span class="detail-value">{{ item.materialName || item.productName || '—' }}</span>
|
<span class="detail-value">{{ item.materialName || item.productName || '—' }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="source-detail-row" v-if="item.specification">
|
||||||
|
<span class="detail-label">物料规格:</span>
|
||||||
|
<span class="detail-value">{{ item.specification }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- BOM参数展示 -->
|
||||||
|
<template v-if="item.bomItems && item.bomItems.length > 0">
|
||||||
|
<div class="source-detail-divider">BOM参数</div>
|
||||||
|
<div class="source-bom-params">
|
||||||
|
<div class="source-bom-item" v-for="(param, idx) in item.bomItems.slice(0, 3)" :key="idx">
|
||||||
|
<span class="bom-key">{{ param.attrKey }}:</span>
|
||||||
|
<span class="bom-value">{{ param.attrValue }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 第二个位置:显示待合卷列表 -->
|
<!-- 第二个位置:显示待合卷列表 -->
|
||||||
@@ -128,8 +147,31 @@
|
|||||||
<el-form-item label="班组">
|
<el-form-item label="班组">
|
||||||
<el-input v-model="targetCoil.team" placeholder="请输入班组名称" :disabled="readonly"></el-input>
|
<el-input v-model="targetCoil.team" placeholder="请输入班组名称" :disabled="readonly"></el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="物品类型">
|
||||||
<MaterialSelect :hideType="hideType" :itemId.sync="targetCoil.itemId" :itemType.sync="targetCoil.itemType" />
|
<el-select v-model="targetCoil.itemType" placeholder="请选择物品类型" style="width: 100%" :disabled="readonly">
|
||||||
|
<el-option label="原材料" value="raw_material" />
|
||||||
|
<el-option label="产品" value="product" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="物品">
|
||||||
|
<el-select
|
||||||
|
v-model="targetCoil.itemId"
|
||||||
|
placeholder="请选择物品"
|
||||||
|
filterable
|
||||||
|
remote
|
||||||
|
:remote-method="searchItems"
|
||||||
|
:loading="itemSearchLoading"
|
||||||
|
style="width: 100%"
|
||||||
|
:disabled="readonly"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in currentItemList"
|
||||||
|
:key="item.id"
|
||||||
|
:label="item.name"
|
||||||
|
:value="item.id"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="毛重(t)">
|
<el-form-item label="毛重(t)">
|
||||||
<el-input
|
<el-input
|
||||||
@@ -153,8 +195,8 @@
|
|||||||
<template slot="append">吨</template>
|
<template slot="append">吨</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="目标库位">
|
<el-form-item label="逻辑库区">
|
||||||
<el-select v-model="targetCoil.warehouseId" placeholder="请选择" style="width: 100%" clearable :disabled="readonly">
|
<el-select v-model="targetCoil.warehouseId" placeholder="请选择逻辑库区" style="width: 100%" filterable :disabled="readonly">
|
||||||
<el-option
|
<el-option
|
||||||
v-for="warehouse in warehouseList"
|
v-for="warehouse in warehouseList"
|
||||||
:key="warehouse.warehouseId"
|
:key="warehouse.warehouseId"
|
||||||
@@ -207,14 +249,12 @@ import { listProduct } from '@/api/wms/product';
|
|||||||
import { listPendingAction, completeAction } from '@/api/wms/pendingAction';
|
import { listPendingAction, completeAction } from '@/api/wms/pendingAction';
|
||||||
import CoilSelector from '@/components/CoilSelector';
|
import CoilSelector from '@/components/CoilSelector';
|
||||||
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
|
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
|
||||||
import MaterialSelect from "@/components/KLPService/MaterialSelect";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'MergeCoil',
|
name: 'MergeCoil',
|
||||||
components: {
|
components: {
|
||||||
CoilSelector,
|
CoilSelector,
|
||||||
ActualWarehouseSelect,
|
ActualWarehouseSelect
|
||||||
MaterialSelect
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -255,12 +295,12 @@ export default {
|
|||||||
if (this.targetCoil.itemType === 'raw_material') {
|
if (this.targetCoil.itemType === 'raw_material') {
|
||||||
return this.rawMaterialList.map(item => ({
|
return this.rawMaterialList.map(item => ({
|
||||||
id: item.rawMaterialId,
|
id: item.rawMaterialId,
|
||||||
name: item.rawMaterialName
|
name: this.formatItemName(item)
|
||||||
}));
|
}));
|
||||||
} else if (this.targetCoil.itemType === 'product') {
|
} else if (this.targetCoil.itemType === 'product') {
|
||||||
return this.productList.map(item => ({
|
return this.productList.map(item => ({
|
||||||
id: item.productId,
|
id: item.productId,
|
||||||
name: item.productName
|
name: this.formatItemName(item)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
@@ -309,8 +349,11 @@ export default {
|
|||||||
itemType: null,
|
itemType: null,
|
||||||
itemId: null,
|
itemId: null,
|
||||||
warehouseName: '',
|
warehouseName: '',
|
||||||
|
actualWarehouseName: '',
|
||||||
materialName: '',
|
materialName: '',
|
||||||
productName: ''
|
productName: '',
|
||||||
|
specification: '',
|
||||||
|
bomItems: []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
coilId: null,
|
coilId: null,
|
||||||
@@ -319,8 +362,11 @@ export default {
|
|||||||
itemType: null,
|
itemType: null,
|
||||||
itemId: null,
|
itemId: null,
|
||||||
warehouseName: '',
|
warehouseName: '',
|
||||||
|
actualWarehouseName: '',
|
||||||
materialName: '',
|
materialName: '',
|
||||||
productName: ''
|
productName: '',
|
||||||
|
specification: '',
|
||||||
|
bomItems: []
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -343,8 +389,11 @@ export default {
|
|||||||
itemType: data.itemType,
|
itemType: data.itemType,
|
||||||
itemId: data.itemId,
|
itemId: data.itemId,
|
||||||
warehouseName: data.warehouseName || (data.warehouse ? data.warehouse.warehouseName : ''),
|
warehouseName: data.warehouseName || (data.warehouse ? data.warehouse.warehouseName : ''),
|
||||||
|
actualWarehouseName: data.actualWarehouseName || (data.actualWarehouse ? data.actualWarehouse.warehouseName : ''),
|
||||||
materialName: data.materialName || (data.rawMaterial ? data.rawMaterial.rawMaterialName : ''),
|
materialName: data.materialName || (data.rawMaterial ? data.rawMaterial.rawMaterialName : ''),
|
||||||
productName: data.productName || (data.product ? data.product.productName : '')
|
productName: data.productName || (data.product ? data.product.productName : ''),
|
||||||
|
specification: data.rawMaterial?.specification || data.product?.specification || '',
|
||||||
|
bomItems: data.bomItemList || []
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
coilId: null,
|
coilId: null,
|
||||||
@@ -353,8 +402,11 @@ export default {
|
|||||||
itemType: null,
|
itemType: null,
|
||||||
itemId: null,
|
itemId: null,
|
||||||
warehouseName: '',
|
warehouseName: '',
|
||||||
|
actualWarehouseName: '',
|
||||||
materialName: '',
|
materialName: '',
|
||||||
productName: ''
|
productName: '',
|
||||||
|
specification: '',
|
||||||
|
bomItems: []
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -377,22 +429,47 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 加载待合卷列表
|
// 加载待合卷列表(查询待处理和处理中的记录)
|
||||||
async loadPendingMergeList() {
|
async loadPendingMergeList() {
|
||||||
try {
|
try {
|
||||||
this.pendingLoading = true;
|
this.pendingLoading = true;
|
||||||
const response = await listPendingAction({
|
console.log('=== 开始加载待合卷列表 ===');
|
||||||
actionType: 1, // 1=合卷
|
|
||||||
actionStatus: 0, // 0=待处理
|
// 分别查询待处理和处理中的记录
|
||||||
pageNum: 1,
|
const responses = await Promise.all([
|
||||||
pageSize: 50
|
listPendingAction({
|
||||||
});
|
actionType: 1, // 1=合卷
|
||||||
|
actionStatus: 0, // 0=待处理
|
||||||
if (response.code === 200) {
|
pageNum: 1,
|
||||||
// 排除当前钢卷
|
pageSize: 50
|
||||||
const currentCoilId = this.sourceCoils[0].coilId;
|
}),
|
||||||
this.pendingMergeList = (response.rows || []).filter(item => item.coilId !== currentCoilId);
|
listPendingAction({
|
||||||
}
|
actionType: 1, // 1=合卷
|
||||||
|
actionStatus: 1, // 1=处理中
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 50
|
||||||
|
})
|
||||||
|
]);
|
||||||
|
|
||||||
|
console.log('待处理响应:', responses[0]);
|
||||||
|
console.log('处理中响应:', responses[1]);
|
||||||
|
|
||||||
|
// 合并两个列表
|
||||||
|
const allPending = [
|
||||||
|
...(responses[0].rows || []),
|
||||||
|
...(responses[1].rows || [])
|
||||||
|
];
|
||||||
|
|
||||||
|
console.log('所有待合卷记录数量:', allPending.length);
|
||||||
|
console.log('所有待合卷记录:', allPending);
|
||||||
|
|
||||||
|
// 排除当前钢卷
|
||||||
|
const currentCoilId = this.sourceCoils[0] ? this.sourceCoils[0].coilId : null;
|
||||||
|
console.log('当前钢卷ID:', currentCoilId);
|
||||||
|
|
||||||
|
this.pendingMergeList = allPending.filter(item => item.coilId !== currentCoilId);
|
||||||
|
console.log('过滤后的待合卷列表数量:', this.pendingMergeList.length);
|
||||||
|
console.log('过滤后的待合卷列表:', this.pendingMergeList);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('加载待合卷列表失败', error);
|
console.error('加载待合卷列表失败', error);
|
||||||
} finally {
|
} finally {
|
||||||
@@ -414,8 +491,11 @@ export default {
|
|||||||
itemType: data.itemType,
|
itemType: data.itemType,
|
||||||
itemId: data.itemId,
|
itemId: data.itemId,
|
||||||
warehouseName: data.warehouseName || (data.warehouse ? data.warehouse.warehouseName : ''),
|
warehouseName: data.warehouseName || (data.warehouse ? data.warehouse.warehouseName : ''),
|
||||||
|
actualWarehouseName: data.actualWarehouseName || (data.actualWarehouse ? data.actualWarehouse.warehouseName : ''),
|
||||||
materialName: data.materialName || (data.rawMaterial ? data.rawMaterial.rawMaterialName : ''),
|
materialName: data.materialName || (data.rawMaterial ? data.rawMaterial.rawMaterialName : ''),
|
||||||
productName: data.productName || (data.product ? data.product.productName : ''),
|
productName: data.productName || (data.product ? data.product.productName : ''),
|
||||||
|
specification: data.rawMaterial?.specification || data.product?.specification || '',
|
||||||
|
bomItems: data.bomItemList || [],
|
||||||
actionId: pending.actionId // 保存待操作ID,用于后续完成操作
|
actionId: pending.actionId // 保存待操作ID,用于后续完成操作
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -440,6 +520,41 @@ export default {
|
|||||||
return `${month}-${day} ${hour}:${minute}`;
|
return `${month}-${day} ${hour}:${minute}`;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 格式化物品名称(添加规格和BOM信息)
|
||||||
|
formatItemName(item) {
|
||||||
|
if (!item) return '';
|
||||||
|
|
||||||
|
// 获取名称(原材料或产品)
|
||||||
|
const name = item.rawMaterialName || item.productName || '';
|
||||||
|
if (!name) return '';
|
||||||
|
|
||||||
|
let displayName = name;
|
||||||
|
const specs = [];
|
||||||
|
|
||||||
|
// 1. 优先显示规格(从对象的specification字段)
|
||||||
|
if (item.specification) {
|
||||||
|
specs.push(item.specification);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 添加BOM参数(最多2个)
|
||||||
|
if (item.bomItems && item.bomItems.length > 0) {
|
||||||
|
const bomParams = item.bomItems
|
||||||
|
.filter(bomItem => bomItem.attrKey && bomItem.attrValue)
|
||||||
|
.slice(0, 2); // 最多2个BOM参数
|
||||||
|
|
||||||
|
bomParams.forEach(param => {
|
||||||
|
specs.push(`${param.attrKey}:${param.attrValue}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 拼接成最终格式
|
||||||
|
if (specs.length > 0) {
|
||||||
|
displayName += `(${specs.join(' ')})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return displayName;
|
||||||
|
},
|
||||||
|
|
||||||
// 加载库区列表
|
// 加载库区列表
|
||||||
async loadWarehouses() {
|
async loadWarehouses() {
|
||||||
try {
|
try {
|
||||||
@@ -455,16 +570,24 @@ export default {
|
|||||||
// 加载物品列表(根据类型)
|
// 加载物品列表(根据类型)
|
||||||
async loadItemList(itemType) {
|
async loadItemList(itemType) {
|
||||||
if (!itemType) return;
|
if (!itemType) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.itemSearchLoading = true;
|
this.itemSearchLoading = true;
|
||||||
if (itemType === 'raw_material') {
|
if (itemType === 'raw_material') {
|
||||||
const response = await listRawMaterial({ pageNum: 1, pageSize: 100 });
|
const response = await listRawMaterial({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 100,
|
||||||
|
withBom: true
|
||||||
|
});
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.rawMaterialList = response.rows || [];
|
this.rawMaterialList = response.rows || [];
|
||||||
}
|
}
|
||||||
} else if (itemType === 'product') {
|
} else if (itemType === 'product') {
|
||||||
const response = await listProduct({ pageNum: 1, pageSize: 100 });
|
const response = await listProduct({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 100,
|
||||||
|
withBom: true
|
||||||
|
});
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.productList = response.rows || [];
|
this.productList = response.rows || [];
|
||||||
}
|
}
|
||||||
@@ -482,23 +605,30 @@ export default {
|
|||||||
this.$message.warning('请先选择物品类型');
|
this.$message.warning('请先选择物品类型');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!query || query.trim() === '') {
|
||||||
|
this.loadItemList(this.targetCoil.itemType);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.itemSearchLoading = true;
|
this.itemSearchLoading = true;
|
||||||
if (this.targetCoil.itemType === 'raw_material') {
|
if (this.targetCoil.itemType === 'raw_material') {
|
||||||
const response = await listRawMaterial({
|
const response = await listRawMaterial({
|
||||||
rawMaterialName: query,
|
rawMaterialName: query,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 50
|
pageSize: 50,
|
||||||
|
withBom: true
|
||||||
});
|
});
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.rawMaterialList = response.rows || [];
|
this.rawMaterialList = response.rows || [];
|
||||||
}
|
}
|
||||||
} else if (this.targetCoil.itemType === 'product') {
|
} else if (this.targetCoil.itemType === 'product') {
|
||||||
const response = await listProduct({
|
const response = await listProduct({
|
||||||
productName: query,
|
productName: query,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 50
|
pageSize: 50,
|
||||||
|
withBom: true
|
||||||
});
|
});
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.productList = response.rows || [];
|
this.productList = response.rows || [];
|
||||||
@@ -520,8 +650,11 @@ export default {
|
|||||||
itemType: null,
|
itemType: null,
|
||||||
itemId: null,
|
itemId: null,
|
||||||
warehouseName: '',
|
warehouseName: '',
|
||||||
|
actualWarehouseName: '',
|
||||||
materialName: '',
|
materialName: '',
|
||||||
productName: ''
|
productName: '',
|
||||||
|
specification: '',
|
||||||
|
bomItems: []
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -550,8 +683,11 @@ export default {
|
|||||||
itemType: coil.itemType,
|
itemType: coil.itemType,
|
||||||
itemId: coil.itemId,
|
itemId: coil.itemId,
|
||||||
warehouseName: coil.warehouseName || '',
|
warehouseName: coil.warehouseName || '',
|
||||||
|
actualWarehouseName: coil.actualWarehouseName || '',
|
||||||
materialName: coil.materialName || '',
|
materialName: coil.materialName || '',
|
||||||
productName: coil.productName || ''
|
productName: coil.productName || '',
|
||||||
|
specification: coil.rawMaterial?.specification || coil.product?.specification || '',
|
||||||
|
bomItems: coil.bomItemList || []
|
||||||
});
|
});
|
||||||
|
|
||||||
// 如果是第一个源卷,自动填充目标卷信息
|
// 如果是第一个源卷,自动填充目标卷信息
|
||||||
@@ -915,17 +1051,17 @@ export default {
|
|||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
margin-bottom: 8px;
|
margin-bottom: 8px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-label {
|
.detail-label {
|
||||||
color: #909399;
|
color: #909399;
|
||||||
min-width: 90px;
|
min-width: 90px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detail-value {
|
.detail-value {
|
||||||
color: #303133;
|
color: #303133;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
@@ -933,6 +1069,36 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.source-detail-divider {
|
||||||
|
margin: 10px 0 8px;
|
||||||
|
padding: 5px 0;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
color: #606266;
|
||||||
|
border-bottom: 1px solid #e4e7ed;
|
||||||
|
}
|
||||||
|
|
||||||
|
.source-bom-params {
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.source-bom-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
font-size: 12px;
|
||||||
|
|
||||||
|
.bom-key {
|
||||||
|
color: #909399;
|
||||||
|
min-width: 60px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bom-value {
|
||||||
|
color: #303133;
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.btn-remove {
|
.btn-remove {
|
||||||
color: #f56c6c;
|
color: #f56c6c;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
|||||||
@@ -139,10 +139,10 @@
|
|||||||
<template slot="append">吨</template>
|
<template slot="append">吨</template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="目标库区" required>
|
<el-form-item label="逻辑库区" required>
|
||||||
<el-select
|
<el-select
|
||||||
v-model="item.warehouseId"
|
v-model="item.warehouseId"
|
||||||
placeholder="请选择目标库位"
|
placeholder="请选择逻辑库区"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
filterable
|
filterable
|
||||||
:disabled="readonly"
|
:disabled="readonly"
|
||||||
@@ -155,7 +155,7 @@
|
|||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="展示库区" required>
|
<el-form-item label="真实库区" required>
|
||||||
<ActualWarehouseSelect
|
<ActualWarehouseSelect
|
||||||
v-model="item.actualWarehouseId"
|
v-model="item.actualWarehouseId"
|
||||||
placeholder="请选择真实库区"
|
placeholder="请选择真实库区"
|
||||||
@@ -192,6 +192,7 @@ import { getMaterialCoil, splitMaterialCoil } from '@/api/wms/coil';
|
|||||||
import { listWarehouse } from '@/api/wms/warehouse';
|
import { listWarehouse } from '@/api/wms/warehouse';
|
||||||
import { listRawMaterial } from '@/api/wms/rawMaterial';
|
import { listRawMaterial } from '@/api/wms/rawMaterial';
|
||||||
import { listProduct } from '@/api/wms/product';
|
import { listProduct } from '@/api/wms/product';
|
||||||
|
import { completeAction } from '@/api/wms/pendingAction';
|
||||||
import CoilSelector from '@/components/CoilSelector';
|
import CoilSelector from '@/components/CoilSelector';
|
||||||
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
|
import ActualWarehouseSelect from "@/components/KLPService/ActualWarehouseSelect";
|
||||||
import MaterialSelect from "@/components/KLPService/MaterialSelect";
|
import MaterialSelect from "@/components/KLPService/MaterialSelect";
|
||||||
@@ -244,7 +245,9 @@ export default {
|
|||||||
productList: [],
|
productList: [],
|
||||||
itemSearchLoading: false,
|
itemSearchLoading: false,
|
||||||
// 只读模式
|
// 只读模式
|
||||||
readonly: false
|
readonly: false,
|
||||||
|
// 待操作ID
|
||||||
|
actionId: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -253,14 +256,20 @@ export default {
|
|||||||
// 先加载库区列表
|
// 先加载库区列表
|
||||||
await this.loadWarehouses();
|
await this.loadWarehouses();
|
||||||
|
|
||||||
// 从路由参数获取coilId和readonly
|
// 从路由参数获取coilId、actionId和readonly
|
||||||
const coilId = this.$route.query.coilId;
|
const coilId = this.$route.query.coilId;
|
||||||
|
const actionId = this.$route.query.actionId;
|
||||||
const readonly = this.$route.query.readonly;
|
const readonly = this.$route.query.readonly;
|
||||||
|
|
||||||
if (coilId) {
|
if (coilId) {
|
||||||
await this.loadMotherCoil(coilId);
|
await this.loadMotherCoil(coilId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 保存待操作ID
|
||||||
|
if (actionId) {
|
||||||
|
this.actionId = actionId;
|
||||||
|
}
|
||||||
|
|
||||||
// 设置只读模式
|
// 设置只读模式
|
||||||
if (readonly === 'true' || readonly === true) {
|
if (readonly === 'true' || readonly === true) {
|
||||||
this.readonly = true;
|
this.readonly = true;
|
||||||
@@ -272,17 +281,52 @@ export default {
|
|||||||
if (itemType === 'raw_material') {
|
if (itemType === 'raw_material') {
|
||||||
return this.rawMaterialList.map(item => ({
|
return this.rawMaterialList.map(item => ({
|
||||||
id: item.rawMaterialId,
|
id: item.rawMaterialId,
|
||||||
name: item.rawMaterialName
|
name: this.formatItemName(item)
|
||||||
}));
|
}));
|
||||||
} else if (itemType === 'product') {
|
} else if (itemType === 'product') {
|
||||||
return this.productList.map(item => ({
|
return this.productList.map(item => ({
|
||||||
id: item.productId,
|
id: item.productId,
|
||||||
name: item.productName
|
name: this.formatItemName(item)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 格式化物品名称(添加规格和BOM信息)
|
||||||
|
formatItemName(item) {
|
||||||
|
if (!item) return '';
|
||||||
|
|
||||||
|
// 获取名称(原材料或产品)
|
||||||
|
const name = item.rawMaterialName || item.productName || '';
|
||||||
|
if (!name) return '';
|
||||||
|
|
||||||
|
let displayName = name;
|
||||||
|
const specs = [];
|
||||||
|
|
||||||
|
// 1. 优先显示规格(从对象的specification字段)
|
||||||
|
if (item.specification) {
|
||||||
|
specs.push(item.specification);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 添加BOM参数(最多2个)
|
||||||
|
if (item.bomItems && item.bomItems.length > 0) {
|
||||||
|
const bomParams = item.bomItems
|
||||||
|
.filter(bomItem => bomItem.attrKey && bomItem.attrValue)
|
||||||
|
.slice(0, 2); // 最多2个BOM参数
|
||||||
|
|
||||||
|
bomParams.forEach(param => {
|
||||||
|
specs.push(`${param.attrKey}:${param.attrValue}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 拼接成最终格式
|
||||||
|
if (specs.length > 0) {
|
||||||
|
displayName += `(${specs.join(' ')})`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return displayName;
|
||||||
|
},
|
||||||
|
|
||||||
// 物品类型变化
|
// 物品类型变化
|
||||||
handleItemTypeChange(index) {
|
handleItemTypeChange(index) {
|
||||||
this.splitList[index].itemId = null;
|
this.splitList[index].itemId = null;
|
||||||
@@ -296,23 +340,30 @@ export default {
|
|||||||
this.$message.warning('请先选择物品类型');
|
this.$message.warning('请先选择物品类型');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!query || query.trim() === '') {
|
||||||
|
this.loadItemListForSplit(itemType);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.itemSearchLoading = true;
|
this.itemSearchLoading = true;
|
||||||
if (itemType === 'raw_material') {
|
if (itemType === 'raw_material') {
|
||||||
const response = await listRawMaterial({
|
const response = await listRawMaterial({
|
||||||
rawMaterialName: query,
|
rawMaterialName: query,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 50
|
pageSize: 50,
|
||||||
|
withBom: true
|
||||||
});
|
});
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.rawMaterialList = response.rows || [];
|
this.rawMaterialList = response.rows || [];
|
||||||
}
|
}
|
||||||
} else if (itemType === 'product') {
|
} else if (itemType === 'product') {
|
||||||
const response = await listProduct({
|
const response = await listProduct({
|
||||||
productName: query,
|
productName: query,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 50
|
pageSize: 50,
|
||||||
|
withBom: true
|
||||||
});
|
});
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.productList = response.rows || [];
|
this.productList = response.rows || [];
|
||||||
@@ -328,16 +379,24 @@ export default {
|
|||||||
// 加载子卷物品列表
|
// 加载子卷物品列表
|
||||||
async loadItemListForSplit(itemType) {
|
async loadItemListForSplit(itemType) {
|
||||||
if (!itemType) return;
|
if (!itemType) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.itemSearchLoading = true;
|
this.itemSearchLoading = true;
|
||||||
if (itemType === 'raw_material') {
|
if (itemType === 'raw_material') {
|
||||||
const response = await listRawMaterial({ pageNum: 1, pageSize: 100 });
|
const response = await listRawMaterial({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 100,
|
||||||
|
withBom: true
|
||||||
|
});
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.rawMaterialList = response.rows || [];
|
this.rawMaterialList = response.rows || [];
|
||||||
}
|
}
|
||||||
} else if (itemType === 'product') {
|
} else if (itemType === 'product') {
|
||||||
const response = await listProduct({ pageNum: 1, pageSize: 100 });
|
const response = await listProduct({
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 100,
|
||||||
|
withBom: true
|
||||||
|
});
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.productList = response.rows || [];
|
this.productList = response.rows || [];
|
||||||
}
|
}
|
||||||
@@ -522,6 +581,12 @@ export default {
|
|||||||
const response = await splitMaterialCoil(splitData);
|
const response = await splitMaterialCoil(splitData);
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.$message.success('分卷保存成功');
|
this.$message.success('分卷保存成功');
|
||||||
|
|
||||||
|
// 如果是从待操作列表进来的,标记操作为完成
|
||||||
|
if (this.actionId) {
|
||||||
|
await completeAction(this.actionId);
|
||||||
|
}
|
||||||
|
|
||||||
// 延迟返回,让用户看到成功提示
|
// 延迟返回,让用户看到成功提示
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.$router.back();
|
this.$router.back();
|
||||||
|
|||||||
@@ -55,7 +55,7 @@
|
|||||||
<span class="info-value">{{ currentInfo.netWeight ? currentInfo.netWeight + ' t' : '—' }}</span>
|
<span class="info-value">{{ currentInfo.netWeight ? currentInfo.netWeight + ' t' : '—' }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="info-row">
|
<div class="info-row">
|
||||||
<span class="info-label">目标库区:</span>
|
<span class="info-label">逻辑库区:</span>
|
||||||
<span class="info-value">{{ currentInfo.nextWarehouseName || '—' }}</span>
|
<span class="info-value">{{ currentInfo.nextWarehouseName || '—' }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="info-row" v-if="currentInfo.remark">
|
<div class="info-row" v-if="currentInfo.remark">
|
||||||
@@ -122,8 +122,8 @@
|
|||||||
</el-input>
|
</el-input>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="目标库位" prop="warehouseId">
|
<el-form-item label="逻辑库区" prop="warehouseId">
|
||||||
<el-select v-model="updateForm.warehouseId" placeholder="请选择目标库区" style="width: 100%" filterable
|
<el-select v-model="updateForm.warehouseId" placeholder="请选择逻辑库区" style="width: 100%" filterable
|
||||||
:disabled="readonly">
|
:disabled="readonly">
|
||||||
<el-option v-for="warehouse in warehouseList" :key="warehouse.warehouseId"
|
<el-option v-for="warehouse in warehouseList" :key="warehouse.warehouseId"
|
||||||
:label="warehouse.warehouseName" :value="warehouse.warehouseId" />
|
:label="warehouse.warehouseName" :value="warehouse.warehouseId" />
|
||||||
@@ -256,7 +256,7 @@ export default {
|
|||||||
{ type: 'number', message: '净重必须为数字', trigger: 'blur' }
|
{ type: 'number', message: '净重必须为数字', trigger: 'blur' }
|
||||||
],
|
],
|
||||||
warehouseId: [
|
warehouseId: [
|
||||||
{ required: true, message: '请选择目标库区', trigger: 'change' }
|
{ required: true, message: '请选择逻辑库区', trigger: 'change' }
|
||||||
],
|
],
|
||||||
actualWarehouseId: [
|
actualWarehouseId: [
|
||||||
{ required: true, message: '请选择真实库区', trigger: 'change' }
|
{ required: true, message: '请选择真实库区', trigger: 'change' }
|
||||||
@@ -279,12 +279,12 @@ export default {
|
|||||||
if (this.updateForm.itemType === 'raw_material') {
|
if (this.updateForm.itemType === 'raw_material') {
|
||||||
return this.rawMaterialList.map(item => ({
|
return this.rawMaterialList.map(item => ({
|
||||||
id: item.rawMaterialId,
|
id: item.rawMaterialId,
|
||||||
name: item.rawMaterialName
|
name: this.formatItemName(item)
|
||||||
}));
|
}));
|
||||||
} else if (this.updateForm.itemType === 'product') {
|
} else if (this.updateForm.itemType === 'product') {
|
||||||
return this.productList.map(item => ({
|
return this.productList.map(item => ({
|
||||||
id: item.productId,
|
id: item.productId,
|
||||||
name: item.productName
|
name: this.formatItemName(item)
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
@@ -395,6 +395,49 @@ export default {
|
|||||||
return warehouse ? warehouse.warehouseName : '';
|
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() {
|
async loadWarehouses() {
|
||||||
try {
|
try {
|
||||||
@@ -411,16 +454,26 @@ export default {
|
|||||||
// 加载物品列表(根据类型)
|
// 加载物品列表(根据类型)
|
||||||
async loadItemList(itemType) {
|
async loadItemList(itemType) {
|
||||||
if (!itemType) return;
|
if (!itemType) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.itemSearchLoading = true;
|
this.itemSearchLoading = true;
|
||||||
if (itemType === 'raw_material') {
|
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) {
|
if (response.code === 200) {
|
||||||
this.rawMaterialList = response.rows || [];
|
this.rawMaterialList = response.rows || [];
|
||||||
}
|
}
|
||||||
} else if (itemType === 'product') {
|
} 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) {
|
if (response.code === 200) {
|
||||||
this.productList = response.rows || [];
|
this.productList = response.rows || [];
|
||||||
}
|
}
|
||||||
@@ -432,29 +485,37 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 搜索物品
|
// 搜索物品(支持名称和规格搜索)
|
||||||
async searchItems(query) {
|
async searchItems(query) {
|
||||||
if (!this.updateForm.itemType) {
|
if (!this.updateForm.itemType) {
|
||||||
this.$message.warning('请先选择物品类型');
|
this.$message.warning('请先选择物品类型');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!query || query.trim() === '') {
|
||||||
|
// 如果搜索为空,加载默认列表
|
||||||
|
this.loadItemList(this.updateForm.itemType);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.itemSearchLoading = true;
|
this.itemSearchLoading = true;
|
||||||
if (this.updateForm.itemType === 'raw_material') {
|
if (this.updateForm.itemType === 'raw_material') {
|
||||||
const response = await listRawMaterial({
|
const response = await listRawMaterial({
|
||||||
rawMaterialName: query,
|
rawMaterialName: query, // 按名称搜索
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 50
|
pageSize: 50,
|
||||||
|
withBom: true
|
||||||
});
|
});
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.rawMaterialList = response.rows || [];
|
this.rawMaterialList = response.rows || [];
|
||||||
}
|
}
|
||||||
} else if (this.updateForm.itemType === 'product') {
|
} else if (this.updateForm.itemType === 'product') {
|
||||||
const response = await listProduct({
|
const response = await listProduct({
|
||||||
productName: query,
|
productName: query, // 按名称搜索
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
pageSize: 50
|
pageSize: 50,
|
||||||
|
withBom: true
|
||||||
});
|
});
|
||||||
if (response.code === 200) {
|
if (response.code === 200) {
|
||||||
this.productList = response.rows || [];
|
this.productList = response.rows || [];
|
||||||
@@ -534,24 +595,26 @@ export default {
|
|||||||
try {
|
try {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|
||||||
// 构造更新数据(使用标准update接口,会创建历史版本)
|
// 构造更新数据(使用标准update接口,直接更新原记录)
|
||||||
const updateData = {
|
const updateData = {
|
||||||
coilId: this.currentInfo.coilId,
|
coilId: this.currentInfo.coilId,
|
||||||
enterCoilNo: this.currentInfo.enterCoilNo, // 入场钢卷号,从当前信息获取(必填)
|
enterCoilNo: this.currentInfo.enterCoilNo,
|
||||||
supplierCoilNo: this.currentInfo.supplierCoilNo, // 厂家原料卷号(保持不变)
|
supplierCoilNo: this.currentInfo.supplierCoilNo,
|
||||||
currentCoilNo: this.updateForm.currentCoilNo,
|
currentCoilNo: this.updateForm.currentCoilNo,
|
||||||
team: this.updateForm.team,
|
team: this.updateForm.team,
|
||||||
itemType: this.updateForm.itemType,
|
itemType: this.updateForm.itemType,
|
||||||
itemId: this.updateForm.itemId,
|
itemId: this.updateForm.itemId,
|
||||||
grossWeight: this.updateForm.grossWeight,
|
grossWeight: this.updateForm.grossWeight,
|
||||||
netWeight: this.updateForm.netWeight,
|
netWeight: this.updateForm.netWeight,
|
||||||
// warehouseId: this.currentInfo.warehouseId, // 当前库区ID(保持不变)
|
warehouseId: this.updateForm.warehouseId,
|
||||||
actualWarehouseId: this.updateForm.actualWarehouseId, // 真实库区ID
|
actualWarehouseId: this.updateForm.actualWarehouseId,
|
||||||
warehouseId: this.updateForm.warehouseId, // 目标库区ID
|
|
||||||
remark: this.updateForm.remark
|
remark: this.updateForm.remark
|
||||||
|
// 注意:不要传newCoils,否则会走批量更新逻辑
|
||||||
};
|
};
|
||||||
|
|
||||||
|
console.log('=== 正常更新操作 ===');
|
||||||
console.log('提交的更新数据:', updateData);
|
console.log('提交的更新数据:', updateData);
|
||||||
|
console.log('是否有newCoils:', updateData.newCoils);
|
||||||
|
|
||||||
const response = await updateMaterialCoil(updateData);
|
const response = await updateMaterialCoil(updateData);
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class WmsMaterialCoilController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/{coilId}")
|
@GetMapping("/{coilId}")
|
||||||
public R<WmsMaterialCoilVo> getInfo(@NotNull(message = "主键不能为空")
|
public R<WmsMaterialCoilVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
@PathVariable Long coilId) {
|
@PathVariable("coilId") Long coilId) {
|
||||||
return R.ok(iWmsMaterialCoilService.queryById(coilId));
|
return R.ok(iWmsMaterialCoilService.queryById(coilId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ public class WmsMaterialCoilController extends BaseController {
|
|||||||
@Log(title = "钢卷物料表", businessType = BusinessType.DELETE)
|
@Log(title = "钢卷物料表", businessType = BusinessType.DELETE)
|
||||||
@DeleteMapping("/{coilIds}")
|
@DeleteMapping("/{coilIds}")
|
||||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
@PathVariable Long[] coilIds) {
|
@PathVariable("coilIds") Long[] coilIds) {
|
||||||
return toAjax(iWmsMaterialCoilService.deleteWithValidByIds(Arrays.asList(coilIds), true));
|
return toAjax(iWmsMaterialCoilService.deleteWithValidByIds(Arrays.asList(coilIds), true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ import com.klp.domain.vo.WmsRawMaterialVo;
|
|||||||
import com.klp.domain.vo.WmsBomItemVo;
|
import com.klp.domain.vo.WmsBomItemVo;
|
||||||
import com.klp.domain.bo.WmsBomItemBo;
|
import com.klp.domain.bo.WmsBomItemBo;
|
||||||
import com.klp.domain.WmsMaterialCoil;
|
import com.klp.domain.WmsMaterialCoil;
|
||||||
import com.klp.domain.WmsStock;
|
|
||||||
import com.klp.domain.bo.WmsStockBo;
|
import com.klp.domain.bo.WmsStockBo;
|
||||||
import com.klp.domain.vo.WmsStockVo;
|
import com.klp.domain.vo.WmsStockVo;
|
||||||
import com.klp.mapper.WmsMaterialCoilMapper;
|
import com.klp.mapper.WmsMaterialCoilMapper;
|
||||||
@@ -31,9 +30,11 @@ import com.klp.service.IWmsMaterialCoilService;
|
|||||||
import com.klp.service.IWmsStockService;
|
import com.klp.service.IWmsStockService;
|
||||||
import com.klp.service.IWmsGenerateRecordService;
|
import com.klp.service.IWmsGenerateRecordService;
|
||||||
import com.klp.service.IWmsWarehouseService;
|
import com.klp.service.IWmsWarehouseService;
|
||||||
|
import com.klp.service.IWmsActualWarehouseService;
|
||||||
import com.klp.service.IWmsRawMaterialService;
|
import com.klp.service.IWmsRawMaterialService;
|
||||||
import com.klp.service.IWmsProductBomService;
|
import com.klp.service.IWmsProductBomService;
|
||||||
import com.klp.service.IWmsBomItemService;
|
import com.klp.service.IWmsBomItemService;
|
||||||
|
import com.klp.domain.vo.WmsActualWarehouseVo;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -61,6 +62,7 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
private final IWmsStockService stockService;
|
private final IWmsStockService stockService;
|
||||||
private final IWmsGenerateRecordService generateRecordService;
|
private final IWmsGenerateRecordService generateRecordService;
|
||||||
private final IWmsWarehouseService warehouseService;
|
private final IWmsWarehouseService warehouseService;
|
||||||
|
private final IWmsActualWarehouseService actualWarehouseService;
|
||||||
private final IWmsRawMaterialService rawMaterialService;
|
private final IWmsRawMaterialService rawMaterialService;
|
||||||
private final IWmsProductBomService productBomService;
|
private final IWmsProductBomService productBomService;
|
||||||
private final IWmsBomItemService bomItemService;
|
private final IWmsBomItemService bomItemService;
|
||||||
@@ -97,6 +99,14 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
vo.setNextWarehouse(nextWarehouse);
|
vo.setNextWarehouse(nextWarehouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询实际库区信息
|
||||||
|
if (vo.getActualWarehouseId() != null) {
|
||||||
|
WmsActualWarehouseVo actualWarehouse = actualWarehouseService.queryById(vo.getActualWarehouseId());
|
||||||
|
if (actualWarehouse != null) {
|
||||||
|
vo.setActualWarehouseName(actualWarehouse.getActualWarehouseName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 查询二维码信息
|
// 查询二维码信息
|
||||||
if (vo.getQrcodeRecordId() != null) {
|
if (vo.getQrcodeRecordId() != null) {
|
||||||
WmsGenerateRecordVo qrcodeRecord = generateRecordService.queryById(vo.getQrcodeRecordId());
|
WmsGenerateRecordVo qrcodeRecord = generateRecordService.queryById(vo.getQrcodeRecordId());
|
||||||
@@ -354,7 +364,7 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 单个更新
|
* 单个更新(正常更新,不产生新记录,二维码不变)
|
||||||
*/
|
*/
|
||||||
private Boolean updateBySingle(WmsMaterialCoilBo bo) {
|
private Boolean updateBySingle(WmsMaterialCoilBo bo) {
|
||||||
// 查询原钢卷
|
// 查询原钢卷
|
||||||
@@ -363,56 +373,36 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
throw new RuntimeException("原钢卷不存在");
|
throw new RuntimeException("原钢卷不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断warehouseId是否发生变化
|
// 直接更新原记录(不产生新记录,不修改dataType)
|
||||||
boolean warehouseChanged = bo.getWarehouseId() != null &&
|
WmsMaterialCoil updateCoil = BeanUtil.toBean(bo, WmsMaterialCoil.class);
|
||||||
!bo.getWarehouseId().equals(oldCoil.getWarehouseId());
|
|
||||||
|
// 确保关键字段不丢失
|
||||||
Long qrcodeRecordId;
|
if (updateCoil.getEnterCoilNo() == null) {
|
||||||
if (warehouseChanged) {
|
updateCoil.setEnterCoilNo(oldCoil.getEnterCoilNo());
|
||||||
// 如果库区发生变化,生成新的二维码
|
|
||||||
qrcodeRecordId = generateQrcodeForUpdate(oldCoil, bo);
|
|
||||||
} else {
|
|
||||||
// 如果库区未变化,更新原二维码内容
|
|
||||||
updateQrcodeContent(oldCoil.getQrcodeRecordId(), bo);
|
|
||||||
qrcodeRecordId = oldCoil.getQrcodeRecordId();
|
|
||||||
}
|
}
|
||||||
|
if (updateCoil.getSupplierCoilNo() == null) {
|
||||||
// 2. 将原数据更新为历史数据(data_type=0)
|
updateCoil.setSupplierCoilNo(oldCoil.getSupplierCoilNo());
|
||||||
LambdaUpdateWrapper<WmsMaterialCoil> updateWrapper = new LambdaUpdateWrapper<>();
|
|
||||||
updateWrapper.eq(WmsMaterialCoil::getCoilId, bo.getCoilId())
|
|
||||||
.set(WmsMaterialCoil::getDataType, 0); // 设置为历史数据
|
|
||||||
baseMapper.update(null, updateWrapper);
|
|
||||||
|
|
||||||
// 3. 插入一条新的当前数据(data_type=1)
|
|
||||||
WmsMaterialCoil newCoil = BeanUtil.toBean(bo, WmsMaterialCoil.class);
|
|
||||||
newCoil.setCoilId(null); // 清空ID,让数据库自动生成新的ID
|
|
||||||
newCoil.setDataType(1); // 设置为当前数据
|
|
||||||
newCoil.setQrcodeRecordId(qrcodeRecordId); // 使用新的或原有的二维码ID
|
|
||||||
|
|
||||||
// 确保关键字段不丢失(入场钢卷号始终不变)
|
|
||||||
newCoil.setEnterCoilNo(oldCoil.getEnterCoilNo()); // 入场钢卷号始终不变
|
|
||||||
if (newCoil.getSupplierCoilNo() == null) {
|
|
||||||
newCoil.setSupplierCoilNo(oldCoil.getSupplierCoilNo()); // 保留厂家原料卷号
|
|
||||||
}
|
}
|
||||||
if (newCoil.getItemType() == null) {
|
if (updateCoil.getQrcodeRecordId() == null) {
|
||||||
newCoil.setItemType(oldCoil.getItemType());
|
updateCoil.setQrcodeRecordId(oldCoil.getQrcodeRecordId());
|
||||||
}
|
}
|
||||||
if (newCoil.getItemId() == null) {
|
if (updateCoil.getWarehouseId() == null) {
|
||||||
newCoil.setItemId(oldCoil.getItemId());
|
updateCoil.setWarehouseId(oldCoil.getWarehouseId());
|
||||||
}
|
}
|
||||||
// 确保warehouseId有值(如果前端没传,使用原值)
|
if (updateCoil.getActualWarehouseId() == null) {
|
||||||
if (newCoil.getWarehouseId() == null) {
|
updateCoil.setActualWarehouseId(oldCoil.getActualWarehouseId());
|
||||||
newCoil.setWarehouseId(oldCoil.getWarehouseId());
|
|
||||||
newCoil.setActualWarehouseId(oldCoil.getActualWarehouseId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
validEntityBeforeSave(newCoil);
|
validEntityBeforeSave(updateCoil);
|
||||||
boolean flag = baseMapper.insert(newCoil) > 0;
|
|
||||||
|
// 直接更新记录(coilId不变)
|
||||||
|
boolean flag = baseMapper.updateById(updateCoil) > 0;
|
||||||
|
|
||||||
if (flag) {
|
if (flag) {
|
||||||
bo.setCoilId(newCoil.getCoilId());
|
// 更新二维码内容(添加新的step)
|
||||||
// 无论库区是否变化,都需要更新二维码中的current_coil_id
|
updateQrcodeContentForNormalUpdate(oldCoil, bo);
|
||||||
updateQrcodeCoilId(qrcodeRecordId, newCoil.getCoilId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -543,9 +533,17 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
throw new RuntimeException("分卷操作需要原钢卷信息");
|
throw new RuntimeException("分卷操作需要原钢卷信息");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. 将原始钢卷更新为历史数据(已在上面完成)
|
// 1. 将原始钢卷的二维码标记为失效(status=0)
|
||||||
|
if (oldCoil.getQrcodeRecordId() != null) {
|
||||||
|
WmsGenerateRecordBo oldQrBo = new WmsGenerateRecordBo();
|
||||||
|
oldQrBo.setRecordId(oldCoil.getQrcodeRecordId());
|
||||||
|
oldQrBo.setStatus(0); // 0=失效
|
||||||
|
generateRecordService.updateByBo(oldQrBo);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 将原始钢卷标记为历史数据(已在上面完成)
|
||||||
|
|
||||||
// 2. 为每个分卷后的子钢卷生成独立的二维码并插入数据库
|
// 3. 为每个分卷后的子钢卷生成独立的二维码并插入数据库
|
||||||
for (WmsMaterialCoilBo newCoilBo : bo.getNewCoils()) {
|
for (WmsMaterialCoilBo newCoilBo : bo.getNewCoils()) {
|
||||||
WmsMaterialCoil newCoil = BeanUtil.toBean(newCoilBo, WmsMaterialCoil.class);
|
WmsMaterialCoil newCoil = BeanUtil.toBean(newCoilBo, WmsMaterialCoil.class);
|
||||||
newCoil.setCoilId(null);
|
newCoil.setCoilId(null);
|
||||||
@@ -578,13 +576,25 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
}
|
}
|
||||||
} else if (isMerge) {
|
} else if (isMerge) {
|
||||||
// 合卷:将bo作为合卷后的新钢卷,newCoils中的对象作为参与合卷的原始钢卷
|
// 合卷:将bo作为合卷后的新钢卷,newCoils中的对象作为参与合卷的原始钢卷
|
||||||
// 1. 将参与合卷的原始钢卷更新为历史数据
|
// 1. 将参与合卷的原始钢卷的二维码标记为失效,并将钢卷标记为历史数据
|
||||||
for (WmsMaterialCoilBo originalCoilBo : bo.getNewCoils()) {
|
for (WmsMaterialCoilBo originalCoilBo : bo.getNewCoils()) {
|
||||||
if (originalCoilBo.getCoilId() != null) {
|
if (originalCoilBo.getCoilId() != null) {
|
||||||
LambdaUpdateWrapper<WmsMaterialCoil> originalUpdateWrapper = new LambdaUpdateWrapper<>();
|
WmsMaterialCoil originalCoil = baseMapper.selectById(originalCoilBo.getCoilId());
|
||||||
originalUpdateWrapper.eq(WmsMaterialCoil::getCoilId, originalCoilBo.getCoilId())
|
if (originalCoil != null) {
|
||||||
.set(WmsMaterialCoil::getDataType, 0); // 设置为历史数据
|
// 标记二维码为失效
|
||||||
baseMapper.update(null, originalUpdateWrapper);
|
if (originalCoil.getQrcodeRecordId() != null) {
|
||||||
|
WmsGenerateRecordBo oldQrBo = new WmsGenerateRecordBo();
|
||||||
|
oldQrBo.setRecordId(originalCoil.getQrcodeRecordId());
|
||||||
|
oldQrBo.setStatus(0); // 0=失效
|
||||||
|
generateRecordService.updateByBo(oldQrBo);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 标记钢卷为历史数据
|
||||||
|
LambdaUpdateWrapper<WmsMaterialCoil> originalUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
originalUpdateWrapper.eq(WmsMaterialCoil::getCoilId, originalCoilBo.getCoilId())
|
||||||
|
.set(WmsMaterialCoil::getDataType, 0); // 设置为历史数据
|
||||||
|
baseMapper.update(null, originalUpdateWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -821,21 +831,19 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新二维码内容(单个更新)
|
* 更新二维码内容(正常更新,添加step)
|
||||||
*/
|
*/
|
||||||
private void updateQrcodeContent(Long qrcodeRecordId, WmsMaterialCoilBo bo) {
|
private void updateQrcodeContentForNormalUpdate(WmsMaterialCoil oldCoil, WmsMaterialCoilBo bo) {
|
||||||
try {
|
try {
|
||||||
// 获取原钢卷信息
|
|
||||||
WmsMaterialCoil oldCoil = baseMapper.selectById(bo.getCoilId());
|
|
||||||
|
|
||||||
// 获取原二维码记录
|
// 获取原二维码记录
|
||||||
WmsGenerateRecordVo oldRecord = generateRecordService.queryById(qrcodeRecordId);
|
WmsGenerateRecordVo oldRecord = generateRecordService.queryById(oldCoil.getQrcodeRecordId());
|
||||||
if (oldRecord == null) {
|
if (oldRecord == null) {
|
||||||
throw new RuntimeException("二维码记录不存在");
|
throw new RuntimeException("二维码记录不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 解析现有content
|
// 解析现有content
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
Map<String, Object> contentMap = objectMapper.readValue(oldRecord.getContent(), Map.class);
|
Map<String, Object> contentMap = objectMapper.readValue(oldRecord.getContent(), Map.class);
|
||||||
|
|
||||||
// 获取现有steps
|
// 获取现有steps
|
||||||
@@ -845,39 +853,29 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
steps = new ArrayList<>();
|
steps = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加新的step,记录钢卷号的变化
|
// 添加新的step,记录更新信息
|
||||||
Map<String, Object> newStep = new HashMap<>();
|
Map<String, Object> newStep = new HashMap<>();
|
||||||
newStep.put("step", steps.size() + 1);
|
newStep.put("step", steps.size() + 1);
|
||||||
newStep.put("action", "更新");
|
newStep.put("action", "更新");
|
||||||
newStep.put("old_current_coil_no", oldCoil.getCurrentCoilNo()); // 原当前钢卷号
|
newStep.put("operation", "更新");
|
||||||
newStep.put("new_current_coil_no", bo.getCurrentCoilNo()); // 新当前钢卷号
|
newStep.put("old_current_coil_no", oldCoil.getCurrentCoilNo());
|
||||||
newStep.put("coil_id", String.valueOf(bo.getCoilId())); // 钢卷ID
|
newStep.put("new_current_coil_no", bo.getCurrentCoilNo());
|
||||||
newStep.put("operator", LoginHelper.getUsername()); // 操作者
|
newStep.put("coil_id", String.valueOf(bo.getCoilId()));
|
||||||
|
newStep.put("operator", LoginHelper.getUsername());
|
||||||
// 判断操作类型
|
newStep.put("update_time", new java.util.Date());
|
||||||
if (bo.getHasMergeSplit() != null && bo.getHasMergeSplit() == 2) {
|
|
||||||
newStep.put("operation", "合卷");
|
|
||||||
newStep.put("parent_coil_nos", bo.getParentCoilNos());
|
|
||||||
} else if (bo.getHasMergeSplit() != null && bo.getHasMergeSplit() == 1) {
|
|
||||||
newStep.put("operation", "分卷");
|
|
||||||
newStep.put("new_current_coil_nos", bo.getCurrentCoilNo());
|
|
||||||
} else {
|
|
||||||
newStep.put("operation", "更新");
|
|
||||||
}
|
|
||||||
|
|
||||||
steps.add(newStep);
|
steps.add(newStep);
|
||||||
contentMap.put("steps", steps);
|
contentMap.put("steps", steps);
|
||||||
// 更新当前钢卷号到最外层(方便快速查看)
|
|
||||||
|
// 更新当前钢卷号
|
||||||
contentMap.put("current_coil_no", bo.getCurrentCoilNo());
|
contentMap.put("current_coil_no", bo.getCurrentCoilNo());
|
||||||
|
|
||||||
// 更新当前钢卷ID(注意:这里需要获取新插入的钢卷ID,但在这个方法中还没有新ID)
|
// current_coil_id保持不变(因为coilId没有变化)
|
||||||
// 所以这个方法只在库区不变化时调用,此时钢卷ID不变
|
|
||||||
// contentMap.put("current_coil_id", String.valueOf(bo.getCoilId())); // 保持当前ID不变
|
|
||||||
|
|
||||||
// 更新二维码记录
|
// 更新二维码记录
|
||||||
String newContentJson = objectMapper.writeValueAsString(contentMap);
|
String newContentJson = objectMapper.writeValueAsString(contentMap);
|
||||||
WmsGenerateRecordBo updateBo = new WmsGenerateRecordBo();
|
WmsGenerateRecordBo updateBo = new WmsGenerateRecordBo();
|
||||||
updateBo.setRecordId(qrcodeRecordId);
|
updateBo.setRecordId(oldCoil.getQrcodeRecordId());
|
||||||
updateBo.setContent(newContentJson);
|
updateBo.setContent(newContentJson);
|
||||||
generateRecordService.updateByBo(updateBo);
|
generateRecordService.updateByBo(updateBo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user