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

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

@@ -62,4 +62,7 @@ public interface TmstruckTotalResultMapper extends IBaseMapper<TmstruckTotalResu
 
     //删除所有出厂实绩
     int deleteLeaveByEnTotal(Map<String, Object> map);
+
+    List<BigDecimal> selectOrderIdToTotalId(BigDecimal orderId);
+
 }

+ 34 - 26
src/main/java/com/steerinfo/dil/service/impl/TmstruckTotalResultServiceImpl.java

@@ -83,8 +83,9 @@ public class TmstruckTotalResultServiceImpl implements ITmstruckTotalResultServi
 
     }
 
-    public int copyAllResult(BigDecimal orderId,BigDecimal orderIdOld,BigDecimal resultTotalIdOld){
+    public synchronized int copyAllResult(BigDecimal orderId,BigDecimal orderIdOld,BigDecimal resultTotalIdOld){
         //总实绩
+        //判断该订单有没有总实绩id
         TmstruckTotalResult tmstruckTotalResult = new TmstruckTotalResult();
         BigDecimal maxId = tmstruckTotalResultMapper.selectMaxId();
         tmstruckTotalResult.setResultTotalId(maxId);
@@ -104,35 +105,42 @@ public class TmstruckTotalResultServiceImpl implements ITmstruckTotalResultServi
             map.put("orderReceiveStatus",1);
             map.put("capacityNumber","capacityNumber");
             //根据旧的总实绩ID判断有没有
-            omsFeign.driverReceiveOrRefuse(map);
+            Map<String,Object> responseMap = omsFeign.driverReceiveOrRefuse(map);
+            System.out.println(responseMap);
             //进厂
             serachMap.put("resultTotalId",maxId);
-            TmstruckEnfactoryResult tmstruckEnfactoryResult=tmstruckEnfactoryResultMapper.selectByParameters(serachMap).get(0);
-            TmstruckEnfactoryResult tmstruckEnfactoryResult1=enOlds.get(0);
-            tmstruckEnfactoryResult1.setResultId(tmstruckEnfactoryResult.getResultId());
-            tmstruckEnfactoryResult1.setResultTotalId(tmstruckEnfactoryResult.getResultTotalId());
-            tmstruckEnfactoryResultMapper.updateByPrimaryKeySelective(tmstruckEnfactoryResult1);
+            List<TmstruckEnfactoryResult> tmstruckEnfactoryResultLb = tmstruckEnfactoryResultMapper.selectByParameters(serachMap);
+            if(tmstruckEnfactoryResultLb != null && tmstruckEnfactoryResultLb.size() > 0 && tmstruckEnfactoryResultLb.get(0) != null ) {
+                TmstruckEnfactoryResult tmstruckEnfactoryResult = tmstruckEnfactoryResultLb.get(0);
+                TmstruckEnfactoryResult tmstruckEnfactoryResult1=enOlds.get(0);
+                tmstruckEnfactoryResult1.setResultId(tmstruckEnfactoryResult.getResultId());
+                tmstruckEnfactoryResult1.setResultTotalId(tmstruckEnfactoryResult.getResultTotalId());
+                tmstruckEnfactoryResultMapper.updateByPrimaryKeySelective(tmstruckEnfactoryResult1);
+            }
             //计皮
             serachMap.put("resultTotalId",maxId);
-            TmstruckWeightResult tmstruckWeightResult=tmstruckWeightResultMapper.selectByTotalId(serachMap).get(0);
-            serachMap.put("switch","1");
-            serachMap.put("resultTotalId",resultTotalIdOld);
-            List<TmstruckWeightResult> olds = tmstruckWeightResultMapper.selectByTotalId(serachMap);
-            if(olds!=null && olds.size()>0){
-                TmstruckWeightResult tmstruckWeightResult1=olds.get(0);
-                tmstruckWeightResult.setResultTareWeightTime(tmstruckWeightResult1.getResultTareWeightTime());
-                tmstruckWeightResult.setResultTareWeight(tmstruckWeightResult1.getResultTareWeight());
-                tmstruckWeightResult.setResultTarePlaceId(tmstruckWeightResult1.getResultTarePlaceId());
-                tmstruckWeightResultMapper.updateByPrimaryKeySelective(tmstruckWeightResult);
-                Map<String,Object> orderMap=new HashMap<>();
-                orderMap.put("orderId",orderId);
-                orderMap.put("seq",2);
-                tmstruckWeightResultMapper.updateOmstruckStatus(orderMap);
-            }else{
-                Map<String,Object> orderMap=new HashMap<>();
-                orderMap.put("orderId",orderId);
-                orderMap.put("seq",0);
-                tmstruckWeightResultMapper.updateOmstruckStatus(orderMap);
+            List<TmstruckWeightResult> tmstruckWeightResultLb = tmstruckWeightResultMapper.selectByTotalId(serachMap);
+            if(tmstruckWeightResultLb != null && tmstruckWeightResultLb.size() > 0 && tmstruckWeightResultLb.get(0) != null) {
+                TmstruckWeightResult tmstruckWeightResult = tmstruckWeightResultLb.get(0);
+                serachMap.put("switch","1");
+                serachMap.put("resultTotalId",resultTotalIdOld);
+                List<TmstruckWeightResult> olds = tmstruckWeightResultMapper.selectByTotalId(serachMap);
+                if(olds!=null && olds.size()>0){
+                    TmstruckWeightResult tmstruckWeightResult1=olds.get(0);
+                    tmstruckWeightResult.setResultTareWeightTime(tmstruckWeightResult1.getResultTareWeightTime());
+                    tmstruckWeightResult.setResultTareWeight(tmstruckWeightResult1.getResultTareWeight());
+                    tmstruckWeightResult.setResultTarePlaceId(tmstruckWeightResult1.getResultTarePlaceId());
+                    tmstruckWeightResultMapper.updateByPrimaryKeySelective(tmstruckWeightResult);
+                    Map<String,Object> orderMap=new HashMap<>();
+                    orderMap.put("orderId",orderId);
+                    orderMap.put("seq",2);
+                    tmstruckWeightResultMapper.updateOmstruckStatus(orderMap);
+                }else{
+                    Map<String,Object> orderMap=new HashMap<>();
+                    orderMap.put("orderId",orderId);
+                    orderMap.put("seq",0);
+                    tmstruckWeightResultMapper.updateOmstruckStatus(orderMap);
+                }
             }
             //迁移排队实绩
             serachMap.put("resultTotalId",maxId);

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

@@ -2143,8 +2143,7 @@
                         and R_CARRIER.CARRIER_SSO_ID = #{carrierSsoId}
                     </if>
                     <if test="remark != null" >
-                        and RSR.SALER_NAME || RCA.CAPACITY_NUMBER || RC.CONSIGNEE_COMPANY_NAME || R_CARRIER.CARRIER_ABBREVIATION || RM.MATERIAL_NAME || RM.MATERIAL_MODEL || RM.MATERIAL_SPECIFICATION
-                        || (CASE WHEN RRA_HISTORY.ADDRESS_PROVINCE is not null
+                        (CASE WHEN RRA_HISTORY.ADDRESS_PROVINCE is not null
                         THEN '新地址:' || RRA.ADDRESS_PROVINCE || RRA.ADDRESS_DISTRICT ||
                         RRA.ADDRESS_TOWN || RRP.ADDRESS_DELIVERY_ADDRESS
                         || ';旧地址:' || RRA_HISTORY.ADDRESS_PROVINCE || RRA_HISTORY.ADDRESS_DISTRICT ||
@@ -3406,6 +3405,7 @@
         ASM.SALE_MATERIAL_ID "saleMaterialId",
         ASOM.SALE_ORDER_MATERIAL_TRUCK_NO "truckNo",
         ASM.MATERIAL_NUMBER "materialNumber",
+        ASM.TRANSFER_IN_OF_WAREHOUSE    "saleRemarkByasm",
         ASM.MATERIAL_NUMBER "materialNum",
         ASM.IS_POUND_SALE   "isPoundSale",
         ADSO.CARRIER_ID     "carrierId",

+ 7 - 2
src/main/resources/com/steerinfo/dil/mapper/TmstruckTotalResultMapper.xml

@@ -140,7 +140,7 @@
             </if>
         </where>
     </sql>
-    <delete id="deleteByPrimaryKey" parameterType="java.lang.Short">
+    <delete id="deleteByPrimaryKey" parameterType="decimal">
         delete from TMSTRUCK_TOTAL_RESULT
         where RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL}
     </delete>
@@ -380,7 +380,7 @@
         </set>
         where RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL}
     </update>
-    <select id="selectByPrimaryKey" parameterType="java.lang.Short" resultMap="BaseResultMap">
+    <select id="selectByPrimaryKey" parameterType="decimal" resultMap="BaseResultMap">
         <include refid="select" />
         where RESULT_TOTAL_ID = #{resultTotalId,jdbcType=DECIMAL}
     </select>
@@ -847,6 +847,7 @@
             AND RESULT_OUT_GATE_TIME IS NOT NULL
         </if>
     </select>
+
     <delete id="deleteEnByEnTotal">
         DELETE FROM TMSTRUCK_ENFACTORY_RESULT WHERE RESULT_TOTAL_ID=#{resultTotalId}
     </delete>
@@ -859,4 +860,8 @@
     <delete id="deleteLeaveByEnTotal">
         DELETE FROM TMSTRUCK_LEAVE_FACTORY_RESULT WHERE RESULT_TOTAL_ID=#{resultTotalId}
     </delete>
+    <select id="selectOrderIdToTotalId" resultType="java.math.BigDecimal" parameterType="java.math.BigDecimal">
+        SELECT TTR.RESULT_TOTAL_ID FROM TMSTRUCK_TOTAL_RESULT TTR
+        WHERE TTR.ORDER_ID = #{orderId}
+    </select>
 </mapper>