1.装箱单效验
2.发运明细审核效验
This commit is contained in:
ljw 2024-10-31 20:48:07 +08:00
parent 21316e6fe9
commit ce36ea9758
2 changed files with 317 additions and 272 deletions

View File

@ -150,13 +150,23 @@ public class EncaseMentEdit extends AbstractBillPlugIn implements Plugin, Before
deleteEntryRow(); deleteEntryRow();
break; break;
case "statusconvertpjqr": case "statusconvertpjqr":
lockAccessoriesPackaging(false); String yemWeightconfirmed = (String) this.getModel().getValue("yem_weightconfirmed");
if (!yemWeightconfirmed.isEmpty()) {
lockAccessoriesPackaging(false);
} else {
this.getView().showMessage("锁定重量是否确认为空!!!");
}
break; break;
case "statusconvertpjfqr": case "statusconvertpjfqr":
lockAccessoriesPackaging(true); lockAccessoriesPackaging(true);
break; break;
case "statusconvertqrzj": case "statusconvertqrzj":
lockRemovable(false); String yemWeightconfirmeds = (String) this.getModel().getValue("yem_weightconfirmed");
if (!yemWeightconfirmeds.isEmpty()) {
lockRemovable(false);
} else {
this.getView().showMessage("锁定重量是否确认为空!!!");
}
break; break;
case "statusconvertfqrzj": case "statusconvertfqrzj":
lockRemovable(true); lockRemovable(true);
@ -175,98 +185,102 @@ public class EncaseMentEdit extends AbstractBillPlugIn implements Plugin, Before
IDataModel model = this.getModel(); IDataModel model = this.getModel();
DynamicObject dataEntity = model.getDataEntity(true); DynamicObject dataEntity = model.getDataEntity(true);
if ("statusconvertpjqr".equals(operateKey) || "statusconvertqrzj".equals(operateKey)) { if ("statusconvertpjqr".equals(operateKey) || "statusconvertqrzj".equals(operateKey)) {
String yemWeightconfirmed = (String) this.getModel().getValue("yem_weightconfirmed");
DynamicObjectCollection collection = dataEntity.getDynamicObjectCollection("yem_im_packinginfor_pi"); if (!yemWeightconfirmed.isEmpty()) {
StringBuilder sb = new StringBuilder(); DynamicObjectCollection collection = dataEntity.getDynamicObjectCollection("yem_im_packinginfor_pi");
for (DynamicObject dynamicObject : collection) { StringBuilder sb = new StringBuilder();
int index = collection.indexOf(dynamicObject); for (DynamicObject dynamicObject : collection) {
// 整柜重量 int index = collection.indexOf(dynamicObject);
BigDecimal wholew = dynamicObject.getBigDecimal("yem_wholew"); // 整柜重量
if (YEM.isNotEmpty(wholew) && wholew.compareTo(new BigDecimal(25000)) > 0) { BigDecimal wholew = dynamicObject.getBigDecimal("yem_wholew");
sb.append(String.format("装柜信息第 [ %S ] 行的整柜重量超出25吨!", index + 1)).append("\r\n"); if (YEM.isNotEmpty(wholew) && wholew.compareTo(new BigDecimal(25000)) > 0) {
} sb.append(String.format("装柜信息第 [ %S ] 行的整柜重量超出25吨!", index + 1)).append("\r\n");
}
if ("statusconvertqrzj".equals(operateKey)) {
auditValidator(dataEntity);
BigDecimal qty = BigDecimal.ZERO;
BigDecimal weight = BigDecimal.ZERO;
DynamicObjectCollection imMaterialinfoMi = dataEntity.getDynamicObjectCollection("yem_im_materialinfo_mi");
BigDecimal sumwholenum = dataEntity.getBigDecimal("yem_sumwholenum");
BigDecimal sumwholew = dataEntity.getBigDecimal("yem_sumwholew");
StringBuilder sbStr = new StringBuilder();
HashSet<Long> sourceIds = Sets.newHashSet();
for (DynamicObject dynamicObject : imMaterialinfoMi) {
int index = imMaterialinfoMi.indexOf(dynamicObject);
sourceIds.add(dynamicObject.getLong("yem_sourceentryid"));
BigDecimal totalqty = dynamicObject.getBigDecimal("yem_totalqty");
BigDecimal netweightsum = dynamicObject.getBigDecimal("yem_netweightsum");
qty = qty.add(totalqty);
weight = weight.add(netweightsum);
String businesssort = dynamicObject.getString("yem_businesssort");
BigDecimal singlestandardqty = dynamicObject.getBigDecimal("yem_singlestandardqty");
if ("Z".equals(businesssort) && singlestandardqty.compareTo(BigDecimal.ZERO) <= 0) {
sbStr.append(String.format("明细信息第 %s 行,单台标准件数必录,请检查!!", index + 1)).append("\r\n");
} }
} }
if (qty.compareTo(sumwholenum) > 0) {
sbStr.append("明细信息总件数合计值不允许超过整机总件数,请检查!!\r\n"); if ("statusconvertqrzj".equals(operateKey)) {
auditValidator(dataEntity);
BigDecimal qty = BigDecimal.ZERO;
BigDecimal weight = BigDecimal.ZERO;
DynamicObjectCollection imMaterialinfoMi = dataEntity.getDynamicObjectCollection("yem_im_materialinfo_mi");
BigDecimal sumwholenum = dataEntity.getBigDecimal("yem_sumwholenum");
BigDecimal sumwholew = dataEntity.getBigDecimal("yem_sumwholew");
StringBuilder sbStr = new StringBuilder();
HashSet<Long> sourceIds = Sets.newHashSet();
for (DynamicObject dynamicObject : imMaterialinfoMi) {
int index = imMaterialinfoMi.indexOf(dynamicObject);
sourceIds.add(dynamicObject.getLong("yem_sourceentryid"));
BigDecimal totalqty = dynamicObject.getBigDecimal("yem_totalqty");
BigDecimal netweightsum = dynamicObject.getBigDecimal("yem_netweightsum");
qty = qty.add(totalqty);
weight = weight.add(netweightsum);
String businesssort = dynamicObject.getString("yem_businesssort");
BigDecimal singlestandardqty = dynamicObject.getBigDecimal("yem_singlestandardqty");
if ("Z".equals(businesssort) && singlestandardqty.compareTo(BigDecimal.ZERO) <= 0) {
sbStr.append(String.format("明细信息第 %s 行,单台标准件数必录,请检查!!", index + 1)).append("\r\n");
}
}
if (qty.compareTo(sumwholenum) > 0) {
sbStr.append("明细信息总件数合计值不允许超过整机总件数,请检查!!\r\n");
// throw new KDBizException("明细信息总件数合计值不允许超过整机总件数,请检查!!"); // throw new KDBizException("明细信息总件数合计值不允许超过整机总件数,请检查!!");
} }
if (weight.compareTo(sumwholew) > 0) { if (weight.compareTo(sumwholew) > 0) {
sbStr.append("明细信息总净重合计值不允许超过整机总重量,请检查!!"); sbStr.append("明细信息总净重合计值不允许超过整机总重量,请检查!!");
// throw new KDBizException("明细信息总净重合计值不允许超过整机总重量,请检查!!"); // throw new KDBizException("明细信息总净重合计值不允许超过整机总重量,请检查!!");
} }
if (sbStr.length() > 0) { if (sbStr.length() > 0) {
throw new KDBizException(sbStr.toString()); throw new KDBizException(sbStr.toString());
} }
String selectfields = DynamicObjectUtil.getSelectfields("yem_es_storagetrans"); String selectfields = DynamicObjectUtil.getSelectfields("yem_es_storagetrans");
String storagetransSelectfields = DynamicObjectUtil.getEntrySelectfields(selectfields, "yem_es_storagetrans", "yem_es_materialinfo"); String storagetransSelectfields = DynamicObjectUtil.getEntrySelectfields(selectfields, "yem_es_storagetrans", "yem_es_materialinfo");
DynamicObject[] load = BusinessDataServiceHelper.load("yem_es_storagetrans", storagetransSelectfields, new QFilter[]{new QFilter("yem_es_materialinfo.id", "in", sourceIds)}); DynamicObject[] load = BusinessDataServiceHelper.load("yem_es_storagetrans", storagetransSelectfields, new QFilter[]{new QFilter("yem_es_materialinfo.id", "in", sourceIds)});
for (DynamicObject dynamicObject : load) { for (DynamicObject dynamicObject : load) {
DynamicObjectCollection sourceCollection = dynamicObject.getDynamicObjectCollection("yem_es_materialinfo"); DynamicObjectCollection sourceCollection = dynamicObject.getDynamicObjectCollection("yem_es_materialinfo");
for (DynamicObject source : sourceCollection) { for (DynamicObject source : sourceCollection) {
long existId = source.getLong("id"); long existId = source.getLong("id");
for (DynamicObject target : imMaterialinfoMi) { for (DynamicObject target : imMaterialinfoMi) {
long sourceentryid = target.getLong("yem_sourceentryid"); long sourceentryid = target.getLong("yem_sourceentryid");
if (existId == sourceentryid) { if (existId == sourceentryid) {
BigDecimal totalqty = target.getBigDecimal("yem_totalqty");//总件数 BigDecimal totalqty = target.getBigDecimal("yem_totalqty");//总件数
BigDecimal netweightsum = target.getBigDecimal("yem_netweightsum");//总净重 BigDecimal netweightsum = target.getBigDecimal("yem_netweightsum");//总净重
BigDecimal grossweightsum = target.getBigDecimal("yem_grossweightsum");//总毛重 BigDecimal grossweightsum = target.getBigDecimal("yem_grossweightsum");//总毛重
if (totalqty.compareTo(BigDecimal.ZERO) > 0) { if (totalqty.compareTo(BigDecimal.ZERO) > 0) {
source.set("yem_piece", totalqty); source.set("yem_piece", totalqty);
}
if (netweightsum.compareTo(BigDecimal.ZERO) > 0) {
source.set("yem_netweightsum", netweightsum);
}
if (grossweightsum.compareTo(BigDecimal.ZERO) > 0) {
source.set("yem_grossweightsum", grossweightsum);
}
BigDecimal piece = source.getBigDecimal("yem_piece");
netweightsum = source.getBigDecimal("yem_netweightsum");
grossweightsum = source.getBigDecimal("yem_grossweightsum");
source.set("yem_netweight", BigDecimalUtils.div(netweightsum, piece, 2));
source.set("yem_grossweight", BigDecimalUtils.div(grossweightsum, piece, 2));
} }
if (netweightsum.compareTo(BigDecimal.ZERO) > 0) {
source.set("yem_netweightsum", netweightsum);
}
if (grossweightsum.compareTo(BigDecimal.ZERO) > 0) {
source.set("yem_grossweightsum", grossweightsum);
}
BigDecimal piece = source.getBigDecimal("yem_piece");
netweightsum = source.getBigDecimal("yem_netweightsum");
grossweightsum = source.getBigDecimal("yem_grossweightsum");
source.set("yem_netweight", BigDecimalUtils.div(netweightsum, piece, 2));
source.set("yem_grossweight", BigDecimalUtils.div(grossweightsum, piece, 2));
} }
} }
} }
if (load.length > 0) {
SaveServiceHelper.save(load);
}
} }
if (load.length > 0) {
SaveServiceHelper.save(load);
}
}
if (sb.length() > 0) { if (sb.length() > 0) {
sb.append("请确认是否继续?"); sb.append("请确认是否继续?");
ConfirmCallBackListener confirmCallBackListener = new ConfirmCallBackListener(operateKey, this); ConfirmCallBackListener confirmCallBackListener = new ConfirmCallBackListener(operateKey, this);
this.getView().showConfirm(sb.toString(), MessageBoxOptions.YesNo, confirmCallBackListener); this.getView().showConfirm(sb.toString(), MessageBoxOptions.YesNo, confirmCallBackListener);
} else {
doConfirm(operateKey);
}
} else { } else {
doConfirm(operateKey); this.getView().showMessage("锁定重量是否确认为空!!!");
} }
} }
@ -344,19 +358,24 @@ public class EncaseMentEdit extends AbstractBillPlugIn implements Plugin, Before
SaveServiceHelper.save(new DynamicObject[]{dynamicObject}); SaveServiceHelper.save(new DynamicObject[]{dynamicObject});
long currentUserId = YEM.getCurrentUserId(); long currentUserId = YEM.getCurrentUserId();
DynamicObject user = BusinessDataServiceHelper.loadSingle(currentUserId, "bos_user"); DynamicObject user = BusinessDataServiceHelper.loadSingle(currentUserId, "bos_user");
if ("statusconvertpjqr".equals(operateKey)) { String yemWeightconfirmed = (String) this.getModel().getValue("yem_weightconfirmed");
if (!yemWeightconfirmed.isEmpty()) {
if ("statusconvertpjqr".equals(operateKey)) {
dataEntity.set("yem_completionstatuspj", "B"); dataEntity.set("yem_completionstatuspj", "B");
dataEntity.set("yem_affirmmanpj", user); dataEntity.set("yem_affirmmanpj", user);
dataEntity.set("yem_affirmdatepj", new Date()); dataEntity.set("yem_affirmdatepj", new Date());
}
if ("statusconvertqrzj".equals(operateKey)) {
dataEntity.set("yem_completionstatuszj", "B");
dataEntity.set("yem_affirmmanzj", user);
dataEntity.set("yem_affirmdatezj", new Date());
}
} else {
this.getView().showMessage("锁定重量是否确认为空!!!");
} }
if ("statusconvertqrzj".equals(operateKey)) {
dataEntity.set("yem_completionstatuszj", "B");
dataEntity.set("yem_affirmmanzj", user);
dataEntity.set("yem_affirmdatezj", new Date());
}
SaveServiceHelper.save(new DynamicObject[]{dataEntity}); SaveServiceHelper.save(new DynamicObject[]{dataEntity});
this.getView().invokeOperation("refresh"); this.getView().invokeOperation("refresh");
this.getView().showSuccessNotification("确认完成"); this.getView().showSuccessNotification("确认完成");
@ -413,7 +432,12 @@ public class EncaseMentEdit extends AbstractBillPlugIn implements Plugin, Before
if (MessageBoxResult.Yes.equals(result)) { if (MessageBoxResult.Yes.equals(result)) {
if ("statusconvertpjqr".equals(callBackId) || "statusconvertqrzj".equals(callBackId)) { if ("statusconvertpjqr".equals(callBackId) || "statusconvertqrzj".equals(callBackId)) {
doConfirm(callBackId); String yemWeightconfirmed = (String) this.getModel().getValue("yem_weightconfirmed");
if (!yemWeightconfirmed.isEmpty()) {
doConfirm(callBackId);
} else {
this.getView().showMessage("锁定重量是否确认为空!!!");
}
} }
} }
} }

View File

@ -3,9 +3,11 @@ package com.yem.wm.es.shippingdetails.op;
import com.alibaba.csp.sentinel.util.StringUtil; import com.alibaba.csp.sentinel.util.StringUtil;
import com.yem.wm.es.contractamtlist.util.FunUtil; import com.yem.wm.es.contractamtlist.util.FunUtil;
import com.yem.wm.es.shippingdetails.util.PaymentControlUtil; import com.yem.wm.es.shippingdetails.util.PaymentControlUtil;
import com.yem.wm.es.shippingdetails.validator.ShippingDetailsAuditValidator;
import com.yem.wm.utils.YEM; import com.yem.wm.utils.YEM;
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.entity.ExtendedDataEntity;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn; import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.AddValidatorsEventArgs; import kd.bos.entity.plugin.AddValidatorsEventArgs;
import kd.bos.entity.plugin.PreparePropertysEventArgs; import kd.bos.entity.plugin.PreparePropertysEventArgs;
@ -33,7 +35,7 @@ public class ShippingDetailsAuditOp extends AbstractOperationServicePlugIn {
@Override @Override
public void onAddValidators(AddValidatorsEventArgs e) { public void onAddValidators(AddValidatorsEventArgs e) {
super.onAddValidators(e); super.onAddValidators(e);
// e.addValidator(new ShippingDetailAuditValidator()); // e.addValidator(new ShippingDetailsAuditValidator());
} }
@Override @Override
@ -43,27 +45,100 @@ public class ShippingDetailsAuditOp extends AbstractOperationServicePlugIn {
dataEntitie = BusinessDataServiceHelper.loadSingle(dataEntitie.getPkValue(), dataEntitie.getDynamicObjectType().getName()); dataEntitie = BusinessDataServiceHelper.loadSingle(dataEntitie.getPkValue(), dataEntitie.getDynamicObjectType().getName());
collect(dataEntitie); collect(dataEntitie);
arrearsAmt(dataEntitie); arrearsAmt(dataEntitie);
SaveServiceHelper.save(new DynamicObject[]{dataEntitie}); // if (dataEntitie.getDynamicObjectType().getName().equals("yem_xshippingdetails")) {
// DynamicObjectCollection yemEsSalesorderTotal = dataEntitie.getDynamicObjectCollection("yem_es_salesorder_total");
// if (!yemEsSalesorderTotal.isEmpty()) {
// for (DynamicObject dynamicObject : yemEsSalesorderTotal) {
// BigDecimal yemQtyTl = dynamicObject.getBigDecimal("yem_qty_tl");
// BigDecimal yemAllocateqtyTl = dynamicObject.getBigDecimal("yem_allocateqty_tl");
// int i = dynamicObject.getInt("seq");
// String yemAccesmaterial = dynamicObject.getString("yem_accesmaterial_tl.name");
// boolean yemIsgifitTl = dynamicObject.getBoolean("yem_isgifit_tl");
//
// if (yemQtyTl.compareTo(yemAllocateqtyTl) < 0&&!yemIsgifitTl&&) {
// this.getOperationResult().setSuccess(true);
// this.getOperationResult().setMessage("出运汇总页签,第" + i + "行物料" + yemAccesmaterial + ",已调数量" + yemQtyTl + ",出运数量" + yemAllocateqtyTl + ",不允许审核,请修改调拨后处理!"); // 提示内容
// this.getOperationResult().setShowMessage(true); // 是否显示提示消息
// }
// }
// }
// }
SaveServiceHelper.save(new DynamicObject[]{dataEntitie});
}
} }
}
/** /**
* @description 审核时生成出运汇总分录 * @description 审核时生成出运汇总分录
* @author power * @author power
*/ */
public static void collect(DynamicObject dataEntitie) { public static void collect (DynamicObject dataEntitie){
DynamicObjectCollection materialinfos = dataEntitie.getDynamicObjectCollection("yem_es_materialinfo"); DynamicObjectCollection materialinfos = dataEntitie.getDynamicObjectCollection("yem_es_materialinfo");
DynamicObjectCollection followcars = dataEntitie.getDynamicObjectCollection("yem_es_salesorder_p"); DynamicObjectCollection followcars = dataEntitie.getDynamicObjectCollection("yem_es_salesorder_p");
DynamicObjectCollection collects = dataEntitie.getDynamicObjectCollection("yem_es_salesorder_total"); DynamicObjectCollection collects = dataEntitie.getDynamicObjectCollection("yem_es_salesorder_total");
if (materialinfos != null) { if (materialinfos != null) {
for (DynamicObject materialinfo : materialinfos) { for (DynamicObject materialinfo : materialinfos) {
if (StringUtil.isNotEmpty(materialinfo.getString("yem_businesssort"))) { if (StringUtil.isNotEmpty(materialinfo.getString("yem_businesssort"))) {
String businesssort = materialinfo.getString("yem_businesssort"); String businesssort = materialinfo.getString("yem_businesssort");
boolean yemIfgift = materialinfo.getBoolean("yem_ifgift"); boolean yemIfgift = materialinfo.getBoolean("yem_ifgift");
if ("Z".equals(businesssort)&&!yemIfgift) { if ("Z".equals(businesssort) && !yemIfgift) {
DynamicObjectCollection completemachines = materialinfo.getDynamicObjectCollection("yem_es_salesorder_z"); DynamicObjectCollection completemachines = materialinfo.getDynamicObjectCollection("yem_es_salesorder_z");
for (DynamicObject completemachine : completemachines) { for (DynamicObject completemachine : completemachines) {
DynamicObject newEntryEntity = collects.addNew();
newEntryEntity.set("yem_isgifit_tl", yemIfgift);
newEntryEntity.set("yem_classification_tl", businesssort);
if (materialinfo.getDynamicObject("yem_materiel") != null) {
newEntryEntity.set("yem_accesmaterial_tl", materialinfo.getLong("yem_materiel.id"));
}
if (completemachine.getDynamicObject("yem_resourcescode") != null) {
newEntryEntity.set("yem_resource_tl", completemachine.getLong("yem_resourcescode.id"));
}
if (completemachine.getDynamicObject("yem_milltype") != null) {
newEntryEntity.set("yem_basicmodel_tl", completemachine.getLong("yem_milltype.id"));
}
if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialname"))) {
newEntryEntity.set("yem_materialname_tl", materialinfo.getString("yem_materialname"));
}
if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialenname"))) {
newEntryEntity.set("yem_materialenname_tl", materialinfo.getString("yem_materialenname"));
}
if (StringUtil.isNotEmpty(materialinfo.getString("yem_specification"))) {
newEntryEntity.set("yem_specification_tl", materialinfo.getString("yem_specification"));
}
if (materialinfo.getDynamicObject("yem_unit") != null) {
newEntryEntity.set("yem_acunit_tl", materialinfo.getLong("yem_unit.id"));
}
newEntryEntity.set("yem_qty_tl", BigDecimal.ONE);
newEntryEntity.set("yem_constractqty_tl", materialinfo.getBigDecimal("yem_needqty"));
//销售单价价格条款
newEntryEntity.set("yem_sapepeclause_tl", materialinfo.getBigDecimal("yem_sapricepriceclause"));
newEntryEntity.set("yem_sapecebase_tl", materialinfo.getBigDecimal("yem_sapriceclausebase"));
//销售金额价格条款
newEntryEntity.set("yem_saamtpecle_tl", materialinfo.getBigDecimal("yem_saamtpriceclause"));
newEntryEntity.set("yem_samtpeceba_tl", materialinfo.getBigDecimal("yem_samtpriceclauseba"));
if (materialinfo.getDynamicObject("yem_baseunit") != null) {
newEntryEntity.set("yem_unitfieldbase_tl", materialinfo.getLong("yem_baseunit.id"));
}
newEntryEntity.set("yem_qtybase_tl", materialinfo.getBigDecimal("yem_baseqty"));
newEntryEntity.set("yem_storageqty_tl", materialinfo.getBigDecimal("yem_storageqty"));
if (StringUtil.isNotEmpty(completemachine.getString("yem_vehicleno"))) {
newEntryEntity.set("yem_zjnumber_tl", completemachine.getString("yem_vehicleno"));
}
if (StringUtil.isNotEmpty(materialinfo.getString("yem_contractno"))) {
newEntryEntity.set("yem_constratnb_tl", materialinfo.getString("yem_contractno"));
}
newEntryEntity.set("yem_constractioid_tl", materialinfo.getLong("id"));
newEntryEntity.set("yem_constracteyid_tl", materialinfo.getLong("yem_sourceentryid"));
// 汇总影响调拨价
newEntryEntity.set("yem_impactprice1", materialinfo.getString("yem_impactprice"));
}
}
if ("P".equals(businesssort) && !yemIfgift) {
DynamicObject newEntryEntity = collects.addNew(); DynamicObject newEntryEntity = collects.addNew();
newEntryEntity.set("yem_isgifit_tl", yemIfgift); newEntryEntity.set("yem_isgifit_tl", yemIfgift);
@ -71,11 +146,11 @@ public class ShippingDetailsAuditOp extends AbstractOperationServicePlugIn {
if (materialinfo.getDynamicObject("yem_materiel") != null) { if (materialinfo.getDynamicObject("yem_materiel") != null) {
newEntryEntity.set("yem_accesmaterial_tl", materialinfo.getLong("yem_materiel.id")); newEntryEntity.set("yem_accesmaterial_tl", materialinfo.getLong("yem_materiel.id"));
} }
if (completemachine.getDynamicObject("yem_resourcescode") != null) { if (materialinfo.getDynamicObject("yem_resourcenog") != null) {
newEntryEntity.set("yem_resource_tl", completemachine.getLong("yem_resourcescode.id")); newEntryEntity.set("yem_resource_tl", materialinfo.getLong("yem_resourcenog.id"));
} }
if (completemachine.getDynamicObject("yem_milltype") != null) { if (materialinfo.getDynamicObject("yem_productmodel") != null) {
newEntryEntity.set("yem_basicmodel_tl", completemachine.getLong("yem_milltype.id")); newEntryEntity.set("yem_basicmodel_tl", materialinfo.getLong("yem_productmodel.yem_products.id"));
} }
if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialname"))) { if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialname"))) {
newEntryEntity.set("yem_materialname_tl", materialinfo.getString("yem_materialname")); newEntryEntity.set("yem_materialname_tl", materialinfo.getString("yem_materialname"));
@ -89,7 +164,7 @@ public class ShippingDetailsAuditOp extends AbstractOperationServicePlugIn {
if (materialinfo.getDynamicObject("yem_unit") != null) { if (materialinfo.getDynamicObject("yem_unit") != null) {
newEntryEntity.set("yem_acunit_tl", materialinfo.getLong("yem_unit.id")); newEntryEntity.set("yem_acunit_tl", materialinfo.getLong("yem_unit.id"));
} }
newEntryEntity.set("yem_qty_tl", BigDecimal.ONE); newEntryEntity.set("yem_qty_tl", materialinfo.getBigDecimal("yem_qty"));
newEntryEntity.set("yem_constractqty_tl", materialinfo.getBigDecimal("yem_needqty")); newEntryEntity.set("yem_constractqty_tl", materialinfo.getBigDecimal("yem_needqty"));
//销售单价价格条款 //销售单价价格条款
newEntryEntity.set("yem_sapepeclause_tl", materialinfo.getBigDecimal("yem_sapricepriceclause")); newEntryEntity.set("yem_sapepeclause_tl", materialinfo.getBigDecimal("yem_sapricepriceclause"));
@ -104,9 +179,59 @@ public class ShippingDetailsAuditOp extends AbstractOperationServicePlugIn {
newEntryEntity.set("yem_qtybase_tl", materialinfo.getBigDecimal("yem_baseqty")); newEntryEntity.set("yem_qtybase_tl", materialinfo.getBigDecimal("yem_baseqty"));
newEntryEntity.set("yem_storageqty_tl", materialinfo.getBigDecimal("yem_storageqty")); newEntryEntity.set("yem_storageqty_tl", materialinfo.getBigDecimal("yem_storageqty"));
if (StringUtil.isNotEmpty(completemachine.getString("yem_vehicleno"))) { if (StringUtil.isNotEmpty(materialinfo.getString("yem_contractno"))) {
newEntryEntity.set("yem_zjnumber_tl", completemachine.getString("yem_vehicleno")); newEntryEntity.set("yem_constratnb_tl", materialinfo.getString("yem_contractno"));
} }
newEntryEntity.set("yem_constractioid_tl", materialinfo.getLong("id"));
newEntryEntity.set("yem_constracteyid_tl", materialinfo.getLong("yem_sourceentryid"));
// 汇总影响调拨价
newEntryEntity.set("yem_impactprice1", materialinfo.getString("yem_impactprice"));
}
if (yemIfgift) {
DynamicObject newEntryEntity = collects.addNew();
newEntryEntity.set("yem_isgifit_tl", yemIfgift);
newEntryEntity.set("yem_classification_tl", businesssort);
if (materialinfo.getDynamicObject("yem_materiel") != null) {
newEntryEntity.set("yem_accesmaterial_tl", materialinfo.getLong("yem_materiel.id"));
}
if (materialinfo.getDynamicObject("yem_resourcenog") != null) {
newEntryEntity.set("yem_resource_tl", materialinfo.getLong("yem_resourcenog.id"));
}
if (materialinfo.getDynamicObject("yem_productmodel") != null) {
newEntryEntity.set("yem_basicmodel_tl", materialinfo.getLong("yem_productmodel.yem_products.id"));
}
if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialname"))) {
newEntryEntity.set("yem_materialname_tl", materialinfo.getString("yem_materialname"));
}
if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialenname"))) {
newEntryEntity.set("yem_materialenname_tl", materialinfo.getString("yem_materialenname"));
}
if (StringUtil.isNotEmpty(materialinfo.getString("yem_specification"))) {
newEntryEntity.set("yem_specification_tl", materialinfo.getString("yem_specification"));
}
if (materialinfo.getDynamicObject("yem_unit") != null) {
newEntryEntity.set("yem_acunit_tl", materialinfo.getLong("yem_unit.id"));
}
newEntryEntity.set("yem_qty_tl", materialinfo.getBigDecimal("yem_qty"));
newEntryEntity.set("yem_constractqty_tl", materialinfo.getBigDecimal("yem_needqty"));
//销售单价价格条款
newEntryEntity.set("yem_sapepeclause_tl", materialinfo.getBigDecimal("yem_sapricepriceclause"));
newEntryEntity.set("yem_sapecebase_tl", materialinfo.getBigDecimal("yem_sapriceclausebase"));
//销售金额价格条款
newEntryEntity.set("yem_saamtpecle_tl", materialinfo.getBigDecimal("yem_saamtpriceclause"));
newEntryEntity.set("yem_samtpeceba_tl", materialinfo.getBigDecimal("yem_samtpriceclauseba"));
if (materialinfo.getDynamicObject("yem_baseunit") != null) {
newEntryEntity.set("yem_unitfieldbase_tl", materialinfo.getLong("yem_baseunit.id"));
}
newEntryEntity.set("yem_qtybase_tl", materialinfo.getBigDecimal("yem_baseqty"));
newEntryEntity.set("yem_storageqty_tl", materialinfo.getBigDecimal("yem_storageqty"));
// if (materialinfo.getDynamicObject("yem_materiel")!=null) {
// newEntryEntity.set("yem_zjnumber_tl", materialinfo.getLong("yem_materiel.id"));
// }
if (StringUtil.isNotEmpty(materialinfo.getString("yem_contractno"))) { if (StringUtil.isNotEmpty(materialinfo.getString("yem_contractno"))) {
newEntryEntity.set("yem_constratnb_tl", materialinfo.getString("yem_contractno")); newEntryEntity.set("yem_constratnb_tl", materialinfo.getString("yem_contractno"));
} }
@ -117,166 +242,62 @@ public class ShippingDetailsAuditOp extends AbstractOperationServicePlugIn {
newEntryEntity.set("yem_impactprice1", materialinfo.getString("yem_impactprice")); newEntryEntity.set("yem_impactprice1", materialinfo.getString("yem_impactprice"));
} }
} }
if ("P".equals(businesssort)&&!yemIfgift) {
DynamicObject newEntryEntity = collects.addNew();
newEntryEntity.set("yem_isgifit_tl", yemIfgift);
newEntryEntity.set("yem_classification_tl", businesssort);
if (materialinfo.getDynamicObject("yem_materiel") != null) {
newEntryEntity.set("yem_accesmaterial_tl", materialinfo.getLong("yem_materiel.id"));
}
if (materialinfo.getDynamicObject("yem_resourcenog") != null) {
newEntryEntity.set("yem_resource_tl", materialinfo.getLong("yem_resourcenog.id"));
}
if (materialinfo.getDynamicObject("yem_productmodel") != null) {
newEntryEntity.set("yem_basicmodel_tl", materialinfo.getLong("yem_productmodel.yem_products.id"));
}
if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialname"))) {
newEntryEntity.set("yem_materialname_tl", materialinfo.getString("yem_materialname"));
}
if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialenname"))) {
newEntryEntity.set("yem_materialenname_tl", materialinfo.getString("yem_materialenname"));
}
if (StringUtil.isNotEmpty(materialinfo.getString("yem_specification"))) {
newEntryEntity.set("yem_specification_tl", materialinfo.getString("yem_specification"));
}
if (materialinfo.getDynamicObject("yem_unit") != null) {
newEntryEntity.set("yem_acunit_tl", materialinfo.getLong("yem_unit.id"));
}
newEntryEntity.set("yem_qty_tl", materialinfo.getBigDecimal("yem_qty"));
newEntryEntity.set("yem_constractqty_tl", materialinfo.getBigDecimal("yem_needqty"));
//销售单价价格条款
newEntryEntity.set("yem_sapepeclause_tl", materialinfo.getBigDecimal("yem_sapricepriceclause"));
newEntryEntity.set("yem_sapecebase_tl", materialinfo.getBigDecimal("yem_sapriceclausebase"));
//销售金额价格条款
newEntryEntity.set("yem_saamtpecle_tl", materialinfo.getBigDecimal("yem_saamtpriceclause"));
newEntryEntity.set("yem_samtpeceba_tl", materialinfo.getBigDecimal("yem_samtpriceclauseba"));
if (materialinfo.getDynamicObject("yem_baseunit") != null) {
newEntryEntity.set("yem_unitfieldbase_tl", materialinfo.getLong("yem_baseunit.id"));
}
newEntryEntity.set("yem_qtybase_tl", materialinfo.getBigDecimal("yem_baseqty"));
newEntryEntity.set("yem_storageqty_tl", materialinfo.getBigDecimal("yem_storageqty"));
if (StringUtil.isNotEmpty(materialinfo.getString("yem_contractno"))) {
newEntryEntity.set("yem_constratnb_tl", materialinfo.getString("yem_contractno"));
}
newEntryEntity.set("yem_constractioid_tl", materialinfo.getLong("id"));
newEntryEntity.set("yem_constracteyid_tl", materialinfo.getLong("yem_sourceentryid"));
// 汇总影响调拨价
newEntryEntity.set("yem_impactprice1", materialinfo.getString("yem_impactprice"));
}
if (yemIfgift){
DynamicObject newEntryEntity = collects.addNew();
newEntryEntity.set("yem_isgifit_tl", yemIfgift);
newEntryEntity.set("yem_classification_tl", businesssort);
if (materialinfo.getDynamicObject("yem_materiel") != null) {
newEntryEntity.set("yem_accesmaterial_tl", materialinfo.getLong("yem_materiel.id"));
}
if (materialinfo.getDynamicObject("yem_resourcenog") != null) {
newEntryEntity.set("yem_resource_tl", materialinfo.getLong("yem_resourcenog.id"));
}
if (materialinfo.getDynamicObject("yem_productmodel") != null) {
newEntryEntity.set("yem_basicmodel_tl", materialinfo.getLong("yem_productmodel.yem_products.id"));
}
if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialname"))) {
newEntryEntity.set("yem_materialname_tl", materialinfo.getString("yem_materialname"));
}
if (StringUtil.isNotEmpty(materialinfo.getString("yem_materialenname"))) {
newEntryEntity.set("yem_materialenname_tl", materialinfo.getString("yem_materialenname"));
}
if (StringUtil.isNotEmpty(materialinfo.getString("yem_specification"))) {
newEntryEntity.set("yem_specification_tl", materialinfo.getString("yem_specification"));
}
if (materialinfo.getDynamicObject("yem_unit") != null) {
newEntryEntity.set("yem_acunit_tl", materialinfo.getLong("yem_unit.id"));
}
newEntryEntity.set("yem_qty_tl", materialinfo.getBigDecimal("yem_qty"));
newEntryEntity.set("yem_constractqty_tl", materialinfo.getBigDecimal("yem_needqty"));
//销售单价价格条款
newEntryEntity.set("yem_sapepeclause_tl", materialinfo.getBigDecimal("yem_sapricepriceclause"));
newEntryEntity.set("yem_sapecebase_tl", materialinfo.getBigDecimal("yem_sapriceclausebase"));
//销售金额价格条款
newEntryEntity.set("yem_saamtpecle_tl", materialinfo.getBigDecimal("yem_saamtpriceclause"));
newEntryEntity.set("yem_samtpeceba_tl", materialinfo.getBigDecimal("yem_samtpriceclauseba"));
if (materialinfo.getDynamicObject("yem_baseunit") != null) {
newEntryEntity.set("yem_unitfieldbase_tl", materialinfo.getLong("yem_baseunit.id"));
}
newEntryEntity.set("yem_qtybase_tl", materialinfo.getBigDecimal("yem_baseqty"));
newEntryEntity.set("yem_storageqty_tl", materialinfo.getBigDecimal("yem_storageqty"));
// if (materialinfo.getDynamicObject("yem_materiel")!=null) {
// newEntryEntity.set("yem_zjnumber_tl", materialinfo.getLong("yem_materiel.id"));
// }
if (StringUtil.isNotEmpty(materialinfo.getString("yem_contractno"))) {
newEntryEntity.set("yem_constratnb_tl", materialinfo.getString("yem_contractno"));
}
newEntryEntity.set("yem_constractioid_tl", materialinfo.getLong("id"));
newEntryEntity.set("yem_constracteyid_tl", materialinfo.getLong("yem_sourceentryid"));
// 汇总影响调拨价
newEntryEntity.set("yem_impactprice1", materialinfo.getString("yem_impactprice"));
}
} }
} }
} if (followcars != null) {
if (followcars != null) { for (DynamicObject followcar : followcars) {
for (DynamicObject followcar : followcars) { DynamicObject newEntryEntity = collects.addNew();
DynamicObject newEntryEntity = collects.addNew(); newEntryEntity.set("yem_isgifit_tl", true);
newEntryEntity.set("yem_isgifit_tl", true); newEntryEntity.set("yem_classification_tl", "A");
newEntryEntity.set("yem_classification_tl", "A"); if (followcar.getDynamicObject("yem_accessorytype") != null) {
if (followcar.getDynamicObject("yem_accessorytype") != null) { newEntryEntity.set("yem_basicmodel_tl", followcar.getLong("yem_accessorytype.id"));
newEntryEntity.set("yem_basicmodel_tl", followcar.getLong("yem_accessorytype.id")); }
} if (StringUtil.isNotEmpty(followcar.getString("yem_volvotype"))) {
if (StringUtil.isNotEmpty(followcar.getString("yem_volvotype"))) { newEntryEntity.set("yem_volvotype_tl", followcar.getString("yem_volvotype"));
newEntryEntity.set("yem_volvotype_tl", followcar.getString("yem_volvotype")); }
} if (followcar.getDynamicObject("yem_accesmaterial") != null) {
if (followcar.getDynamicObject("yem_accesmaterial") != null) { newEntryEntity.set("yem_accesmaterial_tl", followcar.getLong("yem_accesmaterial.id"));
newEntryEntity.set("yem_accesmaterial_tl", followcar.getLong("yem_accesmaterial.id")); newEntryEntity.set("yem_materialname_tl", followcar.getString("yem_accesmaterial.name"));
newEntryEntity.set("yem_materialname_tl", followcar.getString("yem_accesmaterial.name")); newEntryEntity.set("yem_materialenname_tl", followcar.getString("yem_accesmaterial.yem_nameen"));
newEntryEntity.set("yem_materialenname_tl", followcar.getString("yem_accesmaterial.yem_nameen")); newEntryEntity.set("yem_specification_tl", followcar.getString("yem_accesmaterial.modelnum"));
newEntryEntity.set("yem_specification_tl", followcar.getString("yem_accesmaterial.modelnum")); }
} if (followcar.getDynamicObject("yem_acunit") != null) {
if (followcar.getDynamicObject("yem_acunit") != null) { newEntryEntity.set("yem_acunit_tl", followcar.getLong("yem_acunit.id"));
newEntryEntity.set("yem_acunit_tl", followcar.getLong("yem_acunit.id")); newEntryEntity.set("yem_unitfieldbase_tl", followcar.getLong("yem_acunit.id"));
newEntryEntity.set("yem_unitfieldbase_tl", followcar.getLong("yem_acunit.id")); }
} if (StringUtil.isNotEmpty(followcar.getString("yem_saleorderno_p"))) {
if (StringUtil.isNotEmpty(followcar.getString("yem_saleorderno_p"))) { newEntryEntity.set("yem_constratnb_tl", followcar.getString("yem_saleorderno_p"));
newEntryEntity.set("yem_constratnb_tl", followcar.getString("yem_saleorderno_p")); }
} newEntryEntity.set("yem_qty_tl", followcar.getBigDecimal("yem_acallqty"));
newEntryEntity.set("yem_qty_tl", followcar.getBigDecimal("yem_acallqty")); newEntryEntity.set("yem_qtybase_tl", followcar.getBigDecimal("yem_acallqty"));
newEntryEntity.set("yem_qtybase_tl", followcar.getBigDecimal("yem_acallqty")); newEntryEntity.set("yem_constracteyid_tl", followcar.getLong("yem_constracteyid_p"));
newEntryEntity.set("yem_constracteyid_tl", followcar.getLong("yem_constracteyid_p")); newEntryEntity.set("yem_constractioid_tl", followcar.getLong("id"));
newEntryEntity.set("yem_constractioid_tl", followcar.getLong("id"));
}
} }
} }
/**
* @description 计算欠款金额
* @author xwudd
* @param[1] dataEntity
* return
* @time 2023/11/9 14:24
*/
public static void arrearsAmt (DynamicObject dataEntity){
String sourceBillType = dataEntity.getString("yem_sourcebilltype");
long sourceBillId = dataEntity.getLong("yem_sourcebillid");
DynamicObject saleOrder = BusinessDataServiceHelper.loadSingle(sourceBillId, sourceBillType);
String saleorderno = dataEntity.getString("yem_saleorderno");
if (YEM.isEmpty(saleorderno)) return;
DynamicObject[] shipBills = getShipBills(saleOrder, dataEntity, "A");//出运
DynamicObject[] payBills = getPayBills(saleOrder, dataEntity, "B");//收款单
BigDecimal thisRealityAmt = PaymentControlUtil.getThisRealityAmt(saleOrder, shipBills, payBills, dataEntity);
dataEntity.set("yem_arrearsamt", thisRealityAmt);//本次发运欠款金额
dataEntity.set("yem_arrearsamtapply", FunUtil.getAbs(thisRealityAmt));//本次发运应申请欠条金额
}
} }
/**
* @description 计算欠款金额
* @author xwudd
* @param[1] dataEntity
* return
* @time 2023/11/9 14:24
*/
public static void arrearsAmt(DynamicObject dataEntity) {
String sourceBillType = dataEntity.getString("yem_sourcebilltype");
long sourceBillId = dataEntity.getLong("yem_sourcebillid");
DynamicObject saleOrder = BusinessDataServiceHelper.loadSingle(sourceBillId, sourceBillType);
String saleorderno = dataEntity.getString("yem_saleorderno");
if (YEM.isEmpty(saleorderno)) return;
DynamicObject[] shipBills = getShipBills(saleOrder, dataEntity, "A");//出运
DynamicObject[] payBills = getPayBills(saleOrder, dataEntity, "B");//收款单
BigDecimal thisRealityAmt = PaymentControlUtil.getThisRealityAmt(saleOrder, shipBills, payBills, dataEntity);
dataEntity.set("yem_arrearsamt", thisRealityAmt);//本次发运欠款金额
dataEntity.set("yem_arrearsamtapply", FunUtil.getAbs(thisRealityAmt));//本次发运应申请欠条金额
}
}