YL2767 hace 3 semanas
padre
commit
572707dc48

+ 2
- 0
src/main/java/com/th/demo/mapping/ware/DistributionDetailMapper.java Ver fichero

@@ -21,4 +21,6 @@ public interface DistributionDetailMapper {
21 21
    List<DistributionDetail> selectByFid(String distributionId);
22 22
 
23 23
     int updateCancelFlagById(Map<String,Object> map);
24
+
25
+    int deleteByStoreAndDis(String distributionId,String StoreId);
24 26
 }

+ 14
- 0
src/main/java/com/th/demo/service/impl/ware/OutServiceImpl.java Ver fichero

@@ -49,6 +49,8 @@ public class OutServiceImpl implements OutService {
49 49
     public PriceMapper priceMapper;
50 50
     @Autowired
51 51
     public InRecordMapper inRecordMapper;
52
+    @Autowired
53
+    public DistributionDetailMapper distributionDetailMapper;
52 54
 
53 55
     String result = Type.FAIL;
54 56
     int num = 0;
@@ -115,6 +117,12 @@ public class OutServiceImpl implements OutService {
115 117
                 OutRecord outRecord = getOutRecord(store, "", "0", userId);
116 118
                 num += outRecordMapper.insert(outRecord);
117 119
                 num += storeMapper.insert(store);
120
+
121
+                Distribution distribution = distributionMapper.selectByPrimaryKey(listOutRecord.get(i).getDistributionId());
122
+                distribution.setSumWeight(distribution.getSumWeight() - store.getWeight());
123
+                distribution.setSumCount(distribution.getSumCount() - store.getCount());
124
+                num = distributionMapper.updateByPrimaryKey(distribution);
125
+                num = distributionDetailMapper.deleteByStoreAndDis(distribution.getId(),store.getId());
118 126
             }
119 127
             result = Tools.moreThanZeroResultJSON(num);
120 128
         } else {
@@ -131,6 +139,12 @@ public class OutServiceImpl implements OutService {
131 139
                 OutRecord outRecord = getOutRecord(store, "", "0", userId);
132 140
                 num += outRecordMapper.insert(outRecord);
133 141
                 num += storeMapper.insert(store);
142
+
143
+                Distribution distribution = distributionMapper.selectByPrimaryKey(listOutRecord.get(i).getDistributionId());
144
+                distribution.setSumWeight(distribution.getSumWeight() - store.getWeight());
145
+                distribution.setSumCount(distribution.getSumCount() - store.getCount());
146
+                num = distributionMapper.updateByPrimaryKey(distribution);
147
+                num = distributionDetailMapper.deleteByStoreAndDis(distribution.getId(),store.getId());
134 148
             }
135 149
             result = Tools.moreThanZeroResultJSON(num);
136 150
         }

+ 5
- 0
src/main/resource/mapper/ware/DistributionDetailMapper.xml Ver fichero

@@ -114,5 +114,10 @@
114 114
     where distribution_id = #{param1,jdbcType=VARCHAR}
115 115
     and ifnull(cancel_flag,'0') = '0'
116 116
   </select>
117
+  <update id="deleteByStoreAndDis" >
118
+    update t_ware_distribution_detail set cancel_flag = '9'
119
+    where distribution_id = #{param1,jdbcType=VARCHAR}
120
+    and store_id = #{param2,jdbcType=VARCHAR}
121
+  </update>
117 122
 
118 123
 </mapper>

Loading…
Cancelar
Guardar