diff --git a/src/views/wms/instockOrderCopy/index.vue b/src/views/wms/instockOrderCopy/index.vue
index 1c007de..b3cf853 100644
--- a/src/views/wms/instockOrderCopy/index.vue
+++ b/src/views/wms/instockOrderCopy/index.vue
@@ -62,7 +62,6 @@
@current-change="parentTableCellClick"
@selection-change="selectionChange" ref="parentTableRef">
-
@@ -163,7 +162,7 @@
-
+
-
+
- 新增
+ 新增
@@ -532,6 +531,13 @@
>{{dict.label}}
+
+
+
@@ -552,6 +558,17 @@
+
+
+
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: '',
- instockMethond: routeInstockMethondValue, // 使用保存的路由参数值
+ 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';
+});
+