YL2767 il y a 3 semaines
Parent
révision
572707dc48

+ 2
- 0
src/main/java/com/th/demo/mapping/ware/DistributionDetailMapper.java Voir le fichier

21
    List<DistributionDetail> selectByFid(String distributionId);
21
    List<DistributionDetail> selectByFid(String distributionId);
22
 
22
 
23
     int updateCancelFlagById(Map<String,Object> map);
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 Voir le fichier

49
     public PriceMapper priceMapper;
49
     public PriceMapper priceMapper;
50
     @Autowired
50
     @Autowired
51
     public InRecordMapper inRecordMapper;
51
     public InRecordMapper inRecordMapper;
52
+    @Autowired
53
+    public DistributionDetailMapper distributionDetailMapper;
52
 
54
 
53
     String result = Type.FAIL;
55
     String result = Type.FAIL;
54
     int num = 0;
56
     int num = 0;
115
                 OutRecord outRecord = getOutRecord(store, "", "0", userId);
117
                 OutRecord outRecord = getOutRecord(store, "", "0", userId);
116
                 num += outRecordMapper.insert(outRecord);
118
                 num += outRecordMapper.insert(outRecord);
117
                 num += storeMapper.insert(store);
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
             result = Tools.moreThanZeroResultJSON(num);
127
             result = Tools.moreThanZeroResultJSON(num);
120
         } else {
128
         } else {
131
                 OutRecord outRecord = getOutRecord(store, "", "0", userId);
139
                 OutRecord outRecord = getOutRecord(store, "", "0", userId);
132
                 num += outRecordMapper.insert(outRecord);
140
                 num += outRecordMapper.insert(outRecord);
133
                 num += storeMapper.insert(store);
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
             result = Tools.moreThanZeroResultJSON(num);
149
             result = Tools.moreThanZeroResultJSON(num);
136
         }
150
         }

+ 5
- 0
src/main/resource/mapper/ware/DistributionDetailMapper.xml Voir le fichier

114
     where distribution_id = #{param1,jdbcType=VARCHAR}
114
     where distribution_id = #{param1,jdbcType=VARCHAR}
115
     and ifnull(cancel_flag,'0') = '0'
115
     and ifnull(cancel_flag,'0') = '0'
116
   </select>
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
 </mapper>
123
 </mapper>

Loading…
Annuler
Enregistrer