瀏覽代碼

Merge remote-tracking branch 'origin/dev_huangjunjie'

13660505945 3 周之前
父節點
當前提交
296744993f

+ 2 - 2
src/main/java/com/jsh/erp/controller/pda/PdaController.java

@@ -353,8 +353,8 @@ public class PdaController extends BaseController {
 
 
     @ApiOperation("查询商品打印信息")
-    @GetMapping("/printMaterial/{id}")
-    public AjaxResult printMaterial(@PathVariable("id")Long id) {
+    @GetMapping("/printMaterial")
+    public AjaxResult printMaterial(@RequestParam("id") Long id) {
         PDAPrintVo pdaPrintVo = depotItemService.pdaPrintMaterial(id);
         return AjaxResult.success(pdaPrintVo);
     }

+ 8 - 0
src/main/java/com/jsh/erp/datasource/mappers/MaterialMapperEx.java

@@ -3,6 +3,7 @@ package com.jsh.erp.datasource.mappers;
 import com.jsh.erp.datasource.entities.*;
 import com.jsh.erp.datasource.pda.dto.PDAInventoryDTO;
 import com.jsh.erp.datasource.pda.vo.PDADepotItemVO;
+import com.jsh.erp.datasource.pda.vo.PDAPrintVo;
 import com.jsh.erp.datasource.vo.MaterialCurrentStock4SystemSku;
 import com.jsh.erp.datasource.vo.MaterialVoSearch;
 import com.jsh.erp.datasource.vo.TaskStocktakingItemVO;
@@ -171,5 +172,12 @@ public interface MaterialMapperEx {
 
     List<PDADepotItemVO> inventoryInquiry(PDAInventoryDTO pdaInventoryDTO);
 
+    /**
+     * 根据单据子表id查询打印信息
+     * @param depotItemId 单据子表id
+     * @return
+     */
+    PDAPrintVo pdaPrintMaterial(@Param("depotItemId") Long depotItemId);
+
 
 }

+ 15 - 4
src/main/java/com/jsh/erp/service/impl/DepotHeadServiceImpl.java

@@ -2,6 +2,7 @@ package com.jsh.erp.service.impl;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.jsh.erp.constants.BusinessConstants;
@@ -86,8 +87,6 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
     @Resource
     private LogService logService;
     @Resource
-    private QRCodeGenerator qrCodeGenerator;
-    @Resource
     private MaterialService materialService;
     @Resource
     private MaterialExtendService materialExtendService;
@@ -699,11 +698,23 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
             DepotHeadExample example = new DepotHeadExample();
             example.createCriteria().andIdIn(dhIds);
             result = depotHeadMapper.updateByExampleSelective(depotHead, example);
-            //更新当前库存
             if(systemConfigService.getForceApprovalFlag()) {
                 for(Long dhId: dhIds) {
-                    List<DepotItem> list = depotItemService.getListByHeaderId(dhId);
+                    List<DepotItem> list = depotItemService.list(new LambdaQueryWrapperX<DepotItem>().eq(DepotItem::getHeaderId,dhId));
+                    DepotHead head = depotHeadMapper.selectById(dhId);
                     for (DepotItem depotItem : list) {
+                        if ("1".equals(status)){
+                            //单据审核,处理批次商品信息
+                            if(BusinessConstants.DEPOTHEAD_TYPE_IN.equals(head.getType())){
+                                //表单入库,新增批次商品信息
+                                materialBatchService.generateMaterialBatchByDepotItemId(depotItem,head.getOrganId());
+                            }else if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(head.getType())){
+                                //表单出库,修改商品库存
+                                //materialExtend.setInventory(materialExtend.getInventory().subtract(depotItem.getBasicNumber()));
+                                materialBatchService.handleMaterialBatchByDepotItemId(depotItem.getId());
+                            }
+                        }
+                        //更新当前库存
                         depotItemService.updateCurrentStock(depotItem);
                     }
                 }

+ 16 - 23
src/main/java/com/jsh/erp/service/impl/DepotItemServiceImpl.java

@@ -76,7 +76,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
     @Resource
     private LogService logService;
     @Resource
-    private MaterialExtendMapper materialExtendMapper;
+    private MaterialMapperEx materialMapperEx;
 
     @Resource
     private SyncTescoSystemService syncTescoSystemService;
@@ -129,6 +129,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
      */
     @Override
     public PDAPrintVo pdaPrintMaterial(Long depotItemId) {
+        materialMapperEx.pdaPrintMaterial(depotItemId);
         return null;
     }
 
@@ -509,12 +510,12 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
             checkAssembleWithMaterialType(rowArr, depotHead.getSubType());
             for (int i = 0; i < rowArr.size(); i++) {
                 JSONObject rowObj = JSONObject.parseObject(rowArr.getString(i));
-                String batchNumber = rowObj.getString("barCode");
+                String barCode = rowObj.getString("barCode");
                 //根据条码获取商品信息
-                MaterialExtend materialExtend = materialExtendService.getInfoByBarCode(batchNumber);
+                MaterialExtend materialExtend = materialExtendService.getInfoByBarCode(barCode);
                 if(materialExtend == null) {
                     throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_BARCODE_IS_NOT_EXIST_CODE,
-                            String.format(ExceptionConstants.MATERIAL_BARCODE_IS_NOT_EXIST_MSG, batchNumber));
+                            String.format(ExceptionConstants.MATERIAL_BARCODE_IS_NOT_EXIST_MSG, barCode));
                 }
                 //设置单据子表属性
                 DepotItem depotItem = new DepotItem();
@@ -552,18 +553,18 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                     if(BusinessConstants.SUB_TYPE_ASSEMBLE.equals(depotHead.getSubType()) ||
                             BusinessConstants.SUB_TYPE_DISASSEMBLE.equals(depotHead.getSubType())) {
                         throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_ASSEMBLE_SELECT_ERROR_CODE,
-                                String.format(ExceptionConstants.MATERIAL_ASSEMBLE_SELECT_ERROR_MSG, batchNumber));
+                                String.format(ExceptionConstants.MATERIAL_ASSEMBLE_SELECT_ERROR_MSG, barCode));
                     }
                     //调拨单不能选择批号或序列号商品(该场景走出库和入库单)
                     if(BusinessConstants.SUB_TYPE_TRANSFER.equals(depotHead.getSubType())) {
                         throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_TRANSFER_SELECT_ERROR_CODE,
-                                String.format(ExceptionConstants.MATERIAL_TRANSFER_SELECT_ERROR_MSG, batchNumber));
+                                String.format(ExceptionConstants.MATERIAL_TRANSFER_SELECT_ERROR_MSG, barCode));
                     }
                     //盘点业务不能选择批号或序列号商品(该场景走出库和入库单)
                     if(BusinessConstants.SUB_TYPE_CHECK_ENTER.equals(depotHead.getSubType())
                        ||BusinessConstants.SUB_TYPE_REPLAY.equals(depotHead.getSubType())) {
                         throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_CHECK_ERROR_CODE,
-                                String.format(ExceptionConstants.MATERIAL_STOCK_CHECK_ERROR_MSG, batchNumber));
+                                String.format(ExceptionConstants.MATERIAL_STOCK_CHECK_ERROR_MSG, barCode));
                     }
                 }
                 if (StringUtil.isExist(rowObj.get("snList"))) {
@@ -581,7 +582,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                                     depotHead.getNumber(), materialExtend.getMaterialId(), depotId, inPrice, depotItem.getSnList());
                         } else {
                             throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_SN_NUMBERE_FAILED_CODE,
-                                    String.format(ExceptionConstants.DEPOT_HEAD_SN_NUMBERE_FAILED_MSG, batchNumber));
+                                    String.format(ExceptionConstants.DEPOT_HEAD_SN_NUMBERE_FAILED_MSG, barCode));
                         }
                     }
                 } else {
@@ -599,7 +600,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                                 //跳过
                             } else {
                                 throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_EMPTY_CODE,
-                                        String.format(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_EMPTY_MSG, batchNumber));
+                                        String.format(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_EMPTY_MSG, barCode));
                             }
                         }
                     }
@@ -622,7 +623,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                                 //跳过
                             } else {
                                 throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_BATCH_NUMBERE_EMPTY_CODE,
-                                        String.format(ExceptionConstants.DEPOT_HEAD_BATCH_NUMBERE_EMPTY_MSG, batchNumber));
+                                        String.format(ExceptionConstants.DEPOT_HEAD_BATCH_NUMBERE_EMPTY_MSG, barCode));
                             }
                         }
                     }
@@ -674,7 +675,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                         if(depotItem.getOperNumber().add(finishNumber).compareTo(preNumber)>0) {
                             if(!systemConfigService.getOverLinkBillFlag()) {
                                 throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_NUMBER_NEED_EDIT_FAILED_CODE,
-                                        String.format(ExceptionConstants.DEPOT_HEAD_NUMBER_NEED_EDIT_FAILED_MSG, batchNumber));
+                                        String.format(ExceptionConstants.DEPOT_HEAD_NUMBER_NEED_EDIT_FAILED_MSG, barCode));
                             }
                         }
                     } else if("update".equals(actionType)) {
@@ -692,7 +693,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                                 if (depotItem.getOperNumber().add(realFinishNumber).compareTo(preNumber) > 0) {
                                     if (!systemConfigService.getOverLinkBillFlag()) {
                                         throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_NUMBER_NEED_EDIT_FAILED_CODE,
-                                                String.format(ExceptionConstants.DEPOT_HEAD_NUMBER_NEED_EDIT_FAILED_MSG, batchNumber));
+                                                String.format(ExceptionConstants.DEPOT_HEAD_NUMBER_NEED_EDIT_FAILED_MSG, barCode));
                                     }
                                 }
                             } else {
@@ -710,7 +711,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                         if("零售".equals(depotHead.getSubType()) || "销售".equals(depotHead.getSubType())) {
                             if (unitPrice.compareTo(materialExtend.getLowDecimal()) < 0) {
                                 throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_UNIT_PRICE_LOW_CODE,
-                                        String.format(ExceptionConstants.DEPOT_HEAD_UNIT_PRICE_LOW_MSG, batchNumber));
+                                        String.format(ExceptionConstants.DEPOT_HEAD_UNIT_PRICE_LOW_MSG, barCode));
                             }
                         }
                     }
@@ -782,7 +783,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                 }
                 //出库时判断库存是否充足
                 if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
-                    String stockMsg = material.getName() + "-" + batchNumber;
+                    String stockMsg = material.getName() + "-" + barCode;
                     BigDecimal stock = getCurrentStockByParam(depotItem.getDepotId(),depotItem.getMaterialId());
                     if(StringUtil.isNotEmpty(depotItem.getSku())) {
                         //对于sku商品要换个方式计算库存
@@ -790,7 +791,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                     }
                     if(StringUtil.isNotEmpty(depotItem.getBatchNumber())) {
                         //对于批次商品要换个方式计算库存
-                        stock = getOneBatchNumberStock(depotItem.getDepotId(), batchNumber, depotItem.getBatchNumber());
+                        stock = getOneBatchNumberStock(depotItem.getDepotId(), barCode, depotItem.getBatchNumber());
                         stockMsg += "-批号" + depotItem.getBatchNumber();
                     }
                     BigDecimal thisRealNumber = depotItem.getBasicNumber()==null?BigDecimal.ZERO:depotItem.getBasicNumber();
@@ -822,14 +823,6 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                     }
                 }
                 this.insertDepotItemWithObj(depotItem);
-                if(BusinessConstants.DEPOTHEAD_TYPE_IN.equals(depotHead.getType())){
-                    //表单入库,新增批次商品信息
-                    materialBatchService.generateMaterialBatchByDepotItemId(depotItem,depotHead.getOrganId());
-                }else if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
-                    //表单出库,修改商品库存
-                    //materialExtend.setInventory(materialExtend.getInventory().subtract(depotItem.getBasicNumber()));
-                    materialBatchService.handleMaterialBatchByDepotItemId(depotItem.getId());
-                }
                 //更新当前库存
                 updateCurrentStock(depotItem);
                 //更新当前成本价

+ 0 - 3
src/main/java/com/jsh/erp/service/impl/MaterialBatchServiceImpl.java

@@ -109,8 +109,6 @@ public class MaterialBatchServiceImpl extends ServiceImpl<MaterialBatchMapper,Ma
         if (materialBatch.getInventory() != null){
             //获取修改前库存
             int originalStock = materialBatchMapper.selectOne("id",materialBatch.getId()).getInventory().intValue();
-            if (originalStock != materialBatch.getInventory().intValue()){
-                //库存不相同,修改库存
                 User user = userService.getCurrentUser();
                 InventoryLog log = new InventoryLog();
                 log.setUpdateUser(user.getId());
@@ -125,7 +123,6 @@ public class MaterialBatchServiceImpl extends ServiceImpl<MaterialBatchMapper,Ma
                 update(new UpdateWrapper<MaterialBatch>().set("inventory",materialBatch.getInventory()).eq("id",materialBatch.getId()));
                 //更新当前库存
                 depotItemService.updateCurrentStockFun(materialBatch.getMaterialId(),materialBatch.getDepotId());
-            }
         }
     }
 

+ 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()));

+ 3 - 3
src/main/java/com/jsh/erp/service/impl/TaskStocktakingServiceImpl.java

@@ -76,7 +76,7 @@ public class TaskStocktakingServiceImpl extends ServiceImpl<TaskStocktakingMappe
                         .map(MaterialBatch::getPosition)
                         .collect(Collectors.toList());
                 List<Long> materialIdList = materialBatchList.stream().map(MaterialBatch::getMaterialId).distinct().collect(Collectors.toList());
-                List<Material> materialList = materialMapper.selectList(new LambdaQueryWrapperX<Material>().eq(Material::getId, materialIdList));
+                List<Material> materialList = materialMapper.selectList(new LambdaQueryWrapperX<Material>().in(Material::getId, materialIdList));
                 List<Long> categoryIdList = materialList.stream().map(Material::getCategoryId).distinct().collect(Collectors.toList());
                 taskStocktakingDTO.setCategoryCount(categoryIdList.size());
                 taskStocktakingDTO.setMaterialCount(materialBatchList.size());
@@ -130,12 +130,12 @@ public class TaskStocktakingServiceImpl extends ServiceImpl<TaskStocktakingMappe
         //获取负责人名称
         User user = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getId, one.getCreator()));
         if (user != null) {
-            taskStocktakingVO.setCreatorName(user.getLoginName());
+            taskStocktakingVO.setCreatorName(user.getUsername());
         }
         //获取创建人名称
         User user1 = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getId, one.getCreateBy()));
         if (user1 != null) {
-            taskStocktakingVO.setCreateByName(user1.getLoginName());
+            taskStocktakingVO.setCreateByName(user1.getUsername());
         }
         //获取仓库名称
         Depot depot = depotService.getDepot(one.getDepotId());

+ 50 - 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">
@@ -931,4 +937,15 @@
         ORDER BY m.id DESC
     </select>
 
+    <select id="pdaPrintMaterial" parameterType="java.lang.Long" resultType="com.jsh.erp.datasource.pda.vo.PDAPrintVo">
+        SELECT s.supplier customerName,dh.number,m.system_sku barCode,mb.batch_number
+        FROM
+        jsh_depot_item di
+        LEFT JOIN jsh_depot_head dh ON di.header_id = dh.id
+        LEFT JOIN jsh_material m ON di.material_id = m.id
+        LEFT JOIN jsh_supplier s ON dh.organ_id = s.id
+        LEFT JOIN material_batch mb ON di.id = mb.depot_item_id
+        WHERE di.id = #{depotItemId}
+    </select>
+
 </mapper>