2025-10-15 09:57:59 +00:00
|
|
|
package tqq9.lc123.cloud.app.plugin.operate.pm;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
|
|
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
|
|
import kd.bos.entity.operate.result.OperationResult;
|
|
|
|
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
|
|
|
|
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
2025-10-21 10:07:24 +00:00
|
|
|
import kd.bos.orm.query.QFilter;
|
2025-10-15 09:57:59 +00:00
|
|
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
2025-10-21 10:07:24 +00:00
|
|
|
import kd.bos.servicehelper.QueryServiceHelper;
|
2025-10-16 05:31:35 +00:00
|
|
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import tqq9.lc123.cloud.app.plugin.trd.FWImpl;
|
2025-10-15 09:57:59 +00:00
|
|
|
import tqq9.lc123.cloud.app.plugin.utils.FWRestfulUtils;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
public class PurOrderSubmitOp extends AbstractOperationServicePlugIn {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
|
|
|
|
|
super.afterExecuteOperationTransaction(e);
|
|
|
|
|
OperationResult operationResult = this.getOperationResult();
|
|
|
|
|
List<Object> successPkIds = operationResult.getSuccessPkIds();
|
|
|
|
|
for (Object successPkId : successPkIds) {
|
2025-10-21 10:07:24 +00:00
|
|
|
//判断推送的是采购订单 还是采购订单变更单
|
|
|
|
|
String resultStr = null;
|
|
|
|
|
DynamicObject bill = null;
|
|
|
|
|
boolean existOrder = QueryServiceHelper.exists("pm_purorderbill", successPkId);
|
|
|
|
|
if(existOrder){
|
|
|
|
|
bill = BusinessDataServiceHelper.loadSingle(successPkId, "pm_purorderbill");
|
|
|
|
|
resultStr = FWImpl.pushFwPurorder(bill);
|
|
|
|
|
}else{
|
|
|
|
|
boolean existChange = QueryServiceHelper.exists("pm_xspurorderbill", successPkId);
|
|
|
|
|
if(existChange){
|
|
|
|
|
bill = BusinessDataServiceHelper.loadSingle(successPkId, "pm_xspurorderbill");
|
|
|
|
|
resultStr = FWImpl.pushFwPurChange(bill);
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-10-16 05:31:35 +00:00
|
|
|
if(StringUtils.isNotBlank(resultStr)){
|
|
|
|
|
JSONObject resultObj = JSONObject.parseObject(resultStr);
|
|
|
|
|
String code = resultObj.getString("code");
|
|
|
|
|
if("SUCCESS".equals(code)){
|
|
|
|
|
JSONObject data = resultObj.getJSONObject("data");
|
|
|
|
|
if(data != null){
|
|
|
|
|
String requestid = data.getString("requestid");
|
2025-10-21 10:07:24 +00:00
|
|
|
bill.set("tqq9_fwrequestid", requestid);
|
2025-10-28 09:23:58 +00:00
|
|
|
bill.set("tqq9_fwstate", "B");
|
2025-10-21 10:07:24 +00:00
|
|
|
SaveServiceHelper.save(new DynamicObject[]{bill});
|
2025-10-16 05:31:35 +00:00
|
|
|
}
|
2025-10-15 09:57:59 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-10-16 05:31:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-15 09:57:59 +00:00
|
|
|
}
|