Procházet zdrojové kódy

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

liyg před 2 roky
rodič
revize
d097edeb3b

+ 329 - 0
src/main/java/com/steerinfo/dil/controller/StatisticalReportController.java

@@ -804,6 +804,335 @@ public class StatisticalReportController extends BaseRESTfulController {
         return success(report);
     }
 
+    @ApiOperation(value="查询销售统计报表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
+            @ApiImplicitParam(name = "apiId(423)", value = "动态表头", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
+    })
+    @PostMapping("/getSaleSteelSpellingReport")
+    public RESTfulResult getSaleSteelSpellingReport(@RequestBody(required=false) Map<String,Object> map
+    ){
+        String startTime = (String)map.get("startTime");
+        String endTime = (String) map.get("endTime");
+        //分页数据
+        List<Map<String, Object>> report = statisticalReportService.getSaleSteelSpellingReport(map);
+        //初始化Map的值
+        Map<String,Object> map1=new HashMap<>();
+        map1.put("pinZhuang",null);
+        map1.put("chongQinSpellingData",0);
+        map1.put("chengDuSpellingData",0);
+        map1.put("gongChengSpellingData",0);
+        map1.put("chaungDongSpellingData",0);
+        map1.put("AllSpellingData",0);
+        Map<String,Object> map2=new HashMap<>();
+        map2.put("pinZhuang",null);
+        map2.put("chongQinSpellingData",0);
+        map2.put("chengDuSpellingData",0);
+        map2.put("gongChengSpellingData",0);
+        map2.put("chaungDongSpellingData",0);
+        map2.put("AllSpellingData",0);
+        Map<String,Object> map3=new HashMap<>();
+        map3.put("pinZhuang",null);
+        map3.put("chongQinSpellingData",0);
+        map3.put("chengDuSpellingData",0);
+        map3.put("gongChengSpellingData",0);
+        map3.put("chaungDongSpellingData",0);
+        map3.put("AllSpellingData",0);
+        Map<String,Object> map4=new HashMap<>();
+        map4.put("pinZhuang",null);
+        map4.put("chongQinSpellingData",0);
+        map4.put("chengDuSpellingData",0);
+        map4.put("gongChengSpellingData",0);
+        map4.put("chaungDongSpellingData",0);
+        map4.put("AllSpellingData",0);
+        Map<String,Object> map5=new HashMap<>();
+        map5.put("pinZhuang",null);
+        map5.put("chongQinSpellingData",0);
+        map5.put("chengDuSpellingData",0);
+        map5.put("gongChengSpellingData",0);
+        map5.put("chaungDongSpellingData",0);
+        map5.put("AllSpellingData",0);
+        Map<String,Object> map6=new HashMap<>();
+        map6.put("pinZhuang",null);
+        map6.put("chongQinSpellingData",0);
+        map6.put("chengDuSpellingData",0);
+        map6.put("gongChengSpellingData",0);
+        map6.put("chaungDongSpellingData",0);
+        map6.put("AllSpellingData",0);
+        Map<String,Object> map7=new HashMap<>();
+        map7.put("pinZhuang",null);
+        map7.put("chongQinSpellingData",0);
+        map7.put("chengDuSpellingData",0);
+        map7.put("gongChengSpellingData",0);
+        map7.put("chaungDongSpellingData",0);
+        map7.put("AllSpellingData",0);
+        //35个数据
+        List<Map<String,Object>> spellingData=new LinkedList<>();
+        //初始化list集合的值
+        spellingData.add(map1);
+        spellingData.add(map2);
+        spellingData.add(map3);
+        spellingData.add(map4);
+        spellingData.add(map5);
+        spellingData.add(map6);
+        spellingData.add(map7);
+        spellingData.get(0).put("pinZhuang","一拼");
+        spellingData.get(1).put("pinZhuang","二拼");
+        spellingData.get(2).put("pinZhuang","三拼");
+        spellingData.get(3).put("pinZhuang","四拼");
+        spellingData.get(4).put("pinZhuang","五拼");
+        spellingData.get(5).put("pinZhuang","六拼");
+        spellingData.get(6).put("pinZhuang","合计");
+        for (Map<String, Object> stringObjectMap : report) {
+            int flag=0;
+            String areaName = (String) stringObjectMap.get("areaName");
+            //销售订单号
+            if (areaName==null){
+                continue;
+            }
+            BigDecimal spellingNum =  DataChange.dataToBigDecimal(stringObjectMap.get("spellingNum"));
+            if (spellingNum.compareTo(BigDecimal.valueOf(1))==0){
+                if (areaName.equals("钢材重庆组")){
+                    Integer oneSpellingData = (Integer) spellingData.get(0).get("chongQinSpellingData");
+                    if (spellingData.get(0).get("chongQinSpellingData")!=null){
+                        spellingData.get(0).put("chongQinSpellingData",oneSpellingData+1);
+                    }else {
+                        spellingData.get(0).put("chongQinSpellingData",1);
+                    }
+                }else if (areaName.equals("钢材成都组")){
+                    Integer oneSpellingData1 = (Integer) spellingData.get(0).get("chengDuSpellingData");
+                    if (spellingData.get(0).get("chengDuSpellingData")!=null){
+                        spellingData.get(0).put("chengDuSpellingData",oneSpellingData1+1);
+                    }else {
+                        spellingData.get(0).put("chengDuSpellingData",1);
+                    }
+                }else if (areaName.equals("钢材工程组")){
+                    Integer oneSpellingData2 = (Integer) spellingData.get(0).get("gongChengSpellingData");
+                    if (spellingData.get(0).get("gongChengSpellingData")!=null){
+                        spellingData.get(0).put("gongChengSpellingData",oneSpellingData2+1);
+                    }else {
+                        spellingData.get(0).put("gongChengSpellingData",1);
+                    }
+                }else if (areaName.equals("钢材南充组")||areaName.equals("钢材达州组")||areaName.equals("钢材万州组")){
+                    Integer oneSpellingData3 = (Integer) spellingData.get(0).get("chaungDongSpellingData");
+                    if (oneSpellingData3!=null){
+                        spellingData.get(0).put("chaungDongSpellingData",oneSpellingData3+1);
+                    }else {
+                        spellingData.get(0).put("chaungDongSpellingData",1);
+                    }
+                }
+                Integer oneSpellingData4 = (Integer) spellingData.get(0).get("AllSpellingData");
+                if (oneSpellingData4!=null){
+                    spellingData.get(0).put("AllSpellingData",oneSpellingData4+1);
+                }else {
+                    spellingData.get(0).put("AllSpellingData",1);
+                }
+            }else if (spellingNum.compareTo(BigDecimal.valueOf(2))==0){
+                if (areaName.equals("钢材重庆组")){
+                    Integer oneSpellingData = (Integer) spellingData.get(1).get("chongQinSpellingData");
+                    if (oneSpellingData!=null){
+                        spellingData.get(1).put("chongQinSpellingData",oneSpellingData+1);
+                    }else {
+                        spellingData.get(1).put("chongQinSpellingData",1);
+                    }
+                }else if (areaName.equals("钢材成都组")){
+                    Integer oneSpellingData1 = (Integer) spellingData.get(1).get("chengDuSpellingData");
+                    if (oneSpellingData1!=null){
+                        spellingData.get(1).put("chengDuSpellingData",oneSpellingData1+1);
+                    }else {
+                        spellingData.get(1).put("chengDuSpellingData",1);
+                    }
+                }else if (areaName.equals("钢材工程组")){
+                    Integer oneSpellingData2 = (Integer) spellingData.get(1).get("gongChengSpellingData");
+                    if (oneSpellingData2!=null){
+                        spellingData.get(1).put("gongChengSpellingData",oneSpellingData2+1);
+                    }else {
+                        spellingData.get(1).put("gongChengSpellingData",1);
+                    }
+                }else if (areaName.equals("钢材南充组")||areaName.equals("钢材达州组")||areaName.equals("钢材万州组")){
+                    Integer oneSpellingData3 = (Integer) spellingData.get(1).get("chaungDongSpellingData");
+                    if (oneSpellingData3!=null){
+                        spellingData.get(1).put("chaungDongSpellingData",oneSpellingData3+1);
+                    }else {
+                        spellingData.get(1).put("chaungDongSpellingData",1);
+                    }
+                }
+                Integer oneSpellingData4 = (Integer) spellingData.get(1).get("AllSpellingData");
+                if (oneSpellingData4!=null){
+                    spellingData.get(1).put("AllSpellingData",oneSpellingData4+1);
+                }else {
+                    spellingData.get(1).put("AllSpellingData",1);
+                }
+            }else if (spellingNum.compareTo(BigDecimal.valueOf(3))==0){
+                if (areaName.equals("钢材重庆组")){
+                    Integer oneSpellingData = (Integer) spellingData.get(2).get("chongQinSpellingData");
+                    if (oneSpellingData!=null){
+                        spellingData.get(2).put("chongQinSpellingData",oneSpellingData+1);
+                    }else {
+                        spellingData.get(2).put("chongQinSpellingData",1);
+                    }
+                }else if (areaName.equals("钢材成都组")){
+                    Integer oneSpellingData1 = (Integer) spellingData.get(2).get("chengDuSpellingData");
+                    if (oneSpellingData1!=null){
+                        spellingData.get(2).put("chengDuSpellingData",oneSpellingData1+1);
+                    }else {
+                        spellingData.get(2).put("chengDuSpellingData",1);
+                    }
+                }else if (areaName.equals("钢材工程组")){
+                    Integer oneSpellingData2 = (Integer) spellingData.get(2).get("gongChengSpellingData");
+                    if (oneSpellingData2!=null){
+                        spellingData.get(2).put("gongChengSpellingData",oneSpellingData2+1);
+                    }else {
+                        spellingData.get(2).put("gongChengSpellingData",1);
+                    }
+                }else if (areaName.equals("钢材南充组")||areaName.equals("钢材达州组")||areaName.equals("钢材万州组")){
+                    Integer oneSpellingData3 = (Integer) spellingData.get(2).get("chaungDongSpellingData");
+                    if (oneSpellingData3!=null){
+                        spellingData.get(2).put("chaungDongSpellingData",oneSpellingData3+1);
+                    }else {
+                        spellingData.get(2).put("chaungDongSpellingData",1);
+                    }
+                }
+                Integer oneSpellingData4 = (Integer) spellingData.get(2).get("AllSpellingData");
+                if (oneSpellingData4!=null){
+                    spellingData.get(2).put("AllSpellingData",oneSpellingData4+1);
+                }else {
+                    spellingData.get(2).put("AllSpellingData",1);
+                }
+            }else if (spellingNum.compareTo(BigDecimal.valueOf(4))==0){
+                if (areaName.equals("钢材重庆组")){
+                    Integer oneSpellingData = (Integer) spellingData.get(3).get("chongQinSpellingData");
+                    if (oneSpellingData!=null){
+                        spellingData.get(3).put("chongQinSpellingData",oneSpellingData+1);
+                    }else {
+                        spellingData.get(3).put("chongQinSpellingData",1);
+                    }
+                }else if (areaName.equals("钢材成都组")){
+                    Integer oneSpellingData1 = (Integer) spellingData.get(3).get("chengDuSpellingData");
+                    if (oneSpellingData1!=null){
+                        spellingData.get(3).put("chengDuSpellingData",oneSpellingData1+1);
+                    }else {
+                        spellingData.get(3).put("chengDuSpellingData",1);
+                    }
+                }else if (areaName.equals("钢材工程组")){
+                    Integer oneSpellingData2 = (Integer) spellingData.get(3).get("gongChengSpellingData");
+                    if (oneSpellingData2!=null){
+                        spellingData.get(3).put("gongChengSpellingData",oneSpellingData2+1);
+                    }else {
+                        spellingData.get(3).put("gongChengSpellingData",1);
+                    }
+                }else if (areaName.equals("钢材南充组")||areaName.equals("钢材达州组")||areaName.equals("钢材万州组")){
+                    Integer oneSpellingData3 = (Integer) spellingData.get(3).get("chaungDongSpellingData");
+                    if (oneSpellingData3!=null){
+                        spellingData.get(3).put("chaungDongSpellingData",oneSpellingData3+1);
+                    }else {
+                        spellingData.get(3).put("chaungDongSpellingData",1);
+                    }
+                }
+                Integer oneSpellingData4 = (Integer) spellingData.get(3).get("AllSpellingData");
+                if (oneSpellingData4!=null){
+                    spellingData.get(3).put("AllSpellingData",oneSpellingData4+1);
+                }else {
+                    spellingData.get(3).put("AllSpellingData",1);
+                }
+            }else if (spellingNum.compareTo(BigDecimal.valueOf(5))==0){
+                if (areaName.equals("钢材重庆组")){
+                    Integer oneSpellingData = (Integer) spellingData.get(4).get("chongQinSpellingData");
+                    if (oneSpellingData!=null){
+                        spellingData.get(4).put("chongQinSpellingData",oneSpellingData+1);
+                    }else {
+                        spellingData.get(4).put("chongQinSpellingData",1);
+                    }
+                }else if (areaName.equals("钢材成都组")){
+                    Integer oneSpellingData1 = (Integer) spellingData.get(4).get("chengDuSpellingData");
+                    if (oneSpellingData1!=null){
+                        spellingData.get(4).put("chengDuSpellingData",oneSpellingData1+1);
+                    }else {
+                        spellingData.get(4).put("chengDuSpellingData",1);
+                    }
+                }else if (areaName.equals("钢材工程组")){
+                    Integer oneSpellingData2 = (Integer) spellingData.get(4).get("gongChengSpellingData");
+                    if (oneSpellingData2!=null){
+                        spellingData.get(4).put("gongChengSpellingData",oneSpellingData2+1);
+                    }else {
+                        spellingData.get(4).put("gongChengSpellingData",1);
+                    }
+                }else if (areaName.equals("钢材南充组")||areaName.equals("钢材达州组")||areaName.equals("钢材万州组")){
+                    Integer oneSpellingData3 = (Integer) spellingData.get(4).get("chaungDongSpellingData");
+                    if (oneSpellingData3!=null){
+                        spellingData.get(4).put("chaungDongSpellingData",oneSpellingData3+1);
+                    }else {
+                        spellingData.get(4).put("chaungDongSpellingData",1);
+                    }
+                }
+                Integer oneSpellingData4 = (Integer) spellingData.get(4).get("AllSpellingData");
+                if (oneSpellingData4!=null){
+                    spellingData.get(4).put("AllSpellingData",oneSpellingData4+1);
+                }else {
+                    spellingData.get(4).put("AllSpellingData",1);
+                }
+            }else if (spellingNum.compareTo(BigDecimal.valueOf(6))==0){
+                if (areaName.equals("钢材重庆组")){
+                    Integer oneSpellingData = (Integer) spellingData.get(5).get("chongQinSpellingData");
+                    if (oneSpellingData!=null){
+                        spellingData.get(5).put("chongQinSpellingData",oneSpellingData+1);
+                    }else {
+                        spellingData.get(5).put("chongQinSpellingData",1);
+                    }
+                }else if (areaName.equals("钢材成都组")){
+                    Integer oneSpellingData1 = (Integer) spellingData.get(5).get("chengDuSpellingData");
+                    if (oneSpellingData1!=null){
+                        spellingData.get(5).put("chengDuSpellingData",oneSpellingData1+1);
+                    }else {
+                        spellingData.get(5).put("chengDuSpellingData",1);
+                    }
+                }else if (areaName.equals("钢材工程组")){
+                    Integer oneSpellingData2 = (Integer) spellingData.get(5).get("gongChengSpellingData");
+                    if (oneSpellingData2!=null){
+                        spellingData.get(5).put("gongChengSpellingData",oneSpellingData2+1);
+                    }else {
+                        spellingData.get(5).put("gongChengSpellingData",1);
+                    }
+                }else if (areaName.equals("钢材南充组")||areaName.equals("钢材达州组")||areaName.equals("钢材万州组")){
+                    Integer oneSpellingData3 = (Integer) spellingData.get(5).get("chaungDongSpellingData");
+                    if (oneSpellingData3!=null){
+                        spellingData.get(5).put("chaungDongSpellingData",oneSpellingData3+1);
+                    }else {
+                        spellingData.get(5).put("chaungDongSpellingData",1);
+                    }
+                }
+                Integer oneSpellingData4 = (Integer) spellingData.get(5).get("AllSpellingData");
+                if (oneSpellingData4!=null){
+                    spellingData.get(5).put("AllSpellingData",oneSpellingData4+1);
+                }else {
+                    spellingData.get(5).put("AllSpellingData",1);
+                }
+            }
+        }
+        //每一列的合计
+        int oneData=0;
+        int twoData=0;
+        int threeData=0;
+        int fourData=0;
+        int fiveData=0;
+        for (int i = 0; i < spellingData.size(); i++) {
+            oneData+=(int) spellingData.get(i).get("chongQinSpellingData");
+            twoData+=(int) spellingData.get(i).get("chengDuSpellingData");
+            threeData+=(int) spellingData.get(i).get("gongChengSpellingData");
+            fourData+=(int) spellingData.get(i).get("chaungDongSpellingData");
+            fiveData+=(int) spellingData.get(i).get("AllSpellingData");
+        }
+        spellingData.get(6).put("chongQinSpellingData",oneData);
+        spellingData.get(6).put("chengDuSpellingData",twoData);
+        spellingData.get(6).put("gongChengSpellingData",threeData);
+        spellingData.get(6).put("chaungDongSpellingData",fourData);
+        spellingData.get(6).put("AllSpellingData",fiveData);
+        return success(spellingData);
+    }
+
     @ApiOperation(value="查询销售统计报表")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),

+ 3 - 0
src/main/java/com/steerinfo/dil/mapper/StatisticalReportMapper.java

@@ -78,6 +78,9 @@ public interface StatisticalReportMapper {
     //查询销售钢材统计报表
     List<Map<String, Object>> getSaleSteelReport(Map<String, Object> mapValue);
 
+    //查询销售钢材统计报表
+    List<Map<String, Object>> getSaleSteelSpellingReport(Map<String, Object> mapValue);
+
     //根据计费详单的需求修改后的钢材统计报表
     List<Map<String, Object>> getSaleSteelReportNew(Map<String, Object> mapValue);
 

+ 3 - 0
src/main/java/com/steerinfo/dil/service/IStatisticalReportService.java

@@ -21,6 +21,9 @@ public interface IStatisticalReportService {
     //查询销售统计报表
     List<Map<String, Object>> getAllSaleReport(Map<String, Object> map);
 
+    //查询销售拼装报表
+    List<Map<String, Object>> getSaleSteelSpellingReport(Map<String, Object> map);
+
     //查询销售统计报表
     List<Map<String, Object>> getAllSaleReportNum(Map<String, Object> map);
 

+ 6 - 0
src/main/java/com/steerinfo/dil/service/impl/StatisticalReportImpl.java

@@ -254,6 +254,12 @@ public class StatisticalReportImpl implements IStatisticalReportService {
         return saleSteelReport;
     }
 
+    @Override
+    public List<Map<String, Object>> getSaleSteelSpellingReport(Map<String, Object> mapValue) {
+        List<Map<String, Object>> saleSteelReport = statisticalReportMapper.getSaleSteelSpellingReport(mapValue);
+        return saleSteelReport;
+    }
+
     @Override
     public List<Map<String, Object>> getSaleSteelReportNew(Map<String, Object> mapValue) {
         List<Map<String, Object>> saleSteelReport = statisticalReportMapper.getSaleSteelReportNew(mapValue);

+ 73 - 0
src/main/resources/com/steerinfo/dil/mapper/StatisticalReportMapper.xml

@@ -2248,6 +2248,79 @@
                      )
     </select>
 
+    <select id="getSaleSteelSpellingReport" resultType="java.util.Map" parameterType="java.util.Map">
+        SELECT distinct OO.ORDER_ID "orderId",
+        ASO.SALE_ORDER_ID "saleOrderId",
+        to_char(ASOM.SALE_DATE_OF_RECEIPT - 1, 'yyyy-mm-dd') "orderTime",
+        ASO.SALE_NUMBER "saleOrderNo",
+        (SELECT COUNT(A_SM.SALE_MATERIAL_ID) FROM OMSTRUCK_ORDER O_O
+        LEFT JOIN AMS_SALE_ORDER_MATERIAL A_SOM
+        ON O_O.ORDER_PLAN_ID = A_SOM.SALE_ORDER_MATERIAL_ID
+        LEFT JOIN AMS_SALE_TRUCKNO_MATERIAL A_STM
+        ON A_STM.SALE_ORDER_MATERIAL_ID = A_SOM.SALE_ORDER_MATERIAL_ID
+        LEFT JOIN AMS_SALE_MATERIAL A_SM
+        ON A_SM.SALE_MATERIAL_ID = A_STM.MATERIAL_ID
+        WHERE O_O.ORDER_ID=OO.ORDER_ID
+        ) "spellingNum",
+        RSA.AREA_NAME "areaName"
+        FROM AMS_SALE_ORDER ASO
+        LEFT JOIN RMS_CONSIGNEE RC
+        ON RC.CONSIGNEE_ID = ASO.RECEIVE_ID
+        LEFT JOIN RMS_SHIPPER RS
+        ON RS.SHIPPER_ID = ASO.SHIPPER_ID
+        LEFT JOIN RMS_SALE_AREA RSA
+        ON RSA.AREA_ID = RC.AREA_ID
+        LEFT JOIN RMS_SALER RSR
+        ON RSR.SALER_ID = ASO.SALER_ID
+        LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM
+        ON ASOM.SALE_ORDER_ID = ASO.SALE_ORDER_ID
+        LEFT JOIN RMS_RECEIVE_PLACE RRP
+        ON RRP.PLACE_ID = ASOM.SALE_SHIPPING_ADDRESS_ID
+        LEFT JOIN RMS_RECEIVE_ADDRESS RRA
+        ON RRA.ADDRESS_ID = RRP.ADDRESS_ID
+        LEFT JOIN AMS_DISPATCH_SALE_ORDER ADSO
+        ON ADSO.SALE_ORDER_MATERIAL_ID = ASOM.SALE_ORDER_MATERIAL_ID
+        LEFT JOIN RMS_CARRIER R_CARRIER
+        ON R_CARRIER.CARRIER_ID = ADSO.CARRIER_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 OMSTRUCK_ORDER OO
+        ON OO.ORDER_PLAN_ID = ASOM.SALE_ORDER_MATERIAL_ID
+        AND NVL(OO.ORDER_TYPE, 0) in (0, 1)
+        LEFT JOIN RMS_CAPACITY RCA
+        ON RCA.CAPACITY_ID = OO.CAPACITY_ID
+        LEFT JOIN TMSTRUCK_TOTAL_RESULT TTR
+        ON TTR.ORDER_ID = OO.ORDER_ID
+        LEFT JOIN TMSTRUCK_ENFACTORY_RESULT TER
+        ON TER.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+        LEFT JOIN TMSTRUCK_WEIGHT_RESULT TWR
+        ON TWR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+        AND TWR.MATERIAL_ID = RM.MATERIAL_ID
+        LEFT JOIN BMSTRUCK_DETAILS_ORDER BDO
+        ON BDO.WEIGHT_TASK_RESULT_ID = TWR.WEIGHT_TASK_RESULT_ID
+        LEFT JOIN AMS_CONTRACT_TRANSPORT_PRICE actp
+        ON actp.PRICE_ID = OO.PRICE_ID
+        LEFT JOIN TMSTRUCK_LEAVE_FACTORY_RESULT TLFR
+        ON TLFR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+        LEFT JOIN TMSTRUCK_ARRIVAL_RESULT TAR
+        ON TAR.RESULT_TOTAL_ID = TTR.RESULT_TOTAL_ID
+        LEFT JOIN TMStRUCK_RECEIPT_RESULT TRR
+        ON TTR.RESULT_TOTAL_ID = TRR.RESULT_TOTAL_ID
+        WHERE ASO.SALE_TYPE = 1
+        AND ASO.DELETED = 0
+        and ASM.SALE_MATERIAL_ID IS NOT NULL
+        <if test="startTime != null">
+            and to_date(#{startTime},'yyyy-mm-dd hh24:mi:ss') &lt;=  to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss')
+            and to_date(#{endTime}, 'yyyy-mm-dd hh24:mi:ss') >=  to_date(to_char(ASOM.SALE_DATE_OF_RECEIPT-1,'yyyy-mm-dd hh24:mi:ss'),'yyyy-mm-dd hh24:mi:ss')
+        </if>
+        order by ASO.SALE_ORDER_ID  DESC,
+        OO.ORDER_ID DESC
+    </select>
+
     <select id="getSaleSteelReportNew" resultType="java.util.Map" parameterType="java.util.Map">
         SELECT * FROM (
         SELECT distinct OO.ORDER_ID "orderId",

+ 2 - 1
src/main/resources/com/steerinfo/dil/mapper/TmstruckLeaveFactoryResultMapper.xml

@@ -1355,7 +1355,8 @@
                  LEFT JOIN AMS_SALE_MATERIAL ASM
                            ON ASM.SALE_MATERIAL_ID = ASTM.MATERIAL_ID
         where  ASM.MATERIAL_ID=#{materialid}
-          and OO.order_number=#{orderNumber} and oo.order_status=5
+          and OO.order_number=#{orderNumber} and oo.order_status in (2,5)
+            FETCH NEXT 1 ROW ONLY
     </select>
     <!--select oom.order_material_number  "materialNumber"
         from omstruck_order oo