Bläddra i källkod

Merge branch 'master' of https://git.steerinfo.com/DAL-DAZHOU1/DAL-TMS-TRUCK-API

luobang 2 år sedan
förälder
incheckning
16d4101a07

+ 26 - 4
src/main/java/com/steerinfo/dil/controller/TmstruckSelfMachineController.java

@@ -3,11 +3,9 @@ package com.steerinfo.dil.controller;
 import com.steerinfo.dil.service.impl.TmstruckSelfMachineService;
 import com.steerinfo.dil.util.BaseRESTfulController;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.util.Map;
 
@@ -53,4 +51,28 @@ public class TmstruckSelfMachineController extends BaseRESTfulController {
         Map<String,Object>map=tmstruckSelfMachineService.getDeliveryOrder(orderNumber);
         return map;
     }
+
+    /**
+     * @author:zyf
+     * @version:1.0
+     * @Date:2022-09-04
+     * @Description:
+    */
+    @PostMapping("/queryNumber")
+    public Map<String,Object> queryNumber(@RequestParam String orderNumber){
+        Map<String,Object> bigDecimal = tmstruckSelfMachineService.queryNumber(orderNumber);
+        return bigDecimal;
+    }
+
+    /**
+     * @author:zyf
+     * @version:1.0
+     * @Date:2022-09-04
+     * @Description:
+     */
+    @PostMapping("/changeNumber")
+    public void changeNumber(@RequestParam String orderNumber){
+        tmstruckSelfMachineService.changeNumber(orderNumber);
+
+    }
 }

+ 2 - 1
src/main/java/com/steerinfo/dil/controller/TmstruckTimeTaskResultController.java

@@ -68,7 +68,8 @@ public class TmstruckTimeTaskResultController extends BaseRESTfulController {
         try {
             i=tmstruckTimeTaskResultService.addTimeTaskResult(mapValue);
         } catch (Exception e) {
-            return failed(e.getMessage());
+            e.printStackTrace();
+            return failed("计时失败");
         }
         return success(i);
     }

+ 24 - 0
src/main/java/com/steerinfo/dil/mapper/TmstruckLeaveFactoryResultMapper.java

@@ -89,4 +89,28 @@ public interface TmstruckLeaveFactoryResultMapper extends IBaseMapper<TmstruckLe
      * @Description:查询出备注
     */
     String querynote(String orderNumber);
+
+    /**
+     * @author:zyf
+     * @version:1.0
+     * @Date: 2022-08-30
+     * @Description:根据物资ID和订单编号查询物资件数
+    */
+    BigDecimal queryNumber(BigDecimal materialid,String orderNumber);
+
+    /**
+     * @author:zyf
+     * @version:1.0
+     * @Date:2022-09-04
+     * @Description:根据运输单号查询打印数量
+     */
+    Map<String,Object> queryNumber1(String orderNumber);
+
+    /**
+     * @author:zyf
+     * @version:1.0
+     * @Date:2022-09-04
+     * @Description:
+     */
+    void changeNumber(String orderNumber);
 }

+ 2 - 0
src/main/java/com/steerinfo/dil/mapper/TmstruckTimeTaskResultMapper.java

@@ -48,4 +48,6 @@ public interface TmstruckTimeTaskResultMapper extends IBaseMapper<TmstruckTimeTa
     //查找总时长
     Map<String,Object> getResultValue(String orderNumber);
 
+    //根据运输订单号查询用车单位
+    String getShipperName(Map<String,Object> map);
 }

+ 15 - 0
src/main/java/com/steerinfo/dil/model/TmstruckTimeTaskResult.java

@@ -135,6 +135,12 @@ public class TmstruckTimeTaskResult implements IBasePO<BigDecimal> {
     @ApiModelProperty(value="依照合同预估时间",required=false)
     private String resultAboutTime;
 
+    /**
+     * 结算时长(RESULT_BALANCE_TIME,DECIMAL,0)
+     */
+    @ApiModelProperty(value="结算时长",required=false)
+    private BigDecimal resultBalanceTime;
+
     private static final long serialVersionUID = 1L;
 
     @Override
@@ -315,6 +321,14 @@ public class TmstruckTimeTaskResult implements IBasePO<BigDecimal> {
         this.resultAboutTime = resultAboutTime == null ? null : resultAboutTime.trim();
     }
 
+    public BigDecimal getResultBalanceTime() {
+        return resultBalanceTime;
+    }
+
+    public void setResultBalanceTime(BigDecimal resultBalanceTime) {
+        this.resultBalanceTime = resultBalanceTime;
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
@@ -342,6 +356,7 @@ public class TmstruckTimeTaskResult implements IBasePO<BigDecimal> {
         sb.append(", deleteName=").append(deleteName);
         sb.append(", deleteTime=").append(deleteTime);
         sb.append(", resultAboutTime=").append(resultAboutTime);
+        sb.append(", resultBalanceTime=").append(resultBalanceTime);
         sb.append(", serialVersionUID=").append(serialVersionUID);
         sb.append("]");
         return sb.toString();

+ 21 - 5
src/main/java/com/steerinfo/dil/service/impl/StatisticalReportImpl.java

@@ -9,10 +9,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.web.bind.annotation.RequestBody;
 
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * @ author    :TXF
@@ -264,6 +261,25 @@ public class StatisticalReportImpl implements IStatisticalReportService {
 
     @Override
     public List<Map<String, Object>> getInwardSaleSteelOrder(Map<String, Object> map) {
-        return statisticalReportMapper.getInwardSaleSteelOrder(map);
+        List<Map<String, Object>> results=statisticalReportMapper.getInwardSaleSteelOrder(map);
+        if(results!=null){
+            //遍历找到所有已使用的分录
+            Set<BigDecimal> saleMaterialIds=new HashSet<>();
+            for(Map<String,Object> temp:results){
+                if(temp.get("orderId")!=null){
+                    saleMaterialIds.add(DataChange.dataToBigDecimal(temp.get("saleMaterialId")));
+                }
+            }
+            //查询分录已使用但订单id为null的记录
+            List<Map<String, Object>> disResults=new ArrayList<>();
+            for(Map<String,Object> temp:results){
+                if(temp.get("orderId")==null && saleMaterialIds.contains(DataChange.dataToBigDecimal(temp.get("saleMaterialId")))){
+                    disResults.add(temp);
+                }
+            }
+            //删除这些记录,防止重复派单
+            results.removeAll(disResults);
+        }
+        return results;
     }
 }

+ 33 - 7
src/main/java/com/steerinfo/dil/service/impl/TmstruckSelfMachineService.java

@@ -55,9 +55,11 @@ public class TmstruckSelfMachineService implements ITmstruckSelfMachineService {
             List<Map<String, Object>> deliveryOrderMaterialList = tmstruckLeaveFactoryResultMapper.getDeliveryOrderMaterial(orderNumber);
             //判断为棒材还是线材
             for (Map<String,Object> map1:deliveryOrderMaterialList){
-                BigDecimal materialid = (BigDecimal) map1.get("materialid");
+                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("盘元")
@@ -66,11 +68,15 @@ public class TmstruckSelfMachineService implements ITmstruckSelfMachineService {
                     List<Map<String, Object>> netWeightlist = tmstruckLeaveFactoryResultMapper.getNetWeightByOrder(map);
                     for (Map<String, Object> stringObjectMap : netWeightlist) {
                         BigDecimal materialid1 = (BigDecimal) stringObjectMap.get("materialid");
-                        if (materialid.compareTo(materialid1) == 0) {
-                            BigDecimal nowNetWeight = (BigDecimal) stringObjectMap.get("nowNetWeight");
-                            if (nowNetWeight != null) {
-                                map1.put("materialWeight", nowNetWeight);
+                        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 {
@@ -79,13 +85,12 @@ public class TmstruckSelfMachineService implements ITmstruckSelfMachineService {
                     for (Map<String, Object> stringObjectMap : theoryWeightlist) {
                         BigDecimal materialid1 = (BigDecimal) stringObjectMap.get("materialid");
                         if (materialid.compareTo(materialid1) == 0){
-                            BigDecimal theoryWeight=(BigDecimal) stringObjectMap.get("theoryWeight");
+                            BigDecimal theoryWeight=(BigDecimal) stringObjectMap.get("theoreticalWeight");
                             if (theoryWeight != null){
                                 map1.put("materialWeight",theoryWeight);
                             }
                         }
                     }
-
                 }
             }
             map.put("deliveryOrderMaterialList",deliveryOrderMaterialList);
@@ -93,4 +98,25 @@ public class TmstruckSelfMachineService implements ITmstruckSelfMachineService {
 
         return map;
     }
+
+    /**
+     * @author:zyf
+     * @version:1.0
+     * @Date:2022-09-04
+     * @Description:查询出打印数量
+     */
+    public Map<String,Object> queryNumber(String orderNumber){
+        Map<String,Object> bigDecimal = tmstruckLeaveFactoryResultMapper.queryNumber1(orderNumber);
+        return bigDecimal;
+    }
+
+    /**
+     * @author:zyf
+     * @version:1.0
+     * @Date:2022-09-04
+     * @Description:更新打印数量
+     */
+    public void changeNumber(String orderNumber){
+        tmstruckLeaveFactoryResultMapper.changeNumber(orderNumber);
+    }
 }

+ 66 - 95
src/main/java/com/steerinfo/dil/service/impl/TmstruckTimeTaskResultServiceImpl.java

@@ -61,6 +61,7 @@ public class TmstruckTimeTaskResultServiceImpl implements ITmstruckTimeTaskResul
 
     private static final String FourHour="220吨吊车,130吨吊车,120吨吊车,150吨吊车,100吨吊车";
 
+    private static final String DxTemp="达兴能源二厂,化工厂";
 
 
     /**
@@ -314,109 +315,79 @@ public class TmstruckTimeTaskResultServiceImpl implements ITmstruckTimeTaskResul
             map2.put("type", 7);
             map2.put("orderId", orderId);
             BigDecimal resultPauseTime = utilsMapper.TimeTaskPause(map2);
+            //通用处理
+            Map<String, Object> timeMaps = utilsMapper.FristTimeTask(map);
+            Date resultTime2 = (Date) timeMaps.get("resultTime");
+            Map<String, Object> timeStatus = utilsMapper.getTimeStatus(map);
+            Date resultTime1 = (Date) timeStatus.get("resultTime");
+            long dateTime1 = resultTime2.getTime() - resultTime1.getTime();
+            BigDecimal dateTime3 = new BigDecimal(dateTime1 / (1000 * 60));
+            int Time1 = 0;//实际时长
+            Map<String, Object> requirementInfo = tmstruckTimeTaskResultMapper.getRequirementInfo(orderId);
+            String capacityTypeName =(String) requirementInfo.get("capacityTypeName");
             if(resultPauseTime != null) {
-                Map<String, Object> timeMaps = utilsMapper.FristTimeTask(map);
-                Date resultTime2 = (Date) timeMaps.get("resultTime");
-                Map<String, Object> timeStatus = utilsMapper.getTimeStatus(map);
-                Date resultTime1 = (Date) timeStatus.get("resultTime");
-                long dateTime1 = resultTime2.getTime() - resultTime1.getTime();
-                BigDecimal dateTime3 = new BigDecimal(dateTime1 / (1000 * 60));
-                int Time1 = dateTime3.intValue() - resultPauseTime.intValue();
-                Map<String, Object> requirementInfo = tmstruckTimeTaskResultMapper.getRequirementInfo(orderId);
-                String capacityTypeName =(String) requirementInfo.get("capacityTypeName");
-                if (capacityTypeName != null && capacityTypeName.contains("吊车")) {
-                    //100吨以下
-                    int hours=Time1/60;
-                    BigDecimal minutes=new BigDecimal(Time1%60);
-                    int hour = Integer.parseInt(String.valueOf(hours));
-                    if (TwoHour.contains(capacityTypeName)) {
-                        //判断是否小于2个小时
-                        if (hour<2&&hour>=0){
-                            //设置为两个小时
-                            tmstruckTimeTaskResult.setResultAboutTime(2+"小时");
-                        }else {
-                            //设置实际作业时长-dateTime3
-                            tmstruckTimeTaskResult.setResultAboutTime(hour+"小时"+minutes+"分钟");
-                        }
-                        //如果为100吨以上吊车
-                    }else if (FourHour.contains(capacityTypeName)){
+                //存在暂停时间
+                Time1 = dateTime3.intValue() - resultPauseTime.intValue();
+            } else {
+                //不存在暂停时间
+                Time1 = dateTime3.intValue();
+            }
+            //只要车辆类型不为空,就计算结算时长
+            if (capacityTypeName != null) {
+                //一般情况直接计算2小时规则
+                int hour=Time1/60;
+                int minutes=Time1%60;
+                //判断是否小于2个小时
+                if (hour<2){
+                    //设置为两个小时
+                    tmstruckTimeTaskResult.setResultAboutTime("2小时");
+                    tmstruckTimeTaskResult.setResultBalanceTime(new BigDecimal(120));
+                }else {
+                    //设置实际作业时长
+                    tmstruckTimeTaskResult.setResultAboutTime(hour+"小时"+minutes+"分钟");
+                    tmstruckTimeTaskResult.setResultBalanceTime(new BigDecimal(Time1));
+                }
+                //特殊情况,根据不同计时规则重新计算
+                //4小时规则:100吨以上吊车
+                if (FourHour.contains(capacityTypeName)){
+                    if (hour<4&&hour>=0){
                         //1、如实际使用时间不足4小时按照(使用时间+4小时)进行最终结算
-                        if (hour<0) {
-                            tmstruckTimeTaskResult.setResultAboutTime("4小时");
-                        }
-                        else if (hour<4&&hour>=0){
-                             //计算小时和分钟
-                            tmstruckTimeTaskResult.setResultAboutTime(4+hours+"小时"+minutes+"分钟");
-                        }else if (hour>=4&&hour<8){
-                               //2、如实际使用时间超出4小时加上车辆往返时间4小时超过8小时的按8小时计算
-                                tmstruckTimeTaskResult.setResultAboutTime(8+"小时");
-                        }else if (hour>=8){
-                            tmstruckTimeTaskResult.setResultAboutTime(hour+"小时"+minutes+"分钟");
-                        }
+                        tmstruckTimeTaskResult.setResultAboutTime(4+hour+"小时"+minutes+"分钟");
+                        tmstruckTimeTaskResult.setResultBalanceTime(new BigDecimal(240+Time1));
+                    }else if (hour>=4&&hour<8){
+                        //2、如实际使用时间超出4小时加上车辆往返时间4小时超过8小时的按8小时计算
+                        tmstruckTimeTaskResult.setResultAboutTime("8小时");
+                        tmstruckTimeTaskResult.setResultBalanceTime(new BigDecimal(480));
+                    }else if (hour>=8){
+                        tmstruckTimeTaskResult.setResultAboutTime(hour+"小时"+minutes+"分钟");
+                        tmstruckTimeTaskResult.setResultBalanceTime(new BigDecimal(Time1));
                     }
                 }
-                tmstruckTimeTaskResult.setTimeTaskResultId(tmstruckTimeTaskResult.getTimeTaskResultId());
-                tmstruckTimeTaskResult.setResultValue(new BigDecimal((Time1)));
-                tmstruckTimeTaskResult.setResultUomId(new BigDecimal(900));
-                if (personnelSsoId != null) {
-                    tmstruckTimeTaskResult.setUpdateUsername(personnelSsoId);
-                }
-                i += tmstruckTimeTaskResultMapper.updateByPrimaryKeySelective(tmstruckTimeTaskResult);
-                map.put("Time1",Time1);
-               genernateInwardTime(map);
-            } else {
-                //用于计时结束判断
-                Map<String, Object> timeMaps = utilsMapper.FristTimeTask(map);
-                Date resultTime2 = (Date) timeMaps.get("resultTime");
-                Map<String, Object> timeStatus = utilsMapper.getTimeStatus(map);
-                Date resultTime1 = (Date) timeStatus.get("resultTime");
-                long dateTime1 = resultTime2.getTime() - resultTime1.getTime();
-                BigDecimal dateTime3 = new BigDecimal(dateTime1 / (1000 * 60));
-                //如果车辆类型为吊车,则进行以下判断
-                //如果车辆类型为100 吨以下吨位吊车作业时间以2小时为起点计算,超过2小时以实际作业时间计算
-                Map<String, Object> requirementInfo = tmstruckTimeTaskResultMapper.getRequirementInfo(orderId);
-                String capacityTypeName =(String) requirementInfo.get("capacityTypeName");
-                if (capacityTypeName != null && capacityTypeName.contains("吊车")) {
-                    //100吨以下
-                    BigDecimal hours =new BigDecimal(dateTime1 / (1000*60*60));
-                    BigDecimal minutes =new BigDecimal(dateTime3.intValue()%60);
-                    int hour = Integer.parseInt(String.valueOf(hours));
-                    if (TwoHour.contains(capacityTypeName)) {
-                        //判断是否小于2个小时
-                        if (hour<2&&hour>0){
-                            //设置为两个小时
-                            tmstruckTimeTaskResult.setResultAboutTime(2+"小时");
-                        }else {
-                            //设置实际作业时长-dateTime3
-                            tmstruckTimeTaskResult.setResultAboutTime(hour+"小时"+minutes+"分钟");
-                        }
-                        //如果为100吨以上吊车
-                    }else if (FourHour.contains(capacityTypeName)){
-                        //1、如实际使用时间不足4小时按照(使用时间+4小时)进行最终结算
-                        if (hour<0) {
-                            tmstruckTimeTaskResult.setResultAboutTime("4小时");
-                        }
-                        else if (hour<4&&hour>0){
-                            //计算小时和分钟
-                            tmstruckTimeTaskResult.setResultAboutTime(4+hours.intValue()+"小时"+minutes+"分钟");
-                        }else if (hour>=4&&hour<8){
-                            //2、如实际使用时间超出4小时加上车辆往返时间4小时超过8小时的按8小时计算
-                            tmstruckTimeTaskResult.setResultAboutTime(8+"小时");
-                        }else if (hour>=8){
-                            tmstruckTimeTaskResult.setResultAboutTime(hours+"小时"+minutes+"分钟");
+                //查询用车单位,使用特殊规则
+                String shipperName=tmstruckTimeTaskResultMapper.getShipperName(map);
+                if(shipperName!=null){
+                    //达兴能源二厂及化工厂临时规则
+                    if(shipperName.contains("达兴能源") || shipperName.contains("化工厂")){
+                        if(capacityTypeName.contains("汽车")){
+                            tmstruckTimeTaskResult.setResultAboutTime(1+hour+"小时"+minutes+"分钟");
+                            tmstruckTimeTaskResult.setResultBalanceTime(new BigDecimal(Time1+60));
+                        }else if(capacityTypeName.contains("装载机")){
+                            tmstruckTimeTaskResult.setResultAboutTime(4+hour+"小时"+minutes+"分钟");
+                            tmstruckTimeTaskResult.setResultBalanceTime(new BigDecimal(Time1+240));
                         }
                     }
                 }
-                tmstruckTimeTaskResult.setTimeTaskResultId(tmstruckTimeTaskResult.getTimeTaskResultId());
-                tmstruckTimeTaskResult.setResultValue(dateTime3);
-                tmstruckTimeTaskResult.setResultUomId(new BigDecimal(900));
-                if (personnelSsoId != null) {
-                    tmstruckTimeTaskResult.setUpdateUsername(personnelSsoId);
-                }
-                i += tmstruckTimeTaskResultMapper.updateByPrimaryKeySelective(tmstruckTimeTaskResult);
-              map.put("Time1",dateTime3);
-               genernateInwardTime(map);
             }
+            tmstruckTimeTaskResult.setTimeTaskResultId(tmstruckTimeTaskResult.getTimeTaskResultId());
+            tmstruckTimeTaskResult.setResultValue(new BigDecimal((Time1)));//实际时长
+            tmstruckTimeTaskResult.setResultUomId(new BigDecimal(900));
+            if (personnelSsoId != null) {
+                tmstruckTimeTaskResult.setUpdateUsername(personnelSsoId);
+            }
+            i += tmstruckTimeTaskResultMapper.updateByPrimaryKeySelective(tmstruckTimeTaskResult);
+            map.put("Time1",Time1);
+            genernateInwardTime(map);
+            //计算完成
             Map<String, Object> orderMes = utilsMapper.getOrderTypeByOrderNumber(orderNumber);
             BigDecimal orderType =DataChange.dataToBigDecimal(orderMes.get("orderType"));
             if (orderType.intValue()==21) {

+ 10 - 5
src/main/resources/com/steerinfo/dil/mapper/StatisticalReportMapper.xml

@@ -357,6 +357,7 @@
         TLR.INSERT_UPDATE_REMARK "materialRemark",
         ASO.SALE_NUMBER "saleNumber",
         ASM.SALE_WAREHOUSE "saleWarehouse",
+        ASM.MATERIAL_NUMBER "materialNum",
         TLR.CASE_NUMBER "caseNumber",
         RC2.CARRIER_NAME "carrierName",
         TAR.RESULT_ARRIVAL_ADDRESS "arrivalAddress",
@@ -373,10 +374,12 @@
         on ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
         left join AMS_SALE_TRUCKNO_MATERIAL ASTM
         on ASTM.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
-        left join AMS_SALE_MATERIAL ASM
-        on ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
         left join RMS_MATERIAL RM
-        on ASM.MATERIAL_ID = RM.MATERIAL_ID
+        on RM.MATERIAL_ID = TWR.MATERIAL_ID
+        left join AMS_SALE_MATERIAL ASM
+        on ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID AND ASM.MATERIAL_ID=RM.MATERIAL_ID
+--         left join RMS_MATERIAL RM
+--         on ASM.MATERIAL_ID = RM.MATERIAL_ID
         left join AMS_DISPATCH_SALE_ORDER ADSO
         on ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
         left join RMS_CARRIER RC2
@@ -406,8 +409,6 @@
         on RGOUT.GATEPOST_ID = TLFR.GATEPOST_ID
         left join RMS_CAPACITY RC
         on RC.CAPACITY_ID = OO.CAPACITY_ID
---         left join RMS_MATERIAL RM
---         on RM.MATERIAL_ID = TWR.MATERIAL_ID
         left join TMSTRUCK_ARRIVAL_RESULT TAR
         on TAR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
         left join TMStRUCK_RECEIPT_RESULT TRR
@@ -415,6 +416,10 @@
         WHERE OO.ORDER_TYPE = #{orderTypee}
         AND ASO.SHIPPER_ID = #{shipperId}
         AND OO.ORDER_STATUS IN (2,5)
+        AND TWR.RESULT_NET_WEIGHT IS NOT NULL
+        <if test="orderTypee!=null and orderTypee==1">
+            AND ASM.MATERIAL_NUMBER IS NOT NULL
+        </if>
         <if test="carrierSsoId != null">
             and RC2.CARRIER_SSO_ID = #{carrierSsoId}
         </if>

+ 36 - 49
src/main/resources/com/steerinfo/dil/mapper/TmstruckLeaveFactoryResultMapper.xml

@@ -1081,54 +1081,20 @@
     </select>
 
     <select id="getDeliveryOrderMaterial" parameterType="java.lang.String" resultType="java.util.LinkedHashMap">
-        select
-        distinct
-            rm.material_name "materialName",
-            rm.material_specification "materialSpe",
-            rm.material_model "materialModel",
-            oom.order_material_number "materialNumber",
-            oom.order_material_weight "materialWeight",
-            tlr.RESULT_LOAD_START_TIME "makeDate",
-            oom.MATERIAL_ID "materialid",
-            asm.is_pound_sale   "isPoundSale"
-        from omstruck_order oo
-                 left join
-             omstruck_order_material oom
-             on
-                 oom.order_id = oo.order_id
-                 left join
-             rms_material rm
-             on
-                 rm.material_id = oom.MATERIAL_ID
-                 left join
-             rms_unit_of_measure ruom
-             on
-                 ruom.unit_of_measure_id = rm.unit_of_measure_id
-            left join
-            TMSTRUCK_TOTAL_RESULT ttr
-            on ttr.ORDER_ID = oo.ORDER_ID
-                left  join
-            TMSTRUCK_WEIGHT_RESULT twr
-            on
-                 twr.RESULT_TOTAL_ID =   ttr.RESULT_TOTAL_ID
-            and twr.MATERIAL_ID = oom.MATERIAL_ID
-                left  join
-            TMSTRUCK_LOAD_RESULT tlr
-            on
-                  tlr.RESULT_TOTAL_ID =   ttr.RESULT_TOTAL_ID
-            and tlr.MATERIAL_ID = oom.MATERIAL_ID
-            left join
-             rms_capacity rc
-             on
-                 rc.capacity_id = oo.capacity_id
-                 left join
-             ams_sale_order_material asom
-             on
-                 asom.sale_order_material_id = oo.order_plan_id
-             left JOIN AMS_SALE_TRUCKNO_MATERIAL astm
-             on astm.sale_order_material_id = asom.sale_order_material_id
-             left join AMS_SALE_MATERIAL asm
-             on asm.sale_material_id = astm.material_id
+        SELECT DISTINCT
+        rm.material_name "materialName",
+        rm.material_specification "materialSpe",
+        rm.material_model "materialModel",
+        rm.material_id "materialId",
+        asm.is_pound_sale "isPoundSale"
+        FROM
+        omstruck_order oo
+        LEFT JOIN rms_capacity rc ON rc.capacity_id = oo.capacity_id
+        LEFT JOIN ams_sale_order_material asom ON asom.sale_order_material_id = oo.order_plan_id
+        LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL astm ON astm.sale_order_material_id = asom.sale_order_material_id
+        LEFT JOIN AMS_SALE_MATERIAL asm ON asm.sale_material_id = astm.material_id
+        LEFT JOIN rms_material rm ON rm.material_id = ASM.MATERIAL_ID
+        LEFT JOIN rms_unit_of_measure ruom ON ruom.unit_of_measure_id = rm.unit_of_measure_id
         where oo.order_number = #{orderNumber}
     </select>
     <!--零星物资出厂实绩列表 -->
@@ -1329,11 +1295,13 @@
         ON OO.ORDER_ID = TTR.ORDER_ID
         LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
         ON TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+        AND TWR.MATERIAL_ID = OOM.MATERIAL_ID
         WHERE OO.ORDER_NUMBER = #{orderNumber} and RM.MATERIAL_NAME=#{materialName}
+        AND TWR.RESULT_NET_WEIGHT IS NOT NULL
     </select>
 <!--    获取物资理重-->
     <select id="getTheoryWeight" resultType="java.util.Map" parameterType="java.util.Map">
-        select ASTM.MATERIAL_THEORETICAL_WEIGHT "theoreticalWeight",
+        select ASM.MATERIAL_WEIGHT "theoreticalWeight",
         ASM.MATERIAL_ID "materialid"
        from OMSTRUCK_ORDER oo
        left join AMS_SALE_ORDER_MATERIAL ASOM
@@ -1358,4 +1326,23 @@
           on aso.SALE_ORDER_ID =  asom.sale_order_id
          where oo.order_number = #{orderNumber}
     </select>
+    <select id="queryNumber" resultType="java.math.BigDecimal">
+        select oom.order_material_number  "materialNumber"
+        from omstruck_order oo
+        left join omstruck_order_material oom
+        on oom.order_id = oo.order_id
+        where oom.Material_Id=#{materialid}
+        and oo.order_number=#{orderNumber}
+    </select>
+    <select id="queryNumber1" resultType="java.util.Map">
+        select oo.PRINTNUMBER "printnumber"
+        from OMSTRUCK_ORDER oo
+        where oo.ORDER_NUMBER=#{orderNumber}
+    </select>
+
+    <update id="changeNumber">
+        update OMSTRUCK_ORDER oo
+        set oo.PRINTNUMBER=1
+        where oo.ORDER_NUMBER=#{orderNumber}
+    </update>
 </mapper>

+ 54 - 14
src/main/resources/com/steerinfo/dil/mapper/TmstruckTimeTaskResultMapper.xml

@@ -23,20 +23,21 @@
     <result column="DELETE_NAME" jdbcType="VARCHAR" property="deleteName" />
     <result column="DELETE_TIME" jdbcType="TIMESTAMP" property="deleteTime" />
     <result column="RESULT_ABOUT_TIME" jdbcType="VARCHAR" property="resultAboutTime" />
+    <result column="RESULT_BALANCE_TIME" jdbcType="DECIMAL" property="resultBalanceTime" />
   </resultMap>
   <sql id="columns">
     TIME_TASK_RESULT_ID, RESULT_TOTAL_ID, RESULT_VALUE, RESULT_UOM_ID, RESULT_TIME_TYPE,
     RESULT_TIME, RESULT_START_NODE_ID, RESULT_START_LONGITUDE_VAL, RESULT_START_LATITUDE_VAL,
     RESULT_END_NODE_ID, RESULT_END_LONGITUDE_VAL, RESULT_END_LATITUDE_VAL, RESULT_MEMO,
     INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
-    DELETE_NAME, DELETE_TIME, RESULT_ABOUT_TIME
+    DELETE_NAME, DELETE_TIME, RESULT_ABOUT_TIME, RESULT_BALANCE_TIME
   </sql>
   <sql id="columns_alias">
     t.TIME_TASK_RESULT_ID, t.RESULT_TOTAL_ID, t.RESULT_VALUE, t.RESULT_UOM_ID, t.RESULT_TIME_TYPE,
     t.RESULT_TIME, t.RESULT_START_NODE_ID, t.RESULT_START_LONGITUDE_VAL, t.RESULT_START_LATITUDE_VAL,
     t.RESULT_END_NODE_ID, t.RESULT_END_LONGITUDE_VAL, t.RESULT_END_LATITUDE_VAL, t.RESULT_MEMO,
     t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK,
-    t.DELETE_NAME, t.DELETE_TIME, t.RESULT_ABOUT_TIME
+    t.DELETE_NAME, t.DELETE_TIME, t.RESULT_ABOUT_TIME, t.RESULT_BALANCE_TIME
   </sql>
   <sql id="select">
     SELECT <include refid="columns" /> FROM TMSTRUCK_TIME_TASK_RESULT
@@ -109,6 +110,9 @@
       <if test="resultAboutTime != null and resultAboutTime != ''">
         and RESULT_ABOUT_TIME = #{resultAboutTime}
       </if>
+      <if test="resultBalanceTime != null">
+        and RESULT_BALANCE_TIME = #{resultBalanceTime}
+      </if>
     </where>
   </sql>
   <sql id="whereLike">
@@ -176,6 +180,9 @@
       <if test="resultAboutTime != null and resultAboutTime != ''">
         and RESULT_ABOUT_TIME LIKE '%${resultAboutTime}%'
       </if>
+      <if test="resultBalanceTime != null">
+        and RESULT_BALANCE_TIME = #{resultBalanceTime}
+      </if>
     </where>
   </sql>
   <delete id="deleteByPrimaryKey" parameterType="java.lang.Short">
@@ -245,6 +252,9 @@
     <if test="resultAboutTime != null and resultAboutTime != ''">
       or RESULT_ABOUT_TIME = #{resultAboutTime}
     </if>
+    <if test="resultBalanceTime != null">
+      or RESULT_BALANCE_TIME = #{resultBalanceTime}
+    </if>
   </delete>
   <insert id="insert" parameterType="com.steerinfo.dil.model.TmstruckTimeTaskResult">
     insert into TMSTRUCK_TIME_TASK_RESULT (TIME_TASK_RESULT_ID, RESULT_TOTAL_ID,
@@ -254,8 +264,8 @@
                                            RESULT_END_LONGITUDE_VAL, RESULT_END_LATITUDE_VAL,
                                            RESULT_MEMO, INSERT_USERNAME, INSERT_TIME,
                                            UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
-                                           DELETE_NAME, DELETE_TIME, RESULT_ABOUT_TIME
-    )
+                                           DELETE_NAME, DELETE_TIME, RESULT_ABOUT_TIME,
+                                           RESULT_BALANCE_TIME)
     values (#{timeTaskResultId,jdbcType=DECIMAL}, #{resultTotalId,jdbcType=DECIMAL},
             #{resultValue,jdbcType=DECIMAL}, #{resultUomId,jdbcType=DECIMAL}, #{resultTimeType,jdbcType=DECIMAL},
             #{resultTime,jdbcType=TIMESTAMP}, #{resultStartNodeId,jdbcType=DECIMAL}, #{resultStartLongitudeVal,jdbcType=VARCHAR},
@@ -263,8 +273,8 @@
             #{resultEndLongitudeVal,jdbcType=VARCHAR}, #{resultEndLatitudeVal,jdbcType=VARCHAR},
             #{resultMemo,jdbcType=VARCHAR}, #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP},
             #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR},
-            #{deleteName,jdbcType=VARCHAR}, #{deleteTime,jdbcType=TIMESTAMP}, #{resultAboutTime,jdbcType=VARCHAR}
-           )
+            #{deleteName,jdbcType=VARCHAR}, #{deleteTime,jdbcType=TIMESTAMP}, #{resultAboutTime,jdbcType=VARCHAR},
+            #{resultBalanceTime,jdbcType=DECIMAL})
   </insert>
   <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstruckTimeTaskResult">
     insert into TMSTRUCK_TIME_TASK_RESULT
@@ -332,6 +342,9 @@
       <if test="resultAboutTime != null">
         RESULT_ABOUT_TIME,
       </if>
+      <if test="resultBalanceTime != null">
+        RESULT_BALANCE_TIME,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="timeTaskResultId != null">
@@ -397,6 +410,9 @@
       <if test="resultAboutTime != null">
         #{resultAboutTime,jdbcType=VARCHAR},
       </if>
+      <if test="resultBalanceTime != null">
+        #{resultBalanceTime,jdbcType=DECIMAL},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstruckTimeTaskResult">
@@ -420,7 +436,8 @@
         INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
         DELETE_NAME = #{deleteName,jdbcType=VARCHAR},
         DELETE_TIME = #{deleteTime,jdbcType=TIMESTAMP},
-        RESULT_ABOUT_TIME = #{resultAboutTime,jdbcType=VARCHAR}
+        RESULT_ABOUT_TIME = #{resultAboutTime,jdbcType=VARCHAR},
+        RESULT_BALANCE_TIME = #{resultBalanceTime,jdbcType=DECIMAL}
     where TIME_TASK_RESULT_ID = #{timeTaskResultId,jdbcType=DECIMAL}
   </update>
   <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstruckTimeTaskResult">
@@ -486,6 +503,9 @@
       <if test="resultAboutTime != null">
         RESULT_ABOUT_TIME = #{resultAboutTime,jdbcType=VARCHAR},
       </if>
+      <if test="resultBalanceTime != null">
+        RESULT_BALANCE_TIME = #{resultBalanceTime,jdbcType=DECIMAL},
+      </if>
     </set>
     where TIME_TASK_RESULT_ID = #{timeTaskResultId,jdbcType=DECIMAL}
   </update>
@@ -512,8 +532,8 @@
     RESULT_MEMO, INSERT_USERNAME, INSERT_TIME,
     UPDATE_USERNAME, UPDATE_TIME,
     INSERT_UPDATE_REMARK, DELETE_NAME,
-    DELETE_TIME, RESULT_ABOUT_TIME
-    )
+    DELETE_TIME, RESULT_ABOUT_TIME,
+    RESULT_BALANCE_TIME)
     ( <foreach collection="list" item="item" separator="union all">
     select
     #{item.timeTaskResultId,jdbcType=DECIMAL},
@@ -525,8 +545,8 @@
     #{item.resultMemo,jdbcType=VARCHAR}, #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
     #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
     #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.deleteName,jdbcType=VARCHAR},
-    #{item.deleteTime,jdbcType=TIMESTAMP}, #{item.resultAboutTime,jdbcType=VARCHAR}
-    from dual
+    #{item.deleteTime,jdbcType=TIMESTAMP}, #{item.resultAboutTime,jdbcType=VARCHAR},
+    #{item.resultBalanceTime,jdbcType=DECIMAL} from dual
   </foreach> )
   </insert>
   <update id="batchUpdate" parameterType="java.util.List">
@@ -616,6 +636,10 @@
     <foreach close="end" collection="list" index="index" item="item" open="case TIME_TASK_RESULT_ID" separator=" ">
       when #{item.timeTaskResultId,jdbcType=DECIMAL} then #{item.resultAboutTime,jdbcType=VARCHAR}
     </foreach>
+    ,RESULT_BALANCE_TIME=
+    <foreach close="end" collection="list" index="index" item="item" open="case TIME_TASK_RESULT_ID" separator=" ">
+      when #{item.timeTaskResultId,jdbcType=DECIMAL} then #{item.resultBalanceTime,jdbcType=DECIMAL}
+    </foreach>
     where TIME_TASK_RESULT_ID in
     <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
       #{item.timeTaskResultId,jdbcType=DECIMAL}
@@ -629,7 +653,6 @@
     </foreach>
   </delete>
 
-
   <!-- 友情提示!!!-->
   <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
   <!--  通过运输订单号查询总实绩ID -->
@@ -754,7 +777,7 @@
     LEFT JOIN RMS_CAPACITY RC
     ON RC.CAPACITY_ID=OO.CAPACITY_ID
     LEFT JOIN RMS_CAPACITY_TYPE RCT
-    ON RCT.CAPACITY_TYPE_ID=RC.CAPACITY_TYPE_ID
+    ON RCT.CAPACITY_TYPE_ID=AIR.CAPACITY_TYPE_ID
     where TTTR.RESULT_TIME_TYPE = 3 AND TTTR.RESULT_VALUE IS NOT NULL
     <if test="con!=null">
       AND RC.CAPACITY_NUMBER LIKE #{con} or RM.MATERIAL_NAME LIKE #{con}
@@ -861,7 +884,8 @@
   </select>
   <!--获取需求信息-->
   <select id="getRequirementInfo" resultType="java.util.Map" parameterType="decimal">
-    select AIR.CAPACITY_TYPE_ID "capacityTypeId" ,
+    select DISTINCT
+           AIR.CAPACITY_TYPE_ID "capacityTypeId" ,
            AIR.REQUIREMENT_TYPE "requirementType",
            RCT.CAPACITY_TYPE_NAME "capacityTypeName"
     from OMSTRUCK_ORDER OO
@@ -874,6 +898,7 @@
            LEFT JOIN RMS_CAPACITY_TYPE RCT
                      ON AIR.CAPACITY_TYPE_ID = RCT.CAPACITY_TYPE_ID
     where oo.ORDER_ID = #{orderId1}
+    fetch next 1 rows only
   </select>
 
 <!-- 查找计时开始时间-->
@@ -901,4 +926,19 @@
     WHERE  TTTR.RESULT_TIME_TYPE= 3 AND OO.ORDER_NUMBER=#{orderNumber}
   </select>
 
+  <select id="getShipperName" resultType="java.lang.String">
+    SELECT RS.SHIPPER_NAME
+    from OMSTRUCK_ORDER OO
+           LEFT JOIN AMSTRUCK_INWARD_PLAN AIP
+                     ON AIP.PLAN_ID=OO.ORDER_PLAN_ID
+           LEFT JOIN AMSTRUCK_REQUIREMENT_PLAN ARP
+                     ON ARP.PLAN_ID=AIP.PLAN_ID
+           LEFT JOIN AMSTRUCK_INWARD_REQUIREMENT AIR
+                     ON AIR.REQUIREMENT_ID=ARP.REQUIREMENT_ID
+           LEFT JOIN RMS_SHIPPER RS
+                     ON RS.SHIPPER_ID = AIR.REQUIREMENT_SHIPPER_ID
+    where RS.SHIPPER_NAME is not null AND OO.ORDER_NUMBER=#{orderNumber}
+      FETCH NEXT 1 rows only
+  </select>
+
 </mapper>