huang_an 2 лет назад
Родитель
Сommit
dfde9b5ec0

+ 60 - 0
src/api/codeManagement/index.js

@@ -0,0 +1,60 @@
+import request from '@/utils/request';
+
+// 保存/修改编码信息
+export async function saveNew(data) {
+  const res = await request.post('/main/codemanage/saveNew', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 获取编码列表
+export async function getCodeList(data) {
+  let par = new URLSearchParams(data);
+  const res = await request.get(`/main/codemanage/page?` + par, {});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 删除编码
+ */
+export async function removeCodeInfo(params) {
+  const res = await request.post('/main/codemanage/delete', params);
+  if (res.data.code == 0) {
+    return res.data.message;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 获取编码详情
+export async function getCodeDetail(id) {
+  const res = await request.get(`/main/codemanage/getById/` + id, {});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+// 生成编码
+export async function getCode(code) {
+  const res = await request.get(`/main/codemanage/getCode/${code}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+/**
+ * 检查编码是否存在
+ * @param code 编码
+ */
+export async function checkCode(code) {
+  const res = await request.get('/main/codemanage/getByCode/' + code);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 22 - 0
src/api/warehouseManagement/outin.js

@@ -53,5 +53,27 @@ export default {
     if (res.data.code == 0) {
       return res.data.data;
     }
+  },
+  //出入库单-新增入库单信息
+  addInOut: async (data) => {
+    const res = await request.post('/wms/inout/addInOut', data);
+    if (res.data.code == 0) {
+      return res.data;
+    }
+  },
+  //列表
+  pageWms: async (params) => {
+    const res = await request.get('/wms/inout/page', { params });
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
+  },
+
+  //入库详情
+  getWms: async (id) => {
+    const res = await request.get(`/wms/inout/getInfoById/${id}`);
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
   }
 };

+ 13 - 1
src/api/warehouseManagement/warehouseDefinition.js

@@ -75,7 +75,10 @@ export default {
   },
   //修改货位状态是不是满的
   warehouseChangeStatus: async (data) => {
-    const res = await request.put('/wms/warehouseuseinfo/update', data);
+    const res = await request.put(
+      '/wms/warehouseareagoodsshelvesallocation/update',
+      data
+    );
     if (res.data.code == 0) {
       return res.data.message;
     }
@@ -138,5 +141,14 @@ export default {
     if (res.data.code == 0) {
       return res.data.data;
     }
+  },
+  //根据货架查货位
+  getListByGoodId: async (goodId) => {
+    const res = await request.get(
+      `/wms/warehouseareagoodsshelvesallocation/getListByGoodId/${goodId}`
+    );
+    if (res.data.code == 0) {
+      return res.data.data;
+    }
   }
 };

+ 155 - 30
src/views/warehouseManagement/components/WareHouseDailog.vue

@@ -37,8 +37,8 @@
               <el-option
                 v-for="(item, index) in shelvesList"
                 :key="index"
-                :label="item.code"
-                :value="item.code"
+                :label="item.goodsshelvesCode"
+                :value="item.goodsshelvesCode"
                 @click.native="formData.shelves = item"
               ></el-option>
             </el-select> </el-form-item
@@ -59,22 +59,49 @@
         v-for="p in locationList"
         :key="p.id"
         class="box"
-        @click="cur = p"
-        :class="{ active: cur.code == p.code }"
+        @click="handlCur(p)"
+        :class="{ active: cur.goodsAllocationCode == p.goodsAllocationCode }"
         :style="{
-          'background-color': getStatus(p.warehouseStatVO.type).color,
-          cursor: [1, 2].includes(p.warehouseStatVO.type)
+          'background-color': getStatus(p.allocationStatus).color,
+          cursor: [1, 2].includes(p.allocationStatus)
             ? 'pointer'
             : 'not-allowed'
         }"
       >
-        {{ p.code }}
+        {{ p.goodsAllocationCode }}
       </div>
       <div class="placeholder-box"></div>
       <div class="placeholder-box"></div>
       <div class="placeholder-box"></div>
       <div class="placeholder-box"></div>
     </div>
+    <el-table :data="tableList" style="width: 940px">
+      <el-table-column label="序号" type="index"></el-table-column>
+      <el-table-column label="货位位置" prop="position" width="600">
+        <template slot-scope="scope">
+          {{ scope.row.warehouseName }} - {{ scope.row.areaName }} -
+          {{ scope.row.shelfCode }} - {{ scope.row.cargoSpaceCode }}
+        </template>
+      </el-table-column>
+
+      <el-table-column label="数量" prop="num" width="170">
+        <template slot-scope="scope">
+          <el-input
+            v-model.trim="scope.row.num"
+            style="width: 120px"
+            size="mini"
+          ></el-input>
+        </template>
+      </el-table-column>
+
+      <el-table-column width="120" label="操作" fixed="right">
+        <template slot-scope="scope">
+          <el-button type="text" @click="delItem(scope.$index)" size="small"
+            >删除</el-button
+          >
+        </template>
+      </el-table-column>
+    </el-table>
     <template slot="footer">
       <el-button @click="handleSelect" type="primary">确认</el-button>
       <el-button @click="cancel">关闭</el-button>
@@ -112,14 +139,65 @@
         warehouse: '',
         area: '',
         shelves: '',
-        cur: {},
+        cur: {
+          cargoSpaceId: ''
+        },
         shelvesList: [],
-        locationList: []
+        locationList: [],
+        tableList: [],
+        idx: null
       };
     },
 
     created() {},
     methods: {
+      delItem(index) {
+        if (index == 0 && this.tableList.length == 1) {
+          return this.$message.warning('请至少保存一条数据!');
+        }
+        this.tableList.splice(index, 1);
+      },
+      handlCur(row) {
+        if (![1, 2].includes(row.allocationStatus)) {
+          return;
+        }
+        this.cur = { ...row };
+
+        // let shelfId=
+        const { area, shelves, warehouse } = this.formData;
+        let warehouseId = warehouse.id;
+        let warehouseName = warehouse.name;
+
+        let areaId = area.id;
+        let areaName = area.name;
+        // ==========li
+        let shelfId = shelves.id;
+        let shelfCode = shelves.goodsshelvesCode;
+        // ==========li
+        let cargoSpaceId = this.cur.id;
+        let cargoSpaceCode = this.cur.goodsAllocationCode;
+
+        let flag = true;
+        this.tableList.forEach((f) => {
+          if (f.cargoSpaceId == cargoSpaceId && f.shelfId == shelfId) {
+            this.$message.info('请勿重复选择');
+            flag = false;
+          }
+        });
+        if (flag) {
+          this.tableList.push({
+            warehouseId: warehouseId,
+            warehouseName,
+            areaId,
+            areaName,
+            shelfId,
+            shelfCode,
+            cargoSpaceId,
+            cargoSpaceCode,
+            num: null
+          });
+        }
+      },
       warehouseChange() {
         this.cur = {};
         this.shelves = '';
@@ -134,17 +212,24 @@
           (i) => i.reservoirAreaCode === this.area
         );
         const rep = await warehouseDefinition.getListByAreaId(e);
-        console.log(rep);
+        this.shelvesList = rep;
       },
-      changeshelvesList() {
+      async changeshelvesList(id) {
         this.cur = {};
-        this.locationList = this.allocationReqList.filter(
-          (i) => i.goodsShelvesCode === this.shelves
-        );
+        // this.locationList = this.allocationReqList.filter(
+        //   (i) => i.goodsAllocationCode === this.shelves
+        // );
+        const goodsId = this.shelvesList.filter((item) => {
+          return item.goodsshelvesCode == id;
+        })[0].id;
+        const res = await warehouseDefinition.getListByGoodId(goodsId);
+        // console.log(res);
+        this.locationList = res;
       },
       getStatus: useDict(warehouseDefinition_locationStatus),
-      async open(row) {
+      async open(row, idx) {
         this.row = row;
+        this.idx = idx;
         this.visible = true;
         await this._getWarehouseChildren();
         if (this.row?.warehouseId) {
@@ -174,7 +259,7 @@
 
           this.allocationReqList = res.goodsAllocationList || [];
           this.locationList = this.allocationReqList.filter(
-            (i) => i.goodsShelvesCode === this.shelves
+            (i) => i.goodsAllocationCode === this.shelves
           );
           this.cur = this.allocationReqList.find(
             (w) => w.code === this.row.cargoSpaceCode
@@ -184,32 +269,72 @@
       async changeWarehouse(val) {
         this.formData.warehouse = val;
         const res = await warehouseDefinition.getListByWarehouseId(val.id);
-
         this.area = '';
         this.shelves = '';
         this.areaList = res || [];
         this.areaGoodsshelvesList = res.goodsShelvesList || [];
         this.allocationReqList = res.goodsAllocationList || [];
+
+        // ======
+        this.row.warehouseId = val.id;
+        await this.seachWareHouse();
       },
-      handleSelect() {
-        if (![1, 2].includes(this.cur.warehouseStatVO.type)) {
-          return;
+      // 查仓库
+      async seachWareHouse() {
+        if (this.row?.warehouseId) {
+          this.warehouse = this.row.warehouseId;
+          this.formData.warehouse = this.warehouseList.find(
+            (w) => w.id == this.row.warehouseId
+          );
+          const res = await warehouseDefinition.warehouseDetail(
+            this.row.warehouseId
+          );
+
+          this.areaList = res.warehouseAreasSaveList || [];
+
+          this.formData.area = this.areaList.find(
+            (w) => w.id == this.row.areaId
+          ); // this.row.areaId
+          this.area = this.row.areaCode;
+
+          this.areaGoodsshelvesList = res.areaGoodsshelvesList || [];
+          this.shelvesList = this.areaGoodsshelvesList.filter(
+            (i) => i.reservoirAreaCode === this.area
+          );
+          this.formData.shelves = this.areaGoodsshelvesList.find(
+            (w) => w.code == this.row.shelfCode
+          );
+          this.shelves = this.row.shelfCode;
+
+          this.allocationReqList = res.allocationReqList || [];
+          this.locationList = this.allocationReqList.filter(
+            (i) => i.goodsAllocationCode === this.shelves
+          );
+          this.cur = this.allocationReqList.find(
+            (w) => w.goodsAllocationCode === this.row.cargoSpaceCode
+          );
         }
-        const { warehouse, area, shelves } = this.formData;
+      },
+      handleSelect() {
+        // if (![1, 2].includes(this.cur.warehouseStatVO.type)) {
+        //   return;
+        // }
+        // const { warehouse, area, shelves } = this.formData;
 
-        this.row.warehouseId = warehouse.id;
-        this.row.warehouseName = warehouse.name;
+        // this.row.warehouseId = warehouse.id;
+        // this.row.warehouseName = warehouse.name;
 
-        this.row.areaId = area.id;
-        this.row.areaName = area.name;
-        this.row.areaCode = area.code;
+        // this.row.areaId = area.id;
+        // this.row.areaName = area.name;
+        // this.row.areaCode = area.code;
 
-        this.row.shelfId = shelves.id;
-        this.row.shelfCode = shelves.code;
+        // this.row.shelfId = shelves.id;
+        // this.row.shelfCode = shelves.code;
 
-        this.row.cargoSpaceId = this.cur.id;
-        this.row.cargoSpaceCode = this.cur.code;
+        // this.row.cargoSpaceId = this.cur.id;
+        // this.row.cargoSpaceCode = this.cur.code;
 
+        this.$emit('houseData', this.tableList, this.idx);
         this.cancel();
       },
       async _getWarehouseChildren() {

+ 119 - 30
src/views/warehouseManagement/stockManagement/add.vue

@@ -409,21 +409,31 @@
                 required
               >
                 <template slot-scope="{ row, $index }">
-                  <span v-show="!!row.isSave">
-                    {{ row.warehouseName }}-{{ row.areaName }}-{{
-                      row.shelfCode
-                    }}-{{ row.cargoSpaceCode }}
-                  </span>
                   <el-form-item
-                    v-show="!row.isSave"
-                    :prop="`warehousingMaterialList.${$index}.cargoSpaceCode`"
+                    :prop="`warehousingMaterialList.${$index}.houseList`"
                     :required="true"
                   >
-                    <el-input
-                      :value="`${row.warehouseName}-${row.areaName}-${row.shelfCode}-${row.cargoSpaceCode}`"
-                      readonly
-                      @click.native="handleWareHouse(row)"
-                    ></el-input>
+                    <div @click="handleWareHouse(row, $index)">
+                      <div
+                        style="color: #ff4949"
+                        v-if="row.houseList.length == 0"
+                      >
+                        ---(必填)
+                      </div>
+                      <div v-else>
+                        <div
+                          v-for="(item, index) in row.houseList"
+                          :key="index"
+                        >
+                          {{ item.warehouseName }}- {{ item.areaName }}-
+                          {{ item.shelfCode }}- {{ item.cargoSpaceCode
+                          }}<span style="color: #ff4949" v-if="item.num">
+                            - {{ item.num }}(数)</span
+                          >
+                          <br />
+                        </div>
+                      </div>
+                    </div>
                   </el-form-item>
                 </template>
               </el-table-column>
@@ -586,7 +596,10 @@
       :loadTree.sync="loadTree"
       @selectTableData="onSelectTableData"
     />
-    <WareHouseDailog ref="wareHouseDailogRef"></WareHouseDailog>
+    <WareHouseDailog
+      ref="wareHouseDailogRef"
+      @houseData="houseData"
+    ></WareHouseDailog>
     <ReturnSelect
       ref="returnSelectRef"
       :tableHeader="tableHeader"
@@ -633,6 +646,7 @@
   // import org from '@/api/main/org';
   // import user from '@/api/main/user';
   import { tableHeader } from '../common';
+  import { getCode } from '@/api/codeManagement/index.js';
   export default {
     components: {
       selectUpload,
@@ -817,8 +831,8 @@
         });
       },
       // 仓库编辑
-      handleWareHouse(row) {
-        this.$refs.wareHouseDailogRef.open(row);
+      handleWareHouse(row, idx) {
+        this.$refs.wareHouseDailogRef.open(row, idx);
       },
       // 入库操作
       listEdit(row) {
@@ -827,9 +841,11 @@
         row.warehouseLedgerDetails = [];
       },
       listSave(row, index) {
+        console.log(this.formData);
         const fileds = [
-          `warehousingMaterialList.${index}.cargoSpaceCode`,
-          `warehousingMaterialList.${index}.batchNo`
+          // `warehousingMaterialList.${index}.cargoSpaceCode`,
+          `warehousingMaterialList.${index}.batchNo`,
+          `warehousingMaterialList.${index}.houseList`
         ];
         if (this.formData.bizType != 5) {
           fileds.push(
@@ -846,10 +862,12 @@
           this.$message.error('请选择资产编号!');
           return;
         }
+        console.log(fileds);
         Promise.all(
           fileds.map(
             (item) =>
               new Promise(async (resolve, rej) => {
+                console.log('item', item);
                 this.$refs.warehousingMaterialListRef.validateField(
                   item,
                   (err) => {
@@ -864,10 +882,10 @@
           )
         )
           .then((res) => {
+            console.log(11111111);
             this.$set(row, 'isSave', true);
-            console.log(this.formData.bizType);
 
-            if (this.formData.bizType != 5) {
+            if (this.formData.bizScene != 5) {
               this.createMaterialCode(row);
             } else {
               // 退还
@@ -877,6 +895,7 @@
           .catch((err) => {
             this.$message.error('请填入必填项!');
           });
+        console.log(2);
       },
       // 批量设置生产日期
       handleSelectionChange(val) {
@@ -1140,22 +1159,85 @@
 
             let obj = { ...this.formData, type: 1 };
             obj.outInDetailAddPOList = arr;
-            console.log('====数据', obj);
-            // this.saveLoading = true;
-            // try {
-            //   const res = await outin.save(obj);
-            //   if (res.code == 0) {
-            //     this.$message.success('保存成功!');
-            //   }
-            // } catch (error) {}
-            // this.saveLoading = false;
+
+            // =========================================================================
+            console.log(this.warehousingMaterialList);
+
+            let parmasObj = {
+              inOutAddPO: {
+                ...this.formData,
+                ...this.formData.extInfo,
+                bizStatus: 1,
+                bizNum: await this.getOrderCode(),
+                bizScene: this.formData.bizType
+              },
+              warehouseLedgerInfos: this.warehousingMaterialList
+            };
+
+            delete parmasObj.inOutAddPO.extInfo;
+            for (let i = 0; i < parmasObj.warehouseLedgerInfos.length; i++) {
+              parmasObj.warehouseLedgerInfos[i].batchNum =
+                parmasObj.warehouseLedgerInfos[i].batchNo;
+              let warehouseIdOuter =
+                parmasObj.warehouseLedgerInfos[i].warehouseId;
+              let houseList = parmasObj.warehouseLedgerInfos[i].houseList;
+
+              if (houseList && houseList.length > 0) {
+                for (let j = 0; j < houseList.length; j++) {
+                  let warehouseIdInner = houseList[j].warehouseId;
+
+                  if (warehouseIdOuter === warehouseIdInner) {
+                    parmasObj.warehouseLedgerInfos[i] = {
+                      ...parmasObj.warehouseLedgerInfos[i],
+                      ...houseList[j]
+                    };
+                    delete parmasObj.warehouseLedgerInfos[i].houseList;
+                  }
+                }
+              }
+              const warehouseLedgerDetails =
+                parmasObj.warehouseLedgerInfos[i].warehouseLedgerDetails;
+              for (let g = 0; g < warehouseLedgerDetails.length; g++) {
+                for (
+                  let q = 0;
+                  q < warehouseLedgerDetails[g].houseList.length;
+                  q++
+                ) {
+                  warehouseLedgerDetails[g] = {
+                    ...warehouseLedgerDetails[g],
+                    ...warehouseLedgerDetails[g].houseList[q]
+                  };
+                }
+              }
+            }
+            // 遍历数组
+            for (const item of parmasObj.warehouseLedgerInfos) {
+              // 遍历 warehouseLedgerDetails 数组
+              for (const detail of item.warehouseLedgerDetails) {
+                // 在 batchNo 同级添加属性 batchNum,其值为 batchNo 的值
+                detail.batchNum = detail.batchNo;
+              }
+            }
+
+            console.log(parmasObj);
+            this.saveLoading = true;
+            try {
+              const res = await outin.addInOut(parmasObj);
+              if (res.code == 0) {
+                this.$message.success('保存成功!');
+              }
+            } catch (error) {}
+            this.saveLoading = false;
             // this.$router.push('/warehouseManagement/stockManagement');
           }
         });
       },
+      async getOrderCode() {
+        const data = await getCode('in_warehouse');
+        return data;
+      },
       //添加明细
       async onSelectTableData(val) {
-        console.log(val);
         this.warehousingMaterialList.push(
           ...val.map((next) => {
             let cur = {};
@@ -1177,11 +1259,13 @@
               minPackingCount: '',
               bizStatus: 1,
               contentImage: [],
-              warehouseLedgerDetails: []
+              warehouseLedgerDetails: [],
+              houseList: []
             };
             return cur;
           })
         );
+        console.log('sasasa===', this.warehousingMaterialList);
       },
       async initData() {
         const res = await warehouseDefinition.tree();
@@ -1246,6 +1330,11 @@
       upload(data) {
         this.formData.contentImage = data;
         this.$refs.formName.validateField('contentImage');
+      },
+      houseData(argum, idx) {
+        console.log(argum);
+        this.$set(this.warehousingMaterialList[idx], 'houseList', argum);
+        console.log('==s', this.warehousingMaterialList);
       }
     }
   };

+ 79 - 104
src/views/warehouseManagement/stockManagement/details.vue

@@ -20,34 +20,34 @@
             <el-form label-width="120px">
               <el-col :span="8">
                 <el-form-item label="入库单:">
-                  <span>{{ infoData.bizNo }}</span>
+                  <span>{{ infoData.bizNum }}</span>
                 </el-form-item>
               </el-col>
               <el-col :span="8">
                 <el-form-item label="入库物品类型:">
                   <span>{{
-                    getDictValue('类型用途', infoData?.extInfo?.assetType)
+                    getDictValue('类型用途', infoData.assetType)
                   }}</span>
                 </el-form-item>
               </el-col>
               <el-col :span="8">
                 <el-form-item label="入库场景:">
-                  <span>{{ getSceneState(infoData.bizType) }}</span>
+                  <span>{{ getSceneState(infoData.bizScene) }}</span>
                 </el-form-item>
               </el-col>
               <el-col :span="8">
                 <el-form-item label="销售订单:">
-                  <span>{{ infoData.extInfo?.documentSource }}</span>
+                  <span>{{ infoData.documentSource }}</span>
                 </el-form-item>
               </el-col>
               <el-col :span="8">
                 <el-form-item label="权属部门:">
-                  <span>{{ infoData.extInfo?.deptName }}</span>
+                  <span>{{ infoData.deptName }}</span>
                 </el-form-item>
               </el-col>
               <el-col :span="8">
                 <el-form-item label="入库登记人:">
-                  <span>{{ infoData.extInfo?.createUserName }}</span>
+                  <span>{{ infoData.createUserName }}</span>
                 </el-form-item>
               </el-col>
               <el-col :span="8">
@@ -72,12 +72,12 @@
               </el-col>
               <el-col :span="8">
                 <el-form-item label="供应商:">
-                  <span>{{ infoData.extInfo?.supplierName }}</span>
+                  <span>{{ infoData.supplierName }}</span>
                 </el-form-item>
               </el-col>
               <el-col :span="8">
                 <el-form-item label="送货人:">
-                  <span>{{ infoData.fromUser }}</span>
+                  <span>{{ infoData.deliveryName }}</span>
                 </el-form-item>
               </el-col>
               <el-col :span="8">
@@ -113,8 +113,7 @@
                 ref="multipleTable"
                 :data="warehousingMaterialList"
                 tooltip-effect="dark"
-                :key="infoData?.extInfo?.assetType"
-                border
+                :key="infoData.assetType"
                 style="width: 100%"
                 stripe
                 :header-cell-style="rowClass"
@@ -123,7 +122,7 @@
                 </el-table-column>
                 <el-table-column
                   label="物品编码"
-                  prop="categoryCode"
+                  prop="assetCode"
                   align="center"
                   width="150"
                 ></el-table-column>
@@ -131,7 +130,7 @@
                   label="名称"
                   align="center"
                   width="150"
-                  prop="name"
+                  prop="assetName"
                 ></el-table-column>
                 <el-table-column
                   v-for="(item, index) in tableHeader"
@@ -150,7 +149,7 @@
                 </el-table-column>
                 <el-table-column
                   label="批次号"
-                  prop="batchNo"
+                  prop="batchNum"
                   width="150"
                   align="center"
                 >
@@ -159,46 +158,38 @@
                   label="最小包装单元"
                   align="center"
                   prop="measurementUnit"
-                  width="60"
+                  width="100"
                 >
-                  <el-table-column
-                    label=""
-                    align="center"
-                    prop="measurementUnit"
-                    width="60"
-                  >
+                  <el-table-column label="" prop="measurementUnit" width="100">
                     <template slot-scope="{ row, $index }">
-                      {{ row.minPackingCount }}
+                      {{ row.measurementUnit }}
                     </template>
                   </el-table-column>
-                  <el-table-column
-                    label=""
-                    align="center"
-                    prop="measurementUnit"
-                  >
+                  <el-table-column label="" prop="measurementUnit">
                     <template slot-scope="{ row, $index }">
-                      {{ row.measuringUnit }} /{{ row.packingUnit }}
+                      {{ row.unit }} /{{ row.minPackUnit }}
                     </template>
                   </el-table-column>
                 </el-table-column>
                 <el-table-column
                   label="包装数量"
                   prop="outInNum"
+                  width="150"
                   align="center"
                 >
                   <template slot-scope="{ row, $index }">
-                    {{ row.packingCount }} {{ row.packingUnit }}
+                    {{ row.outInNum }} {{ row.minPackUnit }}
                   </template>
                 </el-table-column>
                 <el-table-column
                   label="单价"
-                  prop="price"
+                  prop="univalence"
                   width="150"
                   align="center"
                 >
                   <template slot-scope="{ row }">
-                    <template v-if="row.price || row.price === 0">
-                      {{ row.price }}
+                    <template v-if="row.univalence || row.univalence === 0">
+                      {{ row.univalence }}
                       {{ { yuan: '元', wanyuan: '万元' }[row.univalenceUnit] }}
                     </template>
                   </template>
@@ -206,13 +197,23 @@
                 <el-table-column
                   label="总额"
                   align="center"
-                  prop="totalMoney"
+                  prop="contentImage"
                   :show-overflow-tooltip="true"
                 >
+                  <template slot-scope="{ row, $index }">
+                    {{
+                      calcSum(
+                        row.outInNum,
+                        row.measurementUnit,
+                        row.univalence,
+                        row
+                      )
+                    }}
+                  </template>
                 </el-table-column>
                 <el-table-column
                   label="质检单"
-                  v-if="infoData?.extInfo?.assetType === 3"
+                  v-if="infoData.assetType === 3"
                   prop=""
                   width="150"
                   :show-overflow-tooltip="true"
@@ -222,7 +223,6 @@
                       type="primary"
                       v-for="(item, index) in row.contentImage || []"
                       @click="contentImageDownload(item)"
-                      :key="index"
                       >{{ item.name }}</el-link
                     >
                   </template>
@@ -230,20 +230,23 @@
 
                 <el-table-column
                   label="货位"
-                  prop="position"
+                  prop="warehouseName"
                   :show-overflow-tooltip="true"
                 >
+                  <template slot-scope="{ row, $index }">
+                    {{ row.warehouseName }}-{{ row.areaName }}-{{
+                      row.shelfCode
+                    }}-{{ row.cargoSpaceCode }}
+                  </template>
                 </el-table-column>
               </el-table>
             </div>
           </div>
         </div>
         <div class="mt20">
+          <!-- =={{ getDictValue('类型用途', infoData.assetType) }} -->
           <header-title
-            :title="`${getDictValue(
-              '类型用途',
-              infoData?.extInfo?.assetType
-            )}明细`"
+            :title="`${getDictValue('类型用途', infoData.assetType)}明细`"
             size="16px"
           ></header-title>
 
@@ -255,72 +258,45 @@
             style="width: 100%"
             stripe
           >
-            <el-table-column
-              label="序号"
-              type="index"
-              align="center"
-              width="50"
-            >
+            <el-table-column label="序号" type="index" width="50">
             </el-table-column>
             <el-table-column
-              :label="`${getDictValue(
-                '类型用途',
-                infoData?.extInfo?.assetType
-              )}编码`"
-              prop="code"
-              width="300"
-              align="center"
-            ></el-table-column>
-            <el-table-column
-              label="包装编码"
-              align="center"
-              prop="packageNo"
-            ></el-table-column>
-            <el-table-column
-              label="批次号"
-              align="center"
-              prop="batchNo"
+              :label="`${getDictValue('类型用途', infoData.assetType)}编码`"
+              prop="onlyCode"
             ></el-table-column>
+            <el-table-column label="包装编码" prop="num"></el-table-column>
+            <el-table-column label="批次号" prop="batchNum"></el-table-column>
             <el-table-column
               label="物品编码"
-              align="center"
-              prop="categoryCode"
-            ></el-table-column>
-            <el-table-column
-              label="名称"
-              align="center"
-              prop="name"
+              prop="assetCode"
             ></el-table-column>
-            <el-table-column
-              label="最小包装单元"
-              align="center"
-              prop="measurementUnit"
-              width="100"
-            >
-              <el-table-column
-                label=""
-                align="center"
-                prop="measurementUnit"
-                width="100"
-              >
+            <el-table-column label="名称" prop="assetName"></el-table-column>
+            <el-table-column label="最小包装单元" prop="modelType">
+              <el-table-column label="" prop="measurementUnit" width="100">
                 <template slot-scope="{ row, $index }">
-                  {{ row.minPackingCount }}
+                  {{ row.measurementUnit }}
                 </template>
               </el-table-column>
-              <el-table-column label="" align="center" prop="measurementUnit">
+              <el-table-column label="" prop="measurementUnit">
                 <template slot-scope="{ row, $index }">
-                  {{ row.measuringUnit }} /{{ row.packingUnit }}
+                  {{ row.unit }} /{{ row.minPackUnit }}
                 </template>
               </el-table-column>
             </el-table-column>
             <el-table-column
               label="生产日期"
-              prop="dateValue"
-              align="center"
+              prop="manufactureTime"
               width="200"
             >
               <template slot="header" slot-scope="scope">
-                {{ curDateType }}
+                {{
+                  { manufactureTime: '生产日期', procurementTime: '采购日期' }[
+                    curDateType
+                  ]
+                }}
+              </template>
+              <template slot-scope="{ row }">
+                {{ row[curDateType] }}
               </template>
             </el-table-column>
           </el-table>
@@ -408,22 +384,20 @@
     },
     computed: {
       ...mapGetters(['getDictValue']),
-      curDateType() {
-        return this.materialCodeReqList[0]?.dateType == 1
-          ? '采购时间'
-          : '生产时间';
-      },
-      tableHeader() {
-        return tableHeader(this.infoData?.extInfo?.assetType);
-      },
-      emergencyState() {
-        return useDict(emergencyState)(this.infoData.emergencyState);
-      },
+      // curDateType() {
+      //   return this.materialCodeReqList[0]?.manufactureTime
+      //     ? 'manufactureTime'
+      //     : 'procurementTime';
+      // },
+      // tableHeader() {
+      //   return tableHeader(this.infoData.assetType);
+      // },
+      // emergencyState() {
+      //   return useDict(emergencyState)(this.infoData.emergencyState);
+      // },
       // 条码信息
       materialCodeReqList() {
-        return this.warehousingMaterialList
-          .map((i) => i.outInDetailRecordVOList || [])
-          .flat();
+        return this.warehousingMaterialList.flat();
       }
     },
     created() {
@@ -449,10 +423,11 @@
         return { background: '#EEEEEE', border: 'none' };
       },
       async _getInfo() {
-        const res = await outin.getById(this.$route.query.id);
+        const res = await outin.getWms(this.$route.query.id);
         if (res) {
-          this.infoData = res;
-          this.warehousingMaterialList = res.outInDetailVOList;
+          this.infoData = res.inOutVO;
+          this.warehousingMaterialList =
+            res.warehouseLedgerInfos.warehouseLedgerDetails;
         }
       },
       calcSum(a, b, c, row) {

+ 7 - 6
src/views/warehouseManagement/stockManagement/index.vue

@@ -26,7 +26,7 @@
               ></el-input> </el-form-item
           ></el-col>
           <el-col :span="4">
-            <el-form-item label="经手人" prop="deliveryName">
+            <el-form-item label="送货人" prop="deliveryName">
               <el-input
                 size="small"
                 class="w100"
@@ -97,8 +97,8 @@
         </template>
         <!-- 状态 -->
         <template v-slot:verifyStatus="{ row }">
-          <span :class="status[row.verifyStatus].class">
-            {{ status[row.verifyStatus].label }}
+          <span :class="status[row.verifyStatus + -1].class">
+            {{ status[row.verifyStatus - 1].label }}
           </span>
         </template>
         <!-- 单号链接 -->
@@ -153,8 +153,8 @@
         total: 0,
         status: [
           { label: '待审核', class: 'ele-text-primary' },
-          { label: '已完成', class: 'ele-text-primary' },
-          { label: '已驳回', class: 'ele-text-danger' } // 审核状态  1未审核  2
+          { label: '驳回', class: 'ele-text-danger' },
+          { label: '通过', class: 'ele-text-success' } // 审核状态  1未审核  2
         ],
 
         columns: [
@@ -219,12 +219,13 @@
         }
         delete params.time;
         // params.bizStatus = 1;
-        const res = await outin.list({
+        const res = await outin.pageWms({
           pageNum: page,
           size: limit,
           type: 1,
           ...params
         });
+
         return res;
       },
       getAuditStatus: useDict(auditStatus),

+ 86 - 51
src/views/warehouseManagement/warehouseDefinition/details.vue

@@ -136,28 +136,26 @@
                   <div>
                     <span class="label">库区类型</span
                     >{{
-                      item.extInfo[0].areaType
+                      item.type
                         | useDictLabelFilter(warehouseDefinition_inventoryList)
                     }}
                   </div>
                   <div>
                     <span class="label">库区属性</span
                     >{{
-                      item.extInfo[0].attribute
+                      item.attribute
                         | useDictLabelFilter(warehouseDefinition_areaAttribute)
                     }}
                   </div>
                   <div>
                     <span class="label">库区长宽高(cm)</span
-                    >{{ item.extInfo[0].areaLength }}*{{
-                      item.extInfo[0].areaWidth
-                    }}*{{ item.extInfo[0].areaHigh }}
+                    >{{ item.areaLength }}*{{ item.areaWide }}*{{
+                      item.areaHigh
+                    }}
                   </div>
-                  <div
-                    ><span class="label">货架数</span>{{ item.subCount }}</div
-                  >
+                  <div><span class="label">货架数</span>{{ item.num }}</div>
                   <div>
-                    <span class="label">货位数</span>{{ childrenLength(item) }}
+                    <span class="label">货位数</span>{{ item.allocationNumber }}
                   </div>
                   <div style="width: 10px"></div>
                 </div>
@@ -181,7 +179,7 @@
                             color: p.allocationStatus === 3 ? '#fff' : '#000'
                           }"
                         >
-                          {{ '货位' + p.code }}
+                          {{ '货位' + p.goodsAllocationCode }}
                           <!-- :style="{
                             'background-color': getStatus(
                               p.allocationStatus
@@ -199,11 +197,11 @@
                                     p,
                                     warehouseInfo.code +
                                       '-' +
-                                      p.reservoirAreaCode +
+                                      item.code +
                                       '-' +
-                                      p.goodsShelvesCode +
+                                      itm.goodsshelvesCode +
                                       '-' +
-                                      p.code
+                                      p.goodsAllocationCode
                                   )
                                 "
                               ></i>
@@ -220,17 +218,19 @@
                     <div class="detail">
                       <div>
                         <span class="label">货架号</span
-                        >{{ warehouseInfo.code }}-{{ item.code }}-{{ itm.code }}
+                        >{{ warehouseInfo.code }}-{{ item.code }}-{{
+                          itm.goodsshelvesCode
+                        }}
                       </div>
                       <div>
                         <span class="label">货架长宽高(cm)</span
-                        >{{ itm.extInfo[0].areaHigh }}*{{
-                          itm.extInfo[0].areaWidth
-                        }}*{{ itm.extInfo[0].areaWidth }}
+                        >{{ itm.goodsshelvesLength }}*{{
+                          itm.goodsshelvesWide
+                        }}*{{ itm.goodsshelvesHigh }}
                       </div>
                       <div>
                         <span class="label">货架层数</span
-                        >{{ itm.extInfo[0].line }}
+                        >{{ itm.goodsshelvesLine }}
                       </div>
                       <div>
                         <span class="label">货位数</span
@@ -238,18 +238,27 @@
                       </div>
                       <div>
                         <span class="label">空置货位数</span>
-                        <!-- {{itm.children.filter((i) => i.allocationStatus === 1).length}} -->
-                        {{ itm.emptyAllocationNumber }}
+                        {{
+                          itm.children.filter((i) => i.allocationStatus === 1)
+                            .length
+                        }}
+                        <!-- {{ itm.emptyAllocationNumber }} -->
                       </div>
                       <div>
                         <span class="label">在用货位数</span>
-                        <!-- {{ itm.children.filter((i) => i.allocationStatus === 2).length }} -->
-                        {{ itm.useAllocationNumber }}
+                        {{
+                          itm.children.filter((i) => i.allocationStatus === 2)
+                            .length
+                        }}
+                        <!-- {{ itm.useAllocationNumber }} -->
                       </div>
                       <div>
                         <span class="label">已满货位数</span>
-                        <!-- {{itm.children.filter((i) => i.allocationStatus === 3) .length }} -->
-                        {{ itm.fullAllocationNumber }}
+                        {{
+                          itm.children.filter((i) => i.allocationStatus === 3)
+                            .length
+                        }}
+                        <!-- {{ itm.fullAllocationNumber }} -->
                       </div>
                     </div>
                   </div>
@@ -264,13 +273,13 @@
     </el-card>
 
     <el-dialog :visible.sync="statusVisible" title="变更货位状态" width="400px">
-      <el-radio-group v-model="curLocation.type">
+      <el-radio-group v-model="statusSet">
         <el-radio :label="1">正常</el-radio>
 
-        <el-radio :label="3" :disabled="[1, 4].includes(warehouseStatVO.type)"
+        <el-radio :label="3" :disabled="[1, 4].includes(curLocation.preStatus)"
           >已满</el-radio
         >
-        <el-radio :label="4" :disabled="[2, 3].includes(warehouseStatVO.type)"
+        <el-radio :label="4" :disabled="[2, 3].includes(curLocation.preStatus)"
           >失效</el-radio
         >
       </el-radio-group>
@@ -308,6 +317,7 @@
   // } from '@/api/stockManagement/warehouseDefinition';
   import GoodsInfoDialog from './components/GoodsInfoDialog.vue';
   import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
+  import { deepClone } from '@/utils';
 
   export default {
     components: { GoodsInfoDialog },
@@ -339,21 +349,21 @@
       //   // 货位状态修改
       statusSet: {
         set(val) {
-          this.curLocation.preStatus = val;
+          this.curLocation.allocationStatus = val;
         },
         get() {
-          if (this.curLocation.preStatus) {
-            if ([1, 2].includes(this.curLocation.preStatus)) {
-              return 0;
+          if (this.curLocation.allocationStatus) {
+            if ([1, 2].includes(this.curLocation.allocationStatus)) {
+              return 1;
             }
-            return this.curLocation.preStatus;
+            return this.curLocation.allocationStatus;
           }
 
           if (
-            this.curLocation.preStatus === 0 ||
+            this.curLocation.allocationStatus === 0 ||
             [1, 2].includes(this.curLocation.preStatus)
           ) {
-            return 0;
+            return 1;
           }
           return this.curLocation.preStatus;
         }
@@ -460,37 +470,62 @@
         const res = await warehouseDefinition.warehouseDetail(
           this.$route.query.id
         );
-        const { kq, hj, hw } = this.handleHouse(res);
-        console.log('=++', kq);
         this.warehouseInfo = res.warehouseVO || {};
-        //  warehouseAreasSaveList: res.reservoirAreaList || [], //库区
-        // areaGoodsshelvesList: res.goodsShelvesList || [], //货架
-        // allocationReqList: res.goodsAllocationList || [] //货位
-        // const {
-        //   warehouseAreasSaveList = [],
-        //   areaGoodsshelvesList = [],
-        //   allocationReqList = []
-        // } = res;
-        const warehouseAreasSaveList = kq || [];
-        const areaGoodsshelvesList = hj || [];
-        const allocationReqList = hw || [];
+        const {
+          warehouseAreasSaveList = [],
+          areaGoodsshelvesList = [],
+          allocationReqList = []
+        } = res;
 
         warehouseAreasSaveList.forEach((item) => {
           item.children = areaGoodsshelvesList
-            .filter((i) => i.reservoirAreaCode === item.code)
+            .filter((i) => i.warehouseAreaCode === item.code)
             .map((itm) => {
               itm.children = allocationReqList.filter(
-                (it) => it.goodsShelvesCode === itm.code
+                (i) =>
+                  itm.goodsshelvesCode === i.warehouseAreaGoodsCode &&
+                  itm.warehouseAreaCode === i.warehouseAreaCode
               );
               return itm;
             });
         });
         this.warehouseAreasSaveList = warehouseAreasSaveList;
+        console.log(warehouseAreasSaveList);
+        this.warehouseInfo = res.warehouseVO || {};
+
+        // const { kq, hj, hw } = this.handleHouse(res);
+        // this.warehouseInfo = res.warehouseVO || {};
+        //  warehouseAreasSaveList: res.reservoirAreaList || [], //库区
+        // areaGoodsshelvesList: res.goodsShelvesList || [], //货架
+        // allocationReqList: res.goodsAllocationList || [] //货位
+        // const {
+        //   warehouseAreasSaveList = [],
+        //   areaGoodsshelvesList = [],
+        //   allocationReqList = []
+        // } = res;
+        // const warehouseAreasSaveList = kq || [];
+        // const areaGoodsshelvesList = hj || [];
+        // const allocationReqList = hw || [];
+
+        // warehouseAreasSaveList.forEach((item) => {
+        //   item.children = areaGoodsshelvesList
+        //     .filter((i) => i.reservoirAreaCode === item.code)
+        //     .map((itm) => {
+        //       itm.children = allocationReqList.filter(
+        //         (it) => it.goodsShelvesCode === itm.code
+        //       );
+        //       return itm;
+        //     });
+        // });
+        // this.warehouseAreasSaveList = warehouseAreasSaveList;
+        // console.log('====sssaaa', this.warehouseAreasSaveList);
       },
       //变更货位状态
       transformStatus(item) {
-        this.warehouseStatVO = Object.assign({}, item.warehouseStatVO);
-        this.curLocation = Object.assign({}, item.warehouseStatVO);
+        // this.warehouseStatVO = item.allocationStatus;
+        // this.curLocation = Object.assign({}, item.warehouseStatVO);
+        this.curLocation = deepClone(item);
+        this.curLocation.preStatus = item.allocationStatus;
         this.statusVisible = true;
       },
       async confirmChange() {