luobang 2 سال پیش
والد
کامیت
1abad4635c

+ 1 - 1
pom.xml

@@ -194,7 +194,7 @@
                     <!--包名-->
                     <targetPackage>com.steerinfo.dil</targetPackage>
                     <tables>
-                        <table>OMSTRAIN_ORDER</table>
+                        <table>TMSTRUCK_WEIGHT_RESULT</table>
                     </tables>
                 </configuration>
                 <executions>

+ 7 - 0
src/main/java/com/steerinfo/dil/mapper/TmstruckWeightResultMapper.java

@@ -79,4 +79,11 @@ public interface TmstruckWeightResultMapper extends IBaseMapper<TmstruckWeightRe
     int updatePurchaseInwordAPOId(Map<String, Object> mesMap);
 
     List<Map<String, Object>> getShipQualityResult(Map<String,Object> map);
+
+    Map<String, Object> getOrderMes(String carNo);
+
+    BigDecimal getMaterialId(Map<String, Object> map);
+
+    int getHaveNetWeightByMaterial(Map<String, Object> map);
+
 }

+ 18 - 3
src/main/java/com/steerinfo/dil/model/TmstruckWeightResult.java

@@ -112,19 +112,19 @@ public class TmstruckWeightResult implements IBasePO<BigDecimal> {
     private BigDecimal resultTarePlaceId;
 
     /**
-     * 物资ID(MATERIAL_ID,DECIMAL,38)
+     * 物资ID(MATERIAL_ID,DECIMAL,0)
      */
     @ApiModelProperty(value="物资ID",required=false)
     private BigDecimal materialId;
 
     /**
-     * 是否需要扣水扣杂(0:否,1:是)(ISDEDUCT,DECIMAL,38)
+     * 是否需要扣水扣杂(0:否,1:是)(ISDEDUCT,DECIMAL,0)
      */
     @ApiModelProperty(value="是否需要扣水扣杂(0:否,1:是)",required=false)
     private BigDecimal isdeduct;
 
     /**
-     * 是否完成扣水扣杂(0:否,1:是)(ISQUALITY,DECIMAL,38)
+     * 是否完成扣水扣杂(0:否,1:是)(ISQUALITY,DECIMAL,0)
      */
     @ApiModelProperty(value="是否完成扣水扣杂(0:否,1:是)",required=false)
     private BigDecimal isquality;
@@ -141,6 +141,12 @@ public class TmstruckWeightResult implements IBasePO<BigDecimal> {
     @ApiModelProperty(value="皮重路段顺序号",required=false)
     private BigDecimal tareSegmentSqe;
 
+    /**
+     * 物资件数(MATERIAL_NUM,DECIMAL,0)
+     */
+    @ApiModelProperty(value="物资件数",required=false)
+    private BigDecimal materialNum;
+
     private static final long serialVersionUID = 1L;
 
     @Override
@@ -329,6 +335,14 @@ public class TmstruckWeightResult implements IBasePO<BigDecimal> {
         this.tareSegmentSqe = tareSegmentSqe;
     }
 
+    public BigDecimal getMaterialNum() {
+        return materialNum;
+    }
+
+    public void setMaterialNum(BigDecimal materialNum) {
+        this.materialNum = materialNum;
+    }
+
     @Override
     public String toString() {
         StringBuilder sb = new StringBuilder();
@@ -357,6 +371,7 @@ public class TmstruckWeightResult implements IBasePO<BigDecimal> {
         sb.append(", isquality=").append(isquality);
         sb.append(", grossSegmentSqe=").append(grossSegmentSqe);
         sb.append(", tareSegmentSqe=").append(tareSegmentSqe);
+        sb.append(", materialNum=").append(materialNum);
         sb.append(", serialVersionUID=").append(serialVersionUID);
         sb.append("]");
         return sb.toString();

+ 5 - 0
src/main/java/com/steerinfo/dil/service/impl/AmsSaleOrderServiceImpl.java

@@ -113,7 +113,9 @@ public class AmsSaleOrderServiceImpl implements IAmsSaleOrderService {
     @Transactional
     @Override
     public int operationSaleOrder(Map<String, Object> mapVal) {
+        System.out.println("-----------------------------" + new Date() + "销售订单对接接口" + "-----------------------------");
         System.out.println(mapVal);
+        System.out.println("-----------------------------" + new Date() + "销售订单对接接口" + "-----------------------------");
         int result = 0;
         // 审批状态
         String orderStatus = (String) mapVal.get("orderStatus");
@@ -521,6 +523,9 @@ public class AmsSaleOrderServiceImpl implements IAmsSaleOrderService {
     @Override
     @Transactional(rollbackFor = {Exception.class})
     public int addInwardSteelOrder(Map<String,Object> map) throws Exception {
+        System.out.println("-----------------------------" + new Date() + "内转异地库对接接口" + "-----------------------------");
+        System.out.println(map);
+        System.out.println("-----------------------------" + new Date() + "内转异地库对接接口" + "-----------------------------");
         int result=0;
        //输出json数据。
         String json= JSON.toJSONString(map);

+ 1 - 1
src/main/java/com/steerinfo/dil/service/impl/KDWebServiceServiceImpl.java

@@ -143,7 +143,7 @@ public class KDWebServiceServiceImpl {
      * @param
      * @return
      **/
-    @Scheduled(fixedRate = 1000 * 60 * 10)
+    //@Scheduled(fixedRate = 1000 * 60 * 10)
     public void timingPushMesToKD(){
         List<Map<String, Object>> allNotUploadedEasMes = amsNotUploadedEasMapper.getAllNotUploadedEasMes();
         if(allNotUploadedEasMes != null && allNotUploadedEasMes.size() != 0){

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

@@ -37,12 +37,9 @@ public class TmsTruckQualityService implements ITmsTruckQualityResultService {
     TmstruckWeightResultMapper tmstruckWeightResultMapper;
     //定时访问质检系统,获取质检实绩
     @Scheduled(cron = "30 10 10 * * ?")
-//    @Override
     public int insertQualityResult() throws IOException, DocumentException {
         //先查出所有需要质检的但是没有质检的磅单号
         List<Map<String,Object>>mapList=tmstruckWeightResultMapper.selectWzInputId();
-        System.out.println(mapList);
-        System.out.println(mapList);
         if (mapList.size() != 0){
             for (Map<String,Object> map:mapList
             ) {

+ 69 - 1
src/main/java/com/steerinfo/dil/service/impl/TmstruckWeightResultServiceImpl.java

@@ -123,11 +123,27 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
      * @return
      */
     public String addTruckWeightResult(Map<String, Object> map) {
+        System.out.println("---------------------------------" + new Date() + "新接收到的计量实绩" + "---------------------------------");
         System.out.println(map);
+        System.out.println("---------------------------------" + new Date() + "新接收到的计量实绩"  + "---------------------------------");
         //首先通过运输订单号查询订单类型
         Map<String, Object> oneMap = utilsMapper.getOrderTypeByOrderNumber((String) map.get("orderNumber")); //用于判断订单类型
         if(oneMap == null){
-            return map.get("orderNumber") + "系统无此订单";
+            if(map.get("flag") != null && map.get("flag").equals("GCXS")){
+                System.out.println("这是钢材销售走补录金蝶的那边");
+                TmstruckWeightResult tmstruckWeightResult = null;
+                try {
+                    tmstruckWeightResult = generateSteelWeightResult(map);
+                    tmstruckWeightResultMapper.updateByPrimaryKeySelective(tmstruckWeightResult);
+                    utilsService.pushMesToWebsocket((String) map.get("carNo"), "计量");
+                    return map.get("carNo") + "传输成功";
+                } catch (Exception e) {
+                    System.out.println(map.get("carNo") + "传输失败");
+                    return map.get("carNo")  + e.getMessage() + "传输失败";
+                }
+            }else{
+                return map.get("orderNumber") + "系统无此订单";
+            }
         }
         int orderType= DataChange.dataToBigDecimal(oneMap.get("orderType")).intValue();
         if(orderType == 11 || orderType == 15 || orderType == 16){
@@ -176,6 +192,58 @@ public class TmstruckWeightResultServiceImpl implements ITmstruckWeightResultSer
         return map.get("orderNumber") + "成功";
     }
 
+    private TmstruckWeightResult generateSteelWeightResult(Map<String, Object> map) throws Exception {
+        TmstruckWeightResult tmstruckWeightResult = new TmstruckWeightResult();
+        //该数据为不走物流扫码的数据
+        //1.通过车号去寻找正在作业的5的运输订单号
+        String carNo = (String) map.get("carNo");
+        Map<String,Object> orderMes = tmstruckWeightResultMapper.getOrderMes(carNo);
+        if (orderMes == null){
+            throw new Exception("该车没有正在运行中的信息");
+        }
+        map.putAll(orderMes);
+        tmstruckWeightResult.setId(DataChange.dataToBigDecimal(map.get("weightTaskResultId")));
+        int orderType = DataChange.dataToBigDecimal(orderMes.get("orderTypee")).intValue();
+        //磅单号
+        tmstruckWeightResult.setResultPoundNo((String) map.get("resultPoundNo"));
+        String resultCrossWeightTime = (String) map.get("resultCrossWeightTime");
+        //根据传输过来的物资名称和规格型号
+        BigDecimal materialId = tmstruckWeightResultMapper.getMaterialId(map);
+        if(materialId == null){
+            throw new Exception("系统找不到该物资");
+        }
+        map.put("materialId",materialId);
+        //判断此物资是不是已经有净重了,如果有抛出异常
+        int netWeightCount = tmstruckWeightResultMapper.getHaveNetWeightByMaterial(map);
+        if(netWeightCount != 0){
+            throw new Exception("该物资已有净重,不能再次录入");
+        }
+        tmstruckWeightResult.setMaterialId(materialId);
+        tmstruckWeightResult.setMaterialNum(DataChange.dataToBigDecimal(map.get("goodNum")));
+        addWeightResult(tmstruckWeightResult, map); //添加计量实绩数据
+        // 更新订单中路段顺序号,如果毛重时间为空则为计皮:也就是销售第一次计皮,反之有毛重时间则为计毛
+        if(resultCrossWeightTime == null || resultCrossWeightTime.length() == 0){
+            map.put("segmentSqe", map.get("tareSegmentSqe")); //皮重路段顺序
+        }else{
+            map.put("segmentSqe", map.get("grossSegmentSqe")); //毛重路段顺序
+        }
+        if(orderType == 1 || orderType == 4){
+            //如果是钢材订单,获取下一个还没计量的实绩 将毛重数据作为下一个计量实绩的皮重
+            //并且是第二次传入重量才执行
+            List<Map<String, Object>> steelMapList = tmstruckWeightResultMapper.getNoNetWeightResultId(DataChange.dataToBigDecimal(map.get("resultTotalId")));
+            if(steelMapList.size() >= 2){ //当前更新还未提交所以如果是拼装需要查询两个出来 以第二个为准
+                Map<String, Object> steelMap = steelMapList.get(1);
+                Object resultNetWeight = map.get("resultNetWeight");
+                if(resultNetWeight  != null && !"".equals(resultNetWeight)){
+                    updateSteelAssemble(map, steelMap); //更新下一拼实绩
+                    map.put("segmentSqe", steelMap.get("tareSegmentSqe")); // 修改路段顺序号直接到下一皮重路段顺序
+                }
+            }
+        }
+        utilsService.updateOrderLineSequence(map);
+        return tmstruckWeightResult;
+    }
+
     /**
      * 生成汽运计量实体类
      * @Author TXF

+ 102 - 41
src/main/resources/com/steerinfo/dil/mapper/TmstruckWeightResultMapper.xml

@@ -24,26 +24,27 @@
         <result column="ISQUALITY" jdbcType="DECIMAL" property="isquality" />
         <result column="GROSS_SEGMENT_SQE" jdbcType="DECIMAL" property="grossSegmentSqe" />
         <result column="TARE_SEGMENT_SQE" jdbcType="DECIMAL" property="tareSegmentSqe" />
+        <result column="MATERIAL_NUM" jdbcType="DECIMAL" property="materialNum" />
     </resultMap>
     <sql id="columns">
         WEIGHT_TASK_RESULT_ID, RESULT_TOTAL_ID, RESULT_POUND_NO, RESULT_GROSS_WEIGHT, RESULT_GROSS_WEIGHT_TIME,
     RESULT_TARE_WEIGHT, RESULT_TARE_WEIGHT_TIME, RESULT_NET_WEIGHT, INSERT_USERNAME,
     INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK, DELETE_NAME, DELETE_TIME,
     RESULT_GROSS_PLACE_ID, RESULT_TARE_PLACE_ID, MATERIAL_ID, ISDEDUCT, ISQUALITY, GROSS_SEGMENT_SQE,
-    TARE_SEGMENT_SQE
+    TARE_SEGMENT_SQE, MATERIAL_NUM
     </sql>
     <sql id="columns_alias">
         t.WEIGHT_TASK_RESULT_ID, t.RESULT_TOTAL_ID, t.RESULT_POUND_NO, t.RESULT_GROSS_WEIGHT,
     t.RESULT_GROSS_WEIGHT_TIME, t.RESULT_TARE_WEIGHT, t.RESULT_TARE_WEIGHT_TIME, t.RESULT_NET_WEIGHT,
     t.INSERT_USERNAME, t.INSERT_TIME, t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK,
     t.DELETE_NAME, t.DELETE_TIME, t.RESULT_GROSS_PLACE_ID, t.RESULT_TARE_PLACE_ID, t.MATERIAL_ID,
-    t.ISDEDUCT, t.ISQUALITY, t.GROSS_SEGMENT_SQE, t.TARE_SEGMENT_SQE
+    t.ISDEDUCT, t.ISQUALITY, t.GROSS_SEGMENT_SQE, t.TARE_SEGMENT_SQE, t.MATERIAL_NUM
     </sql>
     <sql id="select">
-        SELECT <include refid="columns"/> FROM TMSTRUCK_WEIGHT_RESULT
+        SELECT <include refid="columns" /> FROM TMSTRUCK_WEIGHT_RESULT
     </sql>
     <sql id="select_alias">
-        SELECT <include refid="columns_alias"/> FROM TMSTRUCK_WEIGHT_RESULT t
+        SELECT <include refid="columns_alias" /> FROM TMSTRUCK_WEIGHT_RESULT t
     </sql>
     <sql id="where">
         <where>
@@ -113,6 +114,9 @@
             <if test="tareSegmentSqe != null">
                 and TARE_SEGMENT_SQE = #{tareSegmentSqe}
             </if>
+            <if test="materialNum != null">
+                and MATERIAL_NUM = #{materialNum}
+            </if>
         </where>
     </sql>
     <sql id="whereLike">
@@ -183,6 +187,9 @@
             <if test="tareSegmentSqe != null">
                 and TARE_SEGMENT_SQE = #{tareSegmentSqe}
             </if>
+            <if test="materialNum != null">
+                and MATERIAL_NUM = #{materialNum}
+            </if>
         </where>
     </sql>
     <delete id="deleteByPrimaryKey" parameterType="DECIMAL">
@@ -255,6 +262,9 @@
         <if test="tareSegmentSqe != null">
             or TARE_SEGMENT_SQE = #{tareSegmentSqe}
         </if>
+        <if test="materialNum != null">
+            or MATERIAL_NUM = #{materialNum}
+        </if>
     </delete>
     <insert id="insert" parameterType="com.steerinfo.dil.model.TmstruckWeightResult">
         insert into TMSTRUCK_WEIGHT_RESULT (WEIGHT_TASK_RESULT_ID, RESULT_TOTAL_ID,
@@ -264,8 +274,8 @@
                                             UPDATE_USERNAME, UPDATE_TIME, INSERT_UPDATE_REMARK,
                                             DELETE_NAME, DELETE_TIME, RESULT_GROSS_PLACE_ID,
                                             RESULT_TARE_PLACE_ID, MATERIAL_ID, ISDEDUCT,
-                                            ISQUALITY, GROSS_SEGMENT_SQE, TARE_SEGMENT_SQE
-        )
+                                            ISQUALITY, GROSS_SEGMENT_SQE, TARE_SEGMENT_SQE,
+                                            MATERIAL_NUM)
         values (#{weightTaskResultId,jdbcType=DECIMAL}, #{resultTotalId,jdbcType=DECIMAL},
                 #{resultPoundNo,jdbcType=VARCHAR}, #{resultGrossWeight,jdbcType=DECIMAL}, #{resultGrossWeightTime,jdbcType=TIMESTAMP},
                 #{resultTareWeight,jdbcType=DECIMAL}, #{resultTareWeightTime,jdbcType=TIMESTAMP},
@@ -273,8 +283,8 @@
                 #{updateUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR},
                 #{deleteName,jdbcType=VARCHAR}, #{deleteTime,jdbcType=TIMESTAMP}, #{resultGrossPlaceId,jdbcType=DECIMAL},
                 #{resultTarePlaceId,jdbcType=DECIMAL}, #{materialId,jdbcType=DECIMAL}, #{isdeduct,jdbcType=DECIMAL},
-                #{isquality,jdbcType=DECIMAL}, #{grossSegmentSqe,jdbcType=DECIMAL}, #{tareSegmentSqe,jdbcType=DECIMAL}
-               )
+                #{isquality,jdbcType=DECIMAL}, #{grossSegmentSqe,jdbcType=DECIMAL}, #{tareSegmentSqe,jdbcType=DECIMAL},
+                #{materialNum,jdbcType=DECIMAL})
     </insert>
     <insert id="insertSelective" parameterType="com.steerinfo.dil.model.TmstruckWeightResult">
         insert into TMSTRUCK_WEIGHT_RESULT
@@ -345,6 +355,9 @@
             <if test="tareSegmentSqe != null">
                 TARE_SEGMENT_SQE,
             </if>
+            <if test="materialNum != null">
+                MATERIAL_NUM,
+            </if>
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="weightTaskResultId != null">
@@ -413,6 +426,9 @@
             <if test="tareSegmentSqe != null">
                 #{tareSegmentSqe,jdbcType=DECIMAL},
             </if>
+            <if test="materialNum != null">
+                #{materialNum,jdbcType=DECIMAL},
+            </if>
         </trim>
     </insert>
     <update id="updateByPrimaryKey" parameterType="com.steerinfo.dil.model.TmstruckWeightResult">
@@ -437,7 +453,8 @@
             ISDEDUCT = #{isdeduct,jdbcType=DECIMAL},
             ISQUALITY = #{isquality,jdbcType=DECIMAL},
             GROSS_SEGMENT_SQE = #{grossSegmentSqe,jdbcType=DECIMAL},
-            TARE_SEGMENT_SQE = #{tareSegmentSqe,jdbcType=DECIMAL}
+            TARE_SEGMENT_SQE = #{tareSegmentSqe,jdbcType=DECIMAL},
+            MATERIAL_NUM = #{materialNum,jdbcType=DECIMAL}
         where WEIGHT_TASK_RESULT_ID = #{weightTaskResultId,jdbcType=DECIMAL}
     </update>
     <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.dil.model.TmstruckWeightResult">
@@ -506,20 +523,23 @@
             <if test="tareSegmentSqe != null">
                 TARE_SEGMENT_SQE = #{tareSegmentSqe,jdbcType=DECIMAL},
             </if>
+            <if test="materialNum != null">
+                MATERIAL_NUM = #{materialNum,jdbcType=DECIMAL},
+            </if>
         </set>
         where WEIGHT_TASK_RESULT_ID = #{weightTaskResultId,jdbcType=DECIMAL}
     </update>
     <select id="selectByPrimaryKey" parameterType="DECIMAL" resultMap="BaseResultMap">
-        <include refid="select"/>
+        <include refid="select" />
         where WEIGHT_TASK_RESULT_ID = #{weightTaskResultId,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 TMSTRUCK_WEIGHT_RESULT
@@ -533,7 +553,7 @@
         DELETE_NAME, DELETE_TIME, RESULT_GROSS_PLACE_ID,
         RESULT_TARE_PLACE_ID, MATERIAL_ID,
         ISDEDUCT, ISQUALITY, GROSS_SEGMENT_SQE,
-        TARE_SEGMENT_SQE)
+        TARE_SEGMENT_SQE, MATERIAL_NUM)
         ( <foreach collection="list" item="item" separator="union all">
         select
         #{item.weightTaskResultId,jdbcType=DECIMAL},
@@ -546,112 +566,118 @@
         #{item.deleteName,jdbcType=VARCHAR}, #{item.deleteTime,jdbcType=TIMESTAMP}, #{item.resultGrossPlaceId,jdbcType=DECIMAL},
         #{item.resultTarePlaceId,jdbcType=DECIMAL}, #{item.materialId,jdbcType=DECIMAL},
         #{item.isdeduct,jdbcType=DECIMAL}, #{item.isquality,jdbcType=DECIMAL}, #{item.grossSegmentSqe,jdbcType=DECIMAL},
-        #{item.tareSegmentSqe,jdbcType=DECIMAL} from dual
+        #{item.tareSegmentSqe,jdbcType=DECIMAL}, #{item.materialNum,jdbcType=DECIMAL} from dual
     </foreach> )
     </insert>
     <update id="batchUpdate" parameterType="java.util.List">
         update TMSTRUCK_WEIGHT_RESULT
         set
         WEIGHT_TASK_RESULT_ID=
-        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.weightTaskResultId,jdbcType=DECIMAL}
         </foreach>
         ,RESULT_TOTAL_ID=
-        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.resultTotalId,jdbcType=DECIMAL}
         </foreach>
         ,RESULT_POUND_NO=
-        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.resultPoundNo,jdbcType=VARCHAR}
         </foreach>
         ,RESULT_GROSS_WEIGHT=
-        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.resultGrossWeight,jdbcType=DECIMAL}
         </foreach>
         ,RESULT_GROSS_WEIGHT_TIME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.resultGrossWeightTime,jdbcType=TIMESTAMP}
         </foreach>
         ,RESULT_TARE_WEIGHT=
-        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.resultTareWeight,jdbcType=DECIMAL}
         </foreach>
         ,RESULT_TARE_WEIGHT_TIME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.resultTareWeightTime,jdbcType=TIMESTAMP}
         </foreach>
         ,RESULT_NET_WEIGHT=
-        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.resultNetWeight,jdbcType=DECIMAL}
         </foreach>
         ,INSERT_USERNAME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.insertUsername,jdbcType=VARCHAR}
         </foreach>
         ,INSERT_TIME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.insertTime,jdbcType=TIMESTAMP}
         </foreach>
         ,UPDATE_USERNAME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.updateUsername,jdbcType=VARCHAR}
         </foreach>
         ,UPDATE_TIME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.updateTime,jdbcType=TIMESTAMP}
         </foreach>
         ,INSERT_UPDATE_REMARK=
-        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.insertUpdateRemark,jdbcType=VARCHAR}
         </foreach>
         ,DELETE_NAME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.deleteName,jdbcType=VARCHAR}
         </foreach>
         ,DELETE_TIME=
-        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.deleteTime,jdbcType=TIMESTAMP}
         </foreach>
         ,RESULT_GROSS_PLACE_ID=
-        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.resultGrossPlaceId,jdbcType=DECIMAL}
         </foreach>
         ,RESULT_TARE_PLACE_ID=
-        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.resultTarePlaceId,jdbcType=DECIMAL}
         </foreach>
         ,MATERIAL_ID=
-        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.materialId,jdbcType=DECIMAL}
         </foreach>
         ,ISDEDUCT=
-        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.isdeduct,jdbcType=DECIMAL}
         </foreach>
         ,ISQUALITY=
-        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.isquality,jdbcType=DECIMAL}
         </foreach>
         ,GROSS_SEGMENT_SQE=
-        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.grossSegmentSqe,jdbcType=DECIMAL}
         </foreach>
         ,TARE_SEGMENT_SQE=
-        <foreach collection="list" item="item" index="index" separator=" " open="case WEIGHT_TASK_RESULT_ID" close="end">
+        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
             when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.tareSegmentSqe,jdbcType=DECIMAL}
         </foreach>
+        ,MATERIAL_NUM=
+        <foreach close="end" collection="list" index="index" item="item" open="case WEIGHT_TASK_RESULT_ID" separator=" ">
+            when #{item.weightTaskResultId,jdbcType=DECIMAL} then #{item.materialNum,jdbcType=DECIMAL}
+        </foreach>
         where WEIGHT_TASK_RESULT_ID in
-        <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
+        <foreach close=")" collection="list" index="index" item="item" open="(" separator=",">
             #{item.weightTaskResultId,jdbcType=DECIMAL}
         </foreach>
     </update>
     <delete id="batchDelete" parameterType="java.util.List">
         delete from TMSTRUCK_WEIGHT_RESULT
         where WEIGHT_TASK_RESULT_ID in
-        <foreach collection="list" item="id" open="(" close=")" separator=",">
+        <foreach close=")" collection="list" item="id" open="(" separator=",">
             #{id}
         </foreach>
     </delete>
+    <!-- 友情提示!!!-->
+    <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
     <!-- 请将自己写的代码放在此标签之下,方便以后粘贴复制。-->
     <!-- 得到计重实绩主键id -->
     <!-- 得到汽车衡id -->
@@ -810,7 +836,6 @@
                         TTR.RESULT_TOTAL_ID       "resultTotalId",
                         TWR.TARE_SEGMENT_SQE      "tareSegmentSqe",
                         TWR.GROSS_SEGMENT_SQE     "grossSegmentSqe"
-
                  from TMSTRUCK_WEIGHT_RESULT TWR
                           left join TMSTRUCK_TOTAL_RESULT TTR
                                     on TTR.RESULT_TOTAL_ID = TWR.RESULT_TOTAL_ID
@@ -926,6 +951,42 @@
         left join DIL_BATCH DB on APO.BATCH_ID = DB.BATCH_ID
         where APO.PURCHASE_ORDER_NO = #{arrivalBillNo}
     </select>
+    <select id="getOrderMes" resultType="java.util.Map">
+        select *
+        from (
+                 select OO.ORDER_ID               "orderId",
+                        OO.ORDER_TYPE             "orderTypee",
+                        OO.ORDER_NUMBER           "orderNumber",
+                        TWR.WEIGHT_TASK_RESULT_ID "weightTaskResultId",
+                        TTR.RESULT_TOTAL_ID       "resultTotalId",
+                        TWR.TARE_SEGMENT_SQE      "tareSegmentSqe",
+                        TWR.GROSS_SEGMENT_SQE     "grossSegmentSqe"
+                 from TMSTRUCK_WEIGHT_RESULT TWR
+                          left join TMSTRUCK_TOTAL_RESULT TTR
+                                    on TTR.RESULT_TOTAL_ID = TWR.RESULT_TOTAL_ID
+                          left join OMSTRUCK_ORDER OO
+                                    on OO.ORDER_ID = TTR.ORDER_ID
+                          left join RMS_CAPACITY RC
+                                    ON RC.CAPACITY_ID = OO.CAPACITY_ID
+                 where RC.CAPACITY_NUMBER = #{carNo}
+                   and TWR.RESULT_NET_WEIGHT is null
+                   and oo.order_status = 5
+                 order by "tareSegmentSqe"
+             )
+        where rownum = 1
+    </select>
+    <select id="getHaveNetWeightByMaterial" resultType="java.lang.Integer">
+        select count(TWR.WEIGHT_TASK_RESULT_ID)  from TMSTRUCK_WEIGHT_RESULT TWR
+        where twr.RESULT_TOTAL_ID = #{resultTotalId}
+        and twr.material_id = #{materialId}
+        and TWR.RESULT_NET_WEIGHT is not null
+    </select>
+
+    <select id="getMaterialId" resultType="java.math.BigDecimal" parameterType="java.util.Map">
+        select RM.MATERIAL_ID from RMS_MATERIAL RM
+        WHERE RM.MATERIAL_NAME = #{good}
+        AND RM.MATERIAL_SPECIFICATION || '(' ||  RM.MATERIAL_MODEL || ')' = #{goodspa}
+    </select>