| | |
| | | import com.ruoyi.common.utils.api.IfsApiUtils; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.inspect.dto.*; |
| | | import com.ruoyi.inspect.event.InsOrderDeletingEvent; |
| | | import com.ruoyi.inspect.mapper.*; |
| | | import com.ruoyi.inspect.pojo.*; |
| | | import com.ruoyi.inspect.service.InsOrderService; |
| | | import com.ruoyi.inspect.service.InsOrderStateService; |
| | | import com.ruoyi.inspect.service.InsProductService; |
| | | import com.ruoyi.inspect.service.InsSampleService; |
| | | import com.ruoyi.inspect.service.OutsourceOrderFlowService; |
| | | import com.ruoyi.inspect.vo.IfsOrderVO; |
| | | import com.ruoyi.inspect.vo.InsOrderPrintingVo; |
| | | import com.ruoyi.system.mapper.UserMapper; |
| | |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.context.ApplicationEventPublisher; |
| | | import org.springframework.transaction.annotation.Isolation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | private InsUnqualifiedRetestProductMapper insUnqualifiedRetestProductMapper; |
| | | private IfsApiUtils ifsApiUtils; |
| | | private SpotCheckQuarterItemMapper spotCheckQuarterItemMapper; |
| | | private ApplicationEventPublisher applicationEventPublisher; |
| | | private StandardProductListMapper standardProductListMapper; |
| | | private StructureItemParameterMapper structureItemParameterMapper; |
| | | private OutsourceOrderFlowService outsourceOrderFlowService; |
| | | |
| | | |
| | | //获取检验下单数据 |
| | |
| | | throw new ErrorException("该抽样计划已被绑定过"); |
| | | } |
| | | } |
| | | IfsInventoryQuantity ifsInventoryQuantity = null; |
| | | if (insOrder.getIfsInventoryId() != null) { |
| | | ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(insOrder.getIfsInventoryId()); |
| | | if (ifsInventoryQuantity != null) { |
| | | insOrder.setTypeSource(outsourceOrderFlowService.resolveTypeSource( |
| | | ifsInventoryQuantity.getOrderType(), ifsInventoryQuantity.getMaterialProp(), insOrder.getTypeSource())); |
| | | } else if (insOrder.getTypeSource() != null) { |
| | | throw new ErrorException("找不到销售订单信息"); |
| | | } |
| | | } |
| | | insOrder.setState(0); |
| | | |
| | | LocalDate appointed = insOrder.getAppointed(); |
| | |
| | | }); |
| | | |
| | | //原材料下单或外购成品下单 |
| | | if (Objects.nonNull(insOrder.getTypeSource()) && Objects.nonNull(insOrder.getIfsInventoryId())) { |
| | | if (insOrder.getTypeSource() != null && ifsInventoryQuantity != null) { |
| | | // 委托人就是报检人, 生产单位就是供应商单位 |
| | | IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(insOrder.getIfsInventoryId()); |
| | | Integer declareUserId = ifsInventoryQuantity.getDeclareUserId(); |
| | | User user = userMapper.selectById(declareUserId); |
| | | if (user == null) { |
| | |
| | | } |
| | | } |
| | | return insOrder.getId(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean deleteReturnedOrder(Integer insOrderId) { |
| | | InsOrder order = insOrderMapper.selectById(insOrderId); |
| | | if (order == null) { |
| | | throw new ErrorException("成品订单不存在"); |
| | | } |
| | | if (!(Integer.valueOf(2).equals(order.getState()) || Integer.valueOf(3).equals(order.getState()))) { |
| | | throw new ErrorException("只有退回或撤销订单才能删除"); |
| | | } |
| | | Integer operatorId = SecurityUtils.getUserId().intValue(); |
| | | applicationEventPublisher.publishEvent(new InsOrderDeletingEvent(insOrderId, operatorId, LocalDateTime.now())); |
| | | return removeById(insOrderId); |
| | | } |
| | | |
| | | /** |
| | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | // InsOrder insOrder = insOrderMapper.selectById(id); |
| | | IfsOrderVO ifsOrderVO = insOrderMapper.selectOrderInfoById(id); |
| | | // 详情同时返回有效处理流程,供检测页面统一选择布局及校验规则。 |
| | | if (ifsOrderVO != null) { |
| | | ifsOrderVO.setFlowOrderType(ifsOrderVO.getIfsOrderType()); |
| | | if (ifsOrderVO.getIfsInventoryId() != null && outsourceOrderFlowService.isOutsource(ifsOrderVO.getIfsOrderType())) { |
| | | IfsInventoryQuantity quantity = ifsInventoryQuantityMapper.selectById(ifsOrderVO.getIfsInventoryId()); |
| | | if (quantity != null) { |
| | | ifsOrderVO.setFlowOrderType(outsourceOrderFlowService.resolve(quantity.getOrderType(), quantity.getMaterialProp())); |
| | | } |
| | | } |
| | | } |
| | | List<SampleProductDto> list = insSampleMapper.getInsOrderAndSample(id, laboratory); |
| | | map.put("insOrder", ifsOrderVO); |
| | | map.put("sampleProduct", list); |
| | |
| | | public String moveRawMaterial(IfsInventoryQuantity inventoryQuantity) { |
| | | //查询ifs订单详情 |
| | | IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectById(inventoryQuantity.getId()); |
| | | String flowOrderType = outsourceOrderFlowService.isOutsource(one.getOrderType()) |
| | | ? outsourceOrderFlowService.resolve(one.getOrderType(), one.getMaterialProp()) |
| | | : inventoryQuantity.getOrderType(); |
| | | String toLocation; |
| | | // 登记采购检验结果STD |
| | | if (one.getIsRegister().equals(0)) { |
| | |
| | | //1.根据ifs域获取对应库位配置 |
| | | IfsProperties properties = ifsApiUtils.getPropByContract(one.getContract()); |
| | | //2.判断订单类型是否为原材料 |
| | | if(StringUtils.equals(inventoryQuantity.getOrderType(), OrderType.RAW.getValue())){ |
| | | if(StringUtils.equals(flowOrderType, OrderType.RAW.getValue())){ |
| | | toLocation = properties.getRawQualifiedLocation(); |
| | | }else{ |
| | | toLocation = properties.getProductQualifiedLocation(); |