lc/lc123/cloud/app/api/controller/WMSPurInController.java

66 lines
2.9 KiB
Java

package tqq9.lc123.cloud.app.api.controller;
import com.drew.lang.annotations.NotNull;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.utils.StringUtils;
import kd.bos.entity.botp.runtime.PushArgs;
import kd.bos.form.plugin.AbstractFormPlugin;
import kd.bos.openapi.common.custom.annotation.ApiController;
import kd.bos.openapi.common.custom.annotation.ApiParam;
import kd.bos.openapi.common.custom.annotation.ApiPostMapping;
import kd.bos.openapi.common.result.CustomApiResult;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.sdk.plugin.Plugin;
import org.json.JSONObject;
import tqq9.lc123.cloud.app.api.model.FWBillStateUpdModel;
import tqq9.lc123.cloud.app.api.utils.ApiResultExt;
import tqq9.lc123.cloud.app.plugin.utils.BotpParamUtils;
import java.util.*;
/**
* 动态表单插件
*/
@ApiController(value = "AbstractFormPlugin", desc = "WMS-收获通知下推采购入库单")
public class WMSPurInController extends AbstractFormPlugin implements Plugin {
private static String RECEIPTNOTICE = "pm_receiptnotice";
private static String PURINBILL = "im_purinbill";
private static String RECEIPTNOTICE_ENTRY = "billentry";
@ApiPostMapping(value = "/WMSPushPurIn", desc = "WMS-收获通知下推采购入库单")
public CustomApiResult<ApiResultExt> WMS_PurInPush
(@NotNull @ApiParam(value = "入参", example = "") HashMap<String, Object> data) {
ApiResultExt resultExt = new ApiResultExt();
List<ApiResultExt.ResultBean> results = new ArrayList<>();
String VoucherType =(String)data.get("VoucherType");//单据类型
if(StringUtils.equals("采购订单",VoucherType)){
String rule = BotpParamUtils.getBotpRuleId(RECEIPTNOTICE, PURINBILL, "收货通知单_采购入库单_转换规则");
String billno =(String)data.get("erpOrderCode");//收货通知单编号
//收货通知单
DynamicObject receiptnotice = BusinessDataServiceHelper.loadSingle(RECEIPTNOTICE, new QFilter[]{new QFilter("billno", QCP.equals, billno)});
Map<String, Object> param =new HashMap<>();//传入转换规则处理参数
HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map
JSONObject jsonObject = new JSONObject();
Long entryId = (Long)data.get("erpDetailId");//收货通知单明细id
jsonObject.put("erpDetailId",entryId);
jsonObject.put("quantity",data.get("quantity"));
jsonObject.put("erpDetailId",data.get("erpDetailId"));
jsonObject.put("erpDetailId",data.get("erpDetailId"));
jsonObject.put("erpDetailId",data.get("erpDetailId"));
PushArgs pushArgs = BotpParamUtils.getPushArgs(PURINBILL, RECEIPTNOTICE, RECEIPTNOTICE_ENTRY, param, entitypkMap, rule);
}
resultExt.setResult(results);
return CustomApiResult.success(resultExt);
}
}