64 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Java
		
	
	
	
			
		
		
	
	
			64 lines
		
	
	
		
			2.6 KiB
		
	
	
	
		
			Java
		
	
	
	
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;
 | 
						|
import kd.bos.orm.query.QFilter;
 | 
						|
import kd.bos.servicehelper.BusinessDataServiceHelper;
 | 
						|
import kd.bos.servicehelper.QueryServiceHelper;
 | 
						|
import kd.bos.servicehelper.operation.SaveServiceHelper;
 | 
						|
import org.apache.commons.lang3.StringUtils;
 | 
						|
import tqq9.lc123.cloud.app.plugin.trd.FWImpl;
 | 
						|
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) {
 | 
						|
            //判断推送的是采购订单 还是采购订单变更单
 | 
						|
            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);
 | 
						|
                }
 | 
						|
            }
 | 
						|
            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");
 | 
						|
                        bill.set("tqq9_fwrequestid", requestid);
 | 
						|
                        bill.set("tqq9_fwstate", "B");
 | 
						|
                        SaveServiceHelper.save(new DynamicObject[]{bill});
 | 
						|
                    }
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
    
 | 
						|
    
 | 
						|
 | 
						|
}
 |