Parcourir la source

fix:修改仓储逻辑

lupeng il y a 2 semaines
Parent
commit
0ef29d1c00

+ 298 - 0
src/components/CommonTable/configs/tableConfig.ts

@@ -1082,4 +1082,302 @@ export const tableConfig = {
       },
     ],
   },
+  HOUSE_STOCK:{
+    url: "/api/v1/wms/stock",
+    column: [
+      /*{
+        label: "入库单号",
+        prop: "taskNo",
+        search: true,
+        rules: [
+          {
+            required: true,
+            message: "入库单号不能为空",
+            trigger: "trigger",
+          },
+        ],
+      },
+      {
+        label: "计划单号",
+        prop: "planNo",
+        search: true,
+        rules: [
+          {
+            required: true,
+            message: "计划单号不能为空",
+            trigger: "trigger",
+          },
+        ],
+      },*/
+      /*{
+        label: "仓库编码",
+        prop: "houseType",
+        type: "select",
+        search: true,
+        width: 90,
+        overHidden: true,
+        editDisabled: true,
+        dicUrl:
+            dictDataUtil.request_url +
+            dictDataUtil.TYPE_CODE.warehouse_type,
+        props: {
+          label: "dictLabel",
+          value: "dictValue",
+        },
+        rules: [
+          {
+            required: true,
+            message: "仓库编码不能为空",
+            trigger: "trigger",
+          },
+        ],
+      },*/
+      {
+        label: "入库单号",
+        prop: "taskNo",
+        //type: "select",
+        search: true,
+        width: 90,
+        overHidden: true,
+        //dicUrl: dictDataUtil.request_url + "stock_material_type",
+        /* props: {
+           label: "dictLabel",
+           value: "dictValue",
+         },*/
+        rules: [
+          {
+            required: true,
+            message: "入库单号不能为空",
+            trigger: "trigger",
+          },
+        ],
+      },
+      /* {
+         label: "料箱编号",
+         prop: "vehicleCode",
+         editDisabled: true,
+         search: true,
+         rules: [
+           {
+             required: true,
+             message: "料箱编号不能为空",
+             trigger: "trigger",
+           },
+         ],
+       },*/
+      {
+        label: "仓库编号",
+        prop: "houseNo",
+        readonly: "true",
+        rules: [
+          {
+            required: true,
+            message: "仓库编号",
+            trigger: "trigger",
+          },
+        ],
+      },
+      {
+        label: "仓库名称",
+        prop: "houseName",
+        disabled: true,
+        rules: [
+          {
+            required: true,
+            message: "仓库名称",
+            trigger: "trigger",
+          },
+        ],
+      },
+      {
+        label: "库位",
+        prop: "coordinate",
+        disabled: true,
+        rules: [
+          {
+            required: true,
+            message: "仓库名称",
+            trigger: "trigger",
+          },
+        ],
+      },
+      {
+        label: "层级",
+        prop: "position",
+        disabled: true,
+        rules: [
+          {
+            required: true,
+            message: "仓库名称",
+            trigger: "trigger",
+          },
+        ],
+      },
+      {
+        label: "二维码",
+        width: 120,
+        overHidden: true,
+        prop: "batchCode",
+        search: true,
+      },
+      /*{
+        label: "流转卡号",
+        width: 130,
+        overHidden: true,
+        prop: "seqNo",
+      },*/
+      {
+        label: "物料名称",
+        prop: "materialName",
+        width: 130,
+        overHidden: true,
+        search: true,
+        rules: [
+          {
+            required: true,
+            message: "物料名称不能为空",
+            trigger: "trigger",
+          },
+        ],
+
+        /*rules: [
+          {
+            required: true,
+            message: "物料名称不能为空",
+            trigger: "trigger",
+          },
+        ],*/
+      },
+      {
+        label: "数量",
+        prop: "num",
+        type: "number",
+        min: 0,
+        max: 99999,
+        width: 150,
+
+        overHidden: true,
+        formatter: (val, value, label) => {
+          if (val.warningMsg) {
+            return val.num + "(" + val.warningMsg + ")";
+          } else {
+            return val.num;
+          }
+        },
+      },
+      {
+        label: "单位",
+        disabled: true,
+        display: false,
+        dicUrl: dictDataUtil.request_url + "danwei_type",
+        props: {
+          label: "dictLabel",
+          value: "dictValue",
+        },
+        prop: "unit",
+      },
+    ],
+  },
+  HOUSE_POSITION:{
+    url: "/api/v1/wms/position",
+    column: [
+      {
+        label: "仓库编码",
+        prop: "houseNo",
+        /* type: "select",*/
+        search: true,
+        editDisabled: true,
+        /*dicUrl: dictDataUtil.request_url + dictDataUtil.TYPE_CODE.warehouse_type,*/
+        props: {
+          label: "dictLabel",
+          value: "dictValue",
+        },
+        rules: [
+          {
+            required: true,
+            message: "仓库编码不能为空",
+            trigger: "trigger",
+          },
+        ],
+      },
+      {
+        label: "仓库名称",
+        prop: "houseName",
+        editDisabled: true,
+        rules: [
+          {
+            required: true,
+            message: "仓库名称不能为空",
+            trigger: "trigger",
+          },
+        ],
+      },
+      {
+        label: "货位",
+        prop: "coordinate",
+        search: true,
+        editDisabled: true,
+        rules: [
+          {
+            required: true,
+            message: "货位不能为空",
+            trigger: "trigger",
+          },
+        ],
+      },
+      {
+        label: "层数",
+        prop: "layer",
+        type: "number",
+        rules: [
+          {
+            required: true,
+            message: "层数不能为空",
+            trigger: "trigger",
+          },
+        ],
+      },
+      {
+        label: "货位类型",
+        prop: "materialType",
+        type: "select",
+        dicUrl:
+            dictDataUtil.request_url + dictDataUtil.TYPE_CODE.storage_location_type,
+        props: {
+          label: "dictLabel",
+          value: "dictValue",
+        },
+        rules: [
+          {
+            required: true,
+            message: "货位类型不能为空",
+            trigger: "trigger",
+          },
+        ],
+      },
+      {
+        label: "状态",
+        prop: "enable",
+        type: "select",
+        dicData: [
+          { label: "启用", value: 0 },
+          { label: "禁用", value: 1 },
+        ],
+        html: true,
+        formatter: (val) => {
+          if (val.state === 0) {
+            return '<b class="el-tag el-tag--success el-tag--light">启用</b>';
+          }
+          return '<b class="el-tag el-tag--danger el-tag--light">禁用</b>';
+        },
+        rules: [
+          {
+            required: true,
+            message: "状态不能为空",
+            trigger: "trigger",
+          },
+        ],
+      },
+    ],
+  }
 };

+ 81 - 11
src/views/storage/stock/index.vue

@@ -38,6 +38,12 @@
       <choice-item-page @material-info="materialInfo" />
     </el-dialog>
     <ExcelUpload ref="uploadRef" @finished="uploadFinished" />
+    <CommonTable
+        ref="houseRef"
+        tableTitle="选择仓库位置"
+        tableType="HOUSE_POSITION"
+        @selected-sure="onSelectedFinish"
+    />
   </div>
 </template>
 <script setup>
@@ -129,26 +135,26 @@ option.value = Object.assign(option.value, {
       ],
     },*/
     {
-      label: "物料类型",
+      label: "入库单号",
       prop: "taskNo",
-      type: "select",
+      //type: "select",
       search: true,
       width: 90,
       overHidden: true,
-      dicUrl: dictDataUtil.request_url + "stock_material_type",
-      props: {
+      //dicUrl: dictDataUtil.request_url + "stock_material_type",
+     /* props: {
         label: "dictLabel",
         value: "dictValue",
-      },
+      },*/
       rules: [
         {
           required: true,
-          message: "物料类型不能为空",
+          message: "入库单号不能为空",
           trigger: "trigger",
         },
       ],
     },
-    {
+   /* {
       label: "料箱编号",
       prop: "vehicleCode",
       editDisabled: true,
@@ -160,15 +166,54 @@ option.value = Object.assign(option.value, {
           trigger: "trigger",
         },
       ],
+    },*/
+    {
+      label: "仓库编号",
+      prop: "houseNo",
+      readonly: "true",
+      click: () => {
+        selectHouse();
+      },
+      rules: [
+        {
+          required: true,
+          message: "仓库编号",
+          trigger: "trigger",
+        },
+      ],
     },
     {
-      label: "仓库坐标",
-      prop: "locationNo",
-      editDisabled: true,
+      label: "仓库名称",
+      prop: "houseName",
+      disabled: true,
+      rules: [
+        {
+          required: true,
+          message: "仓库名称",
+          trigger: "trigger",
+        },
+      ],
+    },
+    {
+      label: "库位",
+      prop: "coordinate",
+      disabled: true,
+      rules: [
+        {
+          required: true,
+          message: "仓库名称",
+          trigger: "trigger",
+        },
+      ],
+    },
+    {
+      label: "层级",
+      prop: "position",
+      disabled: true,
       rules: [
         {
           required: true,
-          message: "仓库位置不能为空",
+          message: "仓库名称",
           trigger: "trigger",
         },
       ],
@@ -192,6 +237,13 @@ option.value = Object.assign(option.value, {
       width: 130,
       overHidden: true,
       search: true,
+      rules: [
+        {
+          required: true,
+          message: "物料名称不能为空",
+          trigger: "trigger",
+        },
+      ],
       click: ({ value, column }) => {
         if (column.boxType) {
           dialog1.visible = true;
@@ -212,6 +264,7 @@ option.value = Object.assign(option.value, {
       min: 0,
       max: 99999,
       width: 150,
+
       overHidden: true,
       formatter: (val, value, label) => {
         if (val.warningMsg) {
@@ -223,10 +276,27 @@ option.value = Object.assign(option.value, {
     },
     {
       label: "单位",
+      disabled: true,
+      display: false,
+      dicUrl: dictDataUtil.request_url + "danwei_type",
+       props: {
+         label: "dictLabel",
+         value: "dictValue",
+       },
       prop: "unit",
     },
   ],
 });
+const houseRef=ref(null);
+const selectHouse =()=>{
+  houseRef.value.startSelect();
+}
+const onSelectedFinish =(val)=>{
+  form.value.houseNo=val.houseNo;
+  form.value.houseName=val.houseName;
+  form.value.coordinate=val.coordinate;
+  form.value.position=val.layer;
+}
 const rowStyle = ({ row, column, rowIndex }) => {
   if (row.warningMsg) {
     return {

+ 7 - 8
src/views/storage/storage/index.vue

@@ -52,7 +52,7 @@
             <el-text>编码:</el-text><el-text>{{ item.houseNo }}</el-text>
           </div>
           <div>
-            <el-text>货区:</el-text><el-text>{{ item.area }}</el-text>
+            <el-text>仓库名称:</el-text><el-text>{{ item.houseName }}</el-text>
           </div>
           <div>
             <el-text>货位:</el-text><el-text>{{ item.coordinate }}</el-text>
@@ -110,15 +110,14 @@ option.value = Object.assign(option.value, {
   searchEnter: true,
   delBtn: false,
   selection: true,
-  addBtn: false,
   column: [
     {
       label: "仓库编码",
-      prop: "type",
-      type: "select",
+      prop: "houseNo",
+     /* type: "select",*/
       search: true,
       editDisabled: true,
-      dicUrl: dictDataUtil.request_url + dictDataUtil.TYPE_CODE.warehouse_type,
+      /*dicUrl: dictDataUtil.request_url + dictDataUtil.TYPE_CODE.warehouse_type,*/
       props: {
         label: "dictLabel",
         value: "dictValue",
@@ -132,13 +131,13 @@ option.value = Object.assign(option.value, {
       ],
     },
     {
-      label: "货区",
-      prop: "area",
+      label: "仓库名称",
+      prop: "houseName",
       editDisabled: true,
       rules: [
         {
           required: true,
-          message: "货区不能为空",
+          message: "仓库名称不能为空",
           trigger: "trigger",
         },
       ],

+ 136 - 20
src/views/storage/wmsOrder/index.vue

@@ -47,13 +47,14 @@
       v-model="dialog3.visible"
       :title="dialog3.title"
       width="1100px"
+      :destroy-on-close="true"
       @close="dialog3.visible = false"
     >
       <el-form ref="ruleFormRef" label-width="90px" :rules="rules">
         <el-row :gutter="22" style="margin-top: 5px">
           <el-col :span="11">
             <el-form-item label="类型" prop="type">
-              <el-select v-model="form.type" placeholder="请选择">
+              <el-select v-model="form.type" placeholder="请选择" @change="changeShow">
                 <el-option
                   v-for="option in fieldOptions"
                   :key="option.value"
@@ -64,23 +65,35 @@
             </el-form-item>
           </el-col>
           <el-col :span="11">
-            <el-form-item label="载具编号" prop="vehicleCode">
+            <el-form-item label="单据编号" prop="orderNo">
               <el-input
-                v-model="form.vehicleCode"
-                placeholder="请输入载具编号"
+                v-model="form.orderNo"
+                placeholder="请输入单据编号"
               />
             </el-form-item>
           </el-col>
         </el-row>
-        <el-row :gutter="22" style="margin-top: 5px">
+        <el-row :gutter="22" style="margin-top: 5px" v-if="isShow">
           <el-col :span="11">
-            <el-form-item label="库位坐标" prop="locationNo">
+            <el-form-item label="仓库编号" prop="houseNo">
               <el-input
-                v-model="form.locationNo"
-                placeholder="请输入库位坐标"
+                v-model="form.houseNo"
+                placeholder="仓库编号"
+                :readonly="true"
+                @click="selectHouse"
               />
             </el-form-item>
           </el-col>
+
+            <el-col :span="11">
+                <el-form-item label="仓库名称" prop="houseName">
+                    <el-input
+                            :disabled="true"
+                            v-model="form.houseName"
+                            placeholder="仓库名称"
+                    />
+                </el-form-item>
+            </el-col>
           <!--          <el-col :span="11">
             <el-form-item label="载具编号">
               <el-input
@@ -90,6 +103,39 @@
             </el-form-item>
           </el-col>-->
         </el-row>
+          <el-row :gutter="22" style="margin-top: 5px" v-if="isShow">
+              <el-col :span="11">
+                  <el-form-item label="货位" prop="coordinate">
+                      <el-input
+                              :disabled="true"
+                              v-model="form.coordinate"
+                              placeholder="货位"
+                      />
+                  </el-form-item>
+              </el-col>
+
+              <el-col :span="11">
+                  <el-form-item label="层数" prop="position">
+                      <el-input
+                              :disabled="true"
+                              v-model="form.position"
+                              placeholder="层数"
+                      />
+                  </el-form-item>
+              </el-col>
+
+          </el-row>
+
+          <el-row :gutter="22" style="margin-top: 5px">
+              <el-col :span="11">
+                <el-form-item label="载具编号">
+                  <el-input
+                      v-model="form.vehicleCode"
+                      placeholder="请输入载具编号"
+                  />
+                </el-form-item>
+              </el-col>
+          </el-row>
         <el-divider />
         <el-text class="mx-1" size="large">物料详情</el-text>
         <el-button
@@ -117,7 +163,7 @@
               v-model="item.materialNo"
               placeholder="请选择物料编号"
               readonly
-              :onclick="choiceItem(item)"
+              @click="choiceItem(item,index)"
             />
           </el-col>
           <el-col :span="3"
@@ -130,7 +176,7 @@
           <el-col :span="4">
             <el-input v-model="item.spec" placeholder="物料型号" readonly />
           </el-col>
-          <el-col :span="2">
+<!--          <el-col :span="2">
             <el-select v-model="item.materialType" placeholder="请选择物料类别">
               <el-option
                 v-for="option in stock_material_type_list"
@@ -139,7 +185,7 @@
                 :value="option.dictValue"
               />
             </el-select>
-          </el-col>
+          </el-col>-->
           <el-col :span="2">
             <el-input v-model="item.unit" placeholder="单位" readonly />
           </el-col>
@@ -150,8 +196,8 @@
             <el-input
               v-model="item.num"
               placeholder="数量"
-              min="0"
-              max="9999"
+              min="1"
+              :max="maxList[index]"
               type="number"
             />
           </el-col>
@@ -170,6 +216,18 @@
     >
       <ChoiceItemPage @material-info="materialInfo" :enabled="-1" />
     </el-dialog>
+      <CommonTable
+              ref="houseRef"
+              tableTitle="选择仓库位置"
+              tableType="HOUSE_POSITION"
+              @selected-sure="onSelectedFinish"
+      />
+      <CommonTable
+              ref="stockRef"
+              tableTitle="库存选择"
+              tableType="HOUSE_STOCK"
+              @selected-sure="onSelected"
+      />
   </div>
 </template>
 <script setup>
@@ -185,10 +243,25 @@ const test = () => {
   isShowTable.value = true;
   tableType.value = tableType.value == 1 ? 2 : 1;
 };
+const maxList=ref([]);
+const isShow=ref(true);
+const houseRef=ref(null);
+const selectHouse =()=>{
+    houseRef.value.startSelect();
+}
+
+const stockRef=ref(null);
 const showSeqPage = (info) => {
   infoObj.value = info;
   dialog4.visible = true;
 };
+const changeShow=()=>{
+    if(form.value.type==='2'){
+       isShow.value=false;
+    }else {
+        isShow.value=true;
+    }
+}
 const dialog3 = reactive({
   title: "新增",
   visible: false,
@@ -198,10 +271,17 @@ const dialog4 = reactive({
   visible: false,
 });
 const rules = reactive({
-  vehicleCode: [{ required: true, message: "请选择载具", trigger: "blur" }],
   type: [{ required: true, message: "请选择类型", trigger: "blur" }],
-  locationNo: [{ required: true, message: "请输入坐标", trigger: "blur" }],
+    orderNo: [{ required: true, message: "请输入单据编号", trigger: "blur" }]
+
 });
+
+const onSelectedFinish =(val)=>{
+   form.value.houseNo=val.houseNo;
+   form.value.houseName=val.houseName;
+    form.value.coordinate=val.coordinate;
+    form.value.position=val.layer;
+}
 const materialInfo = (value) => {
   clickObj.value.materialNo = value.materialCode;
   clickObj.value.materialName = value.materialName;
@@ -209,6 +289,22 @@ const materialInfo = (value) => {
   clickObj.value.unit = value.unitDictValue;
   dialog2.visible = false;
 };
+
+const onSelected=(value)=>{
+    for(let i=0;i<formDataList.value.length;i++){
+       if(value.id===formDataList.value[i].houseStockId){
+           ElMessage.error("该库存已经选择过了!");
+           return;
+       }
+    }
+    clickObj.value.materialNo = value.materialNo;
+    clickObj.value.materialName = value.materialName;
+    clickObj.value.spec = value.spec;
+    clickObj.value.unit = value.unit;
+    clickObj.value.num = value.num;
+    maxList.value[line.value]=value.num;
+    clickObj.value.houseStockId =value.id;
+}
 const dialog2 = reactive({
   title: "物料选择",
   visible: false,
@@ -219,17 +315,25 @@ const addVal = () => {
 const addItem = () => {
   typeIndex.value = 1;
   formDataList.value.push({});
+  maxList.value.push(9999);
 };
 const typeIndex = ref(0);
 const minusItem = () => {
   typeIndex.value = 0;
   formDataList.value.splice(formDataList.value.length - 1, 1);
+    maxList.value.slice(maxList.value.length-1,1);
 };
 const clickObj = ref(null);
-const choiceItem = (item) => {
+const line=ref(0);
+const choiceItem = (item,index) => {
   if (typeIndex.value === 1) {
-    dialog2.visible = true;
+      line.value=index;
     clickObj.value = item;
+    if(form.value.type==='2'){
+        stockRef.value.startSelect();
+    }else if(form.value.type){
+        dialog2.visible = true;
+    }
   }
 };
 const fieldOptions = ref([
@@ -253,6 +357,7 @@ const handleSubmit = () => {
       dataList();
       form.value = null;
       formDataList.value = [];
+      maxList.value=[];
       dialog3.visible = false;
     }
   });
@@ -298,10 +403,16 @@ option.value = Object.assign(option.value, {
       ],
     },
     {
-      label: "载具编号",
+      label: "仓库编号",
       overHidden: true,
-      prop: "vehicleCode",
+      prop: "houseNo",
     },
+
+      {
+          label: "仓库名称",
+          overHidden: true,
+          prop: "houseName",
+      },
     /*{
       label: "物料编号",
       width: 130,
@@ -330,8 +441,13 @@ option.value = Object.assign(option.value, {
     {
       label: "库位",
       overHidden: true,
-      prop: "locationNo",
+      prop: "coordinate",
     },
+      {
+          label: "层数",
+          overHidden: true,
+          prop: "position",
+      },
     /* {
       label: "二维码",
       prop: "batchCode",