| | |
| | | import com.ruoyi.inspect.pojo.IfsPartPropsRecord; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * @author 27233 |
| | |
| | | @Mapper |
| | | public interface IfsPartPropsRecordMapper extends BaseMapper<IfsPartPropsRecord> { |
| | | |
| | | Long selectCountByPartNoAndLotBatchNo(@Param("partNo") String partNo, @Param("lotBatchNo") String lotBatchNo); |
| | | } |
| | | |
| | | |
| | |
| | | if(Objects.isNull(ifsPartPropsRecord)){ |
| | | throw new RuntimeException("参数不能为空"); |
| | | } |
| | | //判断是新增还是更新 |
| | | String actionType = Objects.isNull(ifsPartPropsRecord.getId())?"New":"Modify"; |
| | | Map<String, Object> inAttrMap = new HashMap<>(); |
| | | inAttrMap.put("RECORD_ID", UUID.randomUUID().toString()); |
| | | inAttrMap.put("SYSCODE", "LIMS"); |
| | | inAttrMap.put("SYSMODEL", "库存物料批次属性修改"); |
| | | HashMap<String, Object> batchInfoMap = new HashMap<>(); |
| | | batchInfoMap.put("CONTRACT","ZTNS");//域 |
| | | batchInfoMap.put("PART_NO",ifsPartPropsRecord.getPartNo());//零件号 |
| | | batchInfoMap.put("LOT_BATCH_NO",ifsPartPropsRecord.getLotBatchNo());//批次号 |
| | | batchInfoMap.put("ATTR1",ifsPartPropsRecord.getDrumNo());//载具编号 |
| | | batchInfoMap.put("ATTR2",ifsPartPropsRecord.getStartMeterMark().toString());//起始米标 |
| | | batchInfoMap.put("ATTR3",ifsPartPropsRecord.getEndMeterMark().toString());//截止米标 |
| | | batchInfoMap.put("ATTR4", ifsPartPropsRecord.getOuterColor());//外护颜色 |
| | | batchInfoMap.put("ATTR5",ifsPartPropsRecord.getInsulationColor());//绝缘颜色 |
| | | batchInfoMap.put("ATTR8",ifsPartPropsRecord.getLetteringInfo());//印字信息 |
| | | batchInfoMap.put("ATTR23","车间订单");//入库来源 |
| | | batchInfoMap.put("ATTR24","0");//分割预留数量 |
| | | batchInfoMap.put("ACTION_TYPE",actionType);//操作类型 |
| | | inAttrMap.put("BATCH_INFO", Collections.singletonList(batchInfoMap)); |
| | | Result result = ifsApiUtils.importPartLotAttr(JSONUtil.toJsonStr(inAttrMap)); |
| | | if(result.getCode()!=200){ |
| | | throw new RuntimeException("库存物料批次属性更新失败:"+result.getMessage()); |
| | | //查询是否已有同批次同零件号的批次属性,没有才更新 |
| | | Long count = baseMapper.selectCountByPartNoAndLotBatchNo(ifsPartPropsRecord.getPartNo(),ifsPartPropsRecord.getLotBatchNo()); |
| | | if(count==0){ |
| | | //判断是新增还是更新 |
| | | String actionType = Objects.isNull(ifsPartPropsRecord.getId())?"New":"Modify"; |
| | | Map<String, Object> inAttrMap = new HashMap<>(); |
| | | inAttrMap.put("RECORD_ID", UUID.randomUUID().toString()); |
| | | inAttrMap.put("SYSCODE", "LIMS"); |
| | | inAttrMap.put("SYSMODEL", "库存物料批次属性修改"); |
| | | HashMap<String, Object> batchInfoMap = new HashMap<>(); |
| | | batchInfoMap.put("CONTRACT","ZTNS");//域 |
| | | batchInfoMap.put("PART_NO",ifsPartPropsRecord.getPartNo());//零件号 |
| | | batchInfoMap.put("LOT_BATCH_NO",ifsPartPropsRecord.getLotBatchNo());//批次号 |
| | | batchInfoMap.put("ATTR1",ifsPartPropsRecord.getDrumNo());//载具编号 |
| | | batchInfoMap.put("ATTR2",ifsPartPropsRecord.getStartMeterMark().toString());//起始米标 |
| | | batchInfoMap.put("ATTR3",ifsPartPropsRecord.getEndMeterMark().toString());//截止米标 |
| | | batchInfoMap.put("ATTR4", ifsPartPropsRecord.getOuterColor());//外护颜色 |
| | | batchInfoMap.put("ATTR5",ifsPartPropsRecord.getInsulationColor());//绝缘颜色 |
| | | batchInfoMap.put("ATTR8",ifsPartPropsRecord.getLetteringInfo());//印字信息 |
| | | batchInfoMap.put("ATTR23","车间订单");//入库来源 |
| | | batchInfoMap.put("ATTR24","0");//分割预留数量 |
| | | batchInfoMap.put("ACTION_TYPE",actionType);//操作类型 |
| | | inAttrMap.put("BATCH_INFO", Collections.singletonList(batchInfoMap)); |
| | | Result result = ifsApiUtils.importPartLotAttr(JSONUtil.toJsonStr(inAttrMap)); |
| | | if(result.getCode()!=200){ |
| | | throw new RuntimeException("库存物料批次属性更新失败:"+result.getMessage()); |
| | | } |
| | | } |
| | | return this.saveOrUpdate(ifsPartPropsRecord); |
| | | } |
| | |
| | | |
| | | AtomicInteger finalIndex = new AtomicInteger(1); |
| | | List<String> cableTags = insOrderMapper.selectSampleCableTag(insSample.getId()); |
| | | max = cableTags.size(); |
| | | max = Math.max(cableTags.size(),1); |
| | | //处理电缆配置检测项 |
| | | Map<String, List<SampleProductExportDto>> tempMap = new HashMap<>(); |
| | | Map<String, List<SampleProductExportDto>> tempMap2 = new HashMap<>(); |
| | |
| | | tempMap.putAll(listMap); |
| | | sortSampleProduct(tempMap,totalItem); |
| | | int tagNum = Math.min(max,maxCableTag); |
| | | List<String> tagList = cableTags.subList(0,tagNum); |
| | | handlerSampleItems(totalItem,finalIndex,sampleList,tagNum,text,rows,rowRenderData,resultCh,tagList,true); |
| | | List<String> tagList = cableTags.isEmpty()?new ArrayList<>():cableTags.subList(0,tagNum); |
| | | handlerSampleItems(OrderType.WG.getValue(),totalItem,finalIndex,sampleList,tagNum,text,rows,rowRenderData,resultCh,tagList,true); |
| | | |
| | | if(CollectionUtil.isNotEmpty(tempMap2)){ |
| | | sortSampleProduct(tempMap2,cableTagEnclosureItem); |
| | |
| | | List<TextRenderData> newText = new ArrayList<TextRenderData>(); |
| | | List<RowRenderData> newRows = new ArrayList<>(); |
| | | RowRenderData newRowRenderData = null; |
| | | handlerSampleItems(cableTagEnclosureItem,finalIndex2, new ArrayList<>(),newCableTags.size(),newText,newRows,newRowRenderData,resultCh,newCableTags,true); |
| | | handlerSampleItems(OrderType.WG.getValue(),cableTagEnclosureItem,finalIndex2, new ArrayList<>(),newCableTags.size(),newText,newRows,newRowRenderData,resultCh,newCableTags,true); |
| | | tableRenderData2.setRows(newRows); |
| | | tableRenderData2.setTableStyle(setTableStyle(newCableTags.size())); |
| | | HashMap<String, Object> tableMap = new HashMap<>(); |
| | |
| | | |
| | | |
| | | AtomicInteger finalIndex = new AtomicInteger(1); |
| | | handlerSampleItems(item,finalIndex,sampleList,max,text,rows,rowRenderData,resultCh,null,true); |
| | | handlerSampleItems(OrderType.RAW.getValue(), item,finalIndex,sampleList,max,text,rows,rowRenderData,resultCh,null,true); |
| | | tableRenderData.setRows(rows); |
| | | tableRenderData.setTableStyle(setTableStyle(max)); |
| | | |
| | |
| | | * @param rowRenderData |
| | | * @param resultCh |
| | | */ |
| | | private static void handlerSampleItems(Map<String, List<SampleProductExportDto>> item,AtomicInteger finalIndex,List<SampleProductExportDto> sampleList,Integer max,List<TextRenderData> text,List<RowRenderData> rows,RowRenderData rowRenderData,AtomicReference<String> resultCh,List<String> cableTagList,Boolean hasAddHead ){ |
| | | private static void handlerSampleItems(String orderType,Map<String, List<SampleProductExportDto>> item,AtomicInteger finalIndex,List<SampleProductExportDto> sampleList,Integer max,List<TextRenderData> text,List<RowRenderData> rows,RowRenderData rowRenderData,AtomicReference<String> resultCh,List<String> cableTagList,Boolean hasAddHead ){ |
| | | item.forEach((s, sampleProductDtoInside) -> { |
| | | // 添加检验项 |
| | | SampleProductExportDto dto2 = new SampleProductExportDto(); |
| | |
| | | String productName = productDto2.getInspectionItemClass() + productDto2.getInspectionItem() + productDto2.getCableTag(); |
| | | if (map.containsKey(productName)) { |
| | | // 如果名称已经存在,添加 lastValue 值到 lastValueList 列表 |
| | | if(CollectionUtil.isEmpty(map.get(productName).getLastValueList())){ |
| | | if(CollectionUtil.isEmpty(map.get(productName).getLastValueList()) || StringUtils.equals(OrderType.RAW.getValue(),orderType)){ |
| | | map.get(productName) |
| | | .getLastValueList() |
| | | .add(productDto2.getLastValue()); |
| | |
| | | .add(productDto2.getInsResult()); |
| | | } else { |
| | | // 如果名称不存在,直接放入 map |
| | | if(CollectionUtil.isEmpty(productDto2.getLastValueList())){ |
| | | if(CollectionUtil.isEmpty(productDto2.getLastValueList()) || StringUtils.equals(OrderType.RAW.getValue(),orderType)){ |
| | | productDto2.setLastValueList(new ArrayList<>()); // 检验内容 |
| | | productDto2.getLastValueList().add(productDto2.getLastValue()); |
| | | } |
| | |
| | | String productName = productDto2.getInspectionItemClass() + productDto2.getInspectionItem() + productDto2.getInspectionItemSubclass() + productDto2.getCableTag(); |
| | | if (map.containsKey(productName)) { |
| | | // 如果名称已经存在,添加 lastValue 值到 lastValueList 列表 |
| | | if(CollectionUtil.isEmpty(map.get(productName).getLastValueList())){ |
| | | if(CollectionUtil.isEmpty(map.get(productName).getLastValueList()) || StringUtils.equals(OrderType.RAW.getValue(),orderType)){ |
| | | map.get(productName) |
| | | .getLastValueList() |
| | | .add(productDto2.getLastValue()); |
| | |
| | | .add(productDto2.getInsResult()); |
| | | } else { |
| | | // 如果名称不存在,直接放入 map |
| | | if(CollectionUtil.isEmpty(productDto2.getLastValueList())){ |
| | | if(CollectionUtil.isEmpty(productDto2.getLastValueList()) || StringUtils.equals(OrderType.RAW.getValue(),orderType)){ |
| | | productDto2.setLastValueList(new ArrayList<>()); // 检验内容 |
| | | productDto2.getLastValueList().add(productDto2.getLastValue()); |
| | | } |
| | |
| | | start_meter_mark,end_meter_mark,insulation_color, |
| | | outer_color,lettering_info,part_props_flag |
| | | </sql> |
| | | <select id="selectCountByPartNoAndLotBatchNo" resultType="java.lang.Long"> |
| | | select |
| | | COUNT(iiq.id) |
| | | from ifs_inventory_quantity iiq |
| | | left join ifs_part_props_record ippr |
| | | on iiq.id = ippr.ifs_inventory_id |
| | | where iiq.part_no = #{partNo} |
| | | and iiq.update_batch_no= #{lotBatchNo} |
| | | and ippr.id is not null |
| | | </select> |
| | | </mapper> |