| | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.example.erp.common.Constants; |
| | | import com.example.erp.entity.pp.FlowCard; |
| | | import com.example.erp.entity.sd.OrderGlassDetail; |
| | | import com.example.erp.entity.sd.OrderProcessDetail; |
| | | import com.example.erp.entity.userInfo.Log; |
| | | import com.example.erp.exception.ServiceException; |
| | | import com.example.erp.mapper.pp.FlowCardMapper; |
| | | import com.example.erp.mapper.sd.OrderGlassDetailMapper; |
| | | import com.example.erp.mapper.sd.OrderProcessDetailMapper; |
| | | import com.example.erp.service.userInfo.LogService; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | |
| | | import java.sql.Date; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.example.erp.service.sd.OrderService.getOrderProcessDetails; |
| | | |
| | |
| | | OrderGlassDetailMapper orderGlassDetailMapper; |
| | | final |
| | | OrderProcessDetailMapper orderProcessDetailMapper; |
| | | final |
| | | LogService logService; |
| | | |
| | | public FlowCardService(FlowCardMapper flowCardMapper, OrderGlassDetailMapper orderGlassDetailMapper, OrderProcessDetailMapper orderProcessDetailMapper) { |
| | | public FlowCardService(FlowCardMapper flowCardMapper, OrderGlassDetailMapper orderGlassDetailMapper, OrderProcessDetailMapper orderProcessDetailMapper,LogService logService) { |
| | | this.flowCardMapper = flowCardMapper; |
| | | this.orderGlassDetailMapper = orderGlassDetailMapper; |
| | | this.orderProcessDetailMapper = orderProcessDetailMapper; |
| | | this.logService= logService; |
| | | } |
| | | |
| | | //流程卡管理查询 |
| | |
| | | } |
| | | |
| | | //删除流程卡 |
| | | public Boolean deleteFlowCardSv(String orderId, String processId) { |
| | | public Boolean deleteFlowCardSv(String orderId, String processId, String userId, String userName) { |
| | | if (!orderId.isEmpty() && !processId.isEmpty()) { |
| | | //判断该流程卡是否报工 |
| | | Integer count = flowCardMapper.reportingWorkCount(processId); |
| | |
| | | flowCardMapper.deleteReportingWork(processId); |
| | | //删除分架明细 |
| | | flowCardMapper.deleteFlowCardMp(orderId, processId); |
| | | //删除排序表数据 |
| | | flowCardMapper.deleteflowCardSort(orderId, processId); |
| | | //判断该订单流程卡是否全部删除 |
| | | Integer flowNumber = flowCardMapper.selectFlowCardCount(orderId); |
| | | if (flowNumber == 0) { |
| | |
| | | //修改订单表分架状态为1,删除部分 |
| | | flowCardMapper.updateProcessingCard(orderId, 1); |
| | | } |
| | | |
| | | //保存日志 |
| | | Log log = new Log(); |
| | | log.setContent(orderId+processId); |
| | | log.setFunction("deleteFlowCardSv流程卡删除"); |
| | | log.setOperatorId(userId); |
| | | log.setOperator(userName); |
| | | logService.saveLog(log); |
| | | return true; |
| | | } else { |
| | | return false; |
| | |
| | | public Map<String, Object> selectNoCardSv(String orderId, String productionId, FlowCard flowCard) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", flowCardMapper.selectNoCardMp(orderId, productionId, flowCard)); |
| | | map.put("maxFlowCard", flowCardMapper.selectMaxFlowCard(orderId, productionId)); |
| | | map.put("orderOtherMoney", flowCardMapper.selectorderOtherMoney()); |
| | | return map; |
| | | } |
| | | |
| | |
| | | //赋值订单工艺表 |
| | | orderProcessDetailMapper.insertOrderProcessDetail(orderProcessDetailList); |
| | | } |
| | | |
| | | //保存日志 |
| | | Log log = new Log(); |
| | | log.setContent(object.toString()); |
| | | log.setFunction("addFlowCardSv流程卡新增"); |
| | | log.setOperatorId((String) object.get("userId")); |
| | | log.setOperator((String) object.get("userName")); |
| | | logService.saveLog(log); |
| | | return true; |
| | | } else { |
| | | return false; |
| | |
| | | return map; |
| | | } |
| | | |
| | | public Object selectPrintFlowCardSv(Date selectTime1, Date selectTime2, String orderId, String project, FlowCard flowCard) { |
| | | public Object selectPrintFlowCardSv(Date selectTime1, Date selectTime2, String orderId, String project,String userId, FlowCard flowCard) { |
| | | if ("null".equals(orderId)) { |
| | | orderId = ""; |
| | | } |
| | |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", flowCardMapper.selectPrintFlowCardMp(selectTime1, selectTime2, orderId, project, flowCard)); |
| | | String roleId=flowCardMapper.selectUserMp(userId); |
| | | map.put("user",roleId ); |
| | | return map; |
| | | } |
| | | |
| | |
| | | return map; |
| | | } |
| | | |
| | | public Object selectPrintSv(String orderId, FlowCard flowCard) { |
| | | public Object selectPrintSv(Map<String, Object> object, String inquiryMode) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", flowCardMapper.selectPrintMp(orderId, flowCard)); |
| | | List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();//最终结果 |
| | | List<FlowCard> flowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("printList")), FlowCard.class); |
| | | if (!flowCardList.isEmpty()) { |
| | | for (FlowCard flowCard : flowCardList) { |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | if ("1".equals(inquiryMode)){ |
| | | itemmap.put("detail", flowCardMapper.selectPrintMp(flowCard.getOrderId())); |
| | | } else if ("3".equals(inquiryMode)) { |
| | | itemmap.put("detail", flowCardMapper.selectPrintAllMp(flowCard.getOrderId())); |
| | | } else { |
| | | itemmap.put("detail", flowCardMapper.selectPrintNotMp(flowCard.getOrderId())); |
| | | } |
| | | |
| | | list.add(itemmap); |
| | | } |
| | | } |
| | | map.put("data", list); |
| | | map.put("type", flowCardMapper.selectType()); |
| | | return map; |
| | | } |
| | |
| | | return null; |
| | | } |
| | | } |
| | | public Map<String, Object> getSelectPrintingSv(Map<String, Object> object) { |
| | | public Map<String, Object> getSelectPrintingSv(Map<String, Object> object, String printMerge, String printLike) { |
| | | if (printMerge == null){ |
| | | printMerge= ""; |
| | | } |
| | | if (printLike == null){ |
| | | printLike= ""; |
| | | } |
| | | 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); |
| | |
| | | for (FlowCard flowCard : flowCardList) { |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | //流程卡表头表尾数据 |
| | | itemmap.put("detail", flowCardMapper.getPrimaryList(flowCard.getProcessId(), flowCard.getTechnologyNumber())); |
| | | itemmap.put("numberList", flowCardMapper.getGlassNumber(flowCard.getTechnologyNumber(),flowCard.getProcessId())); |
| | | //是否传入合并层数 |
| | | if (printMerge.equals("")||printMerge.equals("null") ){ |
| | | //是否包含切割 |
| | | //boolean containsCutting = flowCard.getProcess().contains("切割"); |
| | | String processSub=flowCard.getProcess().substring(0, 2); |
| | | if(processSub.equals("夹胶") || processSub.equals("中空")){ |
| | | itemmap.put("detail", flowCardMapper.getPrimaryListLimt(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()),flowCard.getGlassChild(),flowCard.getProcess())); |
| | | |
| | | //流程卡明细数据 |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailList(flowCard.getProcessId(), flowCard.getTechnologyNumber()); |
| | | List<Map<String, Object>> glassList = flowCardMapper.getGlassNumber(flowCard.getTechnologyNumber(),flowCard.getProcessId()); |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailList(flowCard.getProcessId(), flowCard.getTechnologyNumber(),flowCard.getProcess()); |
| | | itemmap.put("detailList", detailList); |
| | | } |
| | | else { |
| | | itemmap.put("detail", flowCardMapper.getPrimaryList(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()),flowCard.getGlassChild(),flowCard.getProcess())); |
| | | |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailListLike(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()),flowCard.getProcess()); |
| | | itemmap.put("detailList", detailList); |
| | | } |
| | | |
| | | } |
| | | else { |
| | | |
| | | //流程卡明细数据 |
| | | if (printLike.equals("")||printLike.equals("null") ){ |
| | | itemmap.put("detail", flowCardMapper.getPrimaryListMerge(flowCard.getProcessId(), printMerge)); |
| | | |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailList(flowCard.getProcessId(), flowCard.getTechnologyNumber(), flowCard.getProcess()); |
| | | itemmap.put("detailList", detailList); |
| | | } |
| | | else { |
| | | itemmap.put("detail", flowCardMapper.getPrimaryList(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()), flowCard.getGlassChild(), flowCard.getProcess())); |
| | | |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailListLike(flowCard.getProcessId(), printMerge, flowCard.getProcess()); |
| | | itemmap.put("detailList", detailList); |
| | | } |
| | | } |
| | | |
| | | //工艺流程 |
| | | List<Map<String, Object>> processList = flowCardMapper.getProcessList(flowCard.getProcessId(), flowCard.getTechnologyNumber()); |
| | | itemmap.put("detailList", detailList); |
| | | //List<Map<String, Object>> processList = flowCardMapper.getProcessList(flowCard.getProcessId(), flowCard.getTechnologyNumber()); |
| | | String input = flowCard.getProcess(); |
| | | String delimiter = "->"; |
| | | |
| | | // 分割字符串 |
| | | String[] parts = input.split(delimiter); |
| | | |
| | | // 创建 List<Map<String, Object>> |
| | | List<Map<String, Object>> processList = new ArrayList<>(); |
| | | |
| | | // 遍历分割后的部分并将其存入 List<Map<String, Object>> |
| | | for (int i = 0; i < parts.length; i++) { |
| | | Map<String, Object> maps = new HashMap<>(); |
| | | maps.put("id", i); // 添加一个索引字段 |
| | | maps.put("process", parts[i]); // 添加实际的值 |
| | | |
| | | processList.add(maps); |
| | | } |
| | | |
| | | itemmap.put("processList", processList); |
| | | // itemmap.put("numberList", numberList); |
| | | itemmap.put("count", flowCardMapper.countFlowCard(flowCard.getOrderId())); |
| | | itemmap.put("remarkList", flowCardMapper.remakList(flowCard.getProcessId())); |
| | | list.add(itemmap); |
| | | |
| | | } |
| | | } |
| | | |
| | | map.put("data", list); |
| | | //初始化值 |
| | | printLike=null; |
| | | return map; |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | public Map<String, Object> getSelectPrintLabelSv(String projectNo) { |
| | | public Map<String, Object> getSelectPrintLabelSv(String projectNo,String type) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", flowCardMapper.getPrintLabel(projectNo)); |
| | | if(Objects.equals(type, "1")){ |
| | | map.put("data", flowCardMapper.getPrintLabel(projectNo)); |
| | | } else if (Objects.equals(type, "2")) { |
| | | map.put("data", flowCardMapper.getPrintLabel2(projectNo)); |
| | | } |
| | | |
| | | return map; |
| | | } |
| | | |
| | |
| | | return map; |
| | | } |
| | | |
| | | public Map<String, Object> printFlowCardDetailsSv(String processId, String technologyNumber, FlowCard flowCard) { |
| | | public Map<String, Object> getSelectPrintLabelDetails(Map<String, Object> object) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", flowCardMapper.printFlowCardDetailsMp(processId, technologyNumber, flowCard)); |
| | | |
| | | List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();//最终结果 |
| | | List<FlowCard> flowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("printList")), FlowCard.class); |
| | | if (!flowCardList.isEmpty()) { |
| | | for (FlowCard flowCard : flowCardList) { |
| | | // Integer count=flowCardMapper.getPrintLabelCount(flowCard.getProcessId(), flowCard.getTechnologyNumber()); |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | // for (int i = 0; i < count; i++) { |
| | | itemmap.put("data", flowCardMapper.getPrintLabelDetail(flowCard)); |
| | | list.add(itemmap); |
| | | //} |
| | | |
| | | } |
| | | } |
| | | map.put("data", list); |
| | | |
| | | return map; |
| | | } |
| | | |
| | | public Map<String, Object> printFlowCardDetailsSv(String processId, String technologyNumber, String process, FlowCard flowCard) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", flowCardMapper.printFlowCardDetailsMp(processId, technologyNumber,process, flowCard)); |
| | | return map; |
| | | } |
| | | |
| | |
| | | List<FlowCard> FlowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("flowCard")), FlowCard.class); |
| | | if (!FlowCardList.isEmpty()) { |
| | | for (FlowCard flowCard : FlowCardList) { |
| | | flowCardMapper.printSortMp(flowCard.getProcessId(),flowCard.getOrderNumber(),flowCard.getTechnologyNumber(),flowCard.getSort()); |
| | | // flowCardMapper.printSortMp(flowCard.getProcessId(),flowCard.getOrderNumber(),flowCard.getTechnologyNumber(),flowCard.getSort()); |
| | | //判断保存的数据是否已存在 |
| | | Integer count = flowCardMapper.printAddSortCountMp(flowCard.getProcessId(),flowCard.getOrderNumber(),flowCard.getTechnologyNumber(),flowCard.getSort(),flowCard.getProcess()); |
| | | if (count >0){ |
| | | flowCardMapper.printUpdateSortMp(flowCard.getProcessId(),flowCard.getOrderNumber(),flowCard.getTechnologyNumber(),flowCard.getSort(),flowCard.getProcess()); |
| | | }else { |
| | | flowCardMapper.printAddSortMp(flowCard.getProcessId(),flowCard.getOrderNumber(),flowCard.getTechnologyNumber(),flowCard.getSort(),flowCard.getProcess()); |
| | | } |
| | | } |
| | | } |
| | | return true; |
| | |
| | | else{ |
| | | for (FlowCard flowCard : flowCardList) { |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | itemmap.put("data", flowCardMapper.getPrintCustomData(flowCard.getProcessId(),flowCard.getTechnologyNumber())); |
| | | itemmap.put("data", flowCardMapper.getPrintCustomDataSemi(flowCard.getProcessId(),flowCard.getTechnologyNumber(),flowCard.getProcess())); |
| | | list.add(itemmap); |
| | | } |
| | | } |
| | |
| | | return map; |
| | | } |
| | | |
| | | public Boolean updatePrintStateSv(Integer printState, Map<String, Object> object) { |
| | | List<FlowCard> flowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("printList")), FlowCard.class); |
| | | if (!flowCardList.isEmpty()) { |
| | | for (FlowCard flowCard : flowCardList) { |
| | | // 更新打印状态 |
| | | flowCardMapper.updatePrintStateMp(printState,flowCard.getProcessId(),flowCard.getTechnologyNumber()); |
| | | } |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | |
| | | } |
| | | |
| | | public Map<String, Object> printFlowCardOrderSortSv(String orderId, FlowCard flowCard) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", flowCardMapper.printFlowCardOrderSortMp(orderId, flowCard)); |
| | | return map; |
| | | } |
| | | |
| | | public Boolean printOrderSort(Map<String, Object> object) { |
| | | List<FlowCard> FlowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("flowCard")), FlowCard.class); |
| | | if (!FlowCardList.isEmpty()) { |
| | | for (FlowCard flowCard : FlowCardList) { |
| | | flowCardMapper.printOrderSortMp(flowCard.getProcessId(),flowCard.getOrderNumber(),flowCard.getTechnologyNumber(),flowCard.getSort()); |
| | | } |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | public Map<String, Object> getSelectPrintingRefundSv(Map<String, Object> object, String printMerge, String printLike, String mergeTechnologyNumber) { |
| | | if (printMerge == null){ |
| | | printMerge= ""; |
| | | } |
| | | if (printLike == null){ |
| | | printLike= ""; |
| | | } |
| | | 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); |
| | | if (!flowCardList.isEmpty()) { |
| | | for (FlowCard flowCard : flowCardList) { |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | //流程卡表头表尾数据 |
| | | //是否传入合并层数 |
| | | if (printMerge.equals("")||printMerge.equals("null") ){ |
| | | itemmap.put("detail", flowCardMapper.getPrimaryListRefund(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()),flowCard.getOrderNumber(),flowCard.getReportingWorkId(),mergeTechnologyNumber,flowCard.getPatchReason())); |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailListRefund(flowCard.getProcessId(), flowCard.getTechnologyNumber(),flowCard.getOrderNumber(),flowCard.getReportingWorkId(),flowCard.getPatchReason()); |
| | | itemmap.put("detailList", detailList); |
| | | } |
| | | else { |
| | | |
| | | //流程卡明细数据 |
| | | if (printLike.equals("")||printLike.equals("null") ){ |
| | | itemmap.put("detail", flowCardMapper.getPrimaryListMergeRefund(flowCard.getProcessId(), printMerge,flowCard.getOrderNumber())); |
| | | |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailListRefund(flowCard.getProcessId(), flowCard.getTechnologyNumber(),flowCard.getOrderNumber(), flowCard.getReportingWorkId(), flowCard.getPatchReason()); |
| | | itemmap.put("detailList", detailList); |
| | | } |
| | | else { |
| | | itemmap.put("detail", flowCardMapper.getPrimaryListRefund(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()),flowCard.getOrderNumber(), flowCard.getReportingWorkId(), mergeTechnologyNumber, flowCard.getPatchReason())); |
| | | |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailListLikeRefund(flowCard.getProcessId(), printMerge,flowCard.getOrderNumber(),flowCard.getReportingWorkId()); |
| | | itemmap.put("detailList", detailList); |
| | | } |
| | | } |
| | | |
| | | //工艺流程 |
| | | List<Map<String, Object>> processList = flowCardMapper.getProcessList(flowCard.getProcessId(), flowCard.getTechnologyNumber()); |
| | | |
| | | itemmap.put("processList", processList); |
| | | // itemmap.put("numberList", numberList); |
| | | list.add(itemmap); |
| | | |
| | | } |
| | | } |
| | | map.put("data", list); |
| | | //初始化值 |
| | | printLike=null; |
| | | return map; |
| | | } |
| | | |
| | | public Map<String, Object> getSelectPrinReworkSv(Map<String, Object> object, String printMerge, String printLike) { |
| | | if (printMerge == null){ |
| | | printMerge= ""; |
| | | } |
| | | if (printLike == null){ |
| | | printLike= ""; |
| | | } |
| | | 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); |
| | | if (!flowCardList.isEmpty()) { |
| | | for (FlowCard flowCard : flowCardList) { |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | //流程卡表头表尾数据 |
| | | //是否传入合并层数 |
| | | if (printMerge.equals("")||printMerge.equals("null") ){ |
| | | itemmap.put("detail", flowCardMapper.getPrimaryListRework(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()),flowCard.getOrderNumber(),flowCard.getReportingWorkId())); |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailListRework(flowCard.getProcessId(), flowCard.getTechnologyNumber(),flowCard.getOrderNumber(),flowCard.getReportingWorkId()); |
| | | itemmap.put("detailList", detailList); |
| | | } |
| | | else { |
| | | |
| | | //流程卡明细数据 |
| | | if (printLike.equals("")||printLike.equals("null") ){ |
| | | itemmap.put("detail", flowCardMapper.getPrimaryListMergeRework(flowCard.getProcessId(), printMerge,flowCard.getOrderNumber())); |
| | | |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailListRework(flowCard.getProcessId(), flowCard.getTechnologyNumber(),flowCard.getOrderNumber(), flowCard.getReportingWorkId()); |
| | | itemmap.put("detailList", detailList); |
| | | } |
| | | else { |
| | | itemmap.put("detail", flowCardMapper.getPrimaryListRework(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()),flowCard.getOrderNumber(), flowCard.getReportingWorkId())); |
| | | |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailListLikeRework(flowCard.getProcessId(), printMerge,flowCard.getOrderNumber(),flowCard.getReportingWorkId()); |
| | | itemmap.put("detailList", detailList); |
| | | } |
| | | } |
| | | |
| | | //工艺流程 |
| | | List<Map<String, Object>> processList = flowCardMapper.getProcessList(flowCard.getProcessId(), flowCard.getTechnologyNumber()); |
| | | |
| | | itemmap.put("processList", processList); |
| | | // itemmap.put("numberList", numberList); |
| | | list.add(itemmap); |
| | | |
| | | } |
| | | } |
| | | map.put("data", list); |
| | | //初始化值 |
| | | printLike=null; |
| | | return map; |
| | | } |
| | | |
| | | public Object selectPrintDetailsSv(Map<String, Object> object, String inquiryMode,Integer type) { |
| | | 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); |
| | | if (!flowCardList.isEmpty()) { |
| | | for (FlowCard flowCard : flowCardList) { |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | if(type==1){ |
| | | itemmap.put("detail", flowCardMapper.selectPrintDetailsMp(flowCard.getOrderId())); |
| | | }else if(type==2){ |
| | | itemmap.put("detail", flowCardMapper.selectPrintDetailsMp1(flowCard.getOrderId())); |
| | | } |
| | | |
| | | list.add(itemmap); |
| | | } |
| | | } |
| | | map.put("data", list); |
| | | map.put("type", flowCardMapper.selectType()); |
| | | return map; |
| | | } |
| | | |
| | | public Map<String, Object> getSelectPrintCustomLabelDetailsSv(String type, Integer lableType, Map<String, Object> object) { |
| | | 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); |
| | | if (!flowCardList.isEmpty()) { |
| | | Set<String> processedProcessIds = new HashSet<>(); // 用来存放已处理过的 processId |
| | | |
| | | if (lableType != 2){ |
| | | for (FlowCard flowCard : flowCardList) { |
| | | String processId = flowCard.getProcessId(); |
| | | String orderNumber = flowCard.getOrderNumber().toString(); |
| | | |
| | | // 检查是否已经处理过该 processId,如果处理过则跳过 |
| | | if (processedProcessIds.contains(processId)&&processedProcessIds.contains(orderNumber)) { |
| | | continue; |
| | | } |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | itemmap.put("data", flowCardMapper.getPrintCustomDataDetails(flowCard.getProcessId(),flowCard.getOrderNumber())); |
| | | list.add(itemmap); |
| | | |
| | | // 将该 processId 加入已处理集合 |
| | | processedProcessIds.add(processId); |
| | | processedProcessIds.add(orderNumber); |
| | | } |
| | | } |
| | | else{ |
| | | for (FlowCard flowCard : flowCardList) { |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | itemmap.put("data", flowCardMapper.getPrintCustomDataSemi(flowCard.getProcessId(),flowCard.getTechnologyNumber(),flowCard.getProcess())); |
| | | list.add(itemmap); |
| | | } |
| | | } |
| | | } |
| | | map.put("data", list); |
| | | map.put("title", flowCardMapper.getPrintTitle(type)); |
| | | return map; |
| | | } |
| | | |
| | | public Map<String, Object> getPrintCustomDataProjectNo(String type, String projectNo) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", flowCardMapper.getPrintCustomDataProjectNo(projectNo)); |
| | | map.put("title", flowCardMapper.getPrintTitle(type)); |
| | | return map; |
| | | } |
| | | |
| | | public Object selectSortTableSv(Map<String, Object> object) { |
| | | 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); |
| | | if (!flowCardList.isEmpty()) { |
| | | for (FlowCard flowCard : flowCardList) { |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | itemmap.put("data", flowCardMapper.selectSortTableMp(flowCard.getOrderId())); |
| | | list.add(itemmap); |
| | | |
| | | } |
| | | } |
| | | map.put("data", list); |
| | | |
| | | return map; |
| | | |
| | | |
| | | } |
| | | |
| | | public String mergeFlowCard(Map<String, Object> object) { |
| | | String returns= "false"; |
| | | List<FlowCard> flowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("flowCard")), FlowCard.class); |
| | | if (!flowCardList.isEmpty()) { |
| | | List<Map<String, Object>> flowCardList1=flowCardMapper.selectFlowCardMerge(flowCardList.get(0).getProcessId()); |
| | | int index=1; |
| | | for(int i = 0;i < flowCardList1.size();i++){ |
| | | if(Integer.valueOf(flowCardList1.get(i).get("count2").toString())>1){ |
| | | List<Integer> technologyNumber = Arrays.stream(flowCardList1.get(i).get("count1").toString().split(",")) |
| | | .map(Integer::parseInt) |
| | | .collect(Collectors.toList()); |
| | | flowCardMapper.updateFlowCardMerge(flowCardList.get(0).getProcessId(),technologyNumber,index); |
| | | index+=1; |
| | | returns="true"; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | return returns; |
| | | |
| | | |
| | | } |
| | | |
| | | public List<FlowCard> getProcessCard(Map<String, String> processCards) { |
| | | String processCard = processCards.get("processCard"); |
| | | if(!processCard.contains("/")){ |
| | | throw new ServiceException(Constants.Code_600, "错误的流程卡号,请检查!"); |
| | | } |
| | | |
| | | String[] processCardList = processCard.split("/"); |
| | | |
| | | List<FlowCard> flowCardList = flowCardMapper.selectList( |
| | | new QueryWrapper<FlowCard>() |
| | | .eq("process_id", processCardList[0]) |
| | | .eq("technology_number", processCardList[1]) |
| | | ); |
| | | for (FlowCard flowCard : flowCardList) { |
| | | flowCard.setOrderGlassDetail( |
| | | orderGlassDetailMapper.selectOne( |
| | | new QueryWrapper<OrderGlassDetail>() |
| | | .eq("order_id", flowCard.getOrderId()) |
| | | .eq("order_number", flowCard.getOrderNumber()) |
| | | .eq("technology_number", flowCard.getTechnologyNumber()) |
| | | ) |
| | | ); |
| | | String str = flowCard.getOrderGlassDetail().getGlassChild(); |
| | | String delimiter = "mm"; |
| | | int index = str.indexOf(delimiter); |
| | | Integer subString = Integer.valueOf(str.substring(0, index).trim()); |
| | | flowCard.getOrderGlassDetail().setThickness(subString); |
| | | } |
| | | return flowCardList; |
| | | } |
| | | |
| | | public Boolean checkboxDeleteSv(Map<String, Object> object) { |
| | | String userName = ""; |
| | | if (object.get("userName") != null) { |
| | | userName = object.get("userName").toString(); |
| | | } |
| | | String userId = ""; |
| | | if (object.get("userId") != null) { |
| | | userId = object.get("userId").toString(); |
| | | } |
| | | List<FlowCard> flowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("composing")), FlowCard.class); |
| | | for (FlowCard flowCard : flowCardList) { |
| | | Integer count = flowCardMapper.reportingWorkCount(flowCard.getProcessId()); |
| | | if (count == 0) { |
| | | //修改分架状态 |
| | | flowCardMapper.updateDeleteState(flowCard.getOrderId(), flowCard.getProcessId()); |
| | | //删除报工流程明细表数据 |
| | | flowCardMapper.deleteReportingWork(flowCard.getProcessId()); |
| | | //删除分架明细 |
| | | flowCardMapper.deleteFlowCardMp(flowCard.getOrderId(), flowCard.getProcessId()); |
| | | //删除排序表数据 |
| | | flowCardMapper.deleteflowCardSort(flowCard.getOrderId(), flowCard.getProcessId()); |
| | | //判断该订单流程卡是否全部删除 |
| | | Integer flowNumber = flowCardMapper.selectFlowCardCount(flowCard.getOrderId()); |
| | | if (flowNumber == 0) { |
| | | //修改订单表分架状态为0,全部删除 |
| | | flowCardMapper.updateProcessingCard(flowCard.getOrderId(), 0); |
| | | } else { |
| | | //修改订单表分架状态为1,删除部分 |
| | | flowCardMapper.updateProcessingCard(flowCard.getOrderId(), 1); |
| | | } |
| | | |
| | | //保存日志 |
| | | Log log = new Log(); |
| | | log.setContent(flowCard.getOrderId()+flowCard.getProcessId()); |
| | | log.setFunction("checkboxDeleteSv流程卡删除"); |
| | | log.setOperatorId(userId); |
| | | log.setOperator(userName); |
| | | logService.saveLog(log); |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | return true; |
| | | |
| | | |
| | | } |
| | | |
| | | public Map<String, Object> getPrintProjectDetails(String projectNo) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", flowCardMapper.getPrintProjectDetailsMp(projectNo)); |
| | | return map; |
| | | } |
| | | |
| | | public Map<String, Object> getPrintCustomDataProjectNoDetailSv(String type, Map<String, Object> object) { |
| | | 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); |
| | | if (!flowCardList.isEmpty()) { |
| | | Set<String> processedProcessIds = new HashSet<>(); // 用来存放已处理过的 processId |
| | | for (FlowCard flowCard : flowCardList) { |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | itemmap.put("data", flowCardMapper.getPrintCustomDataProjectDetail(flowCard.getProjectNo(),flowCard.getStockId())); |
| | | list.add(itemmap); |
| | | } |
| | | } |
| | | map.put("data", list); |
| | | map.put("title", flowCardMapper.getPrintTitle(type)); |
| | | return map; |
| | | } |
| | | } |
| | | |
| | | |