|  |  | @ -231,11 +231,13 @@ public class InvProductsTrService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } else { |  |  |  |                 } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     count = warehouseEntity.getCount(); |  |  |  |                     count = warehouseEntity.getCount(); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 int invCount = getCountByOrder(null, warehouseEntity.getCode(), warehouseEntity.getSupId()); |  |  |  |                 InvWarehouseEntity invWarehouseEntity = invWarehouseService.findDefault(true, true); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 int invCount = getCountByOrder(null, warehouseEntity.getCode(), warehouseEntity.getSupId(), invWarehouseEntity.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (invCount <= 0) { |  |  |  |                 if (invCount <= 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     invCount = getCountByOrder(null, code, warehouseEntity.getSupId()); |  |  |  |                     invCount = getCountByOrder(null, code, warehouseEntity.getSupId(), invWarehouseEntity.getCode()); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |                 warehouseEntity.setFromCorpId(invWarehouseEntity.getCode()); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 warehouseEntity.setFromCorp(invWarehouseEntity.getName()); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (invCount > 0) { |  |  |  |                 if (invCount > 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     if (count > invCount) { |  |  |  |                     if (count > invCount) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                         int lea = count - invCount; |  |  |  |                         int lea = count - invCount; | 
			
		
	
	
		
		
			
				
					|  |  | @ -264,9 +266,27 @@ public class InvProductsTrService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } else { |  |  |  |                 } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     count = warehouseEntity.getCount(); |  |  |  |                     count = warehouseEntity.getCount(); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 int invCount = getCountByOrder(null, warehouseEntity.getCode(), warehouseEntity.getSupId()); |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 if (invCount <= 0) { |  |  |  |                 //获取当前仓库
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     invCount = getCountByOrder(null, code, warehouseEntity.getSupId()); |  |  |  |                 InvWarehouseEntity invWarehouseEntity = invWarehouseService.selectByCode(warehouseEntity.getLocStorageCode()); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 int invCount = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (invWarehouseEntity.getPcode() != null || !invWarehouseEntity.getPcode().equals("0")) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     //上级仓库
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     warehouseEntity.setFromCorp(invWarehouseEntity.getName()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     warehouseEntity.setFromCorpId(invWarehouseEntity.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     invCount = getCountByOrder(null, warehouseEntity.getCode(), warehouseEntity.getSupId(), invWarehouseEntity.getPcode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     if (invCount <= 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invCount = getCountByOrder(null, code, warehouseEntity.getSupId(), invWarehouseEntity.getPcode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     //供应商
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     warehouseEntity.setFromCorpId(warehouseEntity.getSupId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     BasicUnitMaintainEntity basicUnitMaintainEntity = basicUnitMaintainService.selectByErpId(warehouseEntity.getSupId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     warehouseEntity.setFromCorp(basicUnitMaintainEntity.getName()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     invCount = getCountByOrder(null, warehouseEntity.getCode(), warehouseEntity.getSupId(), null); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     if (invCount <= 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invCount = getCountByOrder(null, code, warehouseEntity.getSupId(), null); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (invCount > 0) { |  |  |  |                 if (invCount > 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     if (count > invCount) { |  |  |  |                     if (count > invCount) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -302,49 +322,47 @@ public class InvProductsTrService { | 
			
		
	
		
		
			
				
					
					|  |  |  |             List<WarehouseEntity> temps1 = filterMapCodes(preiInList); |  |  |  |             List<WarehouseEntity> temps1 = filterMapCodes(preiInList); | 
			
		
	
		
		
			
				
					
					|  |  |  |             buildNorPreInOrder(advChangeTypeEntity, temps1, orderEntity);   //3.补寄售转入
 |  |  |  |             buildNorPreInOrder(advChangeTypeEntity, temps1, orderEntity);   //3.补寄售转入
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public List<WarehouseEntity> addOutOrder(OrderEntity |  |  |  | //    public List<WarehouseEntity> addOutOrder(OrderEntity
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                                      orderEntity, List<InvProductDetailEntity> invProductDetailEntities) { |  |  |  | //                                                     orderEntity, List<InvProductDetailEntity> invProductDetailEntities) {
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         List<WarehouseEntity> warehouseEntities = codesService.findByReceiptId(orderEntity.getId()); |  |  |  | //        List<WarehouseEntity> warehouseEntities = codesService.findByReceiptId(orderEntity.getId());
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         List<WarehouseEntity> inList = new ArrayList<>(); |  |  |  | //        List<WarehouseEntity> inList = new ArrayList<>();
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         for (WarehouseEntity warehouseEntity : warehouseEntities) { |  |  |  | //        for (WarehouseEntity warehouseEntity : warehouseEntities) {
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             //获取普通出入库结余数量
 |  |  |  | //            //获取普通出入库结余数量
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             int actCount = getActCount(warehouseEntity); |  |  |  | //            int actCount = getActCount(warehouseEntity);
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             int count = 0; |  |  |  | //            int count = 0;
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             UdiInfoEntity udiInfoEntity = getMinDi(warehouseEntity); |  |  |  | //            UdiInfoEntity udiInfoEntity = getMinDi(warehouseEntity);
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             String code = warehouseEntity.getCode(); |  |  |  | //            String code = warehouseEntity.getCode();
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             if (udiInfoEntity.getDiType() == ConstantStatus.DITYPE_PACK || udiInfoEntity.getDiType() == ConstantStatus.DITYPE_SYDY |  |  |  | //            if (udiInfoEntity.getDiType() == ConstantStatus.DITYPE_PACK || udiInfoEntity.getDiType() == ConstantStatus.DITYPE_SYDY
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     || (udiInfoEntity.getSjcpbm() != null && !"".equals(udiInfoEntity.getSjcpbm()))) { |  |  |  | //                    || (udiInfoEntity.getSjcpbm() != null && !"".equals(udiInfoEntity.getSjcpbm()))) {
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 warehouseEntity.setNameCode(udiInfoEntity.getNameCode()); |  |  |  | //                warehouseEntity.setNameCode(udiInfoEntity.getNameCode());
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 code = FilterUdiUtils.transGlxpNoSerStr(warehouseEntity); |  |  |  | //                code = FilterUdiUtils.transGlxpNoSerStr(warehouseEntity);
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 count = actCount * warehouseEntity.getCount(); |  |  |  | //                count = actCount * warehouseEntity.getCount();
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             } else { |  |  |  | //            } else {
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 count = warehouseEntity.getCount(); |  |  |  | //                count = warehouseEntity.getCount();
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  | //            }
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             int invCount = getCountByOrder(null, warehouseEntity.getCode(), warehouseEntity.getSupId()); |  |  |  | //            int invCount = getCountByOrder(null, warehouseEntity.getCode(), warehouseEntity.getSupId());
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             if (invCount <= 0) { |  |  |  | //            if (invCount <= 0) {
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 invCount = getCountByOrder(null, code, warehouseEntity.getSupId()); |  |  |  | //                invCount = getCountByOrder(null, code, warehouseEntity.getSupId());
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  | //            }
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             if (invCount > 0) { |  |  |  | //            if (invCount > 0) {
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 if (count > invCount) { |  |  |  | //                if (count > invCount) {
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     int lea = count - invCount; |  |  |  | //                    int lea = count - invCount;
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     warehouseEntity.setCount(lea / actCount); |  |  |  | //                    warehouseEntity.setCount(lea / actCount);
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     inList.add(warehouseEntity); |  |  |  | //                    inList.add(warehouseEntity);
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  | //                }
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             } else { |  |  |  | //            } else {
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 warehouseEntity.setCount(count); |  |  |  | //                warehouseEntity.setCount(count);
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 inList.add(warehouseEntity); |  |  |  | //                inList.add(warehouseEntity);
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  | //            }
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             InvProductDetailEntity invProductDetailEntity = filterInvByCode(invProductDetailEntities, warehouseEntity.getCode()); |  |  |  | //            InvProductDetailEntity invProductDetailEntity = filterInvByCode(invProductDetailEntities, warehouseEntity.getCode());
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             insetInvSingle(false, invProductDetailEntity); |  |  |  | //            insetInvSingle(false, invProductDetailEntity);
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             warehouseEntity.setCode(code); |  |  |  | //            warehouseEntity.setCode(code);
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  | //        }
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         return inList; |  |  |  | //        return inList;
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  | //    }
 | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     //普通入库补单
 |  |  |  |     //普通入库补单
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public List<WarehouseEntity> addPutOrder(OrderEntity |  |  |  |     public List<WarehouseEntity> addPutOrder(OrderEntity | 
			
		
	
	
		
		
			
				
					|  |  | @ -573,6 +591,69 @@ public class InvProductsTrService { | 
			
		
	
		
		
			
				
					
					|  |  |  |         //采购入库生成单据
 |  |  |  |         //采购入库生成单据
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         Map<String, List<WarehouseEntity>> filterSupMaps = new HashMap<>(); |  |  |  |         Map<String, List<WarehouseEntity>> filterSupMaps = new HashMap<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<WarehouseEntity> unkonwCorpList = new ArrayList<>(); |  |  |  |         List<WarehouseEntity> unkonwCorpList = new ArrayList<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //根据库存,过滤供应商,条码分组
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         for (WarehouseEntity warehouseEntity : useInList) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (warehouseEntity.getFromCorpId() != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (filterSupMaps.get(warehouseEntity.getFromCorpId()) == null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     List<WarehouseEntity> temps = new ArrayList<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     temps.add(warehouseEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     filterSupMaps.put(warehouseEntity.getFromCorpId(), temps); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     filterSupMaps.get(warehouseEntity.getFromCorpId()).add(warehouseEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } else | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 unkonwCorpList.add(warehouseEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //根据往来单位生成入库单
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         for (String corpName : filterSupMaps.keySet()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             List<WarehouseEntity> temps; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             temps = filterSupMaps.get(corpName); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             OrderEntity outOrder = new OrderEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             BeanUtils.copyProperties(orderEntity, outOrder); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outOrder.setActDate(DateUtil.getBeforeDay(outOrder.getActDate(), bussinessChangeTypeEntity.getBeforeTime())); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outOrder.setAction(bussinessChangeTypeEntity.getScAction()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outOrder.setMainAction(ConstantType.TYPE_PUT); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outOrder.setContrastStatus(ConstantStatus.ORDER_CHECK_UN); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outOrder.setCustomerId(Constant.SYSTEM_CUSTOMER_ID); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outOrder.setErpFk(null); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outOrder.setFromType(ConstantStatus.FROM_CHANGE); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outOrder.setId(CustomUtil.getId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outOrder.setFromCorpId(corpName); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outOrder.setFromCorp(temps.get(0).getFromCorp()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outOrder.setLocStorageCode(orderEntity.getLocStorageCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("additional_auto_submit"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if ("1".equals(systemParamConfigEntity.getParamValue())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 outOrder.setStatus(ConstantStatus.ORDER_STATUS_PROCESS); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 outOrder.setStatus(ConstantStatus.ORDER_STATUS_ADDITIONAL); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             orderService.insertOrder(outOrder); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             for (WarehouseEntity warehouseEntity : temps) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 warehouseEntity.setOrderId(outOrder.getId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 warehouseEntity.setId(null); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 warehouseEntity.setFromCorp(outOrder.getFromCorp()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 warehouseEntity.setFromCorpId(outOrder.getFromCorpId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 warehouseEntity.setLocStorageCode(outOrder.getLocStorageCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 warehouseEntity.setAction(bussinessChangeTypeEntity.getScAction()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 warehouseEntity.setMainAction(ConstantType.TYPE_PUT); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             codesTempService.insertCodesTemp(temps); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     //生成普通入库单据
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public void buildInOrder2(BussinessChangeTypeEntity | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                       bussinessChangeTypeEntity, List<WarehouseEntity> useInList, OrderEntity orderEntity) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (useInList.size() <= 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //采购入库生成单据
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Map<String, List<WarehouseEntity>> filterSupMaps = new HashMap<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         List<WarehouseEntity> unkonwCorpList = new ArrayList<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  | //        InvWarehouseEntity invWarehouseEntity = invWarehouseService.findDefault(false, true);
 |  |  |  | //        InvWarehouseEntity invWarehouseEntity = invWarehouseService.findDefault(false, true);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         //根据库存,过滤供应商,条码分组
 |  |  |  |         //根据库存,过滤供应商,条码分组
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         for (WarehouseEntity warehouseEntity : useInList) { |  |  |  |         for (WarehouseEntity warehouseEntity : useInList) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -663,7 +744,6 @@ public class InvProductsTrService { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     //生成寄售转入单据
 |  |  |  |     //生成寄售转入单据
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public void buildNorPreInOrder(BussinessChangeTypeEntity |  |  |  |     public void buildNorPreInOrder(BussinessChangeTypeEntity | 
			
		
	
		
		
			
				
					
					|  |  |  |                                            bussinessChangeTypeEntity, List<WarehouseEntity> useInList, OrderEntity orderEntity) { |  |  |  |                                            bussinessChangeTypeEntity, List<WarehouseEntity> useInList, OrderEntity orderEntity) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -673,6 +753,75 @@ public class InvProductsTrService { | 
			
		
	
		
		
			
				
					
					|  |  |  |         //采购入库生成单据
 |  |  |  |         //采购入库生成单据
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         Map<String, List<WarehouseEntity>> filterSupMaps = new HashMap<>(); |  |  |  |         Map<String, List<WarehouseEntity>> filterSupMaps = new HashMap<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<WarehouseEntity> unkonwCorpList = new ArrayList<>(); |  |  |  |         List<WarehouseEntity> unkonwCorpList = new ArrayList<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //根据库存,过滤供应商,条码分组
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         for (WarehouseEntity warehouseEntity : useInList) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (warehouseEntity.getFromCorpId() != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (filterSupMaps.get(warehouseEntity.getFromCorpId()) == null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     List<WarehouseEntity> temps = new ArrayList<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     temps.add(warehouseEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     filterSupMaps.put(warehouseEntity.getFromCorpId(), temps); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     filterSupMaps.get(warehouseEntity.getFromCorpId()).add(warehouseEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } else | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 unkonwCorpList.add(warehouseEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //有供应商生成采购入库单据
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         for (String corpName : filterSupMaps.keySet()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             List<WarehouseEntity> temps; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             temps = filterSupMaps.get(corpName); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             OrderEntity outOrder = new OrderEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             BeanUtils.copyProperties(orderEntity, outOrder); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outOrder.setActDate(DateUtil.getBeforeDay(outOrder.getActDate(), bussinessChangeTypeEntity.getBeforeTime())); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outOrder.setAction(bussinessChangeTypeEntity.getScAction()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outOrder.setMainAction(ConstantType.TYPE_PUT); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outOrder.setContrastStatus(ConstantStatus.ORDER_CHECK_UN); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outOrder.setCustomerId(Constant.SYSTEM_CUSTOMER_ID); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outOrder.setFromCorp(temps.get(0).getFromCorp()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outOrder.setFromCorpId(temps.get(0).getFromCorpId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outOrder.setLocStorageCode(orderEntity.getLocStorageCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outOrder.setErpFk(null); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outOrder.setFromType(ConstantStatus.FROM_CHANGE); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             outOrder.setId(CustomUtil.getId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //            BasicUnitMaintainEntity basicUnitMaintainEntity = basicUnitMaintainService.selectByErpId(corpName);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //            outOrder.setFromCorp(basicUnitMaintainEntity.getName());
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //            outOrder.setFromCorpId(corpName);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("additional_auto_submit"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if ("1".equals(systemParamConfigEntity.getParamValue())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 outOrder.setStatus(ConstantStatus.ORDER_STATUS_PROCESS); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 outOrder.setStatus(ConstantStatus.ORDER_STATUS_ADDITIONAL); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             orderService.insertOrder(outOrder); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             for (WarehouseEntity warehouseEntity : temps) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 warehouseEntity.setOrderId(outOrder.getId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 warehouseEntity.setId(null); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 warehouseEntity.setFromCorp(outOrder.getFromCorp()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 warehouseEntity.setFromCorpId(outOrder.getFromCorpId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 warehouseEntity.setLocStorageCode(outOrder.getLocStorageCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 warehouseEntity.setAction(bussinessChangeTypeEntity.getScAction()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 warehouseEntity.setMainAction(ConstantType.TYPE_PUT); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             codesTempService.insertCodesTemp(temps); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //            ioTransInoutService.transInout(outOrder.getId());
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     //生成寄售转入单据
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public void buildNorPreInOrder2(BussinessChangeTypeEntity | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                             bussinessChangeTypeEntity, List<WarehouseEntity> useInList, OrderEntity orderEntity) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (useInList.size() <= 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //采购入库生成单据
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Map<String, List<WarehouseEntity>> filterSupMaps = new HashMap<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         List<WarehouseEntity> unkonwCorpList = new ArrayList<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         InvWarehouseEntity invWarehouseEntity = invWarehouseService.findDefault(true, true); |  |  |  |         InvWarehouseEntity invWarehouseEntity = invWarehouseService.findDefault(true, true); | 
			
		
	
		
		
			
				
					
					|  |  |  |         //根据库存,过滤供应商,条码分组
 |  |  |  |         //根据库存,过滤供应商,条码分组
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         for (WarehouseEntity warehouseEntity : useInList) { |  |  |  |         for (WarehouseEntity warehouseEntity : useInList) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -955,10 +1104,11 @@ public class InvProductsTrService { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     //根据条码获取库存结余数量
 |  |  |  |     //根据条码获取库存结余数量
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public int getCountByOrder(String mainAction, String code, String supId) { |  |  |  |     public int getCountByOrder(String mainAction, String code, String supId, String invWarehouseCode) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest(); |  |  |  |         FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         filterInvProductDetailRequest.setCode(code); |  |  |  |         filterInvProductDetailRequest.setCode(code); | 
			
		
	
		
		
			
				
					
					|  |  |  |         filterInvProductDetailRequest.setSupId(supId); |  |  |  |         filterInvProductDetailRequest.setSupId(supId); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         filterInvProductDetailRequest.setInvStorageCode(invWarehouseCode); | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (mainAction != null) |  |  |  |         if (mainAction != null) | 
			
		
	
		
		
			
				
					
					|  |  |  |             filterInvProductDetailRequest.setMainAction(mainAction); |  |  |  |             filterInvProductDetailRequest.setMainAction(mainAction); | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<InvProductDetailJoinResponse> detailJoinResponseList |  |  |  |         List<InvProductDetailJoinResponse> detailJoinResponseList | 
			
		
	
	
		
		
			
				
					|  |  | 
 |