Przeglądaj źródła

Merge branch 'test' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-wms into test

yusheng 9 miesięcy temu
rodzic
commit
fab3656d84

+ 1 - 1
src/views/warehouseManagement/components/WarehousingDialog.vue

@@ -24,7 +24,7 @@
             </el-select>
             </el-select>
           </el-form-item>
           </el-form-item>
         </el-col>
         </el-col>
-        <el-col :span="4">
+        <el-col :span="4" style="margin-top: 3px;">
           <el-button type="primary" @click="addTableData">添加</el-button>
           <el-button type="primary" @click="addTableData">添加</el-button>
         </el-col>
         </el-col>
         <el-col :span="6">
         <el-col :span="6">

+ 17 - 1
src/views/warehouseManagement/inventoryAllocation/components/inventory-search.vue

@@ -50,7 +50,7 @@
           <el-select
           <el-select
             filterable
             filterable
             placeholder="请选择"
             placeholder="请选择"
-            @change="getTreeData"
+            @change="getWarehouseListHandle"
             v-model="where.factoryId"
             v-model="where.factoryId"
             clearable
             clearable
             class="w100"
             class="w100"
@@ -207,6 +207,7 @@
 
 
 <script>
 <script>
   import { login } from '@/api/login';
   import { login } from '@/api/login';
+  import { getWarehouseList } from '@/api/classifyManage/itemInformation';
   import storageApi from '@/api/warehouseManagement/index.js';
   import storageApi from '@/api/warehouseManagement/index.js';
   import { allocationType } from '@/utils/dict/warehouse';
   import { allocationType } from '@/utils/dict/warehouse';
   import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
   import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
@@ -232,6 +233,7 @@
         treeData: [],
         treeData: [],
         factoryList: [],
         factoryList: [],
         warehouseList: [],
         warehouseList: [],
+        allWarehouseList: [],
         stutusOptions: [
         stutusOptions: [
           {
           {
             value: 0,
             value: 0,
@@ -255,6 +257,7 @@
       }
       }
     },
     },
     created() {
     created() {
+      this.getArguInfo();
       this.getFactoryList();
       this.getFactoryList();
     },
     },
     methods: {
     methods: {
@@ -275,6 +278,11 @@
         }
         }
         this.treeLoading = false;
         this.treeLoading = false;
       },
       },
+
+      async getArguInfo() {
+        const { data } = await getWarehouseList();
+        this.allWarehouseList = data;
+      },
       //获取工厂列表
       //获取工厂列表
       async getFactoryList() {
       async getFactoryList() {
         const res = await warehouseDefinition.getFactoryarea({
         const res = await warehouseDefinition.getFactoryarea({
@@ -284,6 +292,14 @@
         });
         });
         this.factoryList = res.list;
         this.factoryList = res.list;
       },
       },
+
+      getWarehouseListHandle(val) {
+        this.where.targetWarehouse = '';
+        this.where.sourceWarehouse = '';
+        this.warehouseList = this.allWarehouseList.filter(
+          (item) => item.factoryId === val
+        );
+      },
       /* 搜索 */
       /* 搜索 */
       search() {
       search() {
         console.log(this.where);
         console.log(this.where);

+ 144 - 102
src/views/warehouseManagement/stockManagement/add.vue

@@ -1385,6 +1385,7 @@
                 warehouseName: item.warehouseName, // 仓库名称
                 warehouseName: item.warehouseName, // 仓库名称
                 warehouseIds: [item.warehouseId],
                 warehouseIds: [item.warehouseId],
                 warehouseNames: [item.warehouseName]
                 warehouseNames: [item.warehouseName]
+                // 编辑时单位选择消失bug
               };
               };
             });
             });
             // this.$nextTick(() => {
             // this.$nextTick(() => {
@@ -1402,6 +1403,10 @@
         return new BigNumber(number).toString();
         return new BigNumber(number).toString();
       },
       },
       viewInit() {
       viewInit() {
+        const _this = this;
+        // 编辑时选单位没有选项bug
+        let packingSpecification;
+
         storageApi
         storageApi
           .getInboundDetailsById(this.$route.query.detailId)
           .getInboundDetailsById(this.$route.query.detailId)
           .then(async (data) => {
           .then(async (data) => {
@@ -1411,12 +1416,33 @@
             this.formData.id = data.id;
             this.formData.id = data.id;
             this.formData.bizNo = data.bizNo;
             this.formData.bizNo = data.bizNo;
             const batchNo = await getCode('lot_number_code');
             const batchNo = await getCode('lot_number_code');
+
+            packingSpecification =
+              await storageApi.getCategoryPackageDisposition({
+                categoryIds: data.outInDetailList.map((item) => item.categoryId)
+              });
+
+            console.log(packingSpecification);
+
+            this.packingSpecificationOption = data.outInDetailList.map(
+              (item) => {
+                return packingSpecification
+                  .filter((ite) => item.categoryId == ite.categoryId)
+                  .sort((a, b) => a.sort - b.sort);
+              }
+            );
+
+            const newSpecificationOption = this.packingSpecificationOption;
             this.productList = data.outInDetailList.map(
             this.productList = data.outInDetailList.map(
               (productItem, productIndex) => {
               (productItem, productIndex) => {
                 return {
                 return {
                   ...productItem,
                   ...productItem,
                   index: this.productList.length + productIndex,
                   index: this.productList.length + productIndex,
                   isSave: true,
                   isSave: true,
+                  // 编辑时没有单位选项
+                  packingSpecificationOption:
+                    newSpecificationOption[productIndex],
+                  //
                   packingSpecificationLabel:
                   packingSpecificationLabel:
                     productItem.extField?.packingSpecification?.split(','),
                     productItem.extField?.packingSpecification?.split(','),
                   batchNo: batchNo, // 批次号
                   batchNo: batchNo, // 批次号
@@ -2216,110 +2242,122 @@
       },
       },
       // 入库
       // 入库
       handleStorage(type) {
       handleStorage(type) {
-        let boolen = this.productList.every((item) => item.isSave);
-        if (!boolen) {
-          this.$message.warning('请先保存所有产品信息');
-          return;
-        }
-        // 处理包装数据
-        this.packingList = this.packingList.map((packingItem) => {
-          if (packingItem.modelKey) {
-            packingItem.modelKey = packingItem.modelKey.toString();
-          }
-          if (packingItem.colorKey) {
-            packingItem.colorKey = packingItem.colorKey.toString();
-          }
-          return {
-            ...packingItem,
-            materialDetailList: this.materialList.filter(
-              (item) => item.parentIndex === packingItem.index
-            ),
-            taskId: this.selWWData?.taskId,
-            workOrderId: this.selWWData?.workOrderId
-          };
-        });
-        // 处理产品数据
-        this.productList = this.productList.map((productItem) => {
-          if (productItem.modelKey) {
-            productItem.modelKey = productItem.modelKey.toString();
-          }
-          if (productItem.colorKey) {
-            productItem.colorKey = productItem.colorKey.toString();
-          }
-          return {
-            ...productItem,
-            outInDetailRecordRequestList: this.packingList.filter(
-              (item) => item.parentIndex === productItem.index
-            )
-          };
-        });
-        this.formData.outInDetailList = this.productList;
-        let obj = deepClone(this.formData);
-        // 处理物品类型assetType
-        obj.extInfo.assetType = obj.extInfo.assetType.join(',');
-        // 处理仓库id
-        let warehouseId = [];
-        let warehouseName = [];
-        let warehouseIds = this.productList
-          .map((item) => item.warehouseIds)
-          .flat();
-        let warehouseNames = this.productList
-          .map((item) => item.warehouseNames)
-          .flat();
-        warehouseIds.forEach((item, index) => {
-          if (!warehouseId.includes(item)) {
-            warehouseId.push(item);
-            warehouseName.push(warehouseNames[index]);
-          }
-        });
-        obj.warehouseIds = warehouseId;
-        obj.warehouseNames = warehouseName;
+        this.$refs.formName.validate(async (valid) => {
+          if (valid) {
+            if (!this.productList.length) {
+              return this.$message.warning('请至少添加一条产品');
+            }
 
 
-        console.log('入库数据', obj);
+            let boolen = this.productList.every((item) => item.isSave);
+            console.log(boolen);
 
 
-        // 是否需要审核(0审核 1跳过审核)
-        if (obj.bizType == '12') {
-          obj.isSkip = 1;
-        } else {
-          obj.isSkip = 0;
-        }
-        // obj.isSkip = 1;
-        this.saveLoading = true;
-        console.log(obj, 'objobjobjobjobjobj');
-        let api = obj.id ? storageApi.update : storageApi.storage;
-        api(obj)
-          .then(async (res) => {
-            console.log('入库成功', res);
-            console.log('入库成功', obj.id);
-            if (res.code == 0) {
-              try {
-                if (type != 'save') {
-                  if (obj.bizType == '12') {
-                    await storageApi.qualityInspectionTwo({
-                      outInIds: res.data
-                    });
-                  } else {
-                    await storageApi.submitTwo({ outInIds: res.data });
+            if (!boolen) {
+              this.$message.warning('请先保存所有产品信息');
+              return;
+            }
+            // 处理包装数据
+            this.packingList = this.packingList.map((packingItem) => {
+              if (packingItem.modelKey) {
+                packingItem.modelKey = packingItem.modelKey.toString();
+              }
+              if (packingItem.colorKey) {
+                packingItem.colorKey = packingItem.colorKey.toString();
+              }
+              return {
+                ...packingItem,
+                materialDetailList: this.materialList.filter(
+                  (item) => item.parentIndex === packingItem.index
+                ),
+                taskId: this.selWWData?.taskId,
+                workOrderId: this.selWWData?.workOrderId
+              };
+            });
+            // 处理产品数据
+            this.productList = this.productList.map((productItem) => {
+              if (productItem.modelKey) {
+                productItem.modelKey = productItem.modelKey.toString();
+              }
+              if (productItem.colorKey) {
+                productItem.colorKey = productItem.colorKey.toString();
+              }
+              return {
+                ...productItem,
+                outInDetailRecordRequestList: this.packingList.filter(
+                  (item) => item.parentIndex === productItem.index
+                )
+              };
+            });
+            this.formData.outInDetailList = this.productList;
+            let obj = deepClone(this.formData);
+            // 处理物品类型assetType
+            obj.extInfo.assetType = obj.extInfo.assetType.join(',');
+            // 处理仓库id
+            let warehouseId = [];
+            let warehouseName = [];
+            let warehouseIds = this.productList
+              .map((item) => item.warehouseIds)
+              .flat();
+            let warehouseNames = this.productList
+              .map((item) => item.warehouseNames)
+              .flat();
+            warehouseIds.forEach((item, index) => {
+              if (!warehouseId.includes(item)) {
+                warehouseId.push(item);
+                warehouseName.push(warehouseNames[index]);
+              }
+            });
+            obj.warehouseIds = warehouseId;
+            obj.warehouseNames = warehouseName;
+
+            console.log('入库数据', obj);
+
+            // 是否需要审核(0审核 1跳过审核)
+            if (obj.bizType == '12') {
+              obj.isSkip = 1;
+            } else {
+              obj.isSkip = 0;
+            }
+            // obj.isSkip = 1;
+            this.saveLoading = true;
+            console.log(obj, 'objobjobjobjobjobj');
+            let api = obj.id ? storageApi.update : storageApi.storage;
+            api(obj)
+              .then(async (res) => {
+                console.log('入库成功', res);
+                console.log('入库成功', obj.id);
+                if (res.code == 0) {
+                  try {
+                    if (type != 'save') {
+                      if (obj.bizType == '12') {
+                        await storageApi.qualityInspectionTwo({
+                          outInIds: res.data
+                        });
+                      } else {
+                        await storageApi.submitTwo({ outInIds: res.data });
+                      }
+                      this.$message.success('入库成功');
+                    } else {
+                      this.$message.success('操作成功');
+                    }
+                    // 委外入库(非采购)
+
+                    this.saveLoading = false;
+                    this.$router.push('/warehouseManagement/stockManagement');
+                  } catch (error) {
+                    this.saveLoading = false;
+                    this.$router.push('/warehouseManagement/stockManagement');
+                    console.log('提交流程失败', error);
                   }
                   }
-                  this.$message.success('入库成功');
-                } else {
-                  this.$message.success('操作成功');
                 }
                 }
-                // 委外入库(非采购)
-
-                this.saveLoading = false;
-                this.$router.push('/warehouseManagement/stockManagement');
-              } catch (error) {
+              })
+              .catch((err) => {
+                console.log('入库失败', err);
                 this.saveLoading = false;
                 this.saveLoading = false;
-                this.$router.push('/warehouseManagement/stockManagement');
-                console.log('提交流程失败', error);
-              }
-            }
-          })
-          .catch((err) => {
-            console.log('入库失败', err);
-            this.saveLoading = false;
-          });
+              });
+          } else {
+            return;
+          }
+        });
       },
       },
       pickingHandleScroll() {
       pickingHandleScroll() {
         // console.log('---------pickingHandleScroll------------');
         // console.log('---------pickingHandleScroll------------');
@@ -2623,7 +2661,7 @@
             categoryIds: data.map((item) => item.id)
             categoryIds: data.map((item) => item.id)
           });
           });
 
 
-        console.log(packingSpecification, 'packingSpecification');
+        console.log(packingSpecification, '--packingSpecification');
 
 
         this.packingSpecificationOption = data.map((item) => {
         this.packingSpecificationOption = data.map((item) => {
           return packingSpecification
           return packingSpecification
@@ -2660,8 +2698,8 @@
             categoryCode: item.code, // 物品编码
             categoryCode: item.code, // 物品编码
             categoryModel: item.modelType, // 物品型号
             categoryModel: item.modelType, // 物品型号
             specification: item.specification, // 规格
             specification: item.specification, // 规格
-            modelKey: item.modelKey?item.modelKey.split(','):'', // 机型
-            colorKey: item.colorKey?item.colorKey.split(','):'', // 颜色
+            modelKey: item.modelKey ? item.modelKey.split(',') : '', // 机型
+            colorKey: item.colorKey ? item.colorKey.split(',') : '', // 颜色
             color: item.color,
             color: item.color,
             brandNum: item.brandNum, // 牌号
             brandNum: item.brandNum, // 牌号
             batchNo: batchNo, // 批次号
             batchNo: batchNo, // 批次号
@@ -3626,4 +3664,8 @@
     word-break: break-all;
     word-break: break-all;
     white-space: nowrap;
     white-space: nowrap;
   }
   }
+
+  :deep(.el-col) {
+    margin-bottom: 12px;
+  }
 </style>
 </style>

+ 6 - 1
src/views/warehouseManagement/stocktaking/plan/components/addInventoryDialog.vue

@@ -647,7 +647,12 @@
 
 
             if (res.code == 0) {
             if (res.code == 0) {
               this.handleClose();
               this.handleClose();
-              this.$message.success(res.message);
+              console.log(res.message);
+
+              this.$message.success({
+                message:res.message,
+                duration:2000
+              });
               this.$emit('refreshList');
               this.$emit('refreshList');
             }
             }
           }
           }