收款变更问题修复
This commit is contained in:
parent
b38efbc98f
commit
6d4f995dba
|
|
@ -0,0 +1,47 @@
|
|||
package shjh.jhzj7.fi.fi.plugin.form;
|
||||
|
||||
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
|
||||
import java.util.EventObject;
|
||||
|
||||
/**
|
||||
* 认领中心表单插件处理根据认领处理单显示客户拆分
|
||||
* shjh_cas_claimcenterb_ext
|
||||
* @author yuxueliang
|
||||
*/
|
||||
public class ClaimCenterFormPlugin extends AbstractFormPlugin implements Plugin {
|
||||
|
||||
private final static String entryID = "entryentity";//收款认领明细分录标识
|
||||
|
||||
/**
|
||||
* 加载页面触发
|
||||
* @param e
|
||||
*/
|
||||
@Override
|
||||
public void afterBindData(EventObject e) {
|
||||
super.afterBindData(e);
|
||||
//根据收款认领明细中的认领单号还原对象属性至具体列中
|
||||
//e_claimbill shjh_e_khcf
|
||||
DynamicObjectCollection entrys = this.getModel().getEntryEntity(entryID);
|
||||
if (null != entrys) {
|
||||
DynamicObject entryInfo;//收款认领明细对象
|
||||
QFilter q1;
|
||||
DynamicObject claimbill;//认领处理单对象
|
||||
for (int i = 0; i < entrys.size(); i++) {
|
||||
entryInfo = entrys.get(i);
|
||||
q1 = new QFilter("billno", QCP.equals, entryInfo.getString("e_claimbill"));
|
||||
claimbill = BusinessDataServiceHelper.loadSingle("cas_claimbill", "id,billno,shjh_customersplit", q1.toArray());
|
||||
this.getModel().setValue("shjh_e_khcf",claimbill.getBoolean("shjh_customersplit"), i);//客户拆分
|
||||
}
|
||||
//更新分录页面显示
|
||||
this.getView().updateView(entryID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -98,7 +98,7 @@ public class RecBillFromPlugin extends AbstractFormPlugin implements Plugin {
|
|||
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(value, type);
|
||||
if (null != dynamicObject) {
|
||||
String name = dynamicObject.getString("group.name");
|
||||
if (null != name && name.contains("一次性客户")) {
|
||||
if (null != name && name.contains("一次性")) {
|
||||
this.getModel().setValue("shjh_country", "中国");
|
||||
this.getModel().setValue("shjh_city", "上海");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class ClearAccountBillOperation extends AbstractOperationServicePlugIn im
|
|||
private static final String updateSubmitStatus = "update tk_shjh_clear_account set fbillstatus='B' where fid=?;";
|
||||
//手动修改清账状态
|
||||
private static final String hadleClearStatusByID = "update tk_shjh_clear_account set fk_shjh_changereason='手工清账',fk_shjh_clearstatus='A',fbillstatus='C' where fid=?;";
|
||||
private static final String updateSap = "update tk_shjh_clear_account set fk_shjh_clearstatus='A',fk_shjh_pzh=?,fk_shjh_year=? where fid=?;";
|
||||
private static final String updateSap = "update tk_shjh_clear_account set fk_shjh_clearstatus='A',fbillstatus='C',fk_shjh_pzh=?,fk_shjh_year=? where fid=?;";
|
||||
private static final String updateSrcClear = "update tk_shjh_clear_account set fk_shjh_iscopy=1 where fid=?;";
|
||||
private static final String updateUnClearStatus = "update tk_shjh_clear_account set fbillstatus='D',fk_shjh_clearstatus='C',fk_shjh_unclearpzh=? where fid=?;";
|
||||
private static final String updateDetailStatusByBill = "update tk_shjh_clear_acctdetail set fbillstatus='D' where fk_shjh_clearbillid=?;";
|
||||
|
|
|
|||
|
|
@ -0,0 +1,53 @@
|
|||
package shjh.jhzj7.fi.fi.plugin.operate;
|
||||
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.db.DB;
|
||||
import kd.bos.db.DBRoute;
|
||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||
import kd.bos.entity.plugin.PreparePropertysEventArgs;
|
||||
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 收款业务变更单保存和删除操作反写收款单的是否变更标记
|
||||
* shjh_cas_recchgbill_ext
|
||||
* @author yuxueliang
|
||||
*/
|
||||
public class RecbillChangeSaveDelOp extends AbstractOperationServicePlugIn implements Plugin {
|
||||
|
||||
private static final String entityName = "cas_recbill";//收款单
|
||||
private static final String updateReBillChg = "update T_CAS_ReceivingBill set fk_shjh_ischange=1 where fk_shjh_ischange=0 and fid=?;";
|
||||
private static final String updateReBillNotChg = "update T_CAS_ReceivingBill set fk_shjh_ischange=0 where fid=?;";
|
||||
|
||||
@Override
|
||||
public void onPreparePropertys(PreparePropertysEventArgs e) {
|
||||
super.onPreparePropertys(e);
|
||||
List<String> fieldKeys = e.getFieldKeys();
|
||||
fieldKeys.add("sourcebillid");
|
||||
fieldKeys.add("sourcebilltype");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
|
||||
super.afterExecuteOperationTransaction(e);
|
||||
String eok = e.getOperationKey();
|
||||
DynamicObject[] dos = e.getDataEntities();
|
||||
if("save".equals(eok)){
|
||||
for (DynamicObject changeinfo : dos) {
|
||||
if(entityName.equals(changeinfo.getString("sourcebilltype"))){
|
||||
//变更单的源单类型是收款单,反写标记 为 是
|
||||
DB.update(DBRoute.of("fi"), updateReBillChg, new Object[]{changeinfo.getLong("sourcebillid")});
|
||||
}
|
||||
}
|
||||
}else if("delete".equals(eok)){
|
||||
for (DynamicObject changeinfo : dos) {
|
||||
if(entityName.equals(changeinfo.getString("sourcebilltype"))){
|
||||
//变更单的源单类型是收款单,反写标记 为 否
|
||||
DB.update(DBRoute.of("fi"), updateReBillNotChg, new Object[]{changeinfo.getLong("sourcebillid")});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ public class ClosingStatusValidator extends AbstractValidator {
|
|||
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(id, type);
|
||||
if (null != dynamicObject){
|
||||
String name = dynamicObject.getString("group.name");
|
||||
if (null!=name && name.contains("一次性客户")){
|
||||
if (null!=name && name.contains("一次性")){
|
||||
String country = bill.getString("shjh_country");
|
||||
String city = bill.getString("shjh_city");
|
||||
if (country.isEmpty() || city.isEmpty()){
|
||||
|
|
@ -48,16 +48,25 @@ public class ClosingStatusValidator extends AbstractValidator {
|
|||
if("A".equals(bill.getString(RecFieldsInfo.CLOSING_STATUS))){
|
||||
continue;
|
||||
}
|
||||
|
||||
String voucherNum = bill.getString("shjh_vouchernum");
|
||||
if(SapUtils.isEmpty(voucherNum)){
|
||||
//如果收款单凭证号为空
|
||||
this.addErrorMessage(dataEntity, "所选单据不满足变更条件,SAP凭证号≠空。");
|
||||
Long sourcebillid = bill.getLong("sourcebillid");
|
||||
if(sourcebillid == null){
|
||||
continue;
|
||||
}
|
||||
//根据来源单据ID获取对应收款单
|
||||
DynamicObject recebill = BusinessDataServiceHelper.loadSingle(sourcebillid, bill.getString("sourcebilltype"),
|
||||
"id,billno,shjh_vouchernum,shjh_sapfiscalyear");
|
||||
if(recebill == null){
|
||||
continue;
|
||||
}
|
||||
String voucherNum = recebill.getString("shjh_vouchernum");//收款单sap凭证号
|
||||
String sapFiscalYear = recebill.getString("shjh_sapfiscalyear");//收款单sap凭证年度
|
||||
if(SapUtils.isEmpty(voucherNum) || SapUtils.isEmpty(sapFiscalYear)){
|
||||
continue;
|
||||
}
|
||||
|
||||
//则需要调用SAP收款凭证清账状态查询接口
|
||||
String billNumber = bill.getString("billno");
|
||||
String companyCode = bill.getString("org.number");
|
||||
String sapFiscalYear = bill.getString("shjh_sapfiscalyear");
|
||||
// String sapLineNumber = bill.getString("shjh_sapline");
|
||||
//此时不传行号给sap,sap返回这个凭证下的所有行清账标识,我方解析,只要有一行是已清账,就提示
|
||||
String response = SapUtils.querySapClearAccountsState(billNumber, companyCode, voucherNum, sapFiscalYear);
|
||||
|
|
@ -67,9 +76,13 @@ public class ClosingStatusValidator extends AbstractValidator {
|
|||
String code = json.getString("code");
|
||||
if (!"0".equals(code)) {
|
||||
this.addErrorMessage(dataEntity, "SAP收款凭证清账状态查询接口调用失败,错误信息:"+json.getString("msg"));
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
JSONObject data = json.getJSONObject("data");
|
||||
if(data == null){
|
||||
this.addErrorMessage(dataEntity, "SAP收款凭证清账状态查询接口返回值未包含data");
|
||||
continue;
|
||||
}
|
||||
JSONArray itItems = data.getJSONArray("IT_ITEMS");
|
||||
if (itItems != null && !itItems.isEmpty()) {
|
||||
JSONObject resultItem;
|
||||
|
|
@ -82,7 +95,6 @@ public class ClosingStatusValidator extends AbstractValidator {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
this.addErrorMessage(dataEntity, "SAP收款凭证清账状态查询接口返回值未包含IT_ITEMS");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue