1.入库回传接口--收货下推入库
This commit is contained in:
parent
366920037e
commit
c0f702c41a
|
|
@ -1,9 +1,16 @@
|
||||||
package tqq9.lc123.cloud.app.api.controller;
|
package tqq9.lc123.cloud.app.api.controller;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.drew.lang.annotations.NotNull;
|
import com.drew.lang.annotations.NotNull;
|
||||||
|
import kd.bos.dataentity.OperateOption;
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.dataentity.utils.StringUtils;
|
import kd.bos.dataentity.utils.StringUtils;
|
||||||
|
import kd.bos.entity.botp.runtime.ConvertOperationResult;
|
||||||
import kd.bos.entity.botp.runtime.PushArgs;
|
import kd.bos.entity.botp.runtime.PushArgs;
|
||||||
|
import kd.bos.entity.botp.runtime.SourceBillReport;
|
||||||
|
import kd.bos.entity.operate.result.IOperateInfo;
|
||||||
|
import kd.bos.entity.operate.result.OperationResult;
|
||||||
import kd.bos.form.plugin.AbstractFormPlugin;
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||||
import kd.bos.openapi.common.custom.annotation.ApiController;
|
import kd.bos.openapi.common.custom.annotation.ApiController;
|
||||||
import kd.bos.openapi.common.custom.annotation.ApiParam;
|
import kd.bos.openapi.common.custom.annotation.ApiParam;
|
||||||
|
|
@ -12,16 +19,18 @@ import kd.bos.openapi.common.result.CustomApiResult;
|
||||||
import kd.bos.orm.query.QCP;
|
import kd.bos.orm.query.QCP;
|
||||||
import kd.bos.orm.query.QFilter;
|
import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.servicehelper.botp.ConvertServiceHelper;
|
||||||
|
import kd.bos.servicehelper.operation.OperationServiceHelper;
|
||||||
import kd.sdk.plugin.Plugin;
|
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.api.utils.ApiResultExt;
|
||||||
|
import tqq9.lc123.cloud.app.api.utils.Constants;
|
||||||
import tqq9.lc123.cloud.app.plugin.utils.BotpParamUtils;
|
import tqq9.lc123.cloud.app.plugin.utils.BotpParamUtils;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 动态表单插件
|
* 入库回传java接口插件
|
||||||
*/
|
*/
|
||||||
@ApiController(value = "AbstractFormPlugin", desc = "WMS-收获通知下推采购入库单")
|
@ApiController(value = "AbstractFormPlugin", desc = "WMS-收获通知下推采购入库单")
|
||||||
public class WMSPurInController extends AbstractFormPlugin implements Plugin {
|
public class WMSPurInController extends AbstractFormPlugin implements Plugin {
|
||||||
|
|
@ -31,36 +40,141 @@ public class WMSPurInController extends AbstractFormPlugin implements Plugin {
|
||||||
private static String PURINBILL = "im_purinbill";
|
private static String PURINBILL = "im_purinbill";
|
||||||
private static String RECEIPTNOTICE_ENTRY = "billentry";
|
private static String RECEIPTNOTICE_ENTRY = "billentry";
|
||||||
|
|
||||||
@ApiPostMapping(value = "/WMSPushPurIn", desc = "WMS-收获通知下推采购入库单")
|
@ApiPostMapping(value = "/WMSPushPurIn", desc = "WMS-入库回传")
|
||||||
public CustomApiResult<ApiResultExt> WMS_PurInPush
|
public CustomApiResult<ApiResultExt> WMS_PurInPush
|
||||||
(@NotNull @ApiParam(value = "入参", example = "") HashMap<String, Object> data) {
|
(@NotNull @ApiParam(value = "入参", example = "") HashMap<String, Object> data) {
|
||||||
ApiResultExt resultExt = new ApiResultExt();
|
ApiResultExt resultExt = new ApiResultExt();
|
||||||
List<ApiResultExt.ResultBean> results = new ArrayList<>();
|
List<ApiResultExt.ResultBean> results = new ArrayList<>();
|
||||||
String VoucherType = (String) data.get("VoucherType");//单据类型
|
String VoucherType = (String) data.get("VoucherType");//单据类型
|
||||||
if(StringUtils.equals("采购订单",VoucherType)){
|
int index = 0;
|
||||||
String rule = BotpParamUtils.getBotpRuleId(RECEIPTNOTICE, PURINBILL, "收货通知单_采购入库单_转换规则");
|
if (StringUtils.equals("pm_receiptnotice", VoucherType)) {
|
||||||
String billno = (String) data.get("erpOrderCode");//收货通知单编号
|
String billno = (String) data.get("erpOrderCode");//收货通知单编号
|
||||||
//收货通知单
|
//收货通知单
|
||||||
DynamicObject receiptnotice = BusinessDataServiceHelper.loadSingle(RECEIPTNOTICE, new QFilter[]{new QFilter("billno", QCP.equals, billno)});
|
DynamicObject receiptnotice = BusinessDataServiceHelper.loadSingle(RECEIPTNOTICE, new QFilter[]{new QFilter("billno", QCP.equals, billno)});
|
||||||
|
JSONObject keys = new JSONObject();
|
||||||
|
keys.put("billno", billno);
|
||||||
|
ApiResultExt.ResultBean resultBean = new ApiResultExt.ResultBean();
|
||||||
|
ApiResultExt.Error error = new ApiResultExt.Error();
|
||||||
|
error.setRowMsg(new ArrayList<String>());
|
||||||
|
resultBean.setBillIndex(0);
|
||||||
|
resultBean.setKeys(keys);
|
||||||
|
resultBean.setNumber(billno);
|
||||||
|
resultBean.setType(Constants.TYPE_PUSH);
|
||||||
|
if (receiptnotice == null) {
|
||||||
|
index = 1;
|
||||||
|
List<String> rowMsg = error.getRowMsg();
|
||||||
|
rowMsg.add("根据传入编号:" + billno + "未找到对应收货通知单");
|
||||||
|
error.setRowMsg(rowMsg);
|
||||||
|
error.setEntityKey(Constants.IM_PURINBILL);
|
||||||
|
error.setKeys(keys);
|
||||||
|
resultBean.setId("");
|
||||||
|
resultBean.setBillStatus(false);
|
||||||
|
resultBean.setErrors(error);
|
||||||
|
results.add(resultBean);
|
||||||
|
} else {
|
||||||
|
Long id = receiptnotice.getLong("id");
|
||||||
Map<String, Object> param = new HashMap<>();//传入转换规则处理参数
|
Map<String, Object> param = new HashMap<>();//传入转换规则处理参数
|
||||||
HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map
|
HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();//上下游id映射Map
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject detailObject = new JSONObject();
|
||||||
Long entryId = (Long)data.get("erpDetailId");//收货通知单明细id
|
JSONArray details = (JSONArray) data.get("details");
|
||||||
jsonObject.put("erpDetailId",entryId);
|
for (Object detail : details) {
|
||||||
jsonObject.put("quantity",data.get("quantity"));
|
JSONObject detail1 = (JSONObject) detail;
|
||||||
jsonObject.put("erpDetailId",data.get("erpDetailId"));
|
String entryId = detail1.getString("erpDetailId");//金蝶源头单据细单号
|
||||||
jsonObject.put("erpDetailId",data.get("erpDetailId"));
|
BigDecimal quantity = detail1.getBigDecimal("quantity");//入库数量
|
||||||
jsonObject.put("erpDetailId",data.get("erpDetailId"));
|
String uniqueCode = detail1.getString("uniqueCode");//商品编码
|
||||||
|
Date manufactureDate = detail1.getDate("manufactureDate");//生产日期
|
||||||
|
Date expirationDate = detail1.getDate("expirationDate");//失效期
|
||||||
PushArgs pushArgs = BotpParamUtils.getPushArgs(PURINBILL, RECEIPTNOTICE, RECEIPTNOTICE_ENTRY, param, entitypkMap, rule);
|
String batch = detail1.getString("batch");//批次
|
||||||
|
String registrationCode = detail1.getString("registrationCode");//注册证号
|
||||||
|
String licenceCode = detail1.getString("licenceCode");//生产许可证
|
||||||
|
String producer = detail1.getString("producer");//生产厂商
|
||||||
|
detailObject.put("entryId", entryId);
|
||||||
|
detailObject.put("uniqueCode", uniqueCode);
|
||||||
|
detailObject.put("quantity", quantity);
|
||||||
|
detailObject.put("manufactureDate", manufactureDate);
|
||||||
|
detailObject.put("expirationDate", expirationDate);
|
||||||
|
detailObject.put("batch", batch);
|
||||||
|
detailObject.put("registrationCode", registrationCode);
|
||||||
|
detailObject.put("licenceCode", licenceCode);
|
||||||
|
detailObject.put("producer", producer);
|
||||||
|
entitypkMap.computeIfAbsent(id, k -> new HashSet<>()).add(detail1.getLong("erpDetailId"));
|
||||||
|
param.put(entryId, detailObject);
|
||||||
|
}
|
||||||
|
//开始下推
|
||||||
|
String rule = BotpParamUtils.getBotpRuleId(RECEIPTNOTICE, PURINBILL, "收货通知单_采购入库单_转换规则");
|
||||||
|
PushArgs pushArgs = BotpParamUtils.getPushArgs(RECEIPTNOTICE, PURINBILL, RECEIPTNOTICE_ENTRY, param, entitypkMap, rule);
|
||||||
|
ConvertOperationResult pushResult = ConvertServiceHelper.pushAndSave(pushArgs);
|
||||||
|
List<SourceBillReport> billReports = pushResult.getBillReports();
|
||||||
|
if (!pushResult.isSuccess()) {
|
||||||
|
for (SourceBillReport billReport : billReports) {
|
||||||
|
String billMessage = billReport.getFailMessage();
|
||||||
|
List<String> rowMsg = error.getRowMsg();
|
||||||
|
rowMsg.add(billMessage);
|
||||||
|
error.setRowMsg(rowMsg);
|
||||||
|
error.setEntityKey(Constants.IM_PURINBILL);
|
||||||
|
error.setKeys(keys);
|
||||||
|
resultBean.setId("");
|
||||||
|
resultBean.setBillStatus(false);
|
||||||
|
resultBean.setErrors(error);
|
||||||
|
results.add(resultBean);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
results.add(resultBean);
|
||||||
|
Set<Object> targetBillIds = pushResult.getTargetBillIds();
|
||||||
|
DynamicObject[] load = new DynamicObject[targetBillIds.size()];
|
||||||
|
HashMap<Object, String> reMap = new HashMap<Object, String>();
|
||||||
|
Iterator<Object> iterator = targetBillIds.iterator();
|
||||||
|
for (int i = 0; iterator.hasNext(); i++) {
|
||||||
|
Object next = iterator.next();
|
||||||
|
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(PURINBILL, new QFilter[]{new QFilter("id", QCP.equals, next)});
|
||||||
|
load[i] = dynamicObject;
|
||||||
|
reMap.put(dynamicObject.get("id"), dynamicObject.getString("billno"));
|
||||||
|
resultBean.setId(next.toString());
|
||||||
|
resultBean.setBillStatus(true);
|
||||||
|
}
|
||||||
|
//开始提交
|
||||||
|
OperateOption operateOption = OperateOption.create();
|
||||||
|
OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, RECEIPTNOTICE, load, operateOption);
|
||||||
|
if(!sumbitResult.isSuccess()){
|
||||||
|
List<IOperateInfo> allErrorOrValidateInfo = sumbitResult.getAllErrorOrValidateInfo();
|
||||||
|
if(allErrorOrValidateInfo.size()!=0){
|
||||||
|
for (IOperateInfo iOperateInfo : allErrorOrValidateInfo) {
|
||||||
|
HashMap<String, Object> returnMap = resultExt.addErrorToResultBeanByNumber(results, iOperateInfo, Constants.AR_SETTLERECORD);
|
||||||
|
results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, sumbitResult.getMessage(), Constants.AR_SETTLERECORD);
|
||||||
|
results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
|
//开始审核
|
||||||
|
OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, RECEIPTNOTICE, load, operateOption);
|
||||||
|
|
||||||
|
if(!auditResult.isSuccess()){
|
||||||
|
List<IOperateInfo> allErrorOrValidateInfo1 = auditResult.getAllErrorOrValidateInfo();
|
||||||
|
if(allErrorOrValidateInfo1.size()!=0){
|
||||||
|
for (IOperateInfo iOperateInfo : allErrorOrValidateInfo1) {
|
||||||
|
HashMap<String, Object> returnMap = resultExt.addErrorToResultBeanByNumber(results, iOperateInfo, Constants.AR_SETTLERECORD);
|
||||||
|
results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
HashMap<String, Object> returnMap = resultExt.addOneErrorToResultBeanByNumber(results, auditResult.getMessage(), Constants.AR_SETTLERECORD);
|
||||||
|
results = (List<ApiResultExt.ResultBean>) returnMap.get("ResultBeanList");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int failCount = index;//失败数量
|
||||||
|
int successCount = 1 - index;//成功数量
|
||||||
|
resultExt.setFailCount(failCount);
|
||||||
|
resultExt.setSuccessCount(successCount);
|
||||||
resultExt.setResult(results);
|
resultExt.setResult(results);
|
||||||
return CustomApiResult.success(resultExt);
|
return CustomApiResult.success(resultExt);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -4,10 +4,8 @@ import com.alibaba.fastjson.JSONObject;
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.dataentity.utils.StringUtils;
|
import kd.bos.dataentity.utils.StringUtils;
|
||||||
import kd.bos.entity.operate.result.IOperateInfo;
|
import kd.bos.entity.operate.result.IOperateInfo;
|
||||||
import kd.bos.entity.operate.result.OperateErrorInfo;
|
|
||||||
import kd.bos.openapi.common.custom.annotation.ApiModel;
|
import kd.bos.openapi.common.custom.annotation.ApiModel;
|
||||||
import kd.bos.openapi.common.custom.annotation.ApiParam;
|
import kd.bos.openapi.common.custom.annotation.ApiParam;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
@ -196,6 +194,28 @@ public class ApiResultExt implements Serializable {
|
||||||
return returnMap;
|
return returnMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HashMap<String,Object> addOneErrorToResultBeanByNumber(List<ResultBean> resultBeans, String errormsg, String entityKey) {
|
||||||
|
Set<String> idSet = new HashSet<>();
|
||||||
|
for (ResultBean resultBean : resultBeans) {
|
||||||
|
Error error = resultBean.getErrors();
|
||||||
|
resultBean.setBillStatus(false);
|
||||||
|
if (error == null) {
|
||||||
|
error = new Error();
|
||||||
|
error.setRowMsg(new ArrayList<String>());
|
||||||
|
}
|
||||||
|
error.setKeys(resultBean.getKeys());
|
||||||
|
error.setEntityKey(entityKey);
|
||||||
|
List<String> rowMsg = error.getRowMsg();
|
||||||
|
rowMsg.add(errormsg);
|
||||||
|
error.setRowMsg(rowMsg);
|
||||||
|
resultBean.setErrors(error);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
HashMap<String, Object> returnMap = new HashMap<>();
|
||||||
|
returnMap.put("ResultBeanList",resultBeans);
|
||||||
|
return returnMap;
|
||||||
|
}
|
||||||
|
|
||||||
public static DynamicObject[] removeBillByBillno(DynamicObject[] bills, Set<String> idSet) {
|
public static DynamicObject[] removeBillByBillno(DynamicObject[] bills, Set<String> idSet) {
|
||||||
DynamicObject[] tempBills = new DynamicObject[bills.length];
|
DynamicObject[] tempBills = new DynamicObject[bills.length];
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,16 @@ package tqq9.lc123.cloud.app.api.utils;
|
||||||
public class Constants {
|
public class Constants {
|
||||||
//单据类型
|
//单据类型
|
||||||
public static final String AR_SETTLERECORD = "ar_settlerecord"; //应收结算记录
|
public static final String AR_SETTLERECORD = "ar_settlerecord"; //应收结算记录
|
||||||
|
public static final String IM_PURINBILL = "im_purinbill"; //采购入库
|
||||||
public static final String CAS_PAYBILL = "cas_paybill"; //付款处理
|
public static final String CAS_PAYBILL = "cas_paybill"; //付款处理
|
||||||
|
|
||||||
//操作类型
|
//操作类型
|
||||||
public static final String TYPE_SAVE = "save"; //保存类型
|
public static final String TYPE_SAVE = "save"; //保存类型
|
||||||
|
public static final String TYPE_PUSH = "push"; //下推类型
|
||||||
public static final String TYPE_SUBMIT = "submit"; //提交类型
|
public static final String TYPE_SUBMIT = "submit"; //提交类型
|
||||||
public static final String TYPE_AUDIT = "audit"; //审核类型
|
public static final String TYPE_AUDIT = "audit"; //审核类型
|
||||||
|
public static final String TYPE_ENABLE = "enable"; //启用类型
|
||||||
|
public static final String TYPE_DISABLE = "disable"; //禁用类型
|
||||||
|
|
||||||
public static final String TYPE_UPDATE = "update"; //更新类型
|
public static final String TYPE_UPDATE = "update"; //更新类型
|
||||||
public static final String TYPE_ADD = "add"; //新增类型
|
public static final String TYPE_ADD = "add"; //新增类型
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,6 @@
|
||||||
package tqq9.lc123.cloud.app.plugin.form.im;
|
package tqq9.lc123.cloud.app.plugin.form.im;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import kd.bos.bill.AbstractBillPlugIn;
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
import kd.bos.bill.BillShowParameter;
|
|
||||||
import kd.bos.bill.OperationStatus;
|
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
import kd.bos.dataentity.utils.StringUtils;
|
import kd.bos.dataentity.utils.StringUtils;
|
||||||
|
|
@ -12,9 +8,7 @@ import kd.bos.entity.datamodel.IDataModel;
|
||||||
import kd.bos.entity.datamodel.events.ChangeData;
|
import kd.bos.entity.datamodel.events.ChangeData;
|
||||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||||
import kd.bos.form.FormShowParameter;
|
import kd.bos.form.FormShowParameter;
|
||||||
import kd.bos.form.ShowType;
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
||||||
import kd.bos.form.StyleCss;
|
|
||||||
import kd.bos.form.control.Control;
|
|
||||||
import kd.bos.form.field.BasedataEdit;
|
import kd.bos.form.field.BasedataEdit;
|
||||||
import kd.bos.form.field.events.BeforeF7SelectEvent;
|
import kd.bos.form.field.events.BeforeF7SelectEvent;
|
||||||
import kd.bos.form.field.events.BeforeF7SelectListener;
|
import kd.bos.form.field.events.BeforeF7SelectListener;
|
||||||
|
|
@ -26,6 +20,7 @@ import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.EventObject;
|
import java.util.EventObject;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 其他出库申请界面插件
|
* 其他出库申请界面插件
|
||||||
|
|
@ -37,13 +32,13 @@ public class OtherOutApplyBillPlugin extends AbstractBillPlugIn implements Befor
|
||||||
this.addItemClickListeners("tbmain");
|
this.addItemClickListeners("tbmain");
|
||||||
BasedataEdit control = this.getControl("tqq9_lot");
|
BasedataEdit control = this.getControl("tqq9_lot");
|
||||||
control.addBeforeF7SelectListener(this);
|
control.addBeforeF7SelectListener(this);
|
||||||
this.addClickListeners("tqq9_xsddh");
|
// this.addClickListeners("tqq9_xsddh");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**出库批号根据了做筛选
|
/**
|
||||||
*
|
* 出库批号根据了做筛选
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -69,8 +64,9 @@ public class OtherOutApplyBillPlugin extends AbstractBillPlugIn implements Befor
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**售后单号带出售后信息
|
|
||||||
*
|
/**
|
||||||
|
* 售后单号带出售后信息
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -88,9 +84,10 @@ public class OtherOutApplyBillPlugin extends AbstractBillPlugIn implements Befor
|
||||||
String mainbillnumber = entry.getString("mainbillnumber");//核心单据编号
|
String mainbillnumber = entry.getString("mainbillnumber");//核心单据编号
|
||||||
String tqq9_kddh = dynamicObject.getString("tqq9_kddh");//快递单号
|
String tqq9_kddh = dynamicObject.getString("tqq9_kddh");//快递单号
|
||||||
DynamicObject tqq9_sskf = dynamicObject.getDynamicObject("tqq9_sskf");//所属客服
|
DynamicObject tqq9_sskf = dynamicObject.getDynamicObject("tqq9_sskf");//所属客服
|
||||||
DynamicObject operator = dynamicObject.getDynamicObject("operator");//所属客服
|
DynamicObject operator = dynamicObject.getDynamicObject("operator");//所属销售
|
||||||
DynamicObject customer = dynamicObject.getDynamicObject("customer");//订货客户
|
DynamicObject customer = dynamicObject.getDynamicObject("customer");//订货客户
|
||||||
model.setValue("tqq9_xsddh", mainbillnumber);//对应销售订单号
|
DynamicObject sm_salorder = BusinessDataServiceHelper.loadSingle("sm_salorder", new QFilter[]{new QFilter("billno", QCP.equals, mainbillnumber)});
|
||||||
|
model.setValue("tqq9_saleorderbill", sm_salorder);//对应销售订单号
|
||||||
model.setValue("tqq9_dpdh", tqq9_kddh);//DP单号
|
model.setValue("tqq9_dpdh", tqq9_kddh);//DP单号
|
||||||
model.setValue("tqq9_sskf", tqq9_sskf);//所属客服
|
model.setValue("tqq9_sskf", tqq9_sskf);//所属客服
|
||||||
model.setValue("tqq9_ssxs", operator);//所属销售
|
model.setValue("tqq9_ssxs", operator);//所属销售
|
||||||
|
|
@ -125,30 +122,30 @@ public class OtherOutApplyBillPlugin extends AbstractBillPlugIn implements Befor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**点击对应销售订单号跳转
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击退出回传其他出库单编号
|
||||||
*
|
*
|
||||||
|
* @param afterDoOperationEventArgs
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void click(EventObject evt) {
|
public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
|
||||||
super.click(evt);
|
super.afterDoOperation(afterDoOperationEventArgs);
|
||||||
Control source = (Control) evt.getSource();
|
String itemKey = afterDoOperationEventArgs.getOperateKey();
|
||||||
if (StringUtils.equals("tqq9_xsddh", source.getKey())) {
|
if (StringUtils.equals("donothing", itemKey)) {
|
||||||
String tqq9_xsddh = (String) this.getModel().getValue("tqq9_xsddh");
|
Object billno = this.getModel().getValue("billno");
|
||||||
DynamicObject sm_salorder = BusinessDataServiceHelper.loadSingle("sm_salorder", new QFilter[]{new QFilter("billno", QCP.equals, tqq9_xsddh)});
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
Long id = sm_salorder.getLong("id");
|
map.put("billno", billno);
|
||||||
if (id != null) {
|
this.getView().returnDataToParent(map);
|
||||||
BillShowParameter formshowParameter = new BillShowParameter();
|
this.getView().close();
|
||||||
formshowParameter.setFormId("sm_salorder");
|
|
||||||
formshowParameter.getOpenStyle().setInlineStyleCss(new StyleCss());
|
|
||||||
formshowParameter.setPkId(id);
|
|
||||||
formshowParameter.getOpenStyle().setShowType(ShowType.Modal);
|
|
||||||
formshowParameter.setStatus(OperationStatus.VIEW);
|
|
||||||
this.getView().showForm(formshowParameter);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购退货未异地退货保存跳转到其他出库申请
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void afterCreateNewData(EventObject e) {
|
public void afterCreateNewData(EventObject e) {
|
||||||
super.afterCreateNewData(e);
|
super.afterCreateNewData(e);
|
||||||
|
|
@ -175,19 +172,31 @@ public class OtherOutApplyBillPlugin extends AbstractBillPlugIn implements Befor
|
||||||
dataEntity.set("tqq9_drck2", org);//调入组织
|
dataEntity.set("tqq9_drck2", org);//调入组织
|
||||||
DynamicObjectCollection entryentity = dataEntity.getDynamicObjectCollection("entryentity");
|
DynamicObjectCollection entryentity = dataEntity.getDynamicObjectCollection("entryentity");
|
||||||
entryentity.clear();
|
entryentity.clear();
|
||||||
|
|
||||||
|
//库存类型-普通
|
||||||
|
DynamicObject bd_invtype = BusinessDataServiceHelper.loadSingle("bd_invtype", new QFilter[]{new QFilter("number", QCP.equals, "110")});
|
||||||
|
//库存类型-普通
|
||||||
|
DynamicObject bd_invstatus = BusinessDataServiceHelper.loadSingle("bd_invstatus", new QFilter[]{new QFilter("number", QCP.equals, "110")});
|
||||||
|
//出库货主类型
|
||||||
|
String tqq9_outownertype = "bos_org";
|
||||||
|
//出库保管者类型
|
||||||
|
String tqq9_outkeepertype = "bos_org";
|
||||||
for (DynamicObject entry : billentry) {
|
for (DynamicObject entry : billentry) {
|
||||||
DynamicObject dynamicObject = entryentity.addNew();
|
DynamicObject dynamicObject = entryentity.addNew();
|
||||||
dynamicObject.set("tqq9_linetype", entry.getDynamicObject("linetype"));//行类型
|
dynamicObject.set("tqq9_linetype", entry.getDynamicObject("linetype"));//行类型
|
||||||
DynamicObject material = entry.getDynamicObject("material");//物料采购信息
|
DynamicObject material = entry.getDynamicObject("material");//物料采购信息
|
||||||
|
if (material != null) {
|
||||||
DynamicObject masterid = material.getDynamicObject("masterid");//物料信息
|
DynamicObject masterid = material.getDynamicObject("masterid");//物料信息
|
||||||
//物料库存信息
|
//物料库存信息
|
||||||
DynamicObject bd_materialinventoryinfo = BusinessDataServiceHelper.loadSingle("bd_materialinventoryinfo", new QFilter[]{new QFilter("masterid", QCP.equals, masterid.getLong("id"))});
|
DynamicObject bd_materialinventoryinfo = BusinessDataServiceHelper.loadSingle("bd_materialinventoryinfo", new QFilter[]{new QFilter("masterid", QCP.equals, masterid.getLong("id"))});
|
||||||
//商城商品
|
//商城商品
|
||||||
DynamicObject tqq9_goodspackage = BusinessDataServiceHelper.loadSingle("tqq9_goodspackage", new QFilter[]{new QFilter("tqq9_mater.id", QCP.equals, masterid.getLong("id"))}); dynamicObject.set("tqq9_materiel",bd_materialinventoryinfo);//物料库存信息
|
DynamicObject tqq9_goodspackage = BusinessDataServiceHelper.loadSingle("tqq9_goodspackage", new QFilter[]{new QFilter("tqq9_mater.id", QCP.equals, masterid.getLong("id"))});
|
||||||
|
dynamicObject.set("tqq9_materiel", bd_materialinventoryinfo);//物料库存信息
|
||||||
dynamicObject.set("tqq9_goods", tqq9_goodspackage);//商城商品
|
dynamicObject.set("tqq9_goods", tqq9_goodspackage);//商城商品
|
||||||
dynamicObject.set("tqq9_materialname", masterid.getString("name"));//物料名称
|
dynamicObject.set("tqq9_materialname", masterid.getString("name"));//物料名称
|
||||||
dynamicObject.set("tqq9_unit", masterid.getDynamicObject("baseunit"));//计量单位
|
dynamicObject.set("tqq9_unit", masterid.getDynamicObject("baseunit"));//计量单位
|
||||||
dynamicObject.set("tqq9_baseunit",masterid.getDynamicObject("baseunit"));//计量单位
|
dynamicObject.set("tqq9_baseunit", masterid.getDynamicObject("baseunit"));//基本单位
|
||||||
|
}
|
||||||
dynamicObject.set("tqq9_dczz", org);//调出组织
|
dynamicObject.set("tqq9_dczz", org);//调出组织
|
||||||
dynamicObject.set("tqq9_drzz", org);//调入组织
|
dynamicObject.set("tqq9_drzz", org);//调入组织
|
||||||
dynamicObject.set("tqq9_zczh", entry.getDynamicObject("tqq9_registration"));//注册证号
|
dynamicObject.set("tqq9_zczh", entry.getDynamicObject("tqq9_registration"));//注册证号
|
||||||
|
|
@ -196,7 +205,20 @@ public class OtherOutApplyBillPlugin extends AbstractBillPlugIn implements Befor
|
||||||
dynamicObject.set("tqq9_expirydate", entry.getDate("tqq9_deadline"));//到期日期
|
dynamicObject.set("tqq9_expirydate", entry.getDate("tqq9_deadline"));//到期日期
|
||||||
dynamicObject.set("tqq9_dcck", entry.getDynamicObject("tqq9_thck"));//退货仓库
|
dynamicObject.set("tqq9_dcck", entry.getDynamicObject("tqq9_thck"));//退货仓库
|
||||||
dynamicObject.set("tqq9_lot", entry.getDynamicObject("tqq9_ph"));//批号
|
dynamicObject.set("tqq9_lot", entry.getDynamicObject("tqq9_ph"));//批号
|
||||||
|
dynamicObject.set("tqq9_qty", entry.getBigDecimal("qty"));//数量
|
||||||
|
dynamicObject.set("tqq9_baseqty", entry.getBigDecimal("qty"));//数量
|
||||||
|
dynamicObject.set("tqq9_price", entry.getBigDecimal("price"));//单价
|
||||||
|
dynamicObject.set("tqq9_amount", entry.getBigDecimal("amount"));//金额
|
||||||
|
dynamicObject.set("tqq9_outinvtype", bd_invtype);//出库库存类型
|
||||||
|
dynamicObject.set("tqq9_outinvstatus", bd_invstatus);//出库库存状态
|
||||||
|
dynamicObject.set("tqq9_outownertype", tqq9_outownertype);//出库货主类型
|
||||||
|
dynamicObject.set("tqq9_outkeepertype", tqq9_outkeepertype);//出库保管者类型
|
||||||
|
dynamicObject.set("tqq9_outowner", org);//出库货主
|
||||||
|
dynamicObject.set("tqq9_outkeeper", org);//出库保管者
|
||||||
|
}
|
||||||
|
this.getView().setVisible(true, "tqq9_confirm");
|
||||||
|
this.getView().setVisible(false, "bar_close");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
@ -2,59 +2,132 @@ package tqq9.lc123.cloud.app.plugin.form.pm;
|
||||||
|
|
||||||
import kd.bos.bill.AbstractBillPlugIn;
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
import kd.bos.bill.BillShowParameter;
|
import kd.bos.bill.BillShowParameter;
|
||||||
|
import kd.bos.bill.OperationStatus;
|
||||||
|
import kd.bos.dataentity.OperateOption;
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
import kd.bos.dataentity.utils.StringUtils;
|
import kd.bos.dataentity.utils.StringUtils;
|
||||||
|
import kd.bos.entity.operate.result.OperationResult;
|
||||||
import kd.bos.form.CloseCallBack;
|
import kd.bos.form.CloseCallBack;
|
||||||
import kd.bos.form.ShowType;
|
import kd.bos.form.ShowType;
|
||||||
import kd.bos.form.control.events.ItemClickEvent;
|
import kd.bos.form.StyleCss;
|
||||||
|
import kd.bos.form.control.Control;
|
||||||
|
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
||||||
|
import kd.bos.form.events.ClosedCallBackEvent;
|
||||||
import kd.bos.form.field.BasedataEdit;
|
import kd.bos.form.field.BasedataEdit;
|
||||||
import kd.bos.form.field.events.BeforeF7SelectEvent;
|
import kd.bos.form.field.events.BeforeF7SelectEvent;
|
||||||
import kd.bos.form.field.events.BeforeF7SelectListener;
|
import kd.bos.form.field.events.BeforeF7SelectListener;
|
||||||
|
import kd.bos.form.operate.FormOperate;
|
||||||
import kd.bos.list.ListShowParameter;
|
import kd.bos.list.ListShowParameter;
|
||||||
import kd.bos.logging.Log;
|
import kd.bos.logging.Log;
|
||||||
import kd.bos.logging.LogFactory;
|
import kd.bos.logging.LogFactory;
|
||||||
import kd.bos.orm.query.QCP;
|
import kd.bos.orm.query.QCP;
|
||||||
import kd.bos.orm.query.QFilter;
|
import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import kd.sdk.plugin.Plugin;
|
import kd.bos.servicehelper.operation.OperationServiceHelper;
|
||||||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
import tqq9.lc123.cloud.app.api.utils.Constants;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.EventObject;
|
import java.util.EventObject;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 采购退货界面插件
|
* 采购退货界面插件
|
||||||
*/
|
*/
|
||||||
public class PurRefundApplyBillPlugin extends AbstractBillPlugIn implements BeforeF7SelectListener {
|
public class PurRefundApplyBillPlugin extends AbstractBillPlugIn implements BeforeF7SelectListener {
|
||||||
private final static Log logger = LogFactory.getLog(PurorderEntryIntroPaybillPlugin.class);
|
private final static Log logger = LogFactory.getLog(PurorderEntryIntroPaybillPlugin.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerListener(EventObject e) {
|
public void registerListener(EventObject e) {
|
||||||
super.registerListener(e);
|
super.registerListener(e);
|
||||||
this.addItemClickListeners("tbmain");
|
this.addItemClickListeners("tbmain");
|
||||||
BasedataEdit control = this.getControl("tqq9_ph");
|
BasedataEdit control = this.getControl("tqq9_ph");
|
||||||
control.addBeforeF7SelectListener(this);
|
control.addBeforeF7SelectListener(this);
|
||||||
// this.addClickListeners("tqq9_xsddh");
|
// this.addClickListeners("tqq9_ydthno");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void closedCallBack(ClosedCallBackEvent closedCallBackEvent) {
|
||||||
|
super.closedCallBack(closedCallBackEvent);
|
||||||
|
String actionId = closedCallBackEvent.getActionId();
|
||||||
|
Object returnData = closedCallBackEvent.getReturnData();
|
||||||
|
if (StringUtils.equals("tqq9_otheroutapply", actionId) && returnData != null) {
|
||||||
|
String billno = ((HashMap) returnData).get("billno").toString();
|
||||||
|
DynamicObject tqq9_otheroutapply = BusinessDataServiceHelper.loadSingle("tqq9_otheroutapply", new QFilter[]{new QFilter("billno", QCP.equals, billno)});
|
||||||
|
this.getModel().setValue("tqq9_yythbillno", tqq9_otheroutapply);
|
||||||
|
}
|
||||||
|
SaveServiceHelper.save(new DynamicObject[]{this.getModel().getDataEntity(true)});
|
||||||
|
this.getView().updateView();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*异地退货
|
* 异地退货返回事件
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void itemClick(ItemClickEvent evt) {
|
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
||||||
super.itemClick(evt);
|
super.beforeDoOperation(args);
|
||||||
String itemKey = evt.getItemKey();
|
FormOperate Operate = (FormOperate) args.getSource();
|
||||||
if(StringUtils.equals("tqq9_ydth",itemKey)){
|
Boolean tqq9_isydth = (Boolean) this.getModel().getValue("tqq9_isydth");//是否异地退货
|
||||||
|
DynamicObject tqq9_yythbillno = (DynamicObject)this.getModel().getValue("tqq9_yythbillno");//异地退货单号
|
||||||
|
String tqq9_ydthno=null;
|
||||||
|
if (tqq9_yythbillno!=null){
|
||||||
|
tqq9_ydthno=tqq9_yythbillno.getString("billno");
|
||||||
|
}
|
||||||
|
if (StringUtils.equals("save", Operate.getOperateKey()) && tqq9_isydth && StringUtils.isBlank(tqq9_ydthno)) {
|
||||||
BillShowParameter param = new BillShowParameter();
|
BillShowParameter param = new BillShowParameter();
|
||||||
param.setFormId("tqq9_otheroutapply");
|
param.setFormId("tqq9_otheroutapply");
|
||||||
param.setCustomParam("tqq9_otheroutapplybillno", this.getModel().getValue("billno"));//采购退货申请单号
|
param.setCustomParam("tqq9_otheroutapplybillno", this.getModel().getValue("billno"));//采购退货申请单号
|
||||||
param.setCloseCallBack(new CloseCallBack(this, "tqq9_otheroutapply"));
|
param.setCloseCallBack(new CloseCallBack(this, "tqq9_otheroutapply"));
|
||||||
param.getOpenStyle().setShowType(ShowType.Modal);
|
param.getOpenStyle().setShowType(ShowType.Modal);
|
||||||
this.getView().showForm(param);
|
this.getView().showForm(param);
|
||||||
|
} else if (StringUtils.equals("submit", Operate.getOperateKey()) && tqq9_isydth && StringUtils.isNotBlank(tqq9_ydthno)) {
|
||||||
|
DynamicObject tqq9_otheroutapply = BusinessDataServiceHelper.loadSingle("tqq9_otheroutapply", new QFilter[]{new QFilter("billno", QCP.equals, tqq9_ydthno)});
|
||||||
|
if (StringUtils.equals(tqq9_otheroutapply.getString("billstatus"), "A")) {
|
||||||
|
args.setCancel(true);
|
||||||
|
String billno = this.getModel().getValue("billno").toString();
|
||||||
|
this.getView().showErrorNotification("采购退货单:" + billno + ",对应的异地退货单号:" + tqq9_ydthno + "未提交");
|
||||||
|
}
|
||||||
|
}else if(StringUtils.equals("audit", Operate.getOperateKey()) && tqq9_isydth && StringUtils.isNotBlank(tqq9_ydthno)){
|
||||||
|
DynamicObject tqq9_otheroutapply = BusinessDataServiceHelper.loadSingle("tqq9_otheroutapply", new QFilter[]{new QFilter("billno", QCP.equals, tqq9_ydthno)});
|
||||||
|
String billstatus = tqq9_otheroutapply.getString("billstatus");
|
||||||
|
if(StringUtils.equals("B",billstatus)){
|
||||||
|
OperateOption operateOption = OperateOption.create();
|
||||||
|
OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, "tqq9_otheroutapply", new DynamicObject[]{tqq9_otheroutapply }, operateOption);
|
||||||
|
if (auditResult.isSuccess()) {
|
||||||
|
this.getView().showMessage("异地退货审核成功");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**出库批号根据了做筛选
|
// /**
|
||||||
*
|
// * 点击对应异地退货单号跳转
|
||||||
|
// */
|
||||||
|
// @Override
|
||||||
|
// public void click(EventObject evt) {
|
||||||
|
// super.click(evt);
|
||||||
|
// Control source = (Control) evt.getSource();
|
||||||
|
// if (StringUtils.equals("tqq9_ydthno", source.getKey())) {
|
||||||
|
// String tqq9_ydthno = (String) this.getModel().getValue("tqq9_ydthno");
|
||||||
|
// DynamicObject tqq9_otheroutapply = BusinessDataServiceHelper.loadSingle("tqq9_otheroutapply", new QFilter[]{new QFilter("billno", QCP.equals, tqq9_ydthno)});
|
||||||
|
// if (tqq9_otheroutapply != null) {
|
||||||
|
// BillShowParameter formshowParameter = new BillShowParameter();
|
||||||
|
// formshowParameter.setFormId("tqq9_otheroutapply");
|
||||||
|
// formshowParameter.getOpenStyle().setInlineStyleCss(new StyleCss());
|
||||||
|
// formshowParameter.setPkId(tqq9_otheroutapply.get("id"));
|
||||||
|
// formshowParameter.getOpenStyle().setShowType(ShowType.Modal);
|
||||||
|
// formshowParameter.setStatus(OperationStatus.VIEW);
|
||||||
|
// this.getView().showForm(formshowParameter);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 出库批号根据了做筛选
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ import com.alibaba.fastjson.JSONObject;
|
||||||
import kd.bos.bill.AbstractBillPlugIn;
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
import kd.bos.bill.BillShowParameter;
|
import kd.bos.bill.BillShowParameter;
|
||||||
import kd.bos.bill.OperationStatus;
|
import kd.bos.bill.OperationStatus;
|
||||||
import kd.bos.coderule.api.CodeRuleInfo;
|
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
import kd.bos.dataentity.utils.ObjectUtils;
|
import kd.bos.dataentity.utils.ObjectUtils;
|
||||||
|
|
@ -13,12 +12,10 @@ import kd.bos.dataentity.utils.StringUtils;
|
||||||
import kd.bos.entity.datamodel.IDataModel;
|
import kd.bos.entity.datamodel.IDataModel;
|
||||||
import kd.bos.entity.datamodel.ListSelectedRow;
|
import kd.bos.entity.datamodel.ListSelectedRow;
|
||||||
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
||||||
import kd.bos.entity.operate.result.OperationResult;
|
|
||||||
import kd.bos.form.*;
|
import kd.bos.form.*;
|
||||||
import kd.bos.form.control.Control;
|
import kd.bos.form.control.Control;
|
||||||
import kd.bos.form.control.EntryGrid;
|
import kd.bos.form.control.EntryGrid;
|
||||||
import kd.bos.form.control.events.BeforeClickEvent;
|
import kd.bos.form.control.events.BeforeClickEvent;
|
||||||
import kd.bos.form.events.AfterDoOperationEventArgs;
|
|
||||||
import kd.bos.form.events.ClosedCallBackEvent;
|
import kd.bos.form.events.ClosedCallBackEvent;
|
||||||
import kd.bos.form.events.HyperLinkClickEvent;
|
import kd.bos.form.events.HyperLinkClickEvent;
|
||||||
import kd.bos.form.events.HyperLinkClickListener;
|
import kd.bos.form.events.HyperLinkClickListener;
|
||||||
|
|
@ -29,7 +26,6 @@ import kd.bos.logging.LogFactory;
|
||||||
import kd.bos.orm.query.QCP;
|
import kd.bos.orm.query.QCP;
|
||||||
import kd.bos.orm.query.QFilter;
|
import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import kd.bos.servicehelper.coderule.CodeRuleServiceHelper;
|
|
||||||
import kd.bos.servicehelper.user.UserServiceHelper;
|
import kd.bos.servicehelper.user.UserServiceHelper;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
@ -274,7 +270,6 @@ public class PurorderEntryIntroPaybillPlugin extends AbstractBillPlugIn implemen
|
||||||
DynamicObject tqq9_material = BusinessDataServiceHelper.loadSingle(material.getLong("id"), "bd_material");//物料
|
DynamicObject tqq9_material = BusinessDataServiceHelper.loadSingle(material.getLong("id"), "bd_material");//物料
|
||||||
DynamicObject materialpurchaseinfo = BusinessDataServiceHelper.loadSingle("bd_materialpurchaseinfo", new QFilter[]{new QFilter("masterid", QCP.equals, tqq9_material.getLong("id"))});//物料采购信息
|
DynamicObject materialpurchaseinfo = BusinessDataServiceHelper.loadSingle("bd_materialpurchaseinfo", new QFilter[]{new QFilter("masterid", QCP.equals, tqq9_material.getLong("id"))});//物料采购信息
|
||||||
BigDecimal tqq9_saledates = entry.getBigDecimal("tqq9_saledates");
|
BigDecimal tqq9_saledates = entry.getBigDecimal("tqq9_saledates");
|
||||||
// model.setValue("seq", i + 1);//分录号
|
|
||||||
model.setValue("material", materialpurchaseinfo, i);//物料
|
model.setValue("material", materialpurchaseinfo, i);//物料
|
||||||
model.setValue("materialname", tqq9_material.getString("name"), i);//物料名称
|
model.setValue("materialname", tqq9_material.getString("name"), i);//物料名称
|
||||||
model.setValue("unit", tqq9_material.getDynamicObject("baseunit"), i);//计量单位
|
model.setValue("unit", tqq9_material.getDynamicObject("baseunit"), i);//计量单位
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
package tqq9.lc123.cloud.app.plugin.form.sm;
|
||||||
|
|
||||||
|
import kd.bos.bill.AbstractBillPlugIn;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.dataentity.utils.StringUtils;
|
||||||
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
||||||
|
import kd.bos.logging.Log;
|
||||||
|
import kd.bos.logging.LogFactory;
|
||||||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
import tqq9.lc123.cloud.app.plugin.operate.ap.PayBillOperationPlugin;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 销售订单界面插件
|
||||||
|
*/
|
||||||
|
public class SaleOrderBillPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
|
private final static Log logger = LogFactory.getLog(PayBillOperationPlugin.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 汇总分录仓库到单头
|
||||||
|
* @param afterDoOperationEventArgs
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
|
||||||
|
super.afterDoOperation(afterDoOperationEventArgs);
|
||||||
|
String operateKey = afterDoOperationEventArgs.getOperateKey();
|
||||||
|
if (StringUtils.equals("save",operateKey)) {
|
||||||
|
//物料明细
|
||||||
|
DynamicObject dataEntity = this.getModel().getDataEntity(true);
|
||||||
|
DynamicObjectCollection billentry = dataEntity.getDynamicObjectCollection("billentry");
|
||||||
|
DynamicObjectCollection tqq9_ck = (DynamicObjectCollection) this.getModel().getValue("tqq9_ck");
|
||||||
|
tqq9_ck.clear();
|
||||||
|
List<String> ids=new ArrayList<>();
|
||||||
|
for (DynamicObject dynamicObject : billentry) {
|
||||||
|
DynamicObject warehouse = dynamicObject.getDynamicObject("warehouse");//仓库
|
||||||
|
String id = warehouse.getString("id");
|
||||||
|
if (warehouse!=null) {
|
||||||
|
DynamicObject newbrand = new DynamicObject(tqq9_ck.getDynamicObjectType());
|
||||||
|
newbrand.set("fbasedataid",warehouse);
|
||||||
|
if (!ids.contains(id)) {
|
||||||
|
tqq9_ck.add(newbrand);
|
||||||
|
ids.add(id);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dataEntity.set("tqq9_ck",tqq9_ck);
|
||||||
|
SaveServiceHelper.save(new DynamicObject[]{dataEntity});
|
||||||
|
this.getView().updateView();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
package tqq9.lc123.cloud.app.plugin.operate.im;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.entity.ExtendedDataEntity;
|
||||||
|
import kd.bos.entity.ExtendedDataEntitySet;
|
||||||
|
import kd.bos.entity.botp.plugin.AbstractConvertPlugIn;
|
||||||
|
import kd.bos.entity.botp.plugin.args.AfterConvertEventArgs;
|
||||||
|
import kd.bos.logging.Log;
|
||||||
|
import kd.bos.logging.LogFactory;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购入库转换插件
|
||||||
|
*/
|
||||||
|
public class PurInConvertPlugin extends AbstractConvertPlugIn implements Plugin {
|
||||||
|
|
||||||
|
private final static Log logger = LogFactory.getLog(PurInConvertPlugin.class);
|
||||||
|
private static String IM_PURINBILL = "im_purinbill";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库回传下推写入对应的
|
||||||
|
* quantity 入库数量
|
||||||
|
* manufactureDate 生产日期
|
||||||
|
* expirationDate 失效期
|
||||||
|
* batch 批次
|
||||||
|
* registrationCode 注册证号
|
||||||
|
* licenceCode 生产许可证号
|
||||||
|
* producer 生产厂商
|
||||||
|
* @param e
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void afterConvert(AfterConvertEventArgs e) {
|
||||||
|
super.afterConvert(e);
|
||||||
|
ExtendedDataEntitySet targetExtDataEntitySet = e.getTargetExtDataEntitySet();
|
||||||
|
ExtendedDataEntity[] extendedDataEntities = targetExtDataEntitySet.FindByEntityKey(IM_PURINBILL);
|
||||||
|
Map<String, String> variables = this.getOption().getVariables();
|
||||||
|
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
|
||||||
|
//采购入库单
|
||||||
|
DynamicObject dataEntity = extendedDataEntity.getDataEntity();
|
||||||
|
DynamicObjectCollection dynamicObjectCollection = dataEntity.getDynamicObjectCollection("billentry");
|
||||||
|
for (DynamicObject entry : dynamicObjectCollection) {
|
||||||
|
String srcbillentryid = entry.getString("srcbillentryid");
|
||||||
|
//核心单据号一致,写入数据
|
||||||
|
if (variables.containsKey(srcbillentryid)) {
|
||||||
|
String jsonString = variables.get(srcbillentryid);
|
||||||
|
Gson gson = new Gson();
|
||||||
|
// 将 JSON 字符串转换为 HashMap
|
||||||
|
HashMap<String, Object> jsonMap = gson.fromJson(jsonString, HashMap.class);
|
||||||
|
BigDecimal quantity = new BigDecimal(jsonMap.get("quantity").toString());//入库数量
|
||||||
|
Double manufacture = (Double) jsonMap.get("manufactureDate");
|
||||||
|
Date manufactureDate = new Date(manufacture.longValue()); //生产日期
|
||||||
|
Double expiration = (Double) jsonMap.get("expirationDate");
|
||||||
|
Date expirationDate = new Date(expiration.longValue()); //失效期
|
||||||
|
String batch = jsonMap.get("batch").toString();//批次
|
||||||
|
String uniqueCode = jsonMap.get("uniqueCode").toString();//商品编码
|
||||||
|
String registrationCode = jsonMap.get("registrationCode").toString();//注册证号
|
||||||
|
String licenceCode = jsonMap.get("licenceCode").toString();//生产许可证号
|
||||||
|
String producer = jsonMap.get("producer").toString();//生产厂商
|
||||||
|
DynamicObject tqq9_goodspackage = BusinessDataServiceHelper.loadSingle("tqq9_goodspackage", new QFilter[]{new QFilter("tqq9_mater.number", QCP.equals, uniqueCode).and("tqq9_isauto", QCP.equals,true)});
|
||||||
|
DynamicObject tqq9_registration = BusinessDataServiceHelper.loadSingle("tqq9_registration", new QFilter[]{new QFilter("number", QCP.equals, registrationCode)});
|
||||||
|
DynamicObject tqq9_proxyandfactory = BusinessDataServiceHelper.loadSingle("tqq9_proxyandfactory", new QFilter[]{new QFilter("number", QCP.equals, producer)});
|
||||||
|
entry.set("qty",quantity);
|
||||||
|
entry.set("baseqty",quantity);
|
||||||
|
entry.set("tqq9_goods",tqq9_goodspackage);
|
||||||
|
entry.set("producedate",manufactureDate);
|
||||||
|
entry.set("expirydate",expirationDate);
|
||||||
|
entry.set("lotnumber",batch);
|
||||||
|
entry.set("tqq9_licenseno",licenceCode);
|
||||||
|
entry.set("tqq9_registration",tqq9_registration);
|
||||||
|
entry.set("tqq9_proxyandfactory",tqq9_proxyandfactory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue