|  |  |  | @ -15,6 +15,7 @@ import com.glxp.api.entity.inout.IoCodeTempEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.inv.InvPreInProductDetailEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.inv.InvPreinDetailEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.inv.InvProductDetailEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.req.inout.CheckPreInInvRequest; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.req.inv.FilterInvPreinDetailRequest; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.req.inv.FilterInvPreinRequest; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.req.inv.FilterInvProductDetailRequest; | 
			
		
	
	
		
			
				
					|  |  |  | @ -24,6 +25,8 @@ import com.glxp.api.res.inv.InvPreinDetailResponse; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.res.inv.InvPreinOrderResponse; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.auth.InvWarehouseService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.basic.IBasicBussinessTypeService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.inout.IoCodeTempService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.inout.impl.IoCodeService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.inv.InvPreProductDetailService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.inv.InvPreinDetailService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.inv.InvPreinOrderService; | 
			
		
	
	
		
			
				
					|  |  |  | @ -84,27 +87,46 @@ public class InvPreinOrderController extends BaseController { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     IoCodeTempService codeTempService; | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     IoCodeService codeService; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @AuthRuleAnnotation("") | 
			
		
	
		
			
				
					|  |  |  |  |     @PostMapping("spms/prein/inv/products/getDetaiByCode") | 
			
		
	
		
			
				
					|  |  |  |  |     public BaseResponse getDetaiByCode(@RequestBody IoCodeTempEntity codeTempEntity) { | 
			
		
	
		
			
				
					|  |  |  |  |     public BaseResponse getDetaiByCode(@RequestBody CheckPreInInvRequest checkPreInInvRequest) { | 
			
		
	
		
			
				
					|  |  |  |  |         InvWarehouseEntity invWarehouseEntity = invWarehouseService.findByOne(ConstantStatus.ACTION_TYPE_PREIN); | 
			
		
	
		
			
				
					|  |  |  |  |         BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(codeTempEntity.getAction()); | 
			
		
	
		
			
				
					|  |  |  |  |         BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(checkPreInInvRequest.getAction()); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         if (bussinessTypeEntity.getBackPreinType() == 1 && bussinessTypeEntity.isPreInBack()) {//按单出库&& bussinessTypeEntity.isPreInBack()
 | 
			
		
	
		
			
				
					|  |  |  |  |             String orderIds = checkPreInInvRequest.getCheckPreInOrders(); | 
			
		
	
		
			
				
					|  |  |  |  |             if (StrUtil.isNotEmpty(orderIds)) { | 
			
		
	
		
			
				
					|  |  |  |  |                 String[] orderIdArray = orderIds.split(","); | 
			
		
	
		
			
				
					|  |  |  |  |                 List<String> orderList = CollUtil.toList(orderIdArray); | 
			
		
	
		
			
				
					|  |  |  |  |                 int count = codeService.findByOrderIdsCount(orderList, checkPreInInvRequest.getCode()); | 
			
		
	
		
			
				
					|  |  |  |  |                 if (count <= 0) { | 
			
		
	
		
			
				
					|  |  |  |  |                     return ResultVOUtils.error(500, "非预验收单产品或预验收库存数量不足!"); | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |             } else { | 
			
		
	
		
			
				
					|  |  |  |  |                 return ResultVOUtils.error(500, "未选择预验收入库单,请先选择预验收入库单!"); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         int count = 0; | 
			
		
	
		
			
				
					|  |  |  |  |         if (bussinessTypeEntity.getSpaceOut() == ConstantStatus.SPACE_OUT_NULL) { | 
			
		
	
		
			
				
					|  |  |  |  |             if (StrUtil.isNotEmpty(codeTempEntity.getSerialNo())) { | 
			
		
	
		
			
				
					|  |  |  |  |                 count = invPreinProductDetailService.vailStockCountByCode(null, invWarehouseEntity.getCode(), null, codeTempEntity.getCode()); | 
			
		
	
		
			
				
					|  |  |  |  |             if (StrUtil.isNotEmpty(checkPreInInvRequest.getSerialNo())) { | 
			
		
	
		
			
				
					|  |  |  |  |                 count = invPreinProductDetailService.vailStockCountByCode(null, invWarehouseEntity.getCode(), null, checkPreInInvRequest.getCode()); | 
			
		
	
		
			
				
					|  |  |  |  |             } else | 
			
		
	
		
			
				
					|  |  |  |  |                 count = invPreinProductDetailService.vailStockCount(codeTempEntity.getRelId(), codeTempEntity.getBatchNo(), codeTempEntity.getSupId(), null, invWarehouseEntity.getCode(), null); | 
			
		
	
		
			
				
					|  |  |  |  |                 count = invPreinProductDetailService.vailStockCount(checkPreInInvRequest.getRelId(), checkPreInInvRequest.getBatchNo(), checkPreInInvRequest.getSupId(), null, invWarehouseEntity.getCode(), null); | 
			
		
	
		
			
				
					|  |  |  |  |         } else if (bussinessTypeEntity.getSpaceOut() == ConstantStatus.SPACE_OUT_SET) { | 
			
		
	
		
			
				
					|  |  |  |  |             if (StrUtil.isNotEmpty(codeTempEntity.getSerialNo())) { | 
			
		
	
		
			
				
					|  |  |  |  |                 count = invPreinProductDetailService.vailStockCountByCode(null, invWarehouseEntity.getCode(), codeTempEntity.getPreInSpaceCode(), codeTempEntity.getCode()); | 
			
		
	
		
			
				
					|  |  |  |  |             if (StrUtil.isNotEmpty(checkPreInInvRequest.getSerialNo())) { | 
			
		
	
		
			
				
					|  |  |  |  |                 count = invPreinProductDetailService.vailStockCountByCode(null, invWarehouseEntity.getCode(), checkPreInInvRequest.getPreInSpaceCode(), checkPreInInvRequest.getCode()); | 
			
		
	
		
			
				
					|  |  |  |  |             } else | 
			
		
	
		
			
				
					|  |  |  |  |                 count = invPreinProductDetailService.vailStockCount(codeTempEntity.getRelId(), codeTempEntity.getBatchNo(), codeTempEntity.getSupId(), null, invWarehouseEntity.getCode(), codeTempEntity.getPreInSpaceCode()); | 
			
		
	
		
			
				
					|  |  |  |  |                 count = invPreinProductDetailService.vailStockCount(checkPreInInvRequest.getRelId(), checkPreInInvRequest.getBatchNo(), checkPreInInvRequest.getSupId(), null, invWarehouseEntity.getCode(), checkPreInInvRequest.getPreInSpaceCode()); | 
			
		
	
		
			
				
					|  |  |  |  |         } else if (bussinessTypeEntity.getSpaceOut() == ConstantStatus.SPACE_OUT_CODE) { | 
			
		
	
		
			
				
					|  |  |  |  |             //按指定货位出库
 | 
			
		
	
		
			
				
					|  |  |  |  |             if (StrUtil.isEmpty(codeTempEntity.getPreSpaceCode())) { | 
			
		
	
		
			
				
					|  |  |  |  |                 List<InvPlaceDetailResponse> invProductDetailEntities = invPreinProductDetailService.findByGroupCode(invWarehouseEntity.getCode(), codeTempEntity.getCode()); | 
			
		
	
		
			
				
					|  |  |  |  |             if (StrUtil.isEmpty(checkPreInInvRequest.getPreSpaceCode())) { | 
			
		
	
		
			
				
					|  |  |  |  |                 List<InvPlaceDetailResponse> invProductDetailEntities = invPreinProductDetailService.findByGroupCode(invWarehouseEntity.getCode(), checkPreInInvRequest.getCode()); | 
			
		
	
		
			
				
					|  |  |  |  |                 if (CollUtil.isNotEmpty(invProductDetailEntities) && invProductDetailEntities.size() > 1) { | 
			
		
	
		
			
				
					|  |  |  |  |                     BaseResponse baseResponse = ResultVOUtils.error(511, "存在多个货位,请指定当前货位!"); | 
			
		
	
		
			
				
					|  |  |  |  |                     baseResponse.setData(invProductDetailEntities); | 
			
		
	
	
		
			
				
					|  |  |  | @ -112,24 +134,24 @@ public class InvPreinOrderController extends BaseController { | 
			
		
	
		
			
				
					|  |  |  |  |                 } else if (invProductDetailEntities.size() == 1) { | 
			
		
	
		
			
				
					|  |  |  |  |                     InvPlaceDetailResponse invPlaceDetailResponse = invProductDetailEntities.get(0); | 
			
		
	
		
			
				
					|  |  |  |  |                     count = invPlaceDetailResponse.getReCount(); | 
			
		
	
		
			
				
					|  |  |  |  |                     codeTempEntity.setPreSpaceCode(invPlaceDetailResponse.getInvSpaceCode()); | 
			
		
	
		
			
				
					|  |  |  |  |                     checkPreInInvRequest.setPreSpaceCode(invPlaceDetailResponse.getInvSpaceCode()); | 
			
		
	
		
			
				
					|  |  |  |  |                 } else { | 
			
		
	
		
			
				
					|  |  |  |  |                     return ResultVOUtils.error(500, "添加失败,该产品未上架货位!"); | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |             } else { | 
			
		
	
		
			
				
					|  |  |  |  |                 if (StrUtil.isNotEmpty(codeTempEntity.getSerialNo())) { | 
			
		
	
		
			
				
					|  |  |  |  |                     count = invPreinProductDetailService.vailStockCountByCode(null, codeTempEntity.getInvCode(), codeTempEntity.getPreInSpaceCode(), codeTempEntity.getCode()); | 
			
		
	
		
			
				
					|  |  |  |  |                 if (StrUtil.isNotEmpty(checkPreInInvRequest.getSerialNo())) { | 
			
		
	
		
			
				
					|  |  |  |  |                     count = invPreinProductDetailService.vailStockCountByCode(null, checkPreInInvRequest.getInvCode(), checkPreInInvRequest.getPreInSpaceCode(), checkPreInInvRequest.getCode()); | 
			
		
	
		
			
				
					|  |  |  |  |                 } else | 
			
		
	
		
			
				
					|  |  |  |  |                     count = invPreinProductDetailService.vailStockCount(codeTempEntity.getRelId(), codeTempEntity.getBatchNo(), codeTempEntity.getSupId(), null, codeTempEntity.getInvCode(), codeTempEntity.getPreInSpaceCode()); | 
			
		
	
		
			
				
					|  |  |  |  |                     count = invPreinProductDetailService.vailStockCount(checkPreInInvRequest.getRelId(), checkPreInInvRequest.getBatchNo(), checkPreInInvRequest.getSupId(), null, checkPreInInvRequest.getInvCode(), checkPreInInvRequest.getPreInSpaceCode()); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         InvPreInProductDetailEntity invPreinDetailEntity = invPreinProductDetailService.findUseOneByCode(codeTempEntity.getCode()); | 
			
		
	
		
			
				
					|  |  |  |  |         InvPreInProductDetailEntity invPreinDetailEntity = invPreinProductDetailService.findUseOneByCode(checkPreInInvRequest.getCode()); | 
			
		
	
		
			
				
					|  |  |  |  |         if (count <= 0) { | 
			
		
	
		
			
				
					|  |  |  |  |             return ResultVOUtils.error(500, "预验收库存数量不足!"); | 
			
		
	
		
			
				
					|  |  |  |  |         } else { | 
			
		
	
		
			
				
					|  |  |  |  |             if (invPreinDetailEntity != null && StrUtil.isNotEmpty(invPreinDetailEntity.getBatchNo()) && StrUtil.isNotEmpty(codeTempEntity.getBatchNo()) | 
			
		
	
		
			
				
					|  |  |  |  |                     && !invPreinDetailEntity.getBatchNo().equals(codeTempEntity.getBatchNo())) { | 
			
		
	
		
			
				
					|  |  |  |  |             if (invPreinDetailEntity != null && StrUtil.isNotEmpty(invPreinDetailEntity.getBatchNo()) && StrUtil.isNotEmpty(checkPreInInvRequest.getBatchNo()) | 
			
		
	
		
			
				
					|  |  |  |  |                     && !invPreinDetailEntity.getBatchNo().equals(checkPreInInvRequest.getBatchNo())) { | 
			
		
	
		
			
				
					|  |  |  |  |                 return ResultVOUtils.error(500, "当前批次号与预验收录入批次号不匹配!"); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
	
		
			
				
					|  |  |  | 
 |