| | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.io.IoUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.ExcelWriter; |
| | | import com.alibaba.excel.support.ExcelTypeEnum; |
| | |
| | | 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.ContractType; |
| | | import com.ruoyi.common.enums.OrderType; |
| | | import com.ruoyi.common.numgen.NumberGenerator; |
| | | import com.ruoyi.common.utils.LimsDateUtil; |
| | |
| | | import com.ruoyi.common.utils.WxCpUtils; |
| | | import com.ruoyi.common.utils.api.IfsApiUtils; |
| | | import com.ruoyi.framework.exception.ErrorException; |
| | | import com.ruoyi.inspect.dto.CopperInsOrderDto; |
| | | import com.ruoyi.inspect.dto.OrderSplitDTO; |
| | | import com.ruoyi.inspect.dto.RawMaterialStandardTreeDto; |
| | | import com.ruoyi.inspect.dto.SampleProductDto; |
| | | import com.ruoyi.inspect.dto.*; |
| | | import com.ruoyi.inspect.excel.OrderSplitExcelData; |
| | | import com.ruoyi.inspect.excel.OrderSplitExcelListener; |
| | | import com.ruoyi.inspect.mapper.InsOrderMapper; |
| | |
| | | private IfsApiUtils ifsApiUtils; |
| | | |
| | | private IfsSplitOrderRecordService ifsSplitOrderRecordService; |
| | | |
| | | private InsUnqualifiedHandlerMapper insUnqualifiedHandlerMapper; |
| | | |
| | | private final NumberGenerator<IfsSplitOrderRecord> splitOrderRecordNumberGenerator; |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public int inspectionReport(List<Long> ids,String orderType) { |
| | | public int inspectionReport(List<Long> ids,String orderType,String materialProp) { |
| | | Integer userId = SecurityUtils.getUserId().intValue(); |
| | | ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | | .in(IfsInventoryQuantity::getId, ids) |
| | |
| | | .set(IfsInventoryQuantity::getDeclareUserId, userId) |
| | | .set(IfsInventoryQuantity::getIsInspect, 1) |
| | | .set(IfsInventoryQuantity::getOrderType,orderType) |
| | | .set(IfsInventoryQuantity::getMaterialProp,materialProp) |
| | | .set(IfsInventoryQuantity::getDeclareDate, LocalDateTime.now()) |
| | | ); |
| | | threadPoolTaskExecutor.execute(() -> { |
| | |
| | | if(!validateValue){ |
| | | throw new ErrorException("报检失败,非法的销售订单分类枚举"); |
| | | } |
| | | validateUpdateBatchNo(ifsInventoryQuantity); |
| | | //批次号字母转大写 |
| | | ifsInventoryQuantity.setUpdateBatchNo(ifsInventoryQuantity.getUpdateBatchNo().toUpperCase(Locale.ROOT)); |
| | | ifsInventoryQuantityMapper.update(null, Wrappers.<IfsInventoryQuantity>lambdaUpdate() |
| | |
| | | .set(IfsInventoryQuantity::getDeclareDate, LocalDateTime.now()) |
| | | .set(IfsInventoryQuantity::getUpdateBatchNo, ifsInventoryQuantity.getUpdateBatchNo()) |
| | | .set(IfsInventoryQuantity::getOrderType,ifsInventoryQuantity.getOrderType()) |
| | | .set(IfsInventoryQuantity::getMaterialProp,ifsInventoryQuantity.getMaterialProp()) |
| | | ); |
| | | |
| | | threadPoolTaskExecutor.execute(() -> { |
| | |
| | | WxCpUtils.informWebHook(wechatProperty.getExaminingUrl(), message); |
| | | }); |
| | | return 1; |
| | | } |
| | | |
| | | /** |
| | | * 校验外购订单报检的批次号是否重复 |
| | | * @param ifsInventoryQuantity |
| | | */ |
| | | public void validateUpdateBatchNo(IfsInventoryQuantity ifsInventoryQuantity){ |
| | | if(StringUtils.equals(ifsInventoryQuantity.getOrderType(),OrderType.WG.getValue())){ |
| | | //查询历史记录 |
| | | Long count = ifsInventoryQuantityMapper.selectCount(Wrappers.<IfsInventoryQuantity>lambdaQuery() |
| | | .eq(IfsInventoryQuantity::getContract,ifsInventoryQuantity.getContract()) |
| | | .eq(IfsInventoryQuantity::getPartNo,ifsInventoryQuantity.getPartNo()) |
| | | .eq(IfsInventoryQuantity::getUpdateBatchNo,ifsInventoryQuantity.getUpdateBatchNo()) |
| | | .eq(IfsInventoryQuantity::getOrderType,OrderType.WG.getValue()) |
| | | .ne(IfsInventoryQuantity::getState,0) |
| | | ); |
| | | if(count>0){ |
| | | throw new RuntimeException("报检失败,零件"+ifsInventoryQuantity.getPartNo()+"所报检的批次号【"+ifsInventoryQuantity.getUpdateBatchNo()+"】已存在!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | if(!OrderType.validateValue(ifsInventoryQuantity.getOrderType())){ |
| | | throw new ErrorException("新增报检信息失败,非法的销售订单分类枚举"); |
| | | } |
| | | validateUpdateBatchNo(ifsInventoryQuantity); |
| | | ifsInventoryQuantityMapper.insert(ifsInventoryQuantity); |
| | | } |
| | | |
| | |
| | | inAttrMap.put("BATCH_INFO", batchInfoData); |
| | | String inAttr = JSONObject.toJSONString(inAttrMap); |
| | | //调用ifs接口 |
| | | Result result = ifsApiUtils.updateMoveReceiptLot(inAttr); |
| | | Result result = ifsApiUtils.updateMoveReceiptLot(ifsInventoryQuantity.getContract(),inAttr); |
| | | if(result.getCode()!=200){ |
| | | throw new RuntimeException("IFS采购接收更改批号请求异常:"+result.getMessage()); |
| | | } |
| | |
| | | } |
| | | //ifs更改批号接口调用成功,拉取新拆分的ifs订单并报检 |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("LOCATION_NO","1302"); |
| | | // map.put("LOCATION_NO","1302"); |
| | | map.put("STATE_DB","To be Inspected"); |
| | | map.put("PART_NO",ifsInventoryQuantity.getPartNo()); |
| | | map.put("ORDER_NO",ifsInventoryQuantity.getOrderNo()); |
| | |
| | | if(Objects.nonNull(splitOrderList) && !splitOrderList.isEmpty()){ |
| | | List<Long> ids = splitOrderList.stream().map(IfsInventoryQuantity::getId).collect(Collectors.toList()); |
| | | ids.add(ifsInventoryQuantity.getId()); |
| | | this.inspectionReport(ids,OrderType.RAW.getValue()); |
| | | this.inspectionReport(ids,OrderType.RAW.getValue(),orderSplitDTO.getMaterialProp()); |
| | | } |
| | | //勾选同步到MES,保存订单拆分记录 |
| | | if(orderSplitDTO.getPushToMes()){ |