Преглед изворни кода

优化增加多仓库功能

yaorongkeji пре 3 недеља
родитељ
комит
bb59a43d79

+ 0 - 2
inventory-admin/src/main/java/com/ruoyi/web/controller/inventory/BillsController.java

@@ -109,6 +109,4 @@ public class BillsController extends BaseController {
 
 
 
-
-
 }

+ 14 - 0
inventory-system/src/main/java/com/ruoyi/system/domain/Bills.java

@@ -46,6 +46,11 @@ public class Bills extends BaseEntity {
     @Excel(name = "出", readConverterExp = "入=")
     private String givePlace;
 
+    /**
+     * 调度时到那个仓库
+     */
+    private String wareHouse;
+
     public void setId(Long id) {
         this.id = id;
     }
@@ -86,6 +91,14 @@ public class Bills extends BaseEntity {
         return givePlace;
     }
 
+    public void setWareHouse(String wareHouse) {
+        this.wareHouse = wareHouse;
+    }
+
+    public String getWareHouse() {
+        return wareHouse;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
@@ -94,6 +107,7 @@ public class Bills extends BaseEntity {
                 .append("principal", getPrincipal())
                 .append("billsTime", getBillsTime())
                 .append("givePlace", getGivePlace())
+                .append("wareHouse", getWareHouse())
                 .append("createBy", getCreateBy())
                 .append("createTime", getCreateTime())
                 .append("updateBy", getUpdateBy())

+ 12 - 0
inventory-system/src/main/java/com/ruoyi/system/domain/Goods.java

@@ -39,6 +39,9 @@ public class Goods extends BaseEntity
     @Excel(name = "物品状态(0=在库,1=已出库)")
     private String goodsStatus;
 
+    @Excel(name = "所在仓库")
+    private String wareHouse;
+
 
     public void setId(Long id)
     {
@@ -95,6 +98,14 @@ public class Goods extends BaseEntity
         return goodsStatus;
     }
 
+    public String getWareHouse() {
+        return wareHouse;
+    }
+
+    public void setWareHouse(String wareHouse) {
+        this.wareHouse = wareHouse;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
@@ -104,6 +115,7 @@ public class Goods extends BaseEntity
                 .append("goodsType", getGoodsType())
                 .append("quantityStock", getQuantityStock())
                 .append("goodsStatus", getGoodsStatus())
+                .append("wareHouse", getWareHouse())
                 .append("createBy", getCreateBy())
                 .append("createTime", getCreateTime())
                 .append("updateBy", getUpdateBy())

+ 9 - 2
inventory-system/src/main/java/com/ruoyi/system/service/impl/BillsDetailsServiceImpl.java

@@ -106,8 +106,15 @@ public class BillsDetailsServiceImpl implements IBillsDetailsService
 //            }
 //            // 出库单据时
 //            if (bills.getBillsType().equals(BillsType.CHUKU.getCode())){
-                goodsUpdate.setGoodsStatus(bills.getBillsType());
-                billsDetails.setGoodsStatus(bills.getBillsType());
+                if (bills.getBillsType().equals("2")){
+                    goodsUpdate.setGoodsStatus("0");
+                    goodsUpdate.setWareHouse(bills.getWareHouse());
+                    billsDetails.setGoodsStatus("0");
+                }else {
+                    goodsUpdate.setGoodsStatus(bills.getBillsType());
+                    billsDetails.setGoodsStatus(bills.getBillsType());
+                }
+
 //            }
             billsDetailsMapper.insertBillsDetails(billsDetails);
             goodsMapper.updateGoods(goodsUpdate);

+ 5 - 1
inventory-system/src/main/resources/mapper/system/BillsMapper.xml

@@ -10,6 +10,7 @@
         <result property="principal"    column="principal"    />
         <result property="billsTime"    column="bills_time"    />
         <result property="givePlace"    column="give_place"    />
+        <result property="wareHouse"    column="ware_house"    />
         <result property="createBy"    column="create_by"    />
         <result property="createTime"    column="create_time"    />
         <result property="updateBy"    column="update_by"    />
@@ -18,7 +19,7 @@
     </resultMap>
 
     <sql id="selectBillsVo">
-        select id, bills_type, principal, bills_time, give_place, create_by, create_time, update_by, updateTime, remark from bills
+        select id, bills_type, principal, bills_time, give_place, ware_house, create_by, create_time, update_by, updateTime, remark from bills
     </sql>
 
     <select id="selectBillsList" parameterType="Bills" resultMap="BillsResult">
@@ -50,6 +51,7 @@
             <if test="principal != null">principal,</if>
             <if test="billsTime != null">bills_time,</if>
             <if test="givePlace != null">give_place,</if>
+            <if test="wareHouse != null">ware_house,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
             <if test="updateBy != null">update_by,</if>
@@ -62,6 +64,7 @@
             <if test="principal != null">#{principal},</if>
             <if test="billsTime != null">#{billsTime},</if>
             <if test="givePlace != null">#{givePlace},</if>
+            <if test="wareHouse != null">#{wareHouse},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
@@ -77,6 +80,7 @@
             <if test="principal != null">principal = #{principal},</if>
             <if test="billsTime != null">bills_time = #{billsTime},</if>
             <if test="givePlace != null">give_place = #{givePlace},</if>
+            <if test="wareHouse != null">ware_house = #{wareHouse},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>

+ 6 - 1
inventory-system/src/main/resources/mapper/system/GoodsMapper.xml

@@ -11,6 +11,7 @@
         <result property="goodsType"    column="goods_type"    />
         <result property="quantityStock"    column="quantity_stock"    />
         <result property="goodsStatus"    column="goods_status"    />
+        <result property="wareHouse"    column="ware_house"    />
         <result property="createBy"    column="create_by"    />
         <result property="createTime"    column="create_time"    />
         <result property="updateBy"    column="update_by"    />
@@ -19,7 +20,7 @@
     </resultMap>
 
     <sql id="selectGoodsVo">
-        select id, goods_code, goods_name, goods_type, quantity_stock, goods_status, create_by, create_time, update_by, update_time, remark from goods
+        select id, goods_code, goods_name, goods_type, quantity_stock, goods_status, ware_house, create_by, create_time, update_by, update_time, remark from goods
     </sql>
 
     <select id="selectGoodsList" parameterType="Goods" resultMap="GoodsResult">
@@ -28,6 +29,7 @@
             <if test="goodsCode != null  and goodsCode != ''"> and goods_code like concat('%', #{goodsCode}, '%')</if>
             <if test="goodsName != null  and goodsName != ''"> and goods_name like concat('%', #{goodsName}, '%')</if>
             <if test="goodsType != null  and goodsType != ''"> and goods_type = #{goodsType}</if>
+            <if test="wareHouse != null  and wareHouse != ''"> and ware_house = #{wareHouse}</if>
             <if test="quantityStock != null "> and quantity_stock = #{quantityStock}</if>
             <if test="goodsStatus != null and goodsStatus != ''">
                 and goods_status in
@@ -53,6 +55,7 @@
             <if test="goodsType != null">goods_type,</if>
             <if test="quantityStock != null">quantity_stock,</if>
             <if test="goodsStatus != null">goods_status,</if>
+            <if test="wareHouse != null">ware_house,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
             <if test="updateBy != null">update_by,</if>
@@ -66,6 +69,7 @@
             <if test="goodsType != null">#{goodsType},</if>
             <if test="quantityStock != null">#{quantityStock},</if>
             <if test="goodsStatus != null">#{goodsStatus},</if>
+            <if test="wareHouse != null">#{wareHouse},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
@@ -82,6 +86,7 @@
             <if test="goodsType != null">goods_type = #{goodsType},</if>
             <if test="quantityStock != null">quantity_stock = #{quantityStock},</if>
             <if test="goodsStatus != null">goods_status = #{goodsStatus},</if>
+            <if test="wareHouse != null">ware_house = #{wareHouse},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>

+ 25 - 7
inventory-ui/src/views/inventory/bills/index.vue

@@ -125,6 +125,18 @@
             ></el-option>
           </el-select>
         </el-form-item>
+
+        <el-form-item label="调度到那个仓库" v-if="form.billsType === '2'" prop="wareHouse">
+          <el-select v-model="form.wareHouse" placeholder="请选择调度到那个仓库">
+            <el-option
+                v-for="dict in dict.type.inventory_ware_house"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+
         <el-form-item label="出/入库负责人:" prop="principal">
           <el-input v-model="form.principal" placeholder="请输入出/入库负责人" />
         </el-form-item>
@@ -280,7 +292,7 @@ import {listGoods} from "@/api/inventory/goods"
 
 export default {
   name: "Bills",
-  dicts: ['inventory_bills_type','inventory_goods_type','inventory_goods_status'],
+  dicts: ['inventory_bills_type','inventory_goods_type','inventory_goods_status','inventory_ware_house'],
   data() {
     return {
       // 遮罩层
@@ -387,6 +399,7 @@ export default {
         principal: null,
         billsTime: null,
         givePlace: null,
+        billsType: null,
         createBy: null,
         createTime: null,
         updateBy: null,
@@ -450,15 +463,20 @@ export default {
       this.bills_type = row.billsType
       if(row.billsType === "0"){
         this.bills_goods_status = [
-          {label: "已出库",value: "1"},{label: "调度",value: "2"}
+          {label: "已出库",value: "1"}
         ]
-        this.goodsParams.goodsStatus = "1,2"
-      }else {
+        this.goodsParams.goodsStatus = "1"
+      }else if(row.billsType === "1") {
         this.bills_goods_status = [
-          {label: "在库",value: "0"},{label: "调度",value: "2"}
+          {label: "在库",value: "0"}
         ]
-        this.goodsParams.goodsStatus = "0,2"
-      }
+        this.goodsParams.goodsStatus = "0"
+      } else {
+        this.bills_goods_status = [
+          {label: "在库",value: "0"}
+        ]
+        this.goodsParams.goodsStatus = "0"
+      } 
       this.getGoodsList()
       this.detailsOpen = true;
       this.detailsTitle = "新增单据详情";

+ 33 - 1
inventory-ui/src/views/inventory/goods/index.vue

@@ -30,6 +30,21 @@
           />
         </el-select>
       </el-form-item>
+      <el-form-item label="所在仓库" prop="wareHouse">
+        <el-select
+          v-model="queryParams.wareHouse"
+          placeholder="所在仓库"
+          clearable
+          style="width: 150px"
+        >
+          <el-option
+            v-for="dict in dict.type.inventory_ware_house"
+            :key="dict.value"
+            :label="dict.label"
+            :value="dict.value"
+          />
+        </el-select>
+      </el-form-item>
       <el-form-item label="物品状态" prop="goodsStatus">
         <el-select
           v-model="queryParams.goodsStatus"
@@ -77,6 +92,11 @@
             <dict-tag :options="dict.type.inventory_goods_type" :value="scope.row.goodsType"/>
         </template>
       </el-table-column>
+      <el-table-column label="所在仓库" align="center" prop="wareHouse" >
+        <template slot-scope="scope">
+            <dict-tag :options="dict.type.inventory_ware_house" :value="scope.row.wareHouse"/>
+        </template>
+      </el-table-column>
       <el-table-column label="库存数量" align="center" prop="quantityStock" />
       <el-table-column label="物品状态" align="center" prop="goodsStatus" >
         <template slot-scope="scope">
@@ -131,6 +151,17 @@
             ></el-option>
           </el-select>
         </el-form-item>
+
+        <el-form-item label="所在仓库" prop="wareHouse">
+          <el-select v-model="form.wareHouse" placeholder="请选择物品所在仓库">
+            <el-option
+                v-for="dict in dict.type.inventory_ware_house"
+                :key="dict.value"
+                :label="dict.label"
+                :value="dict.value"
+            ></el-option>
+          </el-select>
+        </el-form-item>
         <el-form-item label="库存数量" prop="quantityStock">
           <el-input-number v-model="form.quantityStock" placeholder="请输入库存数量" />
         </el-form-item>
@@ -161,7 +192,7 @@ import {listGoods, addGoods, getGoods,updateGoods,delGoods} from "@/api/inventor
 
 export default {
   name: "Goods",
-  dicts: ['inventory_goods_status', 'inventory_goods_type'],
+  dicts: ['inventory_goods_status', 'inventory_goods_type','inventory_ware_house'],
   data() {
     return {
       // 遮罩层
@@ -251,6 +282,7 @@ export default {
         goodsType: '0',
         quantityStock: 1,
         goodsStatus: '0',
+        billsType: null
       };
       this.resetForm("form");
     },