|
@@ -11,6 +11,9 @@ import com.google.gson.GsonBuilder;
|
|
|
import lombok.extern.log4j.Log4j2;
|
|
|
|
|
|
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.service.IDxpDataPlanService;
|
|
|
import org.jeecg.modules.openApi.service.ISenYuDataSourceOne;
|
|
@@ -50,6 +53,8 @@ public class MOMainController implements ApplicationContextAware {
|
|
|
private static ISenYuDataSourceTwo senYuDataSourceTwo;
|
|
|
//数据源one
|
|
|
private static ISenYuDataSourceThree iSenYuDataSourceThree;
|
|
|
+ @Autowired
|
|
|
+ private ISyFailDocumentService iSyFailDocumentService;
|
|
|
|
|
|
|
|
|
@PostMapping(value = "/QueryMoMain")
|
|
@@ -91,11 +96,11 @@ public class MOMainController implements ApplicationContextAware {
|
|
|
if (pkorgValue[0].equals("one")) {//mo.cPersonCode as 'salerId',hr.cPsn_Num as 'buyerId',
|
|
|
String sql = "select mo.MOID as 'moId',mo.MOID as 'moId','"+ac+"' as accId,'"+pkorgValue[0]+"' as pkorg,mo.cState as 'poStatus'," +
|
|
|
"mo.cCode as 'poNum','SUBCONTRACTOR_PO' as 'poType','0085' as 'supplierNumber','森鑫' as 'supplierName'," +
|
|
|
- "ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone',mo.cPersonCode as 'headerAttributeString10',hr.cPsn_Num as 'headerAttributeString9'," +
|
|
|
- "hr1.cPsn_Name as 'salerCode',mo.cMaker as 'customerContacts','采购业务实体名称' as poBusinessUnitCode," +
|
|
|
+ "ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone',mo.cPersonCode as 'salerCode',hr.cPsn_Num as 'headerAttributeString9'," +
|
|
|
+ "hr1.cPsn_Name as 'headerAttributeString10',mo.cMaker as 'customerContacts','采购业务实体名称' as poBusinessUnitCode," +
|
|
|
"'' as 'customerContactsPhone','0.00' as 'totalAmount','0.00' as 'exTaxAmount', curr.cexch_code as 'currencyCode'," +
|
|
|
- "mo.iTaxRate as 'headerTaxRate',mo.dDate as 'customerDemandDate', mo.cMemo as 'remark'," +
|
|
|
- "'' as 'sourceDocNum',mo.cMaker as 'buyerCode',mo.dCreateTime as 'publishDate',0 as 'tenantId'," +
|
|
|
+ "mo.iTaxRate as 'headerTaxRate',mo.dDate as 'customerDemandDate', mo.cMemo as 'remark',mo.dVerifyDate as dVerifyDate," +
|
|
|
+ "'' as 'sourceDocNum',mo.cMaker as 'customerContacts',mo.dCreateTime as 'publishDate',0 as 'tenantId'," +
|
|
|
"0 as 'totalAmount','' as 'headerAttributeString1', mo.cCode as 'headerAttributeString2','' as 'headerAttributeString3'," +
|
|
|
"'' as 'headerAttributeString4' from OM_MOMain mo left join Vendor ven on mo.cVenCode = ven.cVenCode " +
|
|
|
" left join (select cPsn_Num, cPsn_Name from hr_hi_person) hr " +
|
|
@@ -113,11 +118,11 @@ public class MOMainController implements ApplicationContextAware {
|
|
|
}else if(pkorgValue[0].equals("two")){
|
|
|
String sql = "select mo.MOID as 'moId',mo.MOID as 'moId','"+ac+"' as accId,'"+pkorgValue[0]+"' as pkorg,mo.cState as 'poStatus'," +
|
|
|
"mo.cCode as 'poNum','SUBCONTRACTOR_PO' as 'poType','0085' as 'supplierNumber','森鑫' as 'supplierName'," +
|
|
|
- "ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone',mo.cPersonCode as 'headerAttributeString10',hr.cPsn_Num as 'headerAttributeString9'," +
|
|
|
- "hr1.cPsn_Name as 'salerCode',mo.cMaker as 'customerContacts','采购业务实体名称' as poBusinessUnitCode," +
|
|
|
+ "ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone',mo.cPersonCode as 'salerCode',hr.cPsn_Num as 'headerAttributeString9'," +
|
|
|
+ "hr1.cPsn_Name as 'headerAttributeString10',mo.cMaker as 'customerContacts','采购业务实体名称' as poBusinessUnitCode," +
|
|
|
"'' as 'customerContactsPhone','0.00' as 'totalAmount','0.00' as 'exTaxAmount', curr.cexch_code as 'currencyCode'," +
|
|
|
- "mo.iTaxRate as 'headerTaxRate',mo.dDate as 'customerDemandDate', mo.cMemo as 'remark'," +
|
|
|
- "'' as 'sourceDocNum',mo.cMaker as 'buyerCode',mo.dCreateTime as 'publishDate',0 as 'tenantId'," +
|
|
|
+ "mo.iTaxRate as 'headerTaxRate',mo.dDate as 'customerDemandDate', mo.cMemo as 'remark',mo.dVerifyDate as dVerifyDate," +
|
|
|
+ "'' as 'sourceDocNum',mo.cMaker as 'customerContacts',mo.dCreateTime as 'publishDate',0 as 'tenantId'," +
|
|
|
"0 as 'totalAmount','' as 'headerAttributeString1', mo.cCode as 'headerAttributeString2','' as 'headerAttributeString3'," +
|
|
|
"'' as 'headerAttributeString4' from OM_MOMain mo left join Vendor ven on mo.cVenCode = ven.cVenCode " +
|
|
|
" left join (select cPsn_Num, cPsn_Name from hr_hi_person) hr " +
|
|
@@ -135,11 +140,11 @@ public class MOMainController implements ApplicationContextAware {
|
|
|
}else if(pkorgValue[0].equals("three")){
|
|
|
String sql = "select mo.MOID as 'moId',mo.MOID as 'moId','"+ac+"' as accId,'"+pkorgValue[0]+"' as pkorg,mo.cState as 'poStatus'," +
|
|
|
"mo.cCode as 'poNum','SUBCONTRACTOR_PO' as 'poType','0085' as 'supplierNumber','森鑫' as 'supplierName'," +
|
|
|
- "ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone',mo.cPersonCode as 'headerAttributeString10',hr.cPsn_Num as 'headerAttributeString9'," +
|
|
|
- "hr1.cPsn_Name as 'salerCode',mo.cMaker as 'customerContacts','采购业务实体名称' as poBusinessUnitCode," +
|
|
|
+ "ven.cVenPerson as 'supplierContacts',ven.cVenBranchPhone as 'supplierContactsPhone',mo.cPersonCode as 'salerCode',hr.cPsn_Num as 'headerAttributeString9'," +
|
|
|
+ "hr1.cPsn_Name as 'headerAttributeString10',mo.cMaker as 'customerContacts','采购业务实体名称' as poBusinessUnitCode," +
|
|
|
"'' as 'customerContactsPhone','0.00' as 'totalAmount','0.00' as 'exTaxAmount', curr.cexch_code as 'currencyCode'," +
|
|
|
- "mo.iTaxRate as 'headerTaxRate',mo.dDate as 'customerDemandDate', mo.cMemo as 'remark'," +
|
|
|
- "'' as 'sourceDocNum',mo.cMaker as 'buyerCode',mo.dCreateTime as 'publishDate',0 as 'tenantId'," +
|
|
|
+ "mo.iTaxRate as 'headerTaxRate',mo.dDate as 'customerDemandDate', mo.cMemo as 'remark',mo.dVerifyDate as dVerifyDate," +
|
|
|
+ "'' as 'sourceDocNum',mo.cMaker as 'customerContacts',mo.dCreateTime as 'publishDate',0 as 'tenantId'," +
|
|
|
"0 as 'totalAmount','' as 'headerAttributeString1', mo.cCode as 'headerAttributeString2','' as 'headerAttributeString3'," +
|
|
|
"'' as 'headerAttributeString4' from OM_MOMain mo left join Vendor ven on mo.cVenCode = ven.cVenCode " +
|
|
|
" left join (select cPsn_Num, cPsn_Name from hr_hi_person) hr " +
|
|
@@ -206,35 +211,54 @@ public class MOMainController implements ApplicationContextAware {
|
|
|
String accId = jo.getString("accId");
|
|
|
//订单类型
|
|
|
String type = jo.getString("type");
|
|
|
+ //单据号
|
|
|
+ String poNum = jo.getString("poNum");
|
|
|
+ if(oConvertUtils.isEmpty(poNum)){
|
|
|
+ poNum ="测试001";
|
|
|
+ }
|
|
|
+ //单据日期
|
|
|
+ String date = jo.getString("date");
|
|
|
//账套666
|
|
|
if (accId.equals(yi)) {
|
|
|
if(type.equals("SUBCONTRACTOR_PO")) {
|
|
|
- if (code.equals("S")) {
|
|
|
- String sql1 = "update OM_MOMain set cDefine10 = ? where MOID = ?";
|
|
|
- senYuDataSourceOne.updateMOMain(sql1, "true," + message, moId);
|
|
|
- } else {
|
|
|
- String sql1 = "update OM_MOMain set cDefine10 = ? where MOID = ?";
|
|
|
- senYuDataSourceOne.updateMOMain(sql1, "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)) {
|
|
|
if(type.equals("SUBCONTRACTOR_PO")) {
|
|
|
- if (code.equals("S")) {
|
|
|
- String sql1 = "update OM_MOMain set cDefine10 = ? where MOID = ?";
|
|
|
- senYuDataSourceTwo.updateMOMain(sql1, "true," + message, moId);
|
|
|
- } else {
|
|
|
- String sql1 = "update OM_MOMain set cDefine10 = ? where MOID = ?";
|
|
|
- senYuDataSourceTwo.updateMOMain(sql1, "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)) {
|
|
|
if(type.equals("SUBCONTRACTOR_PO")) {
|
|
|
- if (code.equals("S")) {
|
|
|
- String sql1 = "update OM_MOMain set cDefine10 = ? where MOID = ?";
|
|
|
- iSenYuDataSourceThree.updateMOMain(sql1, "true," + message, moId);
|
|
|
- } else {
|
|
|
- String sql1 = "update OM_MOMain set cDefine10 = ? where MOID = ?";
|
|
|
- iSenYuDataSourceThree.updateMOMain(sql1, "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);
|
|
|
}
|
|
|
}
|
|
|
}
|