diff --git a/src/api/materialManagement/productionMaterial/mminventory.js b/src/api/materialManagement/productionMaterial/mminventory.js index a5eca65..adf68a8 100644 --- a/src/api/materialManagement/productionMaterial/mminventory.js +++ b/src/api/materialManagement/productionMaterial/mminventory.js @@ -59,7 +59,7 @@ export function delMmInventory(pid) { /** * 获取物料编码下拉列表 - */ + */ export function getMaterialOption(query) { return request({ url: 'mes/productionMaterial/MmInventory/GetMaterialOption/', @@ -70,7 +70,7 @@ export function getMaterialOption(query) { /** * 获取入库类型列表 - */ + */ export function getTransactionOption(query) { return request({ url: 'mes/productionMaterial/MmInventory/GetTransactionOption/', @@ -93,7 +93,7 @@ export function createInboundReceipt(data) { /** * 获取库位编码下拉列表 - */ + */ export function getLocationOption(query) { return request({ url: 'mes/productionMaterial/MmInventory/GetLocationOption/', @@ -116,19 +116,19 @@ export function createOutboundReceipt(data) { /** * 导出库存表 - */ + */ export async function exportMmInventory(query) { - // return request({ - // url: '/system/User/export', - // method: 'get', - // params: query - // }) - await downFile('/mes/productionMaterial/MmInventory/export', { ...query }) + // return request({ + // url: '/system/User/export', + // method: 'get', + // params: query + // }) + await downFile('/mes/productionMaterial/MmInventory/export', { ...query }) } /** * 查询出/入库记录 - */ + */ export async function queryMmInventory(data) { return request({ url: 'mes/productionMaterial/MmInventory/GetInOrOutRecord', @@ -139,7 +139,7 @@ export async function queryMmInventory(data) { /** * 撤销出/入库记录 - */ + */ export async function cancelMmInventory(data) { return request({ url: 'mes/productionMaterial/MmInventory/RevokeReceipt', @@ -147,6 +147,3 @@ export async function cancelMmInventory(data) { data: data }) } - - - diff --git a/src/api/materialManagement/productionMaterial/mmrecordinbound.js b/src/api/materialManagement/productionMaterial/mmrecordinbound.js index f822792..15c70d3 100644 --- a/src/api/materialManagement/productionMaterial/mmrecordinbound.js +++ b/src/api/materialManagement/productionMaterial/mmrecordinbound.js @@ -59,12 +59,23 @@ export function delMmRecordInbound(pid) { /** * 导出库存表 - */ + */ export async function exportMmRecordInbound(query) { - // return request({ - // url: '/system/User/export', - // method: 'get', - // params: query - // }) - await downFile('/mes/productionMaterial/MmRecordInbound/export', { ...query }) + // return request({ + // url: '/system/User/export', + // method: 'get', + // params: query + // }) + await downFile('/mes/productionMaterial/MmRecordInbound/export', { ...query }) +} + +/** + * 领料操作 + */ +export async function takeMaterial(data) { + return request({ + url: 'mes/productionMaterial/MmRecordInbound/TakeMaterial', + method: 'post', + data: data + }) } diff --git a/src/views/materialManagement/productionMaterial/MmInventory.vue b/src/views/materialManagement/productionMaterial/MmInventory.vue index 72141b6..c7d02f2 100644 --- a/src/views/materialManagement/productionMaterial/MmInventory.vue +++ b/src/views/materialManagement/productionMaterial/MmInventory.vue @@ -660,8 +660,6 @@ type="info" size="small" title="撤销" - v-hasPermi="['mmrecordinbound:delete']" - @click="handleCancel(scope.row)" disabled >已撤销 @@ -1186,7 +1184,7 @@ function handleCancel(row) { const { code, msg } = res if (code == 200) { proxy.$modal.msgSuccess('撤销成功') - queryRecord() + getList() } else { proxy.$modal.msgError(msg) } diff --git a/src/views/materialManagement/productionMaterial/MmRecordInbound.vue b/src/views/materialManagement/productionMaterial/MmRecordInbound.vue index 6718886..2c564c0 100644 --- a/src/views/materialManagement/productionMaterial/MmRecordInbound.vue +++ b/src/views/materialManagement/productionMaterial/MmRecordInbound.vue @@ -91,30 +91,37 @@ + - + @@ -299,6 +306,65 @@ {{ $t('btn.submit') }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -308,7 +374,8 @@ import { addMmRecordInbound, delMmRecordInbound, updateMmRecordInbound, - getMmRecordInbound + getMmRecordInbound, + takeMaterial } from '@/api/materialManagement/productionMaterial/mmrecordinbound.js' import { listMmTransactionType } from '@/api/materialManagement/productionMaterial/mmtransactiontype.js' import { getMaterialOption, getLocationOption, cancelMmInventory } from '@/api/materialManagement/productionMaterial/mminventory.js' @@ -357,6 +424,26 @@ const dataList = ref([]) const queryRef = ref() const defaultTime = ref([new Date(2000, 1, 1, 0, 0, 0), new Date(2000, 2, 1, 23, 59, 59)]) +// 领料功能相关变量 +const takeMaterialOpen = ref(false) +const takeMaterialFormRef = ref() +const currentTakeMaterialRow = ref(null) +const takeMaterialForm = reactive({ + materialCode: '', + materialName: '', + supplier: '', + workorder: '', + quantity: '', + stoveCode: '', + batchNo: '', + workorderRow: '', + operator: userStore.name +}) +const takeMaterialRules = reactive({ + workorderRow: [{ required: true, message: '成品工单号不能为空', trigger: 'blur' }], + operator: [{ required: true, message: '领料人不能为空', trigger: 'blur' }] +}) + /*** 用户导入参数 */ const upload = reactive({ // 是否显示弹出层(用户导入) @@ -685,7 +772,7 @@ function handleCancel(row) { const { code, msg } = res if (code == 200) { proxy.$modal.msgSuccess('撤销成功') - queryRecord() + getList() } else { proxy.$modal.msgError(msg) } @@ -693,6 +780,69 @@ function handleCancel(row) { }) } +/** 打开领料对话框 */ +function handleTakeMaterial(row) { + currentTakeMaterialRow.value = row + // 填充只读字段 + takeMaterialForm.materialCode = row.materialCode + takeMaterialForm.materialName = row.materialName + takeMaterialForm.supplier = row.supplierName || '' + takeMaterialForm.workorder = row.workorder + takeMaterialForm.quantity = row.quantity + takeMaterialForm.stoveCode = row.stoveCode || '' + takeMaterialForm.batchNo = row.batchNo + // 清空输入字段 + takeMaterialForm.workorderRow = '' + takeMaterialForm.operator = userStore.name + // 打开对话框 + takeMaterialOpen.value = true +} + +/** 提交领料请求 */ +function submitTakeMaterialForm() { + proxy.$refs['takeMaterialFormRef'].validate((valid) => { + if (valid) { + loading.value = true + // 构建请求参数 + const params = { + id: currentTakeMaterialRow.value.id, + inboundNo: currentTakeMaterialRow.value.inboundNo, + workorderRow: takeMaterialForm.workorderRow, + operator: takeMaterialForm.operator + } + + // 调用后端的领料API + takeMaterial(params) + .then((res) => { + const { code, msg } = res + if (code == 200) { + proxy.$modal.msgSuccess('领料成功') + takeMaterialOpen.value = false + getList() + } else { + proxy.$modal.msgError(msg) + } + }) + .finally(() => { + loading.value = false + }) + } + }) +} + +/** 重置领料表单 */ +function resetTakeMaterialForm() { + takeMaterialForm.materialCode = '' + takeMaterialForm.materialName = '' + takeMaterialForm.supplier = '' + takeMaterialForm.workorder = '' + takeMaterialForm.quantity = '' + takeMaterialForm.stoveCode = '' + takeMaterialForm.batchNo = '' + takeMaterialForm.workorderRow = '' + takeMaterialForm.operator = userStore.name +} + handleQuery() getTypeOfWarehousingList() getMaterialCodeList() diff --git a/src/views/materialManagement/productionMaterial/MmRecordOutbound.vue b/src/views/materialManagement/productionMaterial/MmRecordOutbound.vue index 2df585a..680dbc5 100644 --- a/src/views/materialManagement/productionMaterial/MmRecordOutbound.vue +++ b/src/views/materialManagement/productionMaterial/MmRecordOutbound.vue @@ -90,18 +90,13 @@ +