|
@@ -6,11 +6,13 @@ import com.github.pagehelper.PageHelper;
|
6
|
6
|
import com.github.pagehelper.PageInfo;
|
7
|
7
|
import com.th.demo.mapping.maint.CustomerMapper;
|
8
|
8
|
import com.th.demo.mapping.ware.ChangeRecordMapper;
|
|
9
|
+import com.th.demo.mapping.ware.InRecordMapper;
|
9
|
10
|
import com.th.demo.mapping.ware.StoreMapper;
|
10
|
11
|
import com.th.demo.model.maint.Customer;
|
11
|
12
|
import com.th.demo.model.maint.Stack;
|
12
|
13
|
import com.th.demo.model.system.Type;
|
13
|
14
|
import com.th.demo.model.ware.ChangeRecord;
|
|
15
|
+import com.th.demo.model.ware.InRecord;
|
14
|
16
|
import com.th.demo.model.ware.SplitRecord;
|
15
|
17
|
import com.th.demo.model.ware.Store;
|
16
|
18
|
import com.th.demo.service.maint.CustomerService;
|
|
@@ -33,6 +35,10 @@ public class StoreServiceImpl implements StoreService {
|
33
|
35
|
public ChangeRecordMapper changeRecordMapper;
|
34
|
36
|
@Autowired//自动注入Mapper
|
35
|
37
|
public StoreMapper storeMapper;
|
|
38
|
+ @Autowired//自动注入Mapper
|
|
39
|
+ public CustomerMapper customerMapper;
|
|
40
|
+ @Autowired//自动注入Mapper
|
|
41
|
+ public InRecordMapper inRecordMapper;
|
36
|
42
|
String result = Type.FAIL;
|
37
|
43
|
int num = 0;
|
38
|
44
|
|
|
@@ -242,4 +248,89 @@ public class StoreServiceImpl implements StoreService {
|
242
|
248
|
// return result;
|
243
|
249
|
//
|
244
|
250
|
// }
|
|
251
|
+ @Override
|
|
252
|
+ public String changeAll(String json,
|
|
253
|
+ String newCustomername,
|
|
254
|
+ String newFKCustomername,
|
|
255
|
+ String newContractno,
|
|
256
|
+ String newOrdno,
|
|
257
|
+ String newReceiveaddress,
|
|
258
|
+ String newProductionplace,
|
|
259
|
+ String newPackno,
|
|
260
|
+ String userId,
|
|
261
|
+ String belongId) {
|
|
262
|
+ List<Store> list = JSON.parseObject(json, new TypeReference<List<Store>>() {
|
|
263
|
+ });
|
|
264
|
+ Customer customer = new Customer();
|
|
265
|
+ Customer kfcustomer = new Customer();
|
|
266
|
+ if(newCustomername != null && !newCustomername.equals("")){
|
|
267
|
+ customer = customerMapper.selectByName(newCustomername,belongId);
|
|
268
|
+
|
|
269
|
+ }
|
|
270
|
+
|
|
271
|
+ if(newFKCustomername != null && !newFKCustomername.equals("")){
|
|
272
|
+ kfcustomer = customerMapper.selectByName(newFKCustomername,belongId);
|
|
273
|
+
|
|
274
|
+ }
|
|
275
|
+
|
|
276
|
+ for(int i = 0; i < list.size(); i++){
|
|
277
|
+ InRecord inRecord = inRecordMapper.selectByPrimaryKey(list.get(i).getInId());
|
|
278
|
+ if (newCustomername != null && !newCustomername.equals("")){
|
|
279
|
+ list.get(i).setCustomer(customer);
|
|
280
|
+ inRecord.setCustomerName(newCustomername);
|
|
281
|
+ }
|
|
282
|
+ if(newFKCustomername != null && !newFKCustomername.equals("")){
|
|
283
|
+ list.get(i).setFkComponyId(kfcustomer.getId());
|
|
284
|
+ num += storeMapper.updateFKByPKey(list.get(i));
|
|
285
|
+ inRecord.setFkComponyName(kfcustomer.getId());
|
|
286
|
+ }
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+ if (newContractno != null && !newContractno.equals("")){
|
|
290
|
+ list.get(i).setContractNo(newContractno);
|
|
291
|
+ inRecord.setContractNo(newContractno);
|
|
292
|
+ } else if (newContractno.equals("0")) {
|
|
293
|
+ list.get(i).setContractNo("");
|
|
294
|
+ inRecord.setContractNo("");
|
|
295
|
+ }
|
|
296
|
+
|
|
297
|
+ if (newOrdno != null && !newOrdno.equals("")){
|
|
298
|
+ list.get(i).setOrdNo(newOrdno);
|
|
299
|
+ inRecord.setOrdNo(newOrdno);
|
|
300
|
+ } else if (newOrdno.equals("0")) {
|
|
301
|
+ list.get(i).setOrdNo("");
|
|
302
|
+ inRecord.setOrdNo("");
|
|
303
|
+ }
|
|
304
|
+
|
|
305
|
+ if (newReceiveaddress != null && !newReceiveaddress.equals("")){
|
|
306
|
+ list.get(i).setReceiveAddress(newReceiveaddress);
|
|
307
|
+ inRecord.setReceiveAddress(newReceiveaddress);
|
|
308
|
+ } else if (newReceiveaddress.equals("0")) {
|
|
309
|
+ list.get(i).setReceiveAddress("");
|
|
310
|
+ inRecord.setReceiveAddress("");
|
|
311
|
+ }
|
|
312
|
+
|
|
313
|
+ if (newProductionplace != null && !newProductionplace.equals("")){
|
|
314
|
+ list.get(i).setProductionPlace(newProductionplace);
|
|
315
|
+ inRecord.setProductionPlace(newProductionplace);
|
|
316
|
+ } else if (newProductionplace.equals("0")) {
|
|
317
|
+ list.get(i).setProductionPlace("");
|
|
318
|
+ inRecord.setProductionPlace("");
|
|
319
|
+ }
|
|
320
|
+
|
|
321
|
+ if (newPackno != null && !newPackno.equals("")){
|
|
322
|
+ list.get(i).setPackNo(newPackno);
|
|
323
|
+ inRecord.setPackNo(newPackno);
|
|
324
|
+ } else if (newPackno.equals("0")) {
|
|
325
|
+ list.get(i).setPackNo("");
|
|
326
|
+ inRecord.setPackNo("");
|
|
327
|
+ }
|
|
328
|
+ num += storeMapper.updateByPrimaryKey(list.get(i));
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+ num += inRecordMapper.updateIn(inRecord);
|
|
332
|
+
|
|
333
|
+ }
|
|
334
|
+ return Tools.moreThanZeroResultJSON(num);
|
|
335
|
+ }
|
245
|
336
|
}
|