lc/lc123/cloud/app/plugin/operate/sys/MaterialUnsubmitOp.java

66 lines
3.2 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package tqq9.lc123.cloud.app.plugin.operate.sys;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.args.AfterOperationArgs;
import kd.sdk.plugin.Plugin;
/**
* 单据操作插件
* 物料撤销 调用流程撤回 接口
*/
public class MaterialUnsubmitOp extends AbstractOperationServicePlugIn implements Plugin {
// private static final Log logger = LogFactory.getLog(MaterialUnsubmitOp.class);
// final static String KEY_OPKEY = "unsubmit";
// private static String WL_UnSubmit_URL;
//
// static {
// DynamicObject url = BusinessDataServiceHelper.loadSingle("tqq9_thirdconfig", "name",
// new QFilter[]{new QFilter("number", QCP.equals, "WL_UnSubmit_URL")});
// WL_UnSubmit_URL = url != null ? url.getString("name") : null;
// }
@Override
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
super.afterExecuteOperationTransaction(e);
// LCLogService lcLogService = new LCLogServiceImpl();
// String operationKey = e.getOperationKey();
// if (StringUtils.equals(operationKey, KEY_OPKEY)) {
// //获取选中的物料单据数据
// DynamicObject[] dataEntities = e.getDataEntities();
// for (DynamicObject material : dataEntities) {
// String id = String.valueOf(material.getLong("id"));
// // 创建HttpClient实例
// try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
// // 创建PUT请求
// HttpPut httpPut = new HttpPut(WL_UnSubmit_URL);
// // 设置请求体
// StringEntity entity1 = new StringEntity("0", ContentType.APPLICATION_JSON);
// StringEntity entity2 = new StringEntity(id, ContentType.APPLICATION_JSON);
// httpPut.setEntity(entity1);
// httpPut.setEntity(entity2);
// // 执行请求并处理响应
// try (CloseableHttpResponse response = httpClient.execute(httpPut)) {
// int statusCode = response.getStatusLine().getStatusCode();
// HttpEntity responseEntity = response.getEntity();
//
// if (responseEntity == null) {
// throw new IOException("Empty response entity");
// }
//
// String responseBody = EntityUtils.toString(responseEntity, StandardCharsets.UTF_8);
// logger.debug("Response status: {}, Body: {}", statusCode, responseBody);
//
// if (statusCode < 200 || statusCode >= 300) {
// throw new IOException("HTTP request failed with status code: " + statusCode + "\n" + "HTTP request failed responseBody: " + responseBody);
// }
// }
//
// } catch (IOException ex) {
// lcLogService.savelog("FW_流程实例流程撤回", WL_UnSubmit_URL, false, false, id.toString(), "接口调用报错errormessage:" + ex.getMessage());
// throw new RuntimeException(ex + "FW_流程实例流程撤回失败" );
// }
// }
//
// }
}
}