采购订单分摊逻辑修改
This commit is contained in:
parent
a48c5efa99
commit
1dbad706e5
|
@ -31,15 +31,13 @@ public class ReturnStockSyncNoticePlugin extends AbstractFormPlugin implements P
|
|||
public void afterDoOperation(AfterDoOperationEventArgs afterDoOperationEventArgs) {
|
||||
super.afterDoOperation(afterDoOperationEventArgs);
|
||||
String operateKey = afterDoOperationEventArgs.getOperateKey();
|
||||
if(StringUtils.equals("audit",operateKey)){
|
||||
if (StringUtils.equals("audit", operateKey)) {
|
||||
OperationResult operationResult = afterDoOperationEventArgs.getOperationResult();
|
||||
String message = operationResult.getMessage();
|
||||
if(StringUtils.equals("补货成功",message)){
|
||||
this.getView().showMessage("补货成功");
|
||||
}else if(StringUtils.isNotBlank(message)){
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("补货失败,").append("\n").append(message);
|
||||
this.getView().showMessage(stringBuilder.toString());
|
||||
if (StringUtils.isNotBlank(message)) {
|
||||
// StringBuilder stringBuilder = new StringBuilder();
|
||||
// stringBuilder.append("补货失败,").append("\n").append(message);
|
||||
this.getView().showMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ public class BaseDataPlugin extends AbstractFormPlugin implements Plugin {
|
|||
DynamicObjectCollection tqq9_entry = tqq9_registration.getDynamicObjectCollection("tqq9_entry");
|
||||
for (DynamicObject entry : tqq9_entry) {
|
||||
String supno = entry.getString("tqq9_e_supno");
|
||||
stringBuilder.append(",").append(supno);
|
||||
stringBuilder.append("#").append(supno);
|
||||
}
|
||||
String substring = stringBuilder.substring(1);
|
||||
this.getModel().setValue("tqq9_licenseno",substring,rowIndex);
|
||||
|
|
|
@ -10,14 +10,10 @@ import kd.bos.dataentity.utils.StringUtils;
|
|||
import kd.bos.db.DB;
|
||||
import kd.bos.db.DBRoute;
|
||||
import kd.bos.entity.datamodel.IDataModel;
|
||||
import kd.bos.form.CloseCallBack;
|
||||
import kd.bos.form.ShowFormHelper;
|
||||
import kd.bos.form.ShowType;
|
||||
import kd.bos.form.control.EntryGrid;
|
||||
import kd.bos.form.control.events.ItemClickEvent;
|
||||
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||
import kd.bos.list.ListFilterParameter;
|
||||
import kd.bos.list.ListShowParameter;
|
||||
import kd.bos.logging.Log;
|
||||
import kd.bos.logging.LogFactory;
|
||||
import kd.bos.orm.ORM;
|
||||
|
@ -29,7 +25,6 @@ import kd.bos.servicehelper.coderule.CodeRuleServiceHelper;
|
|||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
import kd.bos.servicehelper.user.UserServiceHelper;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
import oadd.org.apache.hadoop.io.compress.zlib.BuiltInZlibInflater;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
@ -42,6 +37,7 @@ public class PurSuggestRptFromPlugin extends AbstractFormPlugin implements Plugi
|
|||
private static DynamicObject BILLTYPE;
|
||||
private static DynamicObject BIZTYPE;
|
||||
private static DynamicObject LINETYPE;
|
||||
|
||||
static {
|
||||
DynamicObject billtype = BusinessDataServiceHelper.loadSingle("bos_billtype", new QFilter[]{new QFilter("number", QCP.equals, "pm_PurApplyBill_STD_BT_S")});
|
||||
BILLTYPE = billtype;
|
||||
|
@ -65,10 +61,36 @@ public class PurSuggestRptFromPlugin extends AbstractFormPlugin implements Plugi
|
|||
IDataModel model = this.getModel();
|
||||
DynamicObject dataEntity = model.getDataEntity(true);
|
||||
if ("tqq9_query".equals(itemKey)) {
|
||||
//清除分录数据
|
||||
DynamicObjectCollection entryentity = dataEntity.getDynamicObjectCollection("tqq9_pursuggestrptentry");
|
||||
if (entryentity.size() != 0) {
|
||||
entryentity.clear();
|
||||
}
|
||||
//业务归属查询
|
||||
QFilter qFilter = new QFilter("number", QCP.in, new String[]{"Org-00001", "Org-00002", "Org-00003", "Org-00004"});
|
||||
DynamicObject[] load = BusinessDataServiceHelper.load("bos_org", "id,number", qFilter.toArray());
|
||||
String sh = "0";
|
||||
String bj = "0";
|
||||
String gz = "0";
|
||||
String cd = "0";
|
||||
for (int i = 0; load != null && i < load.length; i++) {
|
||||
DynamicObject dynamicObject = load[i];
|
||||
String number = dynamicObject.getString("number");
|
||||
switch (number) {
|
||||
case "Org-00001":
|
||||
sh = dynamicObject.getString("id");
|
||||
break;
|
||||
case "Org-00002":
|
||||
bj = dynamicObject.getString("id");
|
||||
break;
|
||||
case "Org-00003":
|
||||
gz = dynamicObject.getString("id");
|
||||
break;
|
||||
case "Org-00004":
|
||||
cd = dynamicObject.getString("id");
|
||||
break;
|
||||
}
|
||||
}
|
||||
DynamicObjectCollection tqq9_queryorg = dataEntity.getDynamicObjectCollection("tqq9_queryorg");
|
||||
DynamicObjectCollection tqq9_querysku = dataEntity.getDynamicObjectCollection("tqq9_querysku");
|
||||
List<String> org = new ArrayList<>();
|
||||
|
@ -112,11 +134,12 @@ public class PurSuggestRptFromPlugin extends AbstractFormPlugin implements Plugi
|
|||
new QFilter[]{},
|
||||
null);
|
||||
|
||||
// //商城商品
|
||||
// String goodspackagesql = "/*dialect*/select t1.fid id, t1.fk_tqq9_mater tqq9_sku,t1.fcreateorgid tqq9_org,t1.tqq9_purchaser tqq9_purchaser,t1.tqq9_onsale tqq9_onsale" +
|
||||
// "from tk_tqq9_goodspackage t1";
|
||||
//商城商品
|
||||
String goodspackagesql = "/*dialect*/select t1.fid id,t1.fk_tqq9_isauto tqq9_isauto,t1.fk_tqq9_mater tqq9_sku,t1.fcreateorgid tqq9_org,\n" +
|
||||
"t1.fk_tqq9_purchaser tqq9_purchaser,t1.fk_tqq9_onsale tqq9_onsale ,t1.fk_tqq9_totalupstock tqq9_totalupstock \n" +
|
||||
"from tk_tqq9_goodspackage t1";
|
||||
//即时库存表
|
||||
String realbalancesql = "/*dialect*/select t1.fmaterialid tqq9_sku,t1.forgid tqq9_org,sum(t1.fqty) tqq9_totalinventory " +
|
||||
String realbalancesql = "/*dialect*/select '1' tqq9_isauto,t1.fmaterialid tqq9_sku,t1.forgid tqq9_org,sum(t1.fqty) tqq9_totalinventory \n" +
|
||||
"from t_im_inv_realbalance t1 group by fmaterialid,forgid";
|
||||
//销售订单
|
||||
String saloutbillsql = "/*dialect*/ SELECT sum(CASE WHEN fbiztime >= DATE_TRUNC('month', CURRENT_DATE - INTERVAL '3' MONTH) AND fbiztime < DATE_TRUNC('month', CURRENT_DATE)THEN t2.fqty ELSE 0 END) / 3 AS permonthsales,\n" +
|
||||
|
@ -177,13 +200,14 @@ public class PurSuggestRptFromPlugin extends AbstractFormPlugin implements Plugi
|
|||
long currentUserId = UserServiceHelper.getCurrentUserId();
|
||||
DynamicObject user = BusinessDataServiceHelper.loadSingle("bos_user", new QFilter[]{new QFilter("id", QCP.equals, currentUserId)});
|
||||
DynamicObjectCollection entryentity = user.getDynamicObjectCollection("entryentity");
|
||||
DynamicObject dept=null;
|
||||
DynamicObject dept = null;
|
||||
for (DynamicObject dynamicObject : entryentity) {
|
||||
boolean ispartjob = dynamicObject.getBoolean("ispartjob");
|
||||
if (!ispartjob){
|
||||
dept=dynamicObject.getDynamicObject("dpt");
|
||||
if (!ispartjob) {
|
||||
dept = dynamicObject.getDynamicObject("dpt");
|
||||
}
|
||||
} DynamicObject org = BusinessDataServiceHelper.loadSingle("bos_org",new QFilter[]{new QFilter("name", QCP.equals,"励齿集团")});
|
||||
}
|
||||
DynamicObject org = BusinessDataServiceHelper.loadSingle("bos_org", new QFilter[]{new QFilter("name", QCP.equals, "励齿集团")});
|
||||
CodeRuleInfo vouCodeRule = CodeRuleServiceHelper.getCodeRule("pm_purapplybill",
|
||||
purapplybill, org.getString("id"));
|
||||
String billno = CodeRuleServiceHelper.getNumber(vouCodeRule, purapplybill);//采购申请单编号
|
||||
|
@ -199,56 +223,56 @@ public class PurSuggestRptFromPlugin extends AbstractFormPlugin implements Plugi
|
|||
DynamicObject materialpurchaseinfo = BusinessDataServiceHelper.loadSingle("bd_materialpurchaseinfo",
|
||||
new QFilter[]{new QFilter("masterid", QCP.equals, tqq9_sku.getLong("id"))});//物料采购信息
|
||||
BigDecimal tqq9_saledates = dynamicObject.getBigDecimal("tqq9_saledates");
|
||||
if (i==0){
|
||||
purapplybill.set("org",org);//申请组织
|
||||
purapplybill.set("dept",dept);//申请部门
|
||||
purapplybill.set("bizuser",user);//申请人
|
||||
purapplybill.set("currency",currency);//币别
|
||||
purapplybill.set("creator",user);//创建人
|
||||
purapplybill.set("lastupdateuser",user);//修改人
|
||||
purapplybill.set("lastupdatetime",date);//修改时间
|
||||
purapplybill.set("billno",billno);//采购申请单编号
|
||||
purapplybill.set("billtype",BILLTYPE);//单据类型
|
||||
purapplybill.set("biztype",BIZTYPE);//业务类型
|
||||
purapplybill.set("biztime",date);//申请日期
|
||||
purapplybill.set("billstatus","A");//单据状态
|
||||
purapplybill.set("closestatus","A");//关闭状态
|
||||
purapplybill.set("cancelstatus","A");//作废状态
|
||||
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);//含税现返使用税率
|
||||
if (i == 0) {
|
||||
purapplybill.set("org", org);//申请组织
|
||||
purapplybill.set("dept", dept);//申请部门
|
||||
purapplybill.set("bizuser", user);//申请人
|
||||
purapplybill.set("currency", currency);//币别
|
||||
purapplybill.set("creator", user);//创建人
|
||||
purapplybill.set("lastupdateuser", user);//修改人
|
||||
purapplybill.set("lastupdatetime", date);//修改时间
|
||||
purapplybill.set("billno", billno);//采购申请单编号
|
||||
purapplybill.set("billtype", BILLTYPE);//单据类型
|
||||
purapplybill.set("biztype", BIZTYPE);//业务类型
|
||||
purapplybill.set("biztime", date);//申请日期
|
||||
purapplybill.set("billstatus", "A");//单据状态
|
||||
purapplybill.set("closestatus", "A");//关闭状态
|
||||
purapplybill.set("cancelstatus", "A");//作废状态
|
||||
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);//含税现返使用税率
|
||||
|
||||
}
|
||||
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("rowclosestatus","A");//行关闭状态
|
||||
dynamicObject1.set("rowterminatestatus","A");//行终止状态
|
||||
dynamicObject1.set("entryrecorg",tqq9_org);//收货组织
|
||||
dynamicObject1.set("entryreqorg",tqq9_org);//需求组织
|
||||
dynamicObject1.set("entryreqdept",dept);//需求部门
|
||||
dynamicObject1.set("reqdate",date);//需求日期
|
||||
dynamicObject1.set("purdate",date);//建议采购日期
|
||||
dynamicObject1.set("deliverdate",date);//交货日期
|
||||
dynamicObject1.set("bomtime",date);//展BOM时间
|
||||
dynamicObject1.set("entrychangetype","B");//变更方式
|
||||
dynamicObject1.set("linetype",LINETYPE);//行类型
|
||||
dynamicObject1.set("linetype",LINETYPE);//行类型
|
||||
dynamicObject1.set("entrycreator",user);//创建人
|
||||
dynamicObject1.set("entryrecdept",tqq9_org);//收货部门
|
||||
dynamicObject1.set("entrypurdept",tqq9_org);//采购部门
|
||||
dynamicObject1.set("entryoperatorgroup",tqq9_org);//采购组
|
||||
dynamicObject1.set("tqq9_expectsaletime",tqq9_saledates);//预计销售时间(月)
|
||||
dynamicObjectCollection.set(i,dynamicObject1);
|
||||
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("rowclosestatus", "A");//行关闭状态
|
||||
dynamicObject1.set("rowterminatestatus", "A");//行终止状态
|
||||
dynamicObject1.set("entryrecorg", tqq9_org);//收货组织
|
||||
dynamicObject1.set("entryreqorg", tqq9_org);//需求组织
|
||||
dynamicObject1.set("entryreqdept", dept);//需求部门
|
||||
dynamicObject1.set("reqdate", date);//需求日期
|
||||
dynamicObject1.set("purdate", date);//建议采购日期
|
||||
dynamicObject1.set("deliverdate", date);//交货日期
|
||||
dynamicObject1.set("bomtime", date);//展BOM时间
|
||||
dynamicObject1.set("entrychangetype", "B");//变更方式
|
||||
dynamicObject1.set("linetype", LINETYPE);//行类型
|
||||
dynamicObject1.set("linetype", LINETYPE);//行类型
|
||||
dynamicObject1.set("entrycreator", user);//创建人
|
||||
dynamicObject1.set("entryrecdept", tqq9_org);//收货部门
|
||||
dynamicObject1.set("entrypurdept", tqq9_org);//采购部门
|
||||
dynamicObject1.set("entryoperatorgroup", tqq9_org);//采购组
|
||||
dynamicObject1.set("tqq9_expectsaletime", tqq9_saledates);//预计销售时间(月)
|
||||
dynamicObjectCollection.set(i, dynamicObject1);
|
||||
}
|
||||
purapplybill.set("billentry",dynamicObjectCollection);
|
||||
purapplybill.set("billentry", dynamicObjectCollection);
|
||||
SaveServiceHelper.save(new DynamicObject[]{purapplybill});
|
||||
BillShowParameter billShowParameter = new BillShowParameter();
|
||||
billShowParameter.getOpenStyle().setShowType(ShowType.Modal);
|
||||
|
|
|
@ -3,12 +3,10 @@ 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.metadata.IDataEntityProperty;
|
||||
import kd.bos.dataentity.utils.StringUtils;
|
||||
import kd.bos.entity.datamodel.IDataModel;
|
||||
import kd.bos.entity.datamodel.RowDataEntity;
|
||||
import kd.bos.entity.datamodel.events.AfterAddRowEventArgs;
|
||||
import kd.bos.entity.datamodel.events.BeforeAddRowEventArgs;
|
||||
import kd.bos.entity.datamodel.events.ChangeData;
|
||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||
import kd.bos.logging.Log;
|
||||
|
@ -37,7 +35,7 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
|
|||
RowDataEntity[] rowDataEntities = e.getRowDataEntities();
|
||||
for (RowDataEntity rowDataEntity : rowDataEntities) {
|
||||
int rowIndex = rowDataEntity.getRowIndex();
|
||||
this.getModel().setValue("discounttype","C",rowIndex);
|
||||
this.getModel().setValue("discounttype", "C", rowIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,9 +63,17 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
|
|||
} else {
|
||||
//如果不是最后一行
|
||||
BigDecimal amountandtax = billentry.getBigDecimal("amountandtax");//明细价税合计
|
||||
BigDecimal tqq9_xfamount = tqq9_hsxfsyje.multiply(amountandtax).divide(totalallamount, 2, RoundingMode.HALF_UP);//分录行含税金额比例
|
||||
this.getModel().setValue("tqq9_xfamount", tqq9_xfamount, i);//明细现返使用金额
|
||||
remainRefundAmt = remainRefundAmt.subtract(tqq9_xfamount);
|
||||
if (amountandtax.compareTo(BigDecimal.ZERO) == 0) {
|
||||
BigDecimal tqq9_xfamount = BigDecimal.ZERO;//分录行含税金额比例
|
||||
this.getModel().setValue("tqq9_xfamount", tqq9_xfamount, i);//明细现返使用金额
|
||||
remainRefundAmt = remainRefundAmt.subtract(tqq9_xfamount);
|
||||
}else{
|
||||
BigDecimal tqq9_xfamount = tqq9_hsxfsyje.multiply(amountandtax).divide(totalallamount, 2, RoundingMode.HALF_UP);//分录行含税金额比例
|
||||
this.getModel().setValue("tqq9_xfamount", tqq9_xfamount, i);//明细现返使用金额
|
||||
remainRefundAmt = remainRefundAmt.subtract(tqq9_xfamount);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -90,9 +96,16 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
|
|||
} else {
|
||||
//如果不是最后一行
|
||||
BigDecimal amountandtax = billentry.getBigDecimal("amountandtax");//明细价税合计
|
||||
BigDecimal tqq9_hfamount = tqq9_hshfsyje.multiply(amountandtax).divide(totalallamount, 2, RoundingMode.HALF_UP);//分录行含税金额比例
|
||||
this.getModel().setValue("tqq9_hfamount", tqq9_hfamount, i);//明细货返使用金额
|
||||
remainRefundAmt = remainRefundAmt.subtract(tqq9_hfamount);
|
||||
if (amountandtax.compareTo(BigDecimal.ZERO) == 0) {
|
||||
BigDecimal tqq9_hfamount =BigDecimal.ZERO;//分录行含税金额比例
|
||||
this.getModel().setValue("tqq9_hfamount", tqq9_hfamount, i);//明细货返使用金额
|
||||
remainRefundAmt = remainRefundAmt.subtract(tqq9_hfamount);
|
||||
}else{
|
||||
BigDecimal tqq9_hfamount = tqq9_hshfsyje.multiply(amountandtax).divide(totalallamount, 2, RoundingMode.HALF_UP);//分录行含税金额比例
|
||||
this.getModel().setValue("tqq9_hfamount", tqq9_hfamount, i);//明细货返使用金额
|
||||
remainRefundAmt = remainRefundAmt.subtract(tqq9_hfamount);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -115,9 +128,16 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
|
|||
} else {
|
||||
//如果不是最后一行
|
||||
BigDecimal amountandtax = billentry.getBigDecimal("amountandtax");//明细价税合计
|
||||
BigDecimal tqq9_disamount = tqq9_discountamount.multiply(amountandtax).divide(totalallamount, 2, RoundingMode.HALF_UP);//分录行含税金额比例
|
||||
this.getModel().setValue("tqq9_disamount", tqq9_disamount, i);//明细优惠金额
|
||||
remainRefundAmt = remainRefundAmt.subtract(tqq9_disamount);
|
||||
if (amountandtax.compareTo(BigDecimal.ZERO) == 0) {
|
||||
BigDecimal tqq9_disamount = BigDecimal.ZERO;//分录行含税金额比例
|
||||
this.getModel().setValue("tqq9_disamount", tqq9_disamount, i);//明细优惠金额
|
||||
remainRefundAmt = remainRefundAmt.subtract(tqq9_disamount);
|
||||
} else {
|
||||
BigDecimal tqq9_disamount = tqq9_discountamount.multiply(amountandtax).divide(totalallamount, 2, RoundingMode.HALF_UP);//分录行含税金额比例
|
||||
this.getModel().setValue("tqq9_disamount", tqq9_disamount, i);//明细优惠金额
|
||||
remainRefundAmt = remainRefundAmt.subtract(tqq9_disamount);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -158,9 +178,16 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
|
|||
} else {
|
||||
//如果不是最后一行
|
||||
BigDecimal amountandtax = billentry.getBigDecimal("amountandtax");//明细价税合计
|
||||
BigDecimal tqq9_xfamount = tqq9_hsxfsyje.multiply(amountandtax).divide(totalallamount.add(amountandtax), 2, RoundingMode.HALF_UP);//分录行含税金额比例
|
||||
this.getModel().setValue("tqq9_xfamount", tqq9_xfamount, i);//明细现返使用金额
|
||||
remainRefundAmt_xf = remainRefundAmt_xf.subtract(tqq9_xfamount);
|
||||
if (amountandtax.compareTo(BigDecimal.ZERO) == 0) {
|
||||
BigDecimal tqq9_xfamount = BigDecimal.ZERO;//分录行含税金额比例
|
||||
this.getModel().setValue("tqq9_xfamount", tqq9_xfamount, i);//明细现返使用金额
|
||||
remainRefundAmt_xf = remainRefundAmt_xf.subtract(tqq9_xfamount);
|
||||
} else {
|
||||
BigDecimal tqq9_xfamount = tqq9_hsxfsyje.multiply(amountandtax).divide(totalallamount.add(amountandtax), 2, RoundingMode.HALF_UP);//分录行含税金额比例
|
||||
this.getModel().setValue("tqq9_xfamount", tqq9_xfamount, i);//明细现返使用金额
|
||||
remainRefundAmt_xf = remainRefundAmt_xf.subtract(tqq9_xfamount);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
if (tqq9_hshfsyje.compareTo(BigDecimal.ZERO) > 0) {
|
||||
|
@ -171,9 +198,17 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
|
|||
} else {
|
||||
//如果不是最后一行
|
||||
BigDecimal amountandtax = billentry.getBigDecimal("amountandtax");//明细价税合计
|
||||
BigDecimal tqq9_hfamount = tqq9_hshfsyje.multiply(amountandtax).divide(totalallamount.add(amountandtax), 2, RoundingMode.HALF_UP);//分录行含税金额比例
|
||||
this.getModel().setValue("tqq9_hfamount", tqq9_hfamount, i);//明细货返使用金额
|
||||
remainRefundAmt_hf = remainRefundAmt_hf.subtract(tqq9_hfamount);
|
||||
if (amountandtax.compareTo(BigDecimal.ZERO) == 0) {
|
||||
BigDecimal tqq9_hfamount = BigDecimal.ZERO;//分录行含税金额比例
|
||||
this.getModel().setValue("tqq9_hfamount", tqq9_hfamount, i);//明细货返使用金额
|
||||
remainRefundAmt_hf = remainRefundAmt_hf.subtract(tqq9_hfamount);
|
||||
} else {
|
||||
BigDecimal tqq9_hfamount = tqq9_hshfsyje.multiply(amountandtax).divide(totalallamount.add(amountandtax), 2, RoundingMode.HALF_UP);//分录行含税金额比例
|
||||
this.getModel().setValue("tqq9_hfamount", tqq9_hfamount, i);//明细货返使用金额
|
||||
remainRefundAmt_hf = remainRefundAmt_hf.subtract(tqq9_hfamount);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
if (tqq9_discountamount.compareTo(BigDecimal.ZERO) > 0) {
|
||||
|
@ -184,17 +219,26 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
|
|||
} else {
|
||||
//如果不是最后一行
|
||||
BigDecimal amountandtax = billentry.getBigDecimal("amountandtax");//明细价税合计
|
||||
BigDecimal tqq9_disamount = tqq9_discountamount.multiply(amountandtax).divide(totalallamount.add(amountandtax), 2, RoundingMode.HALF_UP);//分录行含税金额比例
|
||||
this.getModel().setValue("tqq9_disamount", tqq9_disamount, i);//明细优惠金额
|
||||
this.getModel().setValue("discountamount", tqq9_disamount, i);//
|
||||
remainRefundAmt_yh = remainRefundAmt_yh.subtract(tqq9_disamount);
|
||||
if (amountandtax.compareTo(BigDecimal.ZERO) == 0) {
|
||||
BigDecimal tqq9_disamount = BigDecimal.ZERO;//分录行含税金额比例
|
||||
this.getModel().setValue("tqq9_disamount", tqq9_disamount, i);//明细优惠金额
|
||||
this.getModel().setValue("discountamount", tqq9_disamount, i);//
|
||||
remainRefundAmt_yh = remainRefundAmt_yh.subtract(tqq9_disamount);
|
||||
} else {
|
||||
BigDecimal tqq9_disamount = tqq9_discountamount.multiply(amountandtax).divide(totalallamount.add(amountandtax), 2, RoundingMode.HALF_UP);//分录行含税金额比例
|
||||
this.getModel().setValue("tqq9_disamount", tqq9_disamount, i);//明细优惠金额
|
||||
this.getModel().setValue("discountamount", tqq9_disamount, i);//
|
||||
remainRefundAmt_yh = remainRefundAmt_yh.subtract(tqq9_disamount);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.getView().updateView("billentry");
|
||||
}
|
||||
if(StringUtils.equals("material",name)){
|
||||
if (StringUtils.equals("material", name)) {
|
||||
ChangeData changeData = e.getChangeSet()[0];
|
||||
int rowIndex = changeData.getRowIndex();
|
||||
DynamicObjectCollection dynamicObjectCollection = dataEntity.getDynamicObjectCollection(ENTRYENTITY);
|
||||
|
@ -202,42 +246,39 @@ public class PuroderBillShareRefundPlugin extends AbstractBillPlugIn {
|
|||
DynamicObject material = dynamicObject.getDynamicObject("material");
|
||||
DynamicObject masterid = material.getDynamicObject("masterid");
|
||||
DynamicObject bd_material = BusinessDataServiceHelper.loadSingle(masterid.getLong("id"), "bd_material");
|
||||
|
||||
DynamicObject org = dataEntity.getDynamicObject("org");
|
||||
//上海
|
||||
if(StringUtils.equals("Org-00001",org.getString("number"))){
|
||||
if (StringUtils.equals("SHLC", org.getString("number"))) {
|
||||
BigDecimal tqq9_maxprice_sh = bd_material.getBigDecimal("tqq9_maxprice_sh");
|
||||
if(tqq9_maxprice_sh.compareTo(BigDecimal.ZERO)>0){
|
||||
getModel().setValue("priceandtax",tqq9_maxprice_sh,rowIndex);
|
||||
getModel().setValue("tqq9_zgcgxj",tqq9_maxprice_sh,rowIndex);
|
||||
if (tqq9_maxprice_sh.compareTo(BigDecimal.ZERO) > 0) {
|
||||
getModel().setValue("priceandtax", tqq9_maxprice_sh, rowIndex);
|
||||
getModel().setValue("tqq9_zgcgxj", tqq9_maxprice_sh, rowIndex);
|
||||
}
|
||||
|
||||
//北京
|
||||
}else if(StringUtils.equals("Org-00002",org.getString("number"))){
|
||||
//北京
|
||||
} else if (StringUtils.equals("BJLC", org.getString("number"))) {
|
||||
BigDecimal tqq9_maxprice_bj = bd_material.getBigDecimal("tqq9_maxprice_bj");
|
||||
if(tqq9_maxprice_bj.compareTo(BigDecimal.ZERO)>0) {
|
||||
if (tqq9_maxprice_bj.compareTo(BigDecimal.ZERO) > 0) {
|
||||
getModel().setValue("priceandtax", tqq9_maxprice_bj, rowIndex);
|
||||
getModel().setValue("tqq9_zgcgxj", tqq9_maxprice_bj, rowIndex);
|
||||
}
|
||||
//广州
|
||||
} else if(StringUtils.equals("Org-00003",org.getString("number"))){
|
||||
//广州
|
||||
} else if (StringUtils.equals("GZLC", org.getString("number"))) {
|
||||
BigDecimal tqq9_maxprice_gz = bd_material.getBigDecimal("tqq9_maxprice_gz");
|
||||
if(tqq9_maxprice_gz.compareTo(BigDecimal.ZERO)>0) {
|
||||
if (tqq9_maxprice_gz.compareTo(BigDecimal.ZERO) > 0) {
|
||||
getModel().setValue("priceandtax", tqq9_maxprice_gz, rowIndex);
|
||||
getModel().setValue("tqq9_zgcgxj", tqq9_maxprice_gz, rowIndex);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if(StringUtils.equals("priceandtax",name)){
|
||||
if (StringUtils.equals("priceandtax", name)) {
|
||||
ChangeData changeData = e.getChangeSet()[0];
|
||||
int rowIndex = changeData.getRowIndex();
|
||||
DynamicObjectCollection dynamicObjectCollection = dataEntity.getDynamicObjectCollection(ENTRYENTITY);
|
||||
BigDecimal oldValue = (BigDecimal)changeData.getOldValue();
|
||||
BigDecimal tqq9_zgcgxj = (BigDecimal)getModel().getValue("tqq9_zgcgxj");
|
||||
if (oldValue.compareTo(tqq9_zgcgxj)>0&&tqq9_zgcgxj.compareTo(BigDecimal.ZERO)>0) {
|
||||
getModel().setValue("priceandtax",0);
|
||||
this.getView().showErrorNotification("物料明细分录行"+rowIndex+1+"含税单价超过最高采购限价,请修改");
|
||||
int seq = rowIndex + 1;
|
||||
BigDecimal newValue = (BigDecimal) changeData.getNewValue();
|
||||
BigDecimal tqq9_zgcgxj = (BigDecimal) getModel().getValue("tqq9_zgcgxj");
|
||||
if (newValue.compareTo(tqq9_zgcgxj) > 0 && tqq9_zgcgxj.compareTo(BigDecimal.ZERO) > 0) {
|
||||
getModel().setValue("priceandtax", 0);
|
||||
this.getView().showErrorNotification("物料明细分录行" + seq + "含税单价超过最高采购限价,请修改");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public class ReturnStockSyncNotifierPlugin extends AbstractOperationServicePlugI
|
|||
DynamicObject im_purinbill = BusinessDataServiceHelper.loadSingle("im_purinbill", new QFilter[]{new QFilter("billno", QCP.equals, billno)});
|
||||
DynamicObjectCollection billentry = im_purinbill.getDynamicObjectCollection("billentry");
|
||||
Map<String, String> param = new HashMap<>();
|
||||
HashMap<Long, Long> entitypkMap = new HashMap<>();
|
||||
HashMap<Long, Set<Long>> entitypkMap = new HashMap<>();
|
||||
OperationResult operationResult1 = this.getOperationResult();
|
||||
OperateOption option = this.getOption();
|
||||
Boolean isSuccess = true;
|
||||
|
@ -64,50 +64,61 @@ public class ReturnStockSyncNotifierPlugin extends AbstractOperationServicePlugI
|
|||
for (DynamicObject entry1 : billentry1) {
|
||||
String id = entry1.getString("id");
|
||||
if (StringUtils.equals(id, mainbillentryid)) {
|
||||
entitypkMap.put(pm_purorderbill.getLong("id"), entry1.getLong("id"));
|
||||
entitypkMap.computeIfAbsent(pm_purorderbill.getLong("id"), k -> new HashSet<>()).add(entry1.getLong("id"));
|
||||
param.put(id, qty);
|
||||
}
|
||||
}
|
||||
PushArgs pushArgs = BotpParamUtils.getPushArgs(PURORDER, RECEIPTNOTICE, PURORDER_ENTRY, param, entitypkMap, RULE);
|
||||
ConvertOperationResult pushResult = ConvertServiceHelper.pushAndSave(pushArgs);
|
||||
if (!pushResult.isSuccess()) {
|
||||
List<SourceBillReport> billReports = pushResult.getBillReports();
|
||||
for (SourceBillReport billReport : billReports) {
|
||||
String billNo = billReport.getBillNo();
|
||||
isSuccess = false;
|
||||
String billMessage = billReport.getFailMessage();
|
||||
errorMsg.append("收货通知单:"+billNo+"下推失败 ").append(billMessage).append("\n");
|
||||
}
|
||||
} else {
|
||||
Set<Object> targetBillIds = pushResult.getTargetBillIds();
|
||||
DynamicObject[] load = new DynamicObject[targetBillIds.size()];
|
||||
Iterator<Object> iterator = targetBillIds.iterator();
|
||||
for (int i = 0; iterator.hasNext(); i++) {
|
||||
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(RECEIPTNOTICE, new QFilter[]{new QFilter("id", QCP.equals, iterator.next())});
|
||||
load[i]=dynamicObject;
|
||||
|
||||
}
|
||||
OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, RECEIPTNOTICE, load, option);
|
||||
List<IOperateInfo> allErrorOrValidateInfo = sumbitResult.getAllErrorOrValidateInfo();
|
||||
for (IOperateInfo iOperateInfo : allErrorOrValidateInfo) {
|
||||
isSuccess = false;
|
||||
String message = iOperateInfo.getMessage();
|
||||
errorMsg.append("收货通知单提交失败:").append(message).append("\n");
|
||||
}
|
||||
OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, RECEIPTNOTICE, load, option);
|
||||
List<IOperateInfo> allErrorOrValidateInfo1 = auditResult.getAllErrorOrValidateInfo();
|
||||
for (IOperateInfo iOperateInfo : allErrorOrValidateInfo1) {
|
||||
String message = iOperateInfo.getMessage();
|
||||
errorMsg.append("收货通知单审核失败:").append(message).append("\n");
|
||||
}
|
||||
}
|
||||
PushArgs pushArgs = BotpParamUtils.getPushArgs(PURORDER, RECEIPTNOTICE, PURORDER_ENTRY, param, entitypkMap, RULE);
|
||||
ConvertOperationResult pushResult = ConvertServiceHelper.pushAndSave(pushArgs);
|
||||
List<SourceBillReport> billReports = pushResult.getBillReports();
|
||||
|
||||
if (!pushResult.isSuccess()) {
|
||||
for (SourceBillReport billReport : billReports) {
|
||||
String billNo = billReport.getBillNo();
|
||||
isSuccess = false;
|
||||
String billMessage = billReport.getFailMessage();
|
||||
errorMsg.append("采购订单:" + billNo + "下推失败 ").append(billMessage).append("\r\n");
|
||||
}
|
||||
} else {
|
||||
for (SourceBillReport billReport : billReports) {
|
||||
String billNo = billReport.getBillNo();
|
||||
isSuccess = true;
|
||||
errorMsg.append("采购订单:" + billNo + "下推成功 ").append("\r\n");
|
||||
}
|
||||
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++) {
|
||||
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(RECEIPTNOTICE, new QFilter[]{new QFilter("id", QCP.equals, iterator.next())});
|
||||
load[i] = dynamicObject;
|
||||
reMap.put(dynamicObject.get("id"),dynamicObject.getString("billno"));
|
||||
|
||||
}
|
||||
OperationResult sumbitResult = OperationServiceHelper.executeOperate(Constants.TYPE_SUBMIT, RECEIPTNOTICE, load, option);
|
||||
List<IOperateInfo> allErrorOrValidateInfo = sumbitResult.getAllErrorOrValidateInfo();
|
||||
for (IOperateInfo iOperateInfo : allErrorOrValidateInfo) {
|
||||
isSuccess = false;
|
||||
String message = iOperateInfo.getMessage();
|
||||
String rebillno = reMap.get(iOperateInfo.getPkValue());
|
||||
errorMsg.append("收货通知单:"+rebillno+"提交失败 ").append(message).append("\r\n");
|
||||
}
|
||||
OperationResult auditResult = OperationServiceHelper.executeOperate(Constants.TYPE_AUDIT, RECEIPTNOTICE, load, option);
|
||||
List<IOperateInfo> allErrorOrValidateInfo1 = auditResult.getAllErrorOrValidateInfo();
|
||||
for (IOperateInfo iOperateInfo : allErrorOrValidateInfo1) {
|
||||
String message = iOperateInfo.getMessage();
|
||||
String rebillno = reMap.get(iOperateInfo.getPkValue());
|
||||
errorMsg.append("收货通知单:"+rebillno+"审核失败").append(message).append("\r\n");
|
||||
}
|
||||
}
|
||||
operationResult1.setMessage(errorMsg.toString());
|
||||
if (isSuccess){
|
||||
operationResult1.setMessage("补货成功");
|
||||
}else{
|
||||
operationResult1.setMessage(errorMsg.toString());
|
||||
}
|
||||
// if (isSuccess) {
|
||||
// operationResult1.setMessage("补货成功");
|
||||
// } else {
|
||||
// operationResult1.setMessage(errorMsg.toString());
|
||||
// }
|
||||
operationResult1.setShowMessage(false);
|
||||
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class BotpParamUtils {
|
|||
* @throws KDBizException
|
||||
*/
|
||||
public static PushArgs getPushArgs(String srcEntityNumber, String targetEntityNumber, String srcEntryEntity,
|
||||
Map<String, String> param, HashMap<Long,Long> entitypkMap, String rule) throws KDBizException{
|
||||
Map<String, String> param, HashMap<Long, Set<Long>> entitypkMap, String rule) throws KDBizException{
|
||||
PushArgs pushArgs = new PushArgs();
|
||||
pushArgs.setSourceEntityNumber(srcEntityNumber); // 必选,源单标识
|
||||
pushArgs.setTargetEntityNumber(targetEntityNumber); // 必选,目标单标识
|
||||
|
@ -93,12 +93,16 @@ public class BotpParamUtils {
|
|||
|
||||
//原单单据id
|
||||
ArrayList<ListSelectedRow> auditResult = new ArrayList<ListSelectedRow>();
|
||||
for (Map.Entry<Long, Long> entry : entitypkMap.entrySet()) {
|
||||
ListSelectedRow row = new ListSelectedRow();
|
||||
row.setPrimaryKeyValue(entry.getKey());
|
||||
row.setEntryEntityKey(srcEntryEntity);
|
||||
row.setEntryPrimaryKeyValue(entry.getValue());
|
||||
auditResult.add(row); }
|
||||
for (Map.Entry<Long, Set<Long>> entry : entitypkMap.entrySet()) {
|
||||
Set<Long> value = entry.getValue();
|
||||
for (Long v : value) {
|
||||
ListSelectedRow row = new ListSelectedRow();
|
||||
row.setPrimaryKeyValue(entry.getKey());
|
||||
row.setEntryEntityKey(srcEntryEntity);
|
||||
row.setEntryPrimaryKeyValue(v);
|
||||
auditResult.add(row);
|
||||
}
|
||||
}
|
||||
|
||||
pushArgs.setSelectedRows(auditResult);
|
||||
return pushArgs;
|
||||
|
|
Loading…
Reference in New Issue