Browse Source

出库调整

lxf 1 year ago
parent
commit
f4635c18c4

+ 0 - 8
src/views/production/warehouse/check/add.vue

@@ -36,11 +36,6 @@
             <el-table :data="formData.data.checkBomList" :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="surplusStock" width="140" />
               <el-table-column label="盘点数量" width="160">
                 <template #default="{ row, $index }">
@@ -193,9 +188,6 @@ const selectBOM = (item) => {
       bomSpecId: item.bomSpecId,
       code: item.bomSpecCode,
       name: item.bomSpecName,
-      length: item.length,
-      width: item.width,
-      height: item.height,
       surplusStock: item.quantity,
       checkQuantity: undefined,
     });

+ 22 - 13
src/views/production/warehouse/outbound/add.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="surplusStock" width="140" />
               <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%">
@@ -76,7 +72,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.warehouseId"
+        @selectBOM="selectBOM"></SelectInventory>
       <template #footer>
         <el-button @click="openBOM = false" size="large">关 闭</el-button>
       </template>
@@ -89,7 +89,7 @@ import byForm from "@/components/byForm/index";
 import { ElMessage } from "element-plus";
 import { useRouter } from "vue-router";
 import useTagsViewStore from "@/store/modules/tagsView";
-import SelectBOM from "@/views/group/BOM/management/index";
+import SelectInventory from "@/views/production/warehouse/inventory/index";
 
 const { proxy } = getCurrentInstance();
 const departmentList = ref([{ dictKey: "0", dictValue: "胜德体育" }]);
@@ -168,6 +168,12 @@ const getDemandData = () => {
 getDemandData();
 const openBOM = ref(false);
 const clickAddBOM = () => {
+  if (!(formData.data.departmentId || formData.data.departmentId === "0")) {
+    return ElMessage("请先选择事业部");
+  }
+  if (!(formData.data.warehouseId || formData.data.warehouseId === "0")) {
+    return ElMessage("请先选择仓库");
+  }
   openBOM.value = true;
 };
 const selectBOM = (item) => {
@@ -179,12 +185,10 @@ const selectBOM = (item) => {
   }
   if (item.id) {
     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,
+      surplusStock: item.quantity,
       quantity: undefined,
     });
     ElMessage({ message: "选择完成", type: "success" });
@@ -197,6 +201,11 @@ const btnDisabled = ref(false);
 const submitForm = () => {
   submit.value.handleSubmit(() => {
     if (formData.data.inOutStorageBomList && formData.data.inOutStorageBomList.length > 0) {
+      for (let i = 0; i < formData.data.inOutStorageBomList.length; i++) {
+        if (Number(formData.data.inOutStorageBomList[i].surplusStock) < Number(formData.data.inOutStorageBomList[i].quantity)) {
+          return ElMessage("出库数量大于剩余库存数量");
+        }
+      }
       btnDisabled.value = true;
       proxy.post("/inOutStorage/add", formData.data).then(
         () => {