|  |  |  | @ -27,6 +27,7 @@ import com.glxp.api.util.OrderNoTypeBean; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.util.udi.FilterUdiUtils; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.util.udi.UdiCalCountUtil; | 
			
		
	
		
			
				
					|  |  |  |  | import net.sf.jasperreports.engine.JRException; | 
			
		
	
		
			
				
					|  |  |  |  | import org.apache.commons.lang3.StringUtils; | 
			
		
	
		
			
				
					|  |  |  |  | import org.springframework.beans.BeanUtils; | 
			
		
	
		
			
				
					|  |  |  |  | import org.springframework.scheduling.annotation.Async; | 
			
		
	
		
			
				
					|  |  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
	
		
			
				
					|  |  |  | @ -742,181 +743,74 @@ public class IoCheckInoutService { | 
			
		
	
		
			
				
					|  |  |  |  |     public void genInv(IoOrderEntity orderEntity, BasicBussinessTypeEntity bussinessTypeEntity) { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         if (bussinessTypeEntity.getMainAction().equals(ConstantType.TYPE_OUT) && bussinessTypeEntity.isScanPreIn()) { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             ThreadUtil.execAsync(() -> { | 
			
		
	
		
			
				
					|  |  |  |  |                 List<IoCodeEntity> backCodeList = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |  |                 List<IoCodeEntity> codeList = codeService.findByOrderId(orderEntity.getBillNo()); | 
			
		
	
		
			
				
					|  |  |  |  |                 for (IoCodeEntity codeEntity : codeList) { | 
			
		
	
		
			
				
					|  |  |  |  |                     int count = invPreinProductDetailService.findCountByCode(codeEntity.getCode()); | 
			
		
	
		
			
				
					|  |  |  |  |                     if (count > 0) { | 
			
		
	
		
			
				
					|  |  |  |  |                         codeEntity.setCount(count); | 
			
		
	
		
			
				
					|  |  |  |  |                         codeEntity.setReCount(udiCalCountUtil.getActCount(codeEntity.getNameCode())); | 
			
		
	
		
			
				
					|  |  |  |  |                         backCodeList.add(codeEntity); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |                 BasicBussinessTypeEntity basicBussinessTypeEntity = basicBussinessTypeService.findByAction(orderEntity.getAction()); | 
			
		
	
		
			
				
					|  |  |  |  |                 if (StrUtil.isNotEmpty(basicBussinessTypeEntity.getPreInBackAction())) { | 
			
		
	
		
			
				
					|  |  |  |  |                     IoOrderEntity outOrder = new IoOrderEntity(); | 
			
		
	
		
			
				
					|  |  |  |  | //                    BeanUtils.copyProperties(orderEntity, outOrder);
 | 
			
		
	
		
			
				
					|  |  |  |  |                     outOrder.setId(null); | 
			
		
	
		
			
				
					|  |  |  |  |                     outOrder.setMainAction(ConstantType.TYPE_OUT); | 
			
		
	
		
			
				
					|  |  |  |  |                     outOrder.setAction(basicBussinessTypeEntity.getAction()); | 
			
		
	
		
			
				
					|  |  |  |  |                     outOrder.setCreateTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |  |                     outOrder.setFromType(ConstantStatus.FROM_CHANGE); | 
			
		
	
		
			
				
					|  |  |  |  |                     String orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + StrUtil.trimToEmpty(basicBussinessTypeEntity.getPrefix()), "yyyyMMdd")); | 
			
		
	
		
			
				
					|  |  |  |  |                     outOrder.setBillNo(orderNo); | 
			
		
	
		
			
				
					|  |  |  |  |                     outOrder.setCustomerId(Constant.SYSTEM_CUSTOMER_ID); | 
			
		
	
		
			
				
					|  |  |  |  |                     outOrder.setCorpOrderId(CustomUtil.getId() + "x"); | 
			
		
	
		
			
				
					|  |  |  |  |                     outOrder.setStatus(ConstantStatus.ORDER_STATUS_PROCESS); | 
			
		
	
		
			
				
					|  |  |  |  |                     orderEntity.setUllageSupNo(outOrder.getBillNo()); | 
			
		
	
		
			
				
					|  |  |  |  |                     orderEntity.setUpdateTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |  |                     orderService.update(orderEntity); | 
			
		
	
		
			
				
					|  |  |  |  |                     outOrder.setOriginUllageSupNo(orderEntity.getBillNo()); | 
			
		
	
		
			
				
					|  |  |  |  |                     outOrder.setCreateUser(null); | 
			
		
	
		
			
				
					|  |  |  |  |                     outOrder.setReviewUser(null); | 
			
		
	
		
			
				
					|  |  |  |  |                     orderService.insertOrder(outOrder); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                     //生成条码
 | 
			
		
	
		
			
				
					|  |  |  |  |                     List<IoCodeTempEntity> codeTempEntities = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |  |                     for (IoCodeEntity warehouseEntity : backCodeList) { | 
			
		
	
		
			
				
					|  |  |  |  |                         IoCodeTempEntity codeTempEntity = new IoCodeTempEntity(); | 
			
		
	
		
			
				
					|  |  |  |  |                         BeanUtils.copyProperties(warehouseEntity, codeTempEntity); | 
			
		
	
		
			
				
					|  |  |  |  |                         codeTempEntity.setId(null); | 
			
		
	
		
			
				
					|  |  |  |  |                         codeTempEntity.setOrderId(outOrder.getBillNo()); | 
			
		
	
		
			
				
					|  |  |  |  |                         codeTempEntity.setAction(outOrder.getAction()); | 
			
		
	
		
			
				
					|  |  |  |  |                         codeTempEntity.setMainAction(outOrder.getMainAction()); | 
			
		
	
		
			
				
					|  |  |  |  |                         codeTempEntity.setCreateTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |  |                         codeTempEntity.setUpdateTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |  |                         codeTempEntities.add(codeTempEntity); | 
			
		
	
		
			
				
					|  |  |  |  |                 if (StrUtil.isNotEmpty(bussinessTypeEntity.getPreInBackAction())) { | 
			
		
	
		
			
				
					|  |  |  |  |                     if (bussinessTypeEntity.getBackPreinType() == 1) {    //按单退货
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                         String orderIds = bussinessTypeEntity.getCheckPreInOrders(); | 
			
		
	
		
			
				
					|  |  |  |  |                         if (StrUtil.isNotEmpty(orderIds)) { | 
			
		
	
		
			
				
					|  |  |  |  |                             String[] orderIdArray = StringUtils.split(","); | 
			
		
	
		
			
				
					|  |  |  |  |                             List<String> orderList = CollUtil.toList(orderIdArray); | 
			
		
	
		
			
				
					|  |  |  |  |                             List<IoCodeEntity> outCodeEntitys = codeService.findByOrderId(orderEntity.getBillNo()); | 
			
		
	
		
			
				
					|  |  |  |  |                             List<IoCodeEntity> preInCodeEntities = codeService.findByOrderIds(orderList, null); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                             //                            扣减数量
 | 
			
		
	
		
			
				
					|  |  |  |  |                             for (IoCodeEntity preInCodeEntity : preInCodeEntities) { | 
			
		
	
		
			
				
					|  |  |  |  |                                 for (IoCodeEntity codeEntity : outCodeEntitys) { | 
			
		
	
		
			
				
					|  |  |  |  |                                     if (preInCodeEntity.getCode().equals(codeEntity.getCode())) { | 
			
		
	
		
			
				
					|  |  |  |  |                                         int count = preInCodeEntity.getMyCount() - codeEntity.getMyCount(); | 
			
		
	
		
			
				
					|  |  |  |  |                                         int reCount = preInCodeEntity.getMyReCount() - codeEntity.getMyReCount(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                                         if (count > 0) { | 
			
		
	
		
			
				
					|  |  |  |  |                                             preInCodeEntity.setCount(count); | 
			
		
	
		
			
				
					|  |  |  |  |                                             preInCodeEntity.setReCount(reCount); | 
			
		
	
		
			
				
					|  |  |  |  |                                             codeEntity.setCount(0); | 
			
		
	
		
			
				
					|  |  |  |  |                                             codeEntity.setReCount(0); | 
			
		
	
		
			
				
					|  |  |  |  |                                         } else if (count < 0) { | 
			
		
	
		
			
				
					|  |  |  |  |                                             preInCodeEntity.setCount(0); | 
			
		
	
		
			
				
					|  |  |  |  |                                             preInCodeEntity.setReCount(0); | 
			
		
	
		
			
				
					|  |  |  |  |                                             codeEntity.setCount(-count); | 
			
		
	
		
			
				
					|  |  |  |  |                                             codeEntity.setReCount(-reCount); | 
			
		
	
		
			
				
					|  |  |  |  |                                         } else { | 
			
		
	
		
			
				
					|  |  |  |  |                                             preInCodeEntity.setCount(0); | 
			
		
	
		
			
				
					|  |  |  |  |                                             preInCodeEntity.setReCount(0); | 
			
		
	
		
			
				
					|  |  |  |  |                                             codeEntity.setCount(0); | 
			
		
	
		
			
				
					|  |  |  |  |                                             codeEntity.setReCount(0); | 
			
		
	
		
			
				
					|  |  |  |  |                                         } | 
			
		
	
		
			
				
					|  |  |  |  |                                     } | 
			
		
	
		
			
				
					|  |  |  |  |                                 } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                             } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                             List<IoCodeEntity> backCodeList = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |  |                             for (IoCodeEntity codeEntity : preInCodeEntities) { | 
			
		
	
		
			
				
					|  |  |  |  |                                 if (codeEntity.getMyCount() > 0) { | 
			
		
	
		
			
				
					|  |  |  |  |                                     backCodeList.add(codeEntity); | 
			
		
	
		
			
				
					|  |  |  |  |                                 } | 
			
		
	
		
			
				
					|  |  |  |  |                             } | 
			
		
	
		
			
				
					|  |  |  |  |                             genBackOrder(orderEntity, backCodeList); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                     } else {  //按仓库货位退货
 | 
			
		
	
		
			
				
					|  |  |  |  |                         List<IoCodeEntity> backCodeList = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |  |                         List<IoCodeEntity> codeList = codeService.findByOrderId(orderEntity.getBillNo()); | 
			
		
	
		
			
				
					|  |  |  |  |                         for (IoCodeEntity codeEntity : codeList) { | 
			
		
	
		
			
				
					|  |  |  |  |                             int count = invPreinProductDetailService.findCountByCode(codeEntity.getCode()); | 
			
		
	
		
			
				
					|  |  |  |  |                             if (count > 0) { | 
			
		
	
		
			
				
					|  |  |  |  |                                 codeEntity.setCount(count); | 
			
		
	
		
			
				
					|  |  |  |  |                                 codeEntity.setReCount(udiCalCountUtil.getActCount(codeEntity.getNameCode())); | 
			
		
	
		
			
				
					|  |  |  |  |                                 backCodeList.add(codeEntity); | 
			
		
	
		
			
				
					|  |  |  |  |                                 genBackOrder(orderEntity, backCodeList); | 
			
		
	
		
			
				
					|  |  |  |  |                             } | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                     codeTempService.insertBatch(codeTempEntities); | 
			
		
	
		
			
				
					|  |  |  |  |                     addInoutService.dealProcess(outOrder); | 
			
		
	
		
			
				
					|  |  |  |  |                     if (!checkManual(outOrder.getBillNo())) { | 
			
		
	
		
			
				
					|  |  |  |  |                         check(outOrder.getBillNo()); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | //                //找出UDI码对应的预验收入库单号
 | 
			
		
	
		
			
				
					|  |  |  |  | //                Map<String, String> preInOrder = new HashMap<>();
 | 
			
		
	
		
			
				
					|  |  |  |  | //                for (IoCodeEntity warehouseEntity : codeList) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                    List<InvPreinDetailEntity> invProductDetailEntities = invPreinDetailService.findByCode(warehouseEntity.getCode());
 | 
			
		
	
		
			
				
					|  |  |  |  | //                    if (invProductDetailEntities.size() > 0) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                        for (InvPreinDetailEntity invPreinDetailEntity : invProductDetailEntities)
 | 
			
		
	
		
			
				
					|  |  |  |  | //                            preInOrder.put(invPreinDetailEntity.getOrderId(), invPreinDetailEntity.getOrderId());
 | 
			
		
	
		
			
				
					|  |  |  |  | //                    }
 | 
			
		
	
		
			
				
					|  |  |  |  | //                }
 | 
			
		
	
		
			
				
					|  |  |  |  | //                if (preInOrder.size() > 0) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                    String preInBillNo = "";
 | 
			
		
	
		
			
				
					|  |  |  |  | //                    boolean isBreak = false;
 | 
			
		
	
		
			
				
					|  |  |  |  | //
 | 
			
		
	
		
			
				
					|  |  |  |  | //                    for (String key : preInOrder.keySet()) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                        if (!isBreak) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                            preInBillNo = preInBillNo + "," + key;
 | 
			
		
	
		
			
				
					|  |  |  |  | //                            IoOrderEntity preInEntity = orderService.findByBillNo(key);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                            preInEntity.setPreOutBillNo(orderEntity.getBillNo());
 | 
			
		
	
		
			
				
					|  |  |  |  | //                            orderService.update(preInEntity);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                            BasicBussinessTypeEntity preBusType = basicBussinessTypeService.findByAction(preInEntity.getAction());
 | 
			
		
	
		
			
				
					|  |  |  |  | //                            //预验收不删除单号,方便后续查询
 | 
			
		
	
		
			
				
					|  |  |  |  | //                            if (preBusType.isPreInBack()) {            //预验收如果带回,则清空相关预验收库存;
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                invPreinDetailService.deleteByOrderId(preInEntity.getBillNo());
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                //剩余UDI码生成退货单 todo
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                List<IoCodeEntity> codeEntities = codeService.findByOrderId(key);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                backCodeList.addAll(codeEntities);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                            } else {            //预验收如果不带回,则清除已出库相关库存
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                for (IoCodeEntity codeEntity : codeList) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                    if (StrUtil.isEmpty(codeEntity.getSerialNo())) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                        InvPreinDetailEntity invPreinDetailEntity = invPreinDetailService.findByCode(key, codeEntity.getCode());
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                        if (invPreinDetailEntity != null) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                            int count = 0;
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                            if (invPreinDetailEntity.getCount() < codeEntity.getCount()) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                                count = 0;
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                            } else {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                                count = invPreinDetailEntity.getCount() - codeEntity.getCount();
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                            }
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                            if (count >= 0) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                                isBreak = true;
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                                if (count == 0) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                                    invPreinDetailService.deleteByCode(key, codeEntity.getCode());
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                                } else {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                                    invPreinDetailEntity.setCount(count);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                                    invPreinDetailService.update(invPreinDetailEntity);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                                }
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                                int reCount = invPreinDetailEntity.getReCount() - codeEntity.getMyReCount();
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                                if (reCount == 0) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                                    invPreinDetailService.deleteByCode(key, codeEntity.getCode());
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                                } else {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                                    invPreinDetailEntity.setReCount(reCount);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                                    invPreinDetailService.update(invPreinDetailEntity);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                                }
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                            }
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                        }
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                    } else {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                        invPreinDetailService.deleteByCode(key, codeEntity.getCode());
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                    }
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                }
 | 
			
		
	
		
			
				
					|  |  |  |  | //
 | 
			
		
	
		
			
				
					|  |  |  |  | //                            }
 | 
			
		
	
		
			
				
					|  |  |  |  | //                        }
 | 
			
		
	
		
			
				
					|  |  |  |  | //
 | 
			
		
	
		
			
				
					|  |  |  |  | //
 | 
			
		
	
		
			
				
					|  |  |  |  | //                    }
 | 
			
		
	
		
			
				
					|  |  |  |  | //                orderEntity.setPreInBillNo(preInBillNo.substring(1));
 | 
			
		
	
		
			
				
					|  |  |  |  | //                orderService.update(orderEntity);
 | 
			
		
	
		
			
				
					|  |  |  |  | //
 | 
			
		
	
		
			
				
					|  |  |  |  | //
 | 
			
		
	
		
			
				
					|  |  |  |  | //                //生成退货单 1.查出所有关联的单据条码,2.扣减当前出库数量;3.生成单据类型对应绑定的出库单
 | 
			
		
	
		
			
				
					|  |  |  |  | //                if (CollUtil.isNotEmpty(backCodeList)) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                    List<IoCodeEntity> realBackCodeList = new ArrayList<>();
 | 
			
		
	
		
			
				
					|  |  |  |  | //                    for (IoCodeEntity backCodeEntity : backCodeList) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                        for (IoCodeEntity codeEntity : codeList) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                            if (codeEntity.getCount() != 0 && backCodeEntity.getCode().equals(codeEntity.getCode())) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                int count = backCodeEntity.getCount() - codeEntity.getCount();
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                int reCount = backCodeEntity.getReCount() - codeEntity.getReCount();
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                if (count > 0) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                    codeEntity.setCount(0);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                    codeEntity.setReCount(0);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                    backCodeEntity.setCount(count);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                    backCodeEntity.setReCount(reCount);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                    realBackCodeList.add(backCodeEntity);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                } else if (count == 0) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                    codeEntity.setCount(0);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                    codeEntity.setReCount(0);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                } else if (count < 0) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                    codeEntity.setCount(-count);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                    codeEntity.setReCount(-reCount);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                }
 | 
			
		
	
		
			
				
					|  |  |  |  | //                            }
 | 
			
		
	
		
			
				
					|  |  |  |  | //                        }
 | 
			
		
	
		
			
				
					|  |  |  |  | //
 | 
			
		
	
		
			
				
					|  |  |  |  | //                    }
 | 
			
		
	
		
			
				
					|  |  |  |  | //                    if (CollUtil.isNotEmpty(realBackCodeList)) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                        Map<String, List<IoCodeEntity>> backPreInOrder = new HashMap<>();
 | 
			
		
	
		
			
				
					|  |  |  |  | //                        for (IoCodeEntity codeEntity : codeList) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                            List<IoCodeEntity> codeEntities = backPreInOrder.get(codeEntity.getOrderId());
 | 
			
		
	
		
			
				
					|  |  |  |  | //                            if (CollUtil.isEmpty(codeEntities)) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                                codeEntities = new ArrayList<>();
 | 
			
		
	
		
			
				
					|  |  |  |  | //                            }
 | 
			
		
	
		
			
				
					|  |  |  |  | //                            codeEntities.add(codeEntity);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                            backPreInOrder.put(codeEntity.getOrderId(), codeEntities);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                        }
 | 
			
		
	
		
			
				
					|  |  |  |  | //
 | 
			
		
	
		
			
				
					|  |  |  |  | //                        for (String key : backPreInOrder.keySet()) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //                            IoOrderEntity originOrder = orderService.findByBillNo(key);
 | 
			
		
	
		
			
				
					|  |  |  |  | //                            BasicBussinessTypeEntity basicBussinessTypeEntity = basicBussinessTypeService.findByAction(originOrder.getAction());
 | 
			
		
	
		
			
				
					|  |  |  |  | //
 | 
			
		
	
		
			
				
					|  |  |  |  | //                        }
 | 
			
		
	
		
			
				
					|  |  |  |  | //                    }
 | 
			
		
	
		
			
				
					|  |  |  |  | //                }
 | 
			
		
	
		
			
				
					|  |  |  |  | //            }
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             }); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         //校验是否是不入库存单据
 | 
			
		
	
		
			
				
					|  |  |  |  |         if (bussinessTypeEntity.isInStock()) { | 
			
		
	
		
			
				
					|  |  |  |  |             //生成库存
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -931,10 +825,58 @@ public class IoCheckInoutService { | 
			
		
	
		
			
				
					|  |  |  |  |             //不入库存,直接进行单据流转
 | 
			
		
	
		
			
				
					|  |  |  |  |             changeInoutService.changeOrder(orderEntity); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     public void genBackOrder(IoOrderEntity orderEntity, List<IoCodeEntity> backCodeList) { | 
			
		
	
		
			
				
					|  |  |  |  |         if (CollUtil.isEmpty(backCodeList)) | 
			
		
	
		
			
				
					|  |  |  |  |             return; | 
			
		
	
		
			
				
					|  |  |  |  |         BasicBussinessTypeEntity basicBussinessTypeEntity = basicBussinessTypeService.findByAction(orderEntity.getAction()); | 
			
		
	
		
			
				
					|  |  |  |  |         if (StrUtil.isNotEmpty(basicBussinessTypeEntity.getPreInBackAction())) { | 
			
		
	
		
			
				
					|  |  |  |  |             IoOrderEntity outOrder = new IoOrderEntity(); | 
			
		
	
		
			
				
					|  |  |  |  |             outOrder.setId(null); | 
			
		
	
		
			
				
					|  |  |  |  |             outOrder.setMainAction(ConstantType.TYPE_OUT); | 
			
		
	
		
			
				
					|  |  |  |  |             outOrder.setAction(basicBussinessTypeEntity.getAction()); | 
			
		
	
		
			
				
					|  |  |  |  |             outOrder.setCreateTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |  |             outOrder.setFromType(ConstantStatus.FROM_BACK); | 
			
		
	
		
			
				
					|  |  |  |  |             String orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + StrUtil.trimToEmpty(basicBussinessTypeEntity.getPrefix()), "yyyyMMdd")); | 
			
		
	
		
			
				
					|  |  |  |  |             outOrder.setBillNo(orderNo); | 
			
		
	
		
			
				
					|  |  |  |  |             outOrder.setCustomerId(Constant.SYSTEM_CUSTOMER_ID); | 
			
		
	
		
			
				
					|  |  |  |  |             outOrder.setCorpOrderId(CustomUtil.getId() + "x"); | 
			
		
	
		
			
				
					|  |  |  |  |             outOrder.setStatus(ConstantStatus.ORDER_STATUS_PROCESS); | 
			
		
	
		
			
				
					|  |  |  |  |             orderEntity.setUllageSupNo(outOrder.getBillNo()); | 
			
		
	
		
			
				
					|  |  |  |  |             orderEntity.setUpdateTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |  |             orderService.update(orderEntity); | 
			
		
	
		
			
				
					|  |  |  |  |             outOrder.setOriginUllageSupNo(orderEntity.getBillNo()); | 
			
		
	
		
			
				
					|  |  |  |  |             outOrder.setCreateUser(null); | 
			
		
	
		
			
				
					|  |  |  |  |             outOrder.setReviewUser(null); | 
			
		
	
		
			
				
					|  |  |  |  |             orderService.insertOrder(outOrder); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             //生成条码
 | 
			
		
	
		
			
				
					|  |  |  |  |             List<IoCodeTempEntity> codeTempEntities = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |  |             for (IoCodeEntity warehouseEntity : backCodeList) { | 
			
		
	
		
			
				
					|  |  |  |  |                 IoCodeTempEntity codeTempEntity = new IoCodeTempEntity(); | 
			
		
	
		
			
				
					|  |  |  |  |                 BeanUtils.copyProperties(warehouseEntity, codeTempEntity); | 
			
		
	
		
			
				
					|  |  |  |  |                 codeTempEntity.setId(null); | 
			
		
	
		
			
				
					|  |  |  |  |                 codeTempEntity.setOrderId(outOrder.getBillNo()); | 
			
		
	
		
			
				
					|  |  |  |  |                 codeTempEntity.setAction(outOrder.getAction()); | 
			
		
	
		
			
				
					|  |  |  |  |                 codeTempEntity.setMainAction(outOrder.getMainAction()); | 
			
		
	
		
			
				
					|  |  |  |  |                 codeTempEntity.setCreateTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |  |                 codeTempEntity.setUpdateTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |  |                 codeTempEntities.add(codeTempEntity); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |             codeTempService.insertBatch(codeTempEntities); | 
			
		
	
		
			
				
					|  |  |  |  |             addInoutService.dealProcess(outOrder); | 
			
		
	
		
			
				
					|  |  |  |  |             if (!checkManual(outOrder.getBillNo())) { | 
			
		
	
		
			
				
					|  |  |  |  |                 check(outOrder.getBillNo()); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     //   预验收使用出库处理1.不带回扣库存;2.带回时生成退货出库单
 | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     GennerOrderUtils gennerOrderUtils; | 
			
		
	
	
		
			
				
					|  |  |  | 
 |