Redeem hai 1 ano
pai
achega
f571477ee1

+ 33 - 3
src/main/java/com/steerinfo/dil/controller/OyeResultController.java

@@ -1,6 +1,9 @@
 package com.steerinfo.dil.controller;
 
 
+import com.steerinfo.dil.feign.BmsTruckFeign;
+import com.steerinfo.dil.feign.OtmsFeign;
+import com.steerinfo.dil.mapper.OyeRealtimeInventoryMapper;
 import com.steerinfo.dil.service.impl.OyeResultServiceImpl;
 import com.steerinfo.dil.util.BaseRESTfulController;
 import com.steerinfo.dil.util.ColumnDataUtil;
@@ -10,6 +13,7 @@ import com.steerinfo.framework.controller.RESTfulResult;
 import com.steerinfo.framework.service.pagehelper.PageHelper;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -33,6 +37,15 @@ public class OyeResultController extends BaseRESTfulController {
     @Resource
     ColumnDataUtil columnDataUtil;
 
+    @Resource
+    OyeRealtimeInventoryMapper oyeRealtimeInventoryMapper;
+
+    @Autowired
+    BmsTruckFeign bmsTruckFeign;
+
+    @Autowired
+    OtmsFeign otmsFeign;
+
     @ApiOperation("查询入库实绩")
     @PostMapping("/getOyeInboundResult")
     public RESTfulResult getOyeInboundResult(@RequestBody(required = false) Map<String,Object> mapValue,
@@ -52,7 +65,7 @@ public class OyeResultController extends BaseRESTfulController {
         PageHelper.startPage(pageNum, pageSize);
         //分页查询数据
         List<Map<String, Object>> columnList = oyeResultService.getOyeInboundResult(mapValue);
-        PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList);
+        PageListAdd data = columnDataUtil.tableColumnData5(apiId, null, columnList);
         return success(data);
 
     }
@@ -76,7 +89,7 @@ public class OyeResultController extends BaseRESTfulController {
         PageHelper.startPage(pageNum, pageSize);
         //分页查询数据
         List<Map<String, Object>> columnList = oyeResultService.getOyeOutboundResult(mapValue);
-        PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList);
+        PageListAdd data = columnDataUtil.tableColumnData5(apiId, null, columnList);
         return success(data);
     }
 
@@ -100,7 +113,7 @@ public class OyeResultController extends BaseRESTfulController {
         PageHelper.startPage(pageNum, pageSize);
         //分页查询数据
         List<Map<String, Object>> columnList = oyeResultService.getOyeRealTimeResult(mapValue);
-        PageListAdd data = columnDataUtil.tableColumnData(apiId, null, columnList);
+        PageListAdd data = columnDataUtil.tableColumnData5(apiId, null, columnList);
         return success(data);
     }
 
@@ -122,8 +135,25 @@ public class OyeResultController extends BaseRESTfulController {
     @PostMapping("/insertOyeOutboundResult")
     public RESTfulResult insertOutboundResult(@RequestBody Map<String,Object> map) {
         String result = null;
+        if (map.get("orderId") == null) {
+            return failed("未派车,不允许出库");
+        }
         try {
             result = oyeResultService.insertOutboundResult(map);
+            try {
+                if(map.get("orderId") != null) {
+                    bmsTruckFeign.addDetailsOrder(DataChange.dataToBigDecimal(map.get("orderId")));
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            //根据运单ID获取时间
+            try {
+                Map<String,Object> params = oyeRealtimeInventoryMapper.seleOtmsParams(DataChange.dataToBigDecimal(map.get("orderId")));
+                otmsFeign.createTotalResult(params);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
         } catch (Exception e) {
             e.printStackTrace();
             return failed(e.getMessage());

+ 5 - 0
src/main/java/com/steerinfo/dil/feign/BmsTruckFeign.java

@@ -2,9 +2,11 @@ package com.steerinfo.dil.feign;
 
 import com.steerinfo.framework.controller.RESTfulResult;
 import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 
+import java.math.BigDecimal;
 import java.util.Map;
 
 /**
@@ -20,4 +22,7 @@ public interface BmsTruckFeign {
 
     @PostMapping("api/v1/bmstruck/bmstruckdetailsorder/addInwardDetailsOrder")
     RESTfulResult addInwardDetailsOrder(@RequestBody(required = false) Map<String,Object> map);
+
+    @PostMapping("api/v1/bmstruck/bmstruckdetailsorder/addDetailsOrder/{orderId}")
+    RESTfulResult addDetailsOrder(@PathVariable("orderId") BigDecimal orderId);
 }

+ 15 - 0
src/main/java/com/steerinfo/dil/feign/OtmsFeign.java

@@ -0,0 +1,15 @@
+package com.steerinfo.dil.feign;
+
+import com.steerinfo.framework.controller.RESTfulResult;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+import java.util.Map;
+
+@FeignClient(value = "DAL-OTMS-API-DEV", url = "${openfeign.OTMSFeign.url}")
+public interface OtmsFeign {
+
+    @PostMapping("/api/v1/otms/pathDisplay/createTotalResult")
+    RESTfulResult createTotalResult(@RequestBody(required=true) Map<String, Object> mapValue) throws Exception;
+}

+ 5 - 0
src/main/java/com/steerinfo/dil/mapper/OyeOutboundResultMapper.java

@@ -3,6 +3,7 @@ package com.steerinfo.dil.mapper;
 import com.steerinfo.dil.model.OyeOutboundResult;
 import com.steerinfo.framework.mapper.IBaseMapper;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
 import java.math.BigDecimal;
@@ -21,4 +22,8 @@ public interface OyeOutboundResultMapper extends IBaseMapper<OyeOutboundResult,
 
     BigDecimal selectSaleMaterialID(BigDecimal saleMaterialId);
 
+    int updateSaleMakeDate(Map<String,Object> map);
+
+    int updateOrderStatus(BigDecimal orderId);
+
 }

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

@@ -22,4 +22,6 @@ public interface OyeRealtimeInventoryMapper extends IBaseMapper<OyeRealtimeInven
 
     BigDecimal getInventoryId(Map<String, Object> map);
 
+    Map<String, Object> seleOtmsParams(BigDecimal orderId);
+
 }

+ 26 - 0
src/main/java/com/steerinfo/dil/mapper/TmstruckWeightBatchMapper.java

@@ -0,0 +1,26 @@
+package com.steerinfo.dil.mapper;
+
+import com.steerinfo.dil.model.TmstruckWeightBatch;
+import com.steerinfo.framework.mapper.IBaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Select;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+//import com.steerinfo.dil.tmstruckweightbatch.model;
+
+@Mapper
+public interface TmstruckWeightBatchMapper extends IBaseMapper<TmstruckWeightBatch, BigDecimal> {
+
+
+    @Select("select seq_tms_weight_batch.nextval from dual")
+    BigDecimal weightBatchID();
+
+    int updateFluMes(Map<String, Object> weightMap);
+
+    int updateOmMes(Map<String, Object> weightMap);
+
+    int updateAmsFluToNull(BigDecimal weightBatchId);
+
+}

+ 139 - 0
src/main/java/com/steerinfo/dil/model/TmstruckWeightBatch.java

@@ -0,0 +1,139 @@
+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 TmstruckWeightBatch implements IBasePO<BigDecimal> {
+    /**
+     * 计量批次ID(WEIGHT_BATCH_ID,DECIMAL,38)
+     */
+    @ApiModelProperty(value="计量批次ID",required=true)
+    private BigDecimal weightBatchId;
+
+    /**
+     * 净重(BATCH_NET_WEIGHT,DECIMAL,38)
+     */
+    @ApiModelProperty(value="净重",required=false)
+    private BigDecimal batchNetWeight;
+
+    /**
+     * 毛重(BATCH_GROSS_WEIGHT,DECIMAL,38)
+     */
+    @ApiModelProperty(value="毛重",required=false)
+    private BigDecimal batchGrossWeight;
+
+    /**
+     * 皮重(BATCH_TARE_WEIGHT,DECIMAL,38)
+     */
+    @ApiModelProperty(value="皮重",required=false)
+    private BigDecimal batchTareWeight;
+
+    /**
+     * 皮重时间(BATCH_TARE_WEIGHT_TIME,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="皮重时间",required=false)
+    private Date batchTareWeightTime;
+
+    /**
+     * 备注(BATCH_REMARK,VARCHAR,200)
+     */
+    @ApiModelProperty(value="备注",required=false)
+    private String batchRemark;
+
+    /**
+     * 毛重时间(BATCH_GROSS_WEIGHT_TIME,TIMESTAMP,7)
+     */
+    @ApiModelProperty(value="毛重时间",required=false)
+    private Date batchGrossWeightTime;
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public BigDecimal getId() {
+        return this.weightBatchId;
+    }
+
+    @Override
+    public void setId(BigDecimal weightBatchId) {
+        this.weightBatchId = weightBatchId;
+    }
+
+    public BigDecimal getWeightBatchId() {
+        return weightBatchId;
+    }
+
+    public void setWeightBatchId(BigDecimal weightBatchId) {
+        this.weightBatchId = weightBatchId;
+    }
+
+    public BigDecimal getBatchNetWeight() {
+        return batchNetWeight;
+    }
+
+    public void setBatchNetWeight(BigDecimal batchNetWeight) {
+        this.batchNetWeight = batchNetWeight;
+    }
+
+    public BigDecimal getBatchGrossWeight() {
+        return batchGrossWeight;
+    }
+
+    public void setBatchGrossWeight(BigDecimal batchGrossWeight) {
+        this.batchGrossWeight = batchGrossWeight;
+    }
+
+    public BigDecimal getBatchTareWeight() {
+        return batchTareWeight;
+    }
+
+    public void setBatchTareWeight(BigDecimal batchTareWeight) {
+        this.batchTareWeight = batchTareWeight;
+    }
+
+    public Date getBatchTareWeightTime() {
+        return batchTareWeightTime;
+    }
+
+    public void setBatchTareWeightTime(Date batchTareWeightTime) {
+        this.batchTareWeightTime = batchTareWeightTime;
+    }
+
+    public String getBatchRemark() {
+        return batchRemark;
+    }
+
+    public void setBatchRemark(String batchRemark) {
+        this.batchRemark = batchRemark == null ? null : batchRemark.trim();
+    }
+
+    public Date getBatchGrossWeightTime() {
+        return batchGrossWeightTime;
+    }
+
+    public void setBatchGrossWeightTime(Date batchGrossWeightTime) {
+        this.batchGrossWeightTime = batchGrossWeightTime;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder();
+        sb.append(getClass().getSimpleName());
+        sb.append(" [");
+        sb.append("Hash = ").append(hashCode());
+        sb.append(", weightBatchId=").append(weightBatchId);
+        sb.append(", batchNetWeight=").append(batchNetWeight);
+        sb.append(", batchGrossWeight=").append(batchGrossWeight);
+        sb.append(", batchTareWeight=").append(batchTareWeight);
+        sb.append(", batchTareWeightTime=").append(batchTareWeightTime);
+        sb.append(", batchRemark=").append(batchRemark);
+        sb.append(", batchGrossWeightTime=").append(batchGrossWeightTime);
+        sb.append(", serialVersionUID=").append(serialVersionUID);
+        sb.append("]");
+        return sb.toString();
+    }
+}

+ 54 - 15
src/main/java/com/steerinfo/dil/service/impl/OyeResultServiceImpl.java

@@ -2,12 +2,15 @@ package com.steerinfo.dil.service.impl;
 
 
 import com.alibaba.fastjson.JSONObject;
+import com.steerinfo.dil.feign.BmsTruckFeign;
 import com.steerinfo.dil.mapper.OyeInboundResultMapper;
 import com.steerinfo.dil.mapper.OyeOutboundResultMapper;
 import com.steerinfo.dil.mapper.OyeRealtimeInventoryMapper;
+import com.steerinfo.dil.mapper.TmstruckWeightBatchMapper;
 import com.steerinfo.dil.model.OyeInboundResult;
 import com.steerinfo.dil.model.OyeOutboundResult;
 import com.steerinfo.dil.model.OyeRealtimeInventory;
+import com.steerinfo.dil.model.TmstruckWeightBatch;
 import com.steerinfo.dil.service.IOyeResultService;
 import com.steerinfo.dil.util.DataChange;
 import com.sun.org.apache.bcel.internal.generic.RETURN;
@@ -17,10 +20,7 @@ import org.springframework.transaction.annotation.Transactional;
 import javax.annotation.Resource;
 import javax.xml.crypto.Data;
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Service
 public class OyeResultServiceImpl implements IOyeResultService {
@@ -34,6 +34,12 @@ public class OyeResultServiceImpl implements IOyeResultService {
     @Resource
     OyeRealtimeInventoryMapper oyeRealtimeInventoryMapper;
 
+    @Resource
+    TmstruckWeightBatchMapper tmstruckWeightBatchMapper;
+
+    @Resource
+    BmsTruckFeign bmsTruckFeign;
+
 
 
 
@@ -60,6 +66,9 @@ public class OyeResultServiceImpl implements IOyeResultService {
     public synchronized String insertInboundResult(Map<String, Object> mapValue) throws Exception {
         List<Map<String,Object>> mapList = (List<Map<String,Object>>) mapValue.get("mapList");
         List<OyeInboundResult> OyeInboundResults = new ArrayList<>();
+        List<OyeRealtimeInventory> oyeRealtimeInventoriesInsert = new ArrayList<>();
+        List<OyeRealtimeInventory> oyeRealtimeInventoriesUpdate = new ArrayList<>();
+
         System.out.println("===========" + new Date());
         JSONObject jsonObject = new JSONObject(mapValue);
         System.out.println(jsonObject);
@@ -99,24 +108,30 @@ public class OyeResultServiceImpl implements IOyeResultService {
             if (inventoryId == null) {
                 //新增实时库存
                 map.put("flag",1);
-                inventoryId = insertRealTimeInventory(map);
-                oyeInboundResult.setInventoryId(inventoryId);
+                OyeRealtimeInventory oyeRealtimeInventory = insertRealTimeInventory(map);
+                oyeRealtimeInventoriesInsert.add(oyeRealtimeInventory);
+                oyeInboundResult.setInventoryId(oyeRealtimeInventory.getInventoryId());
             }else{
                 map.put("inventoryId",inventoryId);
                 map.put("flag",1);
-                String result = updateRealTimeInventory(map);
+                OyeRealtimeInventory oyeRealtimeInventory = updateRealTimeInventory(map);
+                oyeRealtimeInventoriesUpdate.add(oyeRealtimeInventory);
             }
             // 修改运单状态
             oyeInboundResultMapper.updateOrderStatus(DataChange.dataToBigDecimal(map.get("orderId")));
             OyeInboundResults.add(oyeInboundResult);
         }
         oyeInboundResultMapper.batchInsert(OyeInboundResults);
+        oyeRealtimeInventoryMapper.batchInsert(oyeRealtimeInventoriesInsert);
+        oyeRealtimeInventoryMapper.batchUpdate(oyeRealtimeInventoriesUpdate);
         return "入库成功";
     }
 
     @Transactional(rollbackFor = Exception.class)
     public synchronized String insertOutboundResult(Map<String,Object> mapValue) throws Exception {
         List<OyeOutboundResult> oyeOutboundResults = new ArrayList<>();
+        List<TmstruckWeightBatch> tmstruckWeightBatches = new ArrayList<>();
+        List<OyeRealtimeInventory> oyeRealtimeInventories = new ArrayList<>();
         List<Map<String,Object>> mapList = (List<Map<String,Object>>) mapValue.get("mapList");
         System.out.println("===========" + new Date());
         JSONObject jsonObject = new JSONObject(mapValue);
@@ -127,6 +142,9 @@ public class OyeResultServiceImpl implements IOyeResultService {
             BigDecimal materialId = DataChange.dataToBigDecimal(map.get("materialId"));
             BigDecimal theoryWeight = DataChange.dataToBigDecimal(map.get("theoryWeight"));
             BigDecimal materialNumber = DataChange.dataToBigDecimal(map.get("materialNumber"));
+            if(materialNumber == null || materialNumber.intValue() == 0) {
+                throw new Exception("物资件数错误");
+            }
             BigDecimal singleWeight = theoryWeight.divide(materialNumber);
             BigDecimal meter = DataChange.dataToBigDecimal(map.get("meter"));
             oyeOutboundResult.setResultId(oyeOutboundResultMapper.getResultId());
@@ -139,10 +157,11 @@ public class OyeResultServiceImpl implements IOyeResultService {
             oyeOutboundResult.setInboundArea(map.get("inboundArea").toString());
             oyeOutboundResult.setInboundWarehouse(map.get("inboundWarehouse").toString());
             oyeOutboundResult.setSaleMaterialId(DataChange.dataToBigDecimal(map.get("saleMaterialId")));
-            //判断该拼是否
+            //判断该拼是否
             if (oyeOutboundResultMapper.selectSaleMaterialID(DataChange.dataToBigDecimal(map.get("saleMaterialId"))) != null) {
                 throw new Exception("该分录已出库,无法继续出库");
             }
+            //更新制单日期
             oyeOutboundResult.setMeter(meter);
             oyeOutboundResult.setMaterialId(materialId);
             oyeOutboundResult.setTheoryWeight(theoryWeight);
@@ -157,10 +176,22 @@ public class OyeResultServiceImpl implements IOyeResultService {
             oyeOutboundResult.setInventoryId(inventoryId);
             map.put("inventoryId",inventoryId);
             map.put("flag",2);
-            String result = updateRealTimeInventory(map);
+            OyeRealtimeInventory oyeRealtimeInventory = updateRealTimeInventory(map);
+            oyeRealtimeInventories.add(oyeRealtimeInventory);
+            TmstruckWeightBatch  tmstruckWeightBatch  = generateWeightBatch(map);
+            tmstruckWeightBatches.add(tmstruckWeightBatch);
+            Map<String, Object> updateMap = new HashMap<>();
+            updateMap.put("weightBatchId",tmstruckWeightBatch.getWeightBatchId());
+            updateMap.put("materialNumber",materialNumber);
+            updateMap.put("saleMaterialId",DataChange.dataToBigDecimal(map.get("saleMaterialId")));
+            updateMap.put("materialWeight",theoryWeight);
+            oyeOutboundResultMapper.updateSaleMakeDate(updateMap);
+            oyeOutboundResultMapper.updateOrderStatus(DataChange.dataToBigDecimal(map.get("orderId")));
             oyeOutboundResults.add(oyeOutboundResult);
         }
         oyeOutboundResultMapper.batchInsert(oyeOutboundResults);
+        oyeRealtimeInventoryMapper.batchUpdate(oyeRealtimeInventories);
+        tmstruckWeightBatchMapper.batchInsert(tmstruckWeightBatches);
         return "出库成功";
     }
 
@@ -168,7 +199,7 @@ public class OyeResultServiceImpl implements IOyeResultService {
      * 新增实时库存
      */
     @Transactional(rollbackFor = Exception.class)
-    public synchronized BigDecimal insertRealTimeInventory(Map<String,Object> map) {
+    public synchronized OyeRealtimeInventory insertRealTimeInventory(Map<String,Object> map) {
         BigDecimal inventoryId = oyeRealtimeInventoryMapper.getResultId();
         OyeRealtimeInventory oyeRealtimeInventory = new OyeRealtimeInventory();
         oyeRealtimeInventory.setInventoryId(inventoryId);
@@ -183,15 +214,14 @@ public class OyeResultServiceImpl implements IOyeResultService {
         oyeRealtimeInventory.setMaterialNumber(DataChange.dataToBigDecimal(map.get("materialNumber")));
         oyeRealtimeInventory.setNetWeight(DataChange.dataToBigDecimal(map.get("netWeight")));
         oyeRealtimeInventory.setInsertTime(new Date());
-        oyeRealtimeInventoryMapper.insertSelective(oyeRealtimeInventory);
-        return inventoryId;
+        return oyeRealtimeInventory;
     }
 
     /**
      * 更新实时库存
      */
     @Transactional(rollbackFor = Exception.class)
-    public synchronized String updateRealTimeInventory(Map<String,Object> map) throws Exception {
+    public synchronized OyeRealtimeInventory updateRealTimeInventory(Map<String,Object> map) throws Exception {
         //更新实时库存
         BigDecimal inventoryId = DataChange.dataToBigDecimal(map.get("inventoryId"));
         // flag为1,则为入库,为2则为出库
@@ -218,7 +248,16 @@ public class OyeResultServiceImpl implements IOyeResultService {
             }
             oyeRealtimeInventory.setNetWeight(realTimeNetWeight.subtract(netWeight));
         }
-        oyeRealtimeInventoryMapper.updateByPrimaryKeySelective(oyeRealtimeInventory);
-        return "实时库存更新成功!";
+        return oyeRealtimeInventory;
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    public TmstruckWeightBatch generateWeightBatch(Map<String,Object> map) {
+        TmstruckWeightBatch tmstruckWeightBatch = new TmstruckWeightBatch();
+        BigDecimal weightBatchId = tmstruckWeightBatchMapper.weightBatchID();
+        tmstruckWeightBatch.setId(weightBatchId);
+        tmstruckWeightBatch.setBatchNetWeight(DataChange.dataToBigDecimal(map.get("netWeight")));
+        tmstruckWeightBatch.setBatchRemark("出库生成批次");
+        return tmstruckWeightBatch;
     }
 }

+ 7 - 0
src/main/java/com/steerinfo/dil/util/ColumnDataUtil.java

@@ -35,4 +35,11 @@ public class ColumnDataUtil {
         pageList.setColumnData(columnDataList);
         return pageList;
     }
+
+    public PageListAdd tableColumnData5(Integer apiId, List<Map<String, Object>> list, List<Map<String,Object>> data) {
+        List<Map<String, Object>> columnDataList = columnDataFeign.getColumnData(apiId);
+        PageListAdd pageList = new PageListAdd(data);
+        pageList.setColumnData(columnDataList);
+        return pageList;
+    }
 }

+ 2 - 0
src/main/resources/application-prod.yml

@@ -21,6 +21,8 @@ openfeign:
     url: ${JOINFEIGN_URL:172.16.33.166:8066}
   BmsTruckFeign:
     url: ${BMSTRUCKFEIGN_URL:172.16.33.166:8076}
+  OTMSFeign:
+    url: ${OTMSFEIGN_URL:172.16.33.166:8038}
 #图片上传配置
 piction:
   # path: /usr/share/nginx/html/image

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

@@ -796,7 +796,7 @@
       #{item.resultId,jdbcType=DECIMAL}
     </foreach>
   </update>
-  <delete id="batchDelete" parameterType="java.util.List">
+    <delete id="batchDelete" parameterType="java.util.List">
     delete from OYE_OUTBOUND_RESULT
     where RESULT_ID in
     <foreach collection="list" item="id" open="(" close=")" separator=",">
@@ -866,5 +866,18 @@
     SELECT OOR.SALE_MATERIAL_ID FROM OYE_OUTBOUND_RESULT OOR
     WHERE OOR.SALE_MATERIAL_ID = #{saleMaterialId}
   </select>
+  <update id="updateSaleMakeDate" parameterType="java.util.Map">
+    UPDATE AMS_SALE_MATERIAL ASM
+    SET ASM.SALE_MAKE_DATE = SYSDATE,
+        ASM.WEIGHT_BATCH_ID = #{weightBatchId},
+        ASM.MATERIAL_NUMBER = #{materialNumber},
+        ASM.MATERIAL_WEIGHT = #{materialWeight}
+    WHERE ASM.SALE_MATERIAL_ID = #{saleMaterialId}
+  </update>
+  <update id="updateOrderStatus">
+    UPDATE TMSTRUCK_TOTAL_RESULT
+    SET ORDER_STATUS = '已出库'
+    WHERE ORDER_ID = #{orderId}
+  </update>
 
 </mapper>

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

@@ -694,10 +694,13 @@
     LEFT JOIN RMS_MATERIAL RM on ORI.MATERIAL_ID = RM.MATERIAL_ID
     LEFT JOIN RMS_CONSIGNEE RC on ORI.CONSIGNEE_ID = RC.CONSIGNEE_ID
     <where>
-      <if test="startDate != null and isEnFactoryFlag == 5">
+      <if test="startDate != null">
         and to_date(#{startDate}, 'yyyy-mm-dd hh24:mi:ss') &lt;= ORI.INSERT_TIME
         and to_date(#{endDate}, 'yyyy-mm-dd hh24:mi:ss') >= ORI.INSERT_TIME
       </if>
+      <if test="filterFlag != null">
+        and ORI.MATERIAL_NUMBER > 0
+      </if>
       <if test="consigneeName != null and consigneeName != ''">
         AND RC.CONSIGNEE_COMPANY_NAME LIKE '%${consigneeName}%'
       </if>
@@ -738,5 +741,57 @@
     AND ORI.meter = #{meter,jdbcType=DECIMAL}
     AND ORI.INBOUND_AREA = #{inboundArea,jdbcType=VARCHAR}
   </select>
+    <select id="seleOtmsParams" resultType="java.util.Map">
+      SELECT *
+      from (
+             SELECT
+               -- 出厂时间
+               to_char(OOR.INSERT_TIME, 'yyyy-mm-dd hh24:mi:ss')                  "resultOutGateTime",
+               --出厂抓拍图片
+               '无'                                           "resultTruckSnapshotPicture",
+               --出厂方式
+               '厂外库房出库'                                                         "resultOutMode",
+               --门岗名称
+               '厂外库房'                                                             "gatepostName",
+               -- 运输订单号
+               OO.ORDER_NUMBER                                                              "orderNumber",
+               -- 车牌号
+               RC.CAPACITY_NUMBER                                                           "capacityNumber",
+               -- 运输订单id
+               OO.ORDER_ID                                                                  "orderId",
+               -- 订单类型
+               OO.ORDER_TYPE                                                                "orderType",
+               -- 销售订单号
+               ASO.SALE_NUMBER                                                              "saleNum",
+               -- 收货地址
+               CONCAT(CONCAT(RRA.ADDRESS_PROVINCE, RRA.ADDRESS_DISTRICT), RRA.Address_Town) "receiveAddress",
+               -- 收货单位
+               RS.SUPPLIER_NAME                                                             "supplierName",
+               -- 发货单位
+               RS2.SHIPPER_NAME                                                             "shipperName"
+             FROM
+               -- 出厂实绩
+                 OYE_OUTBOUND_RESULT OOR
+                 -- 运输订单
+                 LEFT JOIN OMSTRUCK_ORDER OO ON OOR.ORDER_ID = OO.ORDER_ID
+                 -- 销售订单信息
+                 LEFT JOIN AMS_SALE_ORDER ASO ON OO.ORDER_PLAN_ID = ASO.SALE_ORDER_ID
+                 -- 托运人
+                 LEFT JOIN RMS_SUPPLIER RS ON ASO.SHIPPER_ID = RS.SUPPLIER_ID
+                 -- 运力信息
+                 LEFT JOIN RMS_CAPACITY RC ON OO.CAPACITY_ID = RC.CAPACITY_ID
+                 -- 销售订单中间表
+                 LEFT JOIN AMS_SALE_ORDER_MATERIAL ASOM ON ASOM.SALE_ORDER_MATERIAL_ID = OO.ORDER_PLAN_ID
+                 --收货地址
+                 left join RMS_RECEIVE_PLACE RRP on ASOM.SALE_SHIPPING_ADDRESS_ID = RRP.PLACE_ID
+                 left join RMS_RECEIVE_ADDRESS RRA on RRP.ADDRESS_ID = RRA.ADDRESS_ID
+                 -- 收货单位
+                 LEFT JOIN RMS_SHIPPER RS2 ON ASO.SHIPPER_ID = RS2.SHIPPER_ID
+             WHERE
+               OO.ORDER_TYPE = 1
+               AND OO.ORDER_ID = #{orderId}
+             FETCH NEXT 1 ROWS ONLY
+           )
+    </select>
 
 </mapper>

+ 301 - 0
src/main/resources/com/steerinfo/dil/mapper/TmstruckWeightBatchMapper.xml

@@ -0,0 +1,301 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.steerinfo.dil.mapper.TmstruckWeightBatchMapper">
+  <resultMap id="BaseResultMap" type="com.steerinfo.dil.model.TmstruckWeightBatch">
+    <id column="WEIGHT_BATCH_ID" jdbcType="DECIMAL" property="weightBatchId" />
+    <result column="BATCH_NET_WEIGHT" jdbcType="DECIMAL" property="batchNetWeight" />
+    <result column="BATCH_GROSS_WEIGHT" jdbcType="DECIMAL" property="batchGrossWeight" />
+    <result column="BATCH_TARE_WEIGHT" jdbcType="DECIMAL" property="batchTareWeight" />
+    <result column="BATCH_TARE_WEIGHT_TIME" jdbcType="TIMESTAMP" property="batchTareWeightTime" />
+    <result column="BATCH_REMARK" jdbcType="VARCHAR" property="batchRemark" />
+    <result column="BATCH_GROSS_WEIGHT_TIME" jdbcType="TIMESTAMP" property="batchGrossWeightTime" />
+  </resultMap>
+  <sql id="columns">
+    WEIGHT_BATCH_ID, BATCH_NET_WEIGHT, BATCH_GROSS_WEIGHT, BATCH_TARE_WEIGHT, BATCH_TARE_WEIGHT_TIME, 
+    BATCH_REMARK, BATCH_GROSS_WEIGHT_TIME
+  </sql>
+  <sql id="columns_alias">
+    t.WEIGHT_BATCH_ID, t.BATCH_NET_WEIGHT, t.BATCH_GROSS_WEIGHT, t.BATCH_TARE_WEIGHT, 
+    t.BATCH_TARE_WEIGHT_TIME, t.BATCH_REMARK, t.BATCH_GROSS_WEIGHT_TIME
+  </sql>
+  <sql id="select">
+    SELECT <include refid="columns" /> FROM TMSTRUCK_WEIGHT_BATCH
+  </sql>
+  <sql id="select_alias">
+    SELECT <include refid="columns_alias" /> FROM TMSTRUCK_WEIGHT_BATCH t
+  </sql>
+  <sql id="where">
+    <where>
+      <if test="weightBatchId != null">
+        and WEIGHT_BATCH_ID = #{weightBatchId}
+      </if>
+      <if test="batchNetWeight != null">
+        and BATCH_NET_WEIGHT = #{batchNetWeight}
+      </if>
+      <if test="batchGrossWeight != null">
+        and BATCH_GROSS_WEIGHT = #{batchGrossWeight}
+      </if>
+      <if test="batchTareWeight != null">
+        and BATCH_TARE_WEIGHT = #{batchTareWeight}
+      </if>
+      <if test="batchTareWeightTime != null">
+        and TO_CHAR(BATCH_TARE_WEIGHT_TIME,'yyyy-MM-dd') = #{batchTareWeightTime}
+      </if>
+      <if test="batchRemark != null and batchRemark != ''">
+        and BATCH_REMARK = #{batchRemark}
+      </if>
+      <if test="batchGrossWeightTime != null">
+        and TO_CHAR(BATCH_GROSS_WEIGHT_TIME,'yyyy-MM-dd') = #{batchGrossWeightTime}
+      </if>
+    </where>
+  </sql>
+  <sql id="whereLike">
+    <where>
+      <if test="weightBatchId != null">
+        and WEIGHT_BATCH_ID = #{weightBatchId}
+      </if>
+      <if test="batchNetWeight != null">
+        and BATCH_NET_WEIGHT = #{batchNetWeight}
+      </if>
+      <if test="batchGrossWeight != null">
+        and BATCH_GROSS_WEIGHT = #{batchGrossWeight}
+      </if>
+      <if test="batchTareWeight != null">
+        and BATCH_TARE_WEIGHT = #{batchTareWeight}
+      </if>
+      <if test="batchTareWeightTime != null">
+        and TO_CHAR(BATCH_TARE_WEIGHT_TIME,'yyyy-MM-dd') = #{batchTareWeightTime}
+      </if>
+      <if test="batchRemark != null and batchRemark != ''">
+        and BATCH_REMARK LIKE '%${batchRemark}%'
+      </if>
+      <if test="batchGrossWeightTime != null">
+        and TO_CHAR(BATCH_GROSS_WEIGHT_TIME,'yyyy-MM-dd') = #{batchGrossWeightTime}
+      </if>
+    </where>
+  </sql>
+  <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal">
+    delete from TMSTRUCK_WEIGHT_BATCH
+    where WEIGHT_BATCH_ID = #{weightBatchId,jdbcType=DECIMAL}
+  </delete>
+  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
+    delete from TMSTRUCK_WEIGHT_BATCH
+    where 1!=1
+    <if test="batchNetWeight != null">
+      or BATCH_NET_WEIGHT = #{batchNetWeight}
+    </if>
+    <if test="batchGrossWeight != null">
+      or BATCH_GROSS_WEIGHT = #{batchGrossWeight}
+    </if>
+    <if test="batchTareWeight != null">
+      or BATCH_TARE_WEIGHT = #{batchTareWeight}
+    </if>
+    <if test="batchTareWeightTime != null">
+      or TO_CHAR(BATCH_TARE_WEIGHT_TIME,'yyyy-MM-dd') = '#{batchTareWeightTime}'
+    </if>
+    <if test="batchRemark != null and batchRemark != ''">
+      or BATCH_REMARK = #{batchRemark}
+    </if>
+    <if test="batchGrossWeightTime != null">
+      or TO_CHAR(BATCH_GROSS_WEIGHT_TIME,'yyyy-MM-dd') = '#{batchGrossWeightTime}'
+    </if>
+  </delete>
+  <insert id="insert" parameterType="com.steerinfo.dil.model.TmstruckWeightBatch">
+    insert into TMSTRUCK_WEIGHT_BATCH (WEIGHT_BATCH_ID, BATCH_NET_WEIGHT, BATCH_GROSS_WEIGHT,
+                                       BATCH_TARE_WEIGHT, BATCH_TARE_WEIGHT_TIME,
+                                       BATCH_REMARK, BATCH_GROSS_WEIGHT_TIME)
+    values (#{weightBatchId,jdbcType=DECIMAL}, #{batchNetWeight,jdbcType=DECIMAL}, #{batchGrossWeight,jdbcType=DECIMAL},
+            #{batchTareWeight,jdbcType=DECIMAL}, #{batchTareWeightTime,jdbcType=TIMESTAMP},
+            #{batchRemark,jdbcType=VARCHAR}, #{batchGrossWeightTime,jdbcType=TIMESTAMP})
+  </insert>
+  <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstruckWeightBatch">
+    insert into TMSTRUCK_WEIGHT_BATCH
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="weightBatchId != null">
+        WEIGHT_BATCH_ID,
+      </if>
+      <if test="batchNetWeight != null">
+        BATCH_NET_WEIGHT,
+      </if>
+      <if test="batchGrossWeight != null">
+        BATCH_GROSS_WEIGHT,
+      </if>
+      <if test="batchTareWeight != null">
+        BATCH_TARE_WEIGHT,
+      </if>
+      <if test="batchTareWeightTime != null">
+        BATCH_TARE_WEIGHT_TIME,
+      </if>
+      <if test="batchRemark != null">
+        BATCH_REMARK,
+      </if>
+      <if test="batchGrossWeightTime != null">
+        BATCH_GROSS_WEIGHT_TIME,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="weightBatchId != null">
+        #{weightBatchId,jdbcType=DECIMAL},
+      </if>
+      <if test="batchNetWeight != null">
+        #{batchNetWeight,jdbcType=DECIMAL},
+      </if>
+      <if test="batchGrossWeight != null">
+        #{batchGrossWeight,jdbcType=DECIMAL},
+      </if>
+      <if test="batchTareWeight != null">
+        #{batchTareWeight,jdbcType=DECIMAL},
+      </if>
+      <if test="batchTareWeightTime != null">
+        #{batchTareWeightTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="batchRemark != null">
+        #{batchRemark,jdbcType=VARCHAR},
+      </if>
+      <if test="batchGrossWeightTime != null">
+        #{batchGrossWeightTime,jdbcType=TIMESTAMP},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstruckWeightBatch">
+    update TMSTRUCK_WEIGHT_BATCH
+    set BATCH_NET_WEIGHT = #{batchNetWeight,jdbcType=DECIMAL},
+        BATCH_GROSS_WEIGHT = #{batchGrossWeight,jdbcType=DECIMAL},
+        BATCH_TARE_WEIGHT = #{batchTareWeight,jdbcType=DECIMAL},
+        BATCH_TARE_WEIGHT_TIME = #{batchTareWeightTime,jdbcType=TIMESTAMP},
+        BATCH_REMARK = #{batchRemark,jdbcType=VARCHAR},
+        BATCH_GROSS_WEIGHT_TIME = #{batchGrossWeightTime,jdbcType=TIMESTAMP}
+    where WEIGHT_BATCH_ID = #{weightBatchId,jdbcType=DECIMAL}
+  </update>
+  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstruckWeightBatch">
+    update TMSTRUCK_WEIGHT_BATCH
+    <set>
+      <if test="batchNetWeight != null">
+        BATCH_NET_WEIGHT = #{batchNetWeight,jdbcType=DECIMAL},
+      </if>
+      <if test="batchGrossWeight != null">
+        BATCH_GROSS_WEIGHT = #{batchGrossWeight,jdbcType=DECIMAL},
+      </if>
+      <if test="batchTareWeight != null">
+        BATCH_TARE_WEIGHT = #{batchTareWeight,jdbcType=DECIMAL},
+      </if>
+      <if test="batchTareWeightTime != null">
+        BATCH_TARE_WEIGHT_TIME = #{batchTareWeightTime,jdbcType=TIMESTAMP},
+      </if>
+      <if test="batchRemark != null">
+        BATCH_REMARK = #{batchRemark,jdbcType=VARCHAR},
+      </if>
+      <if test="batchGrossWeightTime != null">
+        BATCH_GROSS_WEIGHT_TIME = #{batchGrossWeightTime,jdbcType=TIMESTAMP},
+      </if>
+    </set>
+    where WEIGHT_BATCH_ID = #{weightBatchId,jdbcType=DECIMAL}
+  </update>
+  <select id="selectByPrimaryKey" parameterType="java.math.BigDecimal" resultMap="BaseResultMap">
+    <include refid="select" />
+    where WEIGHT_BATCH_ID = #{weightBatchId,jdbcType=DECIMAL}
+  </select>
+  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
+    <include refid="select" />
+    <include refid="where" />
+  </select>
+  <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
+    <include refid="select" />
+    <include refid="whereLike" />
+  </select>
+  <insert id="batchInsert" parameterType="java.util.List">
+    insert into TMSTRUCK_WEIGHT_BATCH
+    (WEIGHT_BATCH_ID,
+    BATCH_NET_WEIGHT, BATCH_GROSS_WEIGHT,
+    BATCH_TARE_WEIGHT, BATCH_TARE_WEIGHT_TIME,
+    BATCH_REMARK, BATCH_GROSS_WEIGHT_TIME
+    )
+    ( <foreach collection="list" item="item" separator="union all">
+    select
+    #{item.weightBatchId,jdbcType=DECIMAL},
+    #{item.batchNetWeight,jdbcType=DECIMAL}, #{item.batchGrossWeight,jdbcType=DECIMAL},
+    #{item.batchTareWeight,jdbcType=DECIMAL}, #{item.batchTareWeightTime,jdbcType=TIMESTAMP},
+    #{item.batchRemark,jdbcType=VARCHAR}, #{item.batchGrossWeightTime,jdbcType=TIMESTAMP}
+    from dual
+  </foreach> )
+  </insert>
+  <update id="batchUpdate" parameterType="java.util.List">
+    update TMSTRUCK_WEIGHT_BATCH
+    set
+    WEIGHT_BATCH_ID=
+    <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_BATCH_ID" separator=" ">
+      when #{item.weightBatchId,jdbcType=DECIMAL} then #{item.weightBatchId,jdbcType=DECIMAL}
+    </foreach>
+    ,BATCH_NET_WEIGHT=
+    <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_BATCH_ID" separator=" ">
+      when #{item.weightBatchId,jdbcType=DECIMAL} then #{item.batchNetWeight,jdbcType=DECIMAL}
+    </foreach>
+    ,BATCH_GROSS_WEIGHT=
+    <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_BATCH_ID" separator=" ">
+      when #{item.weightBatchId,jdbcType=DECIMAL} then #{item.batchGrossWeight,jdbcType=DECIMAL}
+    </foreach>
+    ,BATCH_TARE_WEIGHT=
+    <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_BATCH_ID" separator=" ">
+      when #{item.weightBatchId,jdbcType=DECIMAL} then #{item.batchTareWeight,jdbcType=DECIMAL}
+    </foreach>
+    ,BATCH_TARE_WEIGHT_TIME=
+    <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_BATCH_ID" separator=" ">
+      when #{item.weightBatchId,jdbcType=DECIMAL} then #{item.batchTareWeightTime,jdbcType=TIMESTAMP}
+    </foreach>
+    ,BATCH_REMARK=
+    <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_BATCH_ID" separator=" ">
+      when #{item.weightBatchId,jdbcType=DECIMAL} then #{item.batchRemark,jdbcType=VARCHAR}
+    </foreach>
+    ,BATCH_GROSS_WEIGHT_TIME=
+    <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_BATCH_ID" separator=" ">
+      when #{item.weightBatchId,jdbcType=DECIMAL} then #{item.batchGrossWeightTime,jdbcType=TIMESTAMP}
+    </foreach>
+    where WEIGHT_BATCH_ID in
+    <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
+      #{item.weightBatchId,jdbcType=DECIMAL}
+    </foreach>
+  </update>
+
+    <delete id="batchDelete" parameterType="java.util.List">
+    delete from TMSTRUCK_WEIGHT_BATCH
+    where WEIGHT_BATCH_ID in
+    <foreach close=")" collection="list" item="id" open="(" separator=",">
+      #{id}
+    </foreach>
+  </delete>
+  <!-- 友情提示!!!-->
+  <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
+  <update id="updateFluMes">
+    UPDATE AMS_SALE_MATERIAL ASM
+    SET ASM.INSERT_UPDATE_REMARK = '绑定计量批次ID'
+    <if test="goodNum != null">
+      ,ASM.MATERIAL_NUMBER = #{goodNum}
+    </if>
+    <if test="theoryWeight != null">
+      ,ASM.MATERIAL_WEIGHT = #{theoryWeight}
+    </if>
+    <if test="weightBatchId != null">
+      ,ASM.weight_batch_id = #{weightBatchId}
+    </if>
+
+    WHERE ASM.EAS_PRIMARY_ID = #{FLID}
+  </update>
+  <update id="updateOmMes">
+    UPDATE OMSTRUCK_ORDER_MATERIAL OOM
+    SET OOM.INSERT_UPDATE_REMARK = '修改理重、件数'
+    <if test="goodNum != null">
+      ,OOM.ORDER_MATERIAL_NUMBER = #{goodNum}
+    </if>
+    <if test="theoryWeight != null">
+      ,OOM.ORDER_MATERIAL_WEIGHT = #{theoryWeight}
+    </if>
+    WHERE OOM.SALE_MATERIAL_ID = (SELECT ASM.SALE_MATERIAL_ID FROM AMS_SALE_MATERIAL ASM
+    WHERE ASM.EAS_PRIMARY_ID = #{FLID})
+  </update>
+    <update id="updateAmsFluToNull">
+      UPDATE AMS_SALE_MATERIAL ASM
+      SET ASM.WEIGHT_BATCH_ID = NULL,
+          ASM.SALE_MAKE_DATE = NULL
+      WHERE ASM.WEIGHT_BATCH_ID = #{weightBatchId}
+    </update>
+</mapper>