@@ -172,6 +179,7 @@
@@ -179,6 +187,14 @@
+
+
+
+ 编辑
+ 删除
+
+
+
@@ -348,6 +364,29 @@
取 消
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -360,7 +399,9 @@ import {
delRequirement,
addRel,
delRel,
- addRequirementDetail
+ addRequirementDetail,
+ updateRequirementDetail,
+ delRequirementDetail
} from '@/api/aps/requirement'
import { listCrmOrder } from '@/api/aps/order'
import { parseProductContent } from '@/utils/productContent'
@@ -385,7 +426,6 @@ export default {
statusBadgeMap: { 0: 'gray', 1: 'blue', 2: 'green', 3: 'red' },
// 绑定订单
- boundOrderList: [],
bindDialogVisible: false,
bindQuery: { keyword: '', pageNum: 1, pageSize: 50 },
candidateOrderList: [],
@@ -402,6 +442,17 @@ export default {
detailLoading: false,
requirementDetailList: [],
+ // 排产明细新增/编辑对话框
+ detailDialogVisible: false,
+ detailDialogTitle: '新增排产明细',
+ detailBtnLoading: false,
+ detailForm: this.getEmptyDetailForm(),
+ detailFormRules: {
+ spec: [{ required: true, message: '规格不能为空', trigger: 'blur' }],
+ material: [{ required: true, message: '材质不能为空', trigger: 'blur' }],
+ scheduleWeight: [{ required: true, message: '排产吨数不能为空', trigger: 'change' }]
+ },
+
// 新增/编辑对话框
dialogVisible: false,
dialogTitle: '新增产需单',
@@ -414,6 +465,9 @@ export default {
}
},
computed: {
+ canEdit() {
+ return this.currentReq && (this.currentReq.scheduleStatus === 0 || this.currentReq.scheduleStatus === 3)
+ },
detailTotalWeight() {
return this.requirementDetailList.reduce((sum, item) => {
const n = Number(item.scheduleWeight)
@@ -452,6 +506,19 @@ export default {
}
},
+ getEmptyDetailForm() {
+ return {
+ scheduleDetailId: undefined,
+ scheduleId: undefined,
+ orderDetailId: undefined,
+ spec: '',
+ material: '',
+ scheduleWeight: 0,
+ productType: '',
+ remark: ''
+ }
+ },
+
handleSearch() {
this.queryParams.pageNum = 1
this.getList()
@@ -651,8 +718,8 @@ export default {
},
handleUnbindByOrderId(orderId) {
- const rel = this.boundOrderList.find(r => r.orderId === orderId)
- if (!rel) {
+ const order = (this.currentReq.orderList || []).find(o => o.orderId === orderId)
+ if (!order) {
this.$message.warning('未找到关联记录')
return
}
@@ -661,12 +728,120 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
- delRel(rel.relId).then(() => {
+ delRel(order.relId || orderId).then(() => {
this.$modal.msgSuccess('解绑成功')
this.handleReqClick(this.currentReq)
})
}).catch(() => { })
},
+
+ // ====== 下发 ======
+ handleDispatch() {
+ this.$confirm('确认下发该产需单吗?下发后将进入审核流程。', '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning'
+ }).then(() => {
+ updateRequirement({
+ scheduleId: this.currentReq.scheduleId,
+ scheduleStatus: 1
+ }).then(() => {
+ this.$modal.msgSuccess('下发成功')
+ this.getList()
+ this.handleReqClick(this.currentReq)
+ }).catch(() => {
+ this.$modal.msgError('下发失败')
+ })
+ }).catch(() => { })
+ },
+
+ // ====== 排产明细新增/编辑/删除 ======
+ resetDetailForm() {
+ this.detailForm = this.getEmptyDetailForm()
+ },
+
+ handleDetailAdd() {
+ if (!this.currentReq) {
+ this.$message.warning('请先选择一个产需单')
+ return
+ }
+ this.resetDetailForm()
+ this.detailForm.scheduleId = this.currentReq.scheduleId
+ this.detailDialogTitle = '新增排产明细'
+ this.detailDialogVisible = true
+ this.$nextTick(() => {
+ this.$refs.detailForm && this.$refs.detailForm.clearValidate()
+ })
+ },
+
+ handleDetailEdit(row) {
+ this.detailForm = { ...this.getEmptyDetailForm(), ...row }
+ this.detailDialogTitle = '编辑排产明细'
+ this.detailDialogVisible = true
+ this.$nextTick(() => {
+ this.$refs.detailForm && this.$refs.detailForm.clearValidate()
+ })
+ },
+
+ submitDetailForm() {
+ this.$refs.detailForm.validate(valid => {
+ if (!valid) return
+ this.detailBtnLoading = true
+ const formData = { ...this.detailForm }
+ if (this.detailForm.scheduleDetailId) {
+ // 更新
+ updateRequirementDetail(formData).then(() => {
+ this.$modal.msgSuccess('修改成功')
+ this.detailDialogVisible = false
+ this.refreshDetailList()
+ }).catch(() => {
+ this.$modal.msgError('修改失败')
+ }).finally(() => {
+ this.detailBtnLoading = false
+ })
+ } else {
+ // 新增
+ addRequirementDetail(formData).then(() => {
+ this.$modal.msgSuccess('新增成功')
+ this.detailDialogVisible = false
+ this.refreshDetailList()
+ }).catch(() => {
+ this.$modal.msgError('新增失败')
+ }).finally(() => {
+ this.detailBtnLoading = false
+ })
+ }
+ })
+ },
+
+ handleDetailDelete(row) {
+ this.$confirm(`确认删除排产明细「${row.spec} / ${row.material}」吗?`, '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning'
+ }).then(() => {
+ delRequirementDetail(row.scheduleDetailId).then(() => {
+ this.$modal.msgSuccess('删除成功')
+ this.refreshDetailList()
+ }).catch(() => {
+ this.$modal.msgError('删除失败')
+ })
+ }).catch(() => { })
+ },
+
+ refreshDetailList() {
+ if (!this.currentReq) return
+ this.detailLoading = true
+ getRequirement(this.currentReq.scheduleId).then(res => {
+ if (res.data) {
+ this.requirementDetailList = res.data.detailList || []
+ }
+ }).catch(() => {
+ this.requirementDetailList = []
+ }).finally(() => {
+ this.detailLoading = false
+ })
+ },
}
}
@@ -849,6 +1024,11 @@ export default {
border-color: rgba(255, 255, 255, 0.7);
}
+.detail-card-header .header-btn:disabled {
+ opacity: 0.45;
+ cursor: not-allowed;
+}
+
.detail-card-body {
padding: 0;
}
diff --git a/klp-ui/src/views/wms/post/aps/schedule.vue b/klp-ui/src/views/wms/post/aps/schedule.vue
index 8c493e237..31381fa99 100644
--- a/klp-ui/src/views/wms/post/aps/schedule.vue
+++ b/klp-ui/src/views/wms/post/aps/schedule.vue
@@ -13,55 +13,115 @@
@change="handleDateChange"
/>
查询
+
+
+
+
{{ summaryText }}