parent
6f00c5a869
commit
a56a7a8266
|
|
@ -195,6 +195,77 @@ public class SappzFormPlugin extends AbstractFormPlugin {
|
|||
this.getModel().setValue("shjh_paymenttype", "自动扣款", i);//付款方式
|
||||
break;
|
||||
}
|
||||
this.getModel().setValue("shjh_paymenttypenumber", it_list.getString("ZLSCH"), i);//付款方式
|
||||
String uuid = it_list.getString("XBLNR");
|
||||
this.getModel().setValue("shjh_uuid", uuid, i);//单据号
|
||||
/**
|
||||
* 员工借款单 A
|
||||
* 通用报销单 B
|
||||
* 差旅报销单 C
|
||||
* 劳务人员报销单 D
|
||||
* 预付款单 E
|
||||
* 请款单无订单 F
|
||||
* 服务付款单 G
|
||||
* 代扣款记账单 H
|
||||
* 其他付款单 I
|
||||
* SPA会员退卡申请单 J
|
||||
* 公司间划转单 K
|
||||
* 资金划款单 L
|
||||
*
|
||||
* JKY 对私 员工借款单
|
||||
* TYB 对私 通用报销单
|
||||
* CLB 对私 差旅报销单
|
||||
* LWB 对私 劳务人员报销单
|
||||
* YFK 对公 预付款单
|
||||
* JCW 对公 请款单无订单
|
||||
* FWK 对公 服务付款单
|
||||
* TFK 对公 其他付款单
|
||||
* SPA 对公 SPA会员退卡申请单
|
||||
* JCH 对公 TPM_请款单
|
||||
* TYH 对私 TPM_通用报销单
|
||||
*/
|
||||
QFilter qq1 = new QFilter("number", QCP.equals, "JH001");//对公
|
||||
QFilter qq2 = new QFilter("number", QCP.equals, "JH002");//对私
|
||||
DynamicObject paytype_g = BusinessDataServiceHelper.loadSingle(CAS_PAYMENTBILLTYPE, new QFilter[]{qq1});
|
||||
DynamicObject paytype_s = BusinessDataServiceHelper.loadSingle(CAS_PAYMENTBILLTYPE, new QFilter[]{qq2});
|
||||
//付款类型 外部系统单据类型
|
||||
if (uuid.contains("JKY")) {
|
||||
this.getModel().setValue("shjh_externalsystemdocume","A",i);//员工借款单
|
||||
this.getModel().setValue("shjh_epaymenttype", paytype_s,i);//对私
|
||||
}else if (uuid.contains("TYB")) {
|
||||
this.getModel().setValue("shjh_externalsystemdocume","B",i);//通用报销单
|
||||
this.getModel().setValue("shjh_epaymenttype", paytype_s,i);//对私
|
||||
}else if (uuid.contains("CLB")) {
|
||||
this.getModel().setValue("shjh_externalsystemdocume","C",i);//差旅报销单
|
||||
this.getModel().setValue("shjh_epaymenttype", paytype_s,i);//对私
|
||||
}else if (uuid.contains("LWB")) {
|
||||
this.getModel().setValue("shjh_externalsystemdocume","D",i);//劳务人员报销单
|
||||
this.getModel().setValue("shjh_epaymenttype", paytype_s,i);//对私
|
||||
}else if (uuid.contains("YFK")) {
|
||||
this.getModel().setValue("shjh_externalsystemdocume","E",i);//预付款单
|
||||
this.getModel().setValue("shjh_epaymenttype", paytype_g,i);//对公
|
||||
}else if (uuid.contains("JCW")) {
|
||||
this.getModel().setValue("shjh_externalsystemdocume","F",i);//请款单无订单
|
||||
this.getModel().setValue("shjh_epaymenttype", paytype_g,i);//对公
|
||||
}else if (uuid.contains("FWK")) { //服务付款单
|
||||
this.getModel().setValue("shjh_externalsystemdocume","G",i);
|
||||
this.getModel().setValue("shjh_epaymenttype", paytype_g,i);//对公
|
||||
}else if (uuid.contains("TFK")) {
|
||||
this.getModel().setValue("shjh_externalsystemdocume","I",i);//其他付款单
|
||||
this.getModel().setValue("shjh_epaymenttype", paytype_g,i);//对公
|
||||
}else if (uuid.contains("SPA")) {
|
||||
this.getModel().setValue("shjh_externalsystemdocume","J",i);//SPA会员退卡申请单
|
||||
this.getModel().setValue("shjh_epaymenttype", paytype_g,i);//对公
|
||||
}else if (uuid.contains("JCH")) {
|
||||
//this.getModel().setValue("shjh_externalsystemdocume","JC",i);//TPM_请款单
|
||||
this.getModel().setValue("shjh_epaymenttype", paytype_g,i);//对公JKY0000001
|
||||
}else if (uuid.contains("TYH")) { //TPM_通用报销单
|
||||
//this.getModel().setValue("shjh_externalsystemdocume","TY",i);
|
||||
this.getModel().setValue("shjh_epaymenttype", paytype_s,i);//对私
|
||||
}else {
|
||||
log.error("费控单据编号解析类型失败:动态表单拉取SAP");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
this.getView().updateView("shjh_entryentity");
|
||||
|
|
@ -216,6 +287,7 @@ public class SappzFormPlugin extends AbstractFormPlugin {
|
|||
for (int selectRow : selectRows) {
|
||||
String fkBillNum = (String) this.getModel().getValue("shjh_vouchernumber", selectRow);//凭证号
|
||||
|
||||
|
||||
// 公司编号
|
||||
String companyNum = (String) this.getModel().getValue("shjh_orgnumber", selectRow);//公司编号
|
||||
if (companyNum == null || companyNum.isEmpty()) {
|
||||
|
|
@ -432,8 +504,6 @@ public class SappzFormPlugin extends AbstractFormPlugin {
|
|||
//表头申请金额
|
||||
ap_payapply.set("applyamount", amount);
|
||||
|
||||
//结算方式
|
||||
|
||||
//付款类型:取值范围:对公付款、对私付款;SAP:科目编号1221020200 对私付款。费控:劳务人员报销单 对私付款。其他均赋值为对公付款。
|
||||
if ("1221020200".equals(accountingsubject)) {
|
||||
QFilter Q9 = new QFilter("name", QCP.equals, "对私付款");
|
||||
|
|
@ -508,6 +578,47 @@ public class SappzFormPlugin extends AbstractFormPlugin {
|
|||
ap_payapply.set("shjh_voucherentrynum", voucherentrynum);
|
||||
//SAP应付凭证会计年度
|
||||
ap_payapply.set("shjh_voucheryear", voucheryear);
|
||||
//单据号
|
||||
String uuid = (String) this.getModel().getValue("shjh_uuid", selectRow);
|
||||
QFilter qq1 = new QFilter("number", QCP.equals, "JH001");//对公
|
||||
QFilter qq2 = new QFilter("number", QCP.equals, "JH002");//对私
|
||||
DynamicObject paytype_g = BusinessDataServiceHelper.loadSingle(CAS_PAYMENTBILLTYPE, new QFilter[]{qq1});
|
||||
DynamicObject paytype_s = BusinessDataServiceHelper.loadSingle(CAS_PAYMENTBILLTYPE, new QFilter[]{qq2});
|
||||
//付款类型 外部系统单据类型
|
||||
if (uuid.contains("JKY")) {
|
||||
ap_payapply.set("shjh_externalsystemdocume","A");//员工借款单
|
||||
ap_payapply_entry.set("e_paymenttype", paytype_s);//对私
|
||||
}else if (uuid.contains("TYB")) {
|
||||
ap_payapply.set("shjh_externalsystemdocume","B");//通用报销单
|
||||
ap_payapply_entry.set("e_paymenttype", paytype_s);//对私
|
||||
}else if (uuid.contains("CLB")) {
|
||||
ap_payapply.set("shjh_externalsystemdocume","C");//差旅报销单
|
||||
ap_payapply_entry.set("e_paymenttype", paytype_s);//对私
|
||||
}else if (uuid.contains("LWB")) {
|
||||
ap_payapply.set("shjh_externalsystemdocume","D");//劳务人员报销单
|
||||
ap_payapply_entry.set("e_paymenttype", paytype_s);//对私
|
||||
}else if (uuid.contains("YFK")) {
|
||||
ap_payapply.set("shjh_externalsystemdocume","E");//预付款单
|
||||
ap_payapply_entry.set("e_paymenttype", paytype_g);//对公
|
||||
}else if (uuid.contains("JCW")) {
|
||||
ap_payapply.set("shjh_externalsystemdocume","F");//请款单无订单
|
||||
ap_payapply_entry.set("e_paymenttype", paytype_g);//对公
|
||||
}else if (uuid.contains("FWK")) { //服务付款单
|
||||
ap_payapply.set("shjh_externalsystemdocume","G");
|
||||
ap_payapply_entry.set("e_paymenttype", paytype_g);//对公
|
||||
}else if (uuid.contains("TFK")) {
|
||||
ap_payapply.set("shjh_externalsystemdocume","I");//其他付款单
|
||||
ap_payapply_entry.set("e_paymenttype", paytype_g);//对公
|
||||
}else if (uuid.contains("SPA")) {
|
||||
ap_payapply.set("shjh_externalsystemdocume","J");//SPA会员退卡申请单
|
||||
ap_payapply_entry.set("e_paymenttype", paytype_g);//对公
|
||||
}else if (uuid.contains("JCH")) {
|
||||
// ap_payapply.set("shjh_externalsystemdocume","JC");//TPM_请款单
|
||||
ap_payapply_entry.set("e_paymenttype", paytype_g);//对公JKY0000001
|
||||
}else if (uuid.contains("TYH")) { //TPM_通用报销单
|
||||
// ap_payapply.set("shjh_externalsystemdocume","TY");
|
||||
ap_payapply_entry.set("e_paymenttype", paytype_s);//对私
|
||||
}
|
||||
//采购组
|
||||
String procurementeam = (String) this.getModel().getValue("shjh_procurementeam", selectRow);
|
||||
ap_payapply.set("shjh_procurementteam", procurementeam);
|
||||
|
|
|
|||
|
|
@ -47,6 +47,10 @@ public class PaybillPushSapOperation extends AbstractOperationServicePlugIn impl
|
|||
for (ExtendedDataEntity entity : entities) {
|
||||
DynamicObject bill = entity.getDataEntity();
|
||||
bill = BusinessDataServiceHelper.loadSingle(bill.getPkValue(), "cas_paybill");
|
||||
String billstatus = bill.getString("billstatus");//付款单状态
|
||||
if (!"D".equals(billstatus)) {
|
||||
this.addErrorMessage(entity, "付款单状态不为已付款,不允许推送SAP凭证");
|
||||
}
|
||||
String shjhSourcesystem = bill.getString("shjh_sourcesystem");//来源系统,A_sap,B_fk
|
||||
DynamicObject paymentidentify = bill.getDynamicObject("paymentidentify");//付款单标识
|
||||
|
||||
|
|
@ -82,16 +86,26 @@ public class PaybillPushSapOperation extends AbstractOperationServicePlugIn impl
|
|||
data.put("IS_HEADER", getIS_HEADER(bill));
|
||||
//金蝶生成的凭证信息
|
||||
data.put("IT_ITEM", getIT_ITEM(bill));
|
||||
Boolean isqingdan = true;
|
||||
//来源系统SAP时,清账(SAP凭证数据)
|
||||
if ("A".equals(shjhSourcesystem)) {
|
||||
// 票据信息
|
||||
DynamicObjectCollection casDraftinfos = bill.getDynamicObjectCollection("cas_draftinfo");
|
||||
if (!casDraftinfos.isEmpty()) {
|
||||
data.put("IT_ITEM", null);
|
||||
isqingdan = false;
|
||||
}
|
||||
//清账数据,参考《IT_CLEAR》,仅清账需要输入
|
||||
data.put("IT_CLEAR", getIT_CLEAR(bill));
|
||||
}
|
||||
//不清却为空,校验
|
||||
if (isqingdan && data.getJSONArray("IT_ITEM").isEmpty()) {
|
||||
OperateErrorInfo operateErrorInfo = new OperateErrorInfo();
|
||||
operateErrorInfo.setMessage("推送SAP凭证接口失败,原因:金蝶凭证未生成或未审核");
|
||||
operateErrorInfo.setErrorLevel(ErrorLevel.Error.name());
|
||||
operateErrorInfo.setPkValue(bill.getPkValue());
|
||||
this.operationResult.addErrorInfo(operateErrorInfo);
|
||||
}
|
||||
//一次性供应商或客户信息(仅需要填写)
|
||||
String type = bill.getString("payeetype");
|
||||
long id = Long.parseLong(bill.getString("payee"));
|
||||
|
|
@ -154,7 +168,7 @@ public class PaybillPushSapOperation extends AbstractOperationServicePlugIn impl
|
|||
String customerOrsupnum = getCustomerOrSupplierNumber(payeetype, bill,"payee");
|
||||
|
||||
//原因码(付款明细)
|
||||
String RSTGR = "";
|
||||
String RSTGR;
|
||||
//SAP会计科目行项目号
|
||||
String SGTXT;
|
||||
DynamicObjectCollection entrys = bill.getDynamicObjectCollection("entry");
|
||||
|
|
@ -163,9 +177,13 @@ public class PaybillPushSapOperation extends AbstractOperationServicePlugIn impl
|
|||
DynamicObject shjhYym = entry.getDynamicObject("shjh_yym");
|
||||
if (null != shjhYym) {
|
||||
RSTGR = shjhYym.getString("number");
|
||||
} else {
|
||||
RSTGR = null;
|
||||
}
|
||||
SGTXT = entry.getString("shjh_voucherentrynum");
|
||||
} else {SGTXT = "";}
|
||||
} else {
|
||||
RSTGR = null;
|
||||
SGTXT = "";}
|
||||
//成本中心
|
||||
String KOSTL;
|
||||
DynamicObject shjhCostcenter = bill.getDynamicObject("shjh_costcenter");
|
||||
|
|
@ -180,9 +198,11 @@ public class PaybillPushSapOperation extends AbstractOperationServicePlugIn impl
|
|||
} else {PRCTR = "";}
|
||||
|
||||
JSONArray IT_ITEM = new JSONArray();
|
||||
QFilter q1 = new QFilter("sourcebill", QCP.equals, bill.getPkValue());
|
||||
QFilter q2 = new QFilter("billstatus",QCP.equals,"C");
|
||||
DynamicObject gl_voucher = BusinessDataServiceHelper.loadSingle("gl_voucher",
|
||||
"id,sourcebill,entries,entries.account,entries.debitlocal,entries.creditlocal,entries.entrydc",
|
||||
new QFilter("sourcebill", QCP.equals, bill.getPkValue()).toArray());
|
||||
new QFilter[]{q1, q2});
|
||||
if (null != gl_voucher) {
|
||||
DynamicObjectCollection entries = gl_voucher.getDynamicObjectCollection("entries");
|
||||
if (!entries.isEmpty()) {
|
||||
|
|
@ -202,7 +222,7 @@ public class PaybillPushSapOperation extends AbstractOperationServicePlugIn impl
|
|||
if (null != account) {
|
||||
IT_ITEMS.put("HKONT", account.getString("number")); // 总账科目_科目(凭证分录account)
|
||||
}
|
||||
IT_ITEMS.put("RSTGR", "014");//todo:原因代码_原因码(付款明细shjh_yym)_必填
|
||||
IT_ITEMS.put("RSTGR", RSTGR);//原因代码_原因码(付款明细shjh_yym)_必填
|
||||
IT_ITEMS.put("SGTXT", SGTXT);//行项目文本_SAP会计科目行项目号(付款明细shjh_voucherentrynum)
|
||||
IT_ITEMS.put("KOSTL", KOSTL);//成本中心_成本中心(付款单shjh_costcenter)
|
||||
IT_ITEMS.put("PRCTR", PRCTR);//利润中心_利润中心(付款单shjh_pc)
|
||||
|
|
|
|||
|
|
@ -477,6 +477,7 @@ public class ApplyAdjustBillControler {
|
|||
String vouchertype = it_list.getString("BLART");// 凭证类型_凭证类型
|
||||
String paymentterms = it_list.getString("ZTERM");// 付款条件_付款条件代码
|
||||
String refertoinvoicenumber = "";// TODO:参照发票号
|
||||
String uuid = it_list.getString("XBLNR");//单据号
|
||||
|
||||
// 防重校验
|
||||
QFilter Q5 = new QFilter("shjh_vouchernum", QCP.equals, vouchernum);
|
||||
|
|
@ -548,8 +549,8 @@ public class ApplyAdjustBillControler {
|
|||
return s1;
|
||||
}
|
||||
|
||||
// 设置付款类型
|
||||
setPaymentType(ap_payapply, accountingsubject);
|
||||
// 设置付款类型 //付款类型 外部系统单据类型
|
||||
setPaymentType(ap_payapply, uuid);
|
||||
|
||||
// 设置默认字段
|
||||
String s2 = setDefaultFields(ap_payapply, vouchernum, voucherentrynum, voucheryear, procurementeam, isselfprocurment,
|
||||
|
|
@ -696,19 +697,81 @@ public class ApplyAdjustBillControler {
|
|||
}
|
||||
|
||||
/**
|
||||
* 设置付款类型
|
||||
*
|
||||
* 设置付款类型 外部系统单据类型
|
||||
* @param ap_payapply 付款申请单的动态对象
|
||||
* @param accountingsubject 会计科目
|
||||
*/
|
||||
private void setPaymentType(DynamicObject ap_payapply, String accountingsubject) {
|
||||
String paymentTypeName = "1221020200".equals(accountingsubject) ? "对私付款" : "对公付款";
|
||||
QFilter Q9 = new QFilter("name", QCP.equals, paymentTypeName);
|
||||
DynamicObject paytype = BusinessDataServiceHelper.loadSingle(CAS_PAYMENTBILLTYPE, new QFilter[]{Q9});
|
||||
if (paytype != null) {
|
||||
DynamicObjectCollection entry = ap_payapply.getDynamicObjectCollection("entry");
|
||||
private void setPaymentType(DynamicObject ap_payapply, String uuid) {
|
||||
// String paymentTypeName = "1221020200".equals(accountingsubject) ? "对私付款" : "对公付款";
|
||||
// QFilter Q9 = new QFilter("name", QCP.equals, paymentTypeName);
|
||||
// DynamicObject paytype = BusinessDataServiceHelper.loadSingle(CAS_PAYMENTBILLTYPE, new QFilter[]{Q9});
|
||||
// if (paytype != null) {
|
||||
// DynamicObjectCollection entry = ap_payapply.getDynamicObjectCollection("entry");
|
||||
// if (!entry.isEmpty()) {
|
||||
// entry.get(0).set("e_paymenttype", paytype);
|
||||
// }
|
||||
// }
|
||||
//单据号
|
||||
QFilter qq1 = new QFilter("number", QCP.equals, "JH001");//对公
|
||||
QFilter qq2 = new QFilter("number", QCP.equals, "JH002");//对私
|
||||
DynamicObject paytype_g = BusinessDataServiceHelper.loadSingle(CAS_PAYMENTBILLTYPE, new QFilter[]{qq1});
|
||||
DynamicObject paytype_s = BusinessDataServiceHelper.loadSingle(CAS_PAYMENTBILLTYPE, new QFilter[]{qq2});
|
||||
DynamicObjectCollection entry = ap_payapply.getDynamicObjectCollection("entry");
|
||||
//付款类型 外部系统单据类型
|
||||
if (uuid.contains("JKY")) {
|
||||
ap_payapply.set("shjh_externalsystemdocume","A");//员工借款单
|
||||
if (!entry.isEmpty()) {
|
||||
entry.get(0).set("e_paymenttype", paytype);
|
||||
entry.get(0).set("e_paymenttype", paytype_s);//对私
|
||||
}
|
||||
}else if (uuid.contains("TYB")) {
|
||||
ap_payapply.set("shjh_externalsystemdocume","B");//通用报销单
|
||||
if (!entry.isEmpty()) {
|
||||
entry.get(0).set("e_paymenttype", paytype_s);//对私
|
||||
}
|
||||
}else if (uuid.contains("CLB")) {
|
||||
ap_payapply.set("shjh_externalsystemdocume","C");//差旅报销单
|
||||
if (!entry.isEmpty()) {
|
||||
entry.get(0).set("e_paymenttype", paytype_s);//对私
|
||||
}
|
||||
}else if (uuid.contains("LWB")) {
|
||||
ap_payapply.set("shjh_externalsystemdocume","D");//劳务人员报销单
|
||||
if (!entry.isEmpty()) {
|
||||
entry.get(0).set("e_paymenttype", paytype_s);//对私
|
||||
}
|
||||
}else if (uuid.contains("YFK")) {
|
||||
ap_payapply.set("shjh_externalsystemdocume","E");//预付款单
|
||||
if (!entry.isEmpty()) {
|
||||
entry.get(0).set("e_paymenttype", paytype_g);//对公
|
||||
}
|
||||
}else if (uuid.contains("JCW")) {
|
||||
ap_payapply.set("shjh_externalsystemdocume","F");//请款单无订单
|
||||
if (!entry.isEmpty()) {
|
||||
entry.get(0).set("e_paymenttype", paytype_g);//对公
|
||||
}
|
||||
}else if (uuid.contains("FWK")) { //服务付款单
|
||||
ap_payapply.set("shjh_externalsystemdocume","G");
|
||||
if (!entry.isEmpty()) {
|
||||
entry.get(0).set("e_paymenttype", paytype_g);//对公
|
||||
}
|
||||
}else if (uuid.contains("TFK")) {
|
||||
ap_payapply.set("shjh_externalsystemdocume","I");//其他付款单
|
||||
if (!entry.isEmpty()) {
|
||||
entry.get(0).set("e_paymenttype", paytype_g);//对公
|
||||
}
|
||||
}else if (uuid.contains("SPA")) {
|
||||
ap_payapply.set("shjh_externalsystemdocume","J");//SPA会员退卡申请单
|
||||
if (!entry.isEmpty()) {
|
||||
entry.get(0).set("e_paymenttype", paytype_g);//对公
|
||||
}
|
||||
}else if (uuid.contains("JCH")) {
|
||||
// ap_payapply.set("shjh_externalsystemdocume","JC");//TPM_请款单
|
||||
if (!entry.isEmpty()) {
|
||||
entry.get(0).set("e_paymenttype", paytype_g);//对公JKY0000001
|
||||
}
|
||||
}else if (uuid.contains("TYH")) { //TPM_通用报销单
|
||||
// ap_payapply.set("shjh_externalsystemdocume","TY");
|
||||
if (!entry.isEmpty()) {
|
||||
entry.get(0).set("e_paymenttype", paytype_s);//对私
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue