فهرست منبع

商品信息bug修改

huang 3 هفته پیش
والد
کامیت
41c43e6427
2فایلهای تغییر یافته به همراه62 افزوده شده و 70 حذف شده
  1. 23 37
      src/main/java/com/jsh/erp/service/impl/MaterialServiceImpl.java
  2. 39 33
      src/main/resources/mapper_xml/MaterialMapperEx.xml

+ 23 - 37
src/main/java/com/jsh/erp/service/impl/MaterialServiceImpl.java

@@ -566,16 +566,16 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
             //遇到多个副条码的情况,只加第一个
             otherMaterialMap.putIfAbsent(me.getMaterialId(), me);
         }
-        String nameStr = "名称*,规格,型号,颜色,品牌,类别,基础重量(kg),基本单位*,副单位,基本条码*,副条码,比例,多属性," +
-                "采购价,零售价,销售价,最低售价,状态*,序列号,批号,自定义1,自定义2,自定义3,备注,系统sku,生产日期,保质期,供应商,商品条码,批次号,仓库名称,仓位货架";
+        String nameStr = "名称*,规格,型号,颜色,品牌,类别,基础重量(kg),基本单位*,副单位,比例,多属性," +
+                "状态*,序列号,系统sku,商品条码,自定义1,自定义2,自定义3,备注";
         List<String> nameList = StringUtil.strToStringList(nameStr);
         //仓库列表
         List<Depot> depotList = depotService.getAllList();
-        if (nameList != null) {
-            for(Depot depot: depotList) {
-                nameList.add(depot.getName());
-            }
-        }
+//        if (nameList != null) {
+//            for(Depot depot: depotList) {
+//                nameList.add(depot.getName());
+//            }
+//        }
         //期初库存缓存
         List<MaterialInitialStock> misList = materialInitialStockMapperEx.getListExceptZero();
         Map<String, BigDecimal> misMap = new HashMap<>();
@@ -599,36 +599,23 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
                 objs[6] = m.getWeight() == null ? "" : m.getWeight().setScale(3, BigDecimal.ROUND_HALF_UP).toString();
                 objs[7] = m.getCommodityUnit();
                 objs[8] = otherMaterialMap.get(m.getId()) == null ? "" : otherMaterialMap.get(m.getId()).getCommodityUnit();
-                objs[9] = m.getmBarCode();
-                objs[10] = otherMaterialMap.get(m.getId()) == null ? "" : otherMaterialMap.get(m.getId()).getBarCode();
-                objs[11] = m.getRatio() == null ? "" : m.getRatio().toString();
-                objs[12] = m.getSku();
-                objs[13] = m.getPurchaseDecimal() == null ? "" : m.getPurchaseDecimal().setScale(3, BigDecimal.ROUND_HALF_UP).toString();
-                objs[14] = m.getCommodityDecimal() == null ? "" : m.getCommodityDecimal().setScale(3, BigDecimal.ROUND_HALF_UP).toString();
-                objs[15] = m.getWholesaleDecimal() == null ? "" : m.getWholesaleDecimal().setScale(3, BigDecimal.ROUND_HALF_UP).toString();
-                objs[16] = m.getLowDecimal() == null ? "" : m.getLowDecimal().setScale(3, BigDecimal.ROUND_HALF_UP).toString();
-                objs[17] = m.getEnabled() ? "1" : "0";
-                objs[18] = m.getEnableSerialNumber();
-                objs[19] = m.getEnableBatchNumber();
-                objs[20] = m.getOtherField1();
-                objs[21] = m.getOtherField2();
-                objs[22] = m.getOtherField3();
-                objs[23] = m.getRemark();
-                objs[24] = m.getSystemSku();
-                objs[25] = m.getProductionDate() == null ? "" : m.getProductionDate().toString();
-                objs[26] = m.getExpiryNum() == null ? "" : m.getExpiryNum().toString();
-                objs[27] = m.getSupplierId() == null ? "" : m.getSupplierId().toString();
-                objs[28] = m.getBarCode();
-                objs[29] = m.getBatchNumber();
-                objs[30] = m.getDepotId() == null ? "" : m.getDepotId().toString();
-                objs[31] = m.getPosition();
+                objs[9] = m.getRatio() == null ? "" : m.getRatio().toString();
+                objs[10] = m.getSku();
+                objs[11] = m.getEnabled() ? "1" : "0";
+                objs[12] = m.getEnableSerialNumber();
+                objs[13] = m.getSystemSku();
+                objs[14] = m.getBarCode();
+                objs[15] = m.getOtherField1();
+                objs[16] = m.getOtherField2();
+                objs[17] = m.getOtherField3();
+                objs[18] = m.getRemark();
                 //仓库期初库存
-                int i = 32;
-                for(Depot depot: depotList) {
-                    BigDecimal number = misMap.get(m.getId() + "_" + depot.getId());
-                    objs[i] = number == null ? "0" : number.setScale(2, BigDecimal.ROUND_HALF_UP).toString();
-                    i++;
-                }
+                int i = 19;
+//                for(Depot depot: depotList) {
+//                    BigDecimal number = misMap.get(m.getId() + "_" + depot.getId());
+//                    objs[i] = number == null ? "0" : number.setScale(2, BigDecimal.ROUND_HALF_UP).toString();
+//                    i++;
+//                }
                 objects.add(objs);
             }
         }
@@ -1940,7 +1927,6 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
 
     @Override
     public List<PDADepotItemVO> inventoryInquiry(PDAInventoryDTO pdaInventoryDTO) throws Exception {
-
         pdaInventoryDTO.setMaterialIds(materialInitialStockMapper.selectMaterialIdByPosition(pdaInventoryDTO.getPosition()));
         //查询类型id的子类型
         pdaInventoryDTO.setCategoryIds(selectCategoryIds(pdaInventoryDTO.getCategoryId()));

+ 39 - 33
src/main/resources/mapper_xml/MaterialMapperEx.xml

@@ -867,41 +867,47 @@
     </select>
 
     <select id="inventoryInquiry" parameterType="com.jsh.erp.datasource.pda.dto.PDAInventoryDTO" resultType="com.jsh.erp.datasource.pda.vo.PDADepotItemVO">
-        select m.id materialId,m.name materialName,m.standard materialStandard,u.name unit_name,mc.name categoryName,me.bar_code,me.id meId,me.commodity_unit,me.sku,
-        me.production_date,me.expiry_num,me.supplier_id,me.batch_number,me.depot_id,me.position,d.`name` depotName,m.img_name,IFNULL(mi.inventory,0) inventory
-        from jsh_material m
+        SELECT
+            m.id materialId,
+            me.id materialExtendId,
+            m.name materialName,
+            m.standard materialStandard,
+            me.position,
+            me.bar_code,
+            me.commodity_unit,
+            m.img_name,
+            CAST(IFNULL(mi.inventory,0) / me.ratio AS DECIMAL(10,0)) inventory
+        FROM jsh_material m
         left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
-        left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
-        left JOIN jsh_material_category mc on m.category_id = mc.id and ifnull(mc.delete_Flag,'0') !='1'
-        left JOIN jsh_depot d on me.depot_id = d.id and ifnull(d.delete_Flag,'0') !='1'
         left JOIN (SELECT material_id,SUM(current_number) AS 'inventory' FROM jsh_material_current_stock GROUP BY material_id) mi ON m.id = mi.material_id
-        where m.enabled = 1
-        and me.id is not null
-        <if test="keyword != null and keyword !=''">
-            <bind name="bindKey" value="'%'+keyword+'%'"/>
-            and (m.name like #{bindKey} or me.bar_code like #{bindKey})
-        </if>
-        <if test="categoryId != null">
-            and m.category_id IN (
-            <foreach collection="categoryIds" item="item" separator=",">
-                #{item}
-            </foreach>
-            )
-        </if>
-        <if test="materialIds != null">
-            and m.id IN (
-            <foreach collection="materialIds" item="item" separator=",">
-                #{item}
-            </foreach>
-            )
-        </if>
-        <if test="type == 'have'">
-            and mi.inventory > 0
-        </if>
-        <if test="type == 'none'">
-            and ifnull(mi.inventory,0) &lt;= 0
-        </if>
-        and ifnull(me.delete_flag,'0') !='1'
+        WHERE
+          m.enabled = 1
+          and me.id is not null
+          <if test="keyword != null and keyword !=''">
+              <bind name="bindKey" value="'%'+keyword+'%'"/>
+              and (m.name like #{bindKey} or me.bar_code like #{bindKey})
+          </if>
+          <if test="categoryId != null">
+              and m.category_id IN (
+              <foreach collection="categoryIds" item="item" separator=",">
+                  #{item}
+              </foreach>
+              )
+          </if>
+          <if test="materialIds != null">
+              and m.id IN (
+              <foreach collection="materialIds" item="item" separator=",">
+                  #{item}
+              </foreach>
+              )
+          </if>
+          <if test="type == 'have'">
+              and mi.inventory > 0
+          </if>
+          <if test="type == 'none'">
+              and ifnull(mi.inventory,0) &lt;= 0
+          </if>
+          and ifnull(me.delete_flag,'0') !='1'
     </select>
 
     <select id="getMaterialCurrentPriceByIdList" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultType="com.jsh.erp.datasource.vo.MaterialCurrentStock4SystemSku">