|
@@ -45,6 +45,8 @@ public class OutServiceImpl implements OutService {
|
45
|
45
|
@Autowired
|
46
|
46
|
public DistributionMapper distributionMapper;
|
47
|
47
|
@Autowired
|
|
48
|
+ public DistributionDetailMapper distributionDetailMapper;
|
|
49
|
+ @Autowired
|
48
|
50
|
public AccountDetailMapper accountDetailMapper;
|
49
|
51
|
@Autowired
|
50
|
52
|
public ChangeRecordMapper changeRecordMapper;
|
|
@@ -117,8 +119,11 @@ public class OutServiceImpl implements OutService {
|
117
|
119
|
store.setLayer(currentLayer + 1);
|
118
|
120
|
//store.setStack(stack);
|
119
|
121
|
OutRecord outRecord = getOutRecord(store, "", "0", userId);
|
|
122
|
+ //取消出库之后配车明细中进行删除
|
|
123
|
+ num += distributionDetailMapper.updateByStoreAndDis(listOutRecord.get(i).getDistributionId(),store.getId());
|
120
|
124
|
num += outRecordMapper.insert(outRecord);
|
121
|
125
|
num += storeMapper.insert(store);
|
|
126
|
+
|
122
|
127
|
Distribution distribution = distributionMapper.selectByPrimaryKey(listOutRecord.get(i).getDistributionId());
|
123
|
128
|
distribution.setSumWeight(distribution.getSumWeight()- store.getWeight());
|
124
|
129
|
distribution.setSumCount(distribution.getSumCount()- store.getCount());
|
|
@@ -135,6 +140,8 @@ public class OutServiceImpl implements OutService {
|
135
|
140
|
public String outByDistribution(String json, String userId, String belongId) throws Exception {
|
136
|
141
|
Distribution distribution1 = JSON.parseObject(json, new TypeReference<Distribution>() {
|
137
|
142
|
});
|
|
143
|
+ String pay_for = "";
|
|
144
|
+ double pay_money = 0;
|
138
|
145
|
Distribution distribution = distributionMapper.selectByPrimaryKey(distribution1.getId());
|
139
|
146
|
if (distribution.getOutFlag().equals("1")){
|
140
|
147
|
return JSONTools.toString(1,"该车已出库,请勿重复操作");
|
|
@@ -164,6 +171,10 @@ public class OutServiceImpl implements OutService {
|
164
|
171
|
for (int i = 0; i < listStore.size(); i++) {
|
165
|
172
|
Store store = storeMapper.selectByPrimaryKey(listStore.get(i).getId());
|
166
|
173
|
OutRecord outRecord = getOutRecord(store, distribution.getId(), "1", userId);
|
|
174
|
+ if (outRecord.getPayWay().equals("现金")){
|
|
175
|
+ pay_for="现金";
|
|
176
|
+ pay_money = pay_money+outRecord.getInvoicePrice();
|
|
177
|
+ }
|
167
|
178
|
num += outRecordMapper.insert(outRecord);
|
168
|
179
|
AccountDetail accountDetail = getAccountDetail(listStore.get(i), distribution.getSumWeight(), distribution.getSuttle(), userId, belongId);
|
169
|
180
|
num += accountDetailMapper.insert(accountDetail);
|
|
@@ -180,6 +191,10 @@ public class OutServiceImpl implements OutService {
|
180
|
191
|
for (int i = 0; i < listStore.size(); i++) {
|
181
|
192
|
Store store = storeMapper.selectByPrimaryKey(listStore.get(i).getId());
|
182
|
193
|
OutRecord outRecord = getOutRecord(store, distribution.getId(), "1", userId);
|
|
194
|
+ if (outRecord.getPayWay().equals("现金")){
|
|
195
|
+ pay_for="现金";
|
|
196
|
+ pay_money = pay_money+outRecord.getInvoicePrice();
|
|
197
|
+ }
|
183
|
198
|
num += outRecordMapper.insert(outRecord);
|
184
|
199
|
|
185
|
200
|
AccountDetail accountDetail = getAccountDetail(listStore.get(i), distribution.getSumWeight(), distribution.getSuttle(), userId, belongId);
|
|
@@ -193,6 +208,11 @@ public class OutServiceImpl implements OutService {
|
193
|
208
|
result = Tools.moreThanZeroResultJSON(num);
|
194
|
209
|
}
|
195
|
210
|
}
|
|
211
|
+
|
|
212
|
+ }
|
|
213
|
+ if (pay_for.equals("现金")){
|
|
214
|
+ result = result.substring(0, result.length() - 1) + ",\"payWay\":\"" + pay_for + "\",\"InvoicePrice\":" + pay_money + "}";
|
|
215
|
+
|
196
|
216
|
}
|
197
|
217
|
|
198
|
218
|
return result;
|