|
|
@@ -142,7 +142,7 @@ public class PurchaseContractServiceImpl implements PurchaseContractService {
|
|
142
|
142
|
*/
|
|
143
|
143
|
private Map<String, List<PcContractDtlDto>> buildDtlMap(List<PcContractDtlDto> excel_dtl) {
|
|
144
|
144
|
Map<String, List<PcContractDtlDto>> map = new HashMap<>();
|
|
145
|
|
- if (excel_dtl != null) {
|
|
|
145
|
+ if (excel_dtl != null ) {
|
|
146
|
146
|
for (PcContractDtlDto dtl : excel_dtl) {
|
|
147
|
147
|
if (dtl.getPono() != null && !dtl.getPono().trim().isEmpty()) {
|
|
148
|
148
|
map.computeIfAbsent(dtl.getPono(), k -> new ArrayList<>()).add(dtl);
|
|
|
@@ -265,11 +265,11 @@ public class PurchaseContractServiceImpl implements PurchaseContractService {
|
|
265
|
265
|
String code = mainItem.getSupName().substring(mainItem.getSupName().indexOf("-") + 1);
|
|
266
|
266
|
mainItem.setSupName(code);
|
|
267
|
267
|
GongYingNameList = sysUserMapper.selectByGongYingName(code);
|
|
268
|
|
- if (GongYingNameList != null && !GongYingNameList.isEmpty() && !"2".equals(GongYingNameList.get(0).getPlaced())) {
|
|
|
268
|
+ if (GongYingNameList == null || GongYingNameList.isEmpty() ) {
|
|
269
|
269
|
errorMsg.append("供应商名称没有审批通过; ");
|
|
270
|
270
|
}
|
|
271
|
271
|
if (GongYingNameList != null && !GongYingNameList.isEmpty() && GongYingNameList.get(0).getFno().isEmpty()) {
|
|
272
|
|
- errorMsg.append("供应商代买没有审批通过; ");
|
|
|
272
|
+ errorMsg.append("供应商代码没有审批通过; ");
|
|
273
|
273
|
}
|
|
274
|
274
|
}
|
|
275
|
275
|
if (mainItem.getCurcy() == null || mainItem.getCurcy().trim().isEmpty()) {
|
|
|
@@ -311,11 +311,11 @@ public class PurchaseContractServiceImpl implements PurchaseContractService {
|
|
311
|
311
|
(mainItem.getServiceType() != null && mainItem.getServiceType().contains("主业")))) &&
|
|
312
|
312
|
(mainItem.getLPort() == null || mainItem.getLPort().trim().isEmpty())) {
|
|
313
|
313
|
errorMsg.append("装运港不能为空; ");
|
|
314
|
|
- }else if (mainItem.getLPort() == null && mainItem.getLPort().trim().isEmpty()){
|
|
|
314
|
+ }else if (mainItem.getLPort() != null && !mainItem.getLPort().trim().isEmpty()){
|
|
315
|
315
|
lPortList = custCtrlMapper.selectLPortByLportName(mainItem.getLPort());
|
|
316
|
316
|
if (lPortList == null || lPortList.isEmpty()) {
|
|
317
|
317
|
errorMsg.append("装运港信息有误; ");
|
|
318
|
|
- } else if (lPortList != null && !lPortList.isEmpty() && (lPortList.get(0).getCountryName()== null || lPortList.get(0).getCountryName().isEmpty())) {
|
|
|
318
|
+ } else if (lPortList != null && !lPortList.isEmpty() && (lPortList.get(0).getCountryCnNm()== null || lPortList.get(0).getCountryCnNm().isEmpty())) {
|
|
319
|
319
|
errorMsg.append("装运港维护信息有误; ");
|
|
320
|
320
|
}
|
|
321
|
321
|
}
|
|
|
@@ -325,11 +325,11 @@ public class PurchaseContractServiceImpl implements PurchaseContractService {
|
|
325
|
325
|
(mainItem.getServiceType() != null && mainItem.getServiceType().contains("主业")))) &&
|
|
326
|
326
|
(mainItem.getDPort() == null || mainItem.getDPort().trim().isEmpty())) {
|
|
327
|
327
|
errorMsg.append("目的港不能为空; ");
|
|
328
|
|
- }else if (mainItem.getDPort() == null && mainItem.getDPort().trim().isEmpty()){
|
|
|
328
|
+ }else if (mainItem.getDPort() != null && !mainItem.getDPort().trim().isEmpty()){
|
|
329
|
329
|
dPortList = custCtrlMapper.selectLPortByLportName(mainItem.getDPort());
|
|
330
|
330
|
if (dPortList == null || dPortList.isEmpty()) {
|
|
331
|
331
|
errorMsg.append("目的港信息有误; ");
|
|
332
|
|
- } else if (dPortList != null && !dPortList.isEmpty() && (dPortList.get(0).getCountryName()== null || dPortList.get(0).getCountryName().isEmpty())) {
|
|
|
332
|
+ } else if (dPortList != null && !dPortList.isEmpty() && (dPortList.get(0).getCountryCnNm()== null || dPortList.get(0).getCountryCnNm().isEmpty())) {
|
|
333
|
333
|
errorMsg.append("目的港维护信息有误; ");
|
|
334
|
334
|
}
|
|
335
|
335
|
}
|
|
|
@@ -434,13 +434,13 @@ public class PurchaseContractServiceImpl implements PurchaseContractService {
|
|
434
|
434
|
if (pay.getPayType() == null || pay.getPayType().trim().isEmpty()){
|
|
435
|
435
|
errorMsg.append("付款计划中款项类别不能为空; ");
|
|
436
|
436
|
} else if (pay.getPayType() != null && !pay.getPayType().trim().isEmpty()) {
|
|
437
|
|
- validateSingleDictField(mainItem.getTerms(), "合同计划-款项类型", "合同计划-款项类型", allDicts, errorMsg);
|
|
|
437
|
+ validateSingleDictField(pay.getPayType(), "合同计划-款项类型", "合同计划-款项类型", allDicts, errorMsg);
|
|
438
|
438
|
}
|
|
439
|
439
|
|
|
440
|
440
|
if (pay.getPayMethod() == null || pay.getPayMethod().trim().isEmpty()){
|
|
441
|
441
|
errorMsg.append("付款计划中付款方式不能为空; ");
|
|
442
|
442
|
} else if (pay.getPayMethod() != null && !pay.getPayMethod().trim().isEmpty()) {
|
|
443
|
|
- validateSingleDictField(mainItem.getTerms(), "合同计划-付款方式", "合同计划-付款方式", allDicts, errorMsg);
|
|
|
443
|
+ validateSingleDictField(pay.getPayMethod(), "合同计划-付款方式", "合同计划-付款方式", allDicts, errorMsg);
|
|
444
|
444
|
}
|
|
445
|
445
|
|
|
446
|
446
|
if (pay.getPayDays() == null || pay.getPayDays().toString().trim().isEmpty()){
|
|
|
@@ -522,8 +522,9 @@ public class PurchaseContractServiceImpl implements PurchaseContractService {
|
|
522
|
522
|
contract.setServiceType(mainItem.getServiceType());
|
|
523
|
523
|
contract.setBizType(mainItem.getBizType());
|
|
524
|
524
|
contract.setBizProductType(mainItem.getBizProductType());
|
|
|
525
|
+ contract.setPriceCls(mainItem.getTerms());
|
|
525
|
526
|
//根据查询“我方信息”结果填入部分数据
|
|
526
|
|
- contract.setFoursname(wofangNameList.get(0).getCountryName());
|
|
|
527
|
+ contract.setFoursname(wofangNameList.get(0).getCpny());
|
|
527
|
528
|
contract.setFours(wofangNameList.get(0).getFno());
|
|
528
|
529
|
contract.setOurBankNm(wofangNameList.get(0).getOurBankNm());
|
|
529
|
530
|
contract.setOurBankAcct(wofangNameList.get(0).getOurBankAcct());
|
|
|
@@ -540,7 +541,7 @@ public class PurchaseContractServiceImpl implements PurchaseContractService {
|
|
540
|
541
|
//根据查询到的“币别”信息填入数据
|
|
541
|
542
|
contract.setCurcy(curcyList.get(0).getFname());
|
|
542
|
543
|
contract.setRate(curcyList.get(0).getRate());
|
|
543
|
|
- contract.setRateUsd(curcyList.get(0).getRateUs());
|
|
|
544
|
+ contract.setRateUs(curcyList.get(0).getRateUs());
|
|
544
|
545
|
//根据查询到的“执行人”信息填入数据
|
|
545
|
546
|
contract.setContrExecNm(ZhixingUserByList.get(0).getUserCode());
|
|
546
|
547
|
contract.setContrExecNm(ZhixingUserByList.get(0).getUserDesc());
|
|
|
@@ -585,6 +586,8 @@ public class PurchaseContractServiceImpl implements PurchaseContractService {
|
|
585
|
586
|
contract.setIfBidding("否");
|
|
586
|
587
|
|
|
587
|
588
|
contract.setRemark("期初导入-采购");
|
|
|
589
|
+ contract.setFmodalid(8);
|
|
|
590
|
+ contract.setPlaced("0");
|
|
588
|
591
|
|
|
589
|
592
|
purchaseContracts.add(contract);
|
|
590
|
593
|
|
|
|
@@ -598,11 +601,14 @@ public class PurchaseContractServiceImpl implements PurchaseContractService {
|
|
598
|
601
|
dtl.setSdesc(itemnoList.get(0).getSdesc());
|
|
599
|
602
|
dtl.setBrand(itemnoList.get(0).getBrand());
|
|
600
|
603
|
dtl.setFtype3(dtlDto.getSpec());
|
|
601
|
|
- dtl.setUt(dtl.getUt());
|
|
|
604
|
+ dtl.setUt(dtlDto.getUt());
|
|
602
|
605
|
dtl.setQty(dtlDto.getQty());
|
|
603
|
|
- dtl.setPoPrice(dtl.getPoPrice());
|
|
604
|
|
- dtl.setMoisture(dtl.getMoisture());
|
|
605
|
|
- dtl.setPriceMode(dtl.getPriceMode());
|
|
|
606
|
+ dtl.setPoPrice(dtlDto.getPoprice());
|
|
|
607
|
+ dtl.setMoisture(dtlDto.getMoisture());
|
|
|
608
|
+ dtl.setPriceMtd(dtlDto.getPriceMtd());
|
|
|
609
|
+ dtl.setInputTaxRate(dtlDto.getInTaxRate());
|
|
|
610
|
+ dtl.setIronCont(dtlDto.getIronCont());
|
|
|
611
|
+ dtl.setPoAmt(dtlDto.getPoamt());
|
|
606
|
612
|
|
|
607
|
613
|
pCcontractDtls.add(dtl);
|
|
608
|
614
|
}
|
|
|
@@ -617,8 +623,8 @@ public class PurchaseContractServiceImpl implements PurchaseContractService {
|
|
617
|
623
|
payment.setPayType(payDto.getPayType());
|
|
618
|
624
|
payment.setPayMethod(payDto.getPayMethod());
|
|
619
|
625
|
payment.setPayRatio(payDto.getPayRatio());
|
|
620
|
|
- payment.setPayAmt(payment.getPayAmt());
|
|
621
|
|
- payment.setPayDays(payment.getPayDays());
|
|
|
626
|
+ payment.setPayAmt(String.valueOf(payDto.getPayAmt()));
|
|
|
627
|
+ payment.setPayDays(String.valueOf(payDto.getPayDays()));
|
|
622
|
628
|
pCcontractPayments.add(payment);
|
|
623
|
629
|
}
|
|
624
|
630
|
}
|
|
|
@@ -626,33 +632,35 @@ public class PurchaseContractServiceImpl implements PurchaseContractService {
|
|
626
|
632
|
// 转换责任中心数据
|
|
627
|
633
|
if (rcentList != null) {
|
|
628
|
634
|
for (PcContractRCentDto rcentDto : rcentList) {
|
|
629
|
|
- PCcontractRCenterDtl rcent = convertToPCcontractRCenterDtl(rcentDto);
|
|
|
635
|
+ PCcontractRCenterDtl rcent = new PCcontractRCenterDtl();
|
|
|
636
|
+ rcent.setPono(mainItem.getPono());
|
|
|
637
|
+ rcent.setCreateBy(rcentDto.getCreate_by());
|
|
|
638
|
+ List<SysUser> createByList = sysUserMapper.selectByCreateBy(rcentDto.getCreate_by());
|
|
|
639
|
+ if (createByList != null && !createByList.isEmpty()) {
|
|
|
640
|
+ rcent.setDeptId(createByList.get(0).getDeptCode());
|
|
|
641
|
+ rcent.setDeptName(createByList.get(0).getDeptName());
|
|
|
642
|
+ rcent.setCreateByName(createByList.get(0).getUserDesc());
|
|
|
643
|
+ }
|
|
|
644
|
+ rcent.setAssessQtyRate(rcentDto.getAssessQtyRate());
|
|
|
645
|
+ rcent.setAssessRatio(rcentDto.getAssessRatio());
|
|
630
|
646
|
pCcontractRCenterDtls.add(rcent);
|
|
631
|
647
|
}
|
|
|
648
|
+ }else {
|
|
|
649
|
+ PCcontractRCenterDtl rcent = new PCcontractRCenterDtl();
|
|
|
650
|
+ rcent.setPono(mainItem.getPono());
|
|
|
651
|
+ rcent.setCreateBy(mainItem.getCreate_by());
|
|
|
652
|
+ List<SysUser> createByList = sysUserMapper.selectByCreateBy(mainItem.getCreate_by());
|
|
|
653
|
+ if (createByList != null && !createByList.isEmpty()) {
|
|
|
654
|
+ rcent.setDeptId(createByList.get(0).getDeptCode());
|
|
|
655
|
+ rcent.setDeptName(createByList.get(0).getDeptName());
|
|
|
656
|
+ rcent.setCreateByName(createByList.get(0).getUserDesc());
|
|
|
657
|
+ }
|
|
|
658
|
+ rcent.setAssessQtyRate(new BigDecimal(100));
|
|
|
659
|
+ rcent.setAssessRatio(new BigDecimal(100));
|
|
|
660
|
+ pCcontractRCenterDtls.add(rcent);
|
|
632
|
661
|
}
|
|
633
|
662
|
}
|
|
634
|
663
|
|
|
635
|
|
-
|
|
636
|
|
- /**
|
|
637
|
|
- * 转换付款计划数据
|
|
638
|
|
- */
|
|
639
|
|
- private PCcontractPayment convertToPCcontractPayment(PcContractPayDto dto) {
|
|
640
|
|
- PCcontractPayment payment = new PCcontractPayment();
|
|
641
|
|
-
|
|
642
|
|
-
|
|
643
|
|
- return payment;
|
|
644
|
|
- }
|
|
645
|
|
-
|
|
646
|
|
- /**
|
|
647
|
|
- * 转换责任中心数据
|
|
648
|
|
- */
|
|
649
|
|
- private PCcontractRCenterDtl convertToPCcontractRCenterDtl(PcContractRCentDto dto) {
|
|
650
|
|
- PCcontractRCenterDtl rcent = new PCcontractRCenterDtl();
|
|
651
|
|
-
|
|
652
|
|
-
|
|
653
|
|
- return rcent;
|
|
654
|
|
- }
|
|
655
|
|
-
|
|
656
|
664
|
/**
|
|
657
|
665
|
* 创建合同错误信息对象
|
|
658
|
666
|
*/
|
|
|
@@ -741,7 +749,7 @@ public class PurchaseContractServiceImpl implements PurchaseContractService {
|
|
741
|
749
|
private void saveContractDetails(String mainId, List<PCcontractDtl> dtlList, String pono) {
|
|
742
|
750
|
for (PCcontractDtl dtl : dtlList) {
|
|
743
|
751
|
if (pono.equals(dtl.getPono())) {
|
|
744
|
|
- dtl.setRid(mainId);
|
|
|
752
|
+ dtl.setRrid(mainId);
|
|
745
|
753
|
pCcontractDtlMapper.insert(dtl);
|
|
746
|
754
|
}
|
|
747
|
755
|
}
|