|  |  |  | @ -1,24 +1,60 @@ | 
			
		
	
		
			
				
					|  |  |  |  | package com.glxp.api.service.inout.impl; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | import cn.hutool.core.util.StrUtil; | 
			
		
	
		
			
				
					|  |  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
			
		
	
		
			
				
					|  |  |  |  | import com.github.pagehelper.PageHelper; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.common.util.ResultVOUtils; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.constant.Constant; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.constant.ConstantStatus; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.constant.ConstantType; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.auth.AuthAdmin; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.auth.InvWarehouseEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.basic.BasicBussinessTypeEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.inout.*; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.req.basic.FilterUdiRelRequest; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.req.inout.IoOrderMutiRequest; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.res.basic.UdiRelevanceResponse; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.res.inout.IoOrderMutiResponse; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.res.inout.IoOrderMutiSetResponse; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.auth.CustomerService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.auth.InvWarehouseService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.basic.IBasicBussinessTypeService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.basic.UdiRelevanceService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.inout.*; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.util.GennerOrderUtils; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.util.OrderNoTypeBean; | 
			
		
	
		
			
				
					|  |  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
		
			
				
					|  |  |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.inout.IoOrderMutiEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.dao.inout.IoOrderMutiMapper; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.inout.IoOrderMutiService; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | import javax.annotation.Resource; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.Collections; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.Date; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.List; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | @Service | 
			
		
	
		
			
				
					|  |  |  |  | public class IoOrderMutiServiceImpl extends ServiceImpl<IoOrderMutiMapper, IoOrderMutiEntity> implements IoOrderMutiService{ | 
			
		
	
		
			
				
					|  |  |  |  | public class IoOrderMutiServiceImpl extends ServiceImpl<IoOrderMutiMapper, IoOrderMutiEntity> implements IoOrderMutiService { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     private IoOrderMutiMapper ioOrderMutiMapper; | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     private IoOrderService orderService; | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     IoCodeTempService codeTempService; | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     IBasicBussinessTypeService basicBussinessTypeService; | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     InvWarehouseService invWarehouseService; | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     UdiRelevanceService udiRelevanceService; | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     IoOrderDetailCodeService ioOrderDetailCodeService; | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     CustomerService customerService; | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     GennerOrderUtils gennerOrderUtils; | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     private IoOrderMutiSetService ioOrderMutiSetService; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |  |     public List<IoOrderMutiResponse> filterList(IoOrderMutiRequest ioOrderMutiRequest) { | 
			
		
	
	
		
			
				
					|  |  |  | @ -29,7 +65,85 @@ public class IoOrderMutiServiceImpl extends ServiceImpl<IoOrderMutiMapper, IoOrd | 
			
		
	
		
			
				
					|  |  |  |  |             int offset = (ioOrderMutiRequest.getPage() - 1) * ioOrderMutiRequest.getLimit(); | 
			
		
	
		
			
				
					|  |  |  |  |             PageHelper.offsetPage(offset, ioOrderMutiRequest.getLimit()); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         List<IoOrderMutiResponse> ioOrderMutiEntityList=ioOrderMutiMapper.filterList(ioOrderMutiRequest); | 
			
		
	
		
			
				
					|  |  |  |  |         List<IoOrderMutiResponse> ioOrderMutiEntityList = ioOrderMutiMapper.filterList(ioOrderMutiRequest); | 
			
		
	
		
			
				
					|  |  |  |  |         return ioOrderMutiEntityList; | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |  |     public String insterOrder(IoOrderMutiEntity ioOrderMutiEntity, IoOrderMutiSetEntity ioOrderMutiSetEntity) { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         AuthAdmin authAdmin = customerService.getUserBean(); | 
			
		
	
		
			
				
					|  |  |  |  |         IoOrderEntity orderEntity = new IoOrderEntity(); | 
			
		
	
		
			
				
					|  |  |  |  |         BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(ioOrderMutiSetEntity.getTargetAction()); | 
			
		
	
		
			
				
					|  |  |  |  |         InvWarehouseEntity invWarehouseEntity = invWarehouseService.findByInvSubByCode(ioOrderMutiSetEntity.getCurInv()); | 
			
		
	
		
			
				
					|  |  |  |  |         String orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + StrUtil.trimToEmpty(bussinessTypeEntity.getPrefix()), "yyyyMMdd")); | 
			
		
	
		
			
				
					|  |  |  |  |         orderEntity.setBillNo(orderNo); | 
			
		
	
		
			
				
					|  |  |  |  |         orderEntity.setMainAction(ConstantType.TYPE_OUT); | 
			
		
	
		
			
				
					|  |  |  |  |         orderEntity.setCreateUser(authAdmin.getId() + ""); | 
			
		
	
		
			
				
					|  |  |  |  |         orderEntity.setCreateTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |  |         orderEntity.setUpdateUser(authAdmin.getId() + ""); | 
			
		
	
		
			
				
					|  |  |  |  |         orderEntity.setUpdateTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |  |         orderEntity.setCustomerId(authAdmin.getCustomerId() + ""); | 
			
		
	
		
			
				
					|  |  |  |  |         orderEntity.setFromCorp(ioOrderMutiSetEntity.getFromCorp()); | 
			
		
	
		
			
				
					|  |  |  |  |         orderEntity.setAction(bussinessTypeEntity.getAction()); | 
			
		
	
		
			
				
					|  |  |  |  |         orderEntity.setMainAction(bussinessTypeEntity.getMainAction()); | 
			
		
	
		
			
				
					|  |  |  |  |         orderEntity.setDeptCode(invWarehouseEntity.getParentId()); | 
			
		
	
		
			
				
					|  |  |  |  |         orderEntity.setInvCode(invWarehouseEntity.getCode()); | 
			
		
	
		
			
				
					|  |  |  |  |         orderEntity.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE); | 
			
		
	
		
			
				
					|  |  |  |  |         orderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_DRAFT); | 
			
		
	
		
			
				
					|  |  |  |  |         orderEntity.setFromType(ConstantStatus.FROM_Muti); | 
			
		
	
		
			
				
					|  |  |  |  |         orderEntity.setOrderType(ConstantStatus.ORDER_TYPE_NORMAL); | 
			
		
	
		
			
				
					|  |  |  |  |         orderEntity.setBusType(bussinessTypeEntity.getBusType()); | 
			
		
	
		
			
				
					|  |  |  |  |         //插入单据
 | 
			
		
	
		
			
				
					|  |  |  |  |         orderService.insertOrder(orderEntity); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         //插入扫码单
 | 
			
		
	
		
			
				
					|  |  |  |  |         IoOrderDetailCodeEntity ioOrderDetailCodeEntity = new IoOrderDetailCodeEntity(); | 
			
		
	
		
			
				
					|  |  |  |  |         ioOrderDetailCodeEntity.setOrderIdFk(orderNo); | 
			
		
	
		
			
				
					|  |  |  |  |         ioOrderDetailCodeEntity.setBindRlFk(Long.valueOf(ioOrderMutiEntity.getRelIdFk())); | 
			
		
	
		
			
				
					|  |  |  |  |         //查询产品信息
 | 
			
		
	
		
			
				
					|  |  |  |  |         FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest(); | 
			
		
	
		
			
				
					|  |  |  |  |         filterUdiRelRequest.setId(Long.valueOf(ioOrderMutiEntity.getRelIdFk())); | 
			
		
	
		
			
				
					|  |  |  |  |         UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectOneUdi(filterUdiRelRequest); | 
			
		
	
		
			
				
					|  |  |  |  |         if (udiRelevanceResponse != null) { | 
			
		
	
		
			
				
					|  |  |  |  |             ioOrderDetailCodeEntity.setUuidFk(udiRelevanceResponse.getUuid()); | 
			
		
	
		
			
				
					|  |  |  |  |             ioOrderDetailCodeEntity.setNameCode(udiRelevanceResponse.getNameCode()); | 
			
		
	
		
			
				
					|  |  |  |  |             ioOrderDetailCodeEntity.setCoName(udiRelevanceResponse.getCpmctymc()); | 
			
		
	
		
			
				
					|  |  |  |  |             ioOrderDetailCodeEntity.setYlqxzcrbarmc(udiRelevanceResponse.getYlqxzcrbarmc()); | 
			
		
	
		
			
				
					|  |  |  |  |             ioOrderDetailCodeEntity.setManufacturer(udiRelevanceResponse.getManufactory()); | 
			
		
	
		
			
				
					|  |  |  |  |             ioOrderDetailCodeEntity.setMeasname(udiRelevanceResponse.getMeasname()); | 
			
		
	
		
			
				
					|  |  |  |  |             ioOrderDetailCodeEntity.setSpec(udiRelevanceResponse.getGgxh()); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         ioOrderDetailCodeEntity.setBatchNo(ioOrderMutiEntity.getBatchNo()); | 
			
		
	
		
			
				
					|  |  |  |  |         ioOrderDetailCodeEntity.setProductDate(ioOrderMutiEntity.getProduceDate()); | 
			
		
	
		
			
				
					|  |  |  |  |         ioOrderDetailCodeEntity.setExpireDate(ioOrderMutiEntity.getExpireDate()); | 
			
		
	
		
			
				
					|  |  |  |  |         ioOrderDetailCodeEntity.setSupId(ioOrderMutiEntity.getSupId()); | 
			
		
	
		
			
				
					|  |  |  |  |         ioOrderDetailCodeEntity.setCount(ioOrderMutiEntity.getTotalCount()); | 
			
		
	
		
			
				
					|  |  |  |  |         ioOrderDetailCodeEntity.setReCount(ioOrderMutiEntity.getTotalCount()); | 
			
		
	
		
			
				
					|  |  |  |  |         ioOrderDetailCodeEntity.setUpdateTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |  |         ioOrderDetailCodeService.insert(ioOrderDetailCodeEntity); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         IoCodeTempEntity ioCodeTempEntity = new IoCodeTempEntity(); | 
			
		
	
		
			
				
					|  |  |  |  |         ioCodeTempEntity.setCode(ioOrderMutiEntity.getUdiCode()); | 
			
		
	
		
			
				
					|  |  |  |  |         ioCodeTempEntity.setMainAction(ConstantType.TYPE_OUT); | 
			
		
	
		
			
				
					|  |  |  |  |         ioCodeTempEntity.setAction(bussinessTypeEntity.getAction()); | 
			
		
	
		
			
				
					|  |  |  |  |         ioCodeTempEntity.setOrderId(orderNo); | 
			
		
	
		
			
				
					|  |  |  |  |         ioCodeTempEntity.setNameCode(ioOrderMutiEntity.getNameCode()); | 
			
		
	
		
			
				
					|  |  |  |  |         ioCodeTempEntity.setBatchNo(ioOrderMutiEntity.getBatchNo()); | 
			
		
	
		
			
				
					|  |  |  |  |         ioCodeTempEntity.setProduceDate(ioOrderMutiEntity.getProduceDate()); | 
			
		
	
		
			
				
					|  |  |  |  |         ioCodeTempEntity.setExpireDate(ioOrderMutiEntity.getExpireDate()); | 
			
		
	
		
			
				
					|  |  |  |  |         ioCodeTempEntity.setSerialNo(ioOrderMutiEntity.getSerialNo()); | 
			
		
	
		
			
				
					|  |  |  |  |         ioCodeTempEntity.setSupId(ioOrderMutiEntity.getSupId()); | 
			
		
	
		
			
				
					|  |  |  |  |         ioCodeTempEntity.setRelId(Long.valueOf(ioOrderMutiEntity.getRelIdFk())); | 
			
		
	
		
			
				
					|  |  |  |  |         ioCodeTempEntity.setCount(ioOrderMutiEntity.getTotalCount()); | 
			
		
	
		
			
				
					|  |  |  |  |         ioCodeTempEntity.setReCount(ioOrderMutiEntity.getTotalCount()); | 
			
		
	
		
			
				
					|  |  |  |  |         ioCodeTempEntity.setCreateTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |  |         ioCodeTempEntity.setUpdateTime(new Date()); | 
			
		
	
		
			
				
					|  |  |  |  |         ioCodeTempEntity.setDeptCode(invWarehouseEntity.getParentId()); | 
			
		
	
		
			
				
					|  |  |  |  |         ioCodeTempEntity.setInvCode(invWarehouseEntity.getCode()); | 
			
		
	
		
			
				
					|  |  |  |  |         codeTempService.insert(ioCodeTempEntity); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         return orderNo; | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
	
		
			
				
					|  |  |  | 
 |