Your Name пре 3 година
родитељ
комит
fc7a64f8b7

+ 1 - 0
pom.xml

@@ -117,6 +117,7 @@
 <!--                        <param>AMS_CONTRACT_TRANSPORT_PRICE</param>&lt;!&ndash;销售订单&ndash;&gt;-->
 <!--                        <param>AMS_SALE_ORDER_MATERIAL</param>&lt;!&ndash;销售订单车序号表&ndash;&gt;-->
 <!--                        <param>AMS_SALE_TRUCKNO_MATERIAL</param>&lt;!&ndash;车序号物资中间表&ndash;&gt;-->
+                            <param>AMSTRUCK_INWARD_PLAN</param>
                     </tables>
                 </configuration>
                 <executions>

+ 9 - 0
src/main/java/com/steerinfo/dil/controller/AmstruckInwardPlanController.java

@@ -60,6 +60,15 @@ public class AmstruckInwardPlanController extends BaseRESTfulController {
 
     }
 
+    /*
+    停/启用运输计划
+     */
+    @PostMapping("/changePlanStatus/{planId}")
+    public RESTfulResult changePlanStatus(@PathVariable("planId") BigDecimal planId){
+        int result = amstruckInwardPlanService.changePlanStatus(planId);
+        return success(result);
+    }
+
     /**
      * 完成运输计划
      */

+ 73 - 0
src/main/java/com/steerinfo/dil/controller/AmstruckInwardRequirementController.java

@@ -54,6 +54,17 @@ public class AmstruckInwardRequirementController extends BaseRESTfulController {
         int result = amstruckInwardRequirementService.insert(mapValue);
         return success(result);
     }
+
+    /*
+    新增采购内转需求
+     */
+    @PostMapping("/addPurInwardRequirement")
+    public RESTfulResult addPurInwardRequirement(@RequestBody Map<String,Object>mapValue){
+        int result = amstruckInwardRequirementService.insertPurInwardRequirement(mapValue);
+        return success(result);
+    }
+
+
     /**
      * 删除用车需求
      */
@@ -80,6 +91,8 @@ public class AmstruckInwardRequirementController extends BaseRESTfulController {
         return success(result);
     }
 
+
+
     /**
      * 下发需求
      */
@@ -155,6 +168,66 @@ public class AmstruckInwardRequirementController extends BaseRESTfulController {
         return success(data);
     }
 
+    //展示采购内转需求
+    @PostMapping("/getPurRequirementList")
+    public RESTfulResult getPurRequirementList(@RequestBody(required = false) Map<String,Object> mapValue,
+                                                 Integer pageNum,
+                                                 Integer pageSize,
+                                                 Integer apiId,
+                                                 Integer requirementStatus,
+                                                 String con,
+                                                 String userId,
+                                                 String carrierSsoId,
+                                                 String enableStatus,
+                                                 String planStatus) {
+        if (con != null) {
+            if (!con.equals("undefined")) {
+                String index="get_pur_requirement_list";//设置要查询的索引名称
+                return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
+            }
+        }
+        if (mapValue == null) {
+            mapValue = new HashMap<>();
+        }
+        if(userId != null){
+            mapValue.put("userId",userId);
+        }
+        if(carrierSsoId != null){
+            mapValue.put("carrierSsoId",carrierSsoId);
+        }
+        if(enableStatus != null){
+            mapValue.put("enableStatus",enableStatus);
+        }
+        if(planStatus != null){
+            mapValue.put("planStatus",planStatus);
+        }
+        mapValue.put("requirementStatus",requirementStatus);
+        List<Map<String, Object>> truckRequirementList = null;
+        if (mapValue.size() == 1) {
+            //将查询结果存入索引中
+            truckRequirementList =  amstruckInwardRequirementService.getPurRequirementList(mapValue);
+            Map<String, Object> map1 = new HashMap<>();
+            //添加索引
+            map1.put("index","get_pur_requirement_list");
+            //添加id
+            map1.put("indexId","purRequirementId");
+            truckRequirementList.add(map1);
+            //新建索引
+            esFeign.insertIndex(truckRequirementList);
+            //删除
+            truckRequirementList.remove(truckRequirementList.size()-1);
+        }
+        if (truckRequirementList == null) {
+            truckRequirementList = amstruckInwardRequirementService.getPurRequirementList(mapValue);
+        }
+        PageHelper.startPage(pageNum, pageSize);
+        //分页查询数据
+        List<Map<String, Object>> columnList = amstruckInwardRequirementService.getPurRequirementList(mapValue);
+        PageListAdd data = columnDataUtil.tableColumnData(apiId, truckRequirementList, columnList);
+        return success(data);
+    }
+
+
     @ApiModelProperty(value = "展示批次信息")
     @ApiImplicitParams({
             @ApiImplicitParam(name = "pageNum", value = "查询页数", required = false, dataType = "Integer"),

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

@@ -39,4 +39,7 @@ public interface AmstruckInwardRequirementMapper extends IBaseMapper<AmstruckInw
 
     // 拿到物资id
     BigDecimal getMaterialId(BigDecimal purchaseOrderId);
+
+    List<Map<String, Object>> getPurRequirementList(Map<String, Object> mapValue);
+
 }

+ 22 - 6
src/main/java/com/steerinfo/dil/model/AmstruckInwardPlan.java

@@ -3,13 +3,14 @@ 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 AmstruckInwardPlan implements IBasePO<BigDecimal> {
     /**
-     * 主键id(PLAN_ID,DECIMAL,38)
+     * 主键id(PLAN_ID,DECIMAL,0)
      */
     @ApiModelProperty(value="主键id",required=true)
     private BigDecimal planId;
@@ -21,7 +22,7 @@ public class AmstruckInwardPlan implements IBasePO<BigDecimal> {
     private String planNumber;
 
     /**
-     * 承运商ID(CARRIER_ID,DECIMAL,38)
+     * 承运商ID(CARRIER_ID,DECIMAL,0)
      */
     @ApiModelProperty(value="承运商ID",required=false)
     private BigDecimal carrierId;
@@ -33,9 +34,9 @@ public class AmstruckInwardPlan implements IBasePO<BigDecimal> {
     private BigDecimal planTruckNumber;
 
     /**
-     * 计划状态(0:未下发;1:已下发;2:已接收)(PLAN_STATUS,DECIMAL,38)
+     * 计划状态(0:未下发;1:已下发;2:已接收 3:已分解4:已完成)(PLAN_STATUS,DECIMAL,0)
      */
-    @ApiModelProperty(value="计划状态(0:未下发;1:已下发;2:已接收)",required=false)
+    @ApiModelProperty(value="计划状态(0:未下发;1:已下发;2:已接收 3:已分解4:已完成)",required=false)
     private BigDecimal planStatus;
 
     /**
@@ -75,9 +76,9 @@ public class AmstruckInwardPlan implements IBasePO<BigDecimal> {
     private String insertUpdateRemark;
 
     /**
-     * 0:未删除;1:已删除(DELETED,DECIMAL,0)
+     * 0:未删除;1:已删除 (DELETED,DECIMAL,0)
      */
-    @ApiModelProperty(value="0:未删除;1:已删除",required=false)
+    @ApiModelProperty(value="0:未删除;1:已删除 ",required=false)
     private BigDecimal deleted;
 
     /**
@@ -86,6 +87,12 @@ public class AmstruckInwardPlan implements IBasePO<BigDecimal> {
     @ApiModelProperty(value="计划下发人",required=false)
     private String planIssueName;
 
+    /**
+     * 计划启用状态(PLAN_EABLE_STATUS,DECIMAL,0)
+     */
+    @ApiModelProperty(value="计划启用状态",required=false)
+    private BigDecimal planEableStatus;
+
     private static final long serialVersionUID = 1L;
 
     @Override
@@ -202,6 +209,14 @@ public class AmstruckInwardPlan implements IBasePO<BigDecimal> {
         this.planIssueName = planIssueName == null ? null : planIssueName.trim();
     }
 
+    public BigDecimal getPlanEableStatus() {
+        return planEableStatus;
+    }
+
+    public void setPlanEableStatus(BigDecimal planEableStatus) {
+        this.planEableStatus = planEableStatus;
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
@@ -221,6 +236,7 @@ public class AmstruckInwardPlan implements IBasePO<BigDecimal> {
         sb.append(", insertUpdateRemark=").append(insertUpdateRemark);
         sb.append(", deleted=").append(deleted);
         sb.append(", planIssueName=").append(planIssueName);
+        sb.append(", planEableStatus=").append(planEableStatus);
         sb.append(", serialVersionUID=").append(serialVersionUID);
         sb.append("]");
         return sb.toString();

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

@@ -37,4 +37,7 @@ public interface IAmstruckInwardPlanService extends IBaseService<AmstruckInwardP
     List<Map<String, Object>> getCarrierList();
 
     int receiveInwardPlan(BigDecimal planId);
+
+    int changePlanStatus(BigDecimal planId);
+
 }

+ 9 - 0
src/main/java/com/steerinfo/dil/service/IAmstruckInwardRequirementService.java

@@ -2,6 +2,7 @@ package com.steerinfo.dil.service;
 
 import com.steerinfo.dil.model.AmstruckInwardRequirement;
 import com.steerinfo.framework.service.IBaseService;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.util.List;
@@ -46,4 +47,12 @@ public interface IAmstruckInwardRequirementService extends IBaseService<Amstruck
 
     //异地库下拉框
     List<Map<String, Object>> getOffsetWareHouse();
+
+    //新增采购内转需求
+    int insertPurInwardRequirement(Map<String, Object> mapValue);
+
+    //查询采购内转需求
+    List<Map<String, Object>> getPurRequirementList(Map<String, Object> mapValue);
+
+//    int insertInwardRequirementPlan(Map<String, Object> mapValue);
 }

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

@@ -85,6 +85,7 @@ public class AmstruckInwardPlanServiceImpl extends BaseServiceImpl<AmstruckInwar
         return i;
     }
 
+
     @Override
     public List<Map<String, Object>> getTruckPlanList(Map<String, Object> mapValue) {
         BigDecimal planStatus = (BigDecimal)mapValue.get("planStatus");
@@ -174,4 +175,13 @@ public class AmstruckInwardPlanServiceImpl extends BaseServiceImpl<AmstruckInwar
         int result = amstruckInwardPlanMapper.updateByPrimaryKeySelective(amstruckInwardPlan);
         return result;
     }
+
+    //停用计划
+    @Override
+    public int changePlanStatus(BigDecimal planId) {
+        AmstruckInwardPlan amstruckInwardPlan = amstruckInwardPlanMapper.selectByPrimaryKey(planId);
+        amstruckInwardPlan.setPlanEableStatus(new BigDecimal(0));
+        int result = amstruckInwardPlanMapper.updateByPrimaryKeySelective(amstruckInwardPlan);
+        return result;
+    }
 }

+ 107 - 0
src/main/java/com/steerinfo/dil/service/impl/AmstruckInwardRequirementServiceImpl.java

@@ -1,9 +1,13 @@
 package com.steerinfo.dil.service.impl;
 
+import com.steerinfo.dil.mapper.AmstruckInwardPlanMapper;
 import com.steerinfo.dil.mapper.AmstruckInwardRequirementMapper;
 import com.steerinfo.dil.mapper.AmstruckRequirementMaterialMapper;
+import com.steerinfo.dil.mapper.AmstruckRequirementPlanMapper;
+import com.steerinfo.dil.model.AmstruckInwardPlan;
 import com.steerinfo.dil.model.AmstruckInwardRequirement;
 import com.steerinfo.dil.model.AmstruckRequirementMaterial;
+import com.steerinfo.dil.model.AmstruckRequirementPlan;
 import com.steerinfo.dil.service.IAmstruckInwardRequirementService;
 import com.steerinfo.dil.util.DataChange;
 import com.steerinfo.framework.mapper.IBaseMapper;
@@ -40,6 +44,12 @@ public class AmstruckInwardRequirementServiceImpl extends BaseServiceImpl<Amstru
     @Autowired
     AmstruckRequirementMaterialMapper amstruckRequirementMaterialMapper;
 
+    @Autowired
+    private AmstruckInwardPlanMapper amstruckInwardPlanMapper;
+
+    @Autowired
+    private AmstruckRequirementPlanMapper amstruckRequirementPlanMapper;
+
     @Override
     protected IBaseMapper<AmstruckInwardRequirement, BigDecimal> getMapper() {
         return amstruckInwardRequirementMapper;
@@ -125,6 +135,8 @@ public class AmstruckInwardRequirementServiceImpl extends BaseServiceImpl<Amstru
         return mapList;
     }
 
+
+
     /**
      * 删除用车需求
      * @param requirementId
@@ -246,4 +258,99 @@ public class AmstruckInwardRequirementServiceImpl extends BaseServiceImpl<Amstru
 
         return amstruckRequirementMaterialMapper.getOffsetWarehouse();
     }
+
+    @Transactional
+    @Override
+    public int insertPurInwardRequirement(Map<String, Object> mapValue) {
+        BigDecimal purchaseOrderId = DataChange.dataToBigDecimal(mapValue.get("purchaseOrderId"));
+        BigDecimal unloadPointId = DataChange.dataToBigDecimal(mapValue.get("unloadPointId"));
+        String userId = (String)mapValue.get("userId");
+        BigDecimal carrierId = DataChange.dataToBigDecimal(mapValue.get("carrierId"));
+        BigDecimal materialId = DataChange.dataToBigDecimal(mapValue.get("materialId"));
+        AmstruckInwardRequirement amstruckInwardRequirement = new AmstruckInwardRequirement();
+        //设置主键
+        BigDecimal requirementId = amstruckInwardRequirementMapper.selectOtherId();
+        amstruckInwardRequirement.setRequirementId(requirementId);
+        amstruckInwardRequirement.setRequirementNumber(DataChange.generateEightDigitsNumber("YSXQ",amstruckInwardRequirementMapper.selectOtherId().intValue()));
+        amstruckInwardRequirement.setRequirementStatus(new BigDecimal(0));
+        amstruckInwardRequirement.setPurchaseOrderId(purchaseOrderId);
+        amstruckInwardRequirement.setRequirementUnloadUnitId(unloadPointId);
+        //采购内转现在先默认装货点是新区轨道衡
+        // 设置常规字段
+        amstruckInwardRequirement.setInsertTime(new Date());
+        amstruckInwardRequirement.setInsertUsername(userId);
+        amstruckInwardRequirement.setInsertUpdateRemark("无");
+        amstruckInwardRequirement.setDeleted(new BigDecimal(0));
+        int result = 0;
+        result += amstruckInwardRequirementMapper.insertSelective(amstruckInwardRequirement);
+        // 物资中间表
+        AmstruckRequirementMaterial amstruckRequirementMaterial = new AmstruckRequirementMaterial();
+        amstruckRequirementMaterial.setRequirementMaterialId(amstruckRequirementMaterialMapper.selectRequirementMaterialId());
+        amstruckRequirementMaterial.setRequirementId(requirementId);
+        amstruckRequirementMaterial.setMaterialId(materialId);
+        amstruckRequirementMaterial.setInsertTime(new Date());
+        amstruckRequirementMaterial.setInsertUsername("admin");
+        amstruckRequirementMaterial.setInsertUpdateRemark("无");
+        Map<String, Object> inwardPlanMap = new HashMap<>();
+        inwardPlanMap.put("carrierId",carrierId);
+        inwardPlanMap.put("requirementId",requirementId);
+        result += amstruckRequirementMaterialMapper.insertSelective(amstruckRequirementMaterial);
+        result += insertInwardRequirementPlan(inwardPlanMap);
+        return result;
+    }
+
+    @Override
+    public List<Map<String, Object>> getPurRequirementList(Map<String, Object> mapValue) {
+        List<Map<String, Object>> mapList;
+            mapList = amstruckInwardRequirementMapper.getPurRequirementList(mapValue);
+            for (Map<String,Object> map:mapList
+             ) {
+                BigDecimal enable = DataChange.dataToBigDecimal(map.get("enable"));
+                if(enable.intValue() == 0){;
+                   map.remove("enable");
+                   map.put("enable","未启用");
+                   map.put("loadPointName","化工园区铁专线");
+                }else{
+                    map.remove("enable");
+                    map.put("enable","启用");
+                    map.put("loadPointName","化工园区铁专线");
+                }
+                }
+            return mapList;
+    }
+    public int insertInwardRequirementPlan(Map<String, Object> mapValue) {
+        AmstruckInwardPlan amstruckInwardPlan = new AmstruckInwardPlan();
+        BigDecimal planId = amstruckInwardPlanMapper.selectOtherId();
+        //设置主键
+        amstruckInwardPlan.setPlanId(planId);
+        //获取承运商id
+        BigDecimal carrierId=DataChange.dataToBigDecimal(mapValue.get("carrierId"));
+        amstruckInwardPlan.setCarrierId(carrierId);
+        amstruckInwardPlan.setPlanNumber(DataChange.generateEightDigitsNumber("YSJH",planId.intValue()));
+        //设置计划状态为启用
+        amstruckInwardPlan.setPlanEableStatus(new BigDecimal(1));
+        //设置计划状态为已接收
+        amstruckInwardPlan.setPlanStatus(new BigDecimal(2));
+        // 设置常规字段
+        amstruckInwardPlan.setInsertTime(new Date());
+        amstruckInwardPlan.setInsertUsername("admin");
+        amstruckInwardPlan.setInsertUpdateRemark("无");
+        amstruckInwardPlan.setDeleted(new BigDecimal(0));
+        int i = amstruckInwardPlanMapper.insertSelective(amstruckInwardPlan);
+        //新增需求计划中间表
+        AmstruckRequirementPlan amstruckRequirementPlan = new AmstruckRequirementPlan();
+        //xu qiu ID
+        BigDecimal requirementId = DataChange.dataToBigDecimal(mapValue.get("requirementId"));
+        BigDecimal requirementPlanId = amstruckRequirementPlanMapper.selectOtherId();
+        amstruckRequirementPlan.setRequirementPlanId(requirementPlanId);
+        amstruckRequirementPlan.setPlanId(planId);
+        amstruckRequirementPlan.setRequirementId(requirementId);
+        amstruckRequirementPlan.setInsertTime(new Date());
+        amstruckRequirementPlan.setInsertUsername("admin");
+        amstruckRequirementPlan.setInsertUpdateRemark("无");
+        //在中间表中将需求与计划绑定
+        i += amstruckRequirementPlanMapper.insertSelective(amstruckRequirementPlan);
+        return i;
+    }
+
 }

+ 103 - 86
src/main/resources/com/steerinfo/dil/mapper/AmstruckInwardPlanMapper.xml

@@ -2,39 +2,36 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.steerinfo.dil.mapper.AmstruckInwardPlanMapper">
     <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.AmstruckInwardPlan">
-        <id column="PLAN_ID" jdbcType="DECIMAL" property="planId"/>
-        <result column="PLAN_NUMBER" jdbcType="VARCHAR" property="planNumber"/>
-        <result column="CARRIER_ID" jdbcType="DECIMAL" property="carrierId"/>
-        <result column="PLAN_TRUCK_NUMBER" jdbcType="DECIMAL" property="planTruckNumber"/>
-        <result column="PLAN_STATUS" jdbcType="DECIMAL" property="planStatus"/>
-        <result column="PLAN_ISSUE_TIME" jdbcType="TIMESTAMP" property="planIssueTime"/>
-        <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername"/>
-        <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime"/>
-        <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername"/>
-        <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime"/>
-        <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark"/>
-        <result column="DELETED" jdbcType="DECIMAL" property="deleted"/>
-        <result column="PLAN_ISSUE_NAME" jdbcType="VARCHAR" property="planIssueName"/>
+        <id column="PLAN_ID" jdbcType="DECIMAL" property="planId" />
+        <result column="PLAN_NUMBER" jdbcType="VARCHAR" property="planNumber" />
+        <result column="CARRIER_ID" jdbcType="DECIMAL" property="carrierId" />
+        <result column="PLAN_TRUCK_NUMBER" jdbcType="DECIMAL" property="planTruckNumber" />
+        <result column="PLAN_STATUS" jdbcType="DECIMAL" property="planStatus" />
+        <result column="PLAN_ISSUE_TIME" jdbcType="TIMESTAMP" property="planIssueTime" />
+        <result column="INSERT_USERNAME" jdbcType="VARCHAR" property="insertUsername" />
+        <result column="INSERT_TIME" jdbcType="TIMESTAMP" property="insertTime" />
+        <result column="UPDATE_USERNAME" jdbcType="VARCHAR" property="updateUsername" />
+        <result column="UPDATE_TIME" jdbcType="TIMESTAMP" property="updateTime" />
+        <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
+        <result column="DELETED" jdbcType="DECIMAL" property="deleted" />
+        <result column="PLAN_ISSUE_NAME" jdbcType="VARCHAR" property="planIssueName" />
+        <result column="PLAN_EABLE_STATUS" jdbcType="DECIMAL" property="planEableStatus" />
     </resultMap>
     <sql id="columns">
-        PLAN_ID, PLAN_NUMBER, CARRIER_ID, PLAN_TRUCK_NUMBER, PLAN_STATUS, PLAN_ISSUE_TIME,
-    INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
-    DELETED, PLAN_ISSUE_NAME
-    </sql>
+    PLAN_ID, PLAN_NUMBER, CARRIER_ID, PLAN_TRUCK_NUMBER, PLAN_STATUS, PLAN_ISSUE_TIME, 
+    INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK, 
+    DELETED, PLAN_ISSUE_NAME, PLAN_EABLE_STATUS
+  </sql>
     <sql id="columns_alias">
-        t.PLAN_ID, t.PLAN_NUMBER, t.CARRIER_ID, t.PLAN_TRUCK_NUMBER, t.PLAN_STATUS, t.PLAN_ISSUE_TIME,
-    t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK,
-    t.DELETED, t.PLAN_ISSUE_NAME
-    </sql>
+    t.PLAN_ID, t.PLAN_NUMBER, t.CARRIER_ID, t.PLAN_TRUCK_NUMBER, t.PLAN_STATUS, t.PLAN_ISSUE_TIME, 
+    t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, 
+    t.DELETED, t.PLAN_ISSUE_NAME, t.PLAN_EABLE_STATUS
+  </sql>
     <sql id="select">
-        SELECT
-        <include refid="columns"/>
-        FROM AMSTRUCK_INWARD_PLAN
+        SELECT <include refid="columns" /> FROM AMSTRUCK_INWARD_PLAN
     </sql>
     <sql id="select_alias">
-        SELECT
-        <include refid="columns_alias"/>
-        FROM AMSTRUCK_INWARD_PLAN t
+        SELECT <include refid="columns_alias" /> FROM AMSTRUCK_INWARD_PLAN t
     </sql>
     <sql id="where">
         <where>
@@ -77,6 +74,9 @@
             <if test="planIssueName != null and planIssueName != ''">
                 and PLAN_ISSUE_NAME = #{planIssueName}
             </if>
+            <if test="planEableStatus != null">
+                and PLAN_EABLE_STATUS = #{planEableStatus}
+            </if>
         </where>
     </sql>
     <sql id="whereLike">
@@ -120,13 +120,15 @@
             <if test="planIssueName != null and planIssueName != ''">
                 and PLAN_ISSUE_NAME LIKE '%${planIssueName}%'
             </if>
+            <if test="planEableStatus != null">
+                and PLAN_EABLE_STATUS = #{planEableStatus}
+            </if>
         </where>
     </sql>
-    <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
-        delete
-        from AMSTRUCK_INWARD_PLAN
-        where PLAN_ID = #{planId,jdbcType=DECIMAL}
-    </delete>
+    <delete id="deleteByPrimaryKey" parameterType="DECIMAL">
+    delete from AMSTRUCK_INWARD_PLAN
+    where PLAN_ID = #{planId,jdbcType=DECIMAL}
+  </delete>
     <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
         delete from AMSTRUCK_INWARD_PLAN
         where 1!=1
@@ -166,21 +168,22 @@
         <if test="planIssueName != null and planIssueName != ''">
             or PLAN_ISSUE_NAME = #{planIssueName}
         </if>
+        <if test="planEableStatus != null">
+            or PLAN_EABLE_STATUS = #{planEableStatus}
+        </if>
     </delete>
     <insert id="insert" parameterType="com.steerinfo.dil.model.AmstruckInwardPlan">
-        insert into AMSTRUCK_INWARD_PLAN (PLAN_ID, PLAN_NUMBER, CARRIER_ID,
-                                          PLAN_TRUCK_NUMBER, PLAN_STATUS, PLAN_ISSUE_TIME,
-                                          INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME,
-                                          UPDATE_TIME, INSERT_UPDATE_REMARK, DELETED,
-                                          PLAN_ISSUE_NAME)
-        values (#{planId,jdbcType=DECIMAL}, #{planNumber,jdbcType=VARCHAR}, #{carrierId,jdbcType=DECIMAL},
-                #{planTruckNumber,jdbcType=DECIMAL}, #{planStatus,jdbcType=DECIMAL},
-                #{planIssueTime,jdbcType=TIMESTAMP},
-                #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP},
-                #{updateUsername,jdbcType=VARCHAR},
-                #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR}, #{deleted,jdbcType=DECIMAL},
-                #{planIssueName,jdbcType=VARCHAR})
-    </insert>
+    insert into AMSTRUCK_INWARD_PLAN (PLAN_ID, PLAN_NUMBER, CARRIER_ID, 
+      PLAN_TRUCK_NUMBER, PLAN_STATUS, PLAN_ISSUE_TIME, 
+      INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, 
+      UPDATE_TIME, INSERT_UPDATE_REMARK, DELETED, 
+      PLAN_ISSUE_NAME, PLAN_EABLE_STATUS)
+    values (#{planId,jdbcType=DECIMAL}, #{planNumber,jdbcType=VARCHAR}, #{carrierId,jdbcType=DECIMAL}, 
+      #{planTruckNumber,jdbcType=DECIMAL}, #{planStatus,jdbcType=DECIMAL}, #{planIssueTime,jdbcType=TIMESTAMP}, 
+      #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, 
+      #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR}, #{deleted,jdbcType=DECIMAL}, 
+      #{planIssueName,jdbcType=VARCHAR}, #{planEableStatus,jdbcType=DECIMAL})
+  </insert>
     <insert id="insertSelective" parameterType="com.steerinfo.dil.model.AmstruckInwardPlan">
         insert into AMSTRUCK_INWARD_PLAN
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -223,6 +226,9 @@
             <if test="planIssueName != null">
                 PLAN_ISSUE_NAME,
             </if>
+            <if test="planEableStatus != null">
+                PLAN_EABLE_STATUS,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="planId != null">
@@ -264,24 +270,28 @@
             <if test="planIssueName != null">
                 #{planIssueName,jdbcType=VARCHAR},
             </if>
+            <if test="planEableStatus != null">
+                #{planEableStatus,jdbcType=DECIMAL},
+            </if>
         </trim>
     </insert>
     <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.AmstruckInwardPlan">
-        update AMSTRUCK_INWARD_PLAN
-        set PLAN_NUMBER          = #{planNumber,jdbcType=VARCHAR},
-            CARRIER_ID           = #{carrierId,jdbcType=DECIMAL},
-            PLAN_TRUCK_NUMBER    = #{planTruckNumber,jdbcType=DECIMAL},
-            PLAN_STATUS          = #{planStatus,jdbcType=DECIMAL},
-            PLAN_ISSUE_TIME      = #{planIssueTime,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},
-            DELETED              = #{deleted,jdbcType=DECIMAL},
-            PLAN_ISSUE_NAME      = #{planIssueName,jdbcType=VARCHAR}
-        where PLAN_ID = #{planId,jdbcType=DECIMAL}
-    </update>
+    update AMSTRUCK_INWARD_PLAN
+    set PLAN_NUMBER = #{planNumber,jdbcType=VARCHAR},
+      CARRIER_ID = #{carrierId,jdbcType=DECIMAL},
+      PLAN_TRUCK_NUMBER = #{planTruckNumber,jdbcType=DECIMAL},
+      PLAN_STATUS = #{planStatus,jdbcType=DECIMAL},
+      PLAN_ISSUE_TIME = #{planIssueTime,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},
+      DELETED = #{deleted,jdbcType=DECIMAL},
+      PLAN_ISSUE_NAME = #{planIssueName,jdbcType=VARCHAR},
+      PLAN_EABLE_STATUS = #{planEableStatus,jdbcType=DECIMAL}
+    where PLAN_ID = #{planId,jdbcType=DECIMAL}
+  </update>
     <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.AmstruckInwardPlan">
         update AMSTRUCK_INWARD_PLAN
         <set>
@@ -321,20 +331,23 @@
             <if test="planIssueName != null">
                 PLAN_ISSUE_NAME = #{planIssueName,jdbcType=VARCHAR},
             </if>
+            <if test="planEableStatus != null">
+                PLAN_EABLE_STATUS = #{planEableStatus,jdbcType=DECIMAL},
+            </if>
         </set>
         where PLAN_ID = #{planId,jdbcType=DECIMAL}
     </update>
-    <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
-        <include refid="select"/>
+    <select id="selectByPrimaryKey" parameterType="DECIMAL" 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"/>
+        <include refid="select" />
+        <include refid="where" />
     </select>
     <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
-        <include refid="select"/>
-        <include refid="whereLike"/>
+        <include refid="select" />
+        <include refid="whereLike" />
     </select>
     <insert id="batchInsert" parameterType="java.util.List">
         insert into AMSTRUCK_INWARD_PLAN
@@ -344,89 +357,93 @@
         INSERT_USERNAME, INSERT_TIME,
         UPDATE_USERNAME, UPDATE_TIME,
         INSERT_UPDATE_REMARK, DELETED,
-        PLAN_ISSUE_NAME)
+        PLAN_ISSUE_NAME, PLAN_EABLE_STATUS
+        )
         ( <foreach collection="list" item="item" separator="union all">
         select
         #{item.planId,jdbcType=DECIMAL},
-        #{item.planNumber,jdbcType=VARCHAR}, #{item.carrierId,jdbcType=DECIMAL},
-        #{item.planTruckNumber,jdbcType=DECIMAL},
+        #{item.planNumber,jdbcType=VARCHAR}, #{item.carrierId,jdbcType=DECIMAL}, #{item.planTruckNumber,jdbcType=DECIMAL},
         #{item.planStatus,jdbcType=DECIMAL}, #{item.planIssueTime,jdbcType=TIMESTAMP},
         #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
         #{item.updateUsername,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=TIMESTAMP},
         #{item.insertUpdateRemark,jdbcType=VARCHAR}, #{item.deleted,jdbcType=DECIMAL},
-        #{item.planIssueName,jdbcType=VARCHAR} from dual
+        #{item.planIssueName,jdbcType=VARCHAR}, #{item.planEableStatus,jdbcType=DECIMAL}
+        from dual
     </foreach> )
     </insert>
     <update id="batchUpdate" parameterType="java.util.List">
         update AMSTRUCK_INWARD_PLAN
         set
         PLAN_ID=
-        <foreach collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
+        <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>
         ,PLAN_NUMBER=
-        <foreach collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
             when #{item.planId,jdbcType=DECIMAL} then #{item.planNumber,jdbcType=VARCHAR}
         </foreach>
         ,CARRIER_ID=
-        <foreach collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
+        <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 collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
+        <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>
         ,PLAN_STATUS=
-        <foreach collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
+        <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>
         ,PLAN_ISSUE_TIME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
             when #{item.planId,jdbcType=DECIMAL} then #{item.planIssueTime,jdbcType=TIMESTAMP}
         </foreach>
         ,INSERT_USERNAME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
+        <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 collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
+        <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 collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
+        <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 collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
+        <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 collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
+        <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>
         ,DELETED=
-        <foreach collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
             when #{item.planId,jdbcType=DECIMAL} then #{item.deleted,jdbcType=DECIMAL}
         </foreach>
         ,PLAN_ISSUE_NAME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case PLAN_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
             when #{item.planId,jdbcType=DECIMAL} then #{item.planIssueName,jdbcType=VARCHAR}
         </foreach>
+        ,PLAN_EABLE_STATUS=
+        <foreach close="end" collection="list" index="index" item="item" open="case PLAN_ID" separator=" ">
+            when #{item.planId,jdbcType=DECIMAL} then #{item.planEableStatus,jdbcType=DECIMAL}
+        </foreach>
         where PLAN_ID in
-        <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
+        <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_INWARD_PLAN
         where PLAN_ID in
-        <foreach collection="list" item="id" open="(" close=")" separator=",">
+        <foreach close=")" collection="list" item="id" open="(" separator=",">
             #{id}
         </foreach>
     </delete>
     <!-- 友情提示!!!-->
     <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
-    <!-- 展示运输计划 -->
     <select id="getTruckPlanList" resultType="java.util.Map" parameterType="java.util.Map">
         SELECT *
         FROM (SELECT APO.PURCHASE_ORDER_NO              AS "purchaseOrderNo",

+ 106 - 0
src/main/resources/com/steerinfo/dil/mapper/AmstruckInwardRequirementMapper.xml

@@ -1179,4 +1179,110 @@ SELECT APO.PURCHASE_ORDER_NO              AS "purchaseOrderNo",
                            ON DB.BATCH_ID = APO.BATCH_ID
         WHERE APO.PURCHASE_ORDER_ID = #{purchaseOrderId}
     </select>
+    <select id="getPurRequirementList" resultType="java.util.Map" parameterType="map">
+        select * from (
+        SELECT
+        AIR.REQUIREMENT_ID "requirementId",
+        AIP.PLAN_ID "planId",
+        APO.PURCHASE_ORDER_ID "purchaseOrderId",
+        AIR.REQUIREMENT_NUMBER    "requirementNo",
+        APO.PURCHASE_ORDER_NO     "purchaseOrderNo",
+        RS.SUPPLIER_NAME          "supplierName",
+        RC.CONSIGNEE_COMPANY_NAME "consigneeName",
+        RW.WAREHOUSE_NAME         "warehouseName",
+        rm.material_id            "materialId",
+        AIP.PLAN_STATUS           "planStatus",
+        RM.MATERIAL_NAME          "materialName",
+        RCR.CARRIER_NAME          "carrierName",
+        AIP.PLAN_EABLE_STATUS     "enable",
+        AIR.INSERT_TIME           "insertTime"
+        FROM AMSTRUCK_INWARD_REQUIREMENT AIR
+        LEFT JOIN AMS_PURCHASE_ORDER APO
+        ON APO.PURCHASE_ORDER_ID = AIR.PURCHASE_ORDER_ID
+        LEFT JOIN RMS_SUPPLIER RS
+        ON RS.SUPPLIER_ID = APO.SUPPLIER_UNIT_ID
+        LEFT JOIN RMS_CONSIGNEE RC
+        ON RC.CONSIGNEE_ID = APO.RECEIVE_UNIT_ID
+        LEFT JOIN RMS_WAREHOUSE RW
+        ON RW.WAREHOUSE_ID = AIR.REQUIREMENT_UNLOAD_UNIT_ID
+        LEFT JOIN AMSTRUCK_REQUIREMENT_MATERIAL ARM
+        ON ARM.REQUIREMENT_ID = AIR.REQUIREMENT_ID
+        LEFT JOIN RMS_MATERIAL RM
+        ON RM.MATERIAL_ID = ARM.MATERIAL_ID
+        LEFT JOIN AMSTRUCK_REQUIREMENT_PLAN ARP
+        ON ARP.REQUIREMENT_ID = AIR.REQUIREMENT_ID
+        LEFT JOIN AMSTRUCK_INWARD_PLAN AIP
+        ON AIP.PLAN_ID = ARP.PLAN_ID
+        LEFT JOIN RMS_CARRIER RCR
+        ON RCR.CARRIER_ID = AIP.CARRIER_ID
+        WHERE AIR.PURCHASE_ORDER_ID IS NOT NULL
+        AND AIR.REQUIREMENT_STATUS = #{requirementStatus}
+        AND AIR.DELETED = 0
+        <if test="userId != null">
+            and air.insert_username = #{userId}
+        </if>
+        <if test="carrierSsoId != null">
+            and AIP.CARRIER_ID = (select rc.carrier_id from rms_carrier rc
+            where rc.carrier_sso_id  = #{carrierSsoId})
+        </if>
+        <if test="enableStatus != null">
+            and AIP.PLAN_EABLE_STATUS = #{enableStatus}
+        </if>
+        <if test="planStatus != null">
+            and AIP.PLAN_STATUS = #{planStatus}
+        </if>
+        )
+        <where>
+
+            <if test="requirementNo != null">
+                and
+                <foreach collection="requirementNo" item="item" open="(" separator="or" close=")">
+                    "requirementNo" 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="supplierName != null">
+                and
+                <foreach collection="supplierName" item="item" open="(" separator="or" close=")">
+                    "supplierName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="consigneeName != null">
+                and
+                <foreach collection="consigneeName" item="item" open="(" separator="or" close=")">
+                    "consigneeName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="warehouseName != null">
+                and
+                <foreach collection="warehouseName" item="item" open="(" separator="or" close=")">
+                    "warehouseName" like '%${item}%'
+                </foreach>
+            </if>
+            <if test="materialName != null">
+                and
+                <foreach collection="materialName" item="item" open="(" separator="or" close=")">
+                    "materialName" 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="insertTime != null">
+                and
+                <foreach collection="insertTime" item="item" open="(" separator="or" close=")">
+                    "insertTime" like '%${item}%'
+                </foreach>
+            </if>
+        </where>
+        <include refid="orderBy"></include>
+    </select>
 </mapper>