|  |  |  | @ -9,6 +9,7 @@ import com.glxp.api.common.util.ResultVOUtils; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.controller.BaseController; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.basic.*; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.collect.IoCollectOrder; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.inout.IoCodeTempEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.inout.IoSplitCodeEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.thrsys.BasicInsChdrugEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.req.inout.AddTagCodeReqeust; | 
			
		
	
	
		
			
				
					|  |  |  | @ -20,13 +21,16 @@ import com.glxp.api.res.basic.UdiRelevanceResponse; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.res.inout.IoSplitCodeDetailResponse; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.basic.*; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.collect.IoCollectOrderService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.inout.IoCodeTempService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.inout.IoSplitCodeDetailService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.inout.IoSplitCodeService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.inout.IoSplitFifoCodeService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.inout.impl.IoCodeService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.util.IntUtil; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.util.udi.FilterUdiUtils; | 
			
		
	
		
			
				
					|  |  |  |  | import lombok.extern.slf4j.Slf4j; | 
			
		
	
		
			
				
					|  |  |  |  | import org.apache.commons.lang3.StringUtils; | 
			
		
	
		
			
				
					|  |  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
			
		
	
		
			
				
					|  |  |  |  | import org.springframework.validation.BindingResult; | 
			
		
	
		
			
				
					|  |  |  |  | import org.springframework.web.bind.annotation.GetMapping; | 
			
		
	
		
			
				
					|  |  |  |  | import org.springframework.web.bind.annotation.PostMapping; | 
			
		
	
	
		
			
				
					|  |  |  | @ -58,6 +62,12 @@ public class IoSplitController extends BaseController { | 
			
		
	
		
			
				
					|  |  |  |  |     BasicSkPrescribeService basicSkPrescribeService; | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     BasicSkPrescribeItemCodeService basicSkPrescribeItemCodeService; | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     private IBasicBussinessTypeService basicBussinessTypeService; | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     IoCodeService codeService; | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     private IoCodeTempService codeTempService; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |  |      * 器械拆零按码查询 | 
			
		
	
	
		
			
				
					|  |  |  | @ -207,6 +217,43 @@ public class IoSplitController extends BaseController { | 
			
		
	
		
			
				
					|  |  |  |  |         if (basicSkPrescribeDiEntity == null) | 
			
		
	
		
			
				
					|  |  |  |  |             return ResultVOUtils.error(500, "非此处方单UDI码!"); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         //2-1.校验预验收库存是否已存在
 | 
			
		
	
		
			
				
					|  |  |  |  |         String preInBillNo = addTagCodeReqeust.getPreInBillNo(); | 
			
		
	
		
			
				
					|  |  |  |  |         String orderId = addTagCodeReqeust.getBillNo(); | 
			
		
	
		
			
				
					|  |  |  |  |         if (StrUtil.isNotEmpty(preInBillNo)){ | 
			
		
	
		
			
				
					|  |  |  |  |             BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction("SC74047369831589"); | 
			
		
	
		
			
				
					|  |  |  |  |             if (bussinessTypeEntity.isScanPreIn() && checkDiAttribute(bussinessTypeEntity, udiRelevanceResponse, 2)) { | 
			
		
	
		
			
				
					|  |  |  |  |                 if (bussinessTypeEntity.getBackPreinType() == 1 && bussinessTypeEntity.isPreInBack()) {//按单出库&& bussinessTypeEntity.isPreInBack()
 | 
			
		
	
		
			
				
					|  |  |  |  |                     String orderIds = preInBillNo; | 
			
		
	
		
			
				
					|  |  |  |  |                     if (StrUtil.isNotEmpty(orderIds)) { | 
			
		
	
		
			
				
					|  |  |  |  |                         String[] orderIdArray = orderIds.split(","); | 
			
		
	
		
			
				
					|  |  |  |  |                         List<String> orderList = CollUtil.toList(orderIdArray); | 
			
		
	
		
			
				
					|  |  |  |  |                         int count = codeService.findByOrderIdsCount(orderList, code); | 
			
		
	
		
			
				
					|  |  |  |  |                         if (count <= 0) { | 
			
		
	
		
			
				
					|  |  |  |  |                             return ResultVOUtils.error(500, "非预验收单产品或预验收库存数量不足!"); | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                         if (StrUtil.isNotEmpty(orderId)) {//非首次添加
 | 
			
		
	
		
			
				
					|  |  |  |  |                             if (StrUtil.isEmpty(udiEntity.getSerialNo())) {//该单据已有该产品
 | 
			
		
	
		
			
				
					|  |  |  |  |                                 //无序列号,则可能存在多个预验收入库单
 | 
			
		
	
		
			
				
					|  |  |  |  |                                 IoCodeTempEntity codeTempEntity = codeTempService.findByUnique(orderId, code); | 
			
		
	
		
			
				
					|  |  |  |  |                                 if (codeTempEntity != null) { | 
			
		
	
		
			
				
					|  |  |  |  |                                     if (count < (codeTempEntity.getMyCount() + 1)) { | 
			
		
	
		
			
				
					|  |  |  |  |                                         return ResultVOUtils.error(500, "超出预验收库存数量"); | 
			
		
	
		
			
				
					|  |  |  |  |                                     } | 
			
		
	
		
			
				
					|  |  |  |  |                                 } | 
			
		
	
		
			
				
					|  |  |  |  |                             } else { | 
			
		
	
		
			
				
					|  |  |  |  |                                 if (count < 1) { | 
			
		
	
		
			
				
					|  |  |  |  |                                     return ResultVOUtils.error(500, "预验收库存数量不足"); | 
			
		
	
		
			
				
					|  |  |  |  |                                 } | 
			
		
	
		
			
				
					|  |  |  |  |                             } | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                     } else { | 
			
		
	
		
			
				
					|  |  |  |  |                         return ResultVOUtils.error(500, "未选择预验收入库单,请先选择预验收入库单!"); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         //3.校验该UDI码是否已经出库(是否在预出库队列)
 | 
			
		
	
		
			
				
					|  |  |  |  |         Boolean b1 = splitFifoCodeService.isExitCode(code, basicSkPrescribeEntity.getWorkPlaceCode()); | 
			
		
	
		
			
				
					|  |  |  |  |         if (!b1) { | 
			
		
	
	
		
			
				
					|  |  |  | @ -275,4 +322,18 @@ public class IoSplitController extends BaseController { | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     /** | 
			
		
	
		
			
				
					|  |  |  |  |      * @param purType 1:入账库;2:预验收库;3:寄售库 | 
			
		
	
		
			
				
					|  |  |  |  |      */ | 
			
		
	
		
			
				
					|  |  |  |  |     public boolean checkDiAttribute(BasicBussinessTypeEntity bussinessTypeEntity, UdiRelevanceResponse | 
			
		
	
		
			
				
					|  |  |  |  |             udiRelevanceEntity, Integer purType) { | 
			
		
	
		
			
				
					|  |  |  |  |         if (bussinessTypeEntity.getUseDyCount() == 2) { | 
			
		
	
		
			
				
					|  |  |  |  |             if (IntUtil.value(udiRelevanceEntity.getPurType()) == IntUtil.value(purType)) { | 
			
		
	
		
			
				
					|  |  |  |  |                 return true; | 
			
		
	
		
			
				
					|  |  |  |  |             } else | 
			
		
	
		
			
				
					|  |  |  |  |                 return false; | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         return true; | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
	
		
			
				
					|  |  |  | 
 |