1.收款单修改认领金额更新
This commit is contained in:
ljw 2024-11-01 16:20:10 +08:00
parent a7236d8feb
commit c1907a51e1

View File

@ -32,6 +32,7 @@ import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.QueryServiceHelper; import kd.bos.servicehelper.QueryServiceHelper;
import kd.bos.servicehelper.operation.OperationServiceHelper; import kd.bos.servicehelper.operation.OperationServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
@ -80,7 +81,7 @@ public class GatheringClaimFormPlugin extends AbstractFormPlugin implements RowC
model.setValue("yem_unclaimedamo", receivableamt.subtract(claimamtA)); model.setValue("yem_unclaimedamo", receivableamt.subtract(claimamtA));
if ("claim".equals(opType)) { if ("claim".equals(opType)) {
for (int i = 0; i < collection.size(); i++) { for (int i = 0; i < collection.size(); i++) {
claim(model, i, collection, claimdetail,i); claim(model, i, collection, claimdetail,i,parentModel);
view.setEnable(false, i, new String[]{"yem_remark_b", "yem_claimamt", "yem_salcontractclaamt", "yem_originid", "yem_claimdate", "yem_moneynature", "yem_moneytype", "yem_productclassify", "yem_receiptuse", "yem_operator_b", "yem_salcontractno", "yem_hidsalcontractno", "yem_billtype_b", "yem_contractrelevcuy", "yem_salcontractamt", "yem_shippingdetailsno", "yem_hidshippingdetailsno", "yem_shipamt", "yem_claimamtbase", "yem_contractamtbase", "yem_conversionrate", "yem_department_b"}); view.setEnable(false, i, new String[]{"yem_remark_b", "yem_claimamt", "yem_salcontractclaamt", "yem_originid", "yem_claimdate", "yem_moneynature", "yem_moneytype", "yem_productclassify", "yem_receiptuse", "yem_operator_b", "yem_salcontractno", "yem_hidsalcontractno", "yem_billtype_b", "yem_contractrelevcuy", "yem_salcontractamt", "yem_shippingdetailsno", "yem_hidshippingdetailsno", "yem_shipamt", "yem_claimamtbase", "yem_contractamtbase", "yem_conversionrate", "yem_department_b"});
} }
model.setValue("yem_optype", "A"); model.setValue("yem_optype", "A");
@ -88,7 +89,7 @@ public class GatheringClaimFormPlugin extends AbstractFormPlugin implements RowC
} }
if ("changeclaim".equals(opType)) { if ("changeclaim".equals(opType)) {
claim(model, subRowIdx, collection, claimdetail,0); claim(model, subRowIdx, collection, claimdetail,0,parentModel);
view.setEnable(false, 0, new String[]{"yem_salcontractclaamt", "yem_originid", "yem_claimdate", "yem_moneynature", "yem_moneytype", "yem_productclassify", "yem_receiptuse", "yem_operator_b", "yem_salcontractno", "yem_hidsalcontractno", "yem_billtype_b", "yem_contractrelevcuy", "yem_salcontractamt", "yem_shippingdetailsno", "yem_hidshippingdetailsno", "yem_shipamt", "yem_claimamtbase", "yem_contractamtbase", "yem_conversionrate", "yem_department_b"}); view.setEnable(false, 0, new String[]{"yem_salcontractclaamt", "yem_originid", "yem_claimdate", "yem_moneynature", "yem_moneytype", "yem_productclassify", "yem_receiptuse", "yem_operator_b", "yem_salcontractno", "yem_hidsalcontractno", "yem_billtype_b", "yem_contractrelevcuy", "yem_salcontractamt", "yem_shippingdetailsno", "yem_hidshippingdetailsno", "yem_shipamt", "yem_claimamtbase", "yem_contractamtbase", "yem_conversionrate", "yem_department_b"});
model.setValue("yem_optype", "B"); model.setValue("yem_optype", "B");
} }
@ -96,7 +97,7 @@ public class GatheringClaimFormPlugin extends AbstractFormPlugin implements RowC
// yem_unclaimedamo = yem_receivableamt - yem_claimamt_a // yem_unclaimedamo = yem_receivableamt - yem_claimamt_a
} }
private void claim(IDataModel model, int row, DynamicObjectCollection collection, DynamicObjectCollection claimdetail, int i) { private void claim(IDataModel model, int row, DynamicObjectCollection collection, DynamicObjectCollection claimdetail, int i, IDataModel parentModel) {
DynamicObject dynamicObject = collection.get(row); DynamicObject dynamicObject = collection.get(row);
DynamicObject object = claimdetail.addNew(); DynamicObject object = claimdetail.addNew();
setEntryValue(object, dynamicObject, "from"); setEntryValue(object, dynamicObject, "from");
@ -115,6 +116,22 @@ public class GatheringClaimFormPlugin extends AbstractFormPlugin implements RowC
model.setValue("yem_orderrefundamt", orderrefundamt, i); model.setValue("yem_orderrefundamt", orderrefundamt, i);
model.setValue("yem_shiprefundamt", shiprefundamt, i); model.setValue("yem_shiprefundamt", shiprefundamt, i);
model.setValue("yem_periodrefundamt", periodrefundamt, i); model.setValue("yem_periodrefundamt", periodrefundamt, i);
DynamicObject loadSingle = BusinessDataServiceHelper.loadSingle("yem_gathering", "id,billnom,yem_receiptdetail,yem_receiptdetail.yem_claimdetail" +
",yem_claimdetail.yem_salcontractamt,yem_claimdetail.yem_orderrefundamt,yem_claimdetail.yem_shiprefundamt,yem_claimdetail.yem_periodrefundamt"
, new QFilter[]{new QFilter("id", QCP.equals, parentModel.getValue("id"))});
DynamicObjectCollection dynamicObjectCollection = loadSingle.getDynamicObjectCollection("yem_receiptdetail");
for (DynamicObject dynamicObjec : dynamicObjectCollection) {
DynamicObjectCollection yemClaimdetail = dynamicObjec.getDynamicObjectCollection("yem_claimdetail");
for (int s = 0; s < yemClaimdetail.size(); s++) {
DynamicObject dynamicObject1 = yemClaimdetail.get(s);
dynamicObject1.set("yem_salcontractamt",amount);
dynamicObject1.set("yem_orderrefundamt",orderrefundamt);
dynamicObject1.set("yem_shiprefundamt",shiprefundamt);
dynamicObject1.set("yem_periodrefundamt",periodrefundamt);
}
}
SaveServiceHelper.update(loadSingle);
} }
if (YEM.isNotEmpty(salcontract) && YEM.isNotEmpty(shippingDetailsNo)) { if (YEM.isNotEmpty(salcontract) && YEM.isNotEmpty(shippingDetailsNo)) {
DynamicObject salesorder = BusinessDataServiceHelper.loadSingle("yem_es_salesorder", new QFilter[]{new QFilter("yem_es_salesorder.billno", QCP.equals, salcontract),}); DynamicObject salesorder = BusinessDataServiceHelper.loadSingle("yem_es_salesorder", new QFilter[]{new QFilter("yem_es_salesorder.billno", QCP.equals, salcontract),});
@ -133,6 +150,22 @@ public class GatheringClaimFormPlugin extends AbstractFormPlugin implements RowC
model.setValue("yem_periodrefundamt", periodrefundamt, i); model.setValue("yem_periodrefundamt", periodrefundamt, i);
model.setValue("yem_salcontractamt", amounts, i); model.setValue("yem_salcontractamt", amounts, i);
model.setValue("yem_shipamt", amount, i); model.setValue("yem_shipamt", amount, i);
DynamicObject loadSingle = BusinessDataServiceHelper.loadSingle("yem_gathering", "id,billnom,yem_receiptdetail,yem_receiptdetail.yem_claimdetail" +
",yem_claimdetail.yem_salcontractamt,yem_claimdetail.yem_orderrefundamt,yem_claimdetail.yem_shiprefundamt,yem_claimdetail.yem_periodrefundamt,yem_claimdetail.yem_shipamt"
, new QFilter[]{new QFilter("id", QCP.equals, parentModel.getValue("id"))});
DynamicObjectCollection dynamicObjectCollection = loadSingle.getDynamicObjectCollection("yem_receiptdetail");
for (DynamicObject dynamicObjec : dynamicObjectCollection) {
DynamicObjectCollection yemClaimdetail = dynamicObjec.getDynamicObjectCollection("yem_claimdetail");
for (int s = 0; s < yemClaimdetail.size(); s++) {
DynamicObject dynamicObject1 = yemClaimdetail.get(s);
dynamicObject1.set("yem_salcontractamt",amount);
dynamicObject1.set("yem_orderrefundamt",orderrefundamt);
dynamicObject1.set("yem_shiprefundamt",shiprefundamt);
dynamicObject1.set("yem_periodrefundamt",periodrefundamt);
dynamicObject1.set("yem_shipamt", amount);
}
}
SaveServiceHelper.update(loadSingle);
} }
} }