Browse Source

提交代码

zyf 2 năm trước cách đây
mục cha
commit
ae74f88e69

+ 65 - 57
src/main/java/com/steerinfo/dil/service/impl/TmstruckSelfMachineService.java

@@ -51,73 +51,81 @@ public class TmstruckSelfMachineService implements ITmstruckSelfMachineService {
 
     @Override
     public Map<String, Object> getDeliveryOrder(String orderNumber) {
-        //1.根据运输订单号查询主干信息
-        Map<String,Object> map = tmstruckLeaveFactoryResultMapper.getDeliveryOrder(orderNumber);
-        //备注信息的查找以及修改
-        String note=tmstruckLeaveFactoryResultMapper.querynote(orderNumber);
-        Date date=tmstruckLeaveFactoryResultMapper.queryDate(orderNumber);
-        if (date!=null&&!("".equals(date))){
-            map.put("note",note);
-        }else {
-            String regex="\\d{1,2}\\.\\d{1,2}";
-            Pattern pattern=Pattern.compile(regex);
-            Matcher matcher=pattern.matcher(note);
-            StringBuffer stringBuffer=new StringBuffer();
-            stringBuffer.append(note);
-            String partOfNote = tmstruckLeaveFactoryResultMapper.querypartOfNote(orderNumber);
-            while (matcher.find()){
-                String group = matcher.group();
-                /*note=note.replace(group,partOfNote);*/
-                note=matcher.replaceAll(partOfNote);
+        Map<String,Object> map=new HashMap<>();
+        try {
+            //1.根据运输订单号查询主干信息
+            map = tmstruckLeaveFactoryResultMapper.getDeliveryOrder(orderNumber);
+            //备注信息的查找以及修改
+            String note=tmstruckLeaveFactoryResultMapper.querynote(orderNumber);
+            Date date=tmstruckLeaveFactoryResultMapper.queryDate(orderNumber);
+            if (date!=null&&!("".equals(date))){
+                map.put("note",note);
+            }else {
+                if(note!=null&&!("".equals(note))){
+                    String regex="\\d{1,2}\\.\\d{1,2}";
+                    Pattern pattern=Pattern.compile(regex);
+                    Matcher matcher=pattern.matcher(note);
+                    StringBuffer stringBuffer=new StringBuffer();
+                    stringBuffer.append(note);
+                    String partOfNote = tmstruckLeaveFactoryResultMapper.querypartOfNote(orderNumber);
+                    while (matcher.find()){
+                        String group = matcher.group();
+                        /*note=note.replace(group,partOfNote);*/
+                        note=matcher.replaceAll(partOfNote);
+                    }
+
+                }else {
+                    map.put("note","");
+                }
             }
-            map.put("note",note);
-        }
-        map.put("orderNumber",orderNumber);
-        if(map !=null){
-            List<Map<String, Object>> deliveryOrderMaterialList = tmstruckLeaveFactoryResultMapper.getDeliveryOrderMaterial(orderNumber);
-            //判断为棒材还是线材
-            for (Map<String,Object> map1:deliveryOrderMaterialList){
-                BigDecimal materialid = (BigDecimal) map1.get("materialId");
-                String materialName =(String) map1.get("materialName");
-                map.put("materialName",materialName);
-                BigDecimal Bigdecimal1 = tmstruckLeaveFactoryResultMapper.queryNumber(materialid, orderNumber);
-                map1.put("materialNumber",Bigdecimal1);
-                //判断是实重还是理重的标志
-                BigDecimal isPoundSale = (BigDecimal) map1.get("isPoundSale");
-                //判断是否为盘螺materialName.contains("盘螺")||materialName.contains("盘元")
-                if (isPoundSale !=null && isPoundSale.compareTo(BigDecimal.valueOf(0))==0){
-                    //根据运输订单号查找实绩重量
-                    List<Map<String, Object>> netWeightlist = tmstruckLeaveFactoryResultMapper.getNetWeightByOrder(map);
-                    for (Map<String, Object> stringObjectMap : netWeightlist) {
-                        BigDecimal materialid1 = (BigDecimal) stringObjectMap.get("materialid");
-                        if(materialid1 !=null&&!("".equals(materialid1))){
-                            if (materialid.compareTo(materialid1) == 0) {
-                                BigDecimal nowNetWeight = (BigDecimal) stringObjectMap.get("nowNetWeight");
-                                if (nowNetWeight != null) {
-                                    map1.put("materialWeight", nowNetWeight);
+            map.put("orderNumber",orderNumber);
+            if(map !=null){
+                List<Map<String, Object>> deliveryOrderMaterialList = tmstruckLeaveFactoryResultMapper.getDeliveryOrderMaterial(orderNumber);
+                //判断为棒材还是线材
+                for (Map<String,Object> map1:deliveryOrderMaterialList){
+                    BigDecimal materialid = (BigDecimal) map1.get("materialId");
+                    String materialName =(String) map1.get("materialName");
+                    map.put("materialName",materialName);
+                    BigDecimal Bigdecimal1 = tmstruckLeaveFactoryResultMapper.queryNumber(materialid, orderNumber);
+                    map1.put("materialNumber",Bigdecimal1);
+                    //判断是实重还是理重的标志
+                    BigDecimal isPoundSale = (BigDecimal) map1.get("isPoundSale");
+                    //判断是否为盘螺materialName.contains("盘螺")||materialName.contains("盘元")
+                    if (isPoundSale !=null && isPoundSale.compareTo(BigDecimal.valueOf(0))==0){
+                        //根据运输订单号查找实绩重量
+                        List<Map<String, Object>> netWeightlist = tmstruckLeaveFactoryResultMapper.getNetWeightByOrder(map);
+                        for (Map<String, Object> stringObjectMap : netWeightlist) {
+                            BigDecimal materialid1 = (BigDecimal) stringObjectMap.get("materialid");
+                            if(materialid1 !=null&&!("".equals(materialid1))){
+                                if (materialid.compareTo(materialid1) == 0) {
+                                    BigDecimal nowNetWeight = (BigDecimal) stringObjectMap.get("nowNetWeight");
+                                    if (nowNetWeight != null) {
+                                        map1.put("materialWeight", nowNetWeight);
+                                    }
                                 }
+                            }else {
+                                map1.put("materialWeight", "");
                             }
-                        }else {
-                            map1.put("materialWeight", "");
                         }
-                    }
-                }else {
-                    //获取物资理重
-                    List<Map<String, Object>> theoryWeightlist = tmstruckLeaveFactoryResultMapper.getTheoryWeight(map);
-                    for (Map<String, Object> stringObjectMap : theoryWeightlist) {
-                        BigDecimal materialid1 = (BigDecimal) stringObjectMap.get("materialid");
-                        if (materialid.compareTo(materialid1) == 0){
-                            BigDecimal theoryWeight=(BigDecimal) stringObjectMap.get("theoreticalWeight");
-                            if (theoryWeight != null){
-                                map1.put("materialWeight",theoryWeight);
+                    }else {
+                        //获取物资理重
+                        List<Map<String, Object>> theoryWeightlist = tmstruckLeaveFactoryResultMapper.getTheoryWeight(map);
+                        for (Map<String, Object> stringObjectMap : theoryWeightlist) {
+                            BigDecimal materialid1 = (BigDecimal) stringObjectMap.get("materialid");
+                            if (materialid.compareTo(materialid1) == 0){
+                                BigDecimal theoryWeight=(BigDecimal) stringObjectMap.get("theoreticalWeight");
+                                if (theoryWeight != null){
+                                    map1.put("materialWeight",theoryWeight);
+                                }
                             }
                         }
                     }
                 }
+                map.put("deliveryOrderMaterialList",deliveryOrderMaterialList);
             }
-            map.put("deliveryOrderMaterialList",deliveryOrderMaterialList);
+        }catch (Exception e){
+            System.out.println("e"+e.getMessage());
         }
-
         return map;
     }
 

+ 5 - 4
src/main/resources/com/steerinfo/dil/mapper/TmstruckLeaveFactoryResultMapper.xml

@@ -1078,6 +1078,7 @@
         left join RMS_SHIPPER rsh
         on rsh.SHIPPER_ID = aso.SHIPPER_ID
         where oo.order_number =#{orderNumber}
+        and oo.order_status=5
     </select>
 
     <select id="getDeliveryOrderMaterial" parameterType="java.lang.String" resultType="java.util.LinkedHashMap">
@@ -1323,7 +1324,7 @@
           on asom.sale_order_material_id = oo.order_plan_id
           left join AMS_SALE_ORDER aso
           on aso.SALE_ORDER_ID =  asom.sale_order_id
-         where oo.order_number = #{orderNumber}
+         where oo.order_number = #{orderNumber} and oo.order_status=5
     </select>
     <select id="queryDate" resultType="java.util.Date">
         select WOR.INSERT_TIME
@@ -1340,7 +1341,7 @@
         ||'.'||
         extract(DAY from OO.INSERT_TIME +1) "partOfNote"
         from OMSTRUCK_ORDER OO
-        where OO.ORDER_NUMBER=#{orderNumber}
+        where OO.ORDER_NUMBER=#{orderNumber} and oo.order_status=5
     </select>
     <select id="queryNumber" resultType="java.math.BigDecimal">
         select oom.order_material_number  "materialNumber"
@@ -1348,7 +1349,7 @@
         left join omstruck_order_material oom
         on oom.order_id = oo.order_id
         where oom.Material_Id=#{materialid}
-        and oo.order_number=#{orderNumber}
+        and oo.order_number=#{orderNumber} and oo.order_status=5
     </select>
     <select id="queryNumber1" resultType="java.util.Map">
         select oo.PRINTNUMBER "printnumber"
@@ -1359,7 +1360,7 @@
     <update id="changeNumber">
         update OMSTRUCK_ORDER oo
         set oo.PRINTNUMBER=1
-        where oo.ORDER_NUMBER=#{orderNumber}
+        where oo.ORDER_NUMBER=#{orderNumber} and OO.ORDER_STATUS=5
     </update>
 
     <select id="getMaterial" resultType="java.lang.String">