Browse Source

Merge branch 'master' into dev

Your Name 3 years ago
parent
commit
c36355b3fc
19 changed files with 631 additions and 116 deletions
  1. 1 0
      pom.xml
  2. 9 0
      src/main/java/com/steerinfo/dil/controller/AmstruckInwardPlanController.java
  3. 73 0
      src/main/java/com/steerinfo/dil/controller/AmstruckInwardRequirementController.java
  4. 24 5
      src/main/java/com/steerinfo/dil/controller/AmstruckSporadicOrderController.java
  5. 3 0
      src/main/java/com/steerinfo/dil/mapper/AmstruckInwardRequirementMapper.java
  6. 2 0
      src/main/java/com/steerinfo/dil/mapper/AmstruckSporadicMaterialMapper.java
  7. 2 0
      src/main/java/com/steerinfo/dil/mapper/AmstruckSporadicOrderMapper.java
  8. 22 6
      src/main/java/com/steerinfo/dil/model/AmstruckInwardPlan.java
  9. 3 0
      src/main/java/com/steerinfo/dil/service/IAmstruckInwardPlanService.java
  10. 9 0
      src/main/java/com/steerinfo/dil/service/IAmstruckInwardRequirementService.java
  11. 10 0
      src/main/java/com/steerinfo/dil/service/impl/AmstruckInwardPlanServiceImpl.java
  12. 107 0
      src/main/java/com/steerinfo/dil/service/impl/AmstruckInwardRequirementServiceImpl.java
  13. 43 14
      src/main/java/com/steerinfo/dil/service/impl/AmstruckSporadicOrderServiceImpl.java
  14. 1 1
      src/main/resources/application-prod.yml
  15. 1 1
      src/main/resources/bootstrap.yml
  16. 103 86
      src/main/resources/com/steerinfo/dil/mapper/AmstruckInwardPlanMapper.xml
  17. 106 0
      src/main/resources/com/steerinfo/dil/mapper/AmstruckInwardRequirementMapper.xml
  18. 83 1
      src/main/resources/com/steerinfo/dil/mapper/AmstruckSporadicMaterialMapper.xml
  19. 29 2
      src/main/resources/com/steerinfo/dil/mapper/AmstruckSporadicOrderMapper.xml

+ 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"),

+ 24 - 5
src/main/java/com/steerinfo/dil/controller/AmstruckSporadicOrderController.java

@@ -85,7 +85,8 @@ public class AmstruckSporadicOrderController extends BaseRESTfulController {
                                                Integer dispatchStatus,
                                                Integer sporadicStatus,
                                                String carrierSsoId,
-                                               String userId) {
+                                               String userId,
+                                               String userIds) {
 
         if (con != null && !con.equals("undefined")) {
             String index="get_sporadic_order_list";//设置要查询的索引名称
@@ -116,6 +117,10 @@ public class AmstruckSporadicOrderController extends BaseRESTfulController {
             mapValue.put("userId",userId);
             count++;
         }
+        if (userIds!=null){
+            mapValue.put("userIds",userIds);
+            count++;
+        }
         List<Map<String, Object>> sporadicOrderList = null;
         if (mapValue.size() == count) {
             //将查询结果存入索引中
@@ -152,14 +157,28 @@ public class AmstruckSporadicOrderController extends BaseRESTfulController {
                                          Integer pageNum,
                                          Integer pageSize,
                                          Integer sporadicOrderId,
-                                         String con) {
+                                         String con,
+                                         String userId,
+                                         String userIds) {
+        int count=0;
         if (con != null && !con.equals("undefined")) {
             String index="see_all_materials";//设置要查询的索引名称
             return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
         }
-        mapValue.put("sporadicOrderId",sporadicOrderId);
+        if (userId!=null){
+            mapValue.put("userId",userId);
+            count++;
+        }
+        if (userIds!=null){
+            mapValue.put("userIds",userIds);
+            count++;
+        }
+        if (sporadicOrderId!=null) {
+            mapValue.put("sporadicOrderId", sporadicOrderId);
+            count++;
+        }
         List<Map<String, Object>> mapList = null;
-        if (mapValue.size() == 1) {
+        if (mapValue.size() == count) {
             //将查询结果存入索引中
             mapList =  amstruckSporadicOrderService.seeAllMaterials(mapValue);
             Map<String, Object> map1 = new HashMap<>();
@@ -177,7 +196,7 @@ public class AmstruckSporadicOrderController extends BaseRESTfulController {
             mapList = amstruckSporadicOrderService.seeAllMaterials(mapValue);
         }
         PageHelper.startPage(pageNum,pageSize);
-        List<Map<String, Object>> columnList = amstruckSporadicOrderService.getSporadicOrdersList(mapValue);
+        List<Map<String, Object>> columnList = amstruckSporadicOrderService.seeAllMaterials(mapValue);
         PageListAdd pageList = columnDataUtil.tableColumnData(apiId, mapList,columnList);
         return success(pageList);
     }

+ 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);
+
 }

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

@@ -20,4 +20,6 @@ public interface AmstruckSporadicMaterialMapper extends IBaseMapper<AmstruckSpor
      // 查询承运商不为空的零星物资
     List<Map<String,Object>> getSporadicOrdersList3(Map<String,Object> map);
 
+    List<Map<String,Object>> getSporadicOrdersList4(Map<String,Object> mapValue);
+
 }

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

@@ -29,4 +29,6 @@ public interface AmstruckSporadicOrderMapper extends IBaseMapper<AmstruckSporadi
 
     //一车多趟,根据运输订单id查找运输订单信息
     Map<String,Object> selectOrderInfo(Integer orderId);
+
+    List<Map<String,Object>> selectOrderIdbySporadicOrderid(Integer sporadicOrderId);
 }

+ 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;
+    }
+
 }

+ 43 - 14
src/main/java/com/steerinfo/dil/service/impl/AmstruckSporadicOrderServiceImpl.java

@@ -243,13 +243,12 @@ public class AmstruckSporadicOrderServiceImpl implements IAmstruckSporadicOrderS
     public int addSporadicOrder(Map<String, Object> map) {
         Integer orderType =(Integer) map.get("orderType");
         switch (orderType){
-   //      case 12:addSporadicOrders(map);
-  //               break;
-  //       case 13:addSporadicOrders(map);
-  //                break;
+            case 12:
+            case 13:
             case 15:
-            case 16: addSporadicOrdersForCoke(map);
-                    break;
+            case 16:
+                addSporadicOrdersForCoke(map);
+
         }
         return 1;
     }
@@ -258,10 +257,13 @@ public class AmstruckSporadicOrderServiceImpl implements IAmstruckSporadicOrderS
     public int addInwardSporadicOrder(Map<String, Object> map) {
         int result=0;
         BigDecimal sporadicOrderId = DataChange.dataToBigDecimal(map.get("sporadicOrderId"));
+        String userId=(String)map.get("userId");
         //添加承运商
         AmstruckSporadicOrder amstruckSporadicOrder=new AmstruckSporadicOrder();
         amstruckSporadicOrder.setSporadicOrderId(sporadicOrderId);
         amstruckSporadicOrder.setCarrierId(DataChange.dataToBigDecimal(map.get("carrierId")));
+        amstruckSporadicOrder.setUpdateUsername(userId);
+        amstruckSporadicOrder.setInsertTime(new Date());
         result += amstruckSporadicOrderMapper.updateByPrimaryKeySelective(amstruckSporadicOrder);
         return result ;
     }
@@ -315,26 +317,40 @@ public class AmstruckSporadicOrderServiceImpl implements IAmstruckSporadicOrderS
         List<Map<String, Object>> mapList=null;
         switch (orderType1) {
             case 12:
-                mapList = amstruckSporadicOrderMapper.getSporadicOrdersList(mapValue);
+                if (mapValue.get("sporadicStatus") != null) {
+                    //走查询订单id的接口
+                    mapList = amstruckSporadicOrderMapper.getSporadicOrdersList(mapValue);
+                }else {
+                    //不查询订单id的接口
+                    mapList=amstruckSporadicMaterialMapper.getSporadicOrdersList4(mapValue);
+                }
                 for (Map<String, Object> map : mapList) {
                     BigDecimal type = (BigDecimal) map.get("type");
+//                    BigDecimal orderStatus =(BigDecimal) map.get("orderStatus");
                     String orderType = "";
+//                    String status = "";
                     if (type.intValue() == 12) {
-                        orderType += "零星物资进厂";
+                        orderType += "内转零星进厂";
                     }
                     if (type.intValue() == 13) {
-                        orderType += "零星物资出厂";
+                        orderType += "内转零星出厂";
                     }
+//                    if (orderStatus.intValue()==4){
+//                        status += "已下发";
+//                    }
                     map.put("orderType", orderType);
                 }
+            case 13:
                 break;
             case 15:
                 if(mapValue.get("sporadicStatus") != null){
+                    //不查询订单id
                     mapList = amstruckSporadicMaterialMapper.getSporadicOrdersList2(mapValue);
                 }else{
+                    //查询订单id
                     mapList = amstruckSporadicOrderMapper.getSporadicOrdersList1(mapValue);
                 }
-                //没有承运商状态
+                //没有承运商状态为3
                 if (DataChange.dataToBigDecimal(mapValue.get("sporadicStatus")).intValue()==3) {
                     mapList =amstruckSporadicMaterialMapper.getSporadicOrdersList3(mapValue);
                 }
@@ -342,13 +358,14 @@ public class AmstruckSporadicOrderServiceImpl implements IAmstruckSporadicOrderS
                     BigDecimal type = (BigDecimal) map1.get("type");
                     String orderType = "";
                     if (type.intValue() == 15) {
-                        orderType += "内转零星进厂";
+                        orderType += "普通零星进厂";
                     }
                     if (type.intValue() == 16) {
-                        orderType += "内转零星出厂";
+                        orderType += "普通零星出厂";
                     }
                     map1.put("orderType", orderType);
                 }
+            case 16:
                 break;
         }
         return mapList;
@@ -407,6 +424,7 @@ public class AmstruckSporadicOrderServiceImpl implements IAmstruckSporadicOrderS
 
     //一车多趟
     @Override
+    @Transactional
     public int addSporadicOrderforTimes(Map<String, Object> map) {
         int result=0;
         List<Map<String,Object>> maps= (List<Map<String, Object>>) map.get("mapList");
@@ -467,11 +485,22 @@ public class AmstruckSporadicOrderServiceImpl implements IAmstruckSporadicOrderS
     //关闭零星订单,将订单吗状态设置为0  无法推送新的订单。
     @Override
     public int closeSporadicOrder(Map<String, Object> map) {
+        int result=0;
         BigDecimal sporadicOrderId =DataChange.dataToBigDecimal(map.get("sporadicOrderId"));
         AmstruckSporadicOrder amstruckSporadicOrder=new AmstruckSporadicOrder();
         amstruckSporadicOrder.setSporadicOrderId(sporadicOrderId);
         amstruckSporadicOrder.setSporadicOrderTimes(new BigDecimal(0));
-        amstruckSporadicOrderMapper.updateByPrimaryKeySelective(amstruckSporadicOrder);
-        return 1;
+        result+=amstruckSporadicOrderMapper.updateByPrimaryKeySelective(amstruckSporadicOrder);
+        //查找零星订单下的所有未接收的运输订单
+        List<Map<String, Object>> stringObjectMap = amstruckSporadicOrderMapper.selectOrderIdbySporadicOrderid(sporadicOrderId.intValue());
+        for (Map<String,Object> map1:stringObjectMap) {
+            //获取零星订单关联的未接收的订单
+            BigDecimal orderId =(BigDecimal) map1.get("orderId");
+            OmstruckOrder omstruckOrder=new OmstruckOrder();
+            omstruckOrder.setOrderId(orderId);
+            omstruckOrder.setOrderStatus(new BigDecimal(8));
+           result+=omstruckOrderMapper.updateByPrimaryKeySelective(omstruckOrder);
+        }
+        return result;
     }
 }

+ 1 - 1
src/main/resources/application-prod.yml

@@ -8,7 +8,7 @@ spring:
   application:
     name: dil-ams-api-dev
 
- openfeign:
+openfeign:
 #   正式环境
    ESFeign:
      url: ${ESFEIGN_URL:172.16.33.166:8089}

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

@@ -1,7 +1,7 @@
 api.version: api/v1/ams
 spring:
   profiles:
-    include: ${SPRING_PROFILES:dev}
+    include: ${SPRING_PROFILES:prod}
   jackson:
     date-format: yyyy-MM-dd HH:mm:ss
     time-zone: GMT+8

+ 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>

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

@@ -382,7 +382,8 @@
     ASO.INSERT_TIME AS "insertTime",
     OO.ORDER_TYPE AS "type",
     RM.MATERIAL_NAME AS "materialName",
-    ASO.SPORADIC_ORDER_TIMES "sporadicOrderTimes"
+    ASO.SPORADIC_ORDER_TIMES "sporadicOrderTimes",
+    ASO.SPORADIC_TRANS_TIMES "transTimes"
     FROM AMSTRUCK_SPORADIC_ORDER ASO
     LEFT JOIN RMS_CONSIGNEE RCO
     ON ASO.RECEIVE_UNIT_ID = RCO.CONSIGNEE_ID
@@ -408,6 +409,9 @@
     <if test="userId!=null">
       and aso.INSERT_USERNAME=#{userId}
     </if>
+    <if test="userIds!=null">
+      and aso.UPDATE_USERNAME=#{userIds}
+    </if>
     )
     <where>
       <if test="sporadicOrderNo != null">
@@ -444,6 +448,81 @@
     <include refid="orderBy"></include>
   </select>
 
+<select id="getSporadicOrdersList4" resultType="java.util.Map">
+  SELECT *
+  FROM (
+  SELECT distinct
+  ASO.SPORADIC_ORDER_ID AS "sporadicOrderId",
+  ASO.SPORADIC_ORDER_NO AS "sporadicOrderNo",
+  RSU.SUPPLIER_NAME AS "supplierName",
+  RCO.CONSIGNEE_COMPANY_NAME AS "consigneeCompanyName",
+  RCA.CARRIER_NAME AS "carrierName",
+  ASO.INSERT_TIME AS "insertTime",
+  OO.ORDER_TYPE AS "type",
+  RM.MATERIAL_NAME "materialName",
+  ASO.SPORADIC_TRANS_TIMES "transTimes",
+  ASO.SPORADIC_ORDER_TIMES "sporadicOrderTimes"
+  FROM AMSTRUCK_SPORADIC_ORDER ASO
+  LEFT JOIN RMS_CONSIGNEE RCO
+  ON ASO.RECEIVE_UNIT_ID = RCO.CONSIGNEE_ID
+  LEFT JOIN RMS_SUPPLIER RSU
+  ON ASO.SEND_UNIT_ID = RSU.SUPPLIER_ID
+  LEFT JOIN RMS_CARRIER RCA
+  ON RCA.CARRIER_ID = ASO.CARRIER_ID
+  LEFT JOIN OMSTRUCK_ORDER OO
+  ON OO.ORDER_PLAN_ID = ASO.SPORADIC_ORDER_ID
+  LEFT JOIN OMSTRUCK_ORDER_MATERIAL OOM
+  ON
+  OOM.ORDER_ID = OO.ORDER_ID
+  LEFT JOIN RMS_MATERIAL RM
+  ON RM.MATERIAL_ID = OOM.MATERIAL_ID
+  WHERE OO.ORDER_TYPE in (12,13)
+  AND ASO.ISSUE_STATUS = #{issueStatus}
+  AND ASO.DELETED = 0
+  <if test="userId!=null">
+    and ASO.INSERT_USERNAME=#{userId}
+  </if>
+  <if test="usersId!=null">
+    and ASO.UPDATE_USERNAME=#{usersId}
+  </if>
+  <if test="dispatchStatus != null">
+    AND ASO.DISPATCH_STATUS =  #{dispatchStatus}
+  </if>
+  )
+  <where>
+    <if test="sporadicOrderNo != null">
+      and
+      <foreach collection="sporadicOrderNo" item="item" open="(" separator="or" close=")">
+        "sporadicOrderNo" 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="consigneeCompanyName != null">
+      and
+      <foreach collection="consigneeCompanyName" item="item" open="(" separator="or" close=")">
+        "consigneeCompanyName" 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 to_date('${item}','yyyy-mm-dd hh24:mi:ss')
+      </foreach>
+    </if>
+  </where>
+  <include refid="orderBy"></include>
+</select>
 
   <select id="getSporadicOrdersList3" resultType="java.util.Map">
     select *
@@ -484,6 +563,9 @@
     <if test="userId!=null">
       and aso.INSERT_USERNAME=#{userId}
     </if>
+    <if test="userIds!=null">
+      and aso.UPDATE_USERNAME=#{userIds}
+    </if>
     )
     <where>
       <if test="sporadicOrderNo != null">

+ 29 - 2
src/main/resources/com/steerinfo/dil/mapper/AmstruckSporadicOrderMapper.xml

@@ -495,8 +495,10 @@
         ASO.INSERT_TIME AS "insertTime",
         OO.ORDER_TYPE AS "type",
         OO.ORDER_ID "orderId",
+        OO.ORDER_STATUS "orderStatus",
         RM.MATERIAL_NAME "materialName",
-        ASO.SPORADIC_TRANS_TIMES "transTimes"
+        ASO.SPORADIC_TRANS_TIMES "transTimes",
+        ASO.SPORADIC_ORDER_TIMES "sporadicOrderTimes"
         FROM AMSTRUCK_SPORADIC_ORDER ASO
         LEFT JOIN RMS_CONSIGNEE RCO
         ON ASO.RECEIVE_UNIT_ID = RCO.CONSIGNEE_ID
@@ -514,6 +516,15 @@
         WHERE OO.ORDER_TYPE in (12,13)
         AND ASO.ISSUE_STATUS = #{issueStatus}
         AND ASO.DELETED = 0
+            <if test="userId!=null">
+             and ASO.INSERT_USERNAME=#{userId}
+            </if>
+            <if test="usersId!=null">
+             and ASO.UPDATE_USERNAME=#{usersId}
+            </if>
+             <if test="dispatchStatus != null">
+             AND ASO.DISPATCH_STATUS =  #{dispatchStatus}
+             </if>
         )
         <where>
             <if test="sporadicOrderNo != null">
@@ -566,7 +577,7 @@
         OO.ORDER_ID "orderId",
         RM.MATERIAL_NAME AS "materialName",
         ASO.SPORADIC_ORDER_TIMES "sporadicOrderTimes",
-        ASO.SPORADIC_TRANS_TIMES "tranTimes"
+        ASO.SPORADIC_TRANS_TIMES "transTimes"
         FROM AMSTRUCK_SPORADIC_ORDER ASO
         LEFT JOIN RMS_CONSIGNEE RCO
         ON ASO.RECEIVE_UNIT_ID = RCO.CONSIGNEE_ID
@@ -598,6 +609,9 @@
         <if test="userId != null">
             and ASO.INSERT_USERNAME=#{userId}
         </if>
+        <if test="userIds!=null">
+            and aso.UPDATE_USERNAME=#{userIds}
+        </if>
         )
         <where>
             <if test="sporadicOrderNo != null">
@@ -650,6 +664,12 @@
         LEFT JOIN RMS_MATERIAL RM
         ON RM.MATERIAL_ID = OOM.MATERIAL_ID
         WHERE ASO.SPORADIC_ORDER_ID = #{sporadicOrderId}
+            <if test="userId!=null">
+             and ASO.INSERT_USERNAME=#{userId}
+            </if>
+            <if test="usersId!=null">
+             and ASO.UPDATE_USERNAME=#{usersId}
+            </if>
         )
         <where>
             <if test="materialName != null">
@@ -698,6 +718,13 @@
         where OO.ORDER_ID=#{orderId}
     </select>
 
+<!-- 根据零星订单id查找未接收的订单-->
+    <select id="selectOrderIdbySporadicOrderid" parameterType="java.lang.Integer" resultType="java.util.Map">
+        select OO.ORDER_ID "orderId"
+        from OMSTRUCK_ORDER OO
+        where OO.ORDER_STATUS=4 AND OO.ORDER_PLAN_ID=#{sporadicOrderId}
+    </select>
+
 
 
 </mapper>