1.注册证带出许可证号扩展

2.付款单使用返利金额
This commit is contained in:
龚豆豆 2025-10-25 17:34:05 +08:00
parent c32f3dc2cc
commit 574c49ba48
3 changed files with 590 additions and 322 deletions

View File

@ -0,0 +1,42 @@
package tqq9.lc123.cloud.app.plugin.operate.im;
import com.alibaba.fastjson.JSONObject;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.operate.result.OperationResult;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.args.AfterOperationArgs;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.sdk.plugin.Plugin;
import org.apache.commons.lang3.StringUtils;
import tqq9.lc123.cloud.app.plugin.trd.FWImpl;
import java.util.List;
/**
* 单据操作插件
*/
public class ShortageBillSubmitToFwOp extends AbstractOperationServicePlugIn implements Plugin {
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
super.afterExecuteOperationTransaction(e);
OperationResult operationResult = this.getOperationResult();
List<Object> successPkIds = operationResult.getSuccessPkIds();
for (Object successPkId : successPkIds) {
DynamicObject bill = BusinessDataServiceHelper.loadSingle(successPkId, "tqq9_shortagebill");
String resultStr = FWImpl.pushFwshortage(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);
SaveServiceHelper.save(new DynamicObject[]{bill});
}
}
}
}
}
}

View File

@ -5,6 +5,7 @@ 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.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.AttachmentServiceHelper;
import kd.bos.servicehelper.BusinessDataServiceHelper;
@ -2117,6 +2118,7 @@ public class FWImpl {
/**
* 采购合同推送泛微
*
* @param bill
* @return
*/
@ -2553,6 +2555,7 @@ public class FWImpl {
/**
* 采购合同变更单
*
* @param bill
* @return
*/
@ -3170,4 +3173,227 @@ public class FWImpl {
//如果单据上纯在泛微流程id重新提交调用泛微提交接口如果没有泛微流程id就调用新增接口
return fwRestfulUtils.doBillAction(mainArr, detailRootArr, "采购费用申请流程", fw_wfid_zgyfd, billno, tqq9_fwrequestid);
}
/**
* 短缺处理推送泛微
*/
public static String pushFwshortage(DynamicObject bill) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String tqq9_fwrequestid = bill.getString("tqq9_fwrequestid");//泛微流程ID
String billno = bill.getString("billno");
DynamicObject creator = bill.getDynamicObject("creator");
creator = BusinessDataServiceHelper.loadSingle(creator.getPkValue(), "bos_user", "tqq9_fwuserid,id,number");
//创建人
String cjr = creator.getString("tqq9_fwuserid");
//创建部门
String cjbm = null;
DynamicObject tqq9_dept = bill.getDynamicObject("tqq9_dept");
if (tqq9_dept != null) {
String number = tqq9_dept.getString("number");
cjbm = FWUtils.getFwOrgNumberByKdOrgNumber(number);
}
Date createtime = bill.getDate("createtime");
//创建时间
String cjsj = sdf.format(createtime);
DynamicObject org = bill.getDynamicObject("org");
String orgNumber = org.getString("number");
//业务归属
String ywgz = FWUtils.getFwOrgNumberByKdOrgNumber(orgNumber);
//业务类型
int ywlx = 0;
//库存组织
String kczz = ywgz;
//入库日期
Date biztime = bill.getDate("biztime");
String rkrq = sdf.format(biztime);
//供应商
DynamicObject tqq9_supplier = bill.getDynamicObject("tqq9_supplier");
String gys = null;
if (tqq9_supplier != null) {
gys = tqq9_supplier.getString("number");
}
//单据状态
int djzt = 0;
//税额
BigDecimal se = bill.getBigDecimal("tqq9_hzse");
//价税合计
BigDecimal jshj = bill.getBigDecimal("tqq9_hzjshj");
JSONObject detail1 = new JSONObject();
JSONArray recordsArr1 = new JSONArray();
DynamicObjectCollection entries = bill.getDynamicObjectCollection("billentry");
for (DynamicObject entry : entries) {
//规格型号
String ggxh = null;
//品牌
String pp = null;
DynamicObject material = entry.getDynamicObject("material");
DynamicObject bd_material = BusinessDataServiceHelper.loadSingle("bd_material", new QFilter[]{new QFilter("id", QCP.equals, material.getLong("masterid.id"))});
if (bd_material != null) {
ggxh = bd_material.getString("modelnum");
pp = bd_material.getString("tqq9_brand.name");
}
//计量单位
String jldw = null;
DynamicObject unit = entry.getDynamicObject("unit");
if (unit != null) {
jldw = unit.getString("name");
}
//批号
String ph = entry.getString("lotnumber");
//生产日期
Date producedate = entry.getDate("producedate");
String scrq = sdf.format(producedate);
//短缺数量
BigDecimal dqsl = entry.getBigDecimal("qty");
//短缺承担方
String dqcdf = entry.getString("tqq9_combofield");
//短缺原因
String dqyy = entry.getString("tqq9_shortagereason");
//责任承担方名称
String zrcdfmc = null;
DynamicObject tqq9_asstact = entry.getDynamicObject("tqq9_asstact");
if (tqq9_asstact != null) {
zrcdfmc = tqq9_asstact.getString("name");
}
//税率
BigDecimal sl = entry.getBigDecimal("tqq9_taxrateid.taxrate");
//含税单价
BigDecimal hsdj = entry.getBigDecimal("tqq9_priceandtax");
//价税合计
BigDecimal jshj_e = entry.getBigDecimal("tqq9_amountandtax");
//来源单据编号
String lydjbh = entry.getString("srcbillnumber");
//物料编码
String wlbm = bd_material.getString("number");
//物料名称
String wlmc = bd_material.getString("name");
//责任承担方
int zrcdf = 0;
String tqq9_asstacttype = entry.getString("tqq9_asstacttype");
if (StringUtils.equals("bos_user", tqq9_asstacttype)){
zrcdf = 1;
}
JSONObject e1 = new JSONObject();
e1.put("fieldName", "ggxh");
e1.put("fieldValue", ggxh);
JSONObject e2 = new JSONObject();
e2.put("fieldName", "pp");
e2.put("fieldValue", pp);
JSONObject e3 = new JSONObject();
e3.put("fieldName", "jldw");
e3.put("fieldValue", jldw);
JSONObject e4 = new JSONObject();
e4.put("fieldName", "ph");
e4.put("fieldValue", ph);
JSONObject e5 = new JSONObject();
e5.put("fieldName", "scrq");
e5.put("fieldValue", scrq);
JSONObject e6 = new JSONObject();
e6.put("fieldName", "dqsl");
e6.put("fieldValue", dqsl == null || dqsl.compareTo(BigDecimal.ZERO) == 0 ? 0 : dqsl);
JSONObject e7 = new JSONObject();
e7.put("fieldName", "dqcdf");
e7.put("fieldValue", dqcdf);
JSONObject e8 = new JSONObject();
e8.put("fieldName", "dqyy");
e8.put("fieldValue", dqyy);
JSONObject e9 = new JSONObject();
e9.put("fieldName", "zrcdfmc");
e9.put("fieldValue", zrcdfmc);
JSONObject e10 = new JSONObject();
e10.put("fieldName", "sl");
e10.put("fieldValue", sl == null || sl.compareTo(BigDecimal.ZERO) == 0 ? 0 : sl);
JSONObject e11 = new JSONObject();
e11.put("fieldName", "hsdj");
e11.put("fieldValue", hsdj == null || hsdj.compareTo(BigDecimal.ZERO) == 0 ? 0 : hsdj);
JSONObject e12 = new JSONObject();
e12.put("fieldName", "jshj");
e12.put("fieldValue", jshj_e == null || jshj_e.compareTo(BigDecimal.ZERO) == 0 ? 0 : jshj_e);
JSONObject e13 = new JSONObject();
e13.put("fieldName", "lydjbh");
e13.put("fieldValue", lydjbh);
JSONObject e14 = new JSONObject();
e14.put("fieldName", "wlbm");
e14.put("fieldValue", wlbm);
JSONObject e15 = new JSONObject();
e15.put("fieldName", "wlmc");
e15.put("fieldValue", wlbm);
JSONObject e16 = new JSONObject();
e16.put("fieldName", "zrcdf");
e16.put("fieldValue", zrcdf);
List<JSONObject> elist = Arrays.asList(e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16);
JSONArray recordsArr = new JSONArray();
recordsArr.addAll(elist);
JSONObject recordObj = new JSONObject();
recordObj.put("recordOrder", 0);
recordObj.put("workflowRequestTableFields", recordsArr);
recordsArr1.add(recordObj);
}
detail1.put("tableDBName", "formtable_main_106_dt1");
detail1.put("workflowRequestTableRecords", recordsArr1);
if (StringUtils.isNotBlank(tqq9_fwrequestid)) {
detail1.put("deleteAll", "1");
}
JSONArray detailRootArr = new JSONArray();
detailRootArr.add(detail1);
//构建主表数据
JSONObject m1 = new JSONObject();
m1.put("fieldName", "KDBillType");
m1.put("fieldValue", "tqq9_shortagebill");
JSONObject m2 = new JSONObject();
m2.put("fieldName", "lcbh");
m2.put("fieldValue", billno);
JSONObject m3 = new JSONObject();
m3.put("fieldName", "cjr");
m3.put("fieldValue", cjr);
JSONObject m4 = new JSONObject();
m4.put("fieldName", "cjbm");
m4.put("fieldValue", cjbm);
JSONObject m5 = new JSONObject();
m5.put("fieldName", "cjsj");
m5.put("fieldValue", cjsj);
JSONObject m6 = new JSONObject();
m6.put("fieldName", "ywgz");
m6.put("fieldValue", ywgz);
JSONObject m7 = new JSONObject();
m7.put("fieldName", "ywlx");
m7.put("fieldValue", ywlx);
JSONObject m8 = new JSONObject();
m8.put("fieldName", "kczz");
m8.put("fieldValue", kczz);
JSONObject m9 = new JSONObject();
m9.put("fieldName", "rkrq");
m9.put("fieldValue", rkrq);
JSONObject m10 = new JSONObject();
m10.put("fieldName", "gys");
m10.put("fieldValue", gys);
JSONObject m11 = new JSONObject();
m11.put("fieldName", "djzt");
m11.put("fieldValue", djzt);
JSONObject m12 = new JSONObject();
m12.put("fieldName", "se");
m12.put("fieldValue", se == null || se.compareTo(BigDecimal.ZERO) == 0 ? 0 : se);
JSONObject m13 = new JSONObject();
m13.put("fieldName", "jshj");
m13.put("fieldValue", jshj == null || jshj.compareTo(BigDecimal.ZERO) == 0 ? 0 : jshj);
List<JSONObject> mlist = new ArrayList<>(Arrays.asList(m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13));
JSONArray mainArr = new JSONArray();
mainArr.addAll(mlist);
String fw_wfid_xzcgdd = ConfigUtils.getThirdConfigByNumber("FW_WFID_CGDQ");
FWRestfulUtils fwRestfulUtils = new FWRestfulUtils();
//如果单据上纯在泛微流程id重新提交调用泛微提交接口如果没有泛微流程id就调用新增接口
return fwRestfulUtils.doBillAction(mainArr, detailRootArr, "短缺处理单流程", fw_wfid_xzcgdd, billno, tqq9_fwrequestid);
}
}