|
@@ -10,6 +10,9 @@ import com.google.gson.GsonBuilder;
|
|
|
import lombok.extern.log4j.Log4j;
|
|
import lombok.extern.log4j.Log4j;
|
|
|
import lombok.extern.log4j.Log4j2;
|
|
import lombok.extern.log4j.Log4j2;
|
|
|
import org.apache.commons.lang.StringEscapeUtils;
|
|
import org.apache.commons.lang.StringEscapeUtils;
|
|
|
|
|
+import org.jeecg.common.util.oConvertUtils;
|
|
|
|
|
+import org.jeecg.modules.documents.failDocument.entity.SyFailDocument;
|
|
|
|
|
+import org.jeecg.modules.documents.failDocument.service.ISyFailDocumentService;
|
|
|
import org.jeecg.modules.openApi.entity.DxpDataPlan;
|
|
import org.jeecg.modules.openApi.entity.DxpDataPlan;
|
|
|
import org.jeecg.modules.openApi.service.IDxpDataPlanService;
|
|
import org.jeecg.modules.openApi.service.IDxpDataPlanService;
|
|
|
import org.jeecg.modules.openApi.service.ISenYuDataSourceOne;
|
|
import org.jeecg.modules.openApi.service.ISenYuDataSourceOne;
|
|
@@ -18,6 +21,7 @@ import org.jeecg.modules.openApi.service.ISenYuDataSourceTwo;
|
|
|
import org.jeecg.modules.system.util.InterfaceConnUtils;
|
|
import org.jeecg.modules.system.util.InterfaceConnUtils;
|
|
|
import org.jeecg.modules.system.util.JsonChangeUtils;
|
|
import org.jeecg.modules.system.util.JsonChangeUtils;
|
|
|
import org.springframework.beans.BeansException;
|
|
import org.springframework.beans.BeansException;
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.ApplicationContext;
|
|
import org.springframework.context.ApplicationContext;
|
|
|
import org.springframework.context.ApplicationContextAware;
|
|
import org.springframework.context.ApplicationContextAware;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
@@ -43,6 +47,8 @@ public class POPomainController implements ApplicationContextAware {
|
|
|
private static ISenYuDataSourceTwo senYuDataSourceTwo;
|
|
private static ISenYuDataSourceTwo senYuDataSourceTwo;
|
|
|
//数据源one
|
|
//数据源one
|
|
|
private static ISenYuDataSourceThree iSenYuDataSourceThree;
|
|
private static ISenYuDataSourceThree iSenYuDataSourceThree;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ISyFailDocumentService iSyFailDocumentService;
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping(value = "/QueryPoMain")
|
|
@PostMapping(value = "/QueryPoMain")
|
|
@@ -84,12 +90,12 @@ public class POPomainController implements ApplicationContextAware {
|
|
|
//ven.cVenName,mo.cVenCode mo.cPersonCode as salerId,hr.cPsn_Num as 'buyerId',
|
|
//ven.cVenName,mo.cVenCode mo.cPersonCode as salerId,hr.cPsn_Num as 'buyerId',
|
|
|
//cAuditTime>'"+lasttimeSf+"' and mo.iverifystateex = 2
|
|
//cAuditTime>'"+lasttimeSf+"' and mo.iverifystateex = 2
|
|
|
String sql = "select mo.POID as 'moId','"+ac+"' as accId,'"+pkorgValue[0]+"' as pkorg,mo.cState as 'poStatus',mo.cPOID as 'poNum','STANDARD_PO' as 'poType'," +
|
|
String sql = "select mo.POID as 'moId','"+ac+"' as accId,'"+pkorgValue[0]+"' as pkorg,mo.cState as 'poStatus',mo.cPOID as 'poNum','STANDARD_PO' as 'poType'," +
|
|
|
- "'0085' as 'supplierNumber','采购业务实体名称' as 'poBusinessUnitCode','森鑫' as 'supplierName',mo.cPersonCode as headerAttributeString10,hr.cPsn_Num as 'headerAttributeString9'," +
|
|
|
|
|
|
|
+ "'0085' as 'supplierNumber','采购业务实体名称' as 'poBusinessUnitCode','森鑫' as 'supplierName',mo.cPersonCode as salerCode,hr.cPsn_Num as 'headerAttributeString9'," +
|
|
|
"ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone'," +
|
|
"ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone'," +
|
|
|
"mo.cPOID as headerAttributeString2,'' as 'customerContactsPhone','0.00' as 'totalAmount'," +
|
|
"mo.cPOID as headerAttributeString2,'' as 'customerContactsPhone','0.00' as 'totalAmount'," +
|
|
|
"'0.00' as 'exTaxAmount', curr.cexch_code as 'currencyCode',mo.iTaxRate as 'headerTaxRate'," +
|
|
"'0.00' as 'exTaxAmount', curr.cexch_code as 'currencyCode',mo.iTaxRate as 'headerTaxRate'," +
|
|
|
"mo.dPODate as 'customerDemandDate', mo.cMemo as 'remark','' as 'sourceDocNum'," +
|
|
"mo.dPODate as 'customerDemandDate', mo.cMemo as 'remark','' as 'sourceDocNum'," +
|
|
|
- "mo.cMaker as 'buyerCode',hr1.cPsn_Name as salerCode," +
|
|
|
|
|
|
|
+ "mo.cMaker as 'customerContacts',hr1.cPsn_Name as headerAttributeString10,mo.cAuditDate as cAuditDate," +
|
|
|
" mo.cmaketime as 'publishDate' from PO_Pomain mo left join Vendor ven on mo.cVenCode = ven.cVenCode " +
|
|
" mo.cmaketime as 'publishDate' from PO_Pomain mo left join Vendor ven on mo.cVenCode = ven.cVenCode " +
|
|
|
"left join (select cPsn_Num, cPsn_Name from hr_hi_person) hr " +
|
|
"left join (select cPsn_Num, cPsn_Name from hr_hi_person) hr " +
|
|
|
"on mo.cMaker = hr.cPsn_Name " +
|
|
"on mo.cMaker = hr.cPsn_Name " +
|
|
@@ -106,12 +112,12 @@ public class POPomainController implements ApplicationContextAware {
|
|
|
}
|
|
}
|
|
|
else if(pkorgValue[0].equals("two")){
|
|
else if(pkorgValue[0].equals("two")){
|
|
|
String sql = "select mo.POID as 'moId','"+ac+"' as accId,'"+pkorgValue[0]+"' as pkorg,mo.cState as 'poStatus',mo.cPOID as 'poNum','STANDARD_PO' as 'poType'," +
|
|
String sql = "select mo.POID as 'moId','"+ac+"' as accId,'"+pkorgValue[0]+"' as pkorg,mo.cState as 'poStatus',mo.cPOID as 'poNum','STANDARD_PO' as 'poType'," +
|
|
|
- "'0085' as 'supplierNumber','采购业务实体名称' as 'poBusinessUnitCode','森鑫' as 'supplierName',mo.cPersonCode as headerAttributeString10,hr.cPsn_Num as 'headerAttributeString9'," +
|
|
|
|
|
|
|
+ "'0085' as 'supplierNumber','采购业务实体名称' as 'poBusinessUnitCode','森鑫' as 'supplierName',mo.cPersonCode as salerCode,hr.cPsn_Num as 'headerAttributeString9'," +
|
|
|
"ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone'," +
|
|
"ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone'," +
|
|
|
"mo.cPOID as headerAttributeString2,'' as 'customerContactsPhone','0.00' as 'totalAmount'," +
|
|
"mo.cPOID as headerAttributeString2,'' as 'customerContactsPhone','0.00' as 'totalAmount'," +
|
|
|
"'0.00' as 'exTaxAmount', curr.cexch_code as 'currencyCode',mo.iTaxRate as 'headerTaxRate'," +
|
|
"'0.00' as 'exTaxAmount', curr.cexch_code as 'currencyCode',mo.iTaxRate as 'headerTaxRate'," +
|
|
|
"mo.dPODate as 'customerDemandDate',mo.cMemo as 'remark','' as 'sourceDocNum'," +
|
|
"mo.dPODate as 'customerDemandDate',mo.cMemo as 'remark','' as 'sourceDocNum'," +
|
|
|
- "mo.cMaker as 'buyerCode',hr1.cPsn_Name as salerCode," +
|
|
|
|
|
|
|
+ "mo.cMaker as 'customerContacts',hr1.cPsn_Name as headerAttributeString10,mo.cAuditDate as cAuditDate," +
|
|
|
" mo.cmaketime as 'publishDate' from PO_Pomain mo left join Vendor ven on mo.cVenCode = ven.cVenCode " +
|
|
" mo.cmaketime as 'publishDate' from PO_Pomain mo left join Vendor ven on mo.cVenCode = ven.cVenCode " +
|
|
|
"left join (select cPsn_Num, cPsn_Name from hr_hi_person) hr " +
|
|
"left join (select cPsn_Num, cPsn_Name from hr_hi_person) hr " +
|
|
|
"on mo.cMaker = hr.cPsn_Name " +
|
|
"on mo.cMaker = hr.cPsn_Name " +
|
|
@@ -127,12 +133,12 @@ public class POPomainController implements ApplicationContextAware {
|
|
|
//hr.cPsn_Num as 'buyerId',mo.cPersonCode as salerId,
|
|
//hr.cPsn_Num as 'buyerId',mo.cPersonCode as salerId,
|
|
|
}else if(pkorgValue[0].equals("three")){
|
|
}else if(pkorgValue[0].equals("three")){
|
|
|
String sql = "select mo.POID as 'moId','"+ac+"' as accId,'"+pkorgValue[0]+"' as pkorg,mo.cState as 'poStatus',mo.cPOID as 'poNum','STANDARD_PO' as 'poType'," +
|
|
String sql = "select mo.POID as 'moId','"+ac+"' as accId,'"+pkorgValue[0]+"' as pkorg,mo.cState as 'poStatus',mo.cPOID as 'poNum','STANDARD_PO' as 'poType'," +
|
|
|
- "'0085' as 'supplierNumber','采购业务实体名称' as 'poBusinessUnitCode','森鑫' as 'supplierName',mo.cPersonCode as headerAttributeString10,hr.cPsn_Num as 'headerAttributeString9'," +
|
|
|
|
|
|
|
+ "'0085' as 'supplierNumber','采购业务实体名称' as 'poBusinessUnitCode','森鑫' as 'supplierName',mo.cPersonCode as salerCode,hr.cPsn_Num as 'headerAttributeString9'," +
|
|
|
"ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone'," +
|
|
"ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone'," +
|
|
|
"mo.cPOID as headerAttributeString2,'' as 'customerContactsPhone','0.00' as 'totalAmount'," +
|
|
"mo.cPOID as headerAttributeString2,'' as 'customerContactsPhone','0.00' as 'totalAmount'," +
|
|
|
"'0.00' as 'exTaxAmount', curr.cexch_code as 'currencyCode',mo.iTaxRate as 'headerTaxRate'," +
|
|
"'0.00' as 'exTaxAmount', curr.cexch_code as 'currencyCode',mo.iTaxRate as 'headerTaxRate'," +
|
|
|
"mo.dPODate as 'customerDemandDate', mo.cMemo as 'remark','' as 'sourceDocNum'," +
|
|
"mo.dPODate as 'customerDemandDate', mo.cMemo as 'remark','' as 'sourceDocNum'," +
|
|
|
- "mo.cMaker as 'buyerCode',hr1.cPsn_Name as salerCode," +
|
|
|
|
|
|
|
+ "mo.cMaker as 'customerContacts',hr1.cPsn_Name as headerAttributeString10,mo.cAuditDate as cAuditDate," +
|
|
|
" mo.cmaketime as 'publishDate' from PO_Pomain mo left join Vendor ven on mo.cVenCode = ven.cVenCode " +
|
|
" mo.cmaketime as 'publishDate' from PO_Pomain mo left join Vendor ven on mo.cVenCode = ven.cVenCode " +
|
|
|
"left join (select cPsn_Num, cPsn_Name from hr_hi_person) hr " +
|
|
"left join (select cPsn_Num, cPsn_Name from hr_hi_person) hr " +
|
|
|
"on mo.cMaker = hr.cPsn_Name " +
|
|
"on mo.cMaker = hr.cPsn_Name " +
|
|
@@ -203,41 +209,54 @@ public class POPomainController implements ApplicationContextAware {
|
|
|
String accId = jo.getString("accId");
|
|
String accId = jo.getString("accId");
|
|
|
//订单类型
|
|
//订单类型
|
|
|
String type = jo.getString("type");
|
|
String type = jo.getString("type");
|
|
|
|
|
+ //单据号
|
|
|
|
|
+ String poNum = jo.getString("poNum");
|
|
|
|
|
+ if(oConvertUtils.isEmpty(poNum)){
|
|
|
|
|
+ poNum ="测试001";
|
|
|
|
|
+ }
|
|
|
|
|
+ //单据日期
|
|
|
|
|
+ String date = jo.getString("date");
|
|
|
//账套1
|
|
//账套1
|
|
|
if (accId.equals(yi)) {
|
|
if (accId.equals(yi)) {
|
|
|
if(type.equals("STANDARD_PO")){
|
|
if(type.equals("STANDARD_PO")){
|
|
|
- if (code.equals("S")) {
|
|
|
|
|
- //普通采购回写
|
|
|
|
|
- String sql = "update PO_Pomain set cDefine10 = ? where POID = ?";
|
|
|
|
|
- senYuDataSourceOne.updatePOMain(sql, "true," + message, moId);
|
|
|
|
|
- } else {
|
|
|
|
|
- //普通采购回写
|
|
|
|
|
- String sql = "update PO_Pomain set cDefine10 = ? where POID = ?";
|
|
|
|
|
- senYuDataSourceOne.updatePOMain(sql, "false," + message, moId);
|
|
|
|
|
|
|
+ if (code.equals("E")) {
|
|
|
|
|
+ //失败 新增失败汇总表
|
|
|
|
|
+ SyFailDocument syFailDocument = new SyFailDocument();
|
|
|
|
|
+ syFailDocument.setId(oConvertUtils.id());
|
|
|
|
|
+ syFailDocument.setDocumentType("采购订单");
|
|
|
|
|
+ syFailDocument.setDocumentNo(poNum);
|
|
|
|
|
+ syFailDocument.setDocumentDate(date);
|
|
|
|
|
+ syFailDocument.setDocumentStatus("0");
|
|
|
|
|
+ syFailDocument.setReason(message);
|
|
|
|
|
+ iSyFailDocumentService.save(syFailDocument);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}else if(accId.equals(er)){
|
|
}else if(accId.equals(er)){
|
|
|
if(type.equals("STANDARD_PO")) {
|
|
if(type.equals("STANDARD_PO")) {
|
|
|
- if (code.equals("S")) {
|
|
|
|
|
- //普通采购回写
|
|
|
|
|
- String sql = "update PO_Pomain set cDefine10 = ? where POID = ?";
|
|
|
|
|
- senYuDataSourceTwo.updatePOMain(sql, "true," + message, moId);
|
|
|
|
|
- } else {
|
|
|
|
|
- //普通采购回写
|
|
|
|
|
- String sql = "update PO_Pomain set cDefine10 = ? where POID = ?";
|
|
|
|
|
- senYuDataSourceTwo.updatePOMain(sql, "false," + message, moId);
|
|
|
|
|
|
|
+ if (code.equals("E")) {
|
|
|
|
|
+ //失败 新增失败汇总表
|
|
|
|
|
+ SyFailDocument syFailDocument = new SyFailDocument();
|
|
|
|
|
+ syFailDocument.setId(oConvertUtils.id());
|
|
|
|
|
+ syFailDocument.setDocumentType("采购订单");
|
|
|
|
|
+ syFailDocument.setDocumentNo(poNum);
|
|
|
|
|
+ syFailDocument.setDocumentDate(date);
|
|
|
|
|
+ syFailDocument.setDocumentStatus("0");
|
|
|
|
|
+ syFailDocument.setReason(message);
|
|
|
|
|
+ iSyFailDocumentService.save(syFailDocument);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}else if(accId.equals(san)) {
|
|
}else if(accId.equals(san)) {
|
|
|
if(type.equals("STANDARD_PO")) {
|
|
if(type.equals("STANDARD_PO")) {
|
|
|
- if (code.equals("S")) {
|
|
|
|
|
- //普通采购回写
|
|
|
|
|
- String sql = "update PO_Pomain set cDefine10 = ? where POID = ?";
|
|
|
|
|
- iSenYuDataSourceThree.updatePOMain(sql, "true," + message, moId);
|
|
|
|
|
- } else {
|
|
|
|
|
- //普通采购回写
|
|
|
|
|
- String sql = "update PO_Pomain set cDefine10 = ? where POID = ?";
|
|
|
|
|
- iSenYuDataSourceThree.updatePOMain(sql, "false," + message, moId);
|
|
|
|
|
|
|
+ if (code.equals("E")) {
|
|
|
|
|
+ //失败 新增失败汇总表
|
|
|
|
|
+ SyFailDocument syFailDocument = new SyFailDocument();
|
|
|
|
|
+ syFailDocument.setId(oConvertUtils.id());
|
|
|
|
|
+ syFailDocument.setDocumentType("采购订单");
|
|
|
|
|
+ syFailDocument.setDocumentNo(poNum);
|
|
|
|
|
+ syFailDocument.setDocumentDate(date);
|
|
|
|
|
+ syFailDocument.setDocumentStatus("0");
|
|
|
|
|
+ syFailDocument.setReason(message);
|
|
|
|
|
+ iSyFailDocumentService.save(syFailDocument);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -263,4 +282,5 @@ public class POPomainController implements ApplicationContextAware {
|
|
|
this.senYuDataSourceTwo = applicationContext.getBean(ISenYuDataSourceTwo.class);
|
|
this.senYuDataSourceTwo = applicationContext.getBean(ISenYuDataSourceTwo.class);
|
|
|
this.iSenYuDataSourceThree = applicationContext.getBean(ISenYuDataSourceThree.class);
|
|
this.iSenYuDataSourceThree = applicationContext.getBean(ISenYuDataSourceThree.class);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
}
|
|
}
|