|
@@ -423,137 +423,69 @@ public class InServiceImpl implements InService {
|
423
|
423
|
private List<Store> objToStore(List<JSONObject> listJO, String userId, String belongId) throws Exception {
|
424
|
424
|
String err = Type.SUCCESS;
|
425
|
425
|
List<Store> listStore = new ArrayList<>();
|
426
|
|
- String wareName = listJO.get(0).get("仓库名称").toString();
|
427
|
|
- String stackName = listJO.get(0).get("垛位号").toString();
|
428
|
|
- String materialName = listJO.get(0).get("品名").toString();
|
429
|
|
- String standard = listJO.get(0).get("钢种").toString();
|
430
|
|
- String customerName = listJO.get(0).get("客户名称").toString();
|
431
|
|
- String fk_compony_name = listJO.get(0).get("货权单位").toString();
|
432
|
|
- //验证信息增加多条信息验证
|
433
|
|
- Ware ware = wareMapper.selectByWareName(wareName, userId, belongId);
|
434
|
|
- if (ware == null) {
|
435
|
|
- err += "未找到名为\"" + wareName + "\"的库房;";
|
436
|
|
- throw new Exception(err);
|
437
|
|
- }
|
438
|
|
- Stack stack = stackMapper.selectByWareNameStackName(wareName, stackName, userId, belongId);
|
439
|
|
- if (stack == null) {
|
440
|
|
- err += "未找到名为\"" + stackName + "\"的垛位号;";
|
441
|
|
- throw new Exception(err);
|
442
|
|
- }
|
443
|
|
- // 将传入的材料品名和钢种进行校验
|
444
|
|
- Material material = new Material();
|
445
|
|
- List<Material> materialList = materialMapper.selectListByNameStandard(materialName, standard, belongId);
|
446
|
|
- if (materialList.size() == 0 ){
|
447
|
|
- err += "未找到名为\"" + materialName + "," + standard + "\"的物料类型;";
|
448
|
|
- throw new Exception(err);
|
449
|
|
- } else if (materialList.size() > 1) {
|
450
|
|
- err += "名为\"" + materialName + "," + standard + "\"的物料类型维护多条;";
|
451
|
|
- throw new Exception(err);
|
452
|
|
- }else {
|
453
|
|
- material= materialList.get(0);
|
454
|
|
- }
|
455
|
|
-
|
456
|
|
- // 将传入的客户名称进行校验
|
457
|
|
- Customer customer = new Customer();
|
458
|
|
- List<Customer> customerList = customerMapper.selectByNameCode(customerName,customerName,belongId);
|
459
|
|
- if (customerList.size() == 0){
|
460
|
|
- err += "未找到全名或简称为\"" + customerName + "\"的客户名称;";
|
461
|
|
- throw new Exception(err);
|
462
|
|
- } else if (customerList.size() > 1) {
|
463
|
|
- err += "全名或简称为\"" + customerName + "\"的客户名称维护多条;";
|
464
|
|
- throw new Exception(err);
|
465
|
|
- }else{
|
466
|
|
- customer = customerList.get(0);
|
467
|
|
- }
|
468
|
|
-
|
469
|
|
- // 将传入的客户名称进行校验
|
470
|
|
- Customer fk_compony = new Customer();
|
471
|
|
- List<Customer> customerList2 = customerMapper.selectByNameCode(fk_compony_name,fk_compony_name,belongId);
|
472
|
|
- if (customerList2.size() == 0){
|
473
|
|
- err += "未找到全名或简称为\"" + fk_compony_name + "\"的客户名称;";
|
474
|
|
- throw new Exception(err);
|
475
|
|
- } else if (customerList2.size() > 1) {
|
476
|
|
- err += "全名或简称为\"" + fk_compony_name + "\"的客户名称维护多条;";
|
477
|
|
- throw new Exception(err);
|
478
|
|
- }else{
|
479
|
|
- fk_compony = customerList2.get(0);
|
480
|
|
- }
|
|
426
|
+ String wareName = ""; Ware ware = new Ware();
|
|
427
|
+ String stackName = "";Stack stack = new Stack();
|
|
428
|
+ String materialName = ""; String standard = ""; List<Material> materialList;
|
481
|
429
|
|
482
|
|
-// //检查入库操作人
|
483
|
|
-// SysUser sysUser = new SysUser();
|
484
|
|
-// List<SysUser> sysUserList = sysUserMapper.selectUser(addUserName,"");
|
|
430
|
+ String customerName = "";List<Customer> customerList;
|
|
431
|
+ String fk_compony_name = "";List<Customer> customerList2;
|
485
|
432
|
|
486
|
433
|
for (int i = 0; i < listJO.size(); i++) {
|
487
|
434
|
Store store = new Store();
|
488
|
|
- if (listJO.get(i).get("仓库名称").toString().equals(wareName)) {
|
489
|
|
- store.setWare(ware);
|
490
|
|
- } else {
|
491
|
|
- wareName = listJO.get(i).get("仓库名称").toString();
|
492
|
|
- ware = wareMapper.selectByWareName(wareName, userId, belongId);
|
493
|
|
- if (ware == null) {
|
494
|
|
- err += "未找到名为\"" + wareName + "\"的仓库名称;";
|
495
|
|
- throw new Exception(err);
|
496
|
|
- }
|
|
435
|
+ wareName = listJO.get(i).get("仓库名称").toString();
|
|
436
|
+ ware = wareMapper.selectByWareName(wareName, userId, belongId);
|
|
437
|
+ if (ware == null) {
|
|
438
|
+ err += "未找到名为\"" + wareName + "\"的仓库名称;";
|
|
439
|
+ throw new Exception(err);
|
|
440
|
+ }else {
|
497
|
441
|
store.setWare(ware);
|
498
|
442
|
}
|
499
|
|
- if (listJO.get(i).get("垛位号").toString().equals(stackName)) {
|
500
|
|
- store.setStack(stack);
|
501
|
|
- } else {
|
502
|
|
- stackName = listJO.get(i).get("垛位号").toString();
|
503
|
|
- stack = stackMapper.selectByWareNameStackName(wareName, stackName, userId, belongId);
|
504
|
|
- if (stack == null) {
|
505
|
|
- err += "未找到名为\"" + stackName + "\"的垛位号;";
|
506
|
|
- throw new Exception(err);
|
507
|
|
- }
|
|
443
|
+
|
|
444
|
+ stackName = listJO.get(i).get("垛位号").toString();
|
|
445
|
+ stack = stackMapper.selectByWareNameStackName(wareName, stackName, userId, belongId);
|
|
446
|
+ if (stack == null) {
|
|
447
|
+ err += "未找到名为\"" + stackName + "\"的垛位号;";
|
|
448
|
+ throw new Exception(err);
|
|
449
|
+ }else {
|
508
|
450
|
store.setStack(stack);
|
509
|
451
|
}
|
510
|
|
- if (listJO.get(i).get("品名").toString().equals(materialName) && listJO.get(i).get("钢种").toString().equals(standard)) {
|
511
|
|
- store.setMaterial(material);
|
512
|
|
- } else {
|
513
|
|
- materialList = materialMapper.selectListByNameStandard(listJO.get(i).get("品名").toString(), listJO.get(i).get("钢种").toString(), belongId);
|
514
|
|
- if (materialList.size() == 0 ){
|
515
|
|
- err += "未找到名为\"" + listJO.get(i).get("品名").toString() + "," + listJO.get(i).get("钢种").toString() + "\"的物料类型;";
|
516
|
|
- throw new Exception(err);
|
517
|
|
- } else if (materialList.size() > 1) {
|
518
|
|
- err += "名为\"" + listJO.get(i).get("品名").toString() + "," + listJO.get(i).get("钢种").toString() + "\"的物料类型维护多条;";
|
519
|
|
- throw new Exception(err);
|
520
|
|
- }else {
|
521
|
|
- store.setMaterial(materialList.get(0));
|
522
|
|
- }
|
523
|
|
- }
|
524
|
452
|
|
525
|
|
- if (listJO.get(i).get("客户名称").toString().equals(customerName)) {
|
526
|
|
- store.setCustomer(customer);
|
527
|
|
- } else {
|
528
|
|
- customerName = listJO.get(i).get("客户名称").toString();
|
529
|
|
- customerList = customerMapper.selectByNameCode(customerName,customerName,belongId);
|
530
|
|
- if (customerList.size() == 0){
|
531
|
|
- err += "未找到全名或简称为\"" + customerName + "\"的客户名称;";
|
532
|
|
- throw new Exception(err);
|
533
|
|
- } else if (customerList.size() > 1) {
|
534
|
|
- err += "全名或简称为\"" + customerName + "\"的客户名称维护多条;";
|
535
|
|
- throw new Exception(err);
|
536
|
|
- }else{
|
537
|
|
- store.setCustomer(customerList.get(0));
|
538
|
|
- }
|
|
453
|
+
|
|
454
|
+ materialList = materialMapper.selectListByNameStandard(listJO.get(i).get("品名").toString(), listJO.get(i).get("钢种").toString(), belongId);
|
|
455
|
+ if (materialList.size() == 0 ){
|
|
456
|
+ err += "未找到名为\"" + listJO.get(i).get("品名").toString() + "," + listJO.get(i).get("钢种").toString() + "\"的物料类型;";
|
|
457
|
+ throw new Exception(err);
|
|
458
|
+ } else if (materialList.size() > 1) {
|
|
459
|
+ err += "名为\"" + listJO.get(i).get("品名").toString() + "," + listJO.get(i).get("钢种").toString() + "\"的物料类型维护多条;";
|
|
460
|
+ throw new Exception(err);
|
|
461
|
+ }else {
|
|
462
|
+ store.setMaterial(materialList.get(0));
|
539
|
463
|
}
|
540
|
464
|
|
541
|
|
- if (listJO.get(i).get("货权单位").toString().equals(fk_compony_name)) {
|
542
|
|
- store.setFkComponyId(fk_compony.getId());
|
543
|
|
- } else {
|
544
|
|
- fk_compony_name = listJO.get(i).get("货权单位").toString();
|
545
|
|
- customerList2 = customerMapper.selectByNameCode(fk_compony_name,fk_compony_name,belongId);
|
546
|
|
- if (customerList2.size() == 0){
|
547
|
|
- err += "未找到全名或简称为\"" + fk_compony_name + "\"的客户名称;";
|
548
|
|
- throw new Exception(err);
|
549
|
|
- } else if (customerList2.size() > 1) {
|
550
|
|
- err += "全名或简称为\"" + fk_compony_name + "\"的客户名称维护多条;";
|
551
|
|
- throw new Exception(err);
|
552
|
|
- }else {
|
553
|
|
- store.setFkComponyId(customerList2.get(0).getId());
|
554
|
|
- }
|
|
465
|
+ customerName = listJO.get(i).get("客户名称").toString();
|
|
466
|
+ customerList = customerMapper.selectByNameCode(customerName,customerName,belongId);
|
|
467
|
+ if (customerList.size() == 0){
|
|
468
|
+ err += "未找到全名或简称为\"" + customerName + "\"的客户名称;";
|
|
469
|
+ throw new Exception(err);
|
|
470
|
+ } else if (customerList.size() > 1) {
|
|
471
|
+ err += "全名或简称为\"" + customerName + "\"的客户名称维护多条;";
|
|
472
|
+ throw new Exception(err);
|
|
473
|
+ }else{
|
|
474
|
+ store.setCustomer(customerList.get(0));
|
|
475
|
+ }
|
555
|
476
|
|
|
477
|
+ fk_compony_name = listJO.get(i).get("货权单位").toString();
|
|
478
|
+ customerList2 = customerMapper.selectByNameCode(fk_compony_name,fk_compony_name,belongId);
|
|
479
|
+ if (customerList2.size() == 0){
|
|
480
|
+ err += "未找到全名或简称为\"" + fk_compony_name + "\"的客户名称;";
|
|
481
|
+ throw new Exception(err);
|
|
482
|
+ } else if (customerList2.size() > 1) {
|
|
483
|
+ err += "全名或简称为\"" + fk_compony_name + "\"的客户名称维护多条;";
|
|
484
|
+ throw new Exception(err);
|
|
485
|
+ }else {
|
|
486
|
+ store.setFkComponyId(customerList2.get(0).getId());
|
556
|
487
|
}
|
|
488
|
+
|
557
|
489
|
store.setLayer(Integer.parseInt(listJO.get(i).get("层号").toString()));
|
558
|
490
|
store.setPlateNo(listJO.get(i).get("产品编号").toString());
|
559
|
491
|
store.setModel(listJO.get(i).get("规格型号").toString());
|
|
@@ -581,11 +513,16 @@ public class InServiceImpl implements InService {
|
581
|
513
|
}
|
582
|
514
|
if(listJO.get(i).get("合约号") != null && !listJO.get(i).get("合约号").toString().equals("")){
|
583
|
515
|
store.setContractNo(listJO.get(i).get("合约号").toString());
|
|
516
|
+ }else {
|
|
517
|
+ store.setContractNo("");
|
584
|
518
|
}
|
585
|
519
|
|
586
|
520
|
if(listJO.get(i).get("订单号") != null && !listJO.get(i).get("订单号").toString().equals("")){
|
587
|
521
|
store.setOrdNo(listJO.get(i).get("订单号").toString());
|
|
522
|
+ }else {
|
|
523
|
+ store.setOrdNo("");
|
588
|
524
|
}
|
|
525
|
+
|
589
|
526
|
if(listJO.get(i).get("入库车号") != null && !listJO.get(i).get("入库车号").toString().equals("")){
|
590
|
527
|
store.setCarNo(listJO.get(i).get("入库车号").toString());
|
591
|
528
|
}
|
|
@@ -594,6 +531,8 @@ public class InServiceImpl implements InService {
|
594
|
531
|
}
|
595
|
532
|
if(listJO.get(i).get("捆包号") != null && !listJO.get(i).get("捆包号").toString().equals("")){
|
596
|
533
|
store.setPackNo(listJO.get(i).get("捆包号").toString());
|
|
534
|
+ }else {
|
|
535
|
+ store.setPackNo("");
|
597
|
536
|
}
|
598
|
537
|
listStore.add(store);
|
599
|
538
|
}
|