反清账优化

This commit is contained in:
yuxueliang0813 2025-04-25 17:59:26 +08:00
parent c693cb9006
commit ffd8fae545
1 changed files with 22 additions and 13 deletions

View File

@ -411,31 +411,40 @@ public class ClearAccountBillOperation extends AbstractOperationServicePlugIn im
private String sapReversalVoucher(DynamicObject prinfo) {
//SAP反清账接口入参组装和调用
JSONArray IT_LIST = new JSONArray();
JSONObject iteminfo = new JSONObject();
String companyCode = prinfo.getDynamicObject("org").getString("number");
//添加公司过滤条件
addFilterCondition(IT_LIST, "BUKRS", companyCode, companyCode);
//添加公司
// addFilterCondition(IT_LIST, "BUKRS", companyCode, companyCode);
iteminfo.put("BUKRS", companyCode);
String shjh_pzh = prinfo.getString("shjh_pzh");
//添加会计凭证编号过滤条件
addFilterCondition(IT_LIST, "BELNR", shjh_pzh, shjh_pzh);
//添加会计凭证编号
// addFilterCondition(IT_LIST, "BELNR", shjh_pzh, shjh_pzh);
iteminfo.put("BELNR", shjh_pzh);
String shjh_year = prinfo.getString("shjh_year");
//添加会计年度过滤条件
addFilterCondition(IT_LIST, "GJAHR", shjh_year, shjh_year);
//添加冲销原因过滤条件-04-跨期冲销默认04冲销日期必传
addFilterCondition(IT_LIST, "STGRD", "04", "04");
//添加用户名过滤条件-操作反清账按钮的用户OA用户名
//添加会计年度
// addFilterCondition(IT_LIST, "GJAHR", shjh_year, shjh_year);
iteminfo.put("GJAHR", shjh_year);
//添加冲销原因-04-跨期冲销默认04冲销日期必传
// addFilterCondition(IT_LIST, "STGRD", "04", "04");
iteminfo.put("STGRD", "04");
//添加用户名-操作反清账按钮的用户OA用户名
DynamicObject userinfo = BusinessDataServiceHelper.loadSingleFromCache(RequestContext.get().getCurrUserId(), userName);
String oauser = userinfo.getString("shjh_oauser");
addFilterCondition(IT_LIST, "UNAME", oauser, oauser);
//添加反清账日期过滤条件
// addFilterCondition(IT_LIST, "UNAME", oauser, oauser);
iteminfo.put("UNAME", oauser);
//添加反清账日期
if(prinfo.getDate("shjh_uncleardate") != null){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String datestr = sdf.format(prinfo.getDate("shjh_uncleardate"));
addFilterCondition(IT_LIST, "BUDAT", datestr, datestr);
// addFilterCondition(IT_LIST, "BUDAT", datestr, datestr);
iteminfo.put("BUDAT", datestr);
}else{
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String datestr = sdf.format(new Date());
addFilterCondition(IT_LIST, "BUDAT", datestr, datestr);
// addFilterCondition(IT_LIST, "BUDAT", datestr, datestr);
iteminfo.put("BUDAT", datestr);
}
IT_LIST.add(iteminfo);
JSONObject sapReturnData = SapUtils.sapReversalAPI(IT_LIST,prinfo.getString("billno"));
//sap返回的结果不为空且正确