| | |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.basic.dto.IfsInventoryQuantityDto; |
| | | import com.ruoyi.basic.dto.InventoryDetailDTO; |
| | | import com.ruoyi.basic.mapper.IfsInventoryQuantityMapper; |
| | | import com.ruoyi.basic.mapper.StandardProductListMapper; |
| | | import com.ruoyi.basic.mapper.StructureItemParameterMapper; |
| | |
| | | import com.ruoyi.common.constant.InsOrderTypeConstants; |
| | | import com.ruoyi.common.core.domain.Result; |
| | | import com.ruoyi.common.core.domain.entity.User; |
| | | import com.ruoyi.common.enums.OrderType; |
| | | import com.ruoyi.common.numgen.NumberGenerator; |
| | | import com.ruoyi.common.utils.*; |
| | | import com.ruoyi.common.utils.api.IfsApiUtils; |
| | |
| | | import com.ruoyi.inspect.service.InsOrderStateService; |
| | | import com.ruoyi.inspect.service.InsProductService; |
| | | import com.ruoyi.inspect.service.InsSampleService; |
| | | import com.ruoyi.inspect.vo.IfsOrderVO; |
| | | import com.ruoyi.inspect.vo.InsOrderPrintingVo; |
| | | import com.ruoyi.system.mapper.UserMapper; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | private SpotCheckQuarterItemMapper spotCheckQuarterItemMapper; |
| | | private StandardProductListMapper standardProductListMapper; |
| | | private StructureItemParameterMapper structureItemParameterMapper; |
| | | |
| | | |
| | | |
| | | //获取检验下单数据 |
| | |
| | | // 判断订单有没有绑定抽样计划 |
| | | InsOrder order = insOrderMapper.selectById(orderId); |
| | | if (order.getQuarterItemId() != null) { |
| | | // 需要添加下发时间到抽样时间, 取样人员就是检测人 |
| | | // 需要添加下发时间到抽样时间, 取样人员就是检测人 |
| | | SpotCheckQuarterItem spotCheckQuarterItem = spotCheckQuarterItemMapper.selectById(order.getQuarterItemId()); |
| | | spotCheckQuarterItem.setSpotCheckTime(order.getSendTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); |
| | | User user = userMapper.selectById(userId); |
| | |
| | | if (insOrder.getQuarterItemId() != null) { |
| | | Long quarterItemCount = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery() |
| | | .eq(InsOrder::getQuarterItemId, insOrder.getQuarterItemId()) |
| | | .notIn(InsOrder::getState, -1 ,2 ,3)); |
| | | .notIn(InsOrder::getState, -1, 2, 3)); |
| | | if (quarterItemCount > 0) { |
| | | throw new ErrorException("该抽样计划已被绑定过"); |
| | | } |
| | |
| | | } |
| | | } |
| | | }); |
| | | //是否为原材料下单 |
| | | if (insOrder.getTypeSource() != null && insOrder.getTypeSource().equals(1)) { |
| | | // 原材料下单: 委托人就是报检人, 生产单位就是供应商单位 |
| | | |
| | | //原材料下单或外购成品下单 |
| | | if (Objects.nonNull(insOrder.getTypeSource()) && Objects.nonNull(insOrder.getIfsInventoryId())) { |
| | | // 委托人就是报检人, 生产单位就是供应商单位 |
| | | IfsInventoryQuantity ifsInventoryQuantity = ifsInventoryQuantityMapper.selectById(insOrder.getIfsInventoryId()); |
| | | Integer declareUserId = ifsInventoryQuantity.getDeclareUserId(); |
| | | User user = userMapper.selectById(declareUserId); |
| | | if (user == null) { |
| | | throw new ErrorException("缺少报检人信息"); |
| | | throw new ErrorException("缺少报检人信息"); |
| | | } |
| | | // 供应商名称 |
| | | insOrder.setProduction(ifsInventoryQuantity.getSupplierName()); |
| | |
| | | upInsOrderOfState(insOrder); |
| | | |
| | | // 分配检验人 |
| | | upInsOrder(insOrder.getId(), null, appointed != null ? appointed.toString() : null, SecurityUtils.getUserId().intValue(), "原材料"); |
| | | String sonLaboratory = insOrder.getTypeSource().equals(1) ? "原材料" : "成品实验室"; |
| | | upInsOrder(insOrder.getId(), null, appointed != null ? appointed.toString() : null, SecurityUtils.getUserId().intValue(), sonLaboratory); |
| | | |
| | | // 根据零件号判断是否是辅材 |
| | | boolean isRaw = false; |
| | | StructureTestObject productObject = insOrderMapper.selectProductByPartNo(ifsInventoryQuantity.getPartNo()); |
| | | // 查询产品 |
| | | if (productObject != null && StrUtil.isNotBlank(productObject.getObjectType()) && productObject.getObjectType().equals("1")) { |
| | | isRaw = true; |
| | | } else { |
| | | // 查询对象 |
| | | StructureTestObject testObject = insOrderMapper.selectByPartNo(ifsInventoryQuantity.getPartNo()); |
| | | if (testObject != null && StrUtil.isNotBlank(testObject.getObjectType()) && testObject.getObjectType().equals("1")) { |
| | | //是否为原材料下单 |
| | | if (insOrder.getTypeSource().equals(1)) { |
| | | // 根据零件号判断是否是辅材 |
| | | boolean isRaw = false; |
| | | StructureTestObject productObject = insOrderMapper.selectProductByPartNo(ifsInventoryQuantity.getPartNo()); |
| | | // 查询产品 |
| | | if (productObject != null && StrUtil.isNotBlank(productObject.getObjectType()) && productObject.getObjectType().equals("1")) { |
| | | isRaw = true; |
| | | } else { |
| | | // 查询对象 |
| | | StructureTestObject testObject = insOrderMapper.selectByPartNo(ifsInventoryQuantity.getPartNo()); |
| | | if (testObject != null && StrUtil.isNotBlank(testObject.getObjectType()) && testObject.getObjectType().equals("1")) { |
| | | isRaw = true; |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (isRaw) { |
| | | // 获取当前季度的开始时间和结束时间 |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // 获取当前月份 |
| | | int month = now.getMonthValue(); |
| | | // 确定当前季度的开始月份 |
| | | int startMonth = (month - 1) / 3 * 3 + 1; |
| | | // 构造季度的开始时间 |
| | | LocalDateTime startOfQuarter = LocalDateTime.of(now.getYear(), Month.of(startMonth), 1, 0, 0); |
| | | // 计算下一个季度的开始时间 |
| | | LocalDateTime startOfNextQuarter = startOfQuarter.plusMonths(3); |
| | | // 计算当前季度的结束时间 |
| | | LocalDateTime endOfQuarter = startOfNextQuarter.minusSeconds(1); |
| | | if (isRaw) { |
| | | // 获取当前季度的开始时间和结束时间 |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // 获取当前月份 |
| | | int month = now.getMonthValue(); |
| | | // 确定当前季度的开始月份 |
| | | int startMonth = (month - 1) / 3 * 3 + 1; |
| | | // 构造季度的开始时间 |
| | | LocalDateTime startOfQuarter = LocalDateTime.of(now.getYear(), Month.of(startMonth), 1, 0, 0); |
| | | // 计算下一个季度的开始时间 |
| | | LocalDateTime startOfNextQuarter = startOfQuarter.plusMonths(3); |
| | | // 计算当前季度的结束时间 |
| | | LocalDateTime endOfQuarter = startOfNextQuarter.minusSeconds(1); |
| | | |
| | | // 根据下单的规格型号判断是否为季度首次出现 |
| | | Integer count = ifsInventoryQuantityMapper.selectIsFirst(insOrder.getPartDetail(), |
| | | ifsInventoryQuantity.getSupplierName(), |
| | | startOfNextQuarter, |
| | | endOfQuarter); |
| | | // 根据下单的规格型号判断是否为季度首次出现 |
| | | Integer count = ifsInventoryQuantityMapper.selectIsFirst(insOrder.getPartDetail(), |
| | | ifsInventoryQuantity.getSupplierName(), |
| | | startOfNextQuarter, |
| | | endOfQuarter); |
| | | |
| | | if(count == 0) { |
| | | ifsInventoryQuantity.setIsFirst(1); |
| | | ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId()) |
| | | .set(IfsInventoryQuantity::getIsFirst, 1)); |
| | | if (count == 0) { |
| | | ifsInventoryQuantity.setIsFirst(1); |
| | | ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | .eq(IfsInventoryQuantity::getId, insOrder.getIfsInventoryId()) |
| | | .set(IfsInventoryQuantity::getIsFirst, 1)); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * 添加检验项 |
| | | * |
| | | * @param sampleId |
| | | * @param productList |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 审核检验单 |
| | | * |
| | | * @param insOrder |
| | | * @return |
| | | */ |
| | |
| | | InsOrder::getEntrustCode); |
| | | // 判断是否是季度检验, 是季度检验取消原材料季度检验下单 |
| | | if (InsOrderTypeConstants.QUARTERLY_TEST.equals(order.getOrderType())) { |
| | | ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | .eq(IfsInventoryQuantity::getId, order.getIfsInventoryId()) |
| | | .set(IfsInventoryQuantity::getIsQuarter, 0)); |
| | | |
| | |
| | | .ne(InsOrder::getState, -1) |
| | | .eq(InsOrder::getOrderType, InsOrderTypeConstants.ENTER_THE_FACTORY)); |
| | | if (order1 != null) { |
| | | no = order1.getEntrustCode(); |
| | | no = order1.getEntrustCode(); |
| | | } |
| | | } |
| | | |
| | |
| | | @Override |
| | | public Map<String, Object> getInsOrderAndSample(Integer id, String laboratory) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | InsOrder insOrder = insOrderMapper.selectById(id); |
| | | // InsOrder insOrder = insOrderMapper.selectById(id); |
| | | IfsOrderVO ifsOrderVO = insOrderMapper.selectOrderInfoById(id); |
| | | List<SampleProductDto> list = insSampleMapper.getInsOrderAndSample(id, laboratory); |
| | | map.put("insOrder", insOrder); |
| | | map.put("insOrder", ifsOrderVO); |
| | | map.put("sampleProduct", list); |
| | | //查询所有记录模版去重 |
| | | List<Map<Integer, Object>> list2 = insOrderMapper.selectReportModelByOrderId(id, laboratory); |
| | |
| | | |
| | | /** |
| | | * 获取ifs库存信息 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | @Override |
| | | public void getIfsOrder(Map<String, Object> map,Boolean isSplitOrder) { |
| | | public void getIfsOrder(Map<String, Object> map, Boolean isSplitOrder) { |
| | | List<Map<String, Object>> inventory = ifsApiUtils.getInventory(JSONUtil.toJsonStr(map)); |
| | | if(inventory.isEmpty()) { |
| | | if (inventory.isEmpty()) { |
| | | return; |
| | | } |
| | | // 进行保存 |
| | |
| | | DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); // 时间格式化 |
| | | IfsInventoryQuantity ifsInventoryQuantity = new IfsInventoryQuantity(); |
| | | ifsInventoryQuantity.setContract(map1.get("CONTRACT") == null ? "" : map1.get("CONTRACT").toString()); // 域 |
| | | ifsInventoryQuantity.setPartNo(map1.get("PART_NO") == null ? "" : map1.get("PART_NO").toString() ); // 零件号 |
| | | ifsInventoryQuantity.setPartNo(map1.get("PART_NO") == null ? "" : map1.get("PART_NO").toString()); // 零件号 |
| | | ifsInventoryQuantity.setPartDesc(map1.get("PART_DESC") == null ? "" : map1.get("PART_DESC").toString()); // 零件描述 |
| | | ifsInventoryQuantity.setOrderNo(map1.get("ORDER_NO") == null ? "" : map1.get("ORDER_NO").toString()); // 订单号 |
| | | ifsInventoryQuantity.setLineNo(map1.get("LINE_NO") == null ? "" : map1.get("LINE_NO").toString()); // 行号 |
| | |
| | | ifsInventoryQuantity.setReceiptNo(Integer.parseInt(map1.get("RECEIPT_NO") == null ? "" : map1.get("RECEIPT_NO").toString())); // 接收号 |
| | | ifsInventoryQuantity.setStatus(map1.get("STATE") == null ? "" : map1.get("STATE").toString()); // 状态描述 |
| | | ifsInventoryQuantity.setStatusDb(map1.get("STATE_DB") == null ? "" : map1.get("STATE_DB").toString()); // 状态 |
| | | if(map1.get("QTY_ARRIVED") != null) { |
| | | if (map1.get("QTY_ARRIVED") != null) { |
| | | ifsInventoryQuantity.setQtyArrived(new BigDecimal(map1.get("QTY_ARRIVED").toString())); // 抵达的采购数量 |
| | | } |
| | | if(map1.get("QTY_INSPECTED") != null) { |
| | | if (map1.get("QTY_INSPECTED") != null) { |
| | | ifsInventoryQuantity.setQtyInspected(new BigDecimal(map1.get("QTY_INSPECTED").toString())); // 已检验的购买数量 |
| | | } |
| | | if(map1.get("QTY_TO_INSPECT") != null) { |
| | | if (map1.get("QTY_TO_INSPECT") != null) { |
| | | ifsInventoryQuantity.setQtyToInspect(new BigDecimal(map1.get("QTY_TO_INSPECT").toString())); // 要检验的采购数量 |
| | | } |
| | | if(map1.get("INV_QTY_IN_STORE") != null) { |
| | | if (map1.get("INV_QTY_IN_STORE") != null) { |
| | | ifsInventoryQuantity.setInvQtyInStore(new BigDecimal(map1.get("INV_QTY_IN_STORE").toString())); // 抵达的库存数量 |
| | | } |
| | | if(map1.get("PUR_QTY_IN_STORE") != null) { |
| | | ifsInventoryQuantity.setPurQtyInStore(new BigDecimal( map1.get("PUR_QTY_IN_STORE").toString())); // 抵达的采购数量 |
| | | if (map1.get("PUR_QTY_IN_STORE") != null) { |
| | | ifsInventoryQuantity.setPurQtyInStore(new BigDecimal(map1.get("PUR_QTY_IN_STORE").toString())); // 抵达的采购数量 |
| | | |
| | | } |
| | | ifsInventoryQuantity.setSupplierId(map1.get("SUPPLIER_ID") == null ? "" : map1.get("SUPPLIER_ID").toString()); // 供应商ID |
| | |
| | | ifsInventoryQuantity.setBuyerCode(map1.get("BUYER_CODE") == null ? "" : map1.get("BUYER_CODE").toString()); // 采购员 |
| | | ifsInventoryQuantity.setBuyerName(map1.get("BUYER_NAME") == null ? "" : map1.get("BUYER_NAME").toString()); // 采购员名称 |
| | | |
| | | if(map1.get("ARRIVE_DATE") != null) { |
| | | ifsInventoryQuantity.setArriveDate(LocalDateTime.parse(map1.get("ARRIVE_DATE").toString(),dateTimeFormatter)); // 实际到货日期 |
| | | if (map1.get("ARRIVE_DATE") != null) { |
| | | ifsInventoryQuantity.setArriveDate(LocalDateTime.parse(map1.get("ARRIVE_DATE").toString(), dateTimeFormatter)); // 实际到货日期 |
| | | } |
| | | if(map1.get("DELIVERY_DATE") != null) { |
| | | ifsInventoryQuantity.setDeliveryDate(LocalDateTime.parse(map1.get("DELIVERY_DATE").toString(),dateTimeFormatter)); // 实际交货日期 |
| | | if (map1.get("DELIVERY_DATE") != null) { |
| | | ifsInventoryQuantity.setDeliveryDate(LocalDateTime.parse(map1.get("DELIVERY_DATE").toString(), dateTimeFormatter)); // 实际交货日期 |
| | | } |
| | | if(map1.get("PRODUCT_DATE") != null) { |
| | | ifsInventoryQuantity.setProductDate(LocalDateTime.parse(map1.get("PRODUCT_DATE").toString(),dateTimeFormatter)); // 生产日期 |
| | | if (map1.get("PRODUCT_DATE") != null) { |
| | | ifsInventoryQuantity.setProductDate(LocalDateTime.parse(map1.get("PRODUCT_DATE").toString(), dateTimeFormatter)); // 生产日期 |
| | | |
| | | } |
| | | if(map1.get("INVALID_DATE") != null) { |
| | | ifsInventoryQuantity.setInvalidDate(LocalDateTime.parse(map1.get("INVALID_DATE").toString(),dateTimeFormatter)); // 失效日期 |
| | | if (map1.get("INVALID_DATE") != null) { |
| | | ifsInventoryQuantity.setInvalidDate(LocalDateTime.parse(map1.get("INVALID_DATE").toString(), dateTimeFormatter)); // 失效日期 |
| | | } |
| | | if(map1.get("APPROVED_DATE") != null) { |
| | | ifsInventoryQuantity.setApprovedDate(LocalDateTime.parse(map1.get("APPROVED_DATE").toString(),dateTimeFormatter)); // 审批日期 |
| | | if (map1.get("APPROVED_DATE") != null) { |
| | | ifsInventoryQuantity.setApprovedDate(LocalDateTime.parse(map1.get("APPROVED_DATE").toString(), dateTimeFormatter)); // 审批日期 |
| | | } |
| | | ifsInventoryQuantity.setReqCeater(map1.get("REQ_CEATER") == null ? "" : map1.get("REQ_CEATER").toString()); // 采购申请创建人 |
| | | ifsInventoryQuantity.setReqCeaterName(map1.get("REQ_CEATER_NAME") == null ? "" : map1.get("REQ_CEATER_NAME").toString()); // 采购申请创建人名称 |
| | |
| | | .eq(IfsInventoryQuantity::getWaivDevRejNo, ifsInventoryQuantity.getWaivDevRejNo()) |
| | | .eq(IfsInventoryQuantity::getActivitySeq, ifsInventoryQuantity.getActivitySeq()) |
| | | ); |
| | | if(count == 0) { |
| | | if (count == 0) { |
| | | ifsInventoryQuantity.setIsFirst(0); |
| | | if(isSplitOrder){ |
| | | if (isSplitOrder) { |
| | | ifsInventoryQuantity.setIsSplitOrder(1); |
| | | } |
| | | //todo:不清楚用途,暂时注释掉 |
| | | // 查询产业链检测数据 |
| | | String industryChainAttrFields = IndustryChainUtils.getIndustryChainAttrFields(ifsInventoryQuantity.getOrderNo(), |
| | | ifsInventoryQuantity.getLineNo(), |
| | | ifsInventoryQuantity.getReleaseNo()); |
| | | ifsInventoryQuantity.setIndustryChain(industryChainAttrFields); |
| | | // String industryChainAttrFields = IndustryChainUtils.getIndustryChainAttrFields(ifsInventoryQuantity.getOrderNo(), |
| | | // ifsInventoryQuantity.getLineNo(), |
| | | // ifsInventoryQuantity.getReleaseNo()); |
| | | // ifsInventoryQuantity.setIndustryChain(industryChainAttrFields); |
| | | |
| | | ifsInventoryQuantityMapper.insert(ifsInventoryQuantity); |
| | | } |
| | |
| | | |
| | | /** |
| | | * id是原材料的id |
| | | * |
| | | * <p> |
| | | * 修改订单单号 |
| | | * |
| | | * @param insOrder |
| | | */ |
| | | @Override |
| | |
| | | List<Integer> insOrderIds = insOrders.stream().map(InsOrder::getId).collect(Collectors.toList()); |
| | | Long count = insReportMapper.selectCount(Wrappers.<InsReport>lambdaQuery() |
| | | .in(InsReport::getInsOrderId, insOrderIds)); |
| | | if (count > 0 ) { |
| | | if (count > 0) { |
| | | throw new ErrorException("当前订单已经生成了报告不能修改编号"); |
| | | } |
| | | |
| | |
| | | |
| | | /** |
| | | * 修改采购订单接收状态, 避免回滚 |
| | | * |
| | | * @param id |
| | | */ |
| | | @Transactional |
| | |
| | | |
| | | /** |
| | | * 新增铜单丝下单 |
| | | * |
| | | * @param list |
| | | * @param insOrder |
| | | * @return |
| | |
| | | |
| | | /** |
| | | * 修改委托下单编号 |
| | | * |
| | | * @param insOrder |
| | | */ |
| | | @Override |
| | |
| | | // 判断当前订单是否生成了报告, 生成了报告不能修改单号 |
| | | Long count = insReportMapper.selectCount(Wrappers.<InsReport>lambdaQuery() |
| | | .eq(InsReport::getInsOrderId, insOrder.getId())); |
| | | if (count > 0 ) { |
| | | if (count > 0) { |
| | | throw new ErrorException("当前订单已经生成了报告不能修改编号"); |
| | | } |
| | | |
| | |
| | | |
| | | /** |
| | | * 修改检验下单内容 |
| | | * |
| | | * @param insOrderUpdateDto |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 成品标签打印 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | |
| | | return insOrderMapper.labelOrderPrinting(ids); |
| | | } |
| | | |
| | | @Override |
| | | public List<InventoryDetailDTO> labelOutsideOrderPrinting(List<Integer> ids) { |
| | | return insOrderMapper.labelOutsideOrderPrinting(ids); |
| | | } |
| | | |
| | | /** |
| | | * 根据样品id查询检验项树 |
| | | * |
| | | * @param insSampleId |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 添加遗漏的检验项 |
| | | * |
| | | * @param omitOrderProductDto |
| | | * @return |
| | | */ |
| | |
| | | |
| | | /** |
| | | * 成品检验单导出 |
| | | * |
| | | * @param sampleOrderDto |
| | | * @param response |
| | | */ |
| | |
| | | |
| | | // 判断是否是不合格, 不合格查询不合格项 |
| | | for (SampleOrderDto orderDto : sampleOrderDtoList) { |
| | | if (orderDto.getInsResult() != null && orderDto.getInsResult() == 0){ |
| | | if (orderDto.getInsResult() != null && orderDto.getInsResult() == 0) { |
| | | // 查询不合格项 |
| | | List<String> unqualifiedList = insProductMapper.selectUnqualifiedList(orderDto.getId()); |
| | | orderDto.setUnqualifiedItem(CollUtil.join(unqualifiedList, ",")); |
| | |
| | | |
| | | /** |
| | | * 修改样品型号 |
| | | * |
| | | * @param insSample |
| | | */ |
| | | @Override |
| | |
| | | // 判断当前订单是否生成了报告, 生成了报告不能修改单号 |
| | | Long count = insReportMapper.selectCount(Wrappers.<InsReport>lambdaQuery() |
| | | .eq(InsReport::getInsOrderId, insSample.getInsOrderId())); |
| | | if (count > 0 ) { |
| | | if (count > 0) { |
| | | throw new ErrorException("当前订单已经生成了报告不能修改编号"); |
| | | } |
| | | |
| | |
| | | |
| | | /** |
| | | * 查询当前时间是否没有该检测项的抽样计划 |
| | | * |
| | | * @param sampleList |
| | | * @param insOrder |
| | | * @return |
| | |
| | | if (insOrder.getQuarterItemId() != null) { |
| | | Long quarterItemCount = insOrderMapper.selectCount(Wrappers.<InsOrder>lambdaQuery() |
| | | .eq(InsOrder::getQuarterItemId, insOrder.getQuarterItemId()) |
| | | .notIn(InsOrder::getState, -1 ,2 ,3)); |
| | | .notIn(InsOrder::getState, -1, 2, 3)); |
| | | if (quarterItemCount > 0) { |
| | | throw new ErrorException("该抽样计划已被绑定过"); |
| | | } |
| | |
| | | |
| | | /** |
| | | * ifs移库操作 |
| | | * |
| | | * @param inventoryQuantity |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class,isolation = Isolation.READ_COMMITTED) |
| | | @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED) |
| | | public String moveRawMaterial(IfsInventoryQuantity inventoryQuantity) { |
| | | //查询ifs订单详情 |
| | | IfsInventoryQuantity one = ifsInventoryQuantityMapper.selectById(inventoryQuantity.getId()); |
| | |
| | | throw new ErrorException("IFS登记采购检验结果失败: " + result.getMessage()); |
| | | } |
| | | //如果是拆分订单,则将同一接收号的订单标记已登记校验 |
| | | if(one.getIsSplitOrder()==1){ |
| | | if (one.getIsSplitOrder() == 1) { |
| | | //查询其余拆分的订单 |
| | | List<IfsInventoryQuantity> quantityList = ifsInventoryQuantityMapper.selectList(Wrappers.<IfsInventoryQuantity>lambdaQuery() |
| | | .eq(IfsInventoryQuantity::getOrderNo, one.getOrderNo()) |
| | |
| | | .eq(IfsInventoryQuantity::getReceiptNo, one.getReceiptNo()) |
| | | .eq(IfsInventoryQuantity::getIsSplitOrder, 1) |
| | | ); |
| | | if(Objects.nonNull(quantityList) && !quantityList.isEmpty()){ |
| | | if (Objects.nonNull(quantityList) && !quantityList.isEmpty()) { |
| | | //修改采购订单登记状态 |
| | | List<Long> ids = quantityList.stream().map(IfsInventoryQuantity::getId).collect(Collectors.toList()); |
| | | ifsInventoryQuantityMapper.update(null,Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | .set(IfsInventoryQuantity::getIsRegister,1) |
| | | ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | .set(IfsInventoryQuantity::getIsRegister, 1) |
| | | .in(IfsInventoryQuantity::getId, ids) |
| | | ); |
| | | } |
| | | }else{ |
| | | } else { |
| | | this.updateIfsInventoryQuantity(one.getId()); |
| | | } |
| | | } |
| | |
| | | * TODO 后续需要调用IFS的接口 移入的库位号 toLocation |
| | | */ |
| | | // 检验后移库 |
| | | toLocation = "1301"; |
| | | //1301:原材料合格库,CP-02-001:成品库 |
| | | toLocation = StringUtils.equals(inventoryQuantity.getOrderType(), OrderType.RAW.getValue()) ? "1301" : "CP-02-001"; |
| | | Map<String, Object> moveResultMap = new HashMap<>(); |
| | | List<Map<String, Object>> moveResultList = new ArrayList<>(); |
| | | Map<String, Object> moveMap = new HashMap<>(); |
| | |
| | | |
| | | /** |
| | | * 先修改采购订单批次号, 后进行移库操作 |
| | | * |
| | | * @param one |
| | | * @param toLocation |
| | | */ |