|
|
|
@ -62,7 +62,6 @@
|
|
|
|
|
@current-change="parentTableCellClick"
|
|
|
|
|
@selection-change="selectionChange" ref="parentTableRef">
|
|
|
|
|
<el-table-column type="selection" width="55"/>
|
|
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
|
|
<!-- <el-table-column label="入库单 主键" align="center" prop="instockId"/> -->
|
|
|
|
|
<el-table-column label="入库单号" align="center" prop="instockCode"/>
|
|
|
|
|
<el-table-column label="物料大类" align="center" prop="materialCategoryName">
|
|
|
|
@ -163,7 +162,7 @@
|
|
|
|
|
|
|
|
|
|
<el-dialog v-model="dialogVisible" :title="dialogTitle" width="80%">
|
|
|
|
|
<el-card shadow="never">
|
|
|
|
|
<el-form :model="dialogForm" :inline="true" label-width="120px" :disabled="isView">
|
|
|
|
|
<el-form :model="dialogForm" :inline="true" label-width="120px" :disabled="isView" ref="dialogFormRef" :rules="dialogFormRules">
|
|
|
|
|
<el-form-item label="物料大类" prop="materialCategoryId">
|
|
|
|
|
<el-select v-model="dialogForm.materialCategoryId" placeholder="请选择物料大类" @change="setMaterialList">
|
|
|
|
|
<el-option v-for="item in mategoryOptions"
|
|
|
|
@ -174,7 +173,7 @@
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
<el-form-item label="工单类型" prop="instockType">
|
|
|
|
|
<el-select v-model="dialogForm.instockType" placeholder="请选择工单类型(1采购订单,2生产订单,3手工,4系统生成)">
|
|
|
|
|
<el-select v-model="dialogForm.instockType" placeholder="请选择工单类型">
|
|
|
|
|
<el-option
|
|
|
|
|
v-for="dict in wms_instock_type"
|
|
|
|
|
:key="dict.value"
|
|
|
|
@ -224,7 +223,7 @@
|
|
|
|
|
<el-card style="margin-top: 8px" shadow="never">
|
|
|
|
|
<el-row :gutter="10" class="mb8">
|
|
|
|
|
<el-col :span="1.5">
|
|
|
|
|
<el-button type="primary" plain icon="Plus" @click="addDialogTableCell">新增</el-button>
|
|
|
|
|
<el-button type="primary" plain icon="Plus" @click="addDialogTableCell" :disabled="isAddDisabled">新增</el-button>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-table :data="dialogtable" style="width: 100%">
|
|
|
|
@ -532,6 +531,13 @@
|
|
|
|
|
>{{dict.label}}</el-radio>
|
|
|
|
|
</el-radio-group>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
|
|
<!--
|
|
|
|
|
<el-form-item>
|
|
|
|
|
<el-button @click="batchConfigVisible = true">配置条码</el-button>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
-->
|
|
|
|
|
|
|
|
|
|
<el-form-item label="已包数量" prop="printedNum">
|
|
|
|
|
<el-input v-model="childrenTableInfoForm.printedNum" placeholder="" :disabled="true"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
@ -552,6 +558,17 @@
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- <el-dialog v-model="batchConfigVisible" title="条码配置" width="40%">
|
|
|
|
|
<el-select v-model="selectedComponents" multiple placeholder="选择并排序组成部分">
|
|
|
|
|
<el-option v-for="comp in batchComponents" :key="comp" :label="comp" :value="comp" />
|
|
|
|
|
</el-select>
|
|
|
|
|
<template #footer>
|
|
|
|
|
<el-button @click="batchConfigVisible = false">取消</el-button>
|
|
|
|
|
<el-button type="primary" @click="saveBatchConfig">保存</el-button>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dialog>-->
|
|
|
|
|
|
|
|
|
|
<!-- 添加物料信息对话框 -->
|
|
|
|
|
<el-dialog title="选择物料信息" v-model="materialOpen" width='1200px' append-to-body>
|
|
|
|
|
<MaterialSelectInWMS
|
|
|
|
@ -571,8 +588,8 @@
|
|
|
|
|
|
|
|
|
|
<script setup name="Linkage" lang="ts">
|
|
|
|
|
import { listInstockOrder, getInstockOrder, delInstockOrder, addInstockOrder, updateInstockOrder, approveInstockOrder } from '@/api/wms/instockOrder';
|
|
|
|
|
import type { InstockOrderForm } from '@/api/wms/instockOrder/types';
|
|
|
|
|
import {onMounted, reactive, watch, computed} from 'vue'
|
|
|
|
|
import type { InstockOrderForm, InstockOrderVO } from '@/api/wms/instockOrder/types';
|
|
|
|
|
import { ref, onMounted, reactive, watch, computed, getCurrentInstance, toRefs, ComponentInternalInstance } from 'vue'
|
|
|
|
|
import {ElMessage, ElMessageBox} from 'element-plus'
|
|
|
|
|
import {getBaseWarehouseList} from "@/api/wms/baseWarehouse";
|
|
|
|
|
import {UserVO} from "@/api/system/user/types";
|
|
|
|
@ -590,6 +607,8 @@ import { getBaseMaterialCategoryListInWMS } from '@/api/wms/baseMaterialCategory
|
|
|
|
|
import { getWmsPurchaseOrderDetailList } from '@/api/wms/wmsPurchaseOrderDetail';
|
|
|
|
|
import { getProdOrderInfoList, listOrderInfo } from '@/api/wms/orderInfo';
|
|
|
|
|
import { getWmsPurchaseOrderList } from '@/api/wms/wmsPurchaseOrder';
|
|
|
|
|
import { useRoute } from 'vue-router';
|
|
|
|
|
import { parseTime } from '@/utils/ruoyi';
|
|
|
|
|
|
|
|
|
|
const {proxy} = getCurrentInstance() as ComponentInternalInstance;
|
|
|
|
|
const {audit_behave,
|
|
|
|
@ -663,6 +682,8 @@ const parentTableLoad = ref(false)
|
|
|
|
|
const childrenTableLoad = ref(false)
|
|
|
|
|
const isView = ref(false)
|
|
|
|
|
const partntTableSelectCell = ref({})
|
|
|
|
|
const showSearch = ref(true)
|
|
|
|
|
const columns = ref([])
|
|
|
|
|
|
|
|
|
|
const state = reactive({
|
|
|
|
|
showPurchaseOrderSelect: false,
|
|
|
|
@ -678,7 +699,8 @@ const state = reactive({
|
|
|
|
|
getBaseWarehouseList().then(e => {
|
|
|
|
|
baseStoreList.value = e.data
|
|
|
|
|
})
|
|
|
|
|
listUser().then(e => {
|
|
|
|
|
|
|
|
|
|
listUser({ pageNum: 1, pageSize: 99999 }).then(e => {
|
|
|
|
|
userList.value = e.rows;
|
|
|
|
|
})
|
|
|
|
|
/** 提交按钮 */
|
|
|
|
@ -710,11 +732,38 @@ const submitForm = async() => {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* // 生成batchCode基于配置
|
|
|
|
|
childrenTableInfoForm.value.batchCode = generateBatchCode(childrenTableInfoForm.value)*/
|
|
|
|
|
await updateInstockDetail(childrenTableInfoForm.value)
|
|
|
|
|
getChildrenTable({instockId: partntTableSelectCell.value.instockId})
|
|
|
|
|
childrenTableInfoVisible.value = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
// 新增配置相关代码
|
|
|
|
|
const batchConfigVisible = ref(false)
|
|
|
|
|
const batchComponents = ref(['当前时间', '入库单号', '物料编码']) // 可选组成部分
|
|
|
|
|
const selectedComponents = ref([]) // 用户选择的有序列表
|
|
|
|
|
onMounted(() => {
|
|
|
|
|
const saved = localStorage.getItem('batchCodeConfig')
|
|
|
|
|
if (saved) selectedComponents.value = JSON.parse(saved)
|
|
|
|
|
})
|
|
|
|
|
const saveBatchConfig = () => {
|
|
|
|
|
localStorage.setItem('batchCodeConfig', JSON.stringify(selectedComponents.value))
|
|
|
|
|
batchConfigVisible.value = false
|
|
|
|
|
}
|
|
|
|
|
const generateBatchCode = (form) => {
|
|
|
|
|
if (!selectedComponents.value.length) return '' // 或默认生成
|
|
|
|
|
return selectedComponents.value.map(comp => {
|
|
|
|
|
if (comp === '当前时间') return new Date().toISOString().slice(0,10)
|
|
|
|
|
if (comp === '入库单号') return form.instockCode
|
|
|
|
|
if (comp === '物料编码') return form.materialCode
|
|
|
|
|
return ''
|
|
|
|
|
}).join('-') // 假设用-连接,可配置
|
|
|
|
|
}
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let mategoryOptions = ref([]);
|
|
|
|
|
const getMaterialCategorySelect = async () => {
|
|
|
|
|
const res = await getBaseMaterialCategoryListInWMS(null);
|
|
|
|
@ -780,8 +829,15 @@ const query = async () => {
|
|
|
|
|
}
|
|
|
|
|
const reset = () => {
|
|
|
|
|
queryForm.value = {
|
|
|
|
|
instockId: '',
|
|
|
|
|
warehouseId: '',
|
|
|
|
|
instockCode: '',
|
|
|
|
|
materialCategoryId: '',
|
|
|
|
|
materialCategoryName: '',
|
|
|
|
|
warehouseId: '',
|
|
|
|
|
instockType: '',
|
|
|
|
|
instockMethond: routeInstockMethondValue,// 使用保存的路由参数值
|
|
|
|
|
pageNum: 1,
|
|
|
|
|
pageSize: 10
|
|
|
|
|
}
|
|
|
|
|
getParentTable()
|
|
|
|
|
}
|
|
|
|
@ -800,9 +856,9 @@ const selectionChange = (e) => {
|
|
|
|
|
const viewDetails = (e) => {
|
|
|
|
|
isView.value = true
|
|
|
|
|
dialogVisible.value = true
|
|
|
|
|
viewAllocateOrder(e.aoId).then(v => {
|
|
|
|
|
dialogForm.value = v.data
|
|
|
|
|
})
|
|
|
|
|
// viewAllocateOrder(e.aoId).then(v => { // Comment out or remove undefined function
|
|
|
|
|
// dialogForm.value = v.data
|
|
|
|
|
// })
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 父表格新增
|
|
|
|
@ -887,6 +943,7 @@ const addDialogTableCell = () => {
|
|
|
|
|
|
|
|
|
|
// 新增提交
|
|
|
|
|
const dialogSubmit = () => {
|
|
|
|
|
console.log(dialogtable.value)
|
|
|
|
|
// 将前端行映射为后端明细字段,并进行基本校验与过滤
|
|
|
|
|
const detailList = (dialogtable.value || [])
|
|
|
|
|
.map((item: any) => ({
|
|
|
|
@ -895,16 +952,17 @@ const dialogSubmit = () => {
|
|
|
|
|
materialName: item.materialName,
|
|
|
|
|
materialSpe: item.materialSpec, // 前端 materialSpec -> 后端 materialSpe
|
|
|
|
|
unitName: item.materialUnit, // 前端 materialUnit -> 后端 unitName
|
|
|
|
|
instockQty: item.instockQty,
|
|
|
|
|
instockQty: Number(item.instockQty || 0),
|
|
|
|
|
codeYesNo: item.codeYesNo || '0',
|
|
|
|
|
materialCategoryId: dialogForm.value.materialCategoryId
|
|
|
|
|
}))
|
|
|
|
|
.filter(d => d.materialId && d.materialCode && Number(d.instockQty) > 0);
|
|
|
|
|
.filter( d =>d.materialCode && Number(d.instockQty) > 0);
|
|
|
|
|
|
|
|
|
|
// if (!detailList.length) {
|
|
|
|
|
// ElMessage.error('请添加至少一条入库明细且数量>0');
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
console.log(detailList)
|
|
|
|
|
if (!detailList.length) {
|
|
|
|
|
ElMessage.error('请添加至少一条物料且数量>0');
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log(detailList,dialogtable.value);
|
|
|
|
|
|
|
|
|
@ -913,6 +971,7 @@ const dialogSubmit = () => {
|
|
|
|
|
detailListBo: detailList
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
console.log(payload)
|
|
|
|
|
addInstockOrder(payload).then(() => {
|
|
|
|
|
ElMessage.success('保存成功');
|
|
|
|
|
dialogVisible.value = false;
|
|
|
|
@ -954,7 +1013,14 @@ const parentTableInfoSubmit = () =>{
|
|
|
|
|
|
|
|
|
|
// 子表格修改
|
|
|
|
|
const childrenTableUpdate = async (e) => {
|
|
|
|
|
childrenTableInfoForm.value = (await getInstockDetail(e.instockDetailId)).data
|
|
|
|
|
const detail = (await getInstockDetail(e.instockDetailId)).data
|
|
|
|
|
const remaining = Number(detail.instockQty) - Number(detail.printedNum || 0)
|
|
|
|
|
if(remaining <= 0){
|
|
|
|
|
ElMessage.error('无剩余数量可打印')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
childrenTableInfoForm.value = detail
|
|
|
|
|
childrenTableInfoForm.value.splitPackageCount = 1
|
|
|
|
|
childrenTableInfoForm.value.printCopies = 1
|
|
|
|
|
childrenTableInfoVisible.value = true
|
|
|
|
@ -1031,6 +1097,7 @@ const submitMaterialForm = () => {
|
|
|
|
|
if (selectedMaterial.value) {
|
|
|
|
|
if (selectType.value === 'material') {
|
|
|
|
|
// 只更新当前正在编辑的行
|
|
|
|
|
console.log(selectedMaterial.value);
|
|
|
|
|
if (currentRowIndex.value >= 0 && dialogtable.value[currentRowIndex.value]) {
|
|
|
|
|
dialogtable.value[currentRowIndex.value].materialId = selectedMaterial.value.materialId;
|
|
|
|
|
dialogtable.value[currentRowIndex.value].materialName = selectedMaterial.value.materialName;
|
|
|
|
@ -1110,7 +1177,6 @@ const handlePurchaseOrderSelect = (order) => {
|
|
|
|
|
const handleProductionOrderSelect = (order) => {
|
|
|
|
|
state.selectedProductionOrder = order;
|
|
|
|
|
dialogForm.value.orderNo = order.orderCode;
|
|
|
|
|
// For production, do not auto-populate materials; user adds manually
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 验证入库数量
|
|
|
|
@ -1143,6 +1209,16 @@ const remainingQty = computed(() => {
|
|
|
|
|
return Math.max(0, instock - printed) // 添加 Math.max 防护负值
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const dialogFormRef = ref();
|
|
|
|
|
const dialogFormRules = ref({
|
|
|
|
|
warehouseId: [{ required: true, message: '请选择仓库', trigger: 'change' }],
|
|
|
|
|
instockType: [{ required: true, message: '请选择工单类型', trigger: 'change' }]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const isAddDisabled = computed(() => {
|
|
|
|
|
return dialogForm.value.instockType === '1';
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
<style>
|
|
|
|
|
.demo-form-inline .el-input {
|
|
|
|
|