diff --git a/klp-ui/src/api/wms/coil.js b/klp-ui/src/api/wms/coil.js index f40ac681..0de20e16 100644 --- a/klp-ui/src/api/wms/coil.js +++ b/klp-ui/src/api/wms/coil.js @@ -238,4 +238,68 @@ export function restoreMaterialCoil(coilId) { url: '/wms/materialCoil/rollback/' + coilId, method: 'post' }) -} \ No newline at end of file +} + +/** + * 开始分条,锁定钢卷 + */ +export function startSpecialSplit(coilId) { + if (!coilId) { + return Promise.reject(new Error('coilId is required')) + } + return request({ + url: '/wms/materialCoil/specialSplit/start', + method: 'post', + params: { + coilId + } + }) +} + +/** + * 创建一个分条 + */ +export function createSpecialChild(parentCoilId, pendingActionId, data) { + return request({ + url: '/wms/materialCoil/specialSplit/createChild', + method: 'post', + data: data, + params: { + parentCoilId, + pendingActionId + } + }) +} + +/** + * 完成分卷操作 + */ +export function completeSpecialSplit(pendingActionId) { + if (!pendingActionId) { + return Promise.reject(new Error('pendingActionId is required')) + } + return request({ + url: '/wms/materialCoil/specialSplit/complete', + method: 'post', + params: { + pendingActionId + } + }) +} + +/** + * 取消镀锌分卷 + */ +export function cancelSpecialSplit(pendingActionId) { + if (!pendingActionId) { + return Promise.reject(new Error('pendingActionId is required')) + } + return request({ + url: '/wms/materialCoil/specialSplit/cancel', + method: 'post', + params: { + pendingActionId + } + }) +} + diff --git a/klp-ui/src/assets/styles/element-ui.scss b/klp-ui/src/assets/styles/element-ui.scss index 480f6e59..d2f68d07 100644 --- a/klp-ui/src/assets/styles/element-ui.scss +++ b/klp-ui/src/assets/styles/element-ui.scss @@ -1359,6 +1359,7 @@ body { border-bottom: 1px solid $--border-color-lighter; // background: $--metal-gradient-dark; color: $--color-text-primary; // 白色标题 + margin-bottom: 0px; font-weight: 600; font-size: 14px; } diff --git a/klp-ui/src/layout/components/AppMain.vue b/klp-ui/src/layout/components/AppMain.vue index d487588f..43b9dbf2 100644 --- a/klp-ui/src/layout/components/AppMain.vue +++ b/klp-ui/src/layout/components/AppMain.vue @@ -17,7 +17,7 @@ export default { components: { iframeToggle }, computed: { cachedViews() { - console.log(this.$store.state.tagsView.cachedViews) + // console.log(this.$store.state.tagsView.cachedViews) return this.$store.state.tagsView.cachedViews }, key() { diff --git a/klp-ui/src/views/wms/coil/actflow.vue b/klp-ui/src/views/wms/coil/actflow.vue index 1b2e6627..7865988b 100644 --- a/klp-ui/src/views/wms/coil/actflow.vue +++ b/klp-ui/src/views/wms/coil/actflow.vue @@ -415,6 +415,7 @@ export default { // 特殊处理:发货和移库操作不需要跳转 if (actionType === 4 || actionType === 5 || actionType === 401 || actionType === 402) { this.$message.info(actionType === 4 ? '发货操作已在移动端完成' : '移库操作已在移动端完成'); + this.buttonLoading = false; return; } @@ -429,13 +430,19 @@ export default { else if (actionType == 200) { path = '/wms/merge'; } + else if (actionType < 100) { + path = '/wms/typing'; + } // 其他操作类型 else { - path = '/wms/typing'; + this.$message.error('特殊操作请到专门的页面进行处理'); + this.buttonLoading = false; + return; } if (!path) { this.$message.error('未知的操作类型: ' + row.actionType); + this.buttonLoading = false; return; } @@ -462,7 +469,9 @@ export default { }).catch(error => { console.error('更新状态失败:', error); this.$message.error('更新状态失败: ' + (error.message || error)); - }) + }).finally(() => { + this.buttonLoading = false; + }); }, /** 取消操作 */ handleCancel(row) { diff --git a/klp-ui/src/views/wms/coil/do/split.vue b/klp-ui/src/views/wms/coil/do/split.vue index 0525d445..c1333512 100644 --- a/klp-ui/src/views/wms/coil/do/split.vue +++ b/klp-ui/src/views/wms/coil/do/split.vue @@ -1,5 +1,5 @@ \ No newline at end of file + // 查询钢卷的已分条列表 + async getSplitList() { + this.splitListLoading = true + try { + if (!this.actionId) { + return + } + const action = await getPendingAction(this.actionId) + const coilIds = action.data.remark; + console.log('coilIds', coilIds) + if (!coilIds) { + this.splitList = [] + return + } + const res = await listMaterialCoil({ + coilIds + }) + this.splitList = res.rows || [] + updatePendingAction({ + actionId: action.data.actionId, + actionStatus: action.data.actionStatus, + actionType: action.data.actionType, + coilId: action.data.coilId, + currentCoilNo: action.data.currentCoilNo, + remark: res.rows.map(item => item.coilId).join(','), + }) + } catch (error) { + this.$message.error('查询分条列表异常:' + error.message) + } finally { + this.splitListLoading = false + } + }, + + // 新增一个分条表单(重置表单并显示) + async addSplitForm() { + this.showSplitForm = true + this.selectedSplitItem = null + this.resetSplitForm() + this.splitForm.enterCoilNo = this.coilInfo.enterCoilNo || '' + }, + + // 重置分条表单 + resetSplitForm() { + this.$refs.splitFormRef?.resetFields() + this.splitForm = { + coilId: undefined, + enterCoilNo: '', + currentCoilNo: '', + supplierCoilNo: '', + warehouseId: '', + actualWarehouseId: '', + team: '', + materialType: '', + itemType: '', + itemId: '', + qualityStatus: '', + trimmingRequirement: '', + packingStatus: '', + packagingRequirement: '', + grossWeight: '', + netWeight: '', + length: '', + temperGrade: '', + coatingType: '', + remark: '', + parentCoilId: this.coilId, + } + }, + + // 材料类型变更处理 + handleMaterialTypeChange(val) { + // 根据材料类型设置itemType + this.splitForm.itemType = val === '成品' ? 'product' : val === '原料' ? 'raw_material' : '' + }, + + // 选中分条列表项(显示详情) + handleSplitItemClick(row) { + this.selectedSplitItem = row + this.showSplitForm = false + }, + + // 编辑分条项 + async handleEditSplit(row) { + this.showSplitForm = true + this.selectedSplitItem = null + // 赋值表单数据 + this.splitForm = { ...row } + // 同步材料类型和长度显示状态 + this.handleMaterialTypeChange(row.materialType) + }, + + // 新增/编辑分条 + async addSplit() { + try { + // 表单验证 + const valid = await this.$refs.splitFormRef.validate() + if (!valid) { + return + } + // 区分新增/编辑:有coilId则为编辑,否则为新增 + let res + this.buttonLoading = true + if (this.splitForm.coilId) { + // 编辑分条:调用更新接口 + res = await updateMaterialCoilSimple(this.splitForm) + } else { + // 新增分条:调用创建接口 + res = await createSpecialChild(this.coilId, this.actionId, this.splitForm) + } + + this.$message.success(this.splitForm.coilId ? '编辑分条成功' : '新增分条成功') + // 重置表单 + this.resetSplitForm() + this.showSplitForm = false + // 刷新分条列表 + this.getSplitList() + } catch (error) { + // 表单验证失败时的提示 + if (error.name !== 'ValidationError') { + this.$message.error((this.splitForm.coilId ? '编辑' : '新增') + '分条异常:' + error.message) + } + } finally { + this.buttonLoading = false + } + }, + + // 完成整体分条 + async completeSplit() { + this.$confirm('确认完成整体分条操作?完成后将无法修改分条信息', '提示', { + confirmButtonText: '确认', + cancelButtonText: '取消', + type: 'warning', + }).then(async () => { + try { + this.buttonLoading = true + + // 1. 完成分条主流程 + const splitRes = await completeSpecialSplit(this.actionId) + if (splitRes.code !== 200) { + this.$message.error('完成分条失败:' + splitRes.msg) + return + } + + // 2. 完成待办动作(根据业务逻辑调整) + const actionRes = await completeAction(this.actionId) + if (actionRes.code !== 200) { + this.$message.error('完成待办动作失败:' + actionRes.msg) + return + } + this.buttonLoading = false + + this.$message.success('分条操作已完成') + // 通知父组件(如需要) + this.$emit('complete') + } catch (error) { + if (error.message !== 'cancel') { // 排除取消确认的情况 + this.$message.error('完成分条异常:' + error.message) + } + } + }) + }, + }, +} + + + \ No newline at end of file