txf před 3 roky
rodič
revize
09735927dd

+ 233 - 0
src/main/java/com/steerinfo/dil/controller/AmstruckPurplanController.java

@@ -0,0 +1,233 @@
+package com.steerinfo.dil.controller;
+
+import com.steerinfo.dil.feign.ESFeign;
+import com.steerinfo.dil.model.AmstruckPurplan;
+import com.steerinfo.dil.service.IAmstruckPurplanMaterialService;
+import com.steerinfo.dil.service.IAmstruckPurplanService;
+import com.steerinfo.dil.util.BaseRESTfulController;
+import com.steerinfo.dil.util.ColumnDataUtil;
+import com.steerinfo.dil.util.PageListAdd;
+import com.steerinfo.framework.controller.RESTfulResult;
+import com.steerinfo.framework.service.pagehelper.PageHelper;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
+import io.swagger.annotations.ApiOperation;
+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;
+
+/**
+ * AmstruckPurplan RESTful接口:
+ * @author generator
+ * @version 1.0-SNAPSHORT 2021-09-02 10:38
+ * 类描述
+ * 修订历史:
+ * 日期:2021-09-02
+ * 作者:TXF
+ * 参考:
+ * 描述:AmstruckPurplan RESTful接口
+ * @see null
+ * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
+ */
+@RestController
+@RequestMapping("/${api.version}/amstruckpurplans")
+public class AmstruckPurplanController extends BaseRESTfulController {
+
+    @Autowired
+    IAmstruckPurplanMaterialService amstruckPurplanMaterialService;
+
+    @Autowired
+    IAmstruckPurplanService amstruckPurplanService;
+
+    @Autowired
+    ColumnDataUtil columnDataUtil;
+
+    @Autowired
+    ESFeign esFeign;
+
+    @ApiOperation(value="查询运输预约")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
+            @ApiImplicitParam(name = "apiId(79)", value = "动态表头", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
+    })
+    @PostMapping("/getAllPurPlan")
+    public RESTfulResult getAllPurPlan(@RequestBody(required=false) Map<String,Object> mapValue,
+                                           Integer apiId,
+                                           Integer pageNum,
+                                           Integer pageSize,
+                                           Integer status,String con){
+
+        mapValue.put("planStatus", status);
+        //框计算
+        if(con != null){
+            if(!"undefined".equals(con)){
+                //设置要查询的索引名称
+                String index="get_pur_plan_list";
+                //获取查询结果
+                return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));
+            }
+        }
+        //初始化过滤
+        List<Map<String, Object>> allPurPlan = null;
+        //如果有条件查询则跳过初始化,和创建索引
+        if(mapValue.size() == 1){
+            //将查询结果存入索引中
+            allPurPlan = amstruckPurplanService.getAllPurPlan(mapValue);
+            Map<String, Object> map = new HashMap<>();
+            //添加索引
+            map.put("index","get_pur_plan_list");
+            //添加id
+            map.put("indexId","purPlanId");
+            allPurPlan.add(map);
+            //新建索引
+            esFeign.insertIndex(allPurPlan);
+            //删除
+            allPurPlan.remove(allPurPlan.size()-1);
+        }
+        if(allPurPlan == null)
+            allPurPlan = amstruckPurplanService.getAllPurPlan(mapValue);
+        PageHelper.startPage(pageNum,pageSize);
+        //分页数据
+        List<Map<String, Object>> purPlan = amstruckPurplanService.getAllPurPlan(mapValue);
+        PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allPurPlan,purPlan);
+        return success(pageList);
+    }
+
+
+    @ApiOperation(value="通过Id查询运输计划")
+    @PostMapping ("/getPurPlanById/{planId}")
+    public RESTfulResult getPurPlanById(@PathVariable("planId")Integer planId){
+        List<Map<String, Object>> purPlanById = amstruckPurplanService.getPurPlanById(planId);
+        return success(purPlanById);
+    }
+
+    @ApiOperation(value="新增运输计划 状态:0")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "amstruckPurplan", value = "运输计划实绩对象", required = false, dataType = "AmstruckPurplan"),
+    })
+    @PostMapping("/addPurPlan")
+    public RESTfulResult addPurPlan(@RequestBody AmstruckPurplan amstruckPurplan){
+        int i = amstruckPurplanService.addPurPlan(amstruckPurplan);
+        return success(i);
+    }
+
+    @ApiOperation(value="修改运输计划")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "amstruckPurplan", value = "请车作业实绩对象", required = false, dataType = "AmstruckPurplan"),
+    })
+    @PostMapping("/updatePurPlan")
+    public RESTfulResult updatePurPlan(@RequestBody AmstruckPurplan amstruckPurplan){
+        amstruckPurplan.setUpdateTime(new Date()); //设置更新时间
+        int i = amstruckPurplanService.updatePurPlan(amstruckPurplan);
+        return success(i);
+    }
+
+    @ApiOperation(value="下发运输计划 状态:1")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "planId", value = "运输计划Id", required = false, dataType = "Integer"),
+    })
+    @PostMapping("/sendPurPlan/{planId}")
+    public RESTfulResult sendPurPlan(@PathVariable("planId")Integer planId){
+        AmstruckPurplan amstruckPurplan = new AmstruckPurplan();
+        amstruckPurplan.setPlanId(new BigDecimal(planId));
+        amstruckPurplan.setPlanStatus(new BigDecimal(1));
+        int i = amstruckPurplanService.sendPurPlan(amstruckPurplan);
+        return success(i);
+    }
+
+    @ApiOperation(value="接收运输计划 状态:2")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "planId", value = "运输计划Id", required = false, dataType = "Integer"),
+    })
+    @PostMapping("/receptionPurPlan/{planId}")
+    public RESTfulResult receptionPurPlan(@PathVariable("planId")Integer planId){
+        AmstruckPurplan amstruckPurplan = new AmstruckPurplan();
+        amstruckPurplan.setPlanId(new BigDecimal(planId));
+        amstruckPurplan.setPlanStatus(new BigDecimal(2));
+        int i = amstruckPurplanService.receptionPurPlan(amstruckPurplan);
+        return success(i);
+    }
+
+    @ApiOperation(value="逻辑删除运输计划 状态:3")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "planId", value = "运输计划Id", required = false, dataType = "Integer"),
+    })
+    @PostMapping("/deletePurPlan/{planId}")
+    public RESTfulResult deletePurPlan(@PathVariable("planId")Integer planId){
+        AmstruckPurplan amstruckPurplan = new AmstruckPurplan();
+        amstruckPurplan.setPlanId(new BigDecimal(planId));
+        amstruckPurplan.setPlanStatus(new BigDecimal(3));
+        int i = amstruckPurplanService.deletePurPlan(amstruckPurplan);
+        return success(i);
+    }
+
+//    ******************************************************************************************************************
+
+    @ApiOperation(value="查询要分派的计划")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
+            @ApiImplicitParam(name = "apiId(82)", value = "动态表头", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
+            @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
+    })
+    @PostMapping("/getDecomposedPlan")
+    public RESTfulResult getDecomposedPlan(@RequestBody(required=false) Map<String,Object> mapValue,
+                                               Integer apiId,
+                                               Integer pageNum,
+                                               Integer pageSize,
+                                               Integer planId,
+                                               Integer status,String con){
+        int count = 0;
+        if(planId != null){
+            mapValue.put("planId", planId);
+            count++;
+        }
+        if(status != null){
+            mapValue.put("planStatus", status);
+            count++;
+        }
+        //框计算
+        if(con != null){
+            if(!"undefined".equals(con)){
+                String index="get_decomposed_list";    //设置要查询的索引名称
+                return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
+            }
+        }
+        //不分页筛选数据
+        List<Map<String, Object>> allPlan = null;
+        //如果有条件查询则跳过初始化,和创建索引
+        if(mapValue.size() == count){
+            //将查询结果存入索引中
+            allPlan = amstruckPurplanMaterialService.getDecomposedPlan(mapValue);
+            Map<String, Object> map = new HashMap<>();
+            //添加索引
+            map.put("index","get_decomposed_list");
+            //添加id
+            map.put("indexId","decomposedPlanId");
+            allPlan.add(map);
+            //新建索引
+            esFeign.insertIndex(allPlan);
+            //删除
+            allPlan.remove(allPlan.size()-1);
+        }
+        if(allPlan == null)
+            allPlan = amstruckPurplanMaterialService.getDecomposedPlan(mapValue);
+        PageHelper.startPage(pageNum,pageSize);
+        //分页数据
+        List<Map<String, Object>> plan = amstruckPurplanMaterialService.getDecomposedPlan(mapValue);
+        PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allPlan,plan);
+        return success(pageList);
+    }
+
+
+
+}

+ 33 - 0
src/main/java/com/steerinfo/dil/controller/AmstruckPurplanMaterialController.java

@@ -0,0 +1,33 @@
+package com.steerinfo.dil.controller;
+
+import com.steerinfo.dil.service.IAmstruckPurplanMaterialService;
+import com.steerinfo.dil.util.BaseRESTfulController;
+import com.steerinfo.framework.controller.RESTfulResult;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
+
+/**
+ * @ author    :TXF
+ * @ time      :2021/10/27 14:08
+ */
+
+@RestController
+@RequestMapping("/${api.version}/amstruckpurplanmaterial")
+public class AmstruckPurplanMaterialController extends BaseRESTfulController {
+
+    @Autowired
+    IAmstruckPurplanMaterialService amstruckPurplanMaterialService;
+
+    @ApiOperation(value="更改计划子表重量")
+    @PostMapping("/updateMaterial")
+    public RESTfulResult updateMaterial(@RequestBody(required = false) Map<String, Object> map){
+        amstruckPurplanMaterialService.updateMaterial(map);
+        return success(1);
+    }
+}

+ 1 - 1
src/main/java/com/steerinfo/dil/feign/ESFeign.java

@@ -15,7 +15,7 @@ import java.util.Map;
  * @Version 1.0
  */
 
-@FeignClient(value = "DIL-ES-DEV",url = "https://portal-dev.steerinfo.com/icore.icp.web/pass/dil/dil-es-api")
+@FeignClient(value = "DIL-ES-DEV",url = "172.16.33.161:8089/api/v1/es")
 public interface ESFeign {
     @PostMapping("api/v1/es/getConResult")
     PageListAdd getConResult(@RequestBody(required = false) Map<String, Object> mapValue,

+ 32 - 0
src/main/java/com/steerinfo/dil/mapper/AmstruckPurplanMapper.java

@@ -0,0 +1,32 @@
+package com.steerinfo.dil.mapper;
+
+import com.steerinfo.dil.model.AmstruckPurplan;
+import com.steerinfo.framework.mapper.IBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
+
+@Mapper
+public interface AmstruckPurplanMapper extends IBaseMapper<AmstruckPurplan, BigDecimal> {
+
+    //查询所有运输计划
+    List<Map<String, Object>> getAllPurPlan(Map<String, Object> map);
+
+    //新增运输计划
+    int insertSelective(AmstruckPurplan amstruckPurplan);
+
+    //查询最大ID值
+    @Select("select seq_amstruck_purplan.nextval from dual")
+    BigDecimal selectMaxId();
+
+    //通过ID查询运输计划
+    List<Map<String, Object>> getPurPlanById(@Param("planId") Integer planId);
+
+    //修改运输计划
+    int updateByPrimaryKeySelective(AmstruckPurplan amstruckPurplan);
+
+}

+ 30 - 0
src/main/java/com/steerinfo/dil/mapper/AmstruckPurplanMaterialMapper.java

@@ -0,0 +1,30 @@
+package com.steerinfo.dil.mapper;
+
+import com.steerinfo.dil.model.AmstruckPurplanMaterial;
+import com.steerinfo.framework.mapper.IBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
+
+@Mapper
+public interface AmstruckPurplanMaterialMapper extends IBaseMapper<AmstruckPurplanMaterial, BigDecimal> {
+    //新增运输计划同时新增运输计划子表数据
+    int insertSelective(AmstruckPurplanMaterial amstruckPurplanMaterial);
+
+    //通过Id查询运输计划  包含分解信息  未分配、已分配
+    List<Map<String, Object>> getDecomposedPlan(Map<String, Object> map);
+
+    //通过Id查询已分配重量、未分配重量
+    List<Map<String, Object>> getWeight(Integer planId);
+
+    //查询最大主键Id
+    @Select("select seq_amstruck_purplan_material.nextval from dual")
+    BigDecimal selectMaxId();
+
+    //通过运输计划Id查询计划子表主键ID
+    BigDecimal getChildIdByPlanId(BigDecimal planId);
+
+}

+ 259 - 0
src/main/java/com/steerinfo/dil/model/AmstruckPurplan.java

@@ -0,0 +1,259 @@
+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 AmstruckPurplan implements IBasePO<BigDecimal> {
+    /**
+     * 主键ID(PLAN_ID,DECIMAL,38)
+     */
+    @ApiModelProperty(value="主键ID",required=true)
+    private BigDecimal planId;
+
+    /**
+     * 批次ID(BATCH_ID,DECIMAL,38)
+     */
+    @ApiModelProperty(value="批次ID",required=false)
+    private BigDecimal batchId;
+
+    /**
+     * 运输计划号(PLAN_NO,VARCHAR,25)
+     */
+    @ApiModelProperty(value="运输计划号",required=false)
+    private String planNo;
+
+    /**
+     * 承运商ID(CARRIER_ID,DECIMAL,38)
+     */
+    @ApiModelProperty(value="承运商ID",required=false)
+    private BigDecimal carrierId;
+
+    /**
+     * 车数(PLAN_TRUCK_NUMBER,DECIMAL,38)
+     */
+    @ApiModelProperty(value="车数",required=false)
+    private BigDecimal planTruckNumber;
+
+    /**
+     * 车型ID(CAPACITY_TYPE_ID,DECIMAL,38)
+     */
+    @ApiModelProperty(value="车型ID",required=false)
+    private BigDecimal capacityTypeId;
+
+    /**
+     * 用车时间(PLAN_TRUCK_TIME,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="用车时间",required=false)
+    private Date planTruckTime;
+
+    /**
+     * 计划状态:0:未下发;1:已下发;2:已接收(PLAN_STATUS,DECIMAL,38)
+     */
+    @ApiModelProperty(value="计划状态:0:未下发;1:已下发;2:已接收",required=false)
+    private BigDecimal planStatus;
+
+    /**
+     * 物资总重量(MATERIAL_TOTAL_WEIGHT,DECIMAL,0)
+     */
+    @ApiModelProperty(value="物资总重量",required=false)
+    private BigDecimal materialTotalWeight;
+
+    /**
+     * 预计进厂时间(PLAN_INCOMING_TIME,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="预计进厂时间",required=false)
+    private Date planIncomingTime;
+
+    /**
+     * 记录创建人(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.planId;
+    }
+
+    @Override
+    public void setId(BigDecimal planId) {
+        this.planId = planId;
+    }
+
+    public BigDecimal getPlanId() {
+        return planId;
+    }
+
+    public void setPlanId(BigDecimal planId) {
+        this.planId = planId;
+    }
+
+    public BigDecimal getBatchId() {
+        return batchId;
+    }
+
+    public void setBatchId(BigDecimal batchId) {
+        this.batchId = batchId;
+    }
+
+    public String getPlanNo() {
+        return planNo;
+    }
+
+    public void setPlanNo(String planNo) {
+        this.planNo = planNo == null ? null : planNo.trim();
+    }
+
+    public BigDecimal getCarrierId() {
+        return carrierId;
+    }
+
+    public void setCarrierId(BigDecimal carrierId) {
+        this.carrierId = carrierId;
+    }
+
+    public BigDecimal getPlanTruckNumber() {
+        return planTruckNumber;
+    }
+
+    public void setPlanTruckNumber(BigDecimal planTruckNumber) {
+        this.planTruckNumber = planTruckNumber;
+    }
+
+    public BigDecimal getCapacityTypeId() {
+        return capacityTypeId;
+    }
+
+    public void setCapacityTypeId(BigDecimal capacityTypeId) {
+        this.capacityTypeId = capacityTypeId;
+    }
+
+    public Date getPlanTruckTime() {
+        return planTruckTime;
+    }
+
+    public void setPlanTruckTime(Date planTruckTime) {
+        this.planTruckTime = planTruckTime;
+    }
+
+    public BigDecimal getPlanStatus() {
+        return planStatus;
+    }
+
+    public void setPlanStatus(BigDecimal planStatus) {
+        this.planStatus = planStatus;
+    }
+
+    public BigDecimal getMaterialTotalWeight() {
+        return materialTotalWeight;
+    }
+
+    public void setMaterialTotalWeight(BigDecimal materialTotalWeight) {
+        this.materialTotalWeight = materialTotalWeight;
+    }
+
+    public Date getPlanIncomingTime() {
+        return planIncomingTime;
+    }
+
+    public void setPlanIncomingTime(Date planIncomingTime) {
+        this.planIncomingTime = planIncomingTime;
+    }
+
+    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(", planId=").append(planId);
+        sb.append(", batchId=").append(batchId);
+        sb.append(", planNo=").append(planNo);
+        sb.append(", carrierId=").append(carrierId);
+        sb.append(", planTruckNumber=").append(planTruckNumber);
+        sb.append(", capacityTypeId=").append(capacityTypeId);
+        sb.append(", planTruckTime=").append(planTruckTime);
+        sb.append(", planStatus=").append(planStatus);
+        sb.append(", materialTotalWeight=").append(materialTotalWeight);
+        sb.append(", planIncomingTime=").append(planIncomingTime);
+        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();
+    }
+}

+ 199 - 0
src/main/java/com/steerinfo/dil/model/AmstruckPurplanMaterial.java

@@ -0,0 +1,199 @@
+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 AmstruckPurplanMaterial implements IBasePO<BigDecimal> {
+    /**
+     * 主键ID(PURPLAN_PLAN_MATERIAL_ID,DECIMAL,38)
+     */
+    @ApiModelProperty(value="主键ID",required=true)
+    private BigDecimal purplanPlanMaterialId;
+
+    /**
+     * 计划ID(PLAN_ID,DECIMAL,38)
+     */
+    @ApiModelProperty(value="计划ID",required=false)
+    private BigDecimal planId;
+
+    /**
+     * 物资ID(MATERIAL_ID,DECIMAL,38)
+     */
+    @ApiModelProperty(value="物资ID",required=false)
+    private BigDecimal materialId;
+
+    /**
+     * 物资数量(PURPLAN_MATERIAL_NUMBER,DECIMAL,0)
+     */
+    @ApiModelProperty(value="物资数量",required=false)
+    private BigDecimal purplanMaterialNumber;
+
+    /**
+     * 已分配重量(MATERIAL_ALLOCATED_WEIGHT,DECIMAL,0)
+     */
+    @ApiModelProperty(value="已分配重量",required=false)
+    private BigDecimal materialAllocatedWeight;
+
+    /**
+     * 未分配重量(MATERIAL_UNALLOCATED_WEIGHT,DECIMAL,0)
+     */
+    @ApiModelProperty(value="未分配重量",required=false)
+    private BigDecimal materialUnallocatedWeight;
+
+    /**
+     * 记录创建人(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.purplanPlanMaterialId;
+    }
+
+    @Override
+    public void setId(BigDecimal purplanPlanMaterialId) {
+        this.purplanPlanMaterialId = purplanPlanMaterialId;
+    }
+
+    public BigDecimal getPurplanPlanMaterialId() {
+        return purplanPlanMaterialId;
+    }
+
+    public void setPurplanPlanMaterialId(BigDecimal purplanPlanMaterialId) {
+        this.purplanPlanMaterialId = purplanPlanMaterialId;
+    }
+
+    public BigDecimal getPlanId() {
+        return planId;
+    }
+
+    public void setPlanId(BigDecimal planId) {
+        this.planId = planId;
+    }
+
+    public BigDecimal getMaterialId() {
+        return materialId;
+    }
+
+    public void setMaterialId(BigDecimal materialId) {
+        this.materialId = materialId;
+    }
+
+    public BigDecimal getPurplanMaterialNumber() {
+        return purplanMaterialNumber;
+    }
+
+    public void setPurplanMaterialNumber(BigDecimal purplanMaterialNumber) {
+        this.purplanMaterialNumber = purplanMaterialNumber;
+    }
+
+    public BigDecimal getMaterialAllocatedWeight() {
+        return materialAllocatedWeight;
+    }
+
+    public void setMaterialAllocatedWeight(BigDecimal materialAllocatedWeight) {
+        this.materialAllocatedWeight = materialAllocatedWeight;
+    }
+
+    public BigDecimal getMaterialUnallocatedWeight() {
+        return materialUnallocatedWeight;
+    }
+
+    public void setMaterialUnallocatedWeight(BigDecimal materialUnallocatedWeight) {
+        this.materialUnallocatedWeight = materialUnallocatedWeight;
+    }
+
+    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(", purplanPlanMaterialId=").append(purplanPlanMaterialId);
+        sb.append(", planId=").append(planId);
+        sb.append(", materialId=").append(materialId);
+        sb.append(", purplanMaterialNumber=").append(purplanMaterialNumber);
+        sb.append(", materialAllocatedWeight=").append(materialAllocatedWeight);
+        sb.append(", materialUnallocatedWeight=").append(materialUnallocatedWeight);
+        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();
+    }
+}

+ 25 - 0
src/main/java/com/steerinfo/dil/service/IAmstruckPurplanMaterialService.java

@@ -0,0 +1,25 @@
+package com.steerinfo.dil.service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * AmstruckPurplanMaterial服务接口:
+ * @author generator
+ * @version 1.0-SNAPSHORT 2021-09-03 02:15
+ * 类描述
+ * 修订历史:
+ * 日期:2021-09-03
+ * 作者:generator
+ * 参考:
+ * 描述:AmstruckPurplanMaterial服务接口
+ * @see null
+ * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
+ */
+public interface IAmstruckPurplanMaterialService{
+    //查询所有已分解计划
+    List<Map<String, Object>> getDecomposedPlan(Map<String, Object> map);
+
+    //用于更改计划子表方法
+    void updateMaterial(Map<String, Object> map);
+}

+ 43 - 0
src/main/java/com/steerinfo/dil/service/IAmstruckPurplanService.java

@@ -0,0 +1,43 @@
+package com.steerinfo.dil.service;
+
+import com.steerinfo.dil.model.AmstruckPurplan;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * AmstruckPurplan服务接口:
+ * @author generator
+ * @version 1.0-SNAPSHORT 2021-09-02 10:38
+ * 类描述
+ * 修订历史:
+ * 日期:2021-09-02
+ * 作者:generator
+ * 参考:
+ * 描述:AmstruckPurplan服务接口
+ * @see null
+ * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
+ */
+public interface IAmstruckPurplanService{
+    //查询所有运输计划
+    List<Map<String, Object>> getAllPurPlan(Map<String, Object> map);
+
+    //通过ID查询运输计划
+    List<Map<String, Object>> getPurPlanById(@Param("planId") Integer planId);
+
+    //新增运输计划
+    int addPurPlan(AmstruckPurplan amstruckPurplan);
+
+    //修改运输计划
+    int updatePurPlan(AmstruckPurplan amstruckPurplan);
+
+    //逻辑删除运输计划
+    int deletePurPlan(AmstruckPurplan amstruckPurplan);
+
+    //下发运输计划
+    int sendPurPlan(AmstruckPurplan amstruckPurplan);
+
+    //下发运输计划
+    int receptionPurPlan(AmstruckPurplan amstruckPurplan);
+}

+ 76 - 0
src/main/java/com/steerinfo/dil/service/impl/AmstruckPurplanMaterialServiceImpl.java

@@ -0,0 +1,76 @@
+package com.steerinfo.dil.service.impl;
+
+import com.steerinfo.dil.mapper.AmstruckPurplanMaterialMapper;
+import com.steerinfo.dil.model.AmstruckPurplanMaterial;
+import com.steerinfo.dil.service.IAmstruckPurplanMaterialService;
+import com.steerinfo.dil.util.DataChange;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * AmstruckPurplanMaterial服务实现:
+ * @author TXF
+ * @version 1.0-SNAPSHORT 2021-09-03 02:15
+ * 类描述
+ * 修订历史:
+ * 日期:2021-09-03
+ * 作者:generator
+ * 参考:
+ * 描述:AmstruckPurplanMaterial服务实现
+ * @see null
+ * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
+ */
+@Service(value = "amstruckPurplanMaterialService")
+public class AmstruckPurplanMaterialServiceImpl implements IAmstruckPurplanMaterialService {
+
+    @Autowired
+    private AmstruckPurplanMaterialMapper amstruckPurplanMaterialMapper;
+
+
+    @Override
+    public List<Map<String, Object>> getDecomposedPlan(Map<String, Object> map) {
+        return amstruckPurplanMaterialMapper.getDecomposedPlan(map);
+    }
+
+    /**
+     * 更改计划子表重量
+     * @param map
+     */
+    public void updateMaterial(Map<String, Object> map){
+        Object omw = map.get("orderMaterialWeight");
+        double weight;
+        if(omw instanceof Double){
+            weight = (Double) omw;
+        }else if(omw instanceof Integer){
+            weight = (Integer) omw;
+        }else {
+            weight = Double.parseDouble(omw.toString());
+        }
+        Integer planId = DataChange.dataToBigDecimal(map.get("planId")).intValue();
+        List<Map<String, Object>> weightList = amstruckPurplanMaterialMapper.getWeight(planId);
+        Map<String, Object> weightMap = weightList.get(0);
+        double materialAllocatedWeight = DataChange.dataToBigDecimal(weightMap.get("materialAllocatedWeight")).floatValue();
+        double materialUnallocatedWeight = DataChange.dataToBigDecimal(weightMap.get("materialUnallocatedWeight")).floatValue();
+
+        //通过前端是否传来旧的重量 判断 是否是在原有已分解过的计划上修改 未分配 已分配重量
+        if(map.get("weight") != null){
+            BigDecimal oldWeight = DataChange.dataToBigDecimal(map.get("weight"));
+            double difference = weight - oldWeight.doubleValue();
+            materialAllocatedWeight += difference;
+            materialUnallocatedWeight -= difference;
+        }else {
+            materialAllocatedWeight += weight;
+            materialUnallocatedWeight -= weight;
+        }
+        AmstruckPurplanMaterial amstruckPurplanMaterial = new AmstruckPurplanMaterial();
+        //通过计划Id查询子表主键
+        amstruckPurplanMaterial.setPurplanPlanMaterialId(amstruckPurplanMaterialMapper.getChildIdByPlanId(new BigDecimal(planId)));
+        amstruckPurplanMaterial.setMaterialAllocatedWeight(new BigDecimal(materialAllocatedWeight));
+        amstruckPurplanMaterial.setMaterialUnallocatedWeight(new BigDecimal(materialUnallocatedWeight));
+        amstruckPurplanMaterialMapper.updateByPrimaryKeySelective(amstruckPurplanMaterial);
+    }
+}

+ 148 - 0
src/main/java/com/steerinfo/dil/service/impl/AmstruckPurplanServiceImpl.java

@@ -0,0 +1,148 @@
+package com.steerinfo.dil.service.impl;
+
+import com.steerinfo.dil.mapper.AmstruckPurplanMapper;
+import com.steerinfo.dil.mapper.AmstruckPurplanMaterialMapper;
+import com.steerinfo.dil.model.AmstruckPurplan;
+import com.steerinfo.dil.model.AmstruckPurplanMaterial;
+import com.steerinfo.dil.service.IAmstruckPurplanService;
+import com.steerinfo.dil.util.DataChange;
+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;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * AmstruckPurplan服务实现:
+ * @author TXF
+ * @version 1.0-SNAPSHORT 2021-09-02 10:38
+ * 类描述
+ * 修订历史:
+ * 日期:2021-09-02
+ * 作者:generator
+ * 参考:
+ * 描述:AmstruckPurplan服务实现
+ * @see null
+ * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
+ */
+@Service(value = "amstruckPurplanService")
+public class AmstruckPurplanServiceImpl implements IAmstruckPurplanService {
+
+    @Autowired
+    private AmstruckPurplanMapper amstruckPurplanMapper;
+
+    @Autowired
+    private AmstruckPurplanMaterialMapper amstruckPurplanMaterialMapper;
+
+    /**
+     * 查询所有运输计划
+     * @param map
+     * @return
+     */
+    @Override
+    public List<Map<String, Object>> getAllPurPlan(Map<String, Object> map) {
+        return amstruckPurplanMapper.getAllPurPlan(map);
+    }
+
+    /**
+     * 通过主键Id查询运输计划
+     * @param planId
+     * @return
+     */
+    @Override
+    public List<Map<String, Object>> getPurPlanById(Integer planId) {
+        return amstruckPurplanMapper.getPurPlanById(planId);
+    }
+
+    /**
+     * 新增运输计划
+     * @param amstruckPurplan
+     * @return
+     */
+    @Override
+    @Transactional
+    public int addPurPlan(AmstruckPurplan amstruckPurplan) {
+        //生成主键Id
+        BigDecimal maxId = amstruckPurplanMapper.selectMaxId();
+        amstruckPurplan.setPlanId(maxId);
+        //生成运输计划号
+        int id = maxId.intValue();
+        String planNumber = DataChange.generateEightDigitsNumber("WYSJF", id);
+        amstruckPurplan.setPlanNo(planNumber);
+        //新增状态为未下发:0
+        amstruckPurplan.setPlanStatus(new BigDecimal(0));
+        //记录创建人
+        amstruckPurplan.setInsertUsername("admin");
+        //生成子表数据
+        AmstruckPurplanMaterial amstruckPurplanMaterial = new AmstruckPurplanMaterial();
+        //生成主键
+        amstruckPurplanMaterial.setPurplanPlanMaterialId(amstruckPurplanMaterialMapper.selectMaxId());
+        //设置父表主键
+        amstruckPurplanMaterial.setPlanId(maxId);
+        //设置子表未分配数量重量 = 总重量
+        amstruckPurplanMaterial.setMaterialUnallocatedWeight(amstruckPurplan.getMaterialTotalWeight());
+        //设置已分配重量 初始为 0
+        amstruckPurplanMaterial.setMaterialAllocatedWeight(new BigDecimal(0));
+        int i = amstruckPurplanMaterialMapper.insertSelective(amstruckPurplanMaterial);
+        int i1 = amstruckPurplanMapper.insertSelective(amstruckPurplan);
+        return i + i1;
+    }
+
+    /**
+     * 修改运输计划
+     * @param amstruckPurplan
+     * @return
+     */
+    @Override
+    @Transactional
+    public int updatePurPlan(AmstruckPurplan amstruckPurplan) {
+        int i = amstruckPurplanMapper.updateByPrimaryKeySelective(amstruckPurplan);
+        //通过计划ID查询子表主键ID
+        BigDecimal childId = amstruckPurplanMaterialMapper.getChildIdByPlanId(amstruckPurplan.getPlanId());
+        //修改子表数据未分配物资重量
+        AmstruckPurplanMaterial amstruckPurplanMaterial = new AmstruckPurplanMaterial();
+        amstruckPurplanMaterial.setId(childId);
+        amstruckPurplanMaterial.setMaterialUnallocatedWeight(amstruckPurplan.getMaterialTotalWeight());
+        int i1 = amstruckPurplanMaterialMapper.updateByPrimaryKeySelective(amstruckPurplanMaterial);
+        return i + i1;
+    }
+
+    /**
+     * 逻辑删除运输计划 3
+     * @param amstruckPurplan
+     * @return
+     */
+    @Override
+    public int deletePurPlan(AmstruckPurplan amstruckPurplan) {
+
+        return amstruckPurplanMapper.updateByPrimaryKeySelective(amstruckPurplan);
+    }
+
+    /**
+     * 下发运输计划
+     * @param amstruckPurplan
+     * @return
+     */
+    @Override
+    public int sendPurPlan(AmstruckPurplan amstruckPurplan) {
+        //记录下发计划时间
+        amstruckPurplan.setInsertTime(new Date());
+        return amstruckPurplanMapper.updateByPrimaryKeySelective(amstruckPurplan);
+    }
+
+    /**
+     * 接收运输计划
+     * @param amstruckPurplan
+     * @return
+     */
+    @Override
+    public int receptionPurPlan(AmstruckPurplan amstruckPurplan) {
+        //记录接收计划时间
+        amstruckPurplan.setUpdateTime((new Date()));
+        return amstruckPurplanMapper.updateByPrimaryKeySelective(amstruckPurplan);
+    }
+
+}

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

@@ -0,0 +1,162 @@
+package com.steerinfo.dil.util;
+
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @ author    :TXF
+ * @ time      :2021/8/25 11:25
+ */
+
+public class DataChange {
+
+
+    /**
+     * 解析前端传来的日期字符串
+     * @param vueDate
+     * @return
+     */
+    public static Date dataToDate(Object vueDate){
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        Date parseDate = null;
+        if (vueDate != null){
+            try {
+                String date = (String) vueDate;
+                parseDate = sdf.parse(date);
+            } catch (ParseException e) {
+                e.printStackTrace();
+            }
+        }
+        return parseDate;
+    }
+
+    /**
+     * 数据转换成BigDecimal
+     * @param data
+     * @return
+     */
+    public static BigDecimal
+    dataToBigDecimal(Object data){
+        if (data != null){
+            if(data instanceof String){
+                String data1 = (String) data;
+                return new BigDecimal(data1);
+            }
+            if(data instanceof Integer){
+                Integer data2 = (Integer) data;
+                return new BigDecimal(data2);
+            }
+            if(data instanceof Double){
+                Double data3 = (Double) data;
+                return new BigDecimal(data3);
+            }
+            if(data instanceof BigDecimal){
+                return (BigDecimal) data;
+            }
+        }
+        return new BigDecimal(0);
+    }
+
+    /**
+     * 将时间截取到天  为字符串类型 用于前端只显示到天
+     * @param date 传入时间
+     * @return
+     */
+    public static String dateToDayDate(Object date){
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        Date changeDate = null;
+        try{
+            changeDate = (Date) date;
+        }catch (Exception e){
+            e.printStackTrace();
+        }
+        return sdf.format(changeDate);
+    }
+
+    /**
+     * 遍历从数据库中传进来的数据
+     * @param list 从数据库查询出来的list数据列表
+     * @param key map中多个需要转换的date参数
+     */
+    public static void changeDateToDayDate(List<Map<String, Object>> list, String ...key){
+        //遍历List
+        for (Map<String, Object> map : list) {
+            for (String s : key) {
+                //从map中取 date的值 并转换成字符串类型的日期
+                String stringDate = dateToDayDate(map.get(s));
+                if(stringDate.length() == 0){
+                    break;
+                }else {
+                    //修改map中的值
+                    map.put(s, stringDate);
+                }
+            }
+        }
+    }
+
+    /**
+     * 遍历列表使只显示两位小数
+     * @param list
+     * @param key
+     */
+    public static void dataTo2Number(List<Map<String, Object>> list, String ...key){
+        //遍历List
+        for (Map<String, Object> map : list) {
+            for (String s : key) {
+                //修改数据为带两位小数
+                BigDecimal oldDate = (BigDecimal) map.get(s);
+                DecimalFormat df =  new DecimalFormat("0.00");
+                String resultDeduction = df.format(oldDate.doubleValue());
+                map.put(s, resultDeduction);
+            }
+        }
+    }
+
+    /**
+     * 计算相差时间  日时分秒
+     * @param
+     * @return
+     */
+    public static String calculatedTimeDifference(Date time1, Date time2){
+        long t1 = time1.getTime();
+        long t2 = time2.getTime();
+        if(t1 > t2){
+            long temp = t1;
+            t1 = t2;
+            t2 = temp;
+        }
+        long between = t2 - t1;
+        long day = between / (24 * 60 * 60 * 1000);
+        long hour = (between / (60 * 60 * 1000) - day * 24);
+        long min = ((between / (60 * 1000)) - day * 24 * 60 - hour * 60);
+        long s = (between / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60);
+        return day + "天"+  + hour+ "时" + min + "分"  + s + "秒";
+    }
+
+    /**
+     * 生成带时间的八位数顺序号
+     * @param start 前缀
+     * @param id 顺序号  主键Id
+     * @return
+     */
+    public static String generateEightDigitsNumber(String start, Integer id){
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+        StringBuilder sb = new StringBuilder(start + sdf.format(new Date()));
+        sb.append(
+                id < 10
+                        ? "0000000" + id : id < 100
+                        ? "000000" + id : id < 1000
+                        ? "00000" + id : id < 10000
+                        ? "0000" + id : id < 100000
+                        ? "000" + id : id < 1000000
+                        ? "00" + id : id < 10000000
+                        ? "0" + id : id.toString()
+        );
+        return sb.toString();
+    }
+}

+ 1 - 1
src/main/resources/bootstrap.yml

@@ -14,7 +14,7 @@ spring:
 
 openfeign:
   ESFeign:
-    url: ${ESFEIGN_URL:localhost:8099}
+    url: ${ESFEIGN_URL:localhost:8089}
   ColumnDataFeign:
     url: ${COLUMNDATAFEIGN_URL:localhost:8083}
 

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

@@ -0,0 +1,588 @@
+<?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.AmstruckPurplanMapper">
+    <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.AmstruckPurplan">
+        <id column="PLAN_ID" jdbcType="DECIMAL" property="planId" />
+        <result column="BATCH_ID" jdbcType="DECIMAL" property="batchId" />
+        <result column="PLAN_NO" jdbcType="VARCHAR" property="planNo" />
+        <result column="CARRIER_ID" jdbcType="DECIMAL" property="carrierId" />
+        <result column="PLAN_TRUCK_NUMBER" jdbcType="DECIMAL" property="planTruckNumber" />
+        <result column="CAPACITY_TYPE_ID" jdbcType="DECIMAL" property="capacityTypeId" />
+        <result column="PLAN_TRUCK_TIME" jdbcType="TIMESTAMP" property="planTruckTime" />
+        <result column="PLAN_STATUS" jdbcType="DECIMAL" property="planStatus" />
+        <result column="MATERIAL_TOTAL_WEIGHT" jdbcType="DECIMAL" property="materialTotalWeight" />
+        <result column="PLAN_INCOMING_TIME" jdbcType="TIMESTAMP" property="planIncomingTime" />
+        <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">
+        PLAN_ID, BATCH_ID, PLAN_NO, CARRIER_ID, PLAN_TRUCK_NUMBER, CAPACITY_TYPE_ID, PLAN_TRUCK_TIME,
+    PLAN_STATUS, MATERIAL_TOTAL_WEIGHT, PLAN_INCOMING_TIME, INSERT_USERNAME, INSERT_TIME,
+    UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK
+    </sql>
+    <sql id="columns_alias">
+        t.PLAN_ID, t.BATCH_ID, t.PLAN_NO, t.CARRIER_ID, t.PLAN_TRUCK_NUMBER, t.CAPACITY_TYPE_ID,
+    t.PLAN_TRUCK_TIME, t.PLAN_STATUS, t.MATERIAL_TOTAL_WEIGHT, t.PLAN_INCOMING_TIME,
+    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_PURPLAN
+    </sql>
+    <sql id="select_alias">
+        SELECT <include refid="columns_alias" /> FROM AMSTRUCK_PURPLAN t
+    </sql>
+    <sql id="where">
+        <where>
+            <if test="planId != null">
+                and PLAN_ID = #{planId}
+            </if>
+            <if test="batchId != null">
+                and BATCH_ID = #{batchId}
+            </if>
+            <if test="planNo != null and planNo != ''">
+                and PLAN_NO = #{planNo}
+            </if>
+            <if test="carrierId != null">
+                and CARRIER_ID = #{carrierId}
+            </if>
+            <if test="planTruckNumber != null">
+                and PLAN_TRUCK_NUMBER = #{planTruckNumber}
+            </if>
+            <if test="capacityTypeId != null">
+                and CAPACITY_TYPE_ID = #{capacityTypeId}
+            </if>
+            <if test="planTruckTime != null">
+                and TO_CHAR(PLAN_TRUCK_TIME,'yyyy-MM-dd') = #{planTruckTime}
+            </if>
+            <if test="planStatus != null">
+                and PLAN_STATUS = #{planStatus}
+            </if>
+            <if test="materialTotalWeight != null">
+                and MATERIAL_TOTAL_WEIGHT = #{materialTotalWeight}
+            </if>
+            <if test="planIncomingTime != null">
+                and TO_CHAR(PLAN_INCOMING_TIME,'yyyy-MM-dd') = #{planIncomingTime}
+            </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="planId != null">
+                and PLAN_ID = #{planId}
+            </if>
+            <if test="batchId != null">
+                and BATCH_ID = #{batchId}
+            </if>
+            <if test="planNo != null and planNo != ''">
+                and PLAN_NO LIKE '%${planNo}%'
+            </if>
+            <if test="carrierId != null">
+                and CARRIER_ID = #{carrierId}
+            </if>
+            <if test="planTruckNumber != null">
+                and PLAN_TRUCK_NUMBER = #{planTruckNumber}
+            </if>
+            <if test="capacityTypeId != null">
+                and CAPACITY_TYPE_ID = #{capacityTypeId}
+            </if>
+            <if test="planTruckTime != null">
+                and TO_CHAR(PLAN_TRUCK_TIME,'yyyy-MM-dd') = #{planTruckTime}
+            </if>
+            <if test="planStatus != null">
+                and PLAN_STATUS = #{planStatus}
+            </if>
+            <if test="materialTotalWeight != null">
+                and MATERIAL_TOTAL_WEIGHT = #{materialTotalWeight}
+            </if>
+            <if test="planIncomingTime != null">
+                and TO_CHAR(PLAN_INCOMING_TIME,'yyyy-MM-dd') = #{planIncomingTime}
+            </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_PURPLAN
+        where PLAN_ID = #{planId,jdbcType=DECIMAL}
+    </delete>
+    <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
+        delete from AMSTRUCK_PURPLAN
+        where 1!=1
+        <if test="batchId != null">
+            or BATCH_ID = #{batchId}
+        </if>
+        <if test="planNo != null and planNo != ''">
+            or PLAN_NO = #{planNo}
+        </if>
+        <if test="carrierId != null">
+            or CARRIER_ID = #{carrierId}
+        </if>
+        <if test="planTruckNumber != null">
+            or PLAN_TRUCK_NUMBER = #{planTruckNumber}
+        </if>
+        <if test="capacityTypeId != null">
+            or CAPACITY_TYPE_ID = #{capacityTypeId}
+        </if>
+        <if test="planTruckTime != null">
+            or TO_CHAR(PLAN_TRUCK_TIME,'yyyy-MM-dd') = '#{planTruckTime}'
+        </if>
+        <if test="planStatus != null">
+            or PLAN_STATUS = #{planStatus}
+        </if>
+        <if test="materialTotalWeight != null">
+            or MATERIAL_TOTAL_WEIGHT = #{materialTotalWeight}
+        </if>
+        <if test="planIncomingTime != null">
+            or TO_CHAR(PLAN_INCOMING_TIME,'yyyy-MM-dd') = '#{planIncomingTime}'
+        </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.AmstruckPurplan">
+        insert into AMSTRUCK_PURPLAN (PLAN_ID, BATCH_ID, PLAN_NO,
+                                      CARRIER_ID, PLAN_TRUCK_NUMBER, CAPACITY_TYPE_ID,
+                                      PLAN_TRUCK_TIME, PLAN_STATUS, MATERIAL_TOTAL_WEIGHT,
+                                      PLAN_INCOMING_TIME, INSERT_USERNAME, INSERT_TIME,
+                                      UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK
+        )
+        values (#{planId,jdbcType=DECIMAL}, #{batchId,jdbcType=DECIMAL}, #{planNo,jdbcType=VARCHAR},
+                #{carrierId,jdbcType=DECIMAL}, #{planTruckNumber,jdbcType=DECIMAL}, #{capacityTypeId,jdbcType=DECIMAL},
+                #{planTruckTime,jdbcType=TIMESTAMP}, #{planStatus,jdbcType=DECIMAL}, #{materialTotalWeight,jdbcType=DECIMAL},
+                #{planIncomingTime,jdbcType=TIMESTAMP}, #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP},
+                #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR}
+               )
+    </insert>
+    <insert id="insertSelective" parameterType="com.steerinfo.dil.model.AmstruckPurplan">
+        insert into AMSTRUCK_PURPLAN
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="planId != null">
+                PLAN_ID,
+            </if>
+            <if test="batchId != null">
+                BATCH_ID,
+            </if>
+            <if test="planNo != null">
+                PLAN_NO,
+            </if>
+            <if test="carrierId != null">
+                CARRIER_ID,
+            </if>
+            <if test="planTruckNumber != null">
+                PLAN_TRUCK_NUMBER,
+            </if>
+            <if test="capacityTypeId != null">
+                CAPACITY_TYPE_ID,
+            </if>
+            <if test="planTruckTime != null">
+                PLAN_TRUCK_TIME,
+            </if>
+            <if test="planStatus != null">
+                PLAN_STATUS,
+            </if>
+            <if test="materialTotalWeight != null">
+                MATERIAL_TOTAL_WEIGHT,
+            </if>
+            <if test="planIncomingTime != null">
+                PLAN_INCOMING_TIME,
+            </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="planId != null">
+                #{planId,jdbcType=DECIMAL},
+            </if>
+            <if test="batchId != null">
+                #{batchId,jdbcType=DECIMAL},
+            </if>
+            <if test="planNo != null">
+                #{planNo,jdbcType=VARCHAR},
+            </if>
+            <if test="carrierId != null">
+                #{carrierId,jdbcType=DECIMAL},
+            </if>
+            <if test="planTruckNumber != null">
+                #{planTruckNumber,jdbcType=DECIMAL},
+            </if>
+            <if test="capacityTypeId != null">
+                #{capacityTypeId,jdbcType=DECIMAL},
+            </if>
+            <if test="planTruckTime != null">
+                #{planTruckTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="planStatus != null">
+                #{planStatus,jdbcType=DECIMAL},
+            </if>
+            <if test="materialTotalWeight != null">
+                #{materialTotalWeight,jdbcType=DECIMAL},
+            </if>
+            <if test="planIncomingTime != null">
+                #{planIncomingTime,jdbcType=TIMESTAMP},
+            </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.AmstruckPurplan">
+        update AMSTRUCK_PURPLAN
+        set BATCH_ID = #{batchId,jdbcType=DECIMAL},
+            PLAN_NO = #{planNo,jdbcType=VARCHAR},
+            CARRIER_ID = #{carrierId,jdbcType=DECIMAL},
+            PLAN_TRUCK_NUMBER = #{planTruckNumber,jdbcType=DECIMAL},
+            CAPACITY_TYPE_ID = #{capacityTypeId,jdbcType=DECIMAL},
+            PLAN_TRUCK_TIME = #{planTruckTime,jdbcType=TIMESTAMP},
+            PLAN_STATUS = #{planStatus,jdbcType=DECIMAL},
+            MATERIAL_TOTAL_WEIGHT = #{materialTotalWeight,jdbcType=DECIMAL},
+            PLAN_INCOMING_TIME = #{planIncomingTime,jdbcType=TIMESTAMP},
+            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 PLAN_ID = #{planId,jdbcType=DECIMAL}
+    </update>
+    <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.AmstruckPurplan">
+        update AMSTRUCK_PURPLAN
+        <set>
+            <if test="batchId != null">
+                BATCH_ID = #{batchId,jdbcType=DECIMAL},
+            </if>
+            <if test="planNo != null">
+                PLAN_NO = #{planNo,jdbcType=VARCHAR},
+            </if>
+            <if test="carrierId != null">
+                CARRIER_ID = #{carrierId,jdbcType=DECIMAL},
+            </if>
+            <if test="planTruckNumber != null">
+                PLAN_TRUCK_NUMBER = #{planTruckNumber,jdbcType=DECIMAL},
+            </if>
+            <if test="capacityTypeId != null">
+                CAPACITY_TYPE_ID = #{capacityTypeId,jdbcType=DECIMAL},
+            </if>
+            <if test="planTruckTime != null">
+                PLAN_TRUCK_TIME = #{planTruckTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="planStatus != null">
+                PLAN_STATUS = #{planStatus,jdbcType=DECIMAL},
+            </if>
+            <if test="materialTotalWeight != null">
+                MATERIAL_TOTAL_WEIGHT = #{materialTotalWeight,jdbcType=DECIMAL},
+            </if>
+            <if test="planIncomingTime != null">
+                PLAN_INCOMING_TIME = #{planIncomingTime,jdbcType=TIMESTAMP},
+            </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 PLAN_ID = #{planId,jdbcType=DECIMAL}
+    </update>
+    <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
+        <include refid="select" />
+        where PLAN_ID = #{planId,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 AMSTRUCK_PURPLAN
+        (PLAN_ID,
+        BATCH_ID, PLAN_NO, CARRIER_ID,
+        PLAN_TRUCK_NUMBER, CAPACITY_TYPE_ID,
+        PLAN_TRUCK_TIME, PLAN_STATUS,
+        MATERIAL_TOTAL_WEIGHT, PLAN_INCOMING_TIME,
+        INSERT_USERNAME, INSERT_TIME,
+        UPDATE_USERNAME, UPDATE_TIME,
+        INSERT_UPDATE_REMARK)
+        ( <foreach collection="list" item="item" separator="union all">
+        select
+        #{item.planId,jdbcType=DECIMAL},
+        #{item.batchId,jdbcType=DECIMAL}, #{item.planNo,jdbcType=VARCHAR}, #{item.carrierId,jdbcType=DECIMAL},
+        #{item.planTruckNumber,jdbcType=DECIMAL}, #{item.capacityTypeId,jdbcType=DECIMAL},
+        #{item.planTruckTime,jdbcType=TIMESTAMP}, #{item.planStatus,jdbcType=DECIMAL},
+        #{item.materialTotalWeight,jdbcType=DECIMAL}, #{item.planIncomingTime,jdbcType=TIMESTAMP},
+        #{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_PURPLAN
+        set
+        PLAN_ID=
+        <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
+            when #{item.planId,jdbcType=DECIMAL} then #{item.planId,jdbcType=DECIMAL}
+        </foreach>
+        ,BATCH_ID=
+        <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
+            when #{item.planId,jdbcType=DECIMAL} then #{item.batchId,jdbcType=DECIMAL}
+        </foreach>
+        ,PLAN_NO=
+        <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
+            when #{item.planId,jdbcType=DECIMAL} then #{item.planNo,jdbcType=VARCHAR}
+        </foreach>
+        ,CARRIER_ID=
+        <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
+            when #{item.planId,jdbcType=DECIMAL} then #{item.carrierId,jdbcType=DECIMAL}
+        </foreach>
+        ,PLAN_TRUCK_NUMBER=
+        <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
+            when #{item.planId,jdbcType=DECIMAL} then #{item.planTruckNumber,jdbcType=DECIMAL}
+        </foreach>
+        ,CAPACITY_TYPE_ID=
+        <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
+            when #{item.planId,jdbcType=DECIMAL} then #{item.capacityTypeId,jdbcType=DECIMAL}
+        </foreach>
+        ,PLAN_TRUCK_TIME=
+        <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
+            when #{item.planId,jdbcType=DECIMAL} then #{item.planTruckTime,jdbcType=TIMESTAMP}
+        </foreach>
+        ,PLAN_STATUS=
+        <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
+            when #{item.planId,jdbcType=DECIMAL} then #{item.planStatus,jdbcType=DECIMAL}
+        </foreach>
+        ,MATERIAL_TOTAL_WEIGHT=
+        <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
+            when #{item.planId,jdbcType=DECIMAL} then #{item.materialTotalWeight,jdbcType=DECIMAL}
+        </foreach>
+        ,PLAN_INCOMING_TIME=
+        <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
+            when #{item.planId,jdbcType=DECIMAL} then #{item.planIncomingTime,jdbcType=TIMESTAMP}
+        </foreach>
+        ,INSERT_USERNAME=
+        <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
+            when #{item.planId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
+        </foreach>
+        ,INSERT_TIME=
+        <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
+            when #{item.planId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
+        </foreach>
+        ,UPDATE_USERNAME=
+        <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
+            when #{item.planId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
+        </foreach>
+        ,UPDATE_TIME=
+        <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
+            when #{item.planId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
+        </foreach>
+        ,INSERT_UPDATE_REMARK=
+        <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
+            when #{item.planId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
+        </foreach>
+        where PLAN_ID in
+        <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
+            #{item.planId,jdbcType=DECIMAL}
+        </foreach>
+    </update>
+    <delete id="batchDelete" parameterType="java.util.List">
+        delete from AMSTRUCK_PURPLAN
+        where PLAN_ID in
+        <foreach close=")" collection="list" item="id" open="(" separator=",">
+            #{id}
+        </foreach>
+    </delete>
+    <!-- 友情提示!!!-->
+    <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
+
+    <sql id="orderBy">
+        <if test="orderField != null and orderField != ''">
+            order by  "${orderField}"
+            <if test="orderType != null and orderType != ''">
+                ${orderType}
+            </if>
+        </if>
+    </sql>
+
+    <!-- 通过状态 0:未下发 1:已下发 查询运输计划 -->
+    <select id="getAllPurPlan" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
+        select
+        *
+        from (
+        select
+            AP.PLAN_ID "planId",
+            APO.PURCHASE_ORDER_NO "purchaseOrderNo",
+            DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
+            RM.MATERIAL_NAME "materialName",
+            AP.PLAN_NO "planNo",
+            RC.CARRIER_NAME "carrierName",
+            AP.MATERIAL_TOTAL_WEIGHT "materialTotalWeight",
+            AP.PLAN_TRUCK_TIME "planTruckTime",
+            AP.PLAN_INCOMING_TIME "planIncomingTime"
+        from AMSTRUCK_PURPLAN AP
+        left join AMS_PURCHASE_ORDER APO
+        on AP.BATCH_ID = APO.BATCH_ID
+        left join DIL_BATCH DB
+        on AP.BATCH_ID = DB.BATCH_ID
+        left join RMS_MATERIAL RM
+        on RM.MATERIAL_ID = DB.MATERIAL_ID
+        left join RMS_CARRIER RC
+        on AP.CARRIER_ID = RC.CARRIER_ID
+        where AP.PLAN_STATUS = #{planStatus}
+        )
+        <where>
+            <if test="planId != null">
+                <foreach collection="planId" item="item" open="(" separator="or" close=")">
+                    "planId" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="purchaseOrderNo != null">
+                and
+                <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
+                    "purchaseOrderNo" 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="materialName != null">
+                and
+                <foreach collection="materialName" item="item" open="(" separator="or" close=")">
+                    "materialName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="planNo != null">
+                and
+                <foreach collection="planNo" item="item" open="(" separator="or" close=")">
+                    "planNo" 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="materialTotalWeight != null">
+                and
+                <foreach collection="materialTotalWeight" item="item" open="(" separator="or" close=")">
+                    "materialTotalWeight" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="planTruckTime != null">
+                and
+                <foreach collection="planTruckTime" item="item" open="(" separator="or" close=")">
+                    "planTruckTime" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="planIncomingTime != null">
+                and
+                <foreach collection="planIncomingTime" item="item" open="(" separator="or" close=")">
+                    "planIncomingTime" like '%${item}%'
+                </foreach>
+            </if>
+        </where>
+        <include refid="orderBy"></include>
+        <if test="orderField == null  ">
+            order by "planIncomingTime" desc
+        </if>
+    </select>
+
+
+    <!--  通过ID查询运输计划 -->
+    <select id="getPurPlanById" parameterType="int" resultType="java.util.Map">
+        select DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
+               DB.MATERIAL_ID              "materialId",
+               AP.CARRIER_ID               "carrierId",
+               AP.MATERIAL_TOTAL_WEIGHT    "materialTotalWeight",
+               AP.PLAN_TRUCK_TIME          "planTruckTime",
+               AP.PLAN_INCOMING_TIME "planIncomingTime",
+               AP.BATCH_ID                 "batchId",
+               AP.PLAN_ID                  "planId"
+        from AMSTRUCK_PURPLAN AP
+                 left join DIL_BATCH DB
+                           on AP.BATCH_ID = DB.BATCH_ID
+        where PLAN_ID = #{planId}
+    </select>
+
+
+</mapper>

+ 534 - 0
src/main/resources/com/steerinfo/dil/mapper/AmstruckPurplanMaterialMapper.xml

@@ -0,0 +1,534 @@
+<?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.AmstruckPurplanMaterialMapper">
+    <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.AmstruckPurplanMaterial">
+        <id column="PURPLAN_PLAN_MATERIAL_ID" jdbcType="DECIMAL" property="purplanPlanMaterialId"/>
+        <result column="PLAN_ID" jdbcType="DECIMAL" property="planId"/>
+        <result column="MATERIAL_ID" jdbcType="DECIMAL" property="materialId"/>
+        <result column="PURPLAN_MATERIAL_NUMBER" jdbcType="DECIMAL" property="purplanMaterialNumber"/>
+        <result column="MATERIAL_ALLOCATED_WEIGHT" jdbcType="DECIMAL" property="materialAllocatedWeight"/>
+        <result column="MATERIAL_UNALLOCATED_WEIGHT" jdbcType="DECIMAL" property="materialUnallocatedWeight"/>
+        <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">
+        PURPLAN_PLAN_MATERIAL_ID, PLAN_ID, MATERIAL_ID, PURPLAN_MATERIAL_NUMBER, MATERIAL_ALLOCATED_WEIGHT,
+    MATERIAL_UNALLOCATED_WEIGHT, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, 
+    INSERT_UPDATE_REMARK
+    </sql>
+    <sql id="columns_alias">
+        t.PURPLAN_PLAN_MATERIAL_ID, t.PLAN_ID, t.MATERIAL_ID, t.PURPLAN_MATERIAL_NUMBER,
+    t.MATERIAL_ALLOCATED_WEIGHT, t.MATERIAL_UNALLOCATED_WEIGHT, 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_PURPLAN_MATERIAL
+    </sql>
+    <sql id="select_alias">
+        SELECT
+        <include refid="columns_alias"/>
+        FROM AMSTRUCK_PURPLAN_MATERIAL t
+    </sql>
+    <sql id="where">
+        <where>
+            <if test="purplanPlanMaterialId != null">
+                and PURPLAN_PLAN_MATERIAL_ID = #{purplanPlanMaterialId}
+            </if>
+            <if test="planId != null">
+                and PLAN_ID = #{planId}
+            </if>
+            <if test="materialId != null">
+                and MATERIAL_ID = #{materialId}
+            </if>
+            <if test="purplanMaterialNumber != null">
+                and PURPLAN_MATERIAL_NUMBER = #{purplanMaterialNumber}
+            </if>
+            <if test="materialAllocatedWeight != null">
+                and MATERIAL_ALLOCATED_WEIGHT = #{materialAllocatedWeight}
+            </if>
+            <if test="materialUnallocatedWeight != null">
+                and MATERIAL_UNALLOCATED_WEIGHT = #{materialUnallocatedWeight}
+            </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="purplanPlanMaterialId != null">
+                and PURPLAN_PLAN_MATERIAL_ID = #{purplanPlanMaterialId}
+            </if>
+            <if test="planId != null">
+                and PLAN_ID = #{planId}
+            </if>
+            <if test="materialId != null">
+                and MATERIAL_ID = #{materialId}
+            </if>
+            <if test="purplanMaterialNumber != null">
+                and PURPLAN_MATERIAL_NUMBER = #{purplanMaterialNumber}
+            </if>
+            <if test="materialAllocatedWeight != null">
+                and MATERIAL_ALLOCATED_WEIGHT = #{materialAllocatedWeight}
+            </if>
+            <if test="materialUnallocatedWeight != null">
+                and MATERIAL_UNALLOCATED_WEIGHT = #{materialUnallocatedWeight}
+            </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_PURPLAN_MATERIAL
+        where PURPLAN_PLAN_MATERIAL_ID = #{purplanPlanMaterialId,jdbcType=DECIMAL}
+    </delete>
+    <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
+        delete from AMSTRUCK_PURPLAN_MATERIAL
+        where 1!=1
+        <if test="planId != null">
+            or PLAN_ID = #{planId}
+        </if>
+        <if test="materialId != null">
+            or MATERIAL_ID = #{materialId}
+        </if>
+        <if test="purplanMaterialNumber != null">
+            or PURPLAN_MATERIAL_NUMBER = #{purplanMaterialNumber}
+        </if>
+        <if test="materialAllocatedWeight != null">
+            or MATERIAL_ALLOCATED_WEIGHT = #{materialAllocatedWeight}
+        </if>
+        <if test="materialUnallocatedWeight != null">
+            or MATERIAL_UNALLOCATED_WEIGHT = #{materialUnallocatedWeight}
+        </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.AmstruckPurplanMaterial">
+        insert into AMSTRUCK_PURPLAN_MATERIAL (PURPLAN_PLAN_MATERIAL_ID, PLAN_ID, MATERIAL_ID,
+                                               PURPLAN_MATERIAL_NUMBER, MATERIAL_ALLOCATED_WEIGHT,
+                                               MATERIAL_UNALLOCATED_WEIGHT, INSERT_USERNAME,
+                                               INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME,
+                                               INSERT_UPDATE_REMARK)
+        values (#{purplanPlanMaterialId,jdbcType=DECIMAL}, #{planId,jdbcType=DECIMAL}, #{materialId,jdbcType=DECIMAL},
+                #{purplanMaterialNumber,jdbcType=DECIMAL}, #{materialAllocatedWeight,jdbcType=DECIMAL},
+                #{materialUnallocatedWeight,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.AmstruckPurplanMaterial">
+        insert into AMSTRUCK_PURPLAN_MATERIAL
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="purplanPlanMaterialId != null">
+                PURPLAN_PLAN_MATERIAL_ID,
+            </if>
+            <if test="planId != null">
+                PLAN_ID,
+            </if>
+            <if test="materialId != null">
+                MATERIAL_ID,
+            </if>
+            <if test="purplanMaterialNumber != null">
+                PURPLAN_MATERIAL_NUMBER,
+            </if>
+            <if test="materialAllocatedWeight != null">
+                MATERIAL_ALLOCATED_WEIGHT,
+            </if>
+            <if test="materialUnallocatedWeight != null">
+                MATERIAL_UNALLOCATED_WEIGHT,
+            </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="purplanPlanMaterialId != null">
+                #{purplanPlanMaterialId,jdbcType=DECIMAL},
+            </if>
+            <if test="planId != null">
+                #{planId,jdbcType=DECIMAL},
+            </if>
+            <if test="materialId != null">
+                #{materialId,jdbcType=DECIMAL},
+            </if>
+            <if test="purplanMaterialNumber != null">
+                #{purplanMaterialNumber,jdbcType=DECIMAL},
+            </if>
+            <if test="materialAllocatedWeight != null">
+                #{materialAllocatedWeight,jdbcType=DECIMAL},
+            </if>
+            <if test="materialUnallocatedWeight != null">
+                #{materialUnallocatedWeight,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.AmstruckPurplanMaterial">
+        update AMSTRUCK_PURPLAN_MATERIAL
+        set PLAN_ID                     = #{planId,jdbcType=DECIMAL},
+            MATERIAL_ID                 = #{materialId,jdbcType=DECIMAL},
+            PURPLAN_MATERIAL_NUMBER     = #{purplanMaterialNumber,jdbcType=DECIMAL},
+            MATERIAL_ALLOCATED_WEIGHT   = #{materialAllocatedWeight,jdbcType=DECIMAL},
+            MATERIAL_UNALLOCATED_WEIGHT = #{materialUnallocatedWeight,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 PURPLAN_PLAN_MATERIAL_ID = #{purplanPlanMaterialId,jdbcType=DECIMAL}
+    </update>
+    <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.AmstruckPurplanMaterial">
+        update AMSTRUCK_PURPLAN_MATERIAL
+        <set>
+            <if test="planId != null">
+                PLAN_ID = #{planId,jdbcType=DECIMAL},
+            </if>
+            <if test="materialId != null">
+                MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
+            </if>
+            <if test="purplanMaterialNumber != null">
+                PURPLAN_MATERIAL_NUMBER = #{purplanMaterialNumber,jdbcType=DECIMAL},
+            </if>
+            <if test="materialAllocatedWeight != null">
+                MATERIAL_ALLOCATED_WEIGHT = #{materialAllocatedWeight,jdbcType=DECIMAL},
+            </if>
+            <if test="materialUnallocatedWeight != null">
+                MATERIAL_UNALLOCATED_WEIGHT = #{materialUnallocatedWeight,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 PURPLAN_PLAN_MATERIAL_ID = #{purplanPlanMaterialId,jdbcType=DECIMAL}
+    </update>
+    <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
+        <include refid="select"/>
+        where PURPLAN_PLAN_MATERIAL_ID = #{purplanPlanMaterialId,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 AMSTRUCK_PURPLAN_MATERIAL
+        (PURPLAN_PLAN_MATERIAL_ID,
+        PLAN_ID, MATERIAL_ID, PURPLAN_MATERIAL_NUMBER,
+        MATERIAL_ALLOCATED_WEIGHT, MATERIAL_UNALLOCATED_WEIGHT,
+        INSERT_USERNAME, INSERT_TIME,
+        UPDATE_USERNAME, UPDATE_TIME,
+        INSERT_UPDATE_REMARK)
+        ( <foreach collection="list" item="item" separator="union all">
+        select
+        #{item.purplanPlanMaterialId,jdbcType=DECIMAL},
+        #{item.planId,jdbcType=DECIMAL}, #{item.materialId,jdbcType=DECIMAL},
+        #{item.purplanMaterialNumber,jdbcType=DECIMAL},
+        #{item.materialAllocatedWeight,jdbcType=DECIMAL}, #{item.materialUnallocatedWeight,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_PURPLAN_MATERIAL
+        set
+        PURPLAN_PLAN_MATERIAL_ID=
+        <foreach collection="list" item="item" index="index" separator=" " open="case PURPLAN_PLAN_MATERIAL_ID"
+                 close="end">
+            when #{item.purplanPlanMaterialId,jdbcType=DECIMAL} then #{item.purplanPlanMaterialId,jdbcType=DECIMAL}
+        </foreach>
+        ,PLAN_ID=
+        <foreach collection="list" item="item" index="index" separator=" " open="case PURPLAN_PLAN_MATERIAL_ID"
+                 close="end">
+            when #{item.purplanPlanMaterialId,jdbcType=DECIMAL} then #{item.planId,jdbcType=DECIMAL}
+        </foreach>
+        ,MATERIAL_ID=
+        <foreach collection="list" item="item" index="index" separator=" " open="case PURPLAN_PLAN_MATERIAL_ID"
+                 close="end">
+            when #{item.purplanPlanMaterialId,jdbcType=DECIMAL} then #{item.materialId,jdbcType=DECIMAL}
+        </foreach>
+        ,PURPLAN_MATERIAL_NUMBER=
+        <foreach collection="list" item="item" index="index" separator=" " open="case PURPLAN_PLAN_MATERIAL_ID"
+                 close="end">
+            when #{item.purplanPlanMaterialId,jdbcType=DECIMAL} then #{item.purplanMaterialNumber,jdbcType=DECIMAL}
+        </foreach>
+        ,MATERIAL_ALLOCATED_WEIGHT=
+        <foreach collection="list" item="item" index="index" separator=" " open="case PURPLAN_PLAN_MATERIAL_ID"
+                 close="end">
+            when #{item.purplanPlanMaterialId,jdbcType=DECIMAL} then #{item.materialAllocatedWeight,jdbcType=DECIMAL}
+        </foreach>
+        ,MATERIAL_UNALLOCATED_WEIGHT=
+        <foreach collection="list" item="item" index="index" separator=" " open="case PURPLAN_PLAN_MATERIAL_ID"
+                 close="end">
+            when #{item.purplanPlanMaterialId,jdbcType=DECIMAL} then #{item.materialUnallocatedWeight,jdbcType=DECIMAL}
+        </foreach>
+        ,INSERT_USERNAME=
+        <foreach collection="list" item="item" index="index" separator=" " open="case PURPLAN_PLAN_MATERIAL_ID"
+                 close="end">
+            when #{item.purplanPlanMaterialId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
+        </foreach>
+        ,INSERT_TIME=
+        <foreach collection="list" item="item" index="index" separator=" " open="case PURPLAN_PLAN_MATERIAL_ID"
+                 close="end">
+            when #{item.purplanPlanMaterialId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
+        </foreach>
+        ,UPDATE_USERNAME=
+        <foreach collection="list" item="item" index="index" separator=" " open="case PURPLAN_PLAN_MATERIAL_ID"
+                 close="end">
+            when #{item.purplanPlanMaterialId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
+        </foreach>
+        ,UPDATE_TIME=
+        <foreach collection="list" item="item" index="index" separator=" " open="case PURPLAN_PLAN_MATERIAL_ID"
+                 close="end">
+            when #{item.purplanPlanMaterialId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
+        </foreach>
+        ,INSERT_UPDATE_REMARK=
+        <foreach collection="list" item="item" index="index" separator=" " open="case PURPLAN_PLAN_MATERIAL_ID"
+                 close="end">
+            when #{item.purplanPlanMaterialId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
+        </foreach>
+        where PURPLAN_PLAN_MATERIAL_ID in
+        <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
+            #{item.purplanPlanMaterialId,jdbcType=DECIMAL}
+        </foreach>
+    </update>
+    <delete id="batchDelete" parameterType="java.util.List">
+        delete from AMSTRUCK_PURPLAN_MATERIAL
+        where PURPLAN_PLAN_MATERIAL_ID in
+        <foreach collection="list" item="id" open="(" close=")" separator=",">
+            #{id}
+        </foreach>
+    </delete>
+    <!-- 友情提示!!!-->
+    <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
+
+    <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>
+
+
+    <!--查询分解计划 -->
+    <select id="getDecomposedPlan" parameterType="java.util.Map" resultType="java.util.LinkedHashMap">
+        select
+        *
+        from (
+        select
+        APO.PURCHASE_ORDER_ID "purchaseOrderId",
+        APM.PURPLAN_PLAN_MATERIAL_ID "purplanPlanMaterialId",
+        APO.PURCHASE_ORDER_NO "purchaseOrderNo",
+        DB.RESULT_FOREIGN_SHIP_NAME "resultForeignShipName",
+        RM.MATERIAL_NAME "materialName",
+        AP.PLAN_NO "planNo",
+        RC.CARRIER_NAME "carrierName",
+        AP.MATERIAL_TOTAL_WEIGHT "materialTotalWeight",
+        APM.MATERIAL_ALLOCATED_WEIGHT "materialAllocatedWeight",
+        APM.MATERIAL_UNALLOCATED_WEIGHT "materialUnallocatedWeight",
+        AP.PLAN_TRUCK_TIME "planTruckTime",
+        RM.MATERIAL_ID "materialId",
+        AP.PLAN_INCOMING_TIME "planIncomingTime",
+        AP.PLAN_ID "planId",
+        AP.INSERT_TIME "insertTime"
+        from AMSTRUCK_PURPLAN AP
+        left join AMSTRUCK_PURPLAN_MATERIAL APM
+        on AP.PLAN_ID = APM.PLAN_ID
+        left join AMS_PURCHASE_ORDER APO
+        on AP.BATCH_ID = APO.BATCH_ID
+        left join DIL_BATCH DB
+        on AP.BATCH_ID = DB.BATCH_ID
+        left join RMS_MATERIAL RM
+        on RM.MATERIAL_ID = DB.MATERIAL_ID
+        left join RMS_CARRIER RC
+        on AP.CARRIER_ID = RC.CARRIER_ID
+        <where>
+            <if test="planId != null">
+                AP.PLAN_ID = #{planId}
+            </if>
+            <if test="planStatus != null">
+                and AP.PLAN_STATUS = #{planStatus}
+            </if>
+        </where>
+        )
+        <where>
+            <if test="purplanPlanMaterialId != null">
+
+                <foreach collection="purplanPlanMaterialId" item="item" open="(" separator="or" close=")">
+                    "purplanPlanMaterialId" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="purchaseOrderNo != null">
+                and
+                <foreach collection="purchaseOrderNo" item="item" open="(" separator="or" close=")">
+                    "purchaseOrderNo" 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="materialName != null">
+                and
+                <foreach collection="materialName" item="item" open="(" separator="or" close=")">
+                    "materialName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="planNo != null">
+                and
+                <foreach collection="planNo" item="item" open="(" separator="or" close=")">
+                    "planNo" 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="materialTotalWeight != null">
+                and
+                <foreach collection="materialTotalWeight" item="item" open="(" separator="or" close=")">
+                    "materialTotalWeight" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="planTruckTime != null">
+                and
+                <foreach collection="planTruckTime" item="item" open="(" separator="or" close=")">
+                    "planTruckTime" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="lineDesc != null">
+                and
+                <foreach collection="lineDesc" item="item" open="(" separator="or" close=")">
+                    "lineDesc" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="planIncomingTime != null">
+                and
+                <foreach collection="planIncomingTime" item="item" open="(" separator="or" close=")">
+                    "planIncomingTime" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="materialAllocatedWeight != null">
+                and
+                <foreach collection="materialAllocatedWeight" item="item" open="(" separator="or" close=")">
+                    "materialAllocatedWeight" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="materialUnallocatedWeight != null">
+                and
+                <foreach collection="materialUnallocatedWeight" item="item" open="(" separator="or" close=")">
+                    "materialUnallocatedWeight" like '%${item}%'
+                </foreach>
+            </if>
+        </where>
+        <include refid="orderBy"></include>
+    </select>
+
+    <!--获取未分配重量 已分配重量-->
+    <select id="getWeight" parameterType="int" resultType="java.util.LinkedHashMap">
+        select APM.MATERIAL_ALLOCATED_WEIGHT   "materialAllocatedWeight",
+               APM.MATERIAL_UNALLOCATED_WEIGHT "materialUnallocatedWeight"
+        from AMSTRUCK_PURPLAN_MATERIAL APM
+        where APM.PLAN_ID = #{planId}
+    </select>
+
+<!--  通过计划Id查询子表主键ID -->
+    <select id="getChildIdByPlanId" parameterType="java.math.BigDecimal" resultType="java.math.BigDecimal">
+        select PURPLAN_PLAN_MATERIAL_ID
+        from AMSTRUCK_PURPLAN_MATERIAL
+        where PLAN_ID = #{planId}
+    </select>
+</mapper>