| | |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.awt.*; |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | } |
| | | } |
| | | |
| | | public Map<String, Object> getSelectPrintingSv(Map<String, Object> object, String printMerge, String printLike, String merge, String flashback, String compound) { |
| | | public Map<String, Object> getSelectPrintingSv(Map<String, Object> object, String printMerge, String printLike, String merge, String flashback, String compound, String landingSequence) { |
| | | if (printMerge == null) { |
| | | printMerge = ""; |
| | | } |
| | |
| | | if (printMerge.equals("") || printMerge.equals("null")) { |
| | | //是否包含切割 |
| | | //boolean containsCutting = flowCard.getProcess().contains("切割"); |
| | | String processSub = flowCard.getProcess().substring(0, 2); |
| | | String processSub = flowCard.getProcess().split("->")[0]; |
| | | //获取工序对应的别称 |
| | | String processName = flowCardMapper.getProcessName(processSub); |
| | | if (processName.equals("stepC") || processName.equals("stepD")) {//工艺是否包含夹胶中空 |
| | | itemmap.put("detail", flowCardMapper.getPrimaryListLimt(flowCard.getProcessId(), |
| | | String.valueOf(compound != null |
| | | ? compound //同架层 |
| | | : flowCard.getTechnologyNumber()),//正常层 |
| | | String.valueOf("null".equals(compound) |
| | | ? flowCard.getTechnologyNumber()//正常层 |
| | | : compound ),//同架层 |
| | | flowCard.getGlassChild(), flowCard.getProcess(), flowCard.getOrderId())); |
| | | |
| | | if (compound == null |
| | | || "null".equals(compound) |
| | | || compound.trim().isEmpty()){ |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailList(flowCard.getProcessId(), flowCard.getTechnologyNumber(), flowCard.getProcess(),flashback); |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailList(flowCard.getProcessId(), flowCard.getTechnologyNumber(), flowCard.getProcess(),flashback,landingSequence); |
| | | itemmap.put("detailList", detailList); |
| | | }else {//有需要同架的层 |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailCompoundList(flowCard.getProcessId(), flowCard.getTechnologyNumber(), flowCard.getProcess(),flashback,compound); |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailCompoundList(flowCard.getProcessId(), flowCard.getTechnologyNumber(), flowCard.getProcess(),flashback,compound,landingSequence); |
| | | itemmap.put("detailList", detailList); |
| | | } |
| | | } else { |
| | |
| | | // 将该 processId 加入已处理集合 |
| | | processedKeys.add(uniqueKey); |
| | | itemmap.put("detail", flowCardMapper.getPrimaryList(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()), flowCard.getGlassChild(), flowCard.getProcess(), flowCard.getOrderId())); |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailListMerge(flowCard.getProcessId(), flowCard.getProcess(),flashback); |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailListMerge(flowCard.getProcessId(), flowCard.getProcess(),flashback,landingSequence); |
| | | itemmap.put("detailList", detailList); |
| | | } else { |
| | | itemmap.put("detail", flowCardMapper.getPrimaryListLimt(flowCard.getProcessId(), |
| | | String.valueOf(flashback != null |
| | | ? compound //同架层 |
| | | : flowCard.getTechnologyNumber()),//正常层 |
| | | String.valueOf("null".equals(compound) |
| | | ? flowCard.getTechnologyNumber()//正常层 |
| | | : compound ),//同架层 |
| | | flowCard.getGlassChild(), flowCard.getProcess(), flowCard.getOrderId())); |
| | | if (compound == null |
| | | || "null".equals(compound) |
| | | || compound.trim().isEmpty()){ |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailListLike(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()), flowCard.getProcess(),flashback); |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailListLike(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()), flowCard.getProcess(),flashback,landingSequence); |
| | | itemmap.put("detailList", detailList); |
| | | }else {//有需要同架的层 |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailListLikeCompound(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()), flowCard.getProcess(),flashback,compound); |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailListLikeCompound(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()), flowCard.getProcess(),flashback,compound,landingSequence); |
| | | itemmap.put("detailList", detailList); |
| | | } |
| | | } |
| | |
| | | if (printLike.equals("") || printLike.equals("null")) { |
| | | itemmap.put("detail", flowCardMapper.getPrimaryListMerge(flowCard.getProcessId(), printMerge, flowCard.getOrderId())); |
| | | |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailList(flowCard.getProcessId(), flowCard.getTechnologyNumber(), flowCard.getProcess(), flashback); |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailList(flowCard.getProcessId(), flowCard.getTechnologyNumber(), flowCard.getProcess(), flashback, landingSequence); |
| | | itemmap.put("detailList", detailList); |
| | | } else { |
| | | itemmap.put("detail", flowCardMapper.getPrimaryList(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()), flowCard.getGlassChild(), flowCard.getProcess(), flowCard.getOrderId())); |
| | | |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailListLike(flowCard.getProcessId(), printMerge, flowCard.getProcess(), flashback); |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailListLike(flowCard.getProcessId(), printMerge, flowCard.getProcess(), flashback, landingSequence); |
| | | itemmap.put("detailList", detailList); |
| | | } |
| | | } |
| | |
| | | return map; |
| | | } |
| | | |
| | | public Map<String, Object> getSelectPrintProject(String printProject, String merge, String flashback) { |
| | | public Map<String, Object> getSelectPrintProject(String printProject, String merge, String flashback, String landingSequence) { |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();//最终结果 |
| | |
| | | if (processName.equals("stepC") || processName.equals("stepD")) {//工艺是否包含夹胶中空 |
| | | itemmap.put("detail", flowCardMapper.getPrimaryListLimt(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()), flowCard.getGlassChild(), flowCard.getProcess(), flowCard.getOrderId())); |
| | | if (flowCard.getPatchState().equals(0)) { |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailList(flowCard.getProcessId(), flowCard.getTechnologyNumber(), flowCard.getProcess(), flashback); |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailList(flowCard.getProcessId(), flowCard.getTechnologyNumber(), flowCard.getProcess(), flashback, landingSequence); |
| | | itemmap.put("detailList", detailList); |
| | | } else { |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailLists(flowCard.getProcessId(), flowCard.getTechnologyNumber(), flowCard.getProcess(), flowCard.getOrderNumber()); |
| | |
| | | processedKeys.add(uniqueKey); |
| | | itemmap.put("detail", flowCardMapper.getPrimaryList(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()), flowCard.getGlassChild(), flowCard.getProcess(), flowCard.getOrderId())); |
| | | |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailListMerge(flowCard.getProcessId(), flowCard.getProcess(), flashback); |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailListMerge(flowCard.getProcessId(), flowCard.getProcess(), flashback, landingSequence); |
| | | itemmap.put("detailList", detailList); |
| | | } else { |
| | | itemmap.put("detail", flowCardMapper.getPrimaryList(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()), flowCard.getGlassChild(), flowCard.getProcess(), flowCard.getOrderId())); |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailListLike(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()), flowCard.getProcess(), flashback); |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailListLike(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()), flowCard.getProcess(), flashback, landingSequence); |
| | | itemmap.put("detailList", detailList); |
| | | } |
| | | |
| | |
| | | List<FlowCard> flowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("composing")), FlowCard.class); |
| | | if (!flowCardList.isEmpty()) { |
| | | for (FlowCard flowCard : flowCardList) { |
| | | flowCardMapper.updateComposing(flowCard.getProcessId()); |
| | | //先获取排版状态 |
| | | Integer layoutStatus = flowCardMapper.getLayoutStatus(flowCard.getProcessId()); |
| | | //2优化占用 |
| | | if (layoutStatus!=2){ |
| | | flowCardMapper.updateComposing(flowCard.getProcessId()); |
| | | } |
| | | else { |
| | | return false; |
| | | } |
| | | |
| | | } |
| | | //保存日志 |
| | | Log log = new Log(); |
| | | log.setContent(object.toString()); |
| | | log.setFunction("FlowCardSv流程卡排版状态"); |
| | | log.setOperatorId((String) object.get("userId")); |
| | | log.setOperator((String) object.get("userName")); |
| | | logService.saveLog(log); |
| | | return true; |
| | | } else { |
| | | return false; |
| | |
| | | |
| | | |
| | | public Map<String, Object> getSelectPrintCustomLabelSv(String type, Integer lableType, Map<String, Object> object) { |
| | | //根据mse传过来的值,如果不存在 赋值false |
| | | String isRepeat = Optional.ofNullable(object.get("isRepeat")) |
| | | .map(Object::toString) |
| | | .orElse("false"); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();//最终结果 |
| | | List<FlowCard> flowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("printList")), FlowCard.class); |
| | |
| | | String processId = flowCard.getProcessId(); |
| | | Integer orderNumber = flowCard.getOrderNumber(); |
| | | String uniqueKey = processId + "|" + orderNumber; // 用特殊字符连接防止冲突 |
| | | // 检查是否已经处理过该 processId,如果处理过则跳过 |
| | | if (processedKeys.contains(uniqueKey)) { |
| | | continue; |
| | | if (isRepeat=="false"){//根据mse传过来的值判断是否去除重复 |
| | | // 检查是否已经处理过该 processId,如果处理过则跳过 |
| | | if (processedKeys.contains(uniqueKey)) { |
| | | continue; |
| | | } |
| | | } |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | itemmap.put("data", flowCardMapper.getPrintCustomData(flowCard.getProcessId(), flowCard.getOrderNumber())); |
| | | list.add(itemmap); |
| | | |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | |
| | | Integer sumQuantity = flowCardMapper.getSumQuantity(flowCard.getOrderId()); |
| | | List<Map<String, Object>> details = flowCardMapper.getPrintCustomData(flowCard.getProcessId(), flowCard.getOrderNumber(), flowCard.getPrintQuantity()); |
| | | |
| | | for (Map<String, Object> detail : details) { |
| | | detail.put("sumQuantity", sumQuantity); |
| | | } |
| | | |
| | | itemmap.put("data", details); |
| | | list.add(itemmap); |
| | | // 将该 processId 加入已处理集合 |
| | | processedKeys.add(uniqueKey); |
| | | } |
| | | } else {//小片标签 |
| | | for (FlowCard flowCard : flowCardList) { |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | itemmap.put("data", flowCardMapper.getPrintCustomDataSemi(flowCard.getProcessId(), flowCard.getTechnologyNumber(), flowCard.getProcess())); |
| | | String orderNumber = ""; |
| | | if (flowCard.getOrderNumber() != null) { |
| | | orderNumber = String.valueOf(flowCard.getOrderNumber()); |
| | | } |
| | | // 判断是否为非空字符串 |
| | | if (orderNumber != null && !orderNumber.trim().isEmpty()) { |
| | | |
| | | itemmap.put("data", flowCardMapper.getPrintCustomDataSemi( |
| | | flowCard.getProcessId(), |
| | | flowCard.getTechnologyNumber(), |
| | | flowCard.getProcess(), |
| | | flowCard.getOrderNumber() |
| | | )); |
| | | } else { |
| | | |
| | | itemmap.put("data", flowCardMapper.getPrintCustomDataSemiTj( |
| | | flowCard.getProcessId(), |
| | | flowCard.getTechnologyNumber(), |
| | | flowCard.getProcess() |
| | | )); |
| | | } |
| | | list.add(itemmap); |
| | | } |
| | | } |
| | |
| | | } else {//小片标签 |
| | | for (FlowCard flowCard : flowCardList) { |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | itemmap.put("data", flowCardMapper.getPrintCustomDataSemi(flowCard.getProcessId(), flowCard.getTechnologyNumber(), flowCard.getProcess())); |
| | | itemmap.put("data", flowCardMapper.getPrintCustomDataSemi(flowCard.getProcessId(), flowCard.getTechnologyNumber(), flowCard.getProcess(), flowCard.getOrderNumber())); |
| | | list.add(itemmap); |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | map.put("data", list); |
| | | map.put("orderOtherMoney", flowCardMapper.selectorderOtherMoney()); |
| | | map.put("type", flowCardMapper.selectType()); |
| | | return map; |
| | | } |
| | | |
| | | public Map<String, Object> getSelectPrintCustomLabelDetailsSv(String type, Integer lableType, Map<String, Object> object) { |
| | | String landingSequence = ""; |
| | | if (object.get("landingSequence") != null) { |
| | | landingSequence = object.get("landingSequence").toString(); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();//最终结果 |
| | | List<FlowCard> flowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("printList")), FlowCard.class); |
| | |
| | | } else {//小片标签 |
| | | for (FlowCard flowCard : flowCardList) { |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | itemmap.put("data", flowCardMapper.getPrintCustomDataSemi(flowCard.getProcessId(), flowCard.getTechnologyNumber(), flowCard.getProcess())); |
| | | itemmap.put("data", flowCardMapper.getPrintCustomDataSemi(flowCard.getProcessId(), flowCard.getTechnologyNumber(), flowCard.getProcess(), flowCard.getOrderNumber())); |
| | | list.add(itemmap); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!"1".equals(landingSequence)) { |
| | | // 构造一个先按短边、再按长边的比较器 |
| | | Comparator<Map<String,Object>> comparator = Comparator |
| | | .comparingDouble((Map<String,Object> m) -> { |
| | | Map<String,Object> first = ((List<Map<String,Object>>)m.get("data")).get(0); |
| | | double w = ((Number) first.get("width")).doubleValue(); |
| | | double h = ((Number) first.get("height")).doubleValue(); |
| | | return Math.min(w, h); |
| | | }) |
| | | .thenComparingDouble(m -> { |
| | | Map<String,Object> first = ((List<Map<String,Object>>)m.get("data")).get(0); |
| | | double w = ((Number) first.get("width")).doubleValue(); |
| | | double h = ((Number) first.get("height")).doubleValue(); |
| | | return Math.max(w, h); |
| | | }); |
| | | |
| | | // 对整个 list 排序,并整体反转,短边大→前,短边相同时长边大→前 |
| | | list.sort(comparator.reversed()); |
| | | } |
| | | map.put("data", list); |
| | | map.put("title", flowCardMapper.getPrintTitle(type)); |
| | |
| | | List<LocalDate> date= (List<LocalDate>) dates.get("date"); |
| | | return flowCardMapper.exportDateProcessMp(date); |
| | | } |
| | | |
| | | public Map<String, Object> selectSortingCardSv(String orderId, String productionId, String flashback, String optionVal, FlowCard flowCard) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", flowCardMapper.selectSortingCardMp(orderId, productionId,flashback,optionVal, flowCard)); |
| | | map.put("maxFlowCard", flowCardMapper.selectMaxFlowCard(orderId, productionId)); |
| | | map.put("orderOtherMoney", flowCardMapper.selectorderOtherMoney()); |
| | | return map; |
| | | } |
| | | } |
| | | |
| | | |