廖井涛
2025-02-27 1e685c19317c73c86ae0901742b54b51eeaa26ea
north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java
@@ -1061,14 +1061,16 @@
        Float shelfThickness =  Float.parseFloat(object.get("shelfThickness").toString())*1000;
        Float spacerThickness =  Float.parseFloat(object.get("spacerThickness").toString());
        */
        Integer inMaxQuantity = 30;
        //Integer inMaxQuantity = 1;
        Float inWeight = 100.0f;
        Float shelfThickness = 2000.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());
        //获取此工程号订单明细信息
@@ -1095,12 +1097,12 @@
            //当前订单明细剩余数量
            if (shelfQuantity == 0) {
                shelfQuantity = shelfQuantityByWeight;
            }else if(shelfQuantity>0){
            }else if(shelfQuantity>0){//架子剩余数量大于0时,判断当前架子剩余重量,是否支持最新序号的的成品重量
                String FlowCardId = orderDetailList.get(orderDetailList.size() - 1).getFlowCardId();
                double flowCardWeight = 0.0;
                for (OrderDetail orderDetail1 : orderDetailList) {
                    if (orderDetail1.getFlowCardId().equals(FlowCardId)) {
                        flowCardWeight = orderDetail1.getHeight()*orderDetail1.getQuantity()* orderDetail1.getWidth()* glassThickness* 2.5 / 1000000;
                        flowCardWeight += orderDetail1.getHeight()*orderDetail1.getQuantity()* orderDetail1.getWidth()* glassThickness* 2.5 / 1000000;
                    }
                }
                if(flowCardWeight>0){
@@ -1112,6 +1114,7 @@
                                    * 2.5 / 1000000));
                    if (shelfQuantity == 0) {
                        shelfQuantity = shelfQuantityByWeight;
                        flowCardNo += 1;
                    }
                }
@@ -1126,7 +1129,9 @@
                }
                String processId = productionId + String.format("%05d", flowCardNo);
                //取最小值
                maxQuantity = Math.min(shelfQuantity, Math.min(inMaxQuantity, shelfMaxQuantityByThickness));
               // maxQuantity = Math.min(shelfQuantity, Math.min(inMaxQuantity, shelfMaxQuantityByThickness));
                maxQuantity = Math.min(shelfQuantity,  shelfMaxQuantityByThickness);
                /*System.out.println(shelfQuantity + "," + inMaxQuantity + "," + shelfMaxQuantityByThickness);
                System.out.println(flowCardNo + "," + maxQuantity);
                System.out.println("------");*/
@@ -1161,6 +1166,25 @@
    }
    public Boolean revokeComposingSv(Map<String, Object> object) {
        List<FlowCard> flowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("composing")), FlowCard.class);
        if (!flowCardList.isEmpty()) {
            for (FlowCard flowCard : flowCardList) {
                //获取没有工程号的条数,已生成工程号不能撤回
              Integer count =  flowCardMapper.selectProjectNo(flowCard.getProcessId());
              if (count == 0){
                  flowCardMapper.revokeComposing(flowCard.getProcessId());
              } else {
                  return false;
              }
            }
            return true;
        } else {
            return false;
        }
    }
}