guoyuji
2025-03-04 b3c0f1778b109fd82e0368961a9a431041710c63
提交智能分架功能
5个文件已修改
168 ■■■■ 已修改文件
north-glass-erp/northglass-erp/src/views/pp/processCard/AddProcessCard.vue 80 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/entity/sd/OrderDetail.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/mapper/pp/FlowCardMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/processCard/AddProcessCard.vue
@@ -71,8 +71,8 @@
const {currentRoute} = useRouter()
const route = currentRoute.value
let orderId = route.query.orderId
let productionId = route.query.productionId
const orderId = route.query.orderId
const productionId = route.query.productionId
const orderOtherMoney = ref(null)
@@ -145,24 +145,51 @@
  filterConfig: {   //筛选配置项
                    //remote: true
  },
  /*formConfig: {
  formConfig: {
    data: {
      shelfThickness: '',
      spacerThickness: '',
      inWeight: '',
      inMaxQuantity: '',
      inWidth:'',
      inHeight:''
      shelfThickness: 2000,
      spacerThickness: 0,
      inWeight: 4000,
      inMaxQuantity: 1,
      inLenMin:400,
      inLenMax:3500,
      inShortMax:2500,
      inShortMin:400
    },
    rules:{
      shelfThickness: [
        { required: true, message: t('basicData.msg.greater0'),type:'number',pattern:/^[1-9]\d*$/ }
      ],
      spacerThickness: [
        { required: true, message: t('delivery.pleaseEnterANumericalValueGreaterThanOrEqualTo0'),type:'number',pattern:/^[0-9]\d*$/ }
      ],
      inWeight: [
        { required: true, message: t('basicData.msg.greater0'),type:'number',pattern:/^[1-9]\d*$/ }
      ]
    },
    items:[
      { field: 'shelfThickness', title: '架子纵深', itemRender: { name: 'VxeInput' } },
      { field: 'inWeight', title: '架子承重', itemRender: { name: 'VxeInput' } },
      { field: 'inMaxQuantity', title: '最大数量', itemRender: { name: 'VxeInput' } },
      { field: 'spacerThickness', title: '间隔厚度', itemRender: { name: 'VxeInput' } },
      { field: 'inHeight', title: '最大长度', itemRender: { name: 'VxeInput' } },
      { field: 'inWidth', title: '最短长度', itemRender: { name: 'VxeInput' } },
      { field: 'shelfThickness', title: '架子纵深(mm)', itemRender: { name: 'VxeInput' },span:8,folding: true},
      { field: 'inWeight', title: '架子承重(KG)', itemRender: { name: 'VxeInput' },span:8,folding: true },
      { field: 'spacerThickness', title: '间隔厚度(mm)', itemRender: { name: 'VxeInput' } ,span:8,folding: true},
      { field: 'inLenMax', title: '长边最大(mm)', itemRender: { name: 'VxeInput' },span:8,folding: true },
      { field: 'inLenMin', title: '长边最短(mm)', itemRender: { name: 'VxeInput' },span:8,folding: true },
      { field: 'inMaxQuantity', title: '最大数量', itemRender: { name: 'VxeInput' } ,span:8,folding: true},
      { field: 'inShortMax', title: '短边最大(mm)', itemRender: { name: 'VxeInput' },span:8,folding: true },
      { field: 'inShortMin', title: '短边最短(mm)', itemRender: { name: 'VxeInput' },span:8,folding: true },
      {
        span: 24,
        collapseNode: true,
        align: 'center',
        itemRender: {
          name: 'VxeButtonGroup',
          options: [
            { type: 'submit', content: '智能分架', status: 'primary' },
            { type: 'reset', content: '重置' }
          ]
        }
      }
    ]
  },*/
  },
  customConfig: {
    storage: true
  },
@@ -268,6 +295,26 @@
  },
})
const gridEventsRight = {
  formSubmit () {
    let form = gridOptions.formConfig.data
    form.orderId =orderId
    form.productionId = productionId
    request.post(`/processCard/processCardAutoRack`,form).then(res => {
      xGridLeft.value.reloadData(res.data.orderDetailList)
      xGrid.value.reloadData(res.data.orderDetailsNotScope)
    })
  },
  formReset () {
    router.push({
      path: '/main/processCard/AddProcessCard',
      query: {orderId: orderId,
        productionId: productionId,
        random:Math.random()
      }
    })
  }
}
//左侧子组件接收参数
const xGridLeft = ref()
@@ -988,6 +1035,7 @@
                class="mytable-scrollbar"
                height="100%"
                v-bind="gridOptions"
                v-on="gridEventsRight"
                @checkbox-change="handleCheckboxChange"
            >
              <!--      @toolbar-button-click="toolbarButtonClickEvent"-->
north-glass-erp/src/main/java/com/example/erp/entity/sd/OrderDetail.java
@@ -68,6 +68,10 @@
    //private Product product;
    @TableField(exist= false,select = false)
    private String flowCardId;
    private String processId;
    @TableField(exist= false,select = false)
    private String baiscQuantity;
    @TableField(exist= false,select = false)
    private Integer landingSequence;
}
north-glass-erp/src/main/java/com/example/erp/mapper/pp/FlowCardMapper.java
@@ -230,7 +230,7 @@
    Map<String,Object> getGlassThicknessByProdutionId(String orderId,String productionId);
    List<OrderDetail>  getOrderDetailByProductionId(String orderId, String productionId);
    List<OrderDetail>  getOrderDetailByProductionId(String orderId, String productionId,String type,Float inLenMax,Float inLenMin,Float inShortMax,Float inShortMin);
    Boolean revokeComposing(String processId);
north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java
@@ -1052,20 +1052,27 @@
    }
    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());
        */
        //Integer inMaxQuantity = 1;
        Float inWeight = 100.0f;
        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 = 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);
        //成品玻璃总厚度
@@ -1074,7 +1081,8 @@
        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);
        List<OrderDetail> orderDetailsNotScope = flowCardMapper.getOrderDetailByProductionId(orderId, productionId,"notScope",inLenMax,inLenMin,inShortMax,inShortMin);
        //根据玻璃厚度和垫片厚度当前架子最大可放数量
        Integer shelfMaxQuantityByThickness = (int) (shelfThickness / (glassTotalThickness + spacerThickness));
@@ -1096,12 +1104,12 @@
            );
            //当前订单明细剩余数量
            if (shelfQuantity == 0) {
                shelfQuantity = shelfQuantityByWeight;
                shelfQuantity =Math.min( Math.min(shelfMaxQuantityByThickness,inMaxQuantity),shelfQuantityByWeight);
            }else if(shelfQuantity>0){//架子剩余数量大于0时,判断当前架子剩余重量,是否支持最新序号的的成品重量
                String FlowCardId = orderDetailList.get(orderDetailList.size() - 1).getFlowCardId();
                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;
                    }
                }
@@ -1113,7 +1121,7 @@
                                    * glassThickness
                                    * 2.5 / 1000000));
                    if (shelfQuantity == 0) {
                        shelfQuantity = shelfQuantityByWeight;
                        shelfQuantity = Math.min(shelfQuantityByWeight, Math.min(inMaxQuantity, shelfMaxQuantityByThickness));
                        flowCardNo += 1;
                    }
                }
@@ -1125,30 +1133,38 @@
                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));
                maxQuantity = Math.min(shelfQuantity,  shelfMaxQuantityByThickness);
                maxQuantity = Math.min(shelfQuantity, Math.min(inMaxQuantity, shelfMaxQuantityByThickness));
                //maxQuantity = Math.min(shelfQuantity,  shelfMaxQuantityByThickness);
                /*System.out.println(shelfQuantity + "," + inMaxQuantity + "," + shelfMaxQuantityByThickness);
                /*System.out.println("订单序号:"+orderDetail.getOrderNumber());
                System.out.println(shelfQuantity + ","  + "," + shelfMaxQuantityByThickness);
                System.out.println(flowCardNo + "," + maxQuantity);
                System.out.println("------");*/
                if (orderDetail.getQuantity() > maxQuantity) {
                    newOrderDetail.setFlowCardId(processId);
                    newOrderDetail.setProcessId(processId);
                    newOrderDetail.setQuantity(Long.valueOf(maxQuantity));
                    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);
                    flowCardNo += 1;
                    shelfQuantity = shelfQuantity - maxQuantity;
                } 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);
                    orderDetailList.add(newOrderDetail);
                    //当前架子剩余数量
                    shelfQuantity = shelfQuantity - Math.toIntExact(orderDetail.getQuantity());
@@ -1160,9 +1176,11 @@
            }
        }
        return orderDetailList;
        Map<String, Object> map = new HashMap<>();
        Collections.reverse(orderDetailList);
        map.put("orderDetailList", orderDetailList);
        map.put("orderDetailsNotScope", orderDetailsNotScope);
        return map;
    }
north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
@@ -2899,13 +2899,27 @@
    
    <select id="getOrderDetailByProductionId">
        select * from (select a.*,
                              a.quantity as 'baiscQuantity',
        IF(a.height >= a.width, a.height, a.width) as 'long',
        IF(a.height &lt; a.width, a.height, a.width) as 'short'
        from sd.order_detail as a
        left join sd.order_glass_detail as b
        on a.order_id = b.order_id and a.order_number = b.order_number
        where a.order_id = #{orderId} and b.production_id = #{productionId}
        group by a.order_number) as c
        <if test="type=='scope'">
            where  c.`long` &lt;= #{inLenMax}
                and c.`long` >= #{inLenMin}
                and c.`short` >= #{inShortMin}
                and c.`short` &lt;= #{inShortMax}
        </if>
        <if test="type=='notScope'">
            where  !(c.`long` &lt;= #{inLenMax}
            and c.`long` >= #{inLenMin}
            and c.`short` >= #{inShortMin}
            and c.`short` &lt;= #{inShortMax})
        </if>
        order by c.`long` desc
    </select>