Browse Source

问题修改

zhs 2 years ago
parent
commit
2f28823e85

+ 10 - 0
src/main/java/com/tld/controller/ReceiveGoodsController.java

@@ -97,5 +97,15 @@ public class ReceiveGoodsController {
         receiveGoodsSerivce.overtimePurchaseExport(receiveGoods, response);
     }
 
+    /**
+     * 查询入库单
+     * @param receiveGoods
+     * @return
+     */
+    @GetMapping("getPdaReceiveGoods")
+    public Map<String, Object> getPdaReceiveGoods(ReceiveGoods receiveGoods){
+        return receiveGoodsSerivce.getPdaReceiveGoods(receiveGoods);
+    }
+
 
 }

+ 21 - 2
src/main/java/com/tld/controller/WarehousingController.java

@@ -42,6 +42,15 @@ public class WarehousingController {
     public Map<String, Object> addWarehousingVirtual(@RequestBody WarehousingVirtual warehousingVirtual){
         return warehousingService.addWarehousingVirtual(warehousingVirtual);
     }
+    /**
+     * 库位推荐虚拟表入库
+     * @param warehousingVirtual 参数
+     * @return 返回结果
+     */
+    @PostMapping("addWarehousingVirtualTwo")
+    public Map<String, Object> addWarehousingVirtualTwo(@RequestBody WarehousingVirtual warehousingVirtual){
+        return warehousingService.addWarehousingVirtualTwo(warehousingVirtual);
+    }
 
     /**
      * 查询虚拟入库
@@ -69,8 +78,8 @@ public class WarehousingController {
      * @return 返回结果
      */
     @GetMapping("warehousing")
-    public Map<String, Object> warehousing(String uniqueCode, String type){
-        return warehousingService.warehousing(uniqueCode, type);
+    public Map<String, Object> warehousing(String uniqueCode, String type, String warehouseTransferId){
+        return warehousingService.warehousing(uniqueCode, type, warehouseTransferId);
     }
 
     /**
@@ -207,4 +216,14 @@ public class WarehousingController {
     public Map<String, Object> otherWarehou(Inventory inventory, HttpServletRequest request){
         return warehousingService.otherWarehou(inventory, request);
     }
+
+    /**
+     * 查询名牌物料
+     * @param code 参数
+     * @return 返回结果
+     */
+    @GetMapping("getMing")
+    public Map<String, Object> getMing(String code){
+        return warehousingService.getMing(code);
+    }
 }

+ 1 - 0
src/main/java/com/tld/mapper/AskGoodsMapper.java

@@ -130,4 +130,5 @@ public interface AskGoodsMapper {
 
     void delReturnWarehouseTransferZ(@Param("warehouseTransferTd") String warehouseTransferTd);
 
+    String getMing(String code);
 }

+ 4 - 0
src/main/java/com/tld/mapper/ReceiveGoodsMapper.java

@@ -39,4 +39,8 @@ public interface ReceiveGoodsMapper {
     List<Map<String, Object>> overtimePurchaseExport(ReceiveGoods receiveGoods);
 
     List<Map<String, Object>> purchasesExport(ReceiveGoods receiveGoods);
+
+    List<ReceiveGoods> getPdaReceiveGoods(ReceiveGoods receiveGoods);
+
+    ReceiveGoods getReceiveGoodsCode(String receiveGoodsId);
 }

+ 4 - 2
src/main/java/com/tld/mapper/WarehousingMapper.java

@@ -103,9 +103,9 @@ public interface WarehousingMapper {
 
     Map<String, Object> getScanIsNotProduct(Notice notice);
 
-    String getStorageLocationCode(@Param("attribute")String attribute, @Param("symbol")String symbol);
+    String getStorageLocationCode(@Param("attribute")String attribute, @Param("symbol")String symbol, @Param("producBatch")String producBatch);
 
-    int getCountStorage(@Param("attribute")String attribute, @Param("storageLocationCode")String storageLocationCode, @Param("symbol")String symbol);
+    int getCountStorage(@Param("attribute")String attribute, @Param("storageLocationCode")String storageLocationCode, @Param("symbol")String symbol, @Param("producBatch")String producBatch);
 
     void updateStorage(WarehousingVirtual warehousingVirtual1);
 
@@ -118,4 +118,6 @@ public interface WarehousingMapper {
     void updateVitrualNum(Inventory inventory1);
 
     void addInventoryOther(Inventory inventory);
+
+    Map<String, Object> getSumWarehousingVirtual(WarehousingVirtual warehousingVirtual);
 }

+ 4 - 0
src/main/java/com/tld/model/TldPrint.java

@@ -65,4 +65,8 @@ public class TldPrint implements Serializable {
      * 单据类型
      */
     private String type;
+    /**
+     * 属性
+     */
+    private String attribute;
 }

+ 12 - 1
src/main/java/com/tld/model/WarehousingVirtual.java

@@ -144,5 +144,16 @@ public class WarehousingVirtual implements Serializable {
      * 移库出库库位
      */
     private String storageLocationCodeCk;
-
+    /**
+     * 生产单编号
+     */
+    private String productionCode;
+    /**
+     * 采购订单号
+     */
+    private String orderCode;
+    /**
+     * 质检单ID
+     */
+    private String receiveGoodsId;
 }

+ 1 - 0
src/main/java/com/tld/service/ReceiveGoodsSerivce.java

@@ -32,4 +32,5 @@ public interface ReceiveGoodsSerivce {
 
     void purchasesExport(ReceiveGoods receiveGoods, HttpServletResponse response);
 
+    Map<String, Object> getPdaReceiveGoods(ReceiveGoods receiveGoods);
 }

+ 5 - 1
src/main/java/com/tld/service/WarehousingService.java

@@ -13,7 +13,7 @@ public interface WarehousingService {
 
     Map<String, Object> delWarehousingVirtual(WarehousingVirtual warehousingVirtual);
 
-    Map<String, Object> warehousing(String uniqueCode, String type);
+    Map<String, Object> warehousing(String uniqueCode, String type, String warehouseTransferId);
 
     void plugOutWarehousing(String orderNumber);
 
@@ -46,4 +46,8 @@ public interface WarehousingService {
     Map<String, Object> otherWarehousing(AskGoods askGoods);
 
     Map<String, Object> otherWarehou(Inventory inventory, HttpServletRequest request);
+
+    Map<String, Object> getMing(String code);
+
+    Map<String, Object> addWarehousingVirtualTwo(WarehousingVirtual warehousingVirtual);
 }

+ 20 - 0
src/main/java/com/tld/service/impl/AskGoodsServiceImpl.java

@@ -546,6 +546,26 @@ public class AskGoodsServiceImpl implements AskGoodsService {
         try{
             //查询物料信息
             MaterialClass material = warehousingMapper.getMaterial(new Notice().setMaterialCode(askGoods.getWllbCode()));
+            if(material.getPartType().equals("原材料")){
+                if(askGoods.getSerial() == null) {
+                    map.put("msg", "500");
+                    map.put("errMsg", "此物料是" + material.getPartType() + "连番号参数不能为空!");
+                    return map;
+                }
+            } else if(material.getPartType().equals("产成品")) {
+                if(askGoods.getAttribute() == null) {
+                    map.put("msg", "500");
+                    map.put("errMsg", "此物料是" + material.getPartType() + "属性参数不能为空!");
+                    return map;
+                }
+            } else if(material.getPartType().equals("半成品")) {
+                askGoods.setProducDate(null);
+                if(askGoods.getStorageLocationCode() == null) {
+                    map.put("msg", "500");
+                    map.put("errMsg", "此物料是" + material.getPartType() + "库位参数不能为空!");
+                    return map;
+                }
+            }
             askGoods.setMaterialId(material.getTldId());
             //查询库存
             List<Inventory> inventory = askGoodsMapper.getInventoryInfo(askGoods);

+ 1 - 1
src/main/java/com/tld/service/impl/DeliveryServiceImpl.java

@@ -36,7 +36,7 @@ public class DeliveryServiceImpl implements DeliveryService {
             List<Delivery> list = deliveryMapper.getDelivery(delivery);
             map.put("data", list);
             map.put("msg", "200");
-        }catch (Exception e){
+        }catch (Exception e) {
             map.put("msg", "500");
             map.put("errMsg", "服务器请求异常,请稍后再试");
             e.printStackTrace();

+ 15 - 0
src/main/java/com/tld/service/impl/ReceiveGoodsSerivceImpl.java

@@ -318,4 +318,19 @@ public class ReceiveGoodsSerivceImpl implements ReceiveGoodsSerivce {
             e.printStackTrace();
         }
     }
+
+    @Override
+    public Map<String, Object> getPdaReceiveGoods(ReceiveGoods receiveGoods) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            List<ReceiveGoods> list = receiveGoodsMapper.getPdaReceiveGoods(receiveGoods);
+            map.put("data", list);
+            map.put("msg","200");
+        } catch (Exception e) {
+            e.printStackTrace();
+            map.put("status", "500");
+            map.put("msg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
 }

+ 141 - 97
src/main/java/com/tld/service/impl/WarehousingServiceImpl.java

@@ -49,6 +49,9 @@ public class WarehousingServiceImpl implements WarehousingService {
     //库存
     @Autowired
     private DictionaryMapper dictionaryMapper;
+    //质检单
+    @Autowired
+    private ReceiveGoodsMapper receiveGoodsMapper;
 
     @Override
     public Map<String, Object> getRecommend(String wllbCode, String suppId, String num, String unique, String producDate, String warehouseWhere) {
@@ -153,23 +156,13 @@ public class WarehousingServiceImpl implements WarehousingService {
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public Map<String, Object> warehousing(String uniqueCode, String type) {
+    public Map<String, Object> warehousing(String uniqueCode, String type, String warehouseTransferId) {
         Map<String, Object> map = new HashMap<>();
         try{
             //入库信息
             List<WarehousingVirtual> list = new LinkedList<>();
             //查询入库所需要的信息
-            for(WarehousingVirtual warehousingVirtual : warehousingMapper.getVirtual(uniqueCode, type, null)){
-                //查询采购单信息
-                List<ReceiveGoods> receiveGoods = warehousingMapper.getReceiveGoods(warehousingVirtual);
-                if(receiveGoods.size() != 0) {
-                    //所属账套
-                    warehousingVirtual.setAccountSleeve(receiveGoods.get(0).getCompanyNumber());
-                    //WBS
-                    warehousingVirtual.setWbs(receiveGoods.get(0).getWbs());
-                    //流水编号
-                    warehousingVirtual.setStorageCode(receiveGoods.get(0).getOrderCode());
-                }
+            for(WarehousingVirtual warehousingVirtual : warehousingMapper.getVirtual(uniqueCode, type, warehouseTransferId)){
                 //查询部门编号
                 List<User> listUser = userMapper.getAllUser(new User().setId(warehousingVirtual.getUserId()));
                 warehousingVirtual.setDepartmentId(listUser.get(0).getDepartmentId());
@@ -185,48 +178,46 @@ public class WarehousingServiceImpl implements WarehousingService {
             //返回采购单id
             StringBuilder stringBuilder = new StringBuilder();
             //入质检入库数量
-            for(WarehousingVirtual warehousingVirtual1 : warehousingMapper.getVirtual(uniqueCode, type, null)) {
+            for(WarehousingVirtual warehousingVirtual1 : warehousingMapper.getVirtual(uniqueCode, type, warehouseTransferId)) {
                 //查询采购单信息
-                List<ReceiveGoods> receiveGoods = warehousingMapper.getReceiveGoods(warehousingVirtual1);
-                for(ReceiveGoods receiveGoods1 : receiveGoods) {
-                    if(Integer.parseInt(warehousingVirtual1.getNum()) <= 0){
-                        break;
-                    }
-                    //采购单剩余入库数量
-                    int surplusNum = Integer.parseInt(receiveGoods1.getQualifiedNum()) - Integer.parseInt(receiveGoods1.getWarehousingNum());
-                    //剩余入库数量
-                    int numInto = Integer.parseInt(warehousingVirtual1.getNum()) - surplusNum;
-                    if(numInto < 0) {
-                        receiveGoods1.setWarehousingNum(warehousingVirtual1.getNum());
-                        warehousingMapper.updateReceiveGood(receiveGoods1);
-                    } else {
-                        receiveGoods1.setWarehousingNum(String.valueOf(surplusNum));
-                        warehousingMapper.updateReceiveGood(receiveGoods1);
-                        //存入给gs的返回数据
-                        String code = codeGenerateRk();
-                        warehousingVirtual1.setStorageCode(code);
-                        ReturnWarehousing returnWarehousing = new ReturnWarehousing()
-                                .setWarehousingNum(receiveGoods1.getWarehousingNum())
-                                .setGsCk(warehousingVirtual1.getGsCk())
-                                .setSourceType(receiveGoods1.getSourceType())
-                                .setMoveType(receiveGoods1.getMoveType())
-                                .setEntryNumber(receiveGoods1.getEntryNumber())
-                                .setWbs(receiveGoods1.getWbs())
-                                .setId(receiveGoods1.getId())
-                                .setMaterialId(receiveGoods1.getMaterialId())
-                                .setStorageCode(code)
-                                .setOrderNumber(receiveGoods1.getOrderNumber())
-                                .setUserName(warehousingVirtual1.getUserName())
-                                .setStorageLocationCode(warehousingVirtual1.getStorageLocationCode());
-                        warehousingMapper.addReturnWarehousing(returnWarehousing);
-                        warehousingMapper.updateStorage(warehousingVirtual1);//增加入库编号
-                        //判断是否有已存在的采购单号
-                        if(!stringBuilder.toString().contains(receiveGoods1.getOrderNumber() + ",")){
-                            stringBuilder.append(receiveGoods1.getOrderNumber() + ",");
-                        }
+                ReceiveGoods receiveGoods1 = receiveGoodsMapper.getReceiveGoodsCode(warehousingVirtual1.getReceiveGoodsId());
+                if(Integer.parseInt(warehousingVirtual1.getNum()) <= 0){
+                    break;
+                }
+                //采购单剩余入库数量
+                int surplusNum = Integer.parseInt(receiveGoods1.getQualifiedNum()) - Integer.parseInt(receiveGoods1.getWarehousingNum());
+                //剩余入库数量
+                int numInto = Integer.parseInt(warehousingVirtual1.getNum()) - surplusNum;
+                if(numInto < 0) {
+                    receiveGoods1.setWarehousingNum(warehousingVirtual1.getNum());
+                    warehousingMapper.updateReceiveGood(receiveGoods1);
+                } else {
+                    receiveGoods1.setWarehousingNum(String.valueOf(surplusNum));
+                    warehousingMapper.updateReceiveGood(receiveGoods1);
+                    //存入给gs的返回数据
+                    String code = codeGenerateRk();
+                    warehousingVirtual1.setStorageCode(code);
+                    ReturnWarehousing returnWarehousing = new ReturnWarehousing()
+                            .setWarehousingNum(receiveGoods1.getWarehousingNum())
+                            .setGsCk(warehousingVirtual1.getGsCk())
+                            .setSourceType(receiveGoods1.getSourceType())
+                            .setMoveType(receiveGoods1.getMoveType())
+                            .setEntryNumber(receiveGoods1.getEntryNumber())
+                            .setWbs(receiveGoods1.getWbs())
+                            .setId(receiveGoods1.getId())
+                            .setMaterialId(receiveGoods1.getMaterialId())
+                            .setStorageCode(code)
+                            .setOrderNumber(receiveGoods1.getOrderNumber())
+                            .setUserName(warehousingVirtual1.getUserName())
+                            .setStorageLocationCode(warehousingVirtual1.getStorageLocationCode());
+                    warehousingMapper.addReturnWarehousing(returnWarehousing);
+                    warehousingMapper.updateStorage(warehousingVirtual1);//增加入库编号
+                    //判断是否有已存在的采购单号
+                    if(!stringBuilder.toString().contains(receiveGoods1.getOrderNumber() + ",")){
+                        stringBuilder.append(receiveGoods1.getOrderNumber() + ",");
                     }
-                    warehousingVirtual1.setNum(String.valueOf(numInto));
                 }
+                warehousingVirtual1.setNum(String.valueOf(numInto));
             }
             warehousingMapper.delVirtual(uniqueCode);//删除临时表数据
             map.put("data", stringBuilder.toString());
@@ -367,7 +358,7 @@ public class WarehousingServiceImpl implements WarehousingService {
             PageInfo<Notice> list = new PageInfo<>(warehousingMapper.getNotice(notice));
             for(Notice notice1 : list.getList()){
                 int sumScanNumVal = warehousingMapper.getSumScanNumVal(notice1);
-                sumScanNum.put(notice1.getNoticeId(), sumScanNumVal);
+                sumScanNum.put(notice1.getNoticeId() + "-" + notice1.getMaterialId(), sumScanNumVal);
             }
             map.put("data", list);
             map.put("msg", "200");
@@ -411,7 +402,8 @@ public class WarehousingServiceImpl implements WarehousingService {
                     .setProducDate(notice1.getNoticeTime())
                     .setNum(notice.getWarehousingNum())
                     .setStorageCode(storageCode)
-                    .setWbs(notice.getWbs());
+                    .setWbs(notice.getWbs())
+                    .setOrderCode(notice1.getProductionCode());
             warehousingMapper.addProduct(warehousingVirtual);//入库流水 半成品
 
             ReturnWarehousing returnWarehousing = new ReturnWarehousing()
@@ -579,9 +571,13 @@ public class WarehousingServiceImpl implements WarehousingService {
                     StorageLocation storageLocation = new StorageLocation().setIsProduct("1");
                     String[] symbol = {"<", "="};
                     for(int i = 0; i < symbol.length; i++){
-                        String storageLocationCode = warehousingMapper.getStorageLocationCode(notice.getAttribute(), symbol[i]); //查询昨天没满的库位
+                        String producBatch = null;
+                        if(symbol[i].equals("=")){
+                            producBatch = notice.getProducBatch();
+                        }
+                        String storageLocationCode = warehousingMapper.getStorageLocationCode(notice.getAttribute(), symbol[i], producBatch); //查询昨天没满的库位
                         if(!storageLocationCode.equals("0")) {
-                            int countStorage = warehousingMapper.getCountStorage(notice.getAttribute(), storageLocationCode, symbol[i]);
+                            int countStorage = warehousingMapper.getCountStorage(notice.getAttribute(), storageLocationCode, symbol[i], producBatch);
                             int num = 0;
                             if(notice.getType().equals("0")){
                                 num = warehousingMapper.getNumUtil("产成品库位托盘定义");
@@ -599,9 +595,9 @@ public class WarehousingServiceImpl implements WarehousingService {
                     }
                     //查询产成品库位
                     List<StorageLocation> storageLocations = storageLocationMapper.getStorage(storageLocation);
-                    for(StorageLocation storageLocation1 : storageLocations){
+                    for(StorageLocation storageLocation1 : storageLocations) {
                         Inventory inventory = warehousingMapper.getInventoryInfo(storageLocation1);//查询库存信息
-                        if(inventory == null){
+                        if(inventory == null) {
                             stringBuffer.append(storageLocation1.getStorageLocationCode() + ",");
                             break;
                         }
@@ -610,41 +606,43 @@ public class WarehousingServiceImpl implements WarehousingService {
                     map.put("data", list);
                     map.put("msg", "210");
                 } else {
-                    if(warehousingMapper.getInventoryNotice(notice) != 0){
-                        warehousingMapper.updateInventoryNotice(notice);
-                    } else {
-                        warehousingMapper.addInventoryNotice(notice);
-                    }
-                    warehousingMapper.updateNotice(notice);//修改报工单数量
-                    String storageCode = codeGenerateRk();
-                    //入库流水
-                    WarehousingVirtual warehousingVirtual = new WarehousingVirtual()
-                            .setWllbCode(material.getWllbCode())
-                            .setUserId(notice.getUserId())
-                            .setStorageLocationCode(notice.getStorageLocationCode())
-                            .setProducDate(notice.getProducBatch())
-                            .setNum(notice.getWarehousingNum())
-                            .setSerial(notice.getSerial())
-                            .setSeq(notice.getSeq())
-                            .setAttribute(notice.getAttribute())
-                            .setStorageCode(storageCode)
-                            .setWbs(notice.getWbs());
-                    warehousingMapper.addHalf(warehousingVirtual);//入库流水 产成品
-                    //存入给gs的返回数据
-                    Notice notice1 = warehousingMapper.getNoticeId(notice);
-                    ReturnWarehousing returnWarehousing = new ReturnWarehousing()
-                            .setStorageCode(storageCode)//入库编号
-                            .setSourceType(notice1.getSourceType())//来源类型
-                            .setMoveType(notice1.getMoveType())//移动类型
-                            .setOrderNumber(notice1.getNoticeId())//通知单id
-                            .setWbs(notice1.getWbs())//wbs
-                            .setEntryNumber(notice1.getEntryNumber())//gs分录号
-                            .setMaterialId(notice1.getMaterialId())//物料id
-                            .setId(notice1.getId())//分录单id
-                            .setWarehousingNum(notice.getWarehousingNum());//入库数量
-                    warehousingMapper.addReturnWarehousing(returnWarehousing);
-                    map.put("msg", "200");
-                    map.put("data", notice1.getNoticeId() + ",");
+                    map.put("msg", "220");
+//                    if(warehousingMapper.getInventoryNotice(notice) != 0){
+//                        warehousingMapper.updateInventoryNotice(notice);
+//                    } else {
+//                        warehousingMapper.addInventoryNotice(notice);
+//                    }
+//                    warehousingMapper.updateNotice(notice);//修改报工单数量
+//                    String storageCode = codeGenerateRk();
+//                    //入库流水
+//                    Notice notice1 = warehousingMapper.getNoticeId(notice);
+//                    WarehousingVirtual warehousingVirtual = new WarehousingVirtual()
+//                            .setWllbCode(material.getWllbCode())
+//                            .setUserId(notice.getUserId())
+//                            .setStorageLocationCode(notice.getStorageLocationCode())
+//                            .setProducDate(notice.getProducBatch())
+//                            .setNum(notice.getWarehousingNum())
+//                            .setSerial(notice.getSerial())
+//                            .setSeq(notice.getSeq())
+//                            .setAttribute(notice.getAttribute())
+//                            .setStorageCode(storageCode)
+//                            .setWbs(notice.getWbs())
+//                            .setProductionCode(notice1.getProductionCode());
+//                    warehousingMapper.addHalf(warehousingVirtual);//入库流水 产成品
+//                    //存入给gs的返回数据
+//                    ReturnWarehousing returnWarehousing = new ReturnWarehousing()
+//                            .setStorageCode(storageCode)//入库编号
+//                            .setSourceType(notice1.getSourceType())//来源类型
+//                            .setMoveType(notice1.getMoveType())//移动类型
+//                            .setOrderNumber(notice1.getNoticeId())//通知单id
+//                            .setWbs(notice1.getWbs())//wbs
+//                            .setEntryNumber(notice1.getEntryNumber())//gs分录号
+//                            .setMaterialId(notice1.getMaterialId())//物料id
+//                            .setId(notice1.getId())//分录单id
+//                            .setWarehousingNum(notice.getWarehousingNum());//入库数量
+//                    warehousingMapper.addReturnWarehousing(returnWarehousing);
+//                    map.put("msg", "200");
+//                    map.put("data", notice1.getNoticeId() + ",");
                 }
             }
         }catch (Exception e){
@@ -695,7 +693,8 @@ public class WarehousingServiceImpl implements WarehousingService {
                         .setSeq(warehousingVirtual.getSeq())
                         .setAttribute(warehousingVirtual.getAttribute())
                         .setStorageCode(storageCode)
-                        .setWbs(notice1.getWbs());
+                        .setWbs(notice1.getWbs())
+                        .setProductionCode(notice1.getProductionCode());;
                 warehousingMapper.addHalf(warehousingVirtual1);//入库流水 产成品
                 //存入给gs的返回数据
                 ReturnWarehousing returnWarehousing = new ReturnWarehousing()
@@ -825,11 +824,11 @@ public class WarehousingServiceImpl implements WarehousingService {
             //判断物料是否录入
             MaterialClass materialClass = warehousingMapper.getMateriaIsExist(inventory.getWllbCode());
             String userId = request.getHeader("userId");
-            inventory.setWllbClass(materialClass.getWllbClass()).setMaterialId(inventory.getMaterialId()).setUserId(userId);
+            inventory.setWllbClass(materialClass.getWllbClass()).setMaterialId(materialClass.getTldId()).setUserId(userId);
             if(inventory.getId() != null){
-                warehousingMapper.addInventoryOther(inventory);
-            } else {
                 warehousingMapper.updateInventoryOther(inventory);
+            } else {
+                warehousingMapper.addInventoryOther(inventory);
             }
             List<WarehousingVirtual> list = new LinkedList<>();
             String storageCode = codeGenerateRk();//入库单
@@ -846,7 +845,8 @@ public class WarehousingServiceImpl implements WarehousingService {
                     .setStorageLocationCode(inventory.getStorageLocationCode())
                     .setWbs(inventory.getWbs())
                     .setAccountSleeve(inventory.getAccountSleeve())
-                    .setMaterialId(materialClass.getTldId());
+                    .setMaterialId(materialClass.getTldId())
+                    .setNum(inventory.getAmount());
             list.add(warehousingVirtual);
             warehousingMapper.addStorage(list);//入库流水
             warehousingMapper.addReturnWarehousingOther(warehousingVirtual);//其他入库返回信息
@@ -860,6 +860,50 @@ public class WarehousingServiceImpl implements WarehousingService {
         return map;
     }
 
+    @Override
+    public Map<String, Object> getMing(String code) {
+        Map<String, Object> map = new HashMap<>();
+        try {
+            //查询库存
+            String wllbCode = askGoodsMapper.getMing(code);
+            //判断物料是否录入
+            MaterialClass materialClass = warehousingMapper.getMateriaIsExist(wllbCode);
+            if(materialClass.getWllbClass().equals("圆柱终端")){
+                map.put("msg", "500");
+                map.put("errMsg", "请扫描托码");
+                return map;
+            }
+            map.put("msg", "200");
+        } catch (Exception e) {
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
+
+    @Override
+    public Map<String, Object> addWarehousingVirtualTwo(WarehousingVirtual warehousingVirtual) {
+        Map<String, Object> map = new HashMap<>();
+        try{
+            Map<String, Object> mapVal = warehousingMapper.getSumWarehousingVirtual(warehousingVirtual);
+            Double num = Double.parseDouble(warehousingVirtual.getNum()) + Double.parseDouble(mapVal.get("scanNum").toString());
+            if(Double.parseDouble(mapVal.get("num").toString()) < num){
+                String surplus = String.valueOf(Double.parseDouble(mapVal.get("num").toString()) - Double.parseDouble(mapVal.get("scanNum").toString()));
+                map.put("msg", "500");
+                map.put("errMsg", "扫描数量超过单据数量,剩余要扫数量" + surplus);
+                return map;
+            }
+            warehousingMapper.addWarehousingVirtual(warehousingVirtual);
+            map.put("msg", "200");
+        } catch (Exception e){
+            e.printStackTrace();
+            map.put("msg", "500");
+            map.put("errMsg", "服务器请求异常,请稍后再试");
+        }
+        return map;
+    }
+
 
     /**
      * 入库单生成

+ 6 - 1
src/main/java/com/tld/service/impl/WebPrintServiceImpl.java

@@ -42,7 +42,12 @@ public class WebPrintServiceImpl implements WebPrintService {
             String serial = generateSerial((count + 1) + "");
             String num = generateNum(tldPrint.getNum());
             String materialCode = generateMaterialCode(tldPrint.getMaterialCode());
-            String supplierCode = generateSupplierCode(tldPrint.getSupplierId());
+            String supplierCode = "";
+            if(tldPrint.getType().equals("托码打印")) {
+                supplierCode = tldPrint.getAttribute();
+            } else {
+                supplierCode = generateSupplierCode(tldPrint.getSupplierId());
+            }
             tldPrint.setNum(num);
             tldPrint.setSerial(serial);
             webPrintMapper.addPrint(tldPrint);

+ 2 - 1
src/main/resources/application.yml

@@ -22,9 +22,10 @@ spring:
 #        slave:
 #          # 从数据源开关/默认关闭
 #          enabled: true
-#          url: jdbc:mysql://10.2.111.92:3306/okr?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
+#          url: jdbc:mysql://10.2.111.92:3306/tld?useUnicode=true&characterEncoding=utf-8&useSSL=true&rewriteBatchedStatements=true&allowMultiQueries=true
 #          username: root
 #          password: "#09SilverB"
+#          driver-class-name: com.mysql.cj.jdbc.Driver
         # sqlserver
 #        ds2:
 #          username: sa

+ 10 - 2
src/main/resources/mapper/AskGoodsMapper.xml

@@ -618,10 +618,13 @@
             scrq,
             produc_batch,
             attribute
-        from tld_inventory where storage_location_code = #{storageLocationCode} and material_id = #{materialId} and account_sleeve = #{accountSleeve} and amount <![CDATA[>=]]> #{num}
+        from tld_inventory where material_id = #{materialId} and account_sleeve = #{accountSleeve} and amount <![CDATA[>=]]> #{num}
         <if test="wbs != '' and wbs != null">
             and wbs = #{wbs}
         </if>
+        <if test="storageLocationCode != '' and storageLocationCode != null">
+            and storage_location_code = #{storageLocationCode}
+        </if>
         <if test="wbs == ''.toString() or wbs == null ">
             and wbs is null
         </if>
@@ -661,7 +664,8 @@
             a.produc_batch,
             a.attribute,
             b.name as accountName,
-            c.storage_location_name as storageLocationName
+            c.storage_location_name as storageLocationName,
+            c.warehouse_where as warehouseWhere
         from tld_inventory a
         left join tld_company b on a.account_sleeve = b.code
         left join tld_storage_location c on a.storage_location_code = c.storage_location_code
@@ -776,5 +780,9 @@
     <delete id="delReturnWarehouseTransferZ">
         delete from tld_return_warehouse_transfer_z where warehouse_transfer_id = #{warehouseTransferTd}
     </delete>
+    <!-- 查询名牌物料CODE -->
+    <select id="getMing" resultType="String">
+        select wllb_code from tld_mingpai where code = #{code}
+    </select>
 
 </mapper>

+ 80 - 1
src/main/resources/mapper/ReceiveGoodsMapper.xml

@@ -373,5 +373,84 @@
         from tld_receive_goods
         where id = #{id}
     </delete>
-
+    <!-- 查询入库单内容 -->
+    <select id="getPdaReceiveGoods" resultType="com.tld.model.ReceiveGoods">
+        select
+            a.id,
+            a.order_code,
+            b.name as materialName,
+            c.name as supplierName,
+            a.purchase_num,
+            a.arrival_num,
+            a.type,
+            a.qualified_num,
+            a.disqualification_num,
+            a.arrival_time,
+            b.code as wllbCode,
+            a.wbs,
+            e.company_number as companyNumber,
+            e.supplier_id as supplierId,
+            p.name as compName
+        from tld_receive_goods a
+        left join tld_material b on a.material_id = b.tld_id
+        left join tld_customer c on a.supplier_id = c.code
+        left join tld_receive_goods_f e on a.order_code = e.order_code
+        left join tld_company p on e.company_number = p.code
+        where (warehousing_num + 0) <![CDATA[<]]> (qualified_num + 0)
+        <if test="materialId != null and materialId != ''">
+            and a.material_id like CONCAT(CONCAT('%',#{materialId},'%'))
+        </if>
+        <if test="supplierId != null and supplierId != ''">
+            and a.supplier_id = #{supplierId}
+        </if>
+        <if test="companyNumber != null and companyNumber != ''">
+            and e.company_number = #{companyNumber}
+        </if>
+        <if test="materialName != null and materialName != ''">
+            and b.name like CONCAT(CONCAT('%',#{materialName},'%'))
+        </if>
+        <if test="type != null and type != ''">
+            and a.type = #{type}
+        </if>
+        <if test="startTime != null and startTime != ''">
+            and a.arrival_time <![CDATA[>=]]> #{startTime}
+        </if>
+        <if test="endTime != null and endTime != ''">
+            and a.arrival_time <![CDATA[<=]]> #{endTime}
+        </if>
+        <if test="orderCode != null and orderCode != ''">
+            and a.order_code like CONCAT(CONCAT('%',#{orderCode},'%'))
+        </if>
+        <if test="wbs != null and wbs != ''">
+            and a.wbs like CONCAT(CONCAT('%',#{wbs},'%'))
+        </if>
+        order by a.id desc
+    </select>
+    <!-- 查询采购单内容 -->
+    <select id="getReceiveGoodsCode" resultType="com.tld.model.ReceiveGoods">
+        SELECT a.id,
+               a.order_code,
+               a.material_id,
+               a.purchase_num,
+               a.arrival_num,
+               a.type,
+               a.qualified_num,
+               a.disqualification_num,
+               a.wbs,
+               a.arrival_time,
+               a.measurement_id,
+               a.supplier_id,
+               a.entry_number,
+               a.warehousing_num,
+               b.company_number,
+               b.order_number,
+               b.source_type,
+               b.move_type,
+               f.name as supplierName
+        FROM tld_receive_goods a
+        LEFT JOIN tld_receive_goods_f b on a.order_code = b.order_code
+        JOIN tld_material c on a.material_id = c.tld_id
+        LEFT JOIN tld_customer f on a.supplier_id = f.code
+        WHERE id = #{receiveGoodsId}
+    </select>
 </mapper>

+ 22 - 11
src/main/resources/mapper/WarehousingMapper.xml

@@ -27,10 +27,10 @@
     <insert id="addWarehousingVirtual">
         insert into tld_warehousing_virtual(unique_code, num, storage_location_code, wllb_code, supp_id, serial, type,
                                             produc_date, capacity, seq, user_id, storage_location_name, attribute,
-                                            notice_id, warehouse_transfer_id, storage_location_code_ck)
+                                            notice_id, warehouse_transfer_id, storage_location_code_ck,wbs)
         values (#{uniqueCode}, #{num}, #{storageLocationCode}, #{wllbCode}, #{suppId}, #{serial}, #{type},
                 #{producDate}, #{capacity}, #{seq}, #{userId}, #{storageLocationName}, #{attribute}, #{noticeId},
-                #{warehouseTransferId}, #{storageLocationCodeCk})
+                #{warehouseTransferId}, #{storageLocationCodeCk},#{wbs})
     </insert>
     <!-- 查询总数量 -->
     <select id="getScanNum" resultType="java.util.Map">
@@ -155,10 +155,10 @@
     <!-- 插入入库流水 -->
     <insert id="addStorage">
         insert into
-        tld_storage(wllb_code,supplier_id,serial,produc_date,produc_batch,capacity,seq,type,user_id,department_id,storage_location_code,scrq,storage_code,wbs)
+        tld_storage(wllb_code,supplier_id,serial,produc_date,produc_batch,capacity,seq,type,user_id,department_id,storage_location_code,scrq,storage_code,wbs,order_code)
         values
         <foreach collection="list" index="index" item="item" separator=",">
-            (#{item.wllbCode},#{item.suppId},#{item.serial},#{item.producDate},#{item.producDate},#{item.num},#{item.seq},#{item.type},#{item.userId},#{item.departmentId},#{item.storageLocationCode},now(),#{item.storageCode},#{item.wbs})
+            (#{item.wllbCode},#{item.suppId},#{item.serial},#{item.producDate},#{item.producDate},#{item.num},#{item.seq},#{item.type},#{item.userId},#{item.departmentId},#{item.storageLocationCode},now(),#{item.storageCode},#{item.wbs},#{item.orderCode})
         </foreach>
     </insert>
     <!-- 插入库存 -->
@@ -531,8 +531,8 @@
     <!-- 新增半成品入库流水 -->
     <insert id="addProduct">
         insert into tld_half_product(wllb_code, produc_date, produc_batch, capacity, user_id, storage_location_code,
-                                     scrq, storage_code, wbs)
-            value (#{wllbCode},#{producDate},#{producDate},#{num},#{userId},#{storageLocationCode},now(),#{storageCode},#{wbs})
+                                     scrq, storage_code, wbs, production_code)
+            value (#{wllbCode},#{producDate},#{producDate},#{num},#{userId},#{storageLocationCode},now(),#{storageCode},#{wbs}, #{productionCode})
     </insert>
     <!-- 查询半成品入库流水-->
     <select id="getProduct" resultType="com.tld.model.Notice">
@@ -839,9 +839,8 @@
     <select id="getSumScanNumVal" resultType="int">
         SELECT ifnull(sum(a.num), 0)
         FROM tld_warehousing_virtual a
-                 left join tld_material b on a.wllb_code = b.code
-        WHERE a.notice_id = #{noticeId}
-          and b.tld_id = #{materialId}
+        left join tld_material b on a.wllb_code = b.code
+        WHERE a.notice_id = #{noticeId} and b.tld_id = #{materialId}
     </select>
     <!-- 修改报工单入库数量 -->
     <update id="updateNotice">
@@ -870,8 +869,10 @@
     <select id="getStorageLocationCode" resultType="String">
         SELECT ifnull(storage_location_code, "0")
         FROM tld_inventory
-        WHERE attribute = #{attribute}
-          and scrq <![CDATA[${symbol}]]> CURDATE()
+        WHERE attribute = #{attribute} and scrq <![CDATA[${symbol}]]> CURDATE()
+        <if test="producBatch != null">
+            produc_batch = #{producBatch}
+        </if>
         ORDER BY scrq desc LIMIT 1
     </select>
     <select id="getCountStorage" resultType="int">
@@ -880,6 +881,9 @@
         where attribute = #{attribute}
           and storage_location_code = #{storageLocationCode}
           and scrq <![CDATA[${symbol}]]> CURDATE()
+        <if test="producBatch != null">
+            produc_batch = #{producBatch}
+        </if>
         ORDER BY scrq desc LIMIT 1
     </select>
     <!-- 增加流水入库编号 -->
@@ -923,4 +927,11 @@
                                   produc_batch, attribute)
             value (#{storageLocationCode},#{wllbClass},#{libraryType},#{materialId},#{amount},now(),'0',#{accountSleeve},#{wbs},#{supplierId},#{serial},#{wllbCode},#{producDate},now(),#{producDate},#{attribute})
     </insert>
+    <!-- 查询扫描数量 -->
+    <select id="getSumWarehousingVirtual" resultType="java.util.Map">
+        select
+               (select sum(num) from tld_warehousing_virtual where receive_goods_id = #{receiveGoodsId}) as scanNum,
+               (select (qualified_num + 0) - ifnull((warehousing_num + 0), 0) from tld_receive_goods where id = #{receiveGoodsId}) as num
+        from dual
+    </select>
 </mapper>

+ 1 - 1
src/main/resources/mapper/WebPrintMapper.xml

@@ -9,6 +9,6 @@
     <!-- 新增信息 -->
     <insert id="addPrint">
         insert into tld_print(material_code,supplier_id,produc_date,num,serial,scrq,user_id,type)
-        value(#{materialCode},#{supplierId},#{producDate},#{num},#{serial},now(),#{userId},#{type})
+        value(#{materialCode},#{supplierId},#{producDate},#{num},#{serial},now(),#{userId},#{type},#{attribute})
     </insert>
 </mapper>