zx vor 3 Jahren
Ursprung
Commit
4a5399e042
26 geänderte Dateien mit 2453 neuen und 460 gelöschten Zeilen
  1. 2 2
      pom.xml
  2. 90 15
      src/main/java/com/steerinfo/dil/controller/AmsRailOffsetDayplanController.java
  3. 50 47
      src/main/java/com/steerinfo/dil/controller/AmsSalePlanController.java
  4. 53 6
      src/main/java/com/steerinfo/dil/controller/AmstruckInwardPlanController.java
  5. 45 28
      src/main/java/com/steerinfo/dil/controller/AmstruckInwardRequirementController.java
  6. 9 2
      src/main/java/com/steerinfo/dil/mapper/AmsRailOffsetDayplanMapper.java
  7. 4 0
      src/main/java/com/steerinfo/dil/mapper/AmstruckInwardPlanMapper.java
  8. 3 0
      src/main/java/com/steerinfo/dil/mapper/AmstruckInwardRequirementMapper.java
  9. 20 0
      src/main/java/com/steerinfo/dil/mapper/AmstruckRequirementMaterialMapper.java
  10. 49 65
      src/main/java/com/steerinfo/dil/model/AmsRailOffsetDayplan.java
  11. 25 10
      src/main/java/com/steerinfo/dil/model/AmstruckInwardPlan.java
  12. 35 4
      src/main/java/com/steerinfo/dil/model/AmstruckInwardRequirement.java
  13. 183 0
      src/main/java/com/steerinfo/dil/model/AmstruckRequirementMaterial.java
  14. 19 2
      src/main/java/com/steerinfo/dil/service/IAmsRailOffsetDayplanService.java
  15. 5 1
      src/main/java/com/steerinfo/dil/service/IAmstruckInwardPlanService.java
  16. 4 1
      src/main/java/com/steerinfo/dil/service/IAmstruckInwardRequirementService.java
  17. 119 12
      src/main/java/com/steerinfo/dil/service/impl/AmsRailOffsetDayplanServiceImpl.java
  18. 50 10
      src/main/java/com/steerinfo/dil/service/impl/AmstruckInwardPlanServiceImpl.java
  19. 88 7
      src/main/java/com/steerinfo/dil/service/impl/AmstruckInwardRequirementServiceImpl.java
  20. 2 0
      src/main/java/com/steerinfo/dil/util/DataChange.java
  21. 774 77
      src/main/resources/com/steerinfo/dil/mapper/AmsRailOffsetDayplanMapper.xml
  22. 27 11
      src/main/resources/com/steerinfo/dil/mapper/AmsSalePlanMapper.xml
  23. 263 48
      src/main/resources/com/steerinfo/dil/mapper/AmstruckInwardPlanMapper.xml
  24. 180 111
      src/main/resources/com/steerinfo/dil/mapper/AmstruckInwardRequirementMapper.xml
  25. 1 1
      src/main/resources/com/steerinfo/dil/mapper/AmstruckPurplanMapper.xml
  26. 353 0
      src/main/resources/com/steerinfo/dil/mapper/AmstruckRequirementMaterialMapper.xml

+ 2 - 2
pom.xml

@@ -111,8 +111,8 @@
                     <!--包名-->
                     <targetPackage>com.steerinfo.dil</targetPackage>
                     <tables>
-                        <param>AMSTRUCK_REQUIREMENT_PLAN</param><!--销售计划-->
-<!--                        <param>AMS_SALE_PLAN_MATERIAL</param>&lt;!&ndash;销售计划物资中间表&ndash;&gt;-->
+<!--                        <param>AMSTRUCK_INWARD_REQUIREMENT</param>&lt;!&ndash;销售计划&ndash;&gt;-->
+<!--                        <param>AMSTRUCK_INWARD_REQUIREMENT</param>&lt;!&ndash;销售计划物资中间表&ndash;&gt;-->
 <!--                        <param>AMSTRUCK_RAIL_DAYPLAN</param>&lt;!&ndash;销售计划物资中间表&ndash;&gt;-->
 <!--                        <param>AMS_CONTRACT_TRANSPORT_PRICE</param>&lt;!&ndash;销售订单&ndash;&gt;-->
 <!--                        <param>AMS_SALE_ORDER_MATERIAL</param>&lt;!&ndash;销售订单车序号表&ndash;&gt;-->

+ 90 - 15
src/main/java/com/steerinfo/dil/controller/AmsRailOffsetDayplanController.java

@@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -31,30 +32,48 @@ public class AmsRailOffsetDayplanController extends BaseRESTfulController {
 
     @ApiModelProperty(value = "新增钢材发往异地库计划")
     @PostMapping("/addRailOffsetDayplan")
-    public RESTfulResult addRailOffsetDayplan(@RequestBody AmsRailOffsetDayplan amsRailOffsetDayplan) {
-        int i = amsRailOffsetDayplanService.insert(amsRailOffsetDayplan);
-        return success(i);
+    public RESTfulResult addRailOffsetDayplan(@RequestBody Map<String,Object> mapValue) {
+        int result = amsRailOffsetDayplanService.insert(mapValue);
+        return success(result);
     }
 
-    @ApiModelProperty(value = "通过主键Id查询发运异地库数据")
-    @PostMapping("/getRailOffseDayMes")
-    public RESTfulResult getRailOffseDayMes(Integer dayplanId) {
+
+    @ApiModelProperty(value = "修改渲染")
+    @PostMapping("/getRailOffseDayMes/{dayplanId}")
+    public RESTfulResult getRailOffseDayMes(@PathVariable("dayplanId") Integer dayplanId) {
         List<Map<String, Object>> mes = amsRailOffsetDayplanMapper.getRailOffseDayMes(dayplanId);
         return success(mes);
     }
 
     @ApiModelProperty(value = "通过发运计划主键查询关联所有物资信息")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "apiId", value = "362", required = false, dataType = "BigDecimal")
+    })
     @PostMapping("/getMaterialMesByDayPlanId")
-    public RESTfulResult getMaterialMesByDayPlanId(Integer dayplanId) {
-        List<Map<String, Object>> mes = amsRailOffsetDayplanMapper.getMaterialMesByDayPlanId(dayplanId);
-        return success(mes);
+    public RESTfulResult getMaterialMesByDayPlanId(@RequestBody(required = false) Map<String,Object> mapValue,
+                                                   Integer pageNum,
+                                                   Integer pageSize,
+                                                   Integer apiId,
+                                                   @RequestParam Integer dayplanId) {
+        if (mapValue == null) {
+            mapValue = new HashMap<>();
+        }
+        mapValue.put("dayplanId",dayplanId);
+        List<Map<String, Object>> list = amsRailOffsetDayplanService.getMaterialMesByDayPlanId(mapValue);
+        PageHelper.startPage(pageNum, pageSize);
+        //分页查询数据
+        List<Map<String, Object>> columnList = amsRailOffsetDayplanService.getMaterialMesByDayPlanId(mapValue);
+        PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
+        return success(data);
     }
 
     @ApiModelProperty(value = "删除钢材发往异地库计划")
-    @PostMapping("/deleteRailOffsetDayplan/{dayPlanId}")
-    public RESTfulResult deleteTruckRailDayPlan(@PathVariable("dayPlanId") BigDecimal dayPlanId) {
-        amsRailOffsetDayplanService.delete(dayPlanId);
-        return success("删除成功");
+    @PostMapping("/deleteRailOffsetDayplan/{dayplanId}")
+    public RESTfulResult deleteTruckRailDayPlan(@PathVariable("dayplanId") Integer dayplanId) {
+        int result = amsRailOffsetDayplanService.deleteTruckRailDayPlan(new BigDecimal(dayplanId));
+        return success(result);
     }
 
     @ApiModelProperty(value = "修改钢材发往异地库计划")
@@ -66,6 +85,21 @@ public class AmsRailOffsetDayplanController extends BaseRESTfulController {
         amsRailOffsetDayplanService.update(amsRailOffsetDayplan);
         return success("修改成功");
     }
+
+    @ApiModelProperty(value = "下发钢材发往异地库计划")
+    @PostMapping("/issueRailOffsetDayplan")
+    public RESTfulResult issueRailOffsetDayplan(@RequestBody List<Map<String,Object>> mapList) {
+        int result = amsRailOffsetDayplanService.issueRailOffsetDayplan(mapList);
+        return success(result);
+    }
+
+    @ApiModelProperty(value = "接收钢材发往异地库计划")
+    @PostMapping("/receiveRailOffsetDayplan/{dayplanId}")
+    public RESTfulResult receiveRailOffsetDayplan(@PathVariable("dayplanId") Integer dayplanId) {
+        int result = amsRailOffsetDayplanService.receiveRailOffsetDayplan(dayplanId);
+        return success(result);
+    }
+
     /**
      * 查询钢材发往异地库计划
      */
@@ -73,13 +107,23 @@ public class AmsRailOffsetDayplanController extends BaseRESTfulController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
             @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
-            @ApiImplicitParam(name = "apiId", value = "185", required = false, dataType = "BigDecimal")
+            @ApiImplicitParam(name = "apiId", value = "183", required = false, dataType = "BigDecimal")
     })
     @PostMapping("/getRailOffsetDayplan")
     public RESTfulResult getRailOffsetDayplan(@RequestBody(required = false) Map<String,Object> mapValue,
                                               Integer pageNum,
                                               Integer pageSize,
-                                              Integer apiId) {
+                                              Integer apiId,
+                                              Integer dayplanReceiveStatus,
+                                              Integer carrierId
+                                              ) {
+        if (mapValue == null) {
+            mapValue = new HashMap<>();
+        }
+        if (carrierId != null && !"undefined".equals(carrierId.toString())) {
+            mapValue.put("carrierId", new BigDecimal(carrierId));
+        }
+        mapValue.put("dayplanReceiveStatus",new BigDecimal(dayplanReceiveStatus));
         List<Map<String, Object>> list = amsRailOffsetDayplanService.getRailOffsetDayplan(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页查询数据
@@ -87,4 +131,35 @@ public class AmsRailOffsetDayplanController extends BaseRESTfulController {
         PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
         return success(data);
     }
+
+    @PostMapping("/getRailOffsetDayplanId")
+    public RESTfulResult getRailOffsetDayplanId(@RequestBody(required = false) Map<String,Object> mapValue,
+                                              Integer pageNum,
+                                              Integer pageSize,
+                                              Integer apiId,
+                                              Integer dayPlanId
+    ) {
+        if (mapValue == null) {
+            mapValue = new HashMap<>();
+        }
+
+        mapValue.put("dayPlanId",new BigDecimal(dayPlanId));
+        List<Map<String, Object>> list = amsRailOffsetDayplanService.getRailOffsetDayplanId(mapValue);
+        PageHelper.startPage(pageNum, pageSize);
+        //分页查询数据
+        List<Map<String, Object>> columnList = amsRailOffsetDayplanService.getRailOffsetDayplanId(mapValue);
+        PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
+        return success(data);
+    }
+
+    /**
+     * 到站下拉
+     * @return
+     */
+    @GetMapping("/getdayPlanToTheStationId")
+    public RESTfulResult getdayPlanToTheStationId() {
+        List<Map<String,Object>> mapList = amsRailOffsetDayplanService.getdayPlanToTheStationId();
+        return success(mapList);
+    }
+
 }

+ 50 - 47
src/main/java/com/steerinfo/dil/controller/AmsSalePlanController.java

@@ -156,51 +156,54 @@ public class AmsSalePlanController extends BaseRESTfulController {
     }
 
 
-    @ApiModelProperty(value = "查询所有的钢材物资")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
-            @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
-            @ApiImplicitParam(name = "apiId", value = "232", required = false, dataType = "BigDecimal")
-    })
-    @PostMapping("/getAllSteelMaterialMes")
-    public RESTfulResult getAllSteelMaterialMes(@RequestBody(required = false) Map<String,Object> mapValue,
-                                            Integer pageNum,
-                                            Integer pageSize,
-                                            Integer apiId,
-                                            String con) {
-
-        //框计算
-        if(con != null){
-            if(!"undefined".equals(con)){
-                //设置要查询的索引名称
-                String index="get_materialsteelid_list";
-                //获取查询结果
-                return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));
-            }
-        }
-
-        List<Map<String, Object>> list = null;
-        //如果有条件查询则跳过初始化,和创建索引
-        if(mapValue.size() == 0){
-            //将查询结果存入索引中
-            list = amsSalePlanService.getAllSteelMaterialMes(mapValue);
-            Map<String, Object> map = new HashMap<>();
-            //添加索引
-            map.put("index","get_materialsteelid_list");
-            //添加id
-            map.put("indexId","steelMaterialId");
-            list.add(map);
-            //新建索引
-            esFeign.insertIndex(list);
-            //删除
-            list.remove(list.size()-1);
-        }
-        if(list == null)
-            list = amsSalePlanService.getAllSteelMaterialMes(mapValue);
-        PageHelper.startPage(pageNum,pageSize);
-        //分页查询数据
-        List<Map<String, Object>> columnList = amsSalePlanService.getAllSteelMaterialMes(mapValue);
-        PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
-        return success(data);
-    }
+//    @ApiModelProperty(value = "查询所有的钢材物资")
+//    @ApiImplicitParams({
+//            @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
+//            @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
+//            @ApiImplicitParam(name = "apiId", value = "232", required = false, dataType = "BigDecimal")
+//    })
+//    @PostMapping("/getAllSteelMaterialMes")
+//    public RESTfulResult getAllSteelMaterialMes(@RequestBody(required = false) Map<String,Object> mapValue,
+//                                            Integer pageNum,
+//                                            Integer pageSize,
+//                                            Integer apiId,
+//                                            String con) {
+//
+//        if(con != null){
+//
+//            if(!"undefined".equals(con)){
+//                //设置要查询的索引名称
+//                String index="get_materialsteelid_list";
+//                //获取查询结果
+//                return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));
+//            }
+//        }
+//
+//        List<Map<String, Object>> list = null;
+//        //如果有条件查询则跳过初始化,和创建索引
+//        if(mapValue.size() == 0){
+//            //将查询结果存入索引中
+//            list = amsSalePlanService.getAllSteelMaterialMes(mapValue);
+//            Map<String, Object> map = new HashMap<>();
+//            //添加索引
+//            map.put("index","get_materialsteelid_list");
+//            //添加id
+//            map.put("indexId","steelMaterialId");
+//            list.add(map);
+//            //新建索引
+//            esFeign.insertIndex(list);
+//            //删除
+//            list.remove(list.size()-1);
+//        }
+//        if(list == null){
+//            list = amsSalePlanService.getAllSteelMaterialMes(mapValue);
+//            mapValue.put("con", "%" + con + "%");
+//        }
+//        List<Map<String, Object>> list = amsSalePlanService.getAllSteelMaterialMes(mapValue);
+//        PageHelper.startPage(pageNum,pageSize);
+//        //分页查询数据
+//        List<Map<String, Object>> columnList = amsSalePlanService.getAllSteelMaterialMes(mapValue);
+//        PageListAdd data = columnDataUtil.tableColumnData(apiId, list, columnList);
+//        return success(data);
+//    }
 }

+ 53 - 6
src/main/java/com/steerinfo/dil/controller/AmstruckInwardPlanController.java

@@ -10,11 +10,13 @@ import com.steerinfo.framework.service.pagehelper.PageHelper;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiModelProperty;
+import org.omg.CORBA.OBJ_ADAPTER;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.math.BigDecimal;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -55,7 +57,21 @@ public class AmstruckInwardPlanController extends BaseRESTfulController {
     public RESTfulResult deleteTruckPlan(@PathVariable("planId") BigDecimal planId) {
         int result = amstruckInwardPlanService.deleteTruckPlan(planId);
         return success(result);
+
     }
+
+    /**
+     * 完成运输计划
+     */
+    @PostMapping("/finishTruckPlan/{planId}")
+    public RESTfulResult finishTruckPlan(@PathVariable("planId") Integer planId){
+        AmstruckInwardPlan amstruckInwardPlan = new AmstruckInwardPlan();
+        amstruckInwardPlan.setPlanId(new BigDecimal(planId));
+        amstruckInwardPlan.setPlanStatus(new BigDecimal(4));
+        int i = amstruckInwardPlanService.updateTruckPlan(amstruckInwardPlan);
+        return success(i);
+    }
+
     /**
      * 修改运输计划
      */
@@ -73,15 +89,24 @@ public class AmstruckInwardPlanController extends BaseRESTfulController {
         List<Map<String,Object>> mapList = amstruckInwardPlanService.selectInwardPlanToUpdate(planId);
         return success(mapList);
     }
-
     /**
      * 下发运输计划
      */
-    @PostMapping("/downTruckPlan/{planId}")
-    public RESTfulResult downTruckPlan(@PathVariable("planId") BigDecimal planId) {
-        int result = amstruckInwardPlanService.downTruckPlan(planId);
+    @PostMapping("/downTruckPlan")
+    public RESTfulResult downTruckPlan(@RequestBody List<Map<String, Object>> mapList) {
+        int result = amstruckInwardPlanService.downTruckPlan(mapList);
+        return success(result);
+    }
+
+    /**
+     * 接收计划
+     */
+    @PostMapping("/receiveInwardPlan/{planId}")
+    public RESTfulResult receiveInwardPlan(@PathVariable("planId") BigDecimal planId) {
+        int result = amstruckInwardPlanService.receiveInwardPlan(planId);
         return success(result);
     }
+
     /**
      * 展示未下发的运输计划
      * @param mapValue
@@ -94,13 +119,26 @@ public class AmstruckInwardPlanController extends BaseRESTfulController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
             @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = false, dataType = "Integer"),
-            @ApiImplicitParam(name = "apiId", value = "181", required = false, dataType = "BigDecimal")
+            @ApiImplicitParam(name = "apiId", value = "0:257/1,2:258", required = false, dataType = "BigDecimal")
     })
     @PostMapping("/getTruckPlanList")
     public RESTfulResult getTruckPlanList(@RequestBody(required = false) Map<String,Object> mapValue,
                                           Integer pageNum,
                                           Integer pageSize,
-                                          Integer apiId) {
+                                          Integer apiId,
+                                          Integer planStatus,
+                                          Integer carrierId,
+                                          Integer planId) {
+        if (mapValue == null) {
+            mapValue = new HashMap<>();
+        }
+        if (carrierId != null && !"undefined".equals(carrierId.toString())) {
+            mapValue.put("carrierId",new BigDecimal(carrierId));
+        }
+        if (planId != null && !"undefined".equals(planId.toString())) {
+            mapValue.put("planId",new BigDecimal(planId));
+        }
+        mapValue.put("planStatus",new BigDecimal(planStatus));
         List<Map<String, Object>> list = amstruckInwardPlanService.getTruckPlanList(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页查询数据
@@ -110,4 +148,13 @@ public class AmstruckInwardPlanController extends BaseRESTfulController {
     }
 
 
+    /**
+     * 承运商下拉
+     * @return
+     */
+    @GetMapping("/getCarrierList")
+    public RESTfulResult getCarrierList() {
+        List<Map<String,Object>> mapList = amstruckInwardPlanService.getCarrierList();
+        return success(mapList);
+    }
 }

+ 45 - 28
src/main/java/com/steerinfo/dil/controller/AmstruckInwardRequirementController.java

@@ -50,8 +50,8 @@ public class AmstruckInwardRequirementController extends BaseRESTfulController {
      *新增用车需求
      */
     @PostMapping("/addTruckRequirement")
-    public RESTfulResult addTruckRequirement(@RequestBody AmstruckInwardRequirement amstruckInwardRequirement) {
-        int result = amstruckInwardRequirementService.insert(amstruckInwardRequirement);
+    public RESTfulResult addTruckRequirement(@RequestBody Map<String,Object> mapValue) {
+        int result = amstruckInwardRequirementService.insert(mapValue);
         return success(result);
     }
     /**
@@ -165,35 +165,35 @@ public class AmstruckInwardRequirementController extends BaseRESTfulController {
     public RESTfulResult getPurchaseIdByBatch(@RequestBody(required = false) Map<String,Object> mapValue,
                                                  Integer pageNum,
                                                  Integer pageSize,
-                                                 Integer apiId,
-                                                 String con) {
-        if (con != null) {
-            if (!con.equals("undefined")) {
-                String index="get_purchase_batch";//设置要查询的索引名称
-                return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
-            }
-        }
+                                                 Integer apiId) {
+//        if (con != null) {
+//            if (!con.equals("undefined")) {
+//                String index="get_purchase_batch";//设置要查询的索引名称
+//                return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
+//            }
+//        }
         if (mapValue == null) {
             mapValue = new HashMap<>();
         }
-        List<Map<String, Object>> truckRequirementList = null;
-        if (mapValue.size() == 0) {
-            //将查询结果存入索引中
-            truckRequirementList =  amstruckInwardRequirementService.getPurchaseIdByBatch(mapValue);
-            Map<String, Object> map1 = new HashMap<>();
-            //添加索引
-            map1.put("index","get_purchase_batch");
-            //添加id
-            map1.put("indexId","purchaseOrderId");
-            truckRequirementList.add(map1);
-            //新建索引
-            esFeign.insertIndex(truckRequirementList);
-            //删除
-            truckRequirementList.remove(truckRequirementList.size()-1);
-        }
-        if (truckRequirementList == null) {
-            truckRequirementList = amstruckInwardRequirementService.getPurchaseIdByBatch(mapValue);
-        }
+//        List<Map<String, Object>> truckRequirementList = null;
+//        if (mapValue.size() == 0) {
+//            //将查询结果存入索引中
+//            truckRequirementList =  amstruckInwardRequirementService.getPurchaseIdByBatch(mapValue);
+//            Map<String, Object> map1 = new HashMap<>();
+//            //添加索引
+//            map1.put("index","get_purchase_batch");
+//            //添加id
+//            map1.put("indexId","purchaseOrderId");
+//            truckRequirementList.add(map1);
+//            //新建索引
+//            esFeign.insertIndex(truckRequirementList);
+//            //删除
+//            truckRequirementList.remove(truckRequirementList.size()-1);
+//        }
+//        if (truckRequirementList == null) {
+//            truckRequirementList = amstruckInwardRequirementService.getPurchaseIdByBatch(mapValue);
+//        }
+        List<Map<String, Object>> truckRequirementList = amstruckInwardRequirementService.getPurchaseIdByBatch(mapValue);
         PageHelper.startPage(pageNum, pageSize);
         //分页查询数据
         List<Map<String, Object>> columnList = amstruckInwardRequirementService.getPurchaseIdByBatch(mapValue);
@@ -201,6 +201,15 @@ public class AmstruckInwardRequirementController extends BaseRESTfulController {
         return success(data);
     }
 
+
+    //异地库下拉框
+    @GetMapping("/getOffsetWarehouse")
+    public RESTfulResult getOffsetWarehouse(){
+        List<Map<String,Object>> mapList =  amstruckInwardRequirementService.getOffsetWareHouse();
+        return success(mapList);
+    }
+
+
     @ApiModelProperty(value = "仓库模代框")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),
@@ -247,12 +256,20 @@ public class AmstruckInwardRequirementController extends BaseRESTfulController {
         return success(data);
     }
 
+    /**
+     * 承运商下拉
+     * @return
+     */
     @GetMapping("/getCapacityType")
     public RESTfulResult getCapacityType() {
         List<Map<String,Object>> mapList = amstruckInwardRequirementService.getCapacityType();
         return success(mapList);
     }
 
+    /**
+     * 发货单位下拉
+     * @return
+     */
     @GetMapping("/getShipperUser")
     public RESTfulResult getShipperUser() {
         List<Map<String,Object>> mapList = amstruckInwardRequirementService.getShipperUser();

+ 9 - 2
src/main/java/com/steerinfo/dil/mapper/AmsRailOffsetDayplanMapper.java

@@ -14,7 +14,7 @@ import java.util.Map;
 public interface AmsRailOffsetDayplanMapper extends IBaseMapper<AmsRailOffsetDayplan, BigDecimal> {
 
     @Select("select seq_AMS_OTHER.nextval from dual")
-    Integer selectMaxId();
+    BigDecimal selectMaxId();
 
     //展示钢材发往异地库日计划
     List<Map<String, Object>> getRailOffsetDayplan(Map<String, Object> mapValue);
@@ -23,5 +23,12 @@ public interface AmsRailOffsetDayplanMapper extends IBaseMapper<AmsRailOffsetDay
     List<Map<String, Object>> getRailOffseDayMes(Integer dayplanId);
 
     //通过发运计划主键查询关联所有物资信息
-    List<Map<String, Object>> getMaterialMesByDayPlanId(Integer dayplanId);
+    List<Map<String, Object>> getMaterialMesByDayPlanId(Map<String,Object> mapValue);
+
+    // 到站下拉框
+    List<Map<String, Object>> getdayPlanToTheStationId();
+
+
+    //根据ID查询日计划
+    List<Map<String, Object>> getRailOffsetDayplanId(Map<String, Object> mapValue);
 }

+ 4 - 0
src/main/java/com/steerinfo/dil/mapper/AmstruckInwardPlanMapper.java

@@ -18,4 +18,8 @@ public interface AmstruckInwardPlanMapper extends IBaseMapper<AmstruckInwardPlan
 
     // 查询修改渲染
     List<Map<String, Object>> selectInwardPlanToUpdate(BigDecimal planId);
+
+    List<Map<String, Object>> getCarrierList();
+
+    List<Map<String, Object>> getIssuedPlanList(Map<String, Object> mapValue);
 }

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

@@ -36,4 +36,7 @@ public interface AmstruckInwardRequirementMapper extends IBaseMapper<AmstruckInw
 
     // 展示用车地点
     List<Map<String, Object>> getWareHouse(Map<String, Object> mapValue);
+
+    // 拿到物资id
+    BigDecimal getMaterialId(BigDecimal purchaseOrderId);
 }

+ 20 - 0
src/main/java/com/steerinfo/dil/mapper/AmstruckRequirementMaterialMapper.java

@@ -0,0 +1,20 @@
+package com.steerinfo.dil.mapper;
+
+import com.steerinfo.dil.model.AmstruckRequirementMaterial;
+import com.steerinfo.framework.mapper.IBaseMapper;
+import java.math.*;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+
+@Mapper
+public interface AmstruckRequirementMaterialMapper extends IBaseMapper<AmstruckRequirementMaterial, BigDecimal> {
+
+    @Select("select seq__REQUIREMENT_MATERIAL.nextval from dual")
+    BigDecimal selectRequirementMaterialId();
+
+
+    List<Map<String, Object>> getOffsetWarehouse();
+}

+ 49 - 65
src/main/java/com/steerinfo/dil/model/AmsRailOffsetDayplan.java

@@ -1,19 +1,15 @@
 package com.steerinfo.dil.model;
 
-import com.baomidou.mybatisplus.annotation.TableField;
 import com.steerinfo.framework.model.IBasePO;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
-
 import java.math.BigDecimal;
 import java.util.Date;
-import java.util.List;
-import java.util.Map;
 
 @ApiModel(value="发运钢材到异地库日计划")
 public class AmsRailOffsetDayplan implements IBasePO<BigDecimal> {
     /**
-     * 发运计划ID(DAYPLAN_ID,DECIMAL,38)
+     * 发运计划ID(DAYPLAN_ID,DECIMAL,0)
      */
     @ApiModelProperty(value="发运计划ID",required=true)
     private BigDecimal dayplanId;
@@ -31,7 +27,7 @@ public class AmsRailOffsetDayplan implements IBasePO<BigDecimal> {
     private Date dayplanDate;
 
     /**
-     * 发货单位ID(SHIPPER_ID,DECIMAL,38)
+     * 发货单位ID(SHIPPER_ID,DECIMAL,0)
      */
     @ApiModelProperty(value="发货单位ID",required=false)
     private BigDecimal shipperId;
@@ -41,51 +37,27 @@ public class AmsRailOffsetDayplan implements IBasePO<BigDecimal> {
      */
     @ApiModelProperty(value="发货日期",required=false)
     private Date dayplanDeliveryDate;
-    /**
-     * 承运商ID(DAYPLAN_MATERIAL_WEIGHT,DECIMAL,0)
-     */
-    @ApiModelProperty(value="承运商ID",required=false)
-    private BigDecimal carrierId;
 
-    public BigDecimal getCarrierId() {
-        return carrierId;
-    }
-
-    public void setCarrierId(BigDecimal carrierId) {
-        this.carrierId = carrierId;
-    }
     /**
-     * 自有汽车数(DAYPLAN_OWN_CARS_AMOUT,DECIMAL,38)
+     * 自有汽车数(DAYPLAN_OWN_CARS_AMOUT,DECIMAL,0)
      */
     @ApiModelProperty(value="自有汽车数",required=false)
     private BigDecimal dayplanOwnCarsAmout;
 
     /**
-     * 专用线ID(DAYPLAN_DEDICATED_LINE_ID,DECIMAL,38)
-     */
-    @ApiModelProperty(value="专用线ID",required=false)
-    private BigDecimal dayplanDedicatedLineId;
-
-    /**
-     * 到站ID(DAYPLAN_TO_THE_STATION_ID,DECIMAL,38)
+     * 到站ID(DAYPLAN_TO_THE_STATION_ID,DECIMAL,0)
      */
     @ApiModelProperty(value="到站ID",required=false)
     private BigDecimal dayplanToTheStationId;
 
     /**
-     * 移库单位ID(TRANSFER_UNIT_ID,DECIMAL,38)
-     */
-    @ApiModelProperty(value="移库单位ID",required=false)
-    private BigDecimal transferUnitId;
-
-    /**
-     * 车皮数(DAYPLAN_WAGON_NUMBER,DECIMAL,38)
+     * 车皮数(DAYPLAN_WAGON_NUMBER,DECIMAL,0)
      */
     @ApiModelProperty(value="车皮数",required=false)
     private BigDecimal dayplanWagonNumber;
 
     /**
-     * 收货单位(RECEIVING_UNIT_ID,DECIMAL,38)
+     * 收货单位(RECEIVING_UNIT_ID,DECIMAL,0)
      */
     @ApiModelProperty(value="收货单位",required=false)
     private BigDecimal receivingUnitId;
@@ -103,9 +75,9 @@ public class AmsRailOffsetDayplan implements IBasePO<BigDecimal> {
     private String dayplanConsigneeTel;
 
     /**
-     * 接收状态(0;未接收,1:已接收)(DAYPLAN_RECEIVE_STATUS,DECIMAL,38)
+     * 接收状态(0;未下发,1:已下发,2:已接收)(DAYPLAN_RECEIVE_STATUS,DECIMAL,0)
      */
-    @ApiModelProperty(value="接收状态(0;未接收,1:已接收)",required=false)
+    @ApiModelProperty(value="接收状态(0;未下发,1:已下发,2:已接收)",required=false)
     private BigDecimal dayplanReceiveStatus;
 
     /**
@@ -138,21 +110,24 @@ public class AmsRailOffsetDayplan implements IBasePO<BigDecimal> {
     @ApiModelProperty(value="记录创建或修改备注",required=false)
     private String insertUpdateRemark;
 
-    
-    public List<Map<String, Object>> getMapList() {
-        return mapList;
-    }
+    /**
+     * 承运商ID(CARRIER_ID,DECIMAL,38)
+     */
+    @ApiModelProperty(value="承运商ID",required=false)
+    private BigDecimal carrierId;
 
-    public void setMapList(List<Map<String, Object>> mapList) {
-        this.mapList = mapList;
-    }
+    /**
+     * 发站ID(DAYPLAN_SEND_STATION_ID,DECIMAL,0)
+     */
+    @ApiModelProperty(value="发站ID",required=false)
+    private BigDecimal dayplanSendStationId;
 
     /**
-     * 物资信息列表
+     * 0:未删除,1:已删除(DELETED,DECIMAL,0)
      */
-    @TableField(exist = false)
-    private List<Map<String, Object>> mapList;
-    
+    @ApiModelProperty(value="0:未删除,1:已删除",required=false)
+    private BigDecimal deleted;
+
     private static final long serialVersionUID = 1L;
 
     @Override
@@ -213,14 +188,6 @@ public class AmsRailOffsetDayplan implements IBasePO<BigDecimal> {
         this.dayplanOwnCarsAmout = dayplanOwnCarsAmout;
     }
 
-    public BigDecimal getDayplanDedicatedLineId() {
-        return dayplanDedicatedLineId;
-    }
-
-    public void setDayplanDedicatedLineId(BigDecimal dayplanDedicatedLineId) {
-        this.dayplanDedicatedLineId = dayplanDedicatedLineId;
-    }
-
     public BigDecimal getDayplanToTheStationId() {
         return dayplanToTheStationId;
     }
@@ -229,14 +196,6 @@ public class AmsRailOffsetDayplan implements IBasePO<BigDecimal> {
         this.dayplanToTheStationId = dayplanToTheStationId;
     }
 
-    public BigDecimal getTransferUnitId() {
-        return transferUnitId;
-    }
-
-    public void setTransferUnitId(BigDecimal transferUnitId) {
-        this.transferUnitId = transferUnitId;
-    }
-
     public BigDecimal getDayplanWagonNumber() {
         return dayplanWagonNumber;
     }
@@ -317,6 +276,30 @@ public class AmsRailOffsetDayplan implements IBasePO<BigDecimal> {
         this.insertUpdateRemark = insertUpdateRemark == null ? null : insertUpdateRemark.trim();
     }
 
+    public BigDecimal getCarrierId() {
+        return carrierId;
+    }
+
+    public void setCarrierId(BigDecimal carrierId) {
+        this.carrierId = carrierId;
+    }
+
+    public BigDecimal getDayplanSendStationId() {
+        return dayplanSendStationId;
+    }
+
+    public void setDayplanSendStationId(BigDecimal dayplanSendStationId) {
+        this.dayplanSendStationId = dayplanSendStationId;
+    }
+
+    public BigDecimal getDeleted() {
+        return deleted;
+    }
+
+    public void setDeleted(BigDecimal deleted) {
+        this.deleted = deleted;
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
@@ -329,9 +312,7 @@ public class AmsRailOffsetDayplan implements IBasePO<BigDecimal> {
         sb.append(", shipperId=").append(shipperId);
         sb.append(", dayplanDeliveryDate=").append(dayplanDeliveryDate);
         sb.append(", dayplanOwnCarsAmout=").append(dayplanOwnCarsAmout);
-        sb.append(", dayplanDedicatedLineId=").append(dayplanDedicatedLineId);
         sb.append(", dayplanToTheStationId=").append(dayplanToTheStationId);
-        sb.append(", transferUnitId=").append(transferUnitId);
         sb.append(", dayplanWagonNumber=").append(dayplanWagonNumber);
         sb.append(", receivingUnitId=").append(receivingUnitId);
         sb.append(", dayplanConsigneeName=").append(dayplanConsigneeName);
@@ -342,6 +323,9 @@ public class AmsRailOffsetDayplan implements IBasePO<BigDecimal> {
         sb.append(", updateUsername=").append(updateUsername);
         sb.append(", updateTime=").append(updateTime);
         sb.append(", insertUpdateRemark=").append(insertUpdateRemark);
+        sb.append(", carrierId=").append(carrierId);
+        sb.append(", dayplanSendStationId=").append(dayplanSendStationId);
+        sb.append(", deleted=").append(deleted);
         sb.append(", serialVersionUID=").append(serialVersionUID);
         sb.append("]");
         return sb.toString();

+ 25 - 10
src/main/java/com/steerinfo/dil/model/AmstruckInwardPlan.java

@@ -3,7 +3,6 @@ package com.steerinfo.dil.model;
 import com.steerinfo.framework.model.IBasePO;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
-
 import java.math.BigDecimal;
 import java.util.Date;
 
@@ -76,18 +75,16 @@ public class AmstruckInwardPlan implements IBasePO<BigDecimal> {
     private String insertUpdateRemark;
 
     /**
-     * 逻辑删除(DELETED,DECIMAL,38)
+     * 0:未删除;1:已删除(DELETED,DECIMAL,0)
      */
-    @ApiModelProperty(value="逻辑删除",required=false)
+    @ApiModelProperty(value="0:未删除;1:已删除",required=false)
     private BigDecimal deleted;
 
-    public BigDecimal getDeleted() {
-        return deleted;
-    }
-
-    public void setDeleted(BigDecimal deleted) {
-        this.deleted = deleted;
-    }
+    /**
+     * 计划下发人(PLAN_ISSUE_NAME,VARCHAR,20)
+     */
+    @ApiModelProperty(value="计划下发人",required=false)
+    private String planIssueName;
 
     private static final long serialVersionUID = 1L;
 
@@ -189,6 +186,22 @@ public class AmstruckInwardPlan implements IBasePO<BigDecimal> {
         this.insertUpdateRemark = insertUpdateRemark == null ? null : insertUpdateRemark.trim();
     }
 
+    public BigDecimal getDeleted() {
+        return deleted;
+    }
+
+    public void setDeleted(BigDecimal deleted) {
+        this.deleted = deleted;
+    }
+
+    public String getPlanIssueName() {
+        return planIssueName;
+    }
+
+    public void setPlanIssueName(String planIssueName) {
+        this.planIssueName = planIssueName == null ? null : planIssueName.trim();
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
@@ -206,6 +219,8 @@ public class AmstruckInwardPlan implements IBasePO<BigDecimal> {
         sb.append(", updateUsername=").append(updateUsername);
         sb.append(", updateTime=").append(updateTime);
         sb.append(", insertUpdateRemark=").append(insertUpdateRemark);
+        sb.append(", deleted=").append(deleted);
+        sb.append(", planIssueName=").append(planIssueName);
         sb.append(", serialVersionUID=").append(serialVersionUID);
         sb.append("]");
         return sb.toString();

+ 35 - 4
src/main/java/com/steerinfo/dil/model/AmstruckInwardRequirement.java

@@ -3,6 +3,7 @@ package com.steerinfo.dil.model;
 import com.steerinfo.framework.model.IBasePO;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
+
 import java.math.BigDecimal;
 import java.util.Date;
 
@@ -51,9 +52,9 @@ public class AmstruckInwardRequirement implements IBasePO<BigDecimal> {
     private BigDecimal requirementShipperId;
 
     /**
-     * 费用类别(日常内转费,推进办费用,大修费用,新增建设项目,外委吊车,外委转机,环保绿化项目)(REQUIREMENT_WORK_TYPE,DECIMAL,38)
+     * 费用类别(0:日常内转费,1:推进办费用,2:大修费用,3:新增建设项目,4:外委吊车,5:外委转机,6:环保绿化项目)(REQUIREMENT_WORK_TYPE,DECIMAL,38)
      */
-    @ApiModelProperty(value="费用类别(日常内转费,推进办费用,大修费用,新增建设项目,外委吊车,外委转机,环保绿化项目)",required=false)
+    @ApiModelProperty(value="费用类别(0:日常内转费,1:推进办费用,2:大修费用,3:新增建设项目,4:外委吊车,5:外委转机,6:环保绿化项目)",required=false)
     private BigDecimal requirementWorkType;
 
     /**
@@ -87,9 +88,9 @@ public class AmstruckInwardRequirement implements IBasePO<BigDecimal> {
     private String requirementOverlimit;
 
     /**
-     * 用车单位ID(REQUIREMNT_UNIT_ID,DECIMAL,38)
+     * 用车地点ID(REQUIREMNT_UNIT_ID,DECIMAL,38)
      */
-    @ApiModelProperty(value="用车单位ID",required=false)
+    @ApiModelProperty(value="用车地点ID",required=false)
     private BigDecimal requiremntUnitId;
 
     /**
@@ -134,6 +135,18 @@ public class AmstruckInwardRequirement implements IBasePO<BigDecimal> {
     @ApiModelProperty(value="0:未删除,1:已删除",required=false)
     private BigDecimal deleted;
 
+    /**
+     * 卸货点(REQUIREMENT_UNLOAD_UNIT_ID,DECIMAL,0)
+     */
+    @ApiModelProperty(value="卸货点",required=false)
+    private BigDecimal requirementUnloadUnitId;
+
+    /**
+     * 货位或月台(REQUIREMENT_PLATFORM_ID ,DECIMAL,0)
+     */
+    @ApiModelProperty(value="货位或月台",required=false)
+    private BigDecimal requirementPlatformId;
+
     private static final long serialVersionUID = 1L;
 
     @Override
@@ -314,6 +327,22 @@ public class AmstruckInwardRequirement implements IBasePO<BigDecimal> {
         this.deleted = deleted;
     }
 
+    public BigDecimal getRequirementUnloadUnitId() {
+        return requirementUnloadUnitId;
+    }
+
+    public void setRequirementUnloadUnitId(BigDecimal requirementUnloadUnitId) {
+        this.requirementUnloadUnitId = requirementUnloadUnitId;
+    }
+
+    public BigDecimal getRequirementPlatformId() {
+        return requirementPlatformId;
+    }
+
+    public void setRequirementPlatformId(BigDecimal requirementPlatformId) {
+        this.requirementPlatformId = requirementPlatformId;
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
@@ -341,6 +370,8 @@ public class AmstruckInwardRequirement implements IBasePO<BigDecimal> {
         sb.append(", updateTime=").append(updateTime);
         sb.append(", insertUpdateRemark=").append(insertUpdateRemark);
         sb.append(", deleted=").append(deleted);
+        sb.append(", requirementUnloadUnitId=").append(requirementUnloadUnitId);
+        sb.append(", requirementPlatformId=").append(requirementPlatformId);
         sb.append(", serialVersionUID=").append(serialVersionUID);
         sb.append("]");
         return sb.toString();

+ 183 - 0
src/main/java/com/steerinfo/dil/model/AmstruckRequirementMaterial.java

@@ -0,0 +1,183 @@
+package com.steerinfo.dil.model;
+
+import com.steerinfo.framework.model.IBasePO;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import java.math.BigDecimal;
+import java.util.Date;
+
+@ApiModel(value="需求物资中间表")
+public class AmstruckRequirementMaterial implements IBasePO<BigDecimal> {
+    /**
+     * 主键ID(REQUIREMENT_MATERIAL_ID,DECIMAL,38)
+     */
+    @ApiModelProperty(value="主键ID",required=false)
+    private BigDecimal requirementMaterialId;
+
+    /**
+     * 需求ID(REQUIREMENT_ID,DECIMAL,38)
+     */
+    @ApiModelProperty(value="需求ID",required=false)
+    private BigDecimal requirementId;
+
+    /**
+     * 物资ID(MATERIAL_ID,DECIMAL,38)
+     */
+    @ApiModelProperty(value="物资ID",required=false)
+    private BigDecimal materialId;
+
+    /**
+     * 物资重量(MATERIAL_WEIGHT,DECIMAL,0)
+     */
+    @ApiModelProperty(value="物资重量",required=false)
+    private BigDecimal materialWeight;
+
+    /**
+     * 物资数量(MATERIAL_COUNT,DECIMAL,0)
+     */
+    @ApiModelProperty(value="物资数量",required=false)
+    private BigDecimal materialCount;
+
+    /**
+     * 记录创建人(INSERT_USERNAME,VARCHAR,20)
+     */
+    @ApiModelProperty(value="记录创建人",required=false)
+    private String insertUsername;
+
+    /**
+     * 记录创建时间(INSERT_TIME,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="记录创建时间",required=false)
+    private Date insertTime;
+
+    /**
+     * 记录修改人(UPDATE_USERNAME,VARCHAR,20)
+     */
+    @ApiModelProperty(value="记录修改人",required=false)
+    private String updateUsername;
+
+    /**
+     * 记录修改时间(UPDATE_TIME,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="记录修改时间",required=false)
+    private Date updateTime;
+
+    /**
+     * 记录创建或修改备注(INSERT_UPDATE_REMARK,VARCHAR,100)
+     */
+    @ApiModelProperty(value="记录创建或修改备注",required=false)
+    private String insertUpdateRemark;
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public BigDecimal getId() {
+        return this.requirementMaterialId;
+    }
+
+    @Override
+    public void setId(BigDecimal requirementMaterialId) {
+        this.requirementMaterialId = requirementMaterialId;
+    }
+
+    public BigDecimal getRequirementMaterialId() {
+        return requirementMaterialId;
+    }
+
+    public void setRequirementMaterialId(BigDecimal requirementMaterialId) {
+        this.requirementMaterialId = requirementMaterialId;
+    }
+
+    public BigDecimal getRequirementId() {
+        return requirementId;
+    }
+
+    public void setRequirementId(BigDecimal requirementId) {
+        this.requirementId = requirementId;
+    }
+
+    public BigDecimal getMaterialId() {
+        return materialId;
+    }
+
+    public void setMaterialId(BigDecimal materialId) {
+        this.materialId = materialId;
+    }
+
+    public BigDecimal getMaterialWeight() {
+        return materialWeight;
+    }
+
+    public void setMaterialWeight(BigDecimal materialWeight) {
+        this.materialWeight = materialWeight;
+    }
+
+    public BigDecimal getMaterialCount() {
+        return materialCount;
+    }
+
+    public void setMaterialCount(BigDecimal materialCount) {
+        this.materialCount = materialCount;
+    }
+
+    public String getInsertUsername() {
+        return insertUsername;
+    }
+
+    public void setInsertUsername(String insertUsername) {
+        this.insertUsername = insertUsername == null ? null : insertUsername.trim();
+    }
+
+    public Date getInsertTime() {
+        return insertTime;
+    }
+
+    public void setInsertTime(Date insertTime) {
+        this.insertTime = insertTime;
+    }
+
+    public String getUpdateUsername() {
+        return updateUsername;
+    }
+
+    public void setUpdateUsername(String updateUsername) {
+        this.updateUsername = updateUsername == null ? null : updateUsername.trim();
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    public String getInsertUpdateRemark() {
+        return insertUpdateRemark;
+    }
+
+    public void setInsertUpdateRemark(String insertUpdateRemark) {
+        this.insertUpdateRemark = insertUpdateRemark == null ? null : insertUpdateRemark.trim();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", requirementMaterialId=").append(requirementMaterialId);
+        sb.append(", requirementId=").append(requirementId);
+        sb.append(", materialId=").append(materialId);
+        sb.append(", materialWeight=").append(materialWeight);
+        sb.append(", materialCount=").append(materialCount);
+        sb.append(", insertUsername=").append(insertUsername);
+        sb.append(", insertTime=").append(insertTime);
+        sb.append(", updateUsername=").append(updateUsername);
+        sb.append(", updateTime=").append(updateTime);
+        sb.append(", insertUpdateRemark=").append(insertUpdateRemark);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 19 - 2
src/main/java/com/steerinfo/dil/service/IAmsRailOffsetDayplanService.java

@@ -26,12 +26,29 @@ public interface IAmsRailOffsetDayplanService extends IBaseService<AmsRailOffset
      * 得到最大id
      * @return
      */
-    Integer selectMaxId();
+    BigDecimal selectMaxId();
 
     List<Map<String, Object>> getRailOffsetDayplan(Map<String, Object> mapValue);
     //新增钢材发往异地库日计划
-    int insert(AmsRailOffsetDayplan amsRailOffsetDayplan);
+    int insert(Map<String,Object> mapValue);
 
     //修改钢材发往异地库日计划
     int update(AmsRailOffsetDayplan amsRailOffsetDayplan);
+
+    // 删除钢材发往异地库日计划
+    int deleteTruckRailDayPlan(BigDecimal dayplanId);
+
+    // 下发钢材发往异地库日计划
+    int issueRailOffsetDayplan(List<Map<String, Object>> mapList);
+
+    // 通过发运计划主键查询关联所有物资信息
+    List<Map<String, Object>> getMaterialMesByDayPlanId(Map<String, Object> mapValue);
+
+    // 接收钢材发往异地库计划
+    int receiveRailOffsetDayplan(Integer dayplanId);
+
+    // 到站下拉框
+    List<Map<String, Object>> getdayPlanToTheStationId();
+
+    List<Map<String, Object>> getRailOffsetDayplanId(Map<String, Object> mapValue);
 }

+ 5 - 1
src/main/java/com/steerinfo/dil/service/IAmstruckInwardPlanService.java

@@ -30,7 +30,11 @@ public interface IAmstruckInwardPlanService extends IBaseService<AmstruckInwardP
 
     int updateTruckPlan(AmstruckInwardPlan amstruckInwardPlan);
 
-    int downTruckPlan(BigDecimal planId);
+    int downTruckPlan(List<Map<String,Object>> mapList);
 
     List<Map<String, Object>> selectInwardPlanToUpdate(BigDecimal planId);
+
+    List<Map<String, Object>> getCarrierList();
+
+    int receiveInwardPlan(BigDecimal planId);
 }

+ 4 - 1
src/main/java/com/steerinfo/dil/service/IAmstruckInwardRequirementService.java

@@ -22,7 +22,7 @@ import java.util.Map;
  */
 public interface IAmstruckInwardRequirementService extends IBaseService<AmstruckInwardRequirement, BigDecimal> {
 
-    int insert(AmstruckInwardRequirement amstruckInwardRequirement);
+    int insert(Map<String,Object> mapValue);
 
     List<Map<String, Object>> getTruckRequirementList(Map<String, Object> mapValue);
 
@@ -43,4 +43,7 @@ public interface IAmstruckInwardRequirementService extends IBaseService<Amstruck
     List<Map<String, Object>> getShipperUser();
 
     List<Map<String, Object>> getWareHouse(Map<String, Object> mapValue);
+
+    //异地库下拉框
+    List<Map<String, Object>> getOffsetWareHouse();
 }

+ 119 - 12
src/main/java/com/steerinfo/dil/service/impl/AmsRailOffsetDayplanServiceImpl.java

@@ -9,10 +9,13 @@ import com.steerinfo.dil.service.IAmsRailOffsetDayplanService;
 import com.steerinfo.dil.util.DataChange;
 import com.steerinfo.framework.mapper.IBaseMapper;
 import com.steerinfo.framework.service.impl.BaseServiceImpl;
+import io.swagger.models.auth.In;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.cglib.core.Local;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
+import java.time.LocalDate;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -49,36 +52,71 @@ public class AmsRailOffsetDayplanServiceImpl extends BaseServiceImpl<AmsRailOffs
      * @return
      */
     @Override
-    public Integer selectMaxId() {
+    public BigDecimal selectMaxId() {
         return amsRailOffsetDayplanMapper.selectMaxId();
     }
 
+    /**
+     * 展示钢材发往异地库计划
+     * @param mapValue
+     * @return
+     */
     public List<Map<String, Object>> getRailOffsetDayplan(Map<String, Object> mapValue) {
         return amsRailOffsetDayplanMapper.getRailOffsetDayplan(mapValue);
     }
 
     /**
      * 新增发运钢材到异地库计划
-     * @param amsRailOffsetDayplan
+     * @param mapValue
      * @return
      */
     @Override
-    public int insert(AmsRailOffsetDayplan amsRailOffsetDayplan) {
-        Integer id = selectMaxId();
-        amsRailOffsetDayplan.setDayplanId(new BigDecimal(id));
+    public int insert(Map<String,Object> mapValue) {
+        BigDecimal dayPlanId = selectMaxId();
+        AmsRailOffsetDayplan amsRailOffsetDayplan = new AmsRailOffsetDayplan();
+        Date dayPlanDate = new Date((Long) mapValue.get("dayPlanDate"));
+        Integer shipperId = (Integer) mapValue.get("shipperId");
+        Date dayPlanDeliveryDate = new Date((Long) mapValue.get("dayPlanDeliveryDate"));
+        String dayPlanOwnCarsAmount = (String) mapValue.get("dayPlanOwnCarsAmount");
+        Integer dayPlanToTheStationId = (Integer) mapValue.get("dayPlanToTheStationId");
+        String dayPlanWagonNumber = (String) mapValue.get("dayPlanWagonNumber");
+        String dayPlanConsigneeName = (String) mapValue.get("dayPlanConsigneeName");
+        String dayPlanConsigneeTel = (String) mapValue.get("dayPlanConsigneeTel");
+        Integer unitId = (Integer) mapValue.get("unitId");
+//        Integer dayPlanSendStationId = (Integer) mapValue.get("dayPlanSendStationId");
+//        DataChange dataChange=new DataChange();
+        LocalDate now = LocalDate.now();
+        //获取计划数量
+        String count=dayPlanId+"";
+        //用当前时间和需求数量组成流水号
+        String number="JH"+ now.getYear()+now.getMonthValue()+"-"+count;
+        amsRailOffsetDayplan.setDayplanNo(number);
+        //设置计划状态为未下发
+        amsRailOffsetDayplan.setDayplanId(dayPlanId);
+        amsRailOffsetDayplan.setDayplanDate(dayPlanDate);
+        amsRailOffsetDayplan.setShipperId(new BigDecimal(shipperId));
+        amsRailOffsetDayplan.setDayplanDeliveryDate(dayPlanDeliveryDate);
+        amsRailOffsetDayplan.setDayplanOwnCarsAmout(new BigDecimal(dayPlanOwnCarsAmount));
+        amsRailOffsetDayplan.setDayplanToTheStationId(new BigDecimal(dayPlanToTheStationId));
+        amsRailOffsetDayplan.setDayplanWagonNumber(new BigDecimal(dayPlanWagonNumber));
+        amsRailOffsetDayplan.setDayplanConsigneeName(dayPlanConsigneeName);
+        amsRailOffsetDayplan.setDayplanConsigneeTel(dayPlanConsigneeTel);
+        amsRailOffsetDayplan.setReceivingUnitId(new BigDecimal(unitId));
+//        amsRailOffsetDayplan.setDayplanSendStationId(new BigDecimal(dayPlanSendStationId));
+        amsRailOffsetDayplan.setDayplanReceiveStatus(new BigDecimal(0));
+        amsRailOffsetDayplan.setDeleted(new BigDecimal(0));
         //遍历物资列表添加所有发运计划物资中间表
-        List<Map<String, Object>> mapList = amsRailOffsetDayplan.getMapList();
+        List<Map<String, Object>> mapList = (List<Map<String, Object>>) mapValue.get("selectionList");
         for (Map<String, Object> map : mapList) {
             AmsRailOffsetMaterial amsRailOffsetMaterial = new AmsRailOffsetMaterial();
-            amsRailOffsetMaterial.setId(amsRailOffsetMaterialMapper.selectMaxId());
-            //设置发运计划ID
-            amsRailOffsetMaterial.setDayplanId(new BigDecimal(id));
+            amsRailOffsetMaterial.setOffsetMaterialId(amsRailOffsetMaterialMapper.selectMaxId());
+            // 设置发运计划ID
+            amsRailOffsetMaterial.setDayplanId(dayPlanId);
             amsRailOffsetMaterial.setMaterialId(DataChange.dataToBigDecimal(map.get("materialId")));
-            amsRailOffsetMaterial.setOffsetMaterialWeight(DataChange.dataToBigDecimal(map.get("offsetMaterialWeight")));
-            amsRailOffsetMaterial.setOffsetMaterialNumber(DataChange.dataToBigDecimal(map.get("offsetMaterialNumber")));
+            amsRailOffsetMaterial.setOffsetMaterialNumber(DataChange.dataToBigDecimal(map.get("orderPlanWeight")));
             amsRailOffsetMaterial.setInsertTime(new Date());
             amsRailOffsetMaterial.setInsertUsername("admin");
-            amsRailOffsetMaterialMapper.updateByPrimaryKeySelective(amsRailOffsetMaterial);
+            amsRailOffsetMaterialMapper.insertSelective(amsRailOffsetMaterial);
         }
         amsRailOffsetDayplan.setInsertTime(new Date());
         amsRailOffsetDayplan.setInsertUsername("admin");
@@ -90,4 +128,73 @@ public class AmsRailOffsetDayplanServiceImpl extends BaseServiceImpl<AmsRailOffs
     public int update(AmsRailOffsetDayplan amsRailOffsetDayplan) {
         return amsRailOffsetDayplanMapper.updateByPrimaryKey(amsRailOffsetDayplan);
     }
+
+    /**
+     * 删除钢材发往异地库日计划
+     * @param dayplanId
+     * @return
+     */
+    @Override
+    public int deleteTruckRailDayPlan(BigDecimal dayplanId) {
+        AmsRailOffsetDayplan amsRailOffsetDayplan = amsRailOffsetDayplanMapper.selectByPrimaryKey(dayplanId);
+        amsRailOffsetDayplan.setDeleted(new BigDecimal(1));
+        int result = amsRailOffsetDayplanMapper.updateByPrimaryKeySelective(amsRailOffsetDayplan);
+        return result;
+    }
+
+    /**
+     * 下发钢材发往异地库日计划
+     * @param mapList
+     * @return
+     */
+    @Override
+    public int issueRailOffsetDayplan(List<Map<String, Object>> mapList) {
+        int result = 0;
+        for (Map<String,Object> map : mapList) {
+            Integer dayPlanId = (Integer) map.get("dayPlanId");
+            AmsRailOffsetDayplan amsRailOffsetDayplan = amsRailOffsetDayplanMapper.selectByPrimaryKey(new BigDecimal(dayPlanId));
+            amsRailOffsetDayplan.setDayplanReceiveStatus(new BigDecimal(1));
+            amsRailOffsetDayplan.setCarrierId(new BigDecimal(9));
+            result += amsRailOffsetDayplanMapper.updateByPrimaryKeySelective(amsRailOffsetDayplan);
+        }
+        return result;
+    }
+
+    /**
+     * 通过发运计划主键查询关联所有物资信息
+     * @param mapValue
+     * @return
+     */
+    @Override
+    public List<Map<String, Object>> getMaterialMesByDayPlanId(Map<String, Object> mapValue) {
+        return amsRailOffsetDayplanMapper.getMaterialMesByDayPlanId(mapValue);
+    }
+
+    /**
+     * 接收钢材发往异地库计划
+     * @param dayplanId
+     * @return
+     */
+    @Override
+    public int receiveRailOffsetDayplan(Integer dayplanId) {
+        AmsRailOffsetDayplan amsRailOffsetDayplan = amsRailOffsetDayplanMapper.selectByPrimaryKey(new BigDecimal(dayplanId));
+        amsRailOffsetDayplan.setDayplanReceiveStatus(new BigDecimal(2));
+        int result = amsRailOffsetDayplanMapper.updateByPrimaryKeySelective(amsRailOffsetDayplan);
+        return result;
+    }
+
+    /**
+     * 到站下拉框
+     * @return
+     */
+    @Override
+    public List<Map<String, Object>> getdayPlanToTheStationId() {
+        return amsRailOffsetDayplanMapper.getdayPlanToTheStationId();
+    }
+
+    @Override
+    public List<Map<String, Object>> getRailOffsetDayplanId(Map<String, Object> mapValue) {
+        return amsRailOffsetDayplanMapper.getRailOffsetDayplanId(mapValue);
+
+    }
 }

+ 50 - 10
src/main/java/com/steerinfo/dil/service/impl/AmstruckInwardPlanServiceImpl.java

@@ -1,6 +1,7 @@
 package com.steerinfo.dil.service.impl;
 
 import com.steerinfo.dil.mapper.AmstruckInwardPlanMapper;
+import com.steerinfo.dil.mapper.AmstruckRequirementPlanMapper;
 import com.steerinfo.dil.model.AmstruckInwardPlan;
 import com.steerinfo.dil.model.AmstruckInwardRequirement;
 import com.steerinfo.dil.model.AmstruckRequirementPlan;
@@ -10,8 +11,10 @@ import com.steerinfo.dil.service.IAmstruckRequirementPlanService;
 import com.steerinfo.dil.util.DataChange;
 import com.steerinfo.framework.mapper.IBaseMapper;
 import com.steerinfo.framework.service.impl.BaseServiceImpl;
+import io.swagger.models.auth.In;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.util.Date;
@@ -39,25 +42,27 @@ public class AmstruckInwardPlanServiceImpl extends BaseServiceImpl<AmstruckInwar
     @Autowired
     private IAmstruckInwardRequirementService amstruckInwardRequirementService;
     @Autowired
-    private IAmstruckRequirementPlanService amstruckRequirementPlanService;
+    private AmstruckRequirementPlanMapper amstruckRequirementPlanMapper;
     @Override
     protected IBaseMapper<AmstruckInwardPlan, BigDecimal> getMapper() {
         return amstruckInwardPlanMapper;
     }
 
+    @Transactional
     @Override
     public int insert(Map<String,Object> mapValue) {
         BigDecimal requirementId=new BigDecimal(mapValue.get("requirementId").toString());
         AmstruckRequirementPlan amstruckRequirementPlan = new AmstruckRequirementPlan();
         BigDecimal planId=amstruckInwardPlanMapper.selectOtherId();
+        BigDecimal requirementPlanId = amstruckRequirementPlanMapper.selectOtherId();
+        amstruckRequirementPlan.setRequirementPlanId(requirementPlanId);
         amstruckRequirementPlan.setPlanId(planId);
         amstruckRequirementPlan.setRequirementId(requirementId);
         amstruckRequirementPlan.setInsertTime(new Date());
         amstruckRequirementPlan.setInsertUsername("admin");
         amstruckRequirementPlan.setInsertUpdateRemark("无");
-
         //在中间表中将需求与计划绑定
-        amstruckRequirementPlanService.insert(requirementId,planId);
+        amstruckRequirementPlanMapper.insertSelective(amstruckRequirementPlan);
         AmstruckInwardPlan amstruckInwardPlan=new AmstruckInwardPlan();
         //设置主键
         amstruckInwardPlan.setPlanId(planId);
@@ -80,7 +85,15 @@ public class AmstruckInwardPlanServiceImpl extends BaseServiceImpl<AmstruckInwar
 
     @Override
     public List<Map<String, Object>> getTruckPlanList(Map<String, Object> mapValue) {
-        return amstruckInwardPlanMapper.getTruckPlanList(mapValue);
+        BigDecimal planStatus = (BigDecimal)mapValue.get("planStatus");
+        List<Map<String,Object>> mapList;
+        if (planStatus.intValue() == 0) {
+            mapList = amstruckInwardPlanMapper.getTruckPlanList(mapValue);
+        }
+        else {
+            mapList = amstruckInwardPlanMapper.getIssuedPlanList(mapValue);
+        }
+        return mapList;
     }
 
     /**
@@ -111,15 +124,20 @@ public class AmstruckInwardPlanServiceImpl extends BaseServiceImpl<AmstruckInwar
 
     /**
      * 下发计划
-     * @param planId
+     * @param mapList
      * @return
      */
     @Override
-    public int downTruckPlan(BigDecimal planId) {
-        AmstruckInwardPlan amstruckInwardPlan = amstruckInwardPlanMapper.selectByPrimaryKey(planId);
-        amstruckInwardPlan.setPlanStatus(new BigDecimal(1));
-        amstruckInwardPlan.setPlanIssueTime(new Date());
-        int result = amstruckInwardPlanMapper.updateByPrimaryKeySelective(amstruckInwardPlan);
+    public int downTruckPlan(List<Map<String,Object>> mapList) {
+        int result = 0;
+        for (Map<String,Object> map : mapList) {
+            Integer planId = (Integer) map.get("planId");
+            AmstruckInwardPlan amstruckInwardPlan = amstruckInwardPlanMapper.selectByPrimaryKey(new BigDecimal(planId));
+            amstruckInwardPlan.setPlanStatus(new BigDecimal(1));
+            amstruckInwardPlan.setPlanIssueName("admin");
+            amstruckInwardPlan.setPlanIssueTime(new Date());
+            result += amstruckInwardPlanMapper.updateByPrimaryKeySelective(amstruckInwardPlan);
+        }
         return result;
     }
 
@@ -132,4 +150,26 @@ public class AmstruckInwardPlanServiceImpl extends BaseServiceImpl<AmstruckInwar
     public List<Map<String, Object>> selectInwardPlanToUpdate(BigDecimal planId) {
         return amstruckInwardPlanMapper.selectInwardPlanToUpdate(planId);
     }
+
+    /**
+     * 承运商下拉
+     * @return
+     */
+    @Override
+    public List<Map<String, Object>> getCarrierList() {
+        return amstruckInwardPlanMapper.getCarrierList();
+    }
+
+    /**
+     * 接收计划
+     * @param planId
+     * @return
+     */
+    @Override
+    public int receiveInwardPlan(BigDecimal planId) {
+        AmstruckInwardPlan amstruckInwardPlan = amstruckInwardPlanMapper.selectByPrimaryKey(planId);
+        amstruckInwardPlan.setPlanStatus(new BigDecimal(2));
+        int result = amstruckInwardPlanMapper.updateByPrimaryKeySelective(amstruckInwardPlan);
+        return result;
+    }
 }

+ 88 - 7
src/main/java/com/steerinfo/dil/service/impl/AmstruckInwardRequirementServiceImpl.java

@@ -1,13 +1,16 @@
 package com.steerinfo.dil.service.impl;
 
 import com.steerinfo.dil.mapper.AmstruckInwardRequirementMapper;
+import com.steerinfo.dil.mapper.AmstruckRequirementMaterialMapper;
 import com.steerinfo.dil.model.AmstruckInwardRequirement;
+import com.steerinfo.dil.model.AmstruckRequirementMaterial;
 import com.steerinfo.dil.service.IAmstruckInwardRequirementService;
 import com.steerinfo.dil.util.DataChange;
 import com.steerinfo.framework.mapper.IBaseMapper;
 import com.steerinfo.framework.service.impl.BaseServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.util.Date;
@@ -34,25 +37,77 @@ public class AmstruckInwardRequirementServiceImpl extends BaseServiceImpl<Amstru
     @Autowired
     private AmstruckInwardRequirementMapper amstruckInwardRequirementMapper;
 
+    @Autowired
+    AmstruckRequirementMaterialMapper amstruckRequirementMaterialMapper;
+
     @Override
     protected IBaseMapper<AmstruckInwardRequirement, BigDecimal> getMapper() {
         return amstruckInwardRequirementMapper;
     }
 
-
+    @Transactional
     @Override
-    public int insert(AmstruckInwardRequirement amstruckInwardRequirement) {
+    public int  insert(Map<String,Object> mapValue) {
+        Integer purchaseOrderId = (Integer) mapValue.get("purchaseOrderId");
+        String requirementType = (String) mapValue.get("requirementType");
+        Integer capacityTypeId = (Integer) mapValue.get("capacityTypeId");
+        Date requirementTruckTime = new Date((Long) mapValue.get("requirementTruckTime"));
+        Integer requirementShipperId = (Integer) mapValue.get("requirementShipperId");
+        String requirementWorkType = (String) mapValue.get("requirementWorkType");
+        String requirementWorkContent = (String) mapValue.get("requirementWorkContent");
+        String requirementWorkEnvironment = (String) mapValue.get("requirementWorkEnvironment");
+        String requirementEstimatedDuration = (String) mapValue.get("requirementEstimatedDuration");
+        Integer requiremntUnitId = (Integer) mapValue.get("requiremntUnitId");
+        Integer requirementUnloadUnitId = (Integer) mapValue.get("requirementUnloadUnitId");
+        String requirementOverlimit = (String) mapValue.get("requirementOverlimit");
+        BigDecimal materialWeight = DataChange.dataToBigDecimal(mapValue.get("materialWeight"));
+        BigDecimal materialCount = DataChange.dataToBigDecimal(mapValue.get("materialNumber"));
+        AmstruckInwardRequirement amstruckInwardRequirement = new AmstruckInwardRequirement();
         //设置主键
-        amstruckInwardRequirement.setRequirementId(amstruckInwardRequirementMapper.selectOtherId());
-        DataChange dataChange=new DataChange();
-        amstruckInwardRequirement.setRequirementNumber(dataChange.generateEightDigitsNumber("YSXQ",amstruckInwardRequirementMapper.selectOtherId().intValue()));
+        BigDecimal requirementId = amstruckInwardRequirementMapper.selectOtherId();
+        amstruckInwardRequirement.setRequirementId(requirementId);
+        amstruckInwardRequirement.setRequirementNumber(DataChange.generateEightDigitsNumber("YSXQ",amstruckInwardRequirementMapper.selectOtherId().intValue()));
         amstruckInwardRequirement.setRequirementStatus(new BigDecimal(0));
+        if(purchaseOrderId != null){
+            amstruckInwardRequirement.setPurchaseOrderId(new BigDecimal(purchaseOrderId));
+        }
+        amstruckInwardRequirement.setRequirementType(requirementType);
+        amstruckInwardRequirement.setCapacityTypeId(new BigDecimal(capacityTypeId));
+        amstruckInwardRequirement.setRequirementTruckTime(requirementTruckTime);
+        amstruckInwardRequirement.setRequirementWorkType(new BigDecimal(requirementWorkType));
+        amstruckInwardRequirement.setRequirementWorkContent(requirementWorkContent);
+        amstruckInwardRequirement.setRequirementWorkEnvironment(requirementWorkEnvironment);
+        amstruckInwardRequirement.setRequirementEstimatedDuration(new BigDecimal(requirementEstimatedDuration));
+        amstruckInwardRequirement.setRequiremntUnitId(new BigDecimal(requiremntUnitId));
+        amstruckInwardRequirement.setRequirementOverlimit(requirementOverlimit);
+        amstruckInwardRequirement.setRequirementShipperId(new BigDecimal(requirementShipperId));
+        amstruckInwardRequirement.setRequirementUnloadUnitId(new BigDecimal(requirementUnloadUnitId));
+        amstruckInwardRequirement.setRequirementPlatformId(DataChange.dataToBigDecimal(mapValue.get("requirementPlatformId")));
         // 设置常规字段
         amstruckInwardRequirement.setInsertTime(new Date());
         amstruckInwardRequirement.setInsertUsername("admin");
         amstruckInwardRequirement.setInsertUpdateRemark("无");
         amstruckInwardRequirement.setDeleted(new BigDecimal(0));
-        return amstruckInwardRequirementMapper.insertSelective(amstruckInwardRequirement);
+        int result = 0;
+        result += amstruckInwardRequirementMapper.insertSelective(amstruckInwardRequirement);
+        // 物资中间表
+        BigDecimal materialId = DataChange.dataToBigDecimal(mapValue.get("materialId"));
+        if(materialId.intValue() == 0)
+            if(purchaseOrderId != null)
+                materialId = amstruckInwardRequirementMapper.getMaterialId(new BigDecimal(purchaseOrderId));
+        AmstruckRequirementMaterial amstruckRequirementMaterial = new AmstruckRequirementMaterial();
+        amstruckRequirementMaterial.setRequirementMaterialId(amstruckRequirementMaterialMapper.selectRequirementMaterialId());
+        amstruckRequirementMaterial.setRequirementId(requirementId);
+        if(materialCount.intValue() != 0)
+            amstruckRequirementMaterial.setMaterialCount(materialCount);
+        if(materialWeight.intValue() != 0)
+            amstruckRequirementMaterial.setMaterialWeight(materialWeight);
+        amstruckRequirementMaterial.setMaterialId(materialId);
+        amstruckRequirementMaterial.setInsertTime(new Date());
+        amstruckRequirementMaterial.setInsertUsername("admin");
+        amstruckRequirementMaterial.setInsertUpdateRemark("无");
+        result += amstruckRequirementMaterialMapper.insertSelective(amstruckRequirementMaterial);
+        return result;
     }
 
     /**
@@ -69,7 +124,27 @@ public class AmstruckInwardRequirementServiceImpl extends BaseServiceImpl<Amstru
         else {
             mapList = amstruckInwardRequirementMapper.getTruckRequirementList(mapValue);
         }
-
+        for (Map<String,Object> map : mapList) {
+            BigDecimal workType = (BigDecimal) map.get("requirementWorkType");
+            map.remove("requirementWorkType");
+            String requirementWorkType;
+            switch (workType.intValue()) {
+                case 0 : requirementWorkType = "日常内转费";
+                    break;
+                case 1 : requirementWorkType = "推进办费用";
+                    break;
+                case 2 : requirementWorkType = "大修费用";
+                    break;
+                case 3 : requirementWorkType = "新增建设项目";
+                    break;
+                case 4 : requirementWorkType = "外委吊车";
+                    break;
+                case 5 : requirementWorkType = "外委转机";
+                    break;
+                default: requirementWorkType = "环保绿化项目";
+            }
+            map.put("workType",requirementWorkType);
+        }
         return mapList;
     }
 
@@ -188,4 +263,10 @@ public class AmstruckInwardRequirementServiceImpl extends BaseServiceImpl<Amstru
     public List<Map<String, Object>> getWareHouse(Map<String, Object> mapValue) {
         return amstruckInwardRequirementMapper.getWareHouse(mapValue);
     }
+
+    @Override
+    public List<Map<String, Object>> getOffsetWareHouse() {
+
+        return amstruckRequirementMaterialMapper.getOffsetWarehouse();
+    }
 }

+ 2 - 0
src/main/java/com/steerinfo/dil/util/DataChange.java

@@ -45,6 +45,8 @@ public class DataChange {
         if (data != null){
             if(data instanceof String){
                 String data1 = (String) data;
+                if(data1.length() == 0)
+                    return new BigDecimal(0);
                 return new BigDecimal(data1);
             }
             if(data instanceof Integer){

+ 774 - 77
src/main/resources/com/steerinfo/dil/mapper/AmsRailOffsetDayplanMapper.xml

@@ -1,6 +1,265 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.steerinfo.dil.mapper.AmsRailOffsetDayplanMapper">
+    <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.AmsRailOffsetDayplan">
+        <id column="DAYPLAN_ID" jdbcType="DECIMAL" property="dayplanId"/>
+        <result column="DAYPLAN_NO" jdbcType="VARCHAR" property="dayplanNo"/>
+        <result column="DAYPLAN_DATE" jdbcType="TIMESTAMP" property="dayplanDate"/>
+        <result column="SHIPPER_ID" jdbcType="DECIMAL" property="shipperId"/>
+        <result column="DAYPLAN_DELIVERY_DATE" jdbcType="TIMESTAMP" property="dayplanDeliveryDate"/>
+        <result column="DAYPLAN_OWN_CARS_AMOUT" jdbcType="DECIMAL" property="dayplanOwnCarsAmout"/>
+        <result column="DAYPLAN_TO_THE_STATION_ID" jdbcType="DECIMAL" property="dayplanToTheStationId"/>
+        <result column="DAYPLAN_WAGON_NUMBER" jdbcType="DECIMAL" property="dayplanWagonNumber"/>
+        <result column="RECEIVING_UNIT_ID" jdbcType="DECIMAL" property="receivingUnitId"/>
+        <result column="DAYPLAN_CONSIGNEE_NAME" jdbcType="VARCHAR" property="dayplanConsigneeName"/>
+        <result column="DAYPLAN_CONSIGNEE_TEL" jdbcType="VARCHAR" property="dayplanConsigneeTel"/>
+        <result column="DAYPLAN_RECEIVE_STATUS" jdbcType="DECIMAL" property="dayplanReceiveStatus"/>
+        <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername"/>
+        <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime"/>
+        <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername"/>
+        <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/>
+        <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark"/>
+        <result column="CARRIER_ID" jdbcType="DECIMAL" property="carrierId"/>
+        <result column="DAYPLAN_SEND_STATION_ID" jdbcType="DECIMAL" property="dayplanSendStationId"/>
+        <result column="DELETED" jdbcType="DECIMAL" property="deleted"/>
+    </resultMap>
+    <sql id="columns">
+        DAYPLAN_ID, DAYPLAN_NO, DAYPLAN_DATE, SHIPPER_ID, DAYPLAN_DELIVERY_DATE, DAYPLAN_OWN_CARS_AMOUT,
+    DAYPLAN_TO_THE_STATION_ID, DAYPLAN_WAGON_NUMBER, RECEIVING_UNIT_ID, DAYPLAN_CONSIGNEE_NAME,
+    DAYPLAN_CONSIGNEE_TEL, DAYPLAN_RECEIVE_STATUS, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
+    UPDATE_TIME, INSERT_UPDATE_REMARK, CARRIER_ID, DAYPLAN_SEND_STATION_ID, DELETED
+    </sql>
+    <sql id="columns_alias">
+        t.DAYPLAN_ID, t.DAYPLAN_NO, t.DAYPLAN_DATE, t.SHIPPER_ID, t.DAYPLAN_DELIVERY_DATE,
+    t.DAYPLAN_OWN_CARS_AMOUT, t.DAYPLAN_TO_THE_STATION_ID, t.DAYPLAN_WAGON_NUMBER, t.RECEIVING_UNIT_ID,
+    t.DAYPLAN_CONSIGNEE_NAME, t.DAYPLAN_CONSIGNEE_TEL, t.DAYPLAN_RECEIVE_STATUS, t.INSERT_USERNAME,
+    t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, t.CARRIER_ID,
+    t.DAYPLAN_SEND_STATION_ID, t.DELETED
+    </sql>
+    <sql id="select">
+        SELECT
+        <include refid="columns"/>
+        FROM AMS_RAIL_OFFSET_DAYPLAN
+    </sql>
+    <sql id="select_alias">
+        SELECT
+        <include refid="columns_alias"/>
+        FROM AMS_RAIL_OFFSET_DAYPLAN t
+    </sql>
+    <sql id="where">
+        <where>
+            <if test="dayplanId != null">
+                and DAYPLAN_ID = #{dayplanId}
+            </if>
+            <if test="dayplanNo != null and dayplanNo != ''">
+                and DAYPLAN_NO = #{dayplanNo}
+            </if>
+            <if test="dayplanDate != null">
+                and TO_CHAR(DAYPLAN_DATE,'yyyy-MM-dd') = #{dayplanDate}
+            </if>
+            <if test="shipperId != null">
+                and SHIPPER_ID = #{shipperId}
+            </if>
+            <if test="dayplanDeliveryDate != null">
+                and TO_CHAR(DAYPLAN_DELIVERY_DATE,'yyyy-MM-dd') = #{dayplanDeliveryDate}
+            </if>
+            <if test="dayplanOwnCarsAmout != null">
+                and DAYPLAN_OWN_CARS_AMOUT = #{dayplanOwnCarsAmout}
+            </if>
+            <if test="dayplanToTheStationId != null">
+                and DAYPLAN_TO_THE_STATION_ID = #{dayplanToTheStationId}
+            </if>
+            <if test="dayplanWagonNumber != null">
+                and DAYPLAN_WAGON_NUMBER = #{dayplanWagonNumber}
+            </if>
+            <if test="receivingUnitId != null">
+                and RECEIVING_UNIT_ID = #{receivingUnitId}
+            </if>
+            <if test="dayplanConsigneeName != null and dayplanConsigneeName != ''">
+                and DAYPLAN_CONSIGNEE_NAME = #{dayplanConsigneeName}
+            </if>
+            <if test="dayplanConsigneeTel != null and dayplanConsigneeTel != ''">
+                and DAYPLAN_CONSIGNEE_TEL = #{dayplanConsigneeTel}
+            </if>
+            <if test="dayplanReceiveStatus != null">
+                and DAYPLAN_RECEIVE_STATUS = #{dayplanReceiveStatus}
+            </if>
+            <if test="insertUsername != null and insertUsername != ''">
+                and INSERT_USERNAME = #{insertUsername}
+            </if>
+            <if test="insertTime != null">
+                and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
+            </if>
+            <if test="updateUsername != null and updateUsername != ''">
+                and UPDATE_USERNAME = #{updateUsername}
+            </if>
+            <if test="updateTime != null">
+                and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
+            </if>
+            <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
+                and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
+            </if>
+            <if test="carrierId != null">
+                and CARRIER_ID = #{carrierId}
+            </if>
+            <if test="dayplanSendStationId != null">
+                and DAYPLAN_SEND_STATION_ID = #{dayplanSendStationId}
+            </if>
+            <if test="deleted != null">
+                and DELETED = #{deleted}
+            </if>
+        </where>
+    </sql>
+    <sql id="whereLike">
+        <where>
+            <if test="dayplanId != null">
+                and DAYPLAN_ID = #{dayplanId}
+            </if>
+            <if test="dayplanNo != null and dayplanNo != ''">
+                and DAYPLAN_NO LIKE '%${dayplanNo}%'
+            </if>
+            <if test="dayplanDate != null">
+                and TO_CHAR(DAYPLAN_DATE,'yyyy-MM-dd') = #{dayplanDate}
+            </if>
+            <if test="shipperId != null">
+                and SHIPPER_ID = #{shipperId}
+            </if>
+            <if test="dayplanDeliveryDate != null">
+                and TO_CHAR(DAYPLAN_DELIVERY_DATE,'yyyy-MM-dd') = #{dayplanDeliveryDate}
+            </if>
+            <if test="dayplanOwnCarsAmout != null">
+                and DAYPLAN_OWN_CARS_AMOUT = #{dayplanOwnCarsAmout}
+            </if>
+            <if test="dayplanToTheStationId != null">
+                and DAYPLAN_TO_THE_STATION_ID = #{dayplanToTheStationId}
+            </if>
+            <if test="dayplanWagonNumber != null">
+                and DAYPLAN_WAGON_NUMBER = #{dayplanWagonNumber}
+            </if>
+            <if test="receivingUnitId != null">
+                and RECEIVING_UNIT_ID = #{receivingUnitId}
+            </if>
+            <if test="dayplanConsigneeName != null and dayplanConsigneeName != ''">
+                and DAYPLAN_CONSIGNEE_NAME LIKE '%${dayplanConsigneeName}%'
+            </if>
+            <if test="dayplanConsigneeTel != null and dayplanConsigneeTel != ''">
+                and DAYPLAN_CONSIGNEE_TEL LIKE '%${dayplanConsigneeTel}%'
+            </if>
+            <if test="dayplanReceiveStatus != null">
+                and DAYPLAN_RECEIVE_STATUS = #{dayplanReceiveStatus}
+            </if>
+            <if test="insertUsername != null and insertUsername != ''">
+                and INSERT_USERNAME LIKE '%${insertUsername}%'
+            </if>
+            <if test="insertTime != null">
+                and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
+            </if>
+            <if test="updateUsername != null and updateUsername != ''">
+                and UPDATE_USERNAME LIKE '%${updateUsername}%'
+            </if>
+            <if test="updateTime != null">
+                and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
+            </if>
+            <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
+                and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
+            </if>
+            <if test="carrierId != null">
+                and CARRIER_ID = #{carrierId}
+            </if>
+            <if test="dayplanSendStationId != null">
+                and DAYPLAN_SEND_STATION_ID = #{dayplanSendStationId}
+            </if>
+            <if test="deleted != null">
+                and DELETED = #{deleted}
+            </if>
+        </where>
+    </sql>
+    <delete id="deleteByPrimaryKey" parameterType="DECIMAL">
+        delete
+        from AMS_RAIL_OFFSET_DAYPLAN
+        where DAYPLAN_ID = #{dayplanId,jdbcType=DECIMAL}
+    </delete>
+    <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
+        delete from AMS_RAIL_OFFSET_DAYPLAN
+        where 1!=1
+        <if test="dayplanNo != null and dayplanNo != ''">
+            or DAYPLAN_NO = #{dayplanNo}
+        </if>
+        <if test="dayplanDate != null">
+            or TO_CHAR(DAYPLAN_DATE,'yyyy-MM-dd') = '#{dayplanDate}'
+        </if>
+        <if test="shipperId != null">
+            or SHIPPER_ID = #{shipperId}
+        </if>
+        <if test="dayplanDeliveryDate != null">
+            or TO_CHAR(DAYPLAN_DELIVERY_DATE,'yyyy-MM-dd') = '#{dayplanDeliveryDate}'
+        </if>
+        <if test="dayplanOwnCarsAmout != null">
+            or DAYPLAN_OWN_CARS_AMOUT = #{dayplanOwnCarsAmout}
+        </if>
+        <if test="dayplanToTheStationId != null">
+            or DAYPLAN_TO_THE_STATION_ID = #{dayplanToTheStationId}
+        </if>
+        <if test="dayplanWagonNumber != null">
+            or DAYPLAN_WAGON_NUMBER = #{dayplanWagonNumber}
+        </if>
+        <if test="receivingUnitId != null">
+            or RECEIVING_UNIT_ID = #{receivingUnitId}
+        </if>
+        <if test="dayplanConsigneeName != null and dayplanConsigneeName != ''">
+            or DAYPLAN_CONSIGNEE_NAME = #{dayplanConsigneeName}
+        </if>
+        <if test="dayplanConsigneeTel != null and dayplanConsigneeTel != ''">
+            or DAYPLAN_CONSIGNEE_TEL = #{dayplanConsigneeTel}
+        </if>
+        <if test="dayplanReceiveStatus != null">
+            or DAYPLAN_RECEIVE_STATUS = #{dayplanReceiveStatus}
+        </if>
+        <if test="insertUsername != null and insertUsername != ''">
+            or INSERT_USERNAME = #{insertUsername}
+        </if>
+        <if test="insertTime != null">
+            or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
+        </if>
+        <if test="updateUsername != null and updateUsername != ''">
+            or UPDATE_USERNAME = #{updateUsername}
+        </if>
+        <if test="updateTime != null">
+            or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
+        </if>
+        <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
+            or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
+        </if>
+        <if test="carrierId != null">
+            or CARRIER_ID = #{carrierId}
+        </if>
+        <if test="dayplanSendStationId != null">
+            or DAYPLAN_SEND_STATION_ID = #{dayplanSendStationId}
+        </if>
+        <if test="deleted != null">
+            or DELETED = #{deleted}
+        </if>
+    </delete>
+    <insert id="insert" parameterType="com.steerinfo.dil.model.AmsRailOffsetDayplan">
+        insert into AMS_RAIL_OFFSET_DAYPLAN (DAYPLAN_ID, DAYPLAN_NO, DAYPLAN_DATE,
+                                             SHIPPER_ID, DAYPLAN_DELIVERY_DATE, DAYPLAN_OWN_CARS_AMOUT,
+                                             DAYPLAN_TO_THE_STATION_ID, DAYPLAN_WAGON_NUMBER,
+                                             RECEIVING_UNIT_ID, DAYPLAN_CONSIGNEE_NAME,
+                                             DAYPLAN_CONSIGNEE_TEL, DAYPLAN_RECEIVE_STATUS,
+                                             INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
+                                             UPDATE_TIME, INSERT_UPDATE_REMARK, CARRIER_ID,
+                                             DAYPLAN_SEND_STATION_ID, DELETED)
+        values (#{dayplanId,jdbcType=DECIMAL}, #{dayplanNo,jdbcType=VARCHAR}, #{dayplanDate,jdbcType=TIMESTAMP},
+                #{shipperId,jdbcType=DECIMAL}, #{dayplanDeliveryDate,jdbcType=TIMESTAMP},
+                #{dayplanOwnCarsAmout,jdbcType=DECIMAL},
+                #{dayplanToTheStationId,jdbcType=DECIMAL}, #{dayplanWagonNumber,jdbcType=DECIMAL},
+                #{receivingUnitId,jdbcType=DECIMAL}, #{dayplanConsigneeName,jdbcType=VARCHAR},
+                #{dayplanConsigneeTel,jdbcType=VARCHAR}, #{dayplanReceiveStatus,jdbcType=DECIMAL},
+                #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP},
+                #{updateUsername,jdbcType=VARCHAR},
+                #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR}, #{carrierId,jdbcType=DECIMAL},
+                #{dayplanSendStationId,jdbcType=DECIMAL}, #{deleted,jdbcType=DECIMAL})
+    </insert>
     <insert id="insertSelective" parameterType="com.steerinfo.dil.model.AmsRailOffsetDayplan">
         insert into AMS_RAIL_OFFSET_DAYPLAN
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -22,15 +281,9 @@
             <if test="dayplanOwnCarsAmout != null">
                 DAYPLAN_OWN_CARS_AMOUT,
             </if>
-            <if test="dayplanDedicatedLineId != null">
-                DAYPLAN_DEDICATED_LINE_ID,
-            </if>
             <if test="dayplanToTheStationId != null">
                 DAYPLAN_TO_THE_STATION_ID,
             </if>
-            <if test="transferUnitId != null">
-                TRANSFER_UNIT_ID,
-            </if>
             <if test="dayplanWagonNumber != null">
                 DAYPLAN_WAGON_NUMBER,
             </if>
@@ -61,6 +314,15 @@
             <if test="insertUpdateRemark != null">
                 INSERT_UPDATE_REMARK,
             </if>
+            <if test="carrierId != null">
+                CARRIER_ID,
+            </if>
+            <if test="dayplanSendStationId != null">
+                DAYPLAN_SEND_STATION_ID,
+            </if>
+            <if test="deleted != null">
+                DELETED,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="dayplanId != null">
@@ -81,15 +343,9 @@
             <if test="dayplanOwnCarsAmout != null">
                 #{dayplanOwnCarsAmout,jdbcType=DECIMAL},
             </if>
-            <if test="dayplanDedicatedLineId != null">
-                #{dayplanDedicatedLineId,jdbcType=DECIMAL},
-            </if>
             <if test="dayplanToTheStationId != null">
                 #{dayplanToTheStationId,jdbcType=DECIMAL},
             </if>
-            <if test="transferUnitId != null">
-                #{transferUnitId,jdbcType=DECIMAL},
-            </if>
             <if test="dayplanWagonNumber != null">
                 #{dayplanWagonNumber,jdbcType=DECIMAL},
             </if>
@@ -120,84 +376,525 @@
             <if test="insertUpdateRemark != null">
                 #{insertUpdateRemark,jdbcType=VARCHAR},
             </if>
+            <if test="carrierId != null">
+                #{carrierId,jdbcType=DECIMAL},
+            </if>
+            <if test="dayplanSendStationId != null">
+                #{dayplanSendStationId,jdbcType=DECIMAL},
+            </if>
+            <if test="deleted != null">
+                #{deleted,jdbcType=DECIMAL},
+            </if>
         </trim>
     </insert>
     <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.AmsRailOffsetDayplan">
-    update AMS_RAIL_OFFSET_DAYPLAN
-    set DAYPLAN_NO = #{dayplanNo,jdbcType=VARCHAR},
-      DAYPLAN_DATE = #{dayplanDate,jdbcType=TIMESTAMP},
-      SHIPPER_ID = #{shipperId,jdbcType=DECIMAL},
-      DAYPLAN_DELIVERY_DATE = #{dayplanDeliveryDate,jdbcType=TIMESTAMP},
-      DAYPLAN_OWN_CARS_AMOUT = #{dayplanOwnCarsAmout,jdbcType=DECIMAL},
-      DAYPLAN_DEDICATED_LINE_ID = #{dayplanDedicatedLineId,jdbcType=DECIMAL},
-      DAYPLAN_TO_THE_STATION_ID = #{dayplanToTheStationId,jdbcType=DECIMAL},
-      TRANSFER_UNIT_ID = #{transferUnitId,jdbcType=DECIMAL},
-      DAYPLAN_WAGON_NUMBER = #{dayplanWagonNumber,jdbcType=DECIMAL},
-      RECEIVING_UNIT_ID = #{receivingUnitId,jdbcType=DECIMAL},
-      DAYPLAN_CONSIGNEE_NAME = #{dayplanConsigneeName,jdbcType=VARCHAR},
-      DAYPLAN_CONSIGNEE_TEL = #{dayplanConsigneeTel,jdbcType=VARCHAR},
-      DAYPLAN_RECEIVE_STATUS = #{dayplanReceiveStatus,jdbcType=DECIMAL},
-      INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
-      INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
-      UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
-      UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
-      INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR}
-    where DAYPLAN_ID = #{dayplanId,jdbcType=DECIMAL}
-  </update>
-    <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
-    delete from AMS_RAIL_OFFSET_DAYPLAN
-    where DAYPLAN_ID = #{dayplanId,jdbcType=DECIMAL}
-  </delete>
-  <!-- 友情提示!!!-->
-  <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
+        update AMS_RAIL_OFFSET_DAYPLAN
+        set DAYPLAN_NO                = #{dayplanNo,jdbcType=VARCHAR},
+            DAYPLAN_DATE              = #{dayplanDate,jdbcType=TIMESTAMP},
+            SHIPPER_ID                = #{shipperId,jdbcType=DECIMAL},
+            DAYPLAN_DELIVERY_DATE     = #{dayplanDeliveryDate,jdbcType=TIMESTAMP},
+            DAYPLAN_OWN_CARS_AMOUT    = #{dayplanOwnCarsAmout,jdbcType=DECIMAL},
+            DAYPLAN_TO_THE_STATION_ID = #{dayplanToTheStationId,jdbcType=DECIMAL},
+            DAYPLAN_WAGON_NUMBER      = #{dayplanWagonNumber,jdbcType=DECIMAL},
+            RECEIVING_UNIT_ID         = #{receivingUnitId,jdbcType=DECIMAL},
+            DAYPLAN_CONSIGNEE_NAME    = #{dayplanConsigneeName,jdbcType=VARCHAR},
+            DAYPLAN_CONSIGNEE_TEL     = #{dayplanConsigneeTel,jdbcType=VARCHAR},
+            DAYPLAN_RECEIVE_STATUS    = #{dayplanReceiveStatus,jdbcType=DECIMAL},
+            INSERT_USERNAME           = #{insertUsername,jdbcType=VARCHAR},
+            INSERT_TIME               = #{insertTime,jdbcType=TIMESTAMP},
+            UPDATE_USERNAME           = #{updateUsername,jdbcType=VARCHAR},
+            UPDATE_TIME               = #{updateTime,jdbcType=TIMESTAMP},
+            INSERT_UPDATE_REMARK      = #{insertUpdateRemark,jdbcType=VARCHAR},
+            CARRIER_ID                = #{carrierId,jdbcType=DECIMAL},
+            DAYPLAN_SEND_STATION_ID   = #{dayplanSendStationId,jdbcType=DECIMAL},
+            DELETED                   = #{deleted,jdbcType=DECIMAL}
+        where DAYPLAN_ID = #{dayplanId,jdbcType=DECIMAL}
+    </update>
+    <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.AmsRailOffsetDayplan">
+        update AMS_RAIL_OFFSET_DAYPLAN
+        <set>
+            <if test="dayplanNo != null">
+                DAYPLAN_NO = #{dayplanNo,jdbcType=VARCHAR},
+            </if>
+            <if test="dayplanDate != null">
+                DAYPLAN_DATE = #{dayplanDate,jdbcType=TIMESTAMP},
+            </if>
+            <if test="shipperId != null">
+                SHIPPER_ID = #{shipperId,jdbcType=DECIMAL},
+            </if>
+            <if test="dayplanDeliveryDate != null">
+                DAYPLAN_DELIVERY_DATE = #{dayplanDeliveryDate,jdbcType=TIMESTAMP},
+            </if>
+            <if test="dayplanOwnCarsAmout != null">
+                DAYPLAN_OWN_CARS_AMOUT = #{dayplanOwnCarsAmout,jdbcType=DECIMAL},
+            </if>
+            <if test="dayplanToTheStationId != null">
+                DAYPLAN_TO_THE_STATION_ID = #{dayplanToTheStationId,jdbcType=DECIMAL},
+            </if>
+            <if test="dayplanWagonNumber != null">
+                DAYPLAN_WAGON_NUMBER = #{dayplanWagonNumber,jdbcType=DECIMAL},
+            </if>
+            <if test="receivingUnitId != null">
+                RECEIVING_UNIT_ID = #{receivingUnitId,jdbcType=DECIMAL},
+            </if>
+            <if test="dayplanConsigneeName != null">
+                DAYPLAN_CONSIGNEE_NAME = #{dayplanConsigneeName,jdbcType=VARCHAR},
+            </if>
+            <if test="dayplanConsigneeTel != null">
+                DAYPLAN_CONSIGNEE_TEL = #{dayplanConsigneeTel,jdbcType=VARCHAR},
+            </if>
+            <if test="dayplanReceiveStatus != null">
+                DAYPLAN_RECEIVE_STATUS = #{dayplanReceiveStatus,jdbcType=DECIMAL},
+            </if>
+            <if test="insertUsername != null">
+                INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
+            </if>
+            <if test="insertTime != null">
+                INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="updateUsername != null">
+                UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
+            </if>
+            <if test="updateTime != null">
+                UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="insertUpdateRemark != null">
+                INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
+            </if>
+            <if test="carrierId != null">
+                CARRIER_ID = #{carrierId,jdbcType=DECIMAL},
+            </if>
+            <if test="dayplanSendStationId != null">
+                DAYPLAN_SEND_STATION_ID = #{dayplanSendStationId,jdbcType=DECIMAL},
+            </if>
+            <if test="deleted != null">
+                DELETED = #{deleted,jdbcType=DECIMAL},
+            </if>
+        </set>
+        where DAYPLAN_ID = #{dayplanId,jdbcType=DECIMAL}
+    </update>
+    <select id="selectByPrimaryKey" parameterType="DECIMAL" resultMap="BaseResultMap">
+        <include refid="select"/>
+        where DAYPLAN_ID = #{dayplanId,jdbcType=DECIMAL}
+    </select>
+    <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
+        <include refid="select"/>
+        <include refid="where"/>
+    </select>
+    <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
+        <include refid="select"/>
+        <include refid="whereLike"/>
+    </select>
+    <insert id="batchInsert" parameterType="java.util.List">
+        insert into AMS_RAIL_OFFSET_DAYPLAN
+        (DAYPLAN_ID,
+        DAYPLAN_NO, DAYPLAN_DATE, SHIPPER_ID,
+        DAYPLAN_DELIVERY_DATE, DAYPLAN_OWN_CARS_AMOUT,
+        DAYPLAN_TO_THE_STATION_ID, DAYPLAN_WAGON_NUMBER,
+        RECEIVING_UNIT_ID, DAYPLAN_CONSIGNEE_NAME,
+        DAYPLAN_CONSIGNEE_TEL, DAYPLAN_RECEIVE_STATUS,
+        INSERT_USERNAME, INSERT_TIME,
+        UPDATE_USERNAME, UPDATE_TIME,
+        INSERT_UPDATE_REMARK, CARRIER_ID,
+        DAYPLAN_SEND_STATION_ID, DELETED
+        )
+        ( <foreach collection="list" item="item" separator="union all">
+        select
+        #{item.dayplanId,jdbcType=DECIMAL},
+        #{item.dayplanNo,jdbcType=VARCHAR}, #{item.dayplanDate,jdbcType=TIMESTAMP}, #{item.shipperId,jdbcType=DECIMAL},
+        #{item.dayplanDeliveryDate,jdbcType=TIMESTAMP}, #{item.dayplanOwnCarsAmout,jdbcType=DECIMAL},
+        #{item.dayplanToTheStationId,jdbcType=DECIMAL}, #{item.dayplanWagonNumber,jdbcType=DECIMAL},
+        #{item.receivingUnitId,jdbcType=DECIMAL}, #{item.dayplanConsigneeName,jdbcType=VARCHAR},
+        #{item.dayplanConsigneeTel,jdbcType=VARCHAR}, #{item.dayplanReceiveStatus,jdbcType=DECIMAL},
+        #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
+        #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
+        #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.carrierId,jdbcType=DECIMAL},
+        #{item.dayplanSendStationId,jdbcType=DECIMAL}, #{item.deleted,jdbcType=DECIMAL}
+        from dual
+    </foreach> )
+    </insert>
+    <update id="batchUpdate" parameterType="java.util.List">
+        update AMS_RAIL_OFFSET_DAYPLAN
+        set
+        DAYPLAN_ID=
+        <foreach collection="list" item="item" index="index" separator=" " open="case DAYPLAN_ID" close="end">
+            when #{item.dayplanId,jdbcType=DECIMAL} then #{item.dayplanId,jdbcType=DECIMAL}
+        </foreach>
+        ,DAYPLAN_NO=
+        <foreach collection="list" item="item" index="index" separator=" " open="case DAYPLAN_ID" close="end">
+            when #{item.dayplanId,jdbcType=DECIMAL} then #{item.dayplanNo,jdbcType=VARCHAR}
+        </foreach>
+        ,DAYPLAN_DATE=
+        <foreach collection="list" item="item" index="index" separator=" " open="case DAYPLAN_ID" close="end">
+            when #{item.dayplanId,jdbcType=DECIMAL} then #{item.dayplanDate,jdbcType=TIMESTAMP}
+        </foreach>
+        ,SHIPPER_ID=
+        <foreach collection="list" item="item" index="index" separator=" " open="case DAYPLAN_ID" close="end">
+            when #{item.dayplanId,jdbcType=DECIMAL} then #{item.shipperId,jdbcType=DECIMAL}
+        </foreach>
+        ,DAYPLAN_DELIVERY_DATE=
+        <foreach collection="list" item="item" index="index" separator=" " open="case DAYPLAN_ID" close="end">
+            when #{item.dayplanId,jdbcType=DECIMAL} then #{item.dayplanDeliveryDate,jdbcType=TIMESTAMP}
+        </foreach>
+        ,DAYPLAN_OWN_CARS_AMOUT=
+        <foreach collection="list" item="item" index="index" separator=" " open="case DAYPLAN_ID" close="end">
+            when #{item.dayplanId,jdbcType=DECIMAL} then #{item.dayplanOwnCarsAmout,jdbcType=DECIMAL}
+        </foreach>
+        ,DAYPLAN_TO_THE_STATION_ID=
+        <foreach collection="list" item="item" index="index" separator=" " open="case DAYPLAN_ID" close="end">
+            when #{item.dayplanId,jdbcType=DECIMAL} then #{item.dayplanToTheStationId,jdbcType=DECIMAL}
+        </foreach>
+        ,DAYPLAN_WAGON_NUMBER=
+        <foreach collection="list" item="item" index="index" separator=" " open="case DAYPLAN_ID" close="end">
+            when #{item.dayplanId,jdbcType=DECIMAL} then #{item.dayplanWagonNumber,jdbcType=DECIMAL}
+        </foreach>
+        ,RECEIVING_UNIT_ID=
+        <foreach collection="list" item="item" index="index" separator=" " open="case DAYPLAN_ID" close="end">
+            when #{item.dayplanId,jdbcType=DECIMAL} then #{item.receivingUnitId,jdbcType=DECIMAL}
+        </foreach>
+        ,DAYPLAN_CONSIGNEE_NAME=
+        <foreach collection="list" item="item" index="index" separator=" " open="case DAYPLAN_ID" close="end">
+            when #{item.dayplanId,jdbcType=DECIMAL} then #{item.dayplanConsigneeName,jdbcType=VARCHAR}
+        </foreach>
+        ,DAYPLAN_CONSIGNEE_TEL=
+        <foreach collection="list" item="item" index="index" separator=" " open="case DAYPLAN_ID" close="end">
+            when #{item.dayplanId,jdbcType=DECIMAL} then #{item.dayplanConsigneeTel,jdbcType=VARCHAR}
+        </foreach>
+        ,DAYPLAN_RECEIVE_STATUS=
+        <foreach collection="list" item="item" index="index" separator=" " open="case DAYPLAN_ID" close="end">
+            when #{item.dayplanId,jdbcType=DECIMAL} then #{item.dayplanReceiveStatus,jdbcType=DECIMAL}
+        </foreach>
+        ,INSERT_USERNAME=
+        <foreach collection="list" item="item" index="index" separator=" " open="case DAYPLAN_ID" close="end">
+            when #{item.dayplanId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
+        </foreach>
+        ,INSERT_TIME=
+        <foreach collection="list" item="item" index="index" separator=" " open="case DAYPLAN_ID" close="end">
+            when #{item.dayplanId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
+        </foreach>
+        ,UPDATE_USERNAME=
+        <foreach collection="list" item="item" index="index" separator=" " open="case DAYPLAN_ID" close="end">
+            when #{item.dayplanId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
+        </foreach>
+        ,UPDATE_TIME=
+        <foreach collection="list" item="item" index="index" separator=" " open="case DAYPLAN_ID" close="end">
+            when #{item.dayplanId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
+        </foreach>
+        ,INSERT_UPDATE_REMARK=
+        <foreach collection="list" item="item" index="index" separator=" " open="case DAYPLAN_ID" close="end">
+            when #{item.dayplanId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
+        </foreach>
+        ,CARRIER_ID=
+        <foreach collection="list" item="item" index="index" separator=" " open="case DAYPLAN_ID" close="end">
+            when #{item.dayplanId,jdbcType=DECIMAL} then #{item.carrierId,jdbcType=DECIMAL}
+        </foreach>
+        ,DAYPLAN_SEND_STATION_ID=
+        <foreach collection="list" item="item" index="index" separator=" " open="case DAYPLAN_ID" close="end">
+            when #{item.dayplanId,jdbcType=DECIMAL} then #{item.dayplanSendStationId,jdbcType=DECIMAL}
+        </foreach>
+        ,DELETED=
+        <foreach collection="list" item="item" index="index" separator=" " open="case DAYPLAN_ID" close="end">
+            when #{item.dayplanId,jdbcType=DECIMAL} then #{item.deleted,jdbcType=DECIMAL}
+        </foreach>
+        where DAYPLAN_ID in
+        <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
+            #{item.dayplanId,jdbcType=DECIMAL}
+        </foreach>
+    </update>
+    <delete id="batchDelete" parameterType="java.util.List">
+        delete from AMS_RAIL_OFFSET_DAYPLAN
+        where DAYPLAN_ID in
+        <foreach collection="list" item="id" open="(" close=")" separator=",">
+            #{id}
+        </foreach>
+    </delete>
+    <!-- 友情提示!!!-->
+    <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
+
 
     <!-- 展示钢材发往异地库日计划 -->
     <select id="getRailOffsetDayplan" parameterType="java.util.Map" resultType="java.util.Map">
-       select
-           t.DAYPLAN_ID "dayPlanId",
-              t.dayplan_no as "dayplanNo",
-       t.dayplan_date as "dayplanDate",
-       rs.shipper_name as "shipperName",
-       t.dayplan_delivery_date as "dayplanDeliveryDate",
-       t.dayplan_own_cars_amout as "dayplanOwnCarsAmout",
-       ras.arrival_name as "arrivalName",
-       ras.dayplan_dedicated_line as "dayplanDedicatedLine",
-       ras.transfer_unit as "transferUnit",
-       t.dayplan_wagon_number as "dayplanWagonNumber",
-       rc.consignee_company_name as "consigneeCompanyName",
-       t.dayplan_consignee_name as "dayplanConsigneeName",
-       t.dayplan_consignee_tel as "dayplanConsigneeTel"
-from ams_rail_offset_dayplan t
-left join rms_shipper rs on t.shipper_id=rs.shipper_id
-left join rmstrain_arrival_send ras on t.dayplan_to_the_station_id=ras.arrival_id
-left join rms_consignee rc on t.receiving_unit_id =rc.consignee_id
-where t.dayplan_receive_status=0
+        SELECT *
+        FROM (SELECT AROD.DAYPLAN_ID AS "dayPlanId",
+        AROD.DAYPLAN_NO AS "dayplanNo",
+        to_char(AROD.DAYPLAN_DATE, 'yyyy-mm-dd') AS "dayplanDate",
+        RS.SHIPPER_NAME AS "shipperName",
+        to_char(AROD.DAYPLAN_DELIVERY_DATE, 'yyyy-mm-dd') AS "dayplanDeliveryDate",
+        RAS.TRANSFER_UNIT AS "transferUnit",
+        AROD.DAYPLAN_OWN_CARS_AMOUT AS "dayplanOwnCarsAmout",
+        AROD.DAYPLAN_WAGON_NUMBER AS "dayplanWagonNumber",
+        RAS.ARRIVAL_NAME AS "arrivalName",
+        RAS.DAYPLAN_DEDICATED_LINE AS "dayplanDedicatedLine",
+        RW.WAREHOUSE_NAME AS "wareHouseName",
+        AROD.DAYPLAN_CONSIGNEE_NAME AS "dayplanConsigneeName",
+        AROD.DAYPLAN_CONSIGNEE_TEL AS "dayplanConsigneeTel",
+        AROD.INSERT_TIME AS "insertTime"
+        FROM AMS_RAIL_OFFSET_DAYPLAN AROD
+        LEFT JOIN RMS_SHIPPER RS
+        ON AROD.SHIPPER_ID = RS.SHIPPER_ID
+        LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS
+        ON AROD.DAYPLAN_TO_THE_STATION_ID = RAS.ARRIVAL_ID
+        LEFT JOIN RMS_WAREHOUSE RW
+        ON RW.WAREHOUSE_ID = AROD.RECEIVING_UNIT_ID
+        WHERE AROD.DELETED = 0
+        <if test="dayplanReceiveStatus != null">
+            AND AROD.DAYPLAN_RECEIVE_STATUS = #{dayplanReceiveStatus}
+        </if>
+        <if test="carrierId != null">
+            AND AROD.CARRIER_ID = #{carrierId}
+        </if>
+        )
+        <where>
+            <if test="dayplanNo != null">
+                and
+                <foreach collection="dayplanNo" item="item" open="(" separator="or" close=")">
+                    "dayplanNo" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="dayplanDate != null">
+                and
+                <foreach collection="dayplanDate" item="item" open="(" separator="or" close=")">
+                    "dayplanDate" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="shipperName != null">
+                and
+                <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
+                    "shipperName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="dayplanDeliveryDate != null">
+                and
+                <foreach collection="dayplanDeliveryDate" item="item" open="(" separator="or" close=")">
+                    "dayplanDeliveryDate" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="transferUnit != null">
+                and
+                <foreach collection="transferUnit" item="item" open="(" separator="or" close=")">
+                    "transferUnit" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="dayplanOwnCarsAmout != null">
+                and
+                <foreach collection="dayplanOwnCarsAmout" item="item" open="(" separator="or" close=")">
+                    "dayplanOwnCarsAmout" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="dayplanWagonNumber != null">
+                and
+                <foreach collection="dayplanWagonNumber" item="item" open="(" separator="or" close=")">
+                    "dayplanWagonNumber" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="arrivalName != null">
+                and
+                <foreach collection="arrivalName" item="item" open="(" separator="or" close=")">
+                    "arrivalName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="dayplanDedicatedLine != null">
+                and
+                <foreach collection="dayplanDedicatedLine" item="item" open="(" separator="or" close=")">
+                    "dayplanDedicatedLine" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="wareHouseName != null">
+                and
+                <foreach collection="wareHouseName" item="item" open="(" separator="or" close=")">
+                    "wareHouseName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="dayplanConsigneeName != null">
+                and
+                <foreach collection="dayplanConsigneeName" item="item" open="(" separator="or" close=")">
+                    "dayplanConsigneeName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="dayplanConsigneeTel != null">
+                and
+                <foreach collection="dayplanConsigneeTel" item="item" open="(" separator="or" close=")">
+                    "dayplanConsigneeTel" like '%${item}%'
+                </foreach>
+            </if>
+        </where>
+        <include refid="orderBy"></include>
     </select>
 
-<!--  通过主键Id查询发运钢材到异地库计划数据用于修改  -->
+    <sql id="orderBy">
+        <if test="orderField != null and orderField != ''">
+            order by "${orderField}"
+            <if test="orderType != null and orderType != ''">
+                ${orderType}
+            </if>
+        </if>
+        <if test="orderField == null  ">
+            order by "insertTime" desc
+        </if>
+    </sql>
+
+    <!--  通过主键Id查询发运钢材到异地库计划数据用于修改  -->
     <select id="getRailOffseDayMes" parameterType="int" resultType="java.util.Map">
-        select
-               AROD.DAYPLAN_NO "dayplanNo",
-               AROD.CARRIER_ID "carrierId",
-               AROD.SHIPPER_ID "shipperId",
-               AROD.DAYPLAN_DATE "dayplanDate",
-               AROD.DAYPLAN_DELIVERY_DATE "dayplanDeliveryDate",
-               AROD.DAYPLAN_OWN_CARS_AMOUT "dayplanOwnCarsAmout",
+        select AROD.DAYPLAN_NO                "dayplanNo",
+               AROD.CARRIER_ID                "carrierId",
+               AROD.SHIPPER_ID                "shipperId",
+               AROD.DAYPLAN_DATE              "dayplanDate",
+               AROD.DAYPLAN_DELIVERY_DATE     "dayplanDeliveryDate",
+               AROD.DAYPLAN_OWN_CARS_AMOUT    "dayplanOwnCarsAmout",
                AROD.DAYPLAN_TO_THE_STATION_ID "dayplanToTheStationId",
-               AROD.DAYPLAN_WAGON_NUMBER "dayplanWagonNumber",
-               AROD.RECEIVING_UNIT_ID "receivingUnitId",
-               AROD.DAYPLAN_CONSIGNEE_NAME "dayplanConsigneeName",
-               AROD.DAYPLAN_CONSIGNEE_TEL "dayplanConsigneeTel"
+               AROD.DAYPLAN_WAGON_NUMBER      "dayplanWagonNumber",
+               AROD.RECEIVING_UNIT_ID         "receivingUnitId",
+               AROD.DAYPLAN_CONSIGNEE_NAME    "dayplanConsigneeName",
+               AROD.DAYPLAN_CONSIGNEE_TEL     "dayplanConsigneeTel"
         from AMS_RAIL_OFFSET_DAYPLAN AROD
         where AROD.DAYPLAN_ID = #{dayplanId}
     </select>
 
-<!--   通过发运计划主键查询关联所有物资信息 -->
-    <select id="getMaterialMesByDayPlanId"  parameterType="int" resultType="java.util.Map">
-        select OFFSET_MATERIAL_ID "offsetMaterialId",
-               OFFSET_MATERIAL_NUMBER "offsetMaterialNumber",
-               OFFSET_MATERIAL_WEIGHT "offsetMaterialWeight"
-        from AMS_RAIL_OFFSET_MATERIAL AROM
-        where DAYPLAN_ID = #{dayplanId}
+    <!--   通过发运计划主键查询关联所有物资信息 -->
+    <select id="getMaterialMesByDayPlanId" parameterType="java.util.Map" resultType="java.util.Map">
+        SELECT *
+        FROM (SELECT
+        rm.material_id as "materialId",
+        rm.material_code as "materialCode",
+        rm.material_specification as "materialSpecification",
+        rm.material_model as "materialMode",
+        RM.MATERIAL_NAME AS "materailName",
+        AROM.OFFSET_MATERIAL_NUMBER AS "materialNumber",
+        AROM.OFFSET_MATERIAL_WEIGHT AS "materialWeight"
+        FROM AMS_RAIL_OFFSET_MATERIAL AROM
+        LEFT JOIN RMS_MATERIAL RM
+        ON AROM.MATERIAL_ID = RM.MATERIAL_ID
+        WHERE arom.dayplan_id = #{dayplanId})
+        <where>
+            <if test="materailName != null">
+                and
+                <foreach collection="materailName" item="item" open="(" separator="or" close=")">
+                    "materailName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="materialNumber != null">
+                and
+                <foreach collection="materialNumber" item="item" open="(" separator="or" close=")">
+                    "materialNumber" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="materialWeight != null">
+                and
+                <foreach collection="materialWeight" item="item" open="(" separator="or" close=")">
+                    "materialWeight" like '%${item}%'
+                </foreach>
+            </if>
+        </where>
+    </select>
+
+    <!-- 到站下拉 -->
+    <select id="getdayPlanToTheStationId" resultType="java.util.Map">
+        SELECT RAS.ARRIVAL_ID   AS "id",
+               RAS.ARRIVAL_ID   AS "value",
+               RAS.ARRIVAL_NAME AS "label"
+        FROM RMSTRAIN_ARRIVAL_SEND RAS
+    </select>
+    <select id="getRailOffsetDayplanId" resultType="java.util.Map">
+        SELECT *
+        FROM (SELECT AROD.DAYPLAN_ID AS "dayPlanId",
+        AROD.DAYPLAN_NO AS "dayplanNo",
+        AROD.DAYPLAN_DATE AS "dayplanDate",
+        RS.SHIPPER_NAME AS "shipperName",
+        AROD.DAYPLAN_DELIVERY_DATE AS "dayplanDeliveryDate",
+        RAS.TRANSFER_UNIT AS "transferUnit",
+        AROD.DAYPLAN_OWN_CARS_AMOUT AS "dayplanOwnCarsAmout",
+        AROD.DAYPLAN_WAGON_NUMBER AS "dayplanWagonNumber",
+        RAS.ARRIVAL_NAME AS "arrivalName",
+        RAS.DAYPLAN_DEDICATED_LINE AS "dayplanDedicatedLine",
+        RW.WAREHOUSE_NAME AS "wareHouseName",
+        AROD.DAYPLAN_CONSIGNEE_NAME AS "dayplanConsigneeName",
+        AROD.DAYPLAN_CONSIGNEE_TEL AS "dayplanConsigneeTel",
+        AROD.INSERT_TIME AS "insertTime"
+        FROM AMS_RAIL_OFFSET_DAYPLAN AROD
+        LEFT JOIN RMS_SHIPPER RS
+        ON AROD.SHIPPER_ID = RS.SHIPPER_ID
+        LEFT JOIN RMSTRAIN_ARRIVAL_SEND RAS
+        ON AROD.DAYPLAN_TO_THE_STATION_ID = RAS.ARRIVAL_ID
+        LEFT JOIN RMS_WAREHOUSE RW
+        ON RW.WAREHOUSE_ID = AROD.RECEIVING_UNIT_ID
+        WHERE AROD.DELETED = 0
+        and
+        arod.dayplan_id=#{dayPlanId}
+        )
+        <where>
+            <if test="dayplanNo != null">
+                and
+                <foreach collection="dayplanNo" item="item" open="(" separator="or" close=")">
+                    "dayplanNo" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="dayplanDate != null">
+                and
+                <foreach collection="dayplanDate" item="item" open="(" separator="or" close=")">
+                    "dayplanDate" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="shipperName != null">
+                and
+                <foreach collection="shipperName" item="item" open="(" separator="or" close=")">
+                    "shipperName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="dayplanDeliveryDate != null">
+                and
+                <foreach collection="dayplanDeliveryDate" item="item" open="(" separator="or" close=")">
+                    "dayplanDeliveryDate" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="transferUnit != null">
+                and
+                <foreach collection="transferUnit" item="item" open="(" separator="or" close=")">
+                    "transferUnit" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="dayplanOwnCarsAmout != null">
+                and
+                <foreach collection="dayplanOwnCarsAmout" item="item" open="(" separator="or" close=")">
+                    "dayplanOwnCarsAmout" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="dayplanWagonNumber != null">
+                and
+                <foreach collection="dayplanWagonNumber" item="item" open="(" separator="or" close=")">
+                    "dayplanWagonNumber" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="arrivalName != null">
+                and
+                <foreach collection="arrivalName" item="item" open="(" separator="or" close=")">
+                    "arrivalName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="dayplanDedicatedLine != null">
+                and
+                <foreach collection="dayplanDedicatedLine" item="item" open="(" separator="or" close=")">
+                    "dayplanDedicatedLine" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="wareHouseName != null">
+                and
+                <foreach collection="wareHouseName" item="item" open="(" separator="or" close=")">
+                    "wareHouseName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="dayplanConsigneeName != null">
+                and
+                <foreach collection="dayplanConsigneeName" item="item" open="(" separator="or" close=")">
+                    "dayplanConsigneeName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="dayplanConsigneeTel != null">
+                and
+                <foreach collection="dayplanConsigneeTel" item="item" open="(" separator="or" close=")">
+                    "dayplanConsigneeTel" like '%${item}%'
+                </foreach>
+            </if>
+        </where>
+        <include refid="orderBy"></include>
     </select>
 </mapper>

+ 27 - 11
src/main/resources/com/steerinfo/dil/mapper/AmsSalePlanMapper.xml

@@ -438,16 +438,32 @@
     select r_s_area.AREA_NAME "areaName" from RMS_SALE_AREA r_s_area where r_s_area.AREA_ID = #{areaId}
   </select>
 
-<!-- 查询所有钢材物资 -->
-  <select id="getAllSteelMaterialMes"  parameterType="java.util.Map" resultType="java.util.Map">
-    SELECT
-      RM.MATERIAL_ID "materialId",
-      RM.MATERIAL_CODE "materialCode",
-      RM.MATERIAL_NAME "materialName",
-      CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('),  CONCAT(RM.MATERIAL_MODEL, ')')) "Specification",
-           RM.MATERIAL_THEORETICAL_WEIGHT "materialTheoreticalWeight"
-    FROM RMS_MATERIAL RM
-    WHERE RM.MATERIAL_CODE LIKE '0801%' and ROWNUM &lt; 101
-  </select>
+<!--&lt;!&ndash; 查询所有钢材物资 &ndash;&gt;-->
+<!--  <select id="getAllSteelMaterialMes"  parameterType="java.util.Map" resultType="java.util.Map">-->
+<!--<<<<<<< HEAD-->
+<!--    SELECT-->
+<!--      RM.MATERIAL_ID "materialId",-->
+<!--      RM.MATERIAL_CODE "materialCode",-->
+<!--      RM.MATERIAL_NAME "materialName",-->
+<!--      CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('),  CONCAT(RM.MATERIAL_MODEL, ')')) "Specification",-->
+<!--           RM.MATERIAL_THEORETICAL_WEIGHT "materialTheoreticalWeight"-->
+<!--    FROM RMS_MATERIAL RM-->
+<!--    WHERE RM.MATERIAL_CODE LIKE '0801%' and ROWNUM &lt; 101-->
+<!--=======-->
+<!--    select *-->
+<!--    from (-->
+<!--           SELECT RM.MATERIAL_ID                                                                 "materialId",-->
+<!--                  RM.MATERIAL_CODE                                                               "materialCode",-->
+<!--                  RM.MATERIAL_NAME                                                               "materialName",-->
+<!--                  CONCAT(CONCAT(RM.MATERIAL_SPECIFICATION, '('), CONCAT(RM.MATERIAL_MODEL, ')')) "Specification"-->
+<!--           FROM RMS_MATERIAL RM-->
+<!--           WHERE RM.MATERIAL_CODE LIKE '0801%'-->
+<!--         ) t-->
+<!--    <if test="con != null">-->
+<!--      where t."materialName" LIKE #{con}-->
+<!--    </if>-->
+<!--    order by "materialCode"-->
+<!--&gt;>>>>>> 121cd8f37f14385d8dc6e384db413bc0caaaf51f-->
+<!--  </select>-->
 
 </mapper>

+ 263 - 48
src/main/resources/com/steerinfo/dil/mapper/AmstruckInwardPlanMapper.xml

@@ -14,16 +14,17 @@
         <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/>
         <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark"/>
         <result column="DELETED" jdbcType="DECIMAL" property="deleted"/>
+        <result column="PLAN_ISSUE_NAME" jdbcType="VARCHAR" property="planIssueName"/>
     </resultMap>
     <sql id="columns">
         PLAN_ID, PLAN_NUMBER, CARRIER_ID, PLAN_TRUCK_NUMBER, PLAN_STATUS, PLAN_ISSUE_TIME,
     INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
-    DELETED
+    DELETED, PLAN_ISSUE_NAME
     </sql>
     <sql id="columns_alias">
         t.PLAN_ID, t.PLAN_NUMBER, t.CARRIER_ID, t.PLAN_TRUCK_NUMBER, t.PLAN_STATUS, t.PLAN_ISSUE_TIME,
     t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK,
-    t.DELETED
+    t.DELETED, t.PLAN_ISSUE_NAME
     </sql>
     <sql id="select">
         SELECT
@@ -73,6 +74,9 @@
             <if test="deleted != null">
                 and DELETED = #{deleted}
             </if>
+            <if test="planIssueName != null and planIssueName != ''">
+                and PLAN_ISSUE_NAME = #{planIssueName}
+            </if>
         </where>
     </sql>
     <sql id="whereLike">
@@ -113,6 +117,9 @@
             <if test="deleted != null">
                 and DELETED = #{deleted}
             </if>
+            <if test="planIssueName != null and planIssueName != ''">
+                and PLAN_ISSUE_NAME LIKE '%${planIssueName}%'
+            </if>
         </where>
     </sql>
     <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
@@ -156,18 +163,23 @@
         <if test="deleted != null">
             or DELETED = #{deleted}
         </if>
+        <if test="planIssueName != null and planIssueName != ''">
+            or PLAN_ISSUE_NAME = #{planIssueName}
+        </if>
     </delete>
     <insert id="insert" parameterType="com.steerinfo.dil.model.AmstruckInwardPlan">
         insert into AMSTRUCK_INWARD_PLAN (PLAN_ID, PLAN_NUMBER, CARRIER_ID,
                                           PLAN_TRUCK_NUMBER, PLAN_STATUS, PLAN_ISSUE_TIME,
                                           INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
-                                          UPDATE_TIME, INSERT_UPDATE_REMARK, DELETED)
+                                          UPDATE_TIME, INSERT_UPDATE_REMARK, DELETED,
+                                          PLAN_ISSUE_NAME)
         values (#{planId,jdbcType=DECIMAL}, #{planNumber,jdbcType=VARCHAR}, #{carrierId,jdbcType=DECIMAL},
                 #{planTruckNumber,jdbcType=DECIMAL}, #{planStatus,jdbcType=DECIMAL},
                 #{planIssueTime,jdbcType=TIMESTAMP},
                 #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP},
                 #{updateUsername,jdbcType=VARCHAR},
-                #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR}, #{deleted,jdbcType=DECIMAL})
+                #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR}, #{deleted,jdbcType=DECIMAL},
+                #{planIssueName,jdbcType=VARCHAR})
     </insert>
     <insert id="insertSelective" parameterType="com.steerinfo.dil.model.AmstruckInwardPlan">
         insert into AMSTRUCK_INWARD_PLAN
@@ -208,6 +220,9 @@
             <if test="deleted != null">
                 DELETED,
             </if>
+            <if test="planIssueName != null">
+                PLAN_ISSUE_NAME,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="planId != null">
@@ -246,6 +261,9 @@
             <if test="deleted != null">
                 #{deleted,jdbcType=DECIMAL},
             </if>
+            <if test="planIssueName != null">
+                #{planIssueName,jdbcType=VARCHAR},
+            </if>
         </trim>
     </insert>
     <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.AmstruckInwardPlan">
@@ -260,7 +278,8 @@
             UPDATE_USERNAME      = #{updateUsername,jdbcType=VARCHAR},
             UPDATE_TIME          = #{updateTime,jdbcType=TIMESTAMP},
             INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
-            DELETED              = #{deleted,jdbcType=DECIMAL}
+            DELETED              = #{deleted,jdbcType=DECIMAL},
+            PLAN_ISSUE_NAME      = #{planIssueName,jdbcType=VARCHAR}
         where PLAN_ID = #{planId,jdbcType=DECIMAL}
     </update>
     <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.AmstruckInwardPlan">
@@ -299,6 +318,9 @@
             <if test="deleted != null">
                 DELETED = #{deleted,jdbcType=DECIMAL},
             </if>
+            <if test="planIssueName != null">
+                PLAN_ISSUE_NAME = #{planIssueName,jdbcType=VARCHAR},
+            </if>
         </set>
         where PLAN_ID = #{planId,jdbcType=DECIMAL}
     </update>
@@ -321,7 +343,8 @@
         PLAN_STATUS, PLAN_ISSUE_TIME,
         INSERT_USERNAME, INSERT_TIME,
         UPDATE_USERNAME, UPDATE_TIME,
-        INSERT_UPDATE_REMARK, DELETED)
+        INSERT_UPDATE_REMARK, DELETED,
+        PLAN_ISSUE_NAME)
         ( <foreach collection="list" item="item" separator="union all">
         select
         #{item.planId,jdbcType=DECIMAL},
@@ -330,7 +353,8 @@
         #{item.planStatus,jdbcType=DECIMAL}, #{item.planIssueTime,jdbcType=TIMESTAMP},
         #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
         #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
-        #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.deleted,jdbcType=DECIMAL} from dual
+        #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.deleted,jdbcType=DECIMAL},
+        #{item.planIssueName,jdbcType=VARCHAR} from dual
     </foreach> )
     </insert>
     <update id="batchUpdate" parameterType="java.util.List">
@@ -384,6 +408,10 @@
         <foreach collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
             when #{item.planId,jdbcType=DECIMAL} then #{item.deleted,jdbcType=DECIMAL}
         </foreach>
+        ,PLAN_ISSUE_NAME=
+        <foreach collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
+            when #{item.planId,jdbcType=DECIMAL} then #{item.planIssueName,jdbcType=VARCHAR}
+        </foreach>
         where PLAN_ID in
         <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
             #{item.planId,jdbcType=DECIMAL}
@@ -401,43 +429,201 @@
     <!-- 展示运输计划 -->
     <select id="getTruckPlanList" resultType="java.util.Map" parameterType="java.util.Map">
         SELECT *
-        FROM (SELECT APO.PURCHASE_ORDER_NO              AS "purchaseOrderNo",
-                     RM.MATERIAL_NAME                   AS "materialName",
-                     DB.RESULT_FOREIGN_SHIP_NAME        AS "resultForeignShipName",
-                     AIP.PLAN_NUMBER                    AS "planNumber",
-                     RCA.CARRIER_NAME                   AS "carrierName",
-                     AIP.PLAN_TRUCK_NUMBER              AS "planTruckNumber",
-                     AIR.REQUIREMENT_NUMBER             AS "requirementNumber",
-                     AIR.REQUIREMENT_TYPE               AS "requirementType",
-                     RCT.CAPACITY_TYPE_NAME             AS "capacityTypeName",
-                     ARM.MATERIAL_COUNT                 AS "materialNumber",
-                     AIR.REQUIREMENT_TRUCK_TIME         AS "requirementTruckTime",
-                     RW.WAREHOUSE_NAME                  AS "wareHouseName",
-                     AIR.REQUIREMENT_WORK_TYPE          AS "requirementWorkType",
-                     AIR.REQUIREMENT_WORK_CONTENT       AS "requirementWorkContent",
-                     AIR.REQUIREMENT_WORK_ENVIRONMENT   AS "requirementWorkEnvironment",
-                     AIR.REQUIREMENT_ESTIMATED_DURATION AS "requirementEstimatedDuration",
-                     AIP.PLAN_ID                        AS "planId",
-                     AIP.INSERT_TIME                    AS "insertTime"
-              FROM AMSTRUCK_INWARD_PLAN AIP
-                       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 AMSTRUCK_REQUIREMENT_MATERIAL ARM
-                                 ON ARM.REQUIREMENT_ID = AIR.REQUIREMENT_ID
-                       LEFT JOIN AMS_PURCHASE_ORDER APO
-                                 ON APO.PURCHASE_ORDER_ID = AIR.PURCHASE_ORDER_ID
-                       LEFT JOIN DIL_BATCH DB
-                                 ON APO.BATCH_ID = DB.BATCH_ID
-                       LEFT JOIN RMS_MATERIAL RM
-                                 ON RM.MATERIAL_ID = DB.MATERIAL_ID
-                       LEFT JOIN RMS_WAREHOUSE RW
-                                 ON RW.WAREHOUSE_ID = AIR.REQUIREMNT_UNIT_ID
-                       LEFT JOIN RMS_CARRIER RCA
-                                 ON RCA.CARRIER_ID = AIP.CARRIER_ID
-                       LEFT JOIN RMS_CAPACITY_TYPE RCT
-                                 ON RCT.CAPACITY_TYPE_ID = AIR.CAPACITY_TYPE_ID)
+        FROM (SELECT APO.PURCHASE_ORDER_NO AS "purchaseOrderNo",
+        RM.MATERIAL_NAME AS "materialName",
+        DB.RESULT_FOREIGN_SHIP_NAME AS "resultForeignShipName",
+        AIP.PLAN_NUMBER AS "planNumber",
+        RCA.CARRIER_NAME AS "carrierName",
+        AIP.PLAN_TRUCK_NUMBER AS "planTruckNumber",
+        AIR.REQUIREMENT_NUMBER AS "requirementNumber",
+        AIR.REQUIREMENT_TYPE AS "requirementType",
+        RCT.CAPACITY_TYPE_NAME AS "capacityTypeName",
+        ARM.MATERIAL_COUNT AS "materialNumber",
+        ARM.MATERIAL_WEIGHT AS "materialWeight",
+        AIR.REQUIREMENT_TRUCK_TIME AS "requirementTruckTime",
+        RW.WAREHOUSE_NAME AS "wareHouseName",
+        AIR.REQUIREMENT_WORK_TYPE AS "requirementWorkType",
+        AIR.REQUIREMENT_WORK_CONTENT AS "requirementWorkContent",
+        AIR.REQUIREMENT_WORK_ENVIRONMENT AS "requirementWorkEnvironment",
+        AIR.REQUIREMENT_ESTIMATED_DURATION AS "requirementEstimatedDuration",
+        AIP.PLAN_ID AS "planId",
+        AIP.INSERT_TIME AS "insertTime"
+        FROM AMSTRUCK_INWARD_PLAN AIP
+        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 AMSTRUCK_REQUIREMENT_MATERIAL ARM
+        ON ARM.REQUIREMENT_ID = AIR.REQUIREMENT_ID
+        LEFT JOIN AMS_PURCHASE_ORDER APO
+        ON APO.PURCHASE_ORDER_ID = AIR.PURCHASE_ORDER_ID
+        LEFT JOIN DIL_BATCH DB
+        ON APO.BATCH_ID = DB.BATCH_ID
+        LEFT JOIN RMS_MATERIAL RM
+        ON RM.MATERIAL_ID = ARM.MATERIAL_ID
+        LEFT JOIN RMS_WAREHOUSE RW
+        ON RW.WAREHOUSE_ID = AIR.REQUIREMNT_UNIT_ID
+        LEFT JOIN RMS_CARRIER RCA
+        ON RCA.CARRIER_ID = AIP.CARRIER_ID
+        LEFT JOIN RMS_CAPACITY_TYPE RCT
+        ON RCT.CAPACITY_TYPE_ID = AIR.CAPACITY_TYPE_ID
+        WHERE AIP.PLAN_STATUS = #{planStatus}
+        AND AIP.DELETED = 0
+        )
+        <where>
+            <if test="purchaseOrderNo != null">
+                and
+                <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
+                    "purchaseOrderNo" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="materialName != null">
+                and
+                <foreach collection="materialName" item="item" open="(" separator="or" close=")">
+                    "materialName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="materialNumber != null">
+                and
+                <foreach collection="materialNumber" item="item" open="(" separator="or" close=")">
+                    "materialNumber" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="resultForeignShipName != null">
+                and
+                <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
+                    "resultForeignShipName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="requirementNumber != null">
+                and
+                <foreach collection="requirementNumber" item="item" open="(" separator="or" close=")">
+                    "requirementNumber" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="requirementType != null">
+                and
+                <foreach collection="requirementType" item="item" open="(" separator="or" close=")">
+                    "requirementType" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="capacityTypeName != null">
+                and
+                <foreach collection="capacityTypeName" item="item" open="(" separator="or" close=")">
+                    "capacityTypeName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="requirementTruckTime != null">
+                and
+                <foreach collection="requirementTruckTime" item="item" open="(" separator="or" close=")">
+                    "requirementTruckTime" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="requirementWorkType != null">
+                and
+                <foreach collection="requirementWorkType" item="item" open="(" separator="or" close=")">
+                    "requirementWorkType" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="requirementWorkContent != null">
+                and
+                <foreach collection="requirementWorkContent" item="item" open="(" separator="or" close=")">
+                    "requirementWorkContent" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="requirementWorkEnvironment != null">
+                and
+                <foreach collection="requirementWorkEnvironment" item="item" open="(" separator="or" close=")">
+                    "requirementWorkEnvironment" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="requirementEstimatedDuration != null">
+                and
+                <foreach collection="requirementEstimatedDuration" item="item" open="(" separator="or" close=")">
+                    "requirementEstimatedDuration" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="planNumber != null">
+                and
+                <foreach collection="planNumber" item="item" open="(" separator="or" close=")">
+                    "planNumber" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="carrierName != null">
+                and
+                <foreach collection="carrierName" item="item" open="(" separator="or" close=")">
+                    "carrierName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="planTruckNumber != null">
+                and
+                <foreach collection="planTruckNumber" item="item" open="(" separator="or" close=")">
+                    "planTruckNumber" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="wareHouseName != null">
+                and
+                <foreach collection="wareHouseName" item="item" open="(" separator="or" close=")">
+                    "wareHouseName" like '%${item}%'
+                </foreach>
+            </if>
+        </where>
+        <include refid="orderBy"></include>
+    </select>
+
+    <!-- 展示运输计划 -->
+    <select id="getIssuedPlanList" resultType="java.util.Map" parameterType="java.util.Map">
+        SELECT *
+        FROM (SELECT APO.PURCHASE_ORDER_NO AS "purchaseOrderNo",
+        RM.MATERIAL_NAME AS "materialName",
+        DB.RESULT_FOREIGN_SHIP_NAME AS "resultForeignShipName",
+        AIP.PLAN_NUMBER AS "planNumber",
+        RCA.CARRIER_NAME AS "carrierName",
+        AIP.PLAN_TRUCK_NUMBER AS "planTruckNumber",
+        AIR.REQUIREMENT_NUMBER AS "requirementNumber",
+        AIP.PLAN_ISSUE_TIME AS "planIssueTime",
+        AIP.PLAN_ISSUE_NAME AS "planIssueName",
+        AIR.REQUIREMENT_TYPE AS "requirementType",
+        RCT.CAPACITY_TYPE_NAME AS "capacityTypeName",
+        ARM.MATERIAL_COUNT AS "materialNumber",
+        ARM.MATERIAL_WEIGHT AS "materialWeight",
+        AIR.REQUIREMENT_TRUCK_TIME AS "requirementTruckTime",
+        RW.WAREHOUSE_NAME AS "wareHouseName",
+        AIR.REQUIREMENT_WORK_TYPE AS "requirementWorkType",
+        AIR.REQUIREMENT_WORK_CONTENT AS "requirementWorkContent",
+        AIR.REQUIREMENT_WORK_ENVIRONMENT AS "requirementWorkEnvironment",
+        AIR.REQUIREMENT_ESTIMATED_DURATION AS "requirementEstimatedDuration",
+        AIP.PLAN_ID AS "planId",
+        AIP.CARRIER_ID AS "carrierId",
+        AIP.INSERT_TIME AS "insertTime"
+        FROM AMSTRUCK_INWARD_PLAN AIP
+        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 AMSTRUCK_REQUIREMENT_MATERIAL ARM
+        ON ARM.REQUIREMENT_ID = AIR.REQUIREMENT_ID
+        LEFT JOIN AMS_PURCHASE_ORDER APO
+        ON APO.PURCHASE_ORDER_ID = AIR.PURCHASE_ORDER_ID
+        LEFT JOIN DIL_BATCH DB
+        ON APO.BATCH_ID = DB.BATCH_ID
+        LEFT JOIN RMS_MATERIAL RM
+        ON RM.MATERIAL_ID = DB.MATERIAL_ID
+        LEFT JOIN RMS_WAREHOUSE RW
+        ON RW.WAREHOUSE_ID = AIR.REQUIREMNT_UNIT_ID
+        LEFT JOIN RMS_CARRIER RCA
+        ON RCA.CARRIER_ID = AIP.CARRIER_ID
+        LEFT JOIN RMS_CAPACITY_TYPE RCT
+        ON RCT.CAPACITY_TYPE_ID = AIR.CAPACITY_TYPE_ID
+        WHERE AIP.PLAN_STATUS = #{planStatus}
+        AND AIP.DELETED = 0
+        <if test="planId != null">
+            and AIP.PLAN_ID = #{planId}
+        </if>
+        <if test="carrierId != null">
+            and AIP.CARRIER_ID = #{carrierId}
+        </if>
+        )
         <where>
             <if test="purchaseOrderNo != null">
                 and
@@ -457,6 +643,12 @@
                     "materialNumber" like '%${item}%'
                 </foreach>
             </if>
+            <if test="materialWeight != null">
+                and
+                <foreach collection="materialWeight" item="item" open="(" separator="or" close=")">
+                    "materialWeight" like '%${item}%'
+                </foreach>
+            </if>
             <if test="resultForeignShipName != null">
                 and
                 <foreach collection="resultForeignShipName" item="item" open="(" separator="or" close=")">
@@ -475,6 +667,18 @@
                     "requirementType" like '%${item}%'
                 </foreach>
             </if>
+            <if test="planIssueTime != null">
+                and
+                <foreach collection="planIssueTime" item="item" open="(" separator="or" close=")">
+                    "planIssueTime" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="planIssueName != null">
+                and
+                <foreach collection="planIssueName" item="item" open="(" separator="or" close=")">
+                    "planIssueName" like '%${item}%'
+                </foreach>
+            </if>
             <if test="capacityTypeName != null">
                 and
                 <foreach collection="capacityTypeName" item="item" open="(" separator="or" close=")">
@@ -552,11 +756,22 @@
     </sql>
 
     <select id="selectInwardPlanToUpdate" parameterType="DECIMAL" resultType="java.util.Map">
-        SELECT AIP.PLAN_NUMBER       AS "planNumber",
-               AIP.CARRIER_ID        AS "carrierId",
-               AIP.PLAN_TRUCK_NUMBER AS "planTruckNumber",
-               AIP.PLAN_STATUS       AS "planStatus"
+        SELECT AIP.CARRIER_ID         AS "carrierId",
+               AIP.PLAN_TRUCK_NUMBER  AS "planTruckNumber",
+               AIR.REQUIREMENT_NUMBER AS "requirementNumber",
+               AIP.PLAN_NUMBER        AS "planNumber"
         FROM AMSTRUCK_INWARD_PLAN AIP
+                 LEFT JOIN AMSTRUCK_REQUIREMENT_PLAN ARP
+                           ON AIP.PLAN_ID = ARP.PLAN_ID
+                 LEFT JOIN AMSTRUCK_INWARD_REQUIREMENT AIR
+                           ON AIR.REQUIREMENT_ID = ARP.REQUIREMENT_ID
         WHERE AIP.PLAN_ID = #{planId}
     </select>
+
+    <select id="getCarrierList" resultType="java.util.Map">
+        SELECT RC.CARRIER_ID   AS "id",
+               RC.CARRIER_ID   AS "value",
+               RC.CARRIER_NAME AS "label"
+        FROM RMS_CARRIER RC
+    </select>
 </mapper>

+ 180 - 111
src/main/resources/com/steerinfo/dil/mapper/AmstruckInwardRequirementMapper.xml

@@ -2,51 +2,50 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.steerinfo.dil.mapper.AmstruckInwardRequirementMapper">
     <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.AmstruckInwardRequirement">
-        <id column="REQUIREMENT_ID" jdbcType="DECIMAL" property="requirementId"/>
-        <result column="PURCHASE_ORDER_ID" jdbcType="DECIMAL" property="purchaseOrderId"/>
-        <result column="REQUIREMENT_NUMBER" jdbcType="VARCHAR" property="requirementNumber"/>
-        <result column="REQUIREMENT_TYPE" jdbcType="VARCHAR" property="requirementType"/>
-        <result column="CAPACITY_TYPE_ID" jdbcType="DECIMAL" property="capacityTypeId"/>
-        <result column="REQUIREMENT_TRUCK_TIME" jdbcType="TIMESTAMP" property="requirementTruckTime"/>
-        <result column="REQUIREMENT_SHIPPER_ID" jdbcType="DECIMAL" property="requirementShipperId"/>
-        <result column="REQUIREMENT_WORK_TYPE" jdbcType="DECIMAL" property="requirementWorkType"/>
-        <result column="REQUIREMENT_WORK_CONTENT" jdbcType="VARCHAR" property="requirementWorkContent"/>
-        <result column="LINE_ID" jdbcType="DECIMAL" property="lineId"/>
-        <result column="REQUIREMENT_WORK_ENVIRONMENT" jdbcType="VARCHAR" property="requirementWorkEnvironment"/>
-        <result column="REQUIREMENT_ESTIMATED_DURATION" jdbcType="DECIMAL" property="requirementEstimatedDuration"/>
-        <result column="REQUIREMENT_OVERLIMIT" jdbcType="VARCHAR" property="requirementOverlimit"/>
-        <result column="REQUIREMNT_UNIT_ID" jdbcType="DECIMAL" property="requiremntUnitId"/>
-        <result column="REQUIREMENT_STATUS" jdbcType="DECIMAL" property="requirementStatus"/>
-        <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername"/>
-        <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime"/>
-        <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername"/>
-        <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/>
-        <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark"/>
-        <result column="DELETED" jdbcType="DECIMAL" property="deleted"/>
+        <id column="REQUIREMENT_ID" jdbcType="DECIMAL" property="requirementId" />
+        <result column="PURCHASE_ORDER_ID" jdbcType="DECIMAL" property="purchaseOrderId" />
+        <result column="REQUIREMENT_NUMBER" jdbcType="VARCHAR" property="requirementNumber" />
+        <result column="REQUIREMENT_TYPE" jdbcType="VARCHAR" property="requirementType" />
+        <result column="CAPACITY_TYPE_ID" jdbcType="DECIMAL" property="capacityTypeId" />
+        <result column="REQUIREMENT_TRUCK_TIME" jdbcType="TIMESTAMP" property="requirementTruckTime" />
+        <result column="REQUIREMENT_SHIPPER_ID" jdbcType="DECIMAL" property="requirementShipperId" />
+        <result column="REQUIREMENT_WORK_TYPE" jdbcType="DECIMAL" property="requirementWorkType" />
+        <result column="REQUIREMENT_WORK_CONTENT" jdbcType="VARCHAR" property="requirementWorkContent" />
+        <result column="LINE_ID" jdbcType="DECIMAL" property="lineId" />
+        <result column="REQUIREMENT_WORK_ENVIRONMENT" jdbcType="VARCHAR" property="requirementWorkEnvironment" />
+        <result column="REQUIREMENT_ESTIMATED_DURATION" jdbcType="DECIMAL" property="requirementEstimatedDuration" />
+        <result column="REQUIREMENT_OVERLIMIT" jdbcType="VARCHAR" property="requirementOverlimit" />
+        <result column="REQUIREMNT_UNIT_ID" jdbcType="DECIMAL" property="requiremntUnitId" />
+        <result column="REQUIREMENT_STATUS" jdbcType="DECIMAL" property="requirementStatus" />
+        <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
+        <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
+        <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
+        <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
+        <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
+        <result column="DELETED" jdbcType="DECIMAL" property="deleted" />
+        <result column="REQUIREMENT_UNLOAD_UNIT_ID" jdbcType="DECIMAL" property="requirementUnloadUnitId" />
+        <result column="REQUIREMENT_PLATFORM_ID " jdbcType="DECIMAL" property="requirementPlatformId" />
     </resultMap>
     <sql id="columns">
-        REQUIREMENT_ID, PURCHASE_ORDER_ID, REQUIREMENT_NUMBER, REQUIREMENT_TYPE, CAPACITY_TYPE_ID,
-    REQUIREMENT_TRUCK_TIME, REQUIREMENT_SHIPPER_ID, REQUIREMENT_WORK_TYPE, REQUIREMENT_WORK_CONTENT,
-    LINE_ID, REQUIREMENT_WORK_ENVIRONMENT, REQUIREMENT_ESTIMATED_DURATION, REQUIREMENT_OVERLIMIT,
-    REQUIREMNT_UNIT_ID, REQUIREMENT_STATUS, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
-    UPDATE_TIME, INSERT_UPDATE_REMARK, DELETED
+        REQUIREMENT_ID, PURCHASE_ORDER_ID, REQUIREMENT_NUMBER, REQUIREMENT_TYPE, CAPACITY_TYPE_ID, 
+    REQUIREMENT_TRUCK_TIME, REQUIREMENT_SHIPPER_ID, REQUIREMENT_WORK_TYPE, REQUIREMENT_WORK_CONTENT, 
+    LINE_ID, REQUIREMENT_WORK_ENVIRONMENT, REQUIREMENT_ESTIMATED_DURATION, REQUIREMENT_OVERLIMIT, 
+    REQUIREMNT_UNIT_ID, REQUIREMENT_STATUS, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, 
+    UPDATE_TIME, INSERT_UPDATE_REMARK, DELETED, REQUIREMENT_UNLOAD_UNIT_ID, "REQUIREMENT_PLATFORM_ID "
     </sql>
     <sql id="columns_alias">
-        t.REQUIREMENT_ID, t.PURCHASE_ORDER_ID, t.REQUIREMENT_NUMBER, t.REQUIREMENT_TYPE,
-    t.CAPACITY_TYPE_ID, t.REQUIREMENT_TRUCK_TIME, t.REQUIREMENT_SHIPPER_ID, t.REQUIREMENT_WORK_TYPE,
-    t.REQUIREMENT_WORK_CONTENT, t.LINE_ID, t.REQUIREMENT_WORK_ENVIRONMENT, t.REQUIREMENT_ESTIMATED_DURATION,
-    t.REQUIREMENT_OVERLIMIT, t.REQUIREMNT_UNIT_ID, t.REQUIREMENT_STATUS, t.INSERT_USERNAME,
-    t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, t.DELETED
+        t.REQUIREMENT_ID, t.PURCHASE_ORDER_ID, t.REQUIREMENT_NUMBER, t.REQUIREMENT_TYPE, 
+    t.CAPACITY_TYPE_ID, t.REQUIREMENT_TRUCK_TIME, t.REQUIREMENT_SHIPPER_ID, t.REQUIREMENT_WORK_TYPE, 
+    t.REQUIREMENT_WORK_CONTENT, t.LINE_ID, t.REQUIREMENT_WORK_ENVIRONMENT, t.REQUIREMENT_ESTIMATED_DURATION, 
+    t.REQUIREMENT_OVERLIMIT, t.REQUIREMNT_UNIT_ID, t.REQUIREMENT_STATUS, t.INSERT_USERNAME, 
+    t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, t.DELETED, 
+    t.REQUIREMENT_UNLOAD_UNIT_ID, t."REQUIREMENT_PLATFORM_ID "
     </sql>
     <sql id="select">
-        SELECT
-        <include refid="columns"/>
-        FROM AMSTRUCK_INWARD_REQUIREMENT
+        SELECT <include refid="columns" /> FROM AMSTRUCK_INWARD_REQUIREMENT
     </sql>
     <sql id="select_alias">
-        SELECT
-        <include refid="columns_alias"/>
-        FROM AMSTRUCK_INWARD_REQUIREMENT t
+        SELECT <include refid="columns_alias" /> FROM AMSTRUCK_INWARD_REQUIREMENT t
     </sql>
     <sql id="where">
         <where>
@@ -113,6 +112,12 @@
             <if test="deleted != null">
                 and DELETED = #{deleted}
             </if>
+            <if test="requirementUnloadUnitId != null">
+                and REQUIREMENT_UNLOAD_UNIT_ID = #{requirementUnloadUnitId}
+            </if>
+            <if test="requirementPlatformId != null">
+                and REQUIREMENT_PLATFORM_ID  = #{requirementPlatformId}
+            </if>
         </where>
     </sql>
     <sql id="whereLike">
@@ -180,11 +185,16 @@
             <if test="deleted != null">
                 and DELETED = #{deleted}
             </if>
+            <if test="requirementUnloadUnitId != null">
+                and REQUIREMENT_UNLOAD_UNIT_ID = #{requirementUnloadUnitId}
+            </if>
+            <if test="requirementPlatformId != null">
+                and REQUIREMENT_PLATFORM_ID  = #{requirementPlatformId}
+            </if>
         </where>
     </sql>
     <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
-        delete
-        from AMSTRUCK_INWARD_REQUIREMENT
+        delete from AMSTRUCK_INWARD_REQUIREMENT
         where REQUIREMENT_ID = #{requirementId,jdbcType=DECIMAL}
     </delete>
     <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
@@ -250,6 +260,12 @@
         <if test="deleted != null">
             or DELETED = #{deleted}
         </if>
+        <if test="requirementUnloadUnitId != null">
+            or REQUIREMENT_UNLOAD_UNIT_ID = #{requirementUnloadUnitId}
+        </if>
+        <if test="requirementPlatformId != null">
+            or REQUIREMENT_PLATFORM_ID  = #{requirementPlatformId}
+        </if>
     </delete>
     <insert id="insert" parameterType="com.steerinfo.dil.model.AmstruckInwardRequirement">
         insert into AMSTRUCK_INWARD_REQUIREMENT (REQUIREMENT_ID, PURCHASE_ORDER_ID, REQUIREMENT_NUMBER,
@@ -259,19 +275,17 @@
                                                  REQUIREMENT_ESTIMATED_DURATION, REQUIREMENT_OVERLIMIT,
                                                  REQUIREMNT_UNIT_ID, REQUIREMENT_STATUS, INSERT_USERNAME,
                                                  INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME,
-                                                 INSERT_UPDATE_REMARK, DELETED)
-        values (#{requirementId,jdbcType=DECIMAL}, #{purchaseOrderId,jdbcType=DECIMAL},
-                #{requirementNumber,jdbcType=VARCHAR},
-                #{requirementType,jdbcType=VARCHAR}, #{capacityTypeId,jdbcType=DECIMAL},
-                #{requirementTruckTime,jdbcType=TIMESTAMP},
+                                                 INSERT_UPDATE_REMARK, DELETED, REQUIREMENT_UNLOAD_UNIT_ID,
+                                                 "REQUIREMENT_PLATFORM_ID ")
+        values (#{requirementId,jdbcType=DECIMAL}, #{purchaseOrderId,jdbcType=DECIMAL}, #{requirementNumber,jdbcType=VARCHAR},
+                #{requirementType,jdbcType=VARCHAR}, #{capacityTypeId,jdbcType=DECIMAL}, #{requirementTruckTime,jdbcType=TIMESTAMP},
                 #{requirementShipperId,jdbcType=DECIMAL}, #{requirementWorkType,jdbcType=DECIMAL},
-                #{requirementWorkContent,jdbcType=VARCHAR}, #{lineId,jdbcType=DECIMAL},
-                #{requirementWorkEnvironment,jdbcType=VARCHAR},
+                #{requirementWorkContent,jdbcType=VARCHAR}, #{lineId,jdbcType=DECIMAL}, #{requirementWorkEnvironment,jdbcType=VARCHAR},
                 #{requirementEstimatedDuration,jdbcType=DECIMAL}, #{requirementOverlimit,jdbcType=VARCHAR},
-                #{requiremntUnitId,jdbcType=DECIMAL}, #{requirementStatus,jdbcType=DECIMAL},
-                #{insertUsername,jdbcType=VARCHAR},
+                #{requiremntUnitId,jdbcType=DECIMAL}, #{requirementStatus,jdbcType=DECIMAL}, #{insertUsername,jdbcType=VARCHAR},
                 #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
-                #{insertUpdateRemark,jdbcType=VARCHAR}, #{deleted,jdbcType=DECIMAL})
+                #{insertUpdateRemark,jdbcType=VARCHAR}, #{deleted,jdbcType=DECIMAL}, #{requirementUnloadUnitId,jdbcType=DECIMAL},
+                #{requirementPlatformId,jdbcType=DECIMAL})
     </insert>
     <insert id="insertSelective" parameterType="com.steerinfo.dil.model.AmstruckInwardRequirement">
         insert into AMSTRUCK_INWARD_REQUIREMENT
@@ -339,6 +353,12 @@
             <if test="deleted != null">
                 DELETED,
             </if>
+            <if test="requirementUnloadUnitId != null">
+                REQUIREMENT_UNLOAD_UNIT_ID,
+            </if>
+            <if test="requirementPlatformId != null">
+                "REQUIREMENT_PLATFORM_ID ",
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="requirementId != null">
@@ -404,30 +424,38 @@
             <if test="deleted != null">
                 #{deleted,jdbcType=DECIMAL},
             </if>
+            <if test="requirementUnloadUnitId != null">
+                #{requirementUnloadUnitId,jdbcType=DECIMAL},
+            </if>
+            <if test="requirementPlatformId != null">
+                #{requirementPlatformId,jdbcType=DECIMAL},
+            </if>
         </trim>
     </insert>
     <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.AmstruckInwardRequirement">
         update AMSTRUCK_INWARD_REQUIREMENT
-        set PURCHASE_ORDER_ID              = #{purchaseOrderId,jdbcType=DECIMAL},
-            REQUIREMENT_NUMBER             = #{requirementNumber,jdbcType=VARCHAR},
-            REQUIREMENT_TYPE               = #{requirementType,jdbcType=VARCHAR},
-            CAPACITY_TYPE_ID               = #{capacityTypeId,jdbcType=DECIMAL},
-            REQUIREMENT_TRUCK_TIME         = #{requirementTruckTime,jdbcType=TIMESTAMP},
-            REQUIREMENT_SHIPPER_ID         = #{requirementShipperId,jdbcType=DECIMAL},
-            REQUIREMENT_WORK_TYPE          = #{requirementWorkType,jdbcType=DECIMAL},
-            REQUIREMENT_WORK_CONTENT       = #{requirementWorkContent,jdbcType=VARCHAR},
-            LINE_ID                        = #{lineId,jdbcType=DECIMAL},
-            REQUIREMENT_WORK_ENVIRONMENT   = #{requirementWorkEnvironment,jdbcType=VARCHAR},
+        set PURCHASE_ORDER_ID = #{purchaseOrderId,jdbcType=DECIMAL},
+            REQUIREMENT_NUMBER = #{requirementNumber,jdbcType=VARCHAR},
+            REQUIREMENT_TYPE = #{requirementType,jdbcType=VARCHAR},
+            CAPACITY_TYPE_ID = #{capacityTypeId,jdbcType=DECIMAL},
+            REQUIREMENT_TRUCK_TIME = #{requirementTruckTime,jdbcType=TIMESTAMP},
+            REQUIREMENT_SHIPPER_ID = #{requirementShipperId,jdbcType=DECIMAL},
+            REQUIREMENT_WORK_TYPE = #{requirementWorkType,jdbcType=DECIMAL},
+            REQUIREMENT_WORK_CONTENT = #{requirementWorkContent,jdbcType=VARCHAR},
+            LINE_ID = #{lineId,jdbcType=DECIMAL},
+            REQUIREMENT_WORK_ENVIRONMENT = #{requirementWorkEnvironment,jdbcType=VARCHAR},
             REQUIREMENT_ESTIMATED_DURATION = #{requirementEstimatedDuration,jdbcType=DECIMAL},
-            REQUIREMENT_OVERLIMIT          = #{requirementOverlimit,jdbcType=VARCHAR},
-            REQUIREMNT_UNIT_ID             = #{requiremntUnitId,jdbcType=DECIMAL},
-            REQUIREMENT_STATUS             = #{requirementStatus,jdbcType=DECIMAL},
-            INSERT_USERNAME                = #{insertUsername,jdbcType=VARCHAR},
-            INSERT_TIME                    = #{insertTime,jdbcType=TIMESTAMP},
-            UPDATE_USERNAME                = #{updateUsername,jdbcType=VARCHAR},
-            UPDATE_TIME                    = #{updateTime,jdbcType=TIMESTAMP},
-            INSERT_UPDATE_REMARK           = #{insertUpdateRemark,jdbcType=VARCHAR},
-            DELETED                        = #{deleted,jdbcType=DECIMAL}
+            REQUIREMENT_OVERLIMIT = #{requirementOverlimit,jdbcType=VARCHAR},
+            REQUIREMNT_UNIT_ID = #{requiremntUnitId,jdbcType=DECIMAL},
+            REQUIREMENT_STATUS = #{requirementStatus,jdbcType=DECIMAL},
+            INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
+            INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
+            UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
+            UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
+            INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
+            DELETED = #{deleted,jdbcType=DECIMAL},
+            REQUIREMENT_UNLOAD_UNIT_ID = #{requirementUnloadUnitId,jdbcType=DECIMAL},
+            "REQUIREMENT_PLATFORM_ID " = #{requirementPlatformId,jdbcType=DECIMAL}
         where REQUIREMENT_ID = #{requirementId,jdbcType=DECIMAL}
     </update>
     <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.AmstruckInwardRequirement">
@@ -493,20 +521,26 @@
             <if test="deleted != null">
                 DELETED = #{deleted,jdbcType=DECIMAL},
             </if>
+            <if test="requirementUnloadUnitId != null">
+                REQUIREMENT_UNLOAD_UNIT_ID = #{requirementUnloadUnitId,jdbcType=DECIMAL},
+            </if>
+            <if test="requirementPlatformId != null">
+                "REQUIREMENT_PLATFORM_ID " = #{requirementPlatformId,jdbcType=DECIMAL},
+            </if>
         </set>
         where REQUIREMENT_ID = #{requirementId,jdbcType=DECIMAL}
     </update>
     <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
-        <include refid="select"/>
+        <include refid="select" />
         where REQUIREMENT_ID = #{requirementId,jdbcType=DECIMAL}
     </select>
     <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
-        <include refid="select"/>
-        <include refid="where"/>
+        <include refid="select" />
+        <include refid="where" />
     </select>
     <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
-        <include refid="select"/>
-        <include refid="whereLike"/>
+        <include refid="select" />
+        <include refid="whereLike" />
     </select>
     <insert id="batchInsert" parameterType="java.util.List">
         insert into AMSTRUCK_INWARD_REQUIREMENT
@@ -520,7 +554,9 @@
         REQUIREMNT_UNIT_ID, REQUIREMENT_STATUS,
         INSERT_USERNAME, INSERT_TIME,
         UPDATE_USERNAME, UPDATE_TIME,
-        INSERT_UPDATE_REMARK, DELETED)
+        INSERT_UPDATE_REMARK, DELETED,
+        REQUIREMENT_UNLOAD_UNIT_ID, "REQUIREMENT_PLATFORM_ID "
+        )
         ( <foreach collection="list" item="item" separator="union all">
         select
         #{item.requirementId,jdbcType=DECIMAL},
@@ -533,110 +569,121 @@
         #{item.requiremntUnitId,jdbcType=DECIMAL}, #{item.requirementStatus,jdbcType=DECIMAL},
         #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
         #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
-        #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.deleted,jdbcType=DECIMAL} from dual
+        #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.deleted,jdbcType=DECIMAL},
+        #{item.requirementUnloadUnitId,jdbcType=DECIMAL}, #{item.requirementPlatformId,jdbcType=DECIMAL}
+        from dual
     </foreach> )
     </insert>
     <update id="batchUpdate" parameterType="java.util.List">
         update AMSTRUCK_INWARD_REQUIREMENT
         set
         REQUIREMENT_ID=
-        <foreach collection="list" item="item" index="index" separator=" " open="case REQUIREMENT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_ID" separator=" ">
             when #{item.requirementId,jdbcType=DECIMAL} then #{item.requirementId,jdbcType=DECIMAL}
         </foreach>
         ,PURCHASE_ORDER_ID=
-        <foreach collection="list" item="item" index="index" separator=" " open="case REQUIREMENT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_ID" separator=" ">
             when #{item.requirementId,jdbcType=DECIMAL} then #{item.purchaseOrderId,jdbcType=DECIMAL}
         </foreach>
         ,REQUIREMENT_NUMBER=
-        <foreach collection="list" item="item" index="index" separator=" " open="case REQUIREMENT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_ID" separator=" ">
             when #{item.requirementId,jdbcType=DECIMAL} then #{item.requirementNumber,jdbcType=VARCHAR}
         </foreach>
         ,REQUIREMENT_TYPE=
-        <foreach collection="list" item="item" index="index" separator=" " open="case REQUIREMENT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_ID" separator=" ">
             when #{item.requirementId,jdbcType=DECIMAL} then #{item.requirementType,jdbcType=VARCHAR}
         </foreach>
         ,CAPACITY_TYPE_ID=
-        <foreach collection="list" item="item" index="index" separator=" " open="case REQUIREMENT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_ID" separator=" ">
             when #{item.requirementId,jdbcType=DECIMAL} then #{item.capacityTypeId,jdbcType=DECIMAL}
         </foreach>
         ,REQUIREMENT_TRUCK_TIME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case REQUIREMENT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_ID" separator=" ">
             when #{item.requirementId,jdbcType=DECIMAL} then #{item.requirementTruckTime,jdbcType=TIMESTAMP}
         </foreach>
         ,REQUIREMENT_SHIPPER_ID=
-        <foreach collection="list" item="item" index="index" separator=" " open="case REQUIREMENT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_ID" separator=" ">
             when #{item.requirementId,jdbcType=DECIMAL} then #{item.requirementShipperId,jdbcType=DECIMAL}
         </foreach>
         ,REQUIREMENT_WORK_TYPE=
-        <foreach collection="list" item="item" index="index" separator=" " open="case REQUIREMENT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_ID" separator=" ">
             when #{item.requirementId,jdbcType=DECIMAL} then #{item.requirementWorkType,jdbcType=DECIMAL}
         </foreach>
         ,REQUIREMENT_WORK_CONTENT=
-        <foreach collection="list" item="item" index="index" separator=" " open="case REQUIREMENT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_ID" separator=" ">
             when #{item.requirementId,jdbcType=DECIMAL} then #{item.requirementWorkContent,jdbcType=VARCHAR}
         </foreach>
         ,LINE_ID=
-        <foreach collection="list" item="item" index="index" separator=" " open="case REQUIREMENT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_ID" separator=" ">
             when #{item.requirementId,jdbcType=DECIMAL} then #{item.lineId,jdbcType=DECIMAL}
         </foreach>
         ,REQUIREMENT_WORK_ENVIRONMENT=
-        <foreach collection="list" item="item" index="index" separator=" " open="case REQUIREMENT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_ID" separator=" ">
             when #{item.requirementId,jdbcType=DECIMAL} then #{item.requirementWorkEnvironment,jdbcType=VARCHAR}
         </foreach>
         ,REQUIREMENT_ESTIMATED_DURATION=
-        <foreach collection="list" item="item" index="index" separator=" " open="case REQUIREMENT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_ID" separator=" ">
             when #{item.requirementId,jdbcType=DECIMAL} then #{item.requirementEstimatedDuration,jdbcType=DECIMAL}
         </foreach>
         ,REQUIREMENT_OVERLIMIT=
-        <foreach collection="list" item="item" index="index" separator=" " open="case REQUIREMENT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_ID" separator=" ">
             when #{item.requirementId,jdbcType=DECIMAL} then #{item.requirementOverlimit,jdbcType=VARCHAR}
         </foreach>
         ,REQUIREMNT_UNIT_ID=
-        <foreach collection="list" item="item" index="index" separator=" " open="case REQUIREMENT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_ID" separator=" ">
             when #{item.requirementId,jdbcType=DECIMAL} then #{item.requiremntUnitId,jdbcType=DECIMAL}
         </foreach>
         ,REQUIREMENT_STATUS=
-        <foreach collection="list" item="item" index="index" separator=" " open="case REQUIREMENT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_ID" separator=" ">
             when #{item.requirementId,jdbcType=DECIMAL} then #{item.requirementStatus,jdbcType=DECIMAL}
         </foreach>
         ,INSERT_USERNAME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case REQUIREMENT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_ID" separator=" ">
             when #{item.requirementId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
         </foreach>
         ,INSERT_TIME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case REQUIREMENT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_ID" separator=" ">
             when #{item.requirementId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
         </foreach>
         ,UPDATE_USERNAME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case REQUIREMENT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_ID" separator=" ">
             when #{item.requirementId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
         </foreach>
         ,UPDATE_TIME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case REQUIREMENT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_ID" separator=" ">
             when #{item.requirementId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
         </foreach>
         ,INSERT_UPDATE_REMARK=
-        <foreach collection="list" item="item" index="index" separator=" " open="case REQUIREMENT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_ID" separator=" ">
             when #{item.requirementId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
         </foreach>
         ,DELETED=
-        <foreach collection="list" item="item" index="index" separator=" " open="case REQUIREMENT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_ID" separator=" ">
             when #{item.requirementId,jdbcType=DECIMAL} then #{item.deleted,jdbcType=DECIMAL}
         </foreach>
+        ,REQUIREMENT_UNLOAD_UNIT_ID=
+        <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_ID" separator=" ">
+            when #{item.requirementId,jdbcType=DECIMAL} then #{item.requirementUnloadUnitId,jdbcType=DECIMAL}
+        </foreach>
+        ,"REQUIREMENT_PLATFORM_ID "=
+        <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_ID" separator=" ">
+            when #{item.requirementId,jdbcType=DECIMAL} then #{item.requirementPlatformId,jdbcType=DECIMAL}
+        </foreach>
         where REQUIREMENT_ID in
-        <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
+        <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
             #{item.requirementId,jdbcType=DECIMAL}
         </foreach>
     </update>
     <delete id="batchDelete" parameterType="java.util.List">
         delete from AMSTRUCK_INWARD_REQUIREMENT
         where REQUIREMENT_ID in
-        <foreach collection="list" item="id" open="(" close=")" separator=",">
+        <foreach close=")" collection="list" item="id" open="(" separator=",">
             #{id}
         </foreach>
     </delete>
     <!-- 友情提示!!!-->
     <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
+
     <!-- 展示用车需求 -->
     <select id="getTruckRequirementList" resultType="java.util.Map" parameterType="java.util.Map">
         SELECT * FROM
@@ -657,22 +704,26 @@
         AIR.INSERT_USERNAME AS "insertUsername",
         AIR.REQUIREMENT_ID AS "requirementId",
         ARM.MATERIAL_COUNT AS "materialNumber",
+        ARM.MATERIAL_WEIGHT "materialWeight",
         RW.WAREHOUSE_NAME AS "wareHouseName"
         FROM AMSTRUCK_INWARD_REQUIREMENT AIR
         LEFT JOIN AMS_PURCHASE_ORDER APO
-        ON APO.PURCHASE_ORDER_ID = AIR.PURCHASE_ORDER_ID
-        LEFT JOIN RMS_WAREHOUSE RW
-        ON RW.WAREHOUSE_ID = AIR.REQUIREMNT_UNIT_ID
+            ON APO.PURCHASE_ORDER_ID = AIR.PURCHASE_ORDER_ID
         LEFT JOIN DIL_BATCH DB
-        ON DB.BATCH_ID = APO.BATCH_ID
-        LEFT JOIN RMS_MATERIAL RM
-        ON RM.MATERIAL_ID = DB.MATERIAL_ID
-        LEFT JOIN RMS_CAPACITY_TYPE RCT ON AIR.CAPACITY_TYPE_ID = RCT.CAPACITY_TYPE_ID
-        LEFT JOIN RMS_SHIPPER RS ON RS.SHIPPER_ID = AIR.REQUIREMENT_SHIPPER_ID
+            ON DB.BATCH_ID = APO.BATCH_ID
+        LEFT JOIN RMS_WAREHOUSE RW
+            ON RW.WAREHOUSE_ID = AIR.REQUIREMNT_UNIT_ID
+        LEFT JOIN RMS_CAPACITY_TYPE RCT
+            ON AIR.CAPACITY_TYPE_ID = RCT.CAPACITY_TYPE_ID
+        LEFT JOIN RMS_SHIPPER RS
+            ON RS.SHIPPER_ID = AIR.REQUIREMENT_SHIPPER_ID
         LEFT JOIN AMSTRUCK_REQUIREMENT_MATERIAL ARM
-        ON ARM.REQUIREMENT_ID = AIR.REQUIREMENT_ID
+            ON ARM.REQUIREMENT_ID = AIR.REQUIREMENT_ID
+        LEFT JOIN RMS_MATERIAL RM
+            ON RM.MATERIAL_ID = ARM.MATERIAL_ID
         WHERE AIR.REQUIREMENT_STATUS = #{requirementStatus}
-        AND AIR.DELETED = 0)
+        AND AIR.DELETED = 0
+        )
         <where>
             <if test="purchaseOrderNo != null">
                 and
@@ -803,17 +854,26 @@
         AIR.UPDATE_TIME AS "updateTime",
         AIR.UPDATE_USERNAME AS "updateUserName",
         RW.WAREHOUSE_NAME AS "wareHouseName"
-        FROM AMSTRUCK_INWARD_REQUIREMENT AIR
+        FROM (
+        SELECT AIR2.REQUIREMENT_ID
+        FROM AMSTRUCK_INWARD_REQUIREMENT AIR2
+        LEFT JOIN AMSTRUCK_REQUIREMENT_PLAN ARP
+        ON AIR2.REQUIREMENT_ID = ARP.REQUIREMENT_ID
+        WHERE ARP.PLAN_ID IS NULL
+        ) AIRP
+        LEFT JOIN AMSTRUCK_INWARD_REQUIREMENT AIR
+        ON AIR.REQUIREMENT_ID = AIRP.REQUIREMENT_ID
         LEFT JOIN AMS_PURCHASE_ORDER APO
         ON APO.PURCHASE_ORDER_ID = AIR.PURCHASE_ORDER_ID
         LEFT JOIN DIL_BATCH DB
         ON DB.BATCH_ID = APO.BATCH_ID
-        LEFT JOIN RMS_MATERIAL RM
-        ON RM.MATERIAL_ID = DB.MATERIAL_ID
+
         LEFT JOIN RMS_CAPACITY_TYPE RCT ON AIR.CAPACITY_TYPE_ID = RCT.CAPACITY_TYPE_ID
         LEFT JOIN RMS_SHIPPER RS ON RS.SHIPPER_ID = AIR.REQUIREMENT_SHIPPER_ID
         LEFT JOIN AMSTRUCK_REQUIREMENT_MATERIAL ARM
         ON ARM.REQUIREMENT_ID = AIR.REQUIREMENT_ID
+        LEFT JOIN RMS_MATERIAL RM
+        ON RM.MATERIAL_ID = ARM.MATERIAL_ID
         LEFT JOIN RMS_WAREHOUSE RW
         ON RW.WAREHOUSE_ID = AIR.REQUIREMNT_UNIT_ID
         WHERE AIR.REQUIREMENT_STATUS = #{requirementStatus}
@@ -961,6 +1021,7 @@
                DB.RESULT_FOREIGN_SHIP_NAME        AS "resultForeignShipName",
                RW.WAREHOUSE_NAME                  AS "wareHouseName",
                AIR.REQUIREMNT_UNIT_ID             AS "requiremntUnitId",
+               AIR.REQUIREMENT_UNLOAD_UNIT_ID     AS "requirementUnloadUnitId",
                AIR.REQUIREMENT_TYPE               AS "requirementType",
                AIR.CAPACITY_TYPE_ID               AS "capacityTypeId",
                AIR.REQUIREMENT_TRUCK_TIME         AS "requirementTruckTime",
@@ -1043,4 +1104,12 @@
                RW.WAREHOUSE_NAME AS "wareHouseName"
         FROM RMS_WAREHOUSE RW
     </select>
+
+    <select id="getMaterialId" parameterType="DECIMAL" resultType="DECIMAL">
+        SELECT DB.MATERIAL_ID AS "materialId"
+        FROM AMS_PURCHASE_ORDER APO
+                 LEFT JOIN DIL_BATCH DB
+                           ON DB.BATCH_ID = APO.BATCH_ID
+        WHERE APO.PURCHASE_ORDER_ID = #{purchaseOrderId}
+    </select>
 </mapper>

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

@@ -494,7 +494,7 @@
             RC.CARRIER_NAME "carrierName",
             AP.MATERIAL_TOTAL_WEIGHT "materialTotalWeight",
             to_char(AP.PLAN_TRUCK_TIME, 'yyyy-mm-dd') "planTruckTime",
-            to_char(AP.PLAN_INCOMING_TIME. 'yyyy-mm-dd') "planIncomingTime"
+            to_char(AP.PLAN_INCOMING_TIME, 'yyyy-mm-dd') "planIncomingTime"
         from AMSTRUCK_PURPLAN AP
         left join AMS_PURCHASE_ORDER APO
         on AP.BATCH_ID = APO.BATCH_ID

+ 353 - 0
src/main/resources/com/steerinfo/dil/mapper/AmstruckRequirementMaterialMapper.xml

@@ -0,0 +1,353 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.steerinfo.dil.mapper.AmstruckRequirementMaterialMapper">
+  <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.AmstruckRequirementMaterial">
+    <id column="REQUIREMENT_MATERIAL_ID" jdbcType="DECIMAL" property="requirementMaterialId" />
+    <result column="REQUIREMENT_ID" jdbcType="DECIMAL" property="requirementId" />
+    <result column="MATERIAL_ID" jdbcType="DECIMAL" property="materialId" />
+    <result column="MATERIAL_WEIGHT" jdbcType="DECIMAL" property="materialWeight" />
+    <result column="MATERIAL_COUNT" jdbcType="DECIMAL" property="materialCount" />
+    <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
+    <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
+    <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
+    <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
+    <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
+  </resultMap>
+  <sql id="columns">
+    REQUIREMENT_MATERIAL_ID, REQUIREMENT_ID, MATERIAL_ID, MATERIAL_WEIGHT, MATERIAL_COUNT, 
+    INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK
+  </sql>
+  <sql id="columns_alias">
+    t.REQUIREMENT_MATERIAL_ID, t.REQUIREMENT_ID, t.MATERIAL_ID, t.MATERIAL_WEIGHT, t.MATERIAL_COUNT, 
+    t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK
+  </sql>
+  <sql id="select">
+    SELECT <include refid="columns" /> FROM AMSTRUCK_REQUIREMENT_MATERIAL
+  </sql>
+  <sql id="select_alias">
+    SELECT <include refid="columns_alias" /> FROM AMSTRUCK_REQUIREMENT_MATERIAL t
+  </sql>
+  <sql id="where">
+    <where> 
+      <if test="requirementMaterialId != null">
+        and REQUIREMENT_MATERIAL_ID = #{requirementMaterialId}
+      </if>
+      <if test="requirementId != null">
+        and REQUIREMENT_ID = #{requirementId}
+      </if>
+      <if test="materialId != null">
+        and MATERIAL_ID = #{materialId}
+      </if>
+      <if test="materialWeight != null">
+        and MATERIAL_WEIGHT = #{materialWeight}
+      </if>
+      <if test="materialCount != null">
+        and MATERIAL_COUNT = #{materialCount}
+      </if>
+      <if test="insertUsername != null and insertUsername != ''">
+        and INSERT_USERNAME = #{insertUsername}
+      </if>
+      <if test="insertTime != null">
+        and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
+      </if>
+      <if test="updateUsername != null and updateUsername != ''">
+        and UPDATE_USERNAME = #{updateUsername}
+      </if>
+      <if test="updateTime != null">
+        and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
+      </if>
+      <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
+        and INSERT_UPDATE_REMARK = #{insertUpdateRemark}
+      </if>
+    </where>
+  </sql>
+  <sql id="whereLike">
+    <where> 
+      <if test="requirementMaterialId != null">
+        and REQUIREMENT_MATERIAL_ID = #{requirementMaterialId}
+      </if>
+      <if test="requirementId != null">
+        and REQUIREMENT_ID = #{requirementId}
+      </if>
+      <if test="materialId != null">
+        and MATERIAL_ID = #{materialId}
+      </if>
+      <if test="materialWeight != null">
+        and MATERIAL_WEIGHT = #{materialWeight}
+      </if>
+      <if test="materialCount != null">
+        and MATERIAL_COUNT = #{materialCount}
+      </if>
+      <if test="insertUsername != null and insertUsername != ''">
+        and INSERT_USERNAME LIKE '%${insertUsername}%'
+      </if>
+      <if test="insertTime != null">
+        and TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = #{insertTime}
+      </if>
+      <if test="updateUsername != null and updateUsername != ''">
+        and UPDATE_USERNAME LIKE '%${updateUsername}%'
+      </if>
+      <if test="updateTime != null">
+        and TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = #{updateTime}
+      </if>
+      <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
+        and INSERT_UPDATE_REMARK LIKE '%${insertUpdateRemark}%'
+      </if>
+    </where>
+  </sql>
+  <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
+    delete from AMSTRUCK_REQUIREMENT_MATERIAL
+    where REQUIREMENT_MATERIAL_ID = #{requirementMaterialId,jdbcType=DECIMAL}
+  </delete>
+  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
+    delete from AMSTRUCK_REQUIREMENT_MATERIAL
+    where 1!=1 
+      <if test="requirementId != null">
+        or REQUIREMENT_ID = #{requirementId}
+      </if>
+      <if test="materialId != null">
+        or MATERIAL_ID = #{materialId}
+      </if>
+      <if test="materialWeight != null">
+        or MATERIAL_WEIGHT = #{materialWeight}
+      </if>
+      <if test="materialCount != null">
+        or MATERIAL_COUNT = #{materialCount}
+      </if>
+      <if test="insertUsername != null and insertUsername != ''">
+        or INSERT_USERNAME = #{insertUsername}
+      </if>
+      <if test="insertTime != null">
+        or TO_CHAR(INSERT_TIME,'yyyy-MM-dd') = '#{insertTime}'
+      </if>
+      <if test="updateUsername != null and updateUsername != ''">
+        or UPDATE_USERNAME = #{updateUsername}
+      </if>
+      <if test="updateTime != null">
+        or TO_CHAR(UPDATE_TIME,'yyyy-MM-dd') = '#{updateTime}'
+      </if>
+      <if test="insertUpdateRemark != null and insertUpdateRemark != ''">
+        or INSERT_UPDATE_REMARK = #{insertUpdateRemark}
+      </if>
+  </delete>
+  <insert id="insert" parameterType="com.steerinfo.dil.model.AmstruckRequirementMaterial">
+    insert into AMSTRUCK_REQUIREMENT_MATERIAL (REQUIREMENT_MATERIAL_ID, REQUIREMENT_ID, 
+      MATERIAL_ID, MATERIAL_WEIGHT, MATERIAL_COUNT, 
+      INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, 
+      UPDATE_TIME, INSERT_UPDATE_REMARK)
+    values (#{requirementMaterialId,jdbcType=DECIMAL}, #{requirementId,jdbcType=DECIMAL}, 
+      #{materialId,jdbcType=DECIMAL}, #{materialWeight,jdbcType=DECIMAL}, #{materialCount,jdbcType=DECIMAL}, 
+      #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, 
+      #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR})
+  </insert>
+  <insert id="insertSelective" parameterType="com.steerinfo.dil.model.AmstruckRequirementMaterial">
+    insert into AMSTRUCK_REQUIREMENT_MATERIAL
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="requirementMaterialId != null">
+        REQUIREMENT_MATERIAL_ID,
+      </if>
+      <if test="requirementId != null">
+        REQUIREMENT_ID,
+      </if>
+      <if test="materialId != null">
+        MATERIAL_ID,
+      </if>
+      <if test="materialWeight != null">
+        MATERIAL_WEIGHT,
+      </if>
+      <if test="materialCount != null">
+        MATERIAL_COUNT,
+      </if>
+      <if test="insertUsername != null">
+        INSERT_USERNAME,
+      </if>
+      <if test="insertTime != null">
+        INSERT_TIME,
+      </if>
+      <if test="updateUsername != null">
+        UPDATE_USERNAME,
+      </if>
+      <if test="updateTime != null">
+        UPDATE_TIME,
+      </if>
+      <if test="insertUpdateRemark != null">
+        INSERT_UPDATE_REMARK,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="requirementMaterialId != null">
+        #{requirementMaterialId,jdbcType=DECIMAL},
+      </if>
+      <if test="requirementId != null">
+        #{requirementId,jdbcType=DECIMAL},
+      </if>
+      <if test="materialId != null">
+        #{materialId,jdbcType=DECIMAL},
+      </if>
+      <if test="materialWeight != null">
+        #{materialWeight,jdbcType=DECIMAL},
+      </if>
+      <if test="materialCount != null">
+        #{materialCount,jdbcType=DECIMAL},
+      </if>
+      <if test="insertUsername != null">
+        #{insertUsername,jdbcType=VARCHAR},
+      </if>
+      <if test="insertTime != null">
+        #{insertTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateUsername != null">
+        #{updateUsername,jdbcType=VARCHAR},
+      </if>
+      <if test="updateTime != null">
+        #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="insertUpdateRemark != null">
+        #{insertUpdateRemark,jdbcType=VARCHAR},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.AmstruckRequirementMaterial">
+    update AMSTRUCK_REQUIREMENT_MATERIAL
+    set REQUIREMENT_ID = #{requirementId,jdbcType=DECIMAL},
+      MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
+      MATERIAL_WEIGHT = #{materialWeight,jdbcType=DECIMAL},
+      MATERIAL_COUNT = #{materialCount,jdbcType=DECIMAL},
+      INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
+      INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
+      UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
+      UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
+      INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR}
+    where REQUIREMENT_MATERIAL_ID = #{requirementMaterialId,jdbcType=DECIMAL}
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.AmstruckRequirementMaterial">
+    update AMSTRUCK_REQUIREMENT_MATERIAL
+    <set>
+      <if test="requirementId != null">
+        REQUIREMENT_ID = #{requirementId,jdbcType=DECIMAL},
+      </if>
+      <if test="materialId != null">
+        MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
+      </if>
+      <if test="materialWeight != null">
+        MATERIAL_WEIGHT = #{materialWeight,jdbcType=DECIMAL},
+      </if>
+      <if test="materialCount != null">
+        MATERIAL_COUNT = #{materialCount,jdbcType=DECIMAL},
+      </if>
+      <if test="insertUsername != null">
+        INSERT_USERNAME = #{insertUsername,jdbcType=VARCHAR},
+      </if>
+      <if test="insertTime != null">
+        INSERT_TIME = #{insertTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="updateUsername != null">
+        UPDATE_USERNAME = #{updateUsername,jdbcType=VARCHAR},
+      </if>
+      <if test="updateTime != null">
+        UPDATE_TIME = #{updateTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="insertUpdateRemark != null">
+        INSERT_UPDATE_REMARK = #{insertUpdateRemark,jdbcType=VARCHAR},
+      </if>
+    </set>
+    where REQUIREMENT_MATERIAL_ID = #{requirementMaterialId,jdbcType=DECIMAL}
+  </update>
+  <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
+    <include refid="select" />
+    where REQUIREMENT_MATERIAL_ID = #{requirementMaterialId,jdbcType=DECIMAL}
+  </select>
+  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
+    <include refid="select" />
+    <include refid="where" />
+  </select>
+  <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
+    <include refid="select" />
+    <include refid="whereLike" />
+  </select>
+  <select id="getOffsetWarehouse" resultType="java.util.Map">
+        SELECT rw.warehouse_id   AS "id",
+       rw.warehouse_id   AS "value",
+       rw.warehouse_name AS "label"
+  FROM rms_warehouse rw
+ where rw.warehouse_type_id = 2
+
+  </select>
+  <insert id="batchInsert" parameterType="java.util.List">
+    insert into AMSTRUCK_REQUIREMENT_MATERIAL 
+      (REQUIREMENT_MATERIAL_ID, 
+      REQUIREMENT_ID, MATERIAL_ID, MATERIAL_WEIGHT, 
+      MATERIAL_COUNT, INSERT_USERNAME, 
+      INSERT_TIME, UPDATE_USERNAME, 
+      UPDATE_TIME, INSERT_UPDATE_REMARK
+      )
+    ( <foreach collection="list" item="item" separator="union all"> 
+   select  
+      #{item.requirementMaterialId,jdbcType=DECIMAL}, 
+      #{item.requirementId,jdbcType=DECIMAL}, #{item.materialId,jdbcType=DECIMAL}, #{item.materialWeight,jdbcType=DECIMAL}, 
+      #{item.materialCount,jdbcType=DECIMAL}, #{item.insertUsername,jdbcType=VARCHAR}, 
+      #{item.insertTime,jdbcType=TIMESTAMP}, #{item.updateUsername,jdbcType=VARCHAR}, 
+      #{item.updateTime,jdbcType=TIMESTAMP}, #{item.insertUpdateRemark,jdbcType=VARCHAR}
+       from dual  
+   </foreach> )
+  </insert>
+  <update id="batchUpdate" parameterType="java.util.List">
+     update AMSTRUCK_REQUIREMENT_MATERIAL
+     set
+       REQUIREMENT_MATERIAL_ID=
+       <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_MATERIAL_ID" separator=" ">
+          when #{item.requirementMaterialId,jdbcType=DECIMAL} then #{item.requirementMaterialId,jdbcType=DECIMAL}
+       </foreach>
+       ,REQUIREMENT_ID=
+       <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_MATERIAL_ID" separator=" ">
+          when #{item.requirementMaterialId,jdbcType=DECIMAL} then #{item.requirementId,jdbcType=DECIMAL}
+       </foreach>
+       ,MATERIAL_ID=
+       <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_MATERIAL_ID" separator=" ">
+          when #{item.requirementMaterialId,jdbcType=DECIMAL} then #{item.materialId,jdbcType=DECIMAL}
+       </foreach>
+       ,MATERIAL_WEIGHT=
+       <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_MATERIAL_ID" separator=" ">
+          when #{item.requirementMaterialId,jdbcType=DECIMAL} then #{item.materialWeight,jdbcType=DECIMAL}
+       </foreach>
+       ,MATERIAL_COUNT=
+       <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_MATERIAL_ID" separator=" ">
+          when #{item.requirementMaterialId,jdbcType=DECIMAL} then #{item.materialCount,jdbcType=DECIMAL}
+       </foreach>
+       ,INSERT_USERNAME=
+       <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_MATERIAL_ID" separator=" ">
+          when #{item.requirementMaterialId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
+       </foreach>
+       ,INSERT_TIME=
+       <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_MATERIAL_ID" separator=" ">
+          when #{item.requirementMaterialId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
+       </foreach>
+       ,UPDATE_USERNAME=
+       <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_MATERIAL_ID" separator=" ">
+          when #{item.requirementMaterialId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
+       </foreach>
+       ,UPDATE_TIME=
+       <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_MATERIAL_ID" separator=" ">
+          when #{item.requirementMaterialId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
+       </foreach>
+       ,INSERT_UPDATE_REMARK=
+       <foreach close="end" collection="list" index="index" item="item" open="case REQUIREMENT_MATERIAL_ID" separator=" ">
+          when #{item.requirementMaterialId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
+       </foreach>
+     where REQUIREMENT_MATERIAL_ID in 
+     <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
+    #{item.requirementMaterialId,jdbcType=DECIMAL}
+     </foreach> 
+  </update>
+  <delete id="batchDelete" parameterType="java.util.List">
+    delete from AMSTRUCK_REQUIREMENT_MATERIAL
+    where REQUIREMENT_MATERIAL_ID in 
+    <foreach close=")" collection="list" item="id" open="(" separator=",">
+      #{id}
+    </foreach>
+  </delete>
+  <!-- 友情提示!!!-->
+  <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
+  
+  
+</mapper>