guoyujie
5 天以前 7302d21d8578afc3fbc8632f960ce07d38bf03d8
修改订单号生成规则
9个文件已修改
50 ■■■■ 已修改文件
north-glass-erp/northglass-erp/src/stores/sd/companySet/上海北玻.js 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/stores/sd/companySet/天津北玻.js 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/stores/sd/companySet/常州吉利.js 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/stores/sd/companySet/新疆恒鑫.js 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/stores/sd/companySet/洛阳北玻.js 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/stores/sd/companySet/温州巨星.js 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/stores/sd/companySet/金华天成.js 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/sd/OrderService.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/stores/sd/companySet/ÉϺ£±±²£.js
@@ -23,6 +23,8 @@
            msg:'basicData.msg.range99999Dec2'
        },
        orderIdType:'day',//后端生成订单号类型,day:每天生成,month:每月生成,year:每年生成
        orderIdTypeLetter:'NG',//订单号前面字母
        orderIdTypeMantissa:2,//订单号尾数保留位数  orderIdTypeLetter长度+orderIdTypeMantissa =4
        deliveryIdType:'day',
        deliveryDate:15,//订单创建送货日期 å¤©æ´¥7天,常州7天,义乌15天,新疆15天
        columnName:'图号',
north-glass-erp/northglass-erp/src/stores/sd/companySet/Ìì½ò±±²£.js
@@ -23,6 +23,8 @@
            msg:'basicData.msg.range99999Dec2'
        },
        orderIdType:'year',//后端生成订单号类型,day:每天生成,month:每月生成,year:每年生成
        orderIdTypeLetter:'NG',//订单号前面字母
        orderIdTypeMantissa:2,//订单号尾数保留位数  orderIdTypeLetter长度+orderIdTypeMantissa =4
        deliveryIdType:'day',//后端生成发货单号类型,day:每天生成,month:每月生成
        deliveryDate:7,//订单创建送货日期 å¤©æ´¥7天,常州7天,义乌15天,新疆15天
        columnName:'图号',//打印生产单时需要显示的列名,没有为空
north-glass-erp/northglass-erp/src/stores/sd/companySet/³£ÖݼªÀû.js
@@ -23,6 +23,8 @@
            msg:'basicData.msg.range9999Dec'
        },
        orderIdType:'month',//后端生成订单号类型,day:每天生成,month:每月生成
        orderIdTypeLetter:'NG',//订单号前面字母
        orderIdTypeMantissa:2,//订单号尾数保留位数  orderIdTypeLetter长度+orderIdTypeMantissa =4
        deliveryIdType:'month',//后端生成发货单号类型,day:每天生成,month:每月生成
        deliveryDate:7,//订单创建送货日期 å¤©æ´¥7天,常州7天,义乌15天,新疆15天
        columnName:'异形参数',//打印生产单时需要显示的列名,没有为空
north-glass-erp/northglass-erp/src/stores/sd/companySet/н®ºãöÎ.js
@@ -23,6 +23,8 @@
            msg:'basicData.msg.range99999Dec2'
        },
        orderIdType:'year',//后端生成订单号类型,day:每天生成,month:每月生成,year:按年生成
        orderIdTypeLetter:'NG',//订单号前面字母
        orderIdTypeMantissa:2,//订单号尾数保留位数  orderIdTypeLetter长度+orderIdTypeMantissa =4
        deliveryIdType:'day',//后端生成发货单号类型,day:每天生成,month:每月生成
        deliveryDate:15,//订单创建送货日期 å¤©æ´¥7天,常州7天,义乌15天,新疆15天
        columnName:'图号',//打印生产单时需要显示的列名,没有为空
north-glass-erp/northglass-erp/src/stores/sd/companySet/ÂåÑô±±²£.js
@@ -23,6 +23,8 @@
            msg:'basicData.msg.range99999Dec2'
        },
        orderIdType:'day',//后端生成订单号类型,day:每天生成,month:每月生成,year:每年生成
        orderIdTypeLetter:'NG',//订单号前面字母
        orderIdTypeMantissa:2,//订单号尾数保留位数  orderIdTypeLetter长度+orderIdTypeMantissa =4
        deliveryIdType:'day',
        deliveryDate:15,//订单创建送货日期 å¤©æ´¥7天,常州7天,义乌15天,新疆15天
        columnName:'图号',
north-glass-erp/northglass-erp/src/stores/sd/companySet/ÎÂÖݾÞÐÇ.js
@@ -23,6 +23,8 @@
            msg:'basicData.msg.range99999Dec2'
        },
        orderIdType:'day',//后端生成订单号类型,day:每天生成,month:每月生成,year:每年生成
        orderIdTypeLetter:'NG',//订单号前面字母
        orderIdTypeMantissa:2,//订单号尾数保留位数  orderIdTypeLetter长度+orderIdTypeMantissa =4
        deliveryIdType:'day',//后端生成发货单号类型,day:每天生成,month:每月生成
        deliveryDate:15,//订单创建送货日期 å¤©æ´¥7天,常州7天,义乌15天,新疆15天
        columnName:'图号',//打印生产单时需要显示的列名,没有为空
north-glass-erp/northglass-erp/src/stores/sd/companySet/½ð»ªÌì³É.js
@@ -22,7 +22,9 @@
            //regexp:/^(0|[1-9][0-9]{0,3}([.][0-9]{1,2})?)$/,//正则0.00-9999.99
            msg:'basicData.msg.range99999Dec2'
        },
        orderIdType:'year',//后端生成订单号类型,day:每天生成,month:每月生成,year:每年生成
        orderIdType:'day',//后端生成订单号类型,day:每天生成,month:每月生成,year:每年生成
        orderIdTypeLetter:'R',//订单号前面字母
        orderIdTypeMantissa:3,//订单号尾数保留位数  orderIdTypeLetter长度+orderIdTypeMantissa =4
        deliveryIdType:'day',//后端生成发货单号类型,day:每天生成,month:每月生成
        deliveryDate:15,//订单创建送货日期 å¤©æ´¥7天,常州7天,义乌15天,新疆15天
        columnName:'图号',//打印生产单时需要显示的列名,没有为空
north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue
@@ -401,7 +401,9 @@
              creator:userStore.user.userName,
              creatorId:userStore.user.userId,
              newOrderId:newOrderId.value,
              position:company.position
              position:company.position,
              orderIdTypeLetter:company.orderIdTypeLetter,
              orderIdTypeMantissa:company.orderIdTypeMantissa
            }
            const grossAreaList = $grid.getTableData().fullData.filter(
                item=>item.grossArea === 0
north-glass-erp/src/main/java/com/example/erp/service/sd/OrderService.java
@@ -29,7 +29,6 @@
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.sql.SQLOutput;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
@@ -67,6 +66,8 @@
    public boolean saveOrder(Map<String,Object> orderMap) throws Exception {
        JSONObject orderJson = new JSONObject(orderMap);
        String orderIdType = orderJson.getString("orderIdType");
        String orderIdTypeLetter = orderJson.getString("orderIdTypeLetter");
        Integer orderIdTypeMantissa = orderJson.getInteger("orderIdTypeMantissa");
        Order order = JSONObject.parseObject(JSONObject.toJSONString(orderJson.get("title")), Order.class);
        List<OrderDetail> OrderDetails = JSONArray.parseArray(JSONObject.toJSONString(orderJson.get("detail")), OrderDetail.class);
        List<OrderOtherMoney> orderOtherMoneyList = JSONArray.parseArray(JSONObject.toJSONString(orderJson.get("otherMoney")), OrderOtherMoney.class);
@@ -85,7 +86,12 @@
            log.setContent(orderMap.toString());
            if(order.getOrderId() == null || order.getOrderId().isEmpty()){
                insertOrder(order,OrderDetails,orderOtherMoneyList,orderIdType, (Map<String, String>) orderMap.get("position"));
                insertOrder(order,
                        OrderDetails,orderOtherMoneyList,orderIdType,
                        (Map<String, String>) orderMap.get("position"),
                        orderIdTypeLetter,
                        orderIdTypeMantissa
                );
                log.setFunction("saveOrder创建:"+order.getOrderId());
            }else {
                updateOrder(order,OrderDetails,orderOtherMoneyList,(Map<String, String>) orderMap.get("position"));
@@ -165,9 +171,9 @@
        return map;
    }
    //生成订单数据
    public void insertOrder(Order order, List<OrderDetail> OrderDetails, List<OrderOtherMoney> orderOtherMoneyList, String orderIdType, Map<String,String> position) {
    public void insertOrder(Order order, List<OrderDetail> OrderDetails, List<OrderOtherMoney> orderOtherMoneyList, String orderIdType, Map<String,String> position, String orderIdTypeLetter, Integer orderIdTypeMantissa) {
        //根据传入的当前月份或者当天生成订单id
        String orderId =  getOrderId(orderIdType);
        String orderId =  getOrderId(orderIdType,orderIdTypeLetter,orderIdTypeMantissa);
        //往主表插数据
        order.setOrderId(orderId);
        order.setCreateOrder(2);
@@ -175,32 +181,34 @@
        insertOtherDetail(orderId,OrderDetails,orderOtherMoneyList,position);
    }
    private String getOrderId(String dateType){
    private String getOrderId(String dateType, String orderIdTypeLetter, Integer orderIdTypeMantissa){
        String orderId = null;
        Integer orderIdTypeLetterLen = orderIdTypeLetter.length();
        Integer count = orderIdTypeLetterLen+orderIdTypeMantissa;
        if(dateType==null || dateType.equals("day")){
            Integer maxOrderId = orderMapper.selectMaxOrderId();
            //查询订单id,并且自增
            String formattedNumber = String.format("%02d", maxOrderId+1);
            String formattedNumber = String.format("%0"+orderIdTypeMantissa+"d", maxOrderId+1);
            //格式化当前日期
            Date currentDate = new Date();
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyMMdd");
            String formattedDate = dateFormat.format(currentDate);
            orderId =  "NG"+formattedDate+formattedNumber;
            orderId =  orderIdTypeLetter+formattedDate+formattedNumber;
        }else if(dateType.equals("month")){
            Integer maxOrderId = orderMapper.selectMaxOrderIdByMonth();
            String formattedNumber = String.format("%04d", maxOrderId+1);
            String formattedNumber = String.format("%0"+(orderIdTypeMantissa+2)+"d", maxOrderId+1);
            Date currentDate = new Date();
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyMM");
            String formattedDate = dateFormat.format(currentDate);
            orderId =  "NG"+formattedDate+formattedNumber;
            orderId =  orderIdTypeLetter+formattedDate+formattedNumber;
        }else if(dateType.equals("year")){
            Integer maxOrderId = orderMapper.selectMaxOrderIdByYear();
            String formattedNumber = String.format("%06d", maxOrderId+1);
            String formattedNumber = String.format("%"+(orderIdTypeMantissa+4)+"d", maxOrderId+1);
            Date currentDate = new Date();
            SimpleDateFormat dateFormat = new SimpleDateFormat("yy");
            String formattedDate = dateFormat.format(currentDate);
            orderId =  "NG"+formattedDate+formattedNumber;
            orderId =  orderIdTypeLetter+formattedDate+formattedNumber;
        }
        return orderId;
    }