红单冲销获取日期、错误提示优化

This commit is contained in:
李贵强 2025-10-29 11:27:35 +08:00
parent 405186b307
commit cd8d847b80
1 changed files with 95 additions and 91 deletions

View File

@ -33,6 +33,7 @@ import java.util.Map;
/**
* 定期预提记账处理 shjh_cim_depositprein_ext-单据推送sap操作插件
*
* @author yuxueliang
*/
public class DepositpreintSapOperation extends AbstractOperationServicePlugIn implements Plugin {
@ -122,7 +123,7 @@ public class DepositpreintSapOperation extends AbstractOperationServicePlugIn im
}
String key = resultData.getString("OBJ_KEY");
if (JhzjUtils.isEmpty(key)) {
addErrorInfo(prinfo,"推送SAP接口失败SAP返回值OBJ_KEY为空");
addErrorInfo(prinfo, "推送SAP接口失败:"+resultData.getString("ZMESSAGE"));
continue;
}
//推送sap成功后反写已推送标记和sap凭证号和年度至预提单中
@ -164,9 +165,7 @@ public class DepositpreintSapOperation extends AbstractOperationServicePlugIn im
iteminfo.put("UNAME", oauser);//用户名
}
//添加反清账日期
long batchnoid = prinfo.getLong("batchnoid");
if (batchnoid!=0L){
Date date = this.getSourceDate(batchnoid,iteminfo);
Date date = this.getSourceDate(prinfo, iteminfo);
if (date != null) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String datestr = sdf.format(date);
@ -176,16 +175,21 @@ public class DepositpreintSapOperation extends AbstractOperationServicePlugIn im
iteminfo.put("GJAHR", datestr2);
}
}
IT_LIST.add(iteminfo);
JSONObject sapReturnData = SapUtils.sapReversalAPI(IT_LIST, prinfo.getString("billno"));
return sapReturnData;
}
private Date getSourceDate(long batchnoid,JSONObject iteminfo) {
//联查蓝单
QFilter qFilter = new QFilter("batchnoid", QCP.equals, batchnoid);//批次id
private Date getSourceDate(DynamicObject prinfo, JSONObject iteminfo) {
Long pkValue = prinfo.getLong("batchnoid");
QFilter qFilter = new QFilter("batchnoid", QCP.equals, pkValue);//批次id
if (pkValue == 0L) {
pkValue = prinfo.getLong("writeoffpreintbillid");;
qFilter = new QFilter("id", QCP.equals, pkValue);
}
qFilter.and("operatetype", QCP.equals, "preint");//操作类别
DynamicObject depositprein = BusinessDataServiceHelper.loadSingle("cim_depositpreint", qFilter.toArray());
if (depositprein != null) {