sap推送优化
This commit is contained in:
parent
4ccfc07215
commit
f5aeed9b66
|
|
@ -106,8 +106,8 @@ public class ClearBillFormPlugin extends AbstractBillPlugIn implements Plugin {
|
|||
//上述两句应该可以跳过权限验证
|
||||
//如下代码设置目标界面打开时的高度和宽度
|
||||
StyleCss styleCss = new StyleCss();
|
||||
styleCss.setWidth("1400");
|
||||
styleCss.setHeight("800");
|
||||
styleCss.setWidth("80%");
|
||||
styleCss.setHeight("60%");
|
||||
showParameter.getOpenStyle().setInlineStyleCss(styleCss);
|
||||
|
||||
//设置页面ID
|
||||
|
|
|
|||
|
|
@ -102,6 +102,10 @@ public class RecPushVoucherOperation extends AbstractOperationServicePlugIn impl
|
|||
* 是否已生成凭证
|
||||
*/
|
||||
public final static String KEY_IS_VOUCHER = "isvoucher";
|
||||
/**
|
||||
* 收款金额
|
||||
*/
|
||||
public final static String KEY_CAMT = "actrecamt";
|
||||
|
||||
@Override
|
||||
public void validate() {
|
||||
|
|
@ -118,6 +122,11 @@ public class RecPushVoucherOperation extends AbstractOperationServicePlugIn impl
|
|||
this.addErrorMessage(dataEntity, "【" + billNo + "】未付款,无法推送。");
|
||||
}
|
||||
// String voucherNum = (String) rowDataModel.getValue(KEY_VOUCHER_NUM);
|
||||
//负数金额不能使用此操作
|
||||
BigDecimal recamount = (BigDecimal) rowDataModel.getValue(KEY_CAMT);
|
||||
if (recamount.compareTo(BigDecimal.ZERO) < 0) {
|
||||
this.addErrorMessage(dataEntity, "【" + billNo + "】为红单,不能使用此按钮推送,请使用SAP凭证红冲按钮。");
|
||||
}
|
||||
boolean result = (boolean) rowDataModel.getValue(KEY_IS_PUSH_SAP);
|
||||
if (result) {
|
||||
this.addErrorMessage(dataEntity, "【" + billNo + "】已推送SAP,请勿重复推送。");
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONException;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.sap.db.jdbc.packet.ErrorLevel;
|
||||
import kd.bos.context.RequestContext;
|
||||
import kd.bos.dataentity.OperateOption;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.operate.result.OperateErrorInfo;
|
||||
|
|
@ -16,7 +15,6 @@ import kd.bos.logging.Log;
|
|||
import kd.bos.logging.LogFactory;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.operation.OperationServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
import shjh.jhzj7.fi.fi.utils.EsbUtils;
|
||||
|
|
@ -83,7 +81,7 @@ public class SupplierInitOperation extends AbstractOperationServicePlugIn implem
|
|||
taxno = json_body.getString("taxno");
|
||||
type = json_body.getString("type");
|
||||
|
||||
if(EsbUtils.isEmpty(supnumber) || EsbUtils.isEmpty(supname) || EsbUtils.isEmpty(taxno) || EsbUtils.isEmpty(type)){
|
||||
if(EsbUtils.isEmpty(supnumber) || EsbUtils.isEmpty(supname) || EsbUtils.isEmpty(type)){
|
||||
log.error(String.format("供应商接口入参为空异常:%s", json_body.toJSONString()));
|
||||
itemInfo = new JSONObject();
|
||||
itemInfo.put("code",supnumber);
|
||||
|
|
@ -182,15 +180,19 @@ public class SupplierInitOperation extends AbstractOperationServicePlugIn implem
|
|||
//处理 sap公司信息 结算方式 统驭科目
|
||||
handleSAPCompany(companysJson,currentSup.getDynamicObjectCollection("shjh_entry_sap"),supnumber);
|
||||
//保存供应商
|
||||
// SaveServiceHelper.save(new DynamicObject[]{currentSup});
|
||||
OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{currentSup}, OperateOption.create());
|
||||
SaveServiceHelper.save(new DynamicObject[]{currentSup});
|
||||
// OperationServiceHelper.executeOperate("save", entityName, new DynamicObject[]{currentSup}, OperateOption.create());
|
||||
cusids.put(supnumber,currentSup.getLong("id"));
|
||||
//先拿1000个供应商试试
|
||||
if(i == 1000){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//处理供应商分配
|
||||
EsbUtils.handleAssign(companysJson, cusids, entityName);
|
||||
EsbUtils.handleAssignNew(companysJson, cusids, entityName);
|
||||
//处理供应商取消分配
|
||||
EsbUtils.handleUnAssign(companysJson, cusids, entityName);
|
||||
// EsbUtils.handleUnAssign(companysJson, cusids, entityName);
|
||||
|
||||
if(itemsJson.isEmpty()){
|
||||
this.operationResult.addSuccessPkId(pzinfo.getPkValue());
|
||||
|
|
|
|||
|
|
@ -108,6 +108,81 @@ public class EsbUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static void handleUnAssignNew(JSONArray companysJson, Map<String, Long> cusids, String entityName) {
|
||||
if(companysJson == null || cusids.isEmpty()){
|
||||
return;
|
||||
}
|
||||
String cusnumber;
|
||||
String compnum;
|
||||
JSONObject json_body;
|
||||
DynamicObject compinfo;
|
||||
Set<Long> dataList = new HashSet<>(1);
|
||||
Set<Long> orgList = new HashSet<>();
|
||||
for (Map.Entry<String,Long> entry : cusids.entrySet()) {
|
||||
orgList.clear();
|
||||
for (int i = 0; i < companysJson.size(); i++) {
|
||||
json_body = companysJson.getJSONObject(i);
|
||||
cusnumber = json_body.getString("code");//客户-供应商编号
|
||||
compnum = json_body.getString("companynum");//公司编号
|
||||
if(EsbUtils.isEmpty(cusnumber) || EsbUtils.isEmpty(compnum) || "1".equals(json_body.getString("companystatus"))){
|
||||
//公司编号为空 或者 公司层面使用状态-禁用的 不处理
|
||||
continue;
|
||||
}
|
||||
//还原公司id
|
||||
compinfo = BusinessDataServiceHelper.loadSingleFromCache(orgName,"id,number",new QFilter[]{new QFilter("number","=",compnum)});
|
||||
if(compinfo == null){
|
||||
continue;
|
||||
}
|
||||
if(cusnumber.equals(entry.getKey())){
|
||||
orgList.add(compinfo.getLong("id"));
|
||||
}
|
||||
}
|
||||
if(!orgList.isEmpty()){
|
||||
dataList.clear();
|
||||
dataList.add(entry.getValue());
|
||||
// BaseDataServiceHelper.batchAssignWithDetail(entityName,JhzjUtils.GROUPID,dataList,orgList);
|
||||
BaseDataServiceHelper.cancelAssign(entityName,dataList,orgList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void handleAssignNew(JSONArray companysJson, Map<String, Long> cusids, String entityName) {
|
||||
if(companysJson == null || cusids.isEmpty()){
|
||||
return;
|
||||
}
|
||||
String cusnumber;
|
||||
String compnum;
|
||||
JSONObject json_body;
|
||||
DynamicObject compinfo;
|
||||
List<Long> dataList = new ArrayList<>(1);
|
||||
List<Long> orgList = new ArrayList<>();
|
||||
for (Map.Entry<String,Long> entry : cusids.entrySet()) {
|
||||
orgList.clear();
|
||||
for (int i = 0; i < companysJson.size(); i++) {
|
||||
json_body = companysJson.getJSONObject(i);
|
||||
cusnumber = json_body.getString("code");//客户-供应商编号
|
||||
compnum = json_body.getString("companynum");//公司编号
|
||||
if(EsbUtils.isEmpty(cusnumber) || EsbUtils.isEmpty(compnum) || "0".equals(json_body.getString("companystatus"))){
|
||||
//公司编号为空 或者 公司层面使用状态-禁用的 不处理
|
||||
continue;
|
||||
}
|
||||
//还原公司id
|
||||
compinfo = BusinessDataServiceHelper.loadSingleFromCache(orgName,"id,number",new QFilter[]{new QFilter("number","=",compnum)});
|
||||
if(compinfo == null){
|
||||
continue;
|
||||
}
|
||||
if(cusnumber.equals(entry.getKey())){
|
||||
orgList.add(compinfo.getLong("id"));
|
||||
}
|
||||
}
|
||||
if(!orgList.isEmpty()){
|
||||
dataList.clear();
|
||||
dataList.add(entry.getValue());
|
||||
BaseDataServiceHelper.batchAssignWithDetail(entityName,JhzjUtils.GROUPID,dataList,orgList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//处理分配
|
||||
public static void handleAssign(JSONArray companysJson, Map<String, Long> cusids, String entityName) {
|
||||
if(companysJson == null || cusids.isEmpty()){
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public class SupplierControler {
|
|||
taxno = json_body.getString("taxno");
|
||||
type = json_body.getString("type");
|
||||
|
||||
if(EsbUtils.isEmpty(supnumber) || EsbUtils.isEmpty(supname) || EsbUtils.isEmpty(taxno) || EsbUtils.isEmpty(type)){
|
||||
if(EsbUtils.isEmpty(supnumber) || EsbUtils.isEmpty(supname) || EsbUtils.isEmpty(type)){
|
||||
log.error(String.format("供应商接口入参为空异常:%s", json_body.toJSONString()));
|
||||
itemInfo = new JSONObject();
|
||||
itemInfo.put("code",supnumber);
|
||||
|
|
|
|||
Loading…
Reference in New Issue