|  |  |  | @ -13,18 +13,12 @@ import com.glxp.api.entity.inout.IoCodeEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.inout.IoCodeTempEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.inout.IoOrderDetailResultEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.inout.IoOrderEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.inv.InvPreinDetailEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.inv.InvPreinOrderEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.inv.InvProductDetailEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.inv.InvProductEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.inv.*; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.system.SystemParamConfigEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.auth.InvWarehouseService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.basic.IBasicBusTypePreService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.basic.IBasicBussinessTypeService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.inv.InvPreinDetailService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.inv.InvPreinOrderService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.inv.InvProductDetailService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.inv.InvProductService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.inv.*; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.system.SystemParamConfigService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.util.CustomUtil; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.util.DateUtil; | 
			
		
	
	
		
			
				
					|  |  |  | @ -127,6 +121,61 @@ public class IoGenInvService { | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     InvPreProductService invPreProductService; | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     InvPreProductDetailService invPreProductDetailService; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     public void genPreInv(String orderId) { | 
			
		
	
		
			
				
					|  |  |  |  |         IoOrderEntity orderEntity = orderService.findByBillNo(orderId); | 
			
		
	
		
			
				
					|  |  |  |  |         List<IoOrderDetailResultEntity> orderDetailResultEntities = orderDetailResultService.findByOrderId(orderId); | 
			
		
	
		
			
				
					|  |  |  |  |         List<IoCodeEntity> codeEnttities = codeService.findByOrderId(orderId); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         //生成库存产品表
 | 
			
		
	
		
			
				
					|  |  |  |  |         for (IoOrderDetailResultEntity orderDetailResultEntity : orderDetailResultEntities) { | 
			
		
	
		
			
				
					|  |  |  |  |             InvPreProductEntity invPreProductEntity = invPreProductService.selectByUnique(orderDetailResultEntity.getBindRlFk(), orderDetailResultEntity.getBatchNo(), orderDetailResultEntity.getSupId(), orderEntity.getDeptCode(), orderEntity.getInvCode()); | 
			
		
	
		
			
				
					|  |  |  |  |             if (invPreProductEntity == null) { | 
			
		
	
		
			
				
					|  |  |  |  |                 invPreProductEntity = new InvPreProductEntity(); | 
			
		
	
		
			
				
					|  |  |  |  |                 invPreProductEntity.setRelIdFk(orderDetailResultEntity.getBindRlFk()); | 
			
		
	
		
			
				
					|  |  |  |  |                 invPreProductEntity.setNameCode(orderDetailResultEntity.getNameCode()); | 
			
		
	
		
			
				
					|  |  |  |  |                 invPreProductEntity.setBatchNo(orderDetailResultEntity.getBatchNo()); | 
			
		
	
		
			
				
					|  |  |  |  |                 invPreProductEntity.setProductionDate(orderDetailResultEntity.getProductDate()); | 
			
		
	
		
			
				
					|  |  |  |  |                 invPreProductEntity.setExpireDate(orderDetailResultEntity.getExpireDate()); | 
			
		
	
		
			
				
					|  |  |  |  |                 invPreProductEntity.setInCount(0); | 
			
		
	
		
			
				
					|  |  |  |  |                 invPreProductEntity.setOutCount(0); | 
			
		
	
		
			
				
					|  |  |  |  |                 invPreProductEntity.setSupId(orderDetailResultEntity.getSupId()); | 
			
		
	
		
			
				
					|  |  |  |  |                 invPreProductEntity.setDeptCode(orderEntity.getDeptCode()); | 
			
		
	
		
			
				
					|  |  |  |  |                 invPreProductEntity.setInvCode(orderEntity.getInvCode()); | 
			
		
	
		
			
				
					|  |  |  |  |                 invPreProductEntity.setCreateTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |  |                 invPreProductEntity.setUpdateTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |  |                 invPreProductService.insert(invPreProductEntity); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             if (orderEntity.getMainAction().equals(ConstantType.TYPE_OUT)) { | 
			
		
	
		
			
				
					|  |  |  |  |                 invPreProductEntity.setOutCount(invPreProductEntity.getOutCount() + orderDetailResultEntity.getReCount()); | 
			
		
	
		
			
				
					|  |  |  |  |             } else if (orderEntity.getMainAction().equals(ConstantType.TYPE_PUT)) { | 
			
		
	
		
			
				
					|  |  |  |  |                 invPreProductEntity.setInCount(invPreProductEntity.getInCount() + orderDetailResultEntity.getReCount()); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |             invPreProductEntity.setReCount(invPreProductEntity.getInCount() - invPreProductEntity.getOutCount()); | 
			
		
	
		
			
				
					|  |  |  |  |             invPreProductEntity.setUpdateTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |  |             invPreProductService.update(invPreProductEntity); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         //生成库存码详情
 | 
			
		
	
		
			
				
					|  |  |  |  |         List<InvPreProductDetailEntity> invProductDetailEntities = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |  |         for (IoCodeEntity codeEntity : codeEnttities) { | 
			
		
	
		
			
				
					|  |  |  |  |             InvPreProductDetailEntity invProductDetailEntity = new InvPreProductDetailEntity(); | 
			
		
	
		
			
				
					|  |  |  |  |             BeanUtils.copyProperties(codeEntity, invProductDetailEntity); | 
			
		
	
		
			
				
					|  |  |  |  |             invProductDetailEntity.setRelId(codeEntity.getRelId()); | 
			
		
	
		
			
				
					|  |  |  |  |             invProductDetailEntity.setUpdateTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |  |             invProductDetailEntity.setPurchaseType(ConstantStatus.PRUCHASE_COMMON); | 
			
		
	
		
			
				
					|  |  |  |  |             invProductDetailEntities.add(invProductDetailEntity); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         invPreProductDetailService.insertList(invProductDetailEntities); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     //生成预验收库存
 | 
			
		
	
		
			
				
					|  |  |  |  |     public void genPreInInv(String orderId) { | 
			
		
	
		
			
				
					|  |  |  |  |         IoOrderEntity orderEntity = orderService.findByBillNo(orderId); | 
			
		
	
	
		
			
				
					|  |  |  | 
 |