Просмотр исходного кода

调拨,次品流转选择BOM调整

lxf 1 год назад
Родитель
Сommit
dcecbbf0a7

+ 21 - 16
src/views/production/warehouse/defective-turnover/index.vue

@@ -41,11 +41,7 @@
             <el-table :data="formData.data.inOutStorageBomList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader">
               <el-table-column label="品号" prop="code" width="180" />
               <el-table-column label="品名" prop="name" min-width="220" />
-              <el-table-column label="单品尺寸(L*W*H)" align="center" width="300">
-                <template #default="{ row }">
-                  <span>{{ `${row.length} * ${row.width} * ${row.height}` }}</span>
-                </template>
-              </el-table-column>
+              <el-table-column label="可用库存" prop="availableStock" width="120" />
               <el-table-column label="入库数量" width="180">
                 <template #default="{ row, $index }">
                   <el-form-item :prop="'inOutStorageBomList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true" style="width: 100%">
@@ -56,7 +52,8 @@
                       style="width: 100%"
                       :controls="false"
                       :min="0"
-                      :precision="0" />
+                      :precision="0"
+                      :max="row.availableStock" />
                   </el-form-item>
                 </template>
               </el-table-column>
@@ -76,7 +73,11 @@
     </el-card>
 
     <el-dialog title="选择BOM" v-if="openBOM" v-model="openBOM" width="90%">
-      <SelectBOM :selectStatus="true" @selectBOM="selectBOM"></SelectBOM>
+      <SelectInventory
+        :selectStatus="true"
+        :departmentId="formData.data.departmentId"
+        :warehouseId="formData.data.outWarehouseId"
+        @selectBOM="selectBOM"></SelectInventory>
       <template #footer>
         <el-button @click="openBOM = false" size="large">关 闭</el-button>
       </template>
@@ -89,7 +90,7 @@ import byForm from "/src/components/byForm/index";
 import { ElMessage } from "element-plus";
 import { useRouter } from "vue-router";
 import useTagsViewStore from "/src/store/modules/tagsView";
-import SelectBOM from "/src/views/group/BOM/management/index";
+import SelectInventory from "/src/views/production/warehouse/inventory/index";
 
 const { proxy } = getCurrentInstance();
 const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
@@ -169,24 +170,28 @@ const getDemandData = () => {
 getDemandData();
 const openBOM = ref(false);
 const clickAddBOM = () => {
+  if (!(formData.data.departmentId || formData.data.departmentId === "0")) {
+    return ElMessage("请先选择事业部");
+  }
+  if (!(formData.data.outWarehouseId || formData.data.outWarehouseId === "0")) {
+    return ElMessage("请先选择仓库");
+  }
   openBOM.value = true;
 };
 const selectBOM = (item) => {
   if (formData.data.inOutStorageBomList && formData.data.inOutStorageBomList.length > 0) {
-    let list = formData.data.inOutStorageBomList.filter((itemFilter) => itemFilter.bomSpecId === item.id);
+    let list = formData.data.inOutStorageBomList.filter((itemFilter) => itemFilter.bomSpecId === item.bomSpecId);
     if (list && list.length > 0) {
       return ElMessage("该BOM已添加");
     }
   }
-  if (item.id) {
+  if (item.bomSpecId) {
     formData.data.inOutStorageBomList.push({
-      bomSpecId: item.id,
-      code: item.code,
-      name: item.name,
-      length: item.length,
-      width: item.width,
-      height: item.height,
+      bomSpecId: item.bomSpecId,
+      code: item.bomSpecCode,
+      name: item.bomSpecName,
       quantity: undefined,
+      availableStock: item.quantity,
     });
     ElMessage({ message: "选择完成", type: "success" });
   }

+ 22 - 17
src/views/production/warehouse/transfer/index.vue

@@ -41,11 +41,7 @@
             <el-table :data="formData.data.inOutStorageBomList" :row-style="{ height: '35px' }" header-row-class-name="tableHeader">
               <el-table-column label="品号" prop="code" width="180" />
               <el-table-column label="品名" prop="name" min-width="220" />
-              <el-table-column label="单品尺寸(L*W*H)" align="center" width="300">
-                <template #default="{ row }">
-                  <span>{{ `${row.length} * ${row.width} * ${row.height}` }}</span>
-                </template>
-              </el-table-column>
+              <el-table-column label="可用库存" prop="availableStock" width="120" />
               <el-table-column label="入库数量" width="180">
                 <template #default="{ row, $index }">
                   <el-form-item :prop="'inOutStorageBomList.' + $index + '.quantity'" :rules="rules.quantity" :inline-message="true" style="width: 100%">
@@ -56,7 +52,8 @@
                       style="width: 100%"
                       :controls="false"
                       :min="0"
-                      :precision="0" />
+                      :precision="0"
+                      :max="row.availableStock" />
                   </el-form-item>
                 </template>
               </el-table-column>
@@ -76,7 +73,11 @@
     </el-card>
 
     <el-dialog title="选择BOM" v-if="openBOM" v-model="openBOM" width="90%">
-      <SelectBOM :selectStatus="true" @selectBOM="selectBOM"></SelectBOM>
+      <SelectInventory
+        :selectStatus="true"
+        :departmentId="formData.data.departmentId"
+        :warehouseId="formData.data.outWarehouseId"
+        @selectBOM="selectBOM"></SelectInventory>
       <template #footer>
         <el-button @click="openBOM = false" size="large">关 闭</el-button>
       </template>
@@ -89,7 +90,7 @@ import byForm from "/src/components/byForm/index";
 import { ElMessage } from "element-plus";
 import { useRouter } from "vue-router";
 import useTagsViewStore from "/src/store/modules/tagsView";
-import SelectBOM from "/src/views/group/BOM/management/index";
+import SelectInventory from "/src/views/production/warehouse/inventory/index";
 
 const { proxy } = getCurrentInstance();
 const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
@@ -113,7 +114,7 @@ const formConfig = computed(() => {
   return [
     {
       type: "title",
-      title: "库信息",
+      title: "库信息",
       label: "",
     },
     {
@@ -167,24 +168,28 @@ const getDemandData = () => {
 getDemandData();
 const openBOM = ref(false);
 const clickAddBOM = () => {
+  if (!(formData.data.departmentId || formData.data.departmentId === "0")) {
+    return ElMessage("请先选择事业部");
+  }
+  if (!(formData.data.outWarehouseId || formData.data.outWarehouseId === "0")) {
+    return ElMessage("请先选择仓库");
+  }
   openBOM.value = true;
 };
 const selectBOM = (item) => {
   if (formData.data.inOutStorageBomList && formData.data.inOutStorageBomList.length > 0) {
-    let list = formData.data.inOutStorageBomList.filter((itemFilter) => itemFilter.bomSpecId === item.id);
+    let list = formData.data.inOutStorageBomList.filter((itemFilter) => itemFilter.bomSpecId === item.bomSpecId);
     if (list && list.length > 0) {
       return ElMessage("该BOM已添加");
     }
   }
-  if (item.id) {
+  if (item.bomSpecId) {
     formData.data.inOutStorageBomList.push({
-      bomSpecId: item.id,
-      code: item.code,
-      name: item.name,
-      length: item.length,
-      width: item.width,
-      height: item.height,
+      bomSpecId: item.bomSpecId,
+      code: item.bomSpecCode,
+      name: item.bomSpecName,
       quantity: undefined,
+      availableStock: item.quantity,
     });
     ElMessage({ message: "选择完成", type: "success" });
   }