|  |  | @ -20,10 +20,13 @@ import com.glxp.api.req.collect.IoSplitDesOrderRequest; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.res.basic.UdiRelevanceResponse; |  |  |  | import com.glxp.api.res.basic.UdiRelevanceResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.res.collect.IoSplitDesOrderResponse; |  |  |  | import com.glxp.api.res.collect.IoSplitDesOrderResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.inout.IoSplitFifoCodeService; |  |  |  | import com.glxp.api.service.inout.IoSplitFifoCodeService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.glxp.api.service.inout.IoSplitFifoInvService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.util.GennerOrderUtils; |  |  |  | import com.glxp.api.util.GennerOrderUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.util.IntUtil; |  |  |  | import com.glxp.api.util.IntUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.util.OrderNoTypeBean; |  |  |  | import com.glxp.api.util.OrderNoTypeBean; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import org.apache.poi.ss.formula.functions.Offset; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.stereotype.Service; |  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import org.springframework.transaction.annotation.Transactional; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.annotation.Resource; |  |  |  | import javax.annotation.Resource; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.Collections; |  |  |  | import java.util.Collections; | 
			
		
	
	
		
		
			
				
					|  |  | @ -135,4 +138,64 @@ public class IoSplitDesOrderService extends ServiceImpl<IoSplitDesOrderMapper, I | 
			
		
	
		
		
			
				
					
					|  |  |  |         ioSplitDesOrderCodeService.save(splitDesOrderCode); |  |  |  |         ioSplitDesOrderCodeService.save(splitDesOrderCode); | 
			
		
	
		
		
			
				
					
					|  |  |  |         return collectOrder; |  |  |  |         return collectOrder; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     IoSplitFifoInvService ioSplitFifoInvService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Transactional(rollbackFor = Exception.class) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public Boolean destroyOut(AddInvDesDetaiRequest addInvDesDetaiRequest) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         IoSplitDesOrder collectOrder; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         collectOrder = IoSplitDesOrder.builder() | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .id(IdUtil.getSnowflakeNextId()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .billNo(gennerOrderUtils.createWdOrderNo(new OrderNoTypeBean(Constant.SPLIT_DES_ORDER, "yyyyMMdd"))) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .busType("1") | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .orderType(1) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .workPlaceCode(addInvDesDetaiRequest.getSplitFifoInv().getWorkPlaceCode()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .createTime(new Date()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .billTime(new Date()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .remark(addInvDesDetaiRequest.getRemark()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .status(1) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .createUser(addInvDesDetaiRequest.getCreateUser()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .updateTime(new Date()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .updateUser(addInvDesDetaiRequest.getUpdateUser()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .build(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         boolean save = save(collectOrder); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if(!save){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return false; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //拿到 产品库存
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         IoSplitFifoInv splitFifoInv = ioSplitFifoInvService.getById(addInvDesDetaiRequest.getSplitFifoInv().getId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //修改产品 库存 出库数量 可用数量 剩余数量
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         splitFifoInv.setOutCount(splitFifoInv.getOutCount() + addInvDesDetaiRequest.getOutCount());//出库数量
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         splitFifoInv.setReCount(splitFifoInv.getInCount() - splitFifoInv.getOutCount());//剩余数量
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         splitFifoInv.setAvailableCount(splitFifoInv.getInCount() - splitFifoInv.getOutCount()-splitFifoInv.getLockCount()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         splitFifoInv.setUpdateTime(new Date()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //更改 库存
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         boolean update = ioSplitFifoInvService.updateById(splitFifoInv); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (!update){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return false; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //        IoSplitFifoInv splitFifoInv = addInvDesDetaiRequest.getSplitFifoInv();
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         IoSplitDesOrderDetail splitDesOrderDetail = IoSplitDesOrderDetail.builder() | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .id(IdUtil.getSnowflakeNextId()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .workPlaceCode(collectOrder.getWorkPlaceCode()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .orderIdFk(collectOrder.getBillNo()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .invId(splitFifoInv.getId()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .relId(splitFifoInv.getRelId()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .batchNo(splitFifoInv.getBatchNo()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .produceDate(splitFifoInv.getProduceDate()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .expireDate(splitFifoInv.getExpireDate()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .supId(splitFifoInv.getSupId()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .count(splitFifoInv.getReCount()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .reCount(splitFifoInv.getReCount()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .createTime(new Date()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .updateTime(new Date()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .remark("").build(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         boolean save1 = splitDesOrderDetailService.save(splitDesOrderDetail); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (!save1){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return false; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return true; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |