1.付款申请新增抵扣订单按钮调整
2.付款申请单界面插件 3.采购建议报表下推插件 4.供应商可抵扣金额 5.其他入库单转换规则插件 6.收货通知单插件调整 7.采购申请报表工具类
This commit is contained in:
parent
b920dc0598
commit
18198dc0a1
|
@ -76,8 +76,8 @@ public class PayApplyFormPlugin extends AbstractBillPlugIn implements Plugin {
|
|||
DynamicObject e_asstact = (DynamicObject) model.getValue("e_asstact", 0);
|
||||
if (e_asstact != null) {
|
||||
long id = e_asstact.getLong("id");
|
||||
String sql = "/*dialect*/select fasstactid,sum(funsettleamount) qty from t_ap_finapbill,t_ap_finapbilldetailentry " +
|
||||
" WHERE fsettlestatus in ('unsettle','partsettle') and fbillstatus ='C' and funsettleamount<0 AND fasstactid=" + id + " group by fasstactid";
|
||||
String sql = "/*dialect*/select fasstactid,sum(funsettleamount) qty from t_ap_finapbill WHERE fsettlestatus in ('unsettle','partsettle') " +
|
||||
"and fiswrittenoff='0' and fbillstatus ='C' and funsettleamount<0 AND fasstactid=" + id + " group by fasstactid";
|
||||
DataSet dataSet = DB.queryDataSet(this.getClass().getName(), DBRoute.of("cas"), sql);
|
||||
DataSet copy = dataSet.copy();
|
||||
DynamicObjectCollection dynamicObjects = ORM.create().toPlainDynamicObjectCollection(copy);
|
||||
|
@ -96,8 +96,8 @@ public class PayApplyFormPlugin extends AbstractBillPlugIn implements Plugin {
|
|||
DynamicObject e_asstact = (DynamicObject) model.getValue("e_asstact", 0);
|
||||
if (e_asstact != null) {
|
||||
long id = e_asstact.getLong("id");
|
||||
String sql = "/*dialect*/select fasstactid,sum(funsettleamount) qty from t_ap_finapbill,t_ap_finapbilldetailentry " +
|
||||
" WHERE fsettlestatus in ('unsettle','partsettle') and fbillstatus ='C' and funsettleamount<0 AND fasstactid=" + id + " group by fasstactid";
|
||||
String sql = "/*dialect*/select fasstactid,sum(funsettleamount) qty from t_ap_finapbill WHERE fsettlestatus in ('unsettle','partsettle') " +
|
||||
"and fiswrittenoff='0' and fbillstatus ='C' and funsettleamount<0 AND fasstactid=" + id + " group by fasstactid";
|
||||
DataSet dataSet = DB.queryDataSet(this.getClass().getName(), DBRoute.of("cas"), sql);
|
||||
DataSet copy = dataSet.copy();
|
||||
DynamicObjectCollection dynamicObjects = ORM.create().toPlainDynamicObjectCollection(copy);
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
package tqq9.lc123.cloud.app.plugin.form.pm;
|
||||
|
||||
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.entity.datamodel.IDataModel;
|
||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||
import kd.bos.form.IFormView;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
import tqq9.lc123.cloud.app.plugin.utils.EntryFieldRefresher;
|
||||
|
||||
/**
|
||||
* 单据界面插件
|
||||
*/
|
||||
public class PurApplyBillPlugin extends AbstractBillPlugIn implements Plugin {
|
||||
private final static String SH_ORGNUMBER = "SHLC";
|
||||
|
||||
private final static String BJ_ORGNUMBER = "BJLC";
|
||||
|
||||
private final static String GZ_ORGNUMBER = "GZLC";
|
||||
|
||||
|
||||
@Override
|
||||
public void propertyChanged(PropertyChangedArgs e) {
|
||||
super.propertyChanged(e);
|
||||
String name = e.getProperty().getName();
|
||||
DynamicObject dataEntity = this.getModel().getDataEntity(true);
|
||||
IDataModel model = this.getModel();
|
||||
IFormView view = this.getView();
|
||||
//集采供应商
|
||||
if (StringUtils.equals("tqq9_sup_sh", name)) {
|
||||
DynamicObject tqq9_sup_bj = (DynamicObject) model.getValue("tqq9_sup_sh");
|
||||
EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher();
|
||||
entryFieldRefresher.updateDynamicObjectByOrg(SH_ORGNUMBER, "supplier", tqq9_sup_bj, model);
|
||||
String tqq9_mulcombofield1 = tqq9_sup_bj.getString("tqq9_mulcombofield1");
|
||||
model.setValue("tqq9_suparea_sh",tqq9_mulcombofield1);
|
||||
view.updateView();
|
||||
}
|
||||
//收货仓库
|
||||
if (StringUtils.equals("tqq9_rewares_sh", name)) {
|
||||
DynamicObject tqq9_rewares_sh = (DynamicObject) model.getValue("tqq9_rewares_sh");
|
||||
EntryFieldRefresher entryFieldRefresher = new EntryFieldRefresher();
|
||||
entryFieldRefresher.updateDynamicObjectByOrg(SH_ORGNUMBER, "warehouse", tqq9_rewares_sh, model);
|
||||
view.updateView();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -326,8 +326,6 @@ public class PurSuggestRptFromPlugin extends AbstractFormPlugin implements Plugi
|
|||
dataEntity.set("tqq9_pursuggestrptentry", entryentity);
|
||||
this.getView().updateView();
|
||||
} else if (StringUtils.equals("tqq9_purapply", itemKey)) {
|
||||
EntryGrid entry = this.getControl("tqq9_pursuggestrptentry");
|
||||
int[] selectRows = entry.getSelectRows();
|
||||
DynamicObjectCollection tqq9_pursuggestrptentry = dataEntity.getDynamicObjectCollection("tqq9_pursuggestrptentry");
|
||||
DynamicObject purapplybill = BusinessDataServiceHelper.newDynamicObject("pm_purapplybill");
|
||||
DynamicObjectCollection dynamicObjectCollection = purapplybill.getDynamicObjectCollection("billentry");
|
||||
|
@ -351,13 +349,9 @@ public class PurSuggestRptFromPlugin extends AbstractFormPlugin implements Plugi
|
|||
DynamicObject taxrate = BusinessDataServiceHelper.loadSingle("bd_taxrate",
|
||||
new QFilter[]{new QFilter("number", QCP.equals, "V13")});//税率
|
||||
Date date = new Date();
|
||||
for (int i = 0; i < selectRows.length; i++) {
|
||||
DynamicObject dynamicObject = tqq9_pursuggestrptentry.get(selectRows[i]);
|
||||
DynamicObject tqq9_org = dynamicObject.getDynamicObject("tqq9_org");
|
||||
DynamicObject tqq9_sku = dynamicObject.getDynamicObject("tqq9_sku");
|
||||
DynamicObject materialpurchaseinfo = BusinessDataServiceHelper.loadSingle("bd_materialpurchaseinfo",
|
||||
new QFilter[]{new QFilter("masterid", QCP.equals, tqq9_sku.getLong("id"))});//物料采购信息
|
||||
BigDecimal tqq9_saledates = dynamicObject.getBigDecimal("tqq9_saledates");
|
||||
int i = 0;
|
||||
for (DynamicObject dynamicObject : tqq9_pursuggestrptentry) {
|
||||
if (dynamicObject.getBoolean("tqq9_ischange")) {
|
||||
if (i == 0) {
|
||||
purapplybill.set("org", org);//申请组织
|
||||
purapplybill.set("dept", dept);//申请部门
|
||||
|
@ -376,18 +370,31 @@ public class PurSuggestRptFromPlugin extends AbstractFormPlugin implements Plugi
|
|||
purapplybill.set("changestatus", "A");//作废状态
|
||||
purapplybill.set("subversion", "1");//子版本号
|
||||
purapplybill.set("version", "1");//版本号
|
||||
purapplybill.set("tqq9_sfsyhf", "false");//是否使用货返
|
||||
purapplybill.set("tqq9_hshfsysl", taxrate);//含税货返使用税率
|
||||
purapplybill.set("tqq9_sfsyxf", "false");//是否使用现返
|
||||
purapplybill.set("tqq9_hsxfsysl", taxrate);//含税现返使用税率
|
||||
|
||||
purapplybill.set("tqq9_sfsyhf_sh", "false");//是否使用货返
|
||||
purapplybill.set("tqq9_hshfsysl_sh", taxrate);//含税货返使用税率
|
||||
purapplybill.set("tqq9_sfsyxf_sh", "false");//是否使用现返
|
||||
purapplybill.set("tqq9_hsxfsysl_sh", taxrate);//含税现返使用税率
|
||||
purapplybill.set("tqq9_sfsyhf_bj", "false");//是否使用货返
|
||||
purapplybill.set("tqq9_hshfsysl_bj", taxrate);//含税货返使用税率
|
||||
purapplybill.set("tqq9_sfsyxf_bj", "false");//是否使用现返
|
||||
purapplybill.set("tqq9_hsxfsysl_bj", taxrate);//含税现返使用税率
|
||||
purapplybill.set("tqq9_sfsyhf_gz", "false");//是否使用货返
|
||||
purapplybill.set("tqq9_hshfsysl_gz", taxrate);//含税货返使用税率
|
||||
purapplybill.set("tqq9_sfsyxf_gz", "false");//是否使用现返
|
||||
purapplybill.set("tqq9_hsxfsysl_gz", taxrate);//含税现返使用税率
|
||||
}
|
||||
DynamicObject tqq9_org = dynamicObject.getDynamicObject("tqq9_org");//组织
|
||||
DynamicObject tqq9_sku = dynamicObject.getDynamicObject("tqq9_sku");//商品
|
||||
DynamicObject tqq9_material = dynamicObject.getDynamicObject("tqq9_material");//物料
|
||||
DynamicObject materialpurchaseinfo = BusinessDataServiceHelper.loadSingle("bd_materialpurchaseinfo",
|
||||
new QFilter[]{new QFilter("masterid", QCP.equals, tqq9_material.getLong("id"))});//物料采购信息
|
||||
BigDecimal tqq9_saledates = dynamicObject.getBigDecimal("tqq9_saledates");
|
||||
DynamicObject dynamicObject1 = dynamicObjectCollection.addNew();
|
||||
dynamicObject1.set("seq", i + 1);//分录号
|
||||
dynamicObject1.set("material", materialpurchaseinfo);//物料
|
||||
dynamicObject1.set("materialname", tqq9_sku.getString("name"));//物料名称
|
||||
dynamicObject1.set("unit", tqq9_sku.getDynamicObject("baseunit"));//计量单位
|
||||
dynamicObject1.set("baseunit", tqq9_sku.getDynamicObject("baseunit"));//基本单位
|
||||
dynamicObject1.set("materialname", tqq9_material.getString("name"));//物料名称
|
||||
dynamicObject1.set("unit", tqq9_material.getDynamicObject("baseunit"));//计量单位
|
||||
dynamicObject1.set("baseunit", tqq9_material.getDynamicObject("baseunit"));//基本单位
|
||||
dynamicObject1.set("rowclosestatus", "A");//行关闭状态
|
||||
dynamicObject1.set("rowterminatestatus", "A");//行终止状态
|
||||
dynamicObject1.set("entryrecorg", tqq9_org);//收货组织
|
||||
|
@ -406,6 +413,8 @@ public class PurSuggestRptFromPlugin extends AbstractFormPlugin implements Plugi
|
|||
dynamicObject1.set("entryoperatorgroup", tqq9_org);//采购组
|
||||
dynamicObject1.set("tqq9_expectsaletime", tqq9_saledates);//预计销售时间(月)
|
||||
dynamicObjectCollection.set(i, dynamicObject1);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
purapplybill.set("billentry", dynamicObjectCollection);
|
||||
SaveServiceHelper.save(new DynamicObject[]{purapplybill});
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
package tqq9.lc123.cloud.app.plugin.operate.ap;
|
||||
|
||||
import kd.bos.algo.DataSet;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.db.DB;
|
||||
import kd.bos.db.DBRoute;
|
||||
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.ORM;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
import tqq9.lc123.cloud.app.plugin.operate.im.PurOrderPushReceiptNoticePlugin;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 单据转换插件
|
||||
*/
|
||||
public class PurApplySyncSupplierDeductPlugin extends AbstractConvertPlugIn implements Plugin {
|
||||
private final static Log logger = LogFactory.getLog(PurApplySyncSupplierDeductPlugin.class);
|
||||
private static String RECEIPTNOTICE = "ap_payapply";
|
||||
|
||||
@Override
|
||||
public void afterConvert(AfterConvertEventArgs e) {
|
||||
super.afterConvert(e);
|
||||
ExtendedDataEntitySet targetExtDataEntitySet = e.getTargetExtDataEntitySet();
|
||||
ExtendedDataEntity[] extendedDataEntities = targetExtDataEntitySet.FindByEntityKey(RECEIPTNOTICE);
|
||||
// Map<String, String> variables = this.getOption().getVariables();
|
||||
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
|
||||
//付款申请单
|
||||
DynamicObject dataEntity = extendedDataEntity.getDataEntity();
|
||||
DynamicObjectCollection dynamicObjectCollection = dataEntity.getDynamicObjectCollection("entry");
|
||||
DynamicObject e_asstact = dynamicObjectCollection.get(0).getDynamicObject("e_asstact");
|
||||
if (e_asstact != null) {
|
||||
long id = e_asstact.getLong("id");
|
||||
String sql = "/*dialect*/select fasstactid,sum(funsettleamount) qty from t_ap_finapbill WHERE fsettlestatus in ('unsettle','partsettle') " +
|
||||
"and fiswrittenoff='0' and fbillstatus ='C' and funsettleamount<0 AND fasstactid=" + id + " group by fasstactid";
|
||||
DataSet dataSet = DB.queryDataSet(this.getClass().getName(), DBRoute.of("cas"), sql);
|
||||
DataSet copy = dataSet.copy();
|
||||
DynamicObjectCollection dynamicObjects = ORM.create().toPlainDynamicObjectCollection(copy);
|
||||
BigDecimal qty = dynamicObjects.get(0).getBigDecimal("qty");
|
||||
dataEntity.set("tqq9_gyskdkzje",qty);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
package tqq9.lc123.cloud.app.plugin.operate.im;
|
||||
|
||||
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.Map;
|
||||
|
||||
/**
|
||||
* 其他入库单转换插件
|
||||
*/
|
||||
public class OtherInBillConvertPlugIn extends AbstractConvertPlugIn implements Plugin {
|
||||
private final static Log logger = LogFactory.getLog(OtherInBillConvertPlugIn.class);
|
||||
private static String OTHERINBILL = "im_otherinbill";
|
||||
|
||||
|
||||
@Override
|
||||
public void afterConvert(AfterConvertEventArgs e) {
|
||||
super.afterConvert(e);
|
||||
ExtendedDataEntitySet targetExtDataEntitySet = e.getTargetExtDataEntitySet();
|
||||
ExtendedDataEntity[] extendedDataEntities = targetExtDataEntitySet.FindByEntityKey(OTHERINBILL);
|
||||
Map<String, String> variables = this.getOption().getVariables();
|
||||
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
|
||||
//其他入库
|
||||
DynamicObject dataEntity = extendedDataEntity.getDataEntity();
|
||||
DynamicObject biztype = dataEntity.getDynamicObject("biztype");//业务类型
|
||||
QFilter invschemeF=new QFilter("bitypeentry.biztype.number", QCP.in,new String[]{biztype.getString("number")});
|
||||
DynamicObject invscheme = BusinessDataServiceHelper.loadSingle("im_invscheme", invschemeF.toArray());
|
||||
DynamicObjectCollection invtypeentry = invscheme.getDynamicObjectCollection("invtypeentry");//入库库存类型单据体
|
||||
DynamicObjectCollection invstatusentry = invscheme.getDynamicObjectCollection("invstatusentry");//入库库存状态单据体
|
||||
DynamicObject invtype = null;//入库库存类型
|
||||
String ownertype1 = null;//入库货主类型
|
||||
String keepertype1 = null;//入库保管者类型
|
||||
DynamicObject invstatus = null;//入库库存状态
|
||||
for (DynamicObject dynamicObject : invtypeentry) {
|
||||
Boolean invtypeisdefault = dynamicObject.getBoolean("invtypeisdefault");
|
||||
if(invtypeisdefault){
|
||||
invtype = dynamicObject.getDynamicObject("invtype");//入库库存类型
|
||||
ownertype1 = dynamicObject.getString("ownertype1");//入库货主类型
|
||||
keepertype1 = dynamicObject.getString("keepertype1");//入库保管者类型
|
||||
}
|
||||
}
|
||||
for (DynamicObject dynamicObject : invstatusentry) {
|
||||
Boolean invstatusisdefault = dynamicObject.getBoolean("invstatusisdefault");
|
||||
if(invstatusisdefault){
|
||||
invstatus = dynamicObject.getDynamicObject("invstatus");//入库库存状态
|
||||
}
|
||||
}
|
||||
DynamicObject owner = dataEntity.getDynamicObject("org");//入库货主
|
||||
DynamicObject keeper = dataEntity.getDynamicObject("org");//入库保管者
|
||||
|
||||
DynamicObjectCollection billentry = dataEntity.getDynamicObjectCollection("billentry");//物料明细
|
||||
for (DynamicObject dynamicObject : billentry) {
|
||||
dynamicObject.set("invtype",invtype);//入库库存类型
|
||||
dynamicObject.set("ownertype",ownertype1);//入库货主类型
|
||||
dynamicObject.set("keepertype",keepertype1);//入库保管者类型
|
||||
dynamicObject.set("invstatus",invstatus);//入库库存状态
|
||||
dynamicObject.set("owner",owner);//入库货主
|
||||
dynamicObject.set("keeper",keeper);//入库保管者
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -6,9 +6,6 @@ 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.entity.botp.plugin.args.AfterCreateTargetEventArgs;
|
||||
import kd.bos.entity.botp.plugin.args.AfterFieldMappingEventArgs;
|
||||
import kd.bos.entity.botp.plugin.args.BeforeCreateTargetEventArgs;
|
||||
import kd.bos.logging.Log;
|
||||
import kd.bos.logging.LogFactory;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package tqq9.lc123.cloud.app.plugin.utils;
|
||||
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.dataentity.utils.StringUtils;
|
||||
import kd.bos.entity.datamodel.IDataModel;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class EntryFieldRefresher {
|
||||
|
||||
/**
|
||||
* 处理组织和字段的工具类
|
||||
*
|
||||
* @param org 组织参数
|
||||
* @param entityname 字段标识
|
||||
* @param dynamicObject 基础资料
|
||||
* @param model 单据实体
|
||||
*/
|
||||
public void updateDynamicObjectByOrg(String org, String entityname, DynamicObject dynamicObject, IDataModel model) {
|
||||
|
||||
DynamicObjectCollection entries = model.getDataEntity(true).getDynamicObjectCollection("billentry");
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
DynamicObject entry = entries.get(i);
|
||||
DynamicObject entryrecorg = entry.getDynamicObject("entryrecorg");//收货组织
|
||||
if (StringUtils.equals(org, entryrecorg.getString("number"))) {
|
||||
model.setValue(entityname, dynamicObject, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理组织和字段的工具类
|
||||
*
|
||||
* @param org 组织参数
|
||||
* @param entityname 字段标识
|
||||
* @param amount 金额
|
||||
* @param model 单据实体
|
||||
*/
|
||||
public void updateAmountByOrg(String org, String entityname, BigDecimal amount, IDataModel model) {
|
||||
// 这里可以根据需要添加实现逻辑
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue