| | |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.LocalDate; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | import java.sql.Date; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import java.util.stream.IntStream; |
| | | |
| | | import static com.example.erp.service.sd.OrderService.getOrderProcessDetails; |
| | | |
| | |
| | | } |
| | | |
| | | //流程卡管理查询 |
| | | public Map<String, Object> selectProcessCard(Integer pageNum, Integer pageSize, Date selectTime1, Date selectTime2, FlowCard flowCard) { |
| | | public Map<String, Object> selectProcessCard(Integer pageNum, Integer pageSize,List<String> selectDate, FlowCard flowCard) { |
| | | Integer offset = (pageNum - 1) * pageSize; |
| | | String endDate = LocalDate.now().toString(); |
| | | String startDate = LocalDate.now().minusDays(15).toString(); |
| | | if(selectDate !=null && selectDate.size()==2){ |
| | | if(!selectDate.get(0).isEmpty()){ |
| | | startDate = selectDate.get(0); |
| | | } |
| | | if(!selectDate.get(1).isEmpty()){ |
| | | endDate = selectDate.get(1); |
| | | } |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", flowCardMapper.selectFlowCard(offset, pageSize, selectTime1, selectTime2, flowCard)); |
| | | map.put("total", flowCardMapper.getPageTotal(offset, pageSize, selectTime1, selectTime2, flowCard)); |
| | | map.put("data", flowCardMapper.selectFlowCard(offset, pageSize, startDate, endDate, flowCard)); |
| | | map.put("total", flowCardMapper.getPageTotal(offset, pageSize, startDate, endDate, flowCard)); |
| | | List<String> list = new ArrayList<>(); |
| | | list.add(startDate); |
| | | list.add(endDate); |
| | | map.put("selectDate",list); |
| | | return map; |
| | | } |
| | | |
| | |
| | | public Object flowCardDetailSv(String processId, FlowCard flowCard) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", flowCardMapper.flowCardDetailMp(processId, flowCard)); |
| | | map.put("merge", flowCardMapper.flowCardDetailMergeMp(processId)); |
| | | return map; |
| | | } |
| | | |
| | | public Object selectPrintFlowCardSv(Date selectTime1, Date selectTime2, String orderId, String project, String userId, FlowCard flowCard) { |
| | | public Object selectPrintFlowCardSv(Date selectTime1, Date selectTime2, String orderId, String project, String userId, Integer state, FlowCard flowCard) { |
| | | if ("null".equals(orderId)) { |
| | | orderId = ""; |
| | | } |
| | |
| | | project = ""; |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("data", flowCardMapper.selectPrintFlowCardMp(selectTime1, selectTime2, orderId, project, flowCard)); |
| | | map.put("data", flowCardMapper.selectPrintFlowCardMp(selectTime1, selectTime2, orderId, project,state, flowCard)); |
| | | String roleId = flowCardMapper.selectUserMp(userId); |
| | | map.put("user", roleId); |
| | | return map; |
| | |
| | | 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 |
| | | Set<String> processedKeys = new HashSet<>(); |
| | | for (FlowCard flowCard : flowCardList) { |
| | | String processId = flowCard.getProcessId(); |
| | | Integer orderNumber = flowCard.getOrderNumber(); |
| | | String uniqueKey = processId + "|" + orderNumber; // 用特殊字符连接防止冲突 |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | //流程卡表头表尾数据 |
| | | //是否传入合并层数 |
| | |
| | | //是否包含切割 |
| | | //boolean containsCutting = flowCard.getProcess().contains("切割"); |
| | | String processSub = flowCard.getProcess().substring(0, 2); |
| | | if (processSub.equals("夹胶") || processSub.equals("中空")) {//工艺是否包含夹胶中空 |
| | | //获取工序对应的别称 |
| | | String processName = flowCardMapper.getProcessName(processSub); |
| | | if (processName.equals("stepC") || processName.equals("stepD")) {//工艺是否包含夹胶中空 |
| | | itemmap.put("detail", flowCardMapper.getPrimaryListLimt(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()), flowCard.getGlassChild(), flowCard.getProcess(), flowCard.getOrderId())); |
| | | |
| | | List<Map<String, Object>> detailList = flowCardMapper.getDetailList(flowCard.getProcessId(), flowCard.getTechnologyNumber(), flowCard.getProcess()); |
| | |
| | | } else { |
| | | if (merge.equals("1") && flowCard.getMerge().equals(1)) { |
| | | // 检查是否已经处理过该 processId,如果处理过则跳过 |
| | | if (processedProcessIds.contains(flowCard.getProcessId())) { |
| | | if (processedKeys.contains(uniqueKey)) { |
| | | continue; |
| | | } |
| | | // 将该 processId 加入已处理集合 |
| | | processedProcessIds.add(flowCard.getProcessId()); |
| | | 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()); |
| | |
| | | } |
| | | List<FlowCard> flowCardList = flowCardMapper.getFlowCardListPrintProject(printProject); |
| | | if (!flowCardList.isEmpty()) { |
| | | Set<String> processedProcessIds = new HashSet<>(); // 用来存放已处理过的 processId |
| | | Set<String> processedKeys = new HashSet<>(); |
| | | |
| | | for (FlowCard flowCard : flowCardList) { |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | |
| | | |
| | | String processId = flowCard.getProcessId(); |
| | | Integer orderNumber = flowCard.getOrderNumber(); |
| | | String uniqueKey = processId + "|" + orderNumber; // 用特殊字符连接防止冲突 |
| | | //是否包含切割 |
| | | //boolean containsCutting = flowCard.getProcess().contains("切割"); |
| | | String processSub = flowCard.getProcess().substring(0, 2); |
| | | if (processSub.equals("夹胶") || processSub.equals("中空")) { |
| | | //获取工序对应的别称 |
| | | String processName = flowCardMapper.getProcessName(processSub); |
| | | 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()); |
| | |
| | | if (flowCard.getPatchState().equals(0)) { |
| | | if (merge.equals("1") && flowCard.getMerge().equals(1)) { |
| | | // 检查是否已经处理过该 processId,如果处理过则跳过 |
| | | if (processedProcessIds.contains(flowCard.getProcessId())) { |
| | | if (processedKeys.contains(uniqueKey)) { |
| | | continue; |
| | | } |
| | | // 将该 processId 加入已处理集合 |
| | | processedProcessIds.add(flowCard.getProcessId()); |
| | | 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()); |
| | |
| | | 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 |
| | | |
| | | Set<String> processedKeys = new HashSet<>(); |
| | | if (lableType != 2) {//成品标签 |
| | | for (FlowCard flowCard : flowCardList) { |
| | | String processId = flowCard.getProcessId(); |
| | | |
| | | Integer orderNumber = flowCard.getOrderNumber(); |
| | | String uniqueKey = processId + "|" + orderNumber; // 用特殊字符连接防止冲突 |
| | | // 检查是否已经处理过该 processId,如果处理过则跳过 |
| | | if (processedProcessIds.contains(processId)) { |
| | | if (processedKeys.contains(uniqueKey)) { |
| | | continue; |
| | | } |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | |
| | | list.add(itemmap); |
| | | |
| | | // 将该 processId 加入已处理集合 |
| | | processedProcessIds.add(processId); |
| | | processedKeys.add(uniqueKey); |
| | | } |
| | | } else {//小片标签 |
| | | for (FlowCard flowCard : flowCardList) { |
| | |
| | | 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 |
| | | |
| | | Set<String> processedKeys = new HashSet<>(); |
| | | if (lableType != 2) {//成品标签 |
| | | for (FlowCard flowCard : flowCardList) { |
| | | String processId = flowCard.getProcessId(); |
| | | Integer orderNumber = flowCard.getOrderNumber(); |
| | | String uniqueKey = processId + "|" + orderNumber; // 用特殊字符连接防止冲突 |
| | | |
| | | // 检查是否已经处理过该 processId,如果处理过则跳过 |
| | | if (processedProcessIds.contains(processId)) { |
| | | if (processedKeys.contains(uniqueKey)) { |
| | | continue; |
| | | } |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | |
| | | list.add(itemmap); |
| | | |
| | | // 将该 processId 加入已处理集合 |
| | | processedProcessIds.add(processId); |
| | | processedKeys.add(uniqueKey); |
| | | } |
| | | } else {//小片标签 |
| | | for (FlowCard flowCard : flowCardList) { |
| | |
| | | |
| | | //工艺流程 |
| | | List<Map<String, Object>> processList = flowCardMapper.getProcessList(flowCard.getProcessId(), flowCard.getTechnologyNumber()); |
| | | |
| | | //工序列表 |
| | | List<Map<String, Object>> processNameList = flowCardMapper.getProcessNameList(); |
| | | itemmap.put("processList", processList); |
| | | itemmap.put("processNameList", processNameList); |
| | | // itemmap.put("numberList", numberList); |
| | | list.add(itemmap); |
| | | |
| | |
| | | if (!flowCardList.isEmpty()) { |
| | | for (FlowCard flowCard : flowCardList) { |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | if (type == 1) { |
| | | if (type == 1) {//明细打印 |
| | | itemmap.put("detail", flowCardMapper.selectPrintDetailsMp(flowCard.getOrderId())); |
| | | } else if (type == 2) { |
| | | } else if (type == 2) {//明细分架打印 |
| | | itemmap.put("detail", flowCardMapper.selectPrintDetailsMp1(flowCard.getOrderId())); |
| | | }else if (type == 3) {//订单打印 |
| | | itemmap.put("detail", flowCardMapper.selectPrintDetailsMp2(flowCard.getOrderId())); |
| | | } |
| | | |
| | | list.add(itemmap); |
| | |
| | | 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 |
| | | Set<String> processedKeys = new HashSet<>(); |
| | | |
| | | if (lableType != 2) {//成品标签 |
| | | for (FlowCard flowCard : flowCardList) { |
| | | String orderId = flowCard.getOrderId(); |
| | | String processId = flowCard.getProcessId(); |
| | | String orderNumber = flowCard.getOrderNumber().toString(); |
| | | String uniqueKey = processId + "|" + orderNumber; // 用特殊字符连接防止冲突 |
| | | if (processId!=null){ |
| | | // 检查是否已经处理过该 processId,如果处理过则跳过 |
| | | if (processedKeys.contains(uniqueKey)) { |
| | | continue; |
| | | } |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | itemmap.put("data", flowCardMapper.getPrintCustomDataDetails(flowCard.getProcessId(), flowCard.getOrderNumber(), flowCard.getPrintQuantity())); |
| | | list.add(itemmap); |
| | | |
| | | // 检查是否已经处理过该 processId,如果处理过则跳过 |
| | | if (processedProcessIds.contains(processId) && processedProcessIds.contains(orderNumber)) { |
| | | continue; |
| | | } |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | itemmap.put("data", flowCardMapper.getPrintCustomDataDetails(flowCard.getProcessId(), flowCard.getOrderNumber(), flowCard.getPrintQuantity())); |
| | | list.add(itemmap); |
| | | // 将该 processId 加入已处理集合 |
| | | processedKeys.add(uniqueKey); |
| | | } else{ |
| | | |
| | | // 将该 processId 加入已处理集合 |
| | | processedProcessIds.add(processId); |
| | | processedProcessIds.add(orderNumber); |
| | | Map<String, Object> itemmap = new HashMap<>(); |
| | | itemmap.put("data", flowCardMapper.getPrintOrderDataDetails(flowCard.getOrderId(), flowCard.getOrderNumber(), flowCard.getPrintQuantity())); |
| | | list.add(itemmap); |
| | | } |
| | | |
| | | } |
| | | } else {//小片标签 |
| | | for (FlowCard flowCard : flowCardList) { |
| | |
| | | |
| | | } |
| | | |
| | | public String mergeFlowCard(Map<String, Object> object) { |
| | | public String mergeFlowCard(Map<String, Object> object, Integer merge) { |
| | | 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"; |
| | | if (merge == 0){ |
| | | 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"; |
| | | } |
| | | } |
| | | }else {//取消合并 |
| | | flowCardMapper.updateFlowCardIsMerge(flowCardList.get(0).getProcessId()); |
| | | returns = "true"; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | String[] processCardList = processCard.split("/"); |
| | | List<String> result = IntStream.range(0, processCardList[1].length()) |
| | | .mapToObj(i -> String.valueOf(processCardList[1].charAt(i))) |
| | | .collect(Collectors.toList()); |
| | | |
| | | List<FlowCard> flowCardList = flowCardMapper.selectList( |
| | | new QueryWrapper<FlowCard>() |
| | | .eq("process_id", processCardList[0]) |
| | | .eq("technology_number", processCardList[1]) |
| | | .in("technology_number", result) |
| | | ); |
| | | for (FlowCard flowCard : flowCardList) { |
| | | flowCard.setOrderGlassDetail( |
| | |
| | | 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<>(); |
| | | //是否是工程明细打印 |
| | |
| | | } |
| | | |
| | | public Object processCardAutoRack(Map<String, Object> object) { |
| | | String orderId = "NG25000004"; |
| | | String productionId = "NG25000004B"; |
| | | /*String orderId = object.get("orderId").toString(); |
| | | String orderId = object.get("orderId").toString(); |
| | | String productionId = object.get("productionId").toString(); |
| | | Integer inMaxQuantity = Integer.parseInt(object.get("inMaxQuantity").toString()); |
| | | Float inWeight = Float.parseFloat(object.get("inWeight").toString()); |
| | | Float shelfThickness = Float.parseFloat(object.get("shelfThickness").toString())*1000; |
| | | Float shelfThickness = Float.parseFloat(object.get("shelfThickness").toString()); |
| | | Float spacerThickness = Float.parseFloat(object.get("spacerThickness").toString()); |
| | | */ |
| | | Float inLenMax = Float.parseFloat(object.get("inLenMax").toString()); |
| | | Float inLenMin = Float.parseFloat(object.get("inLenMin").toString()); |
| | | Float inShortMax = Float.parseFloat(object.get("inShortMax").toString()); |
| | | Float inShortMin = Float.parseFloat(object.get("inShortMin").toString()); |
| | | |
| | | /*String orderId = "NG25000004"; |
| | | String productionId = "NG25000004A"; |
| | | Integer inMaxQuantity = 1; |
| | | Float inWeight = 100.0f; |
| | | Float inWeight = 4000.0f; |
| | | Float shelfThickness = 2000.0f; |
| | | /*垫片厚度*/ |
| | | Float spacerThickness = 0.0f; |
| | | Float maxHeight = 1520.0f; |
| | | Float maxWid = 400.0f; |
| | | Float spacerThickness = 0.0f;//垫片厚度*/ |
| | | |
| | | |
| | | Map<String, Object> thickness = flowCardMapper.getGlassThicknessByProdutionId(orderId, productionId); |
| | | |
| | | //成品玻璃总厚度 |
| | | Float glassTotalThickness = Float.parseFloat(thickness.get("totalThickness").toString()); |
| | | //成品玻璃厚度 |
| | | Float glassThickness = Float.parseFloat(thickness.get("thickness").toString()); |
| | | |
| | | //获取此工程号订单明细信息 |
| | | List<OrderDetail> orderDetails = flowCardMapper.getOrderDetailByProductionId(orderId, productionId); |
| | | List<OrderDetail> orderDetails = flowCardMapper.getOrderDetailByProductionId(orderId, productionId,"scope",inLenMax,inLenMin,inShortMax,inShortMin,glassThickness); |
| | | List<OrderDetail> orderDetailsNotScope = flowCardMapper.getOrderDetailByProductionId(orderId, productionId,"notScope",inLenMax,inLenMin,inShortMax,inShortMin,glassThickness); |
| | | |
| | | //根据玻璃厚度和垫片厚度当前架子最大可放数量 |
| | | Integer shelfMaxQuantityByThickness = (int) (shelfThickness / (glassTotalThickness + spacerThickness)); |
| | |
| | | ); |
| | | //当前订单明细剩余数量 |
| | | if (shelfQuantity == 0) { |
| | | shelfQuantity = shelfQuantityByWeight; |
| | | }else if(shelfQuantity>0){ |
| | | String FlowCardId = orderDetailList.get(orderDetailList.size() - 1).getFlowCardId(); |
| | | shelfQuantity =Math.min( Math.min(shelfMaxQuantityByThickness,inMaxQuantity),shelfQuantityByWeight); |
| | | }else if(shelfQuantity>0){//架子剩余数量大于0时,判断当前架子剩余重量,是否支持最新序号的的成品重量 |
| | | String FlowCardId = orderDetailList.get(orderDetailList.size() - 1).getProcessId(); |
| | | double flowCardWeight = 0.0; |
| | | for (OrderDetail orderDetail1 : orderDetailList) { |
| | | if (orderDetail1.getFlowCardId().equals(FlowCardId)) { |
| | | if (orderDetail1.getProcessId().equals(FlowCardId)) { |
| | | flowCardWeight += orderDetail1.getHeight()*orderDetail1.getQuantity()* orderDetail1.getWidth()* glassThickness* 2.5 / 1000000; |
| | | } |
| | | } |
| | | if(flowCardWeight>0){ |
| | | //System.out.println(inWeight+","+flowCardWeight); |
| | | flowCardWeight = inWeight - flowCardWeight; |
| | | shelfQuantity = (int) (flowCardWeight / |
| | | //按照当前流程卡剩余重量,计算当前流程卡剩余数量 |
| | | int remainingQuantity = (int) (flowCardWeight / |
| | | (orderDetail.getHeight() |
| | | * orderDetail.getWidth() |
| | | * glassThickness |
| | | * 2.5 / 1000000)); |
| | | shelfQuantity =Math.min(Math.min(Math.min(shelfQuantityByWeight, Math.min(inMaxQuantity, shelfMaxQuantityByThickness)),shelfQuantity),remainingQuantity); |
| | | if (shelfQuantity == 0) { |
| | | shelfQuantity = shelfQuantityByWeight; |
| | | shelfQuantity = Math.min(shelfQuantityByWeight, Math.min(inMaxQuantity, shelfMaxQuantityByThickness)); |
| | | flowCardNo += 1; |
| | | } |
| | | } |
| | | |
| | | } |
| | | //取最小值 |
| | | Integer maxQuantity = 0; |
| | | //Integer maxQuantity = 0; |
| | | while (orderDetail.getQuantity() > 0) { |
| | | OrderDetail newOrderDetail = new OrderDetail(); |
| | | //当死循环中,当前架子剩余数量为0时,重新计算架子剩余数量 |
| | | if (shelfQuantity == 0) { |
| | | shelfQuantity = shelfQuantityByWeight; |
| | | shelfQuantity = Math.min(Math.min(shelfMaxQuantityByThickness,inMaxQuantity),shelfQuantityByWeight); |
| | | } |
| | | String processId = productionId + String.format("%05d", flowCardNo); |
| | | String processId = productionId + String.format("%03d", flowCardNo); |
| | | //取最小值 |
| | | maxQuantity = Math.min(shelfQuantity, Math.min(inMaxQuantity, shelfMaxQuantityByThickness)); |
| | | /*System.out.println(shelfQuantity + "," + inMaxQuantity + "," + shelfMaxQuantityByThickness); |
| | | //maxQuantity = Math.min(shelfQuantity, Math.min(inMaxQuantity, shelfMaxQuantityByThickness)); |
| | | //maxQuantity = Math.min(shelfQuantity, shelfMaxQuantityByThickness); |
| | | |
| | | /*System.out.println("订单序号:"+orderDetail.getOrderNumber()); |
| | | System.out.println(shelfQuantity + "," + "," + shelfMaxQuantityByThickness); |
| | | System.out.println(flowCardNo + "," + maxQuantity); |
| | | System.out.println("------");*/ |
| | | if(shelfQuantity<=0){ |
| | | return false; |
| | | } |
| | | |
| | | if (orderDetail.getQuantity() > maxQuantity) { |
| | | newOrderDetail.setFlowCardId(processId); |
| | | newOrderDetail.setQuantity(Long.valueOf(maxQuantity)); |
| | | if (orderDetail.getQuantity() > shelfQuantity) { |
| | | newOrderDetail.setProcessId(processId); |
| | | newOrderDetail.setQuantity(Long.valueOf(shelfQuantity)); |
| | | newOrderDetail.setHeight(orderDetail.getHeight()); |
| | | newOrderDetail.setWidth(orderDetail.getWidth()); |
| | | newOrderDetail.setOrderNumber(orderDetail.getOrderNumber()); |
| | | newOrderDetail.setShape(orderDetail.getShape()); |
| | | newOrderDetail.setLandingSequence(flowCardNo); |
| | | orderDetailList.add(newOrderDetail); |
| | | orderDetail.setQuantity(orderDetail.getQuantity() - maxQuantity); |
| | | orderDetail.setQuantity(orderDetail.getQuantity() - shelfQuantity); |
| | | orderDetail.setBaiscQuantity(String.valueOf(Integer.valueOf(orderDetail.getBaiscQuantity())-shelfQuantity)); |
| | | flowCardNo += 1; |
| | | shelfQuantity = shelfQuantity - shelfQuantity; |
| | | } else { |
| | | newOrderDetail.setFlowCardId(processId); |
| | | newOrderDetail.setProcessId(processId); |
| | | newOrderDetail.setQuantity(orderDetail.getQuantity()); |
| | | newOrderDetail.setHeight(orderDetail.getHeight()); |
| | | newOrderDetail.setWidth(orderDetail.getWidth()); |
| | | newOrderDetail.setOrderNumber(orderDetail.getOrderNumber()); |
| | | newOrderDetail.setShape(orderDetail.getShape()); |
| | | newOrderDetail.setLandingSequence(flowCardNo); |
| | | newOrderDetail.setBaiscQuantity(String.valueOf(orderDetail.getBaiscQuantity())); |
| | | orderDetailList.add(newOrderDetail); |
| | | //当前架子剩余数量 |
| | | shelfQuantity = shelfQuantity - Math.toIntExact(orderDetail.getQuantity()); |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | return orderDetailList; |
| | | Map<String, Object> map = new HashMap<>(); |
| | | Collections.reverse(orderDetailList); |
| | | map.put("orderDetailList", orderDetailList); |
| | | map.put("orderDetailsNotScope", orderDetailsNotScope); |
| | | return map; |
| | | } |
| | | |
| | | |