Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
93bde50a7c
|
@ -11,6 +11,7 @@ import java.util.HashMap;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import kd.bos.bill.AbstractBillPlugIn;
|
||||
import kd.bos.bill.OperationStatus;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
|
@ -33,7 +34,7 @@ import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|||
import kd.ec.basedata.common.utils.OpenPageUtils;
|
||||
|
||||
/**
|
||||
* 出库单:领料出库与领料申请关联逻辑
|
||||
* 出库单:领料出库与领料申请关联逻辑和使用设备赋值逻辑
|
||||
*/
|
||||
public class MaterialOutApplyPluginExt extends AbstractBillPlugIn implements BeforeF7SelectListener {
|
||||
private static final String APPLYBILL = "applybill";
|
||||
|
@ -45,7 +46,7 @@ public class MaterialOutApplyPluginExt extends AbstractBillPlugIn implements Bef
|
|||
|
||||
public void registerListener(EventObject e) {
|
||||
super.registerListener(e);
|
||||
BasedataEdit basedataEdit = (BasedataEdit)this.getControl("applybill");
|
||||
BasedataEdit basedataEdit = (BasedataEdit) this.getControl("applybill");
|
||||
basedataEdit.addBeforeF7SelectListener(this);
|
||||
basedataEdit.addBeforeF7ViewDetailListener((beforeF7ViewDetailEvent) -> {
|
||||
beforeF7ViewDetailEvent.setCancel(true);
|
||||
|
@ -63,9 +64,9 @@ public class MaterialOutApplyPluginExt extends AbstractBillPlugIn implements Bef
|
|||
|
||||
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
||||
super.beforeDoOperation(args);
|
||||
FormOperate operate = (FormOperate)args.getSource();
|
||||
FormOperate operate = (FormOperate) args.getSource();
|
||||
String operateKey = operate.getOperateKey();
|
||||
DynamicObject applyBill = (DynamicObject)this.getModel().getValue("applybill");
|
||||
DynamicObject applyBill = (DynamicObject) this.getModel().getValue("applybill");
|
||||
if (StringUtils.equals("addnewentry", operateKey)) {
|
||||
if (applyBill != null) {
|
||||
this.openApplyEntryForm();
|
||||
|
@ -77,8 +78,8 @@ public class MaterialOutApplyPluginExt extends AbstractBillPlugIn implements Bef
|
|||
}
|
||||
|
||||
protected void beforeApplyBillSelect(BeforeF7SelectEvent arg0) {
|
||||
DynamicObject project = (DynamicObject)this.getModel().getValue("project");
|
||||
DynamicObject warehouse = (DynamicObject)this.getModel().getValue("warehouse");
|
||||
DynamicObject project = (DynamicObject) this.getModel().getValue("project");
|
||||
DynamicObject warehouse = (DynamicObject) this.getModel().getValue("warehouse");
|
||||
if (warehouse == null) {
|
||||
this.getView().showTipNotification(ResManager.loadKDString("请先选中仓库。", "MaterialOutApplyPlugin_1", "ec-ecma-formplugin", new Object[0]), 3000);
|
||||
arg0.setCancel(true);
|
||||
|
@ -103,12 +104,24 @@ public class MaterialOutApplyPluginExt extends AbstractBillPlugIn implements Bef
|
|||
ChangeData changeData = e.getChangeSet()[0];
|
||||
if (StringUtils.equals(name, "applybill")) {
|
||||
this.applyBillChanged(changeData);
|
||||
} else if (StringUtils.equals(name, "material")) {
|
||||
//资源编码
|
||||
DynamicObject material = (DynamicObject) changeData.getNewValue();
|
||||
int rowIndex = changeData.getRowIndex(); //修改行所在行行号
|
||||
DynamicObject applybill = (DynamicObject) this.getModel().getValue("applybill");//领料申请单
|
||||
if (material != null && rowIndex > 0 && applybill == null) {
|
||||
DynamicObjectCollection entryEntityCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("entryentity");//出库单明细
|
||||
DynamicObject entryEntity = entryEntityCollection.get(0);
|
||||
DynamicObject zcgj_shebei = entryEntity.getDynamicObject("zcgj_shebei");//使用设备
|
||||
if (zcgj_shebei != null) {
|
||||
this.getModel().setValue("zcgj_shebei", zcgj_shebei, rowIndex);//使用设备
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void applyBillChanged(ChangeData changeData) {
|
||||
DynamicObject newValue = (DynamicObject)changeData.getNewValue();
|
||||
DynamicObject newValue = (DynamicObject) changeData.getNewValue();
|
||||
if (newValue != null) {
|
||||
newValue = BusinessDataServiceHelper.loadSingle(newValue.getPkValue(), "ecma_materialapplybill");
|
||||
this.carryHeadData(newValue);
|
||||
|
@ -128,8 +141,8 @@ public class MaterialOutApplyPluginExt extends AbstractBillPlugIn implements Bef
|
|||
if (applyEntries != null && !applyEntries.isEmpty()) {
|
||||
Iterator var4 = applyEntries.iterator();
|
||||
|
||||
while(var4.hasNext()) {
|
||||
DynamicObject applyEntry = (DynamicObject)var4.next();
|
||||
while (var4.hasNext()) {
|
||||
DynamicObject applyEntry = (DynamicObject) var4.next();
|
||||
BigDecimal restQty = applyEntry.getBigDecimal("restqty");
|
||||
if (restQty.compareTo(BigDecimal.ZERO) != 0) {
|
||||
DynamicObject newEntry = new DynamicObject(entries.getDynamicObjectType());
|
||||
|
@ -168,8 +181,8 @@ public class MaterialOutApplyPluginExt extends AbstractBillPlugIn implements Bef
|
|||
if (applyEntries != null && !applyEntries.isEmpty()) {
|
||||
Iterator var5 = applyEntries.iterator();
|
||||
|
||||
while(var5.hasNext()) {
|
||||
DynamicObject applyEntry = (DynamicObject)var5.next();
|
||||
while (var5.hasNext()) {
|
||||
DynamicObject applyEntry = (DynamicObject) var5.next();
|
||||
if (applyEntryIdList.contains(applyEntry.getPkValue())) {
|
||||
DynamicObject newEntry = new DynamicObject(entries.getDynamicObjectType());
|
||||
newEntry.set("applyentryid", applyEntry.getLong("id"));
|
||||
|
@ -259,13 +272,13 @@ public class MaterialOutApplyPluginExt extends AbstractBillPlugIn implements Bef
|
|||
}
|
||||
|
||||
private void openApplyEntryForm() {
|
||||
DynamicObject applyBill = (DynamicObject)this.getModel().getValue("applybill");//领料申请单
|
||||
DynamicObject applyBill = (DynamicObject) this.getModel().getValue("applybill");//领料申请单
|
||||
DynamicObjectCollection entries = this.getModel().getEntryEntity("entryentity");
|
||||
StringBuffer selectedEntryIdBuff = new StringBuffer();
|
||||
Iterator var4 = entries.iterator();
|
||||
|
||||
while(var4.hasNext()) {
|
||||
DynamicObject entry = (DynamicObject)var4.next();
|
||||
while (var4.hasNext()) {
|
||||
DynamicObject entry = (DynamicObject) var4.next();
|
||||
selectedEntryIdBuff.append(entry.get("applyentryid")).append(",");
|
||||
}
|
||||
|
||||
|
@ -284,10 +297,10 @@ public class MaterialOutApplyPluginExt extends AbstractBillPlugIn implements Bef
|
|||
public void closedCallBack(ClosedCallBackEvent closedCallBackEvent) {
|
||||
String actionID = closedCallBackEvent.getActionId();
|
||||
Object returnData = closedCallBackEvent.getReturnData();
|
||||
DynamicObject applyBill = (DynamicObject)this.getModel().getValue("applybill");
|
||||
DynamicObject applyBill = (DynamicObject) this.getModel().getValue("applybill");
|
||||
if (StringUtils.equals(actionID, "applyEntryCallback") && returnData != null) {
|
||||
Map<String, Object> data = (Map)returnData;
|
||||
List<Long> applyEntryIdList = (List)data.get("applyEntryIdList");
|
||||
Map<String, Object> data = (Map) returnData;
|
||||
List<Long> applyEntryIdList = (List) data.get("applyEntryIdList");
|
||||
if (applyBill != null) {
|
||||
DynamicObject applyBillData = BusinessDataServiceHelper.loadSingle(applyBill.getPkValue(), "ecma_materialapplybill");
|
||||
this.carryEntryDataFromReturnData(applyBillData, applyEntryIdList);
|
||||
|
|
|
@ -13,6 +13,7 @@ public class ContractPublicValidator extends AbstractValidator {
|
|||
@Override
|
||||
public void validate() {
|
||||
for (ExtendedDataEntity dataEntity : this.getDataEntities()) {
|
||||
if (dataEntity!=null){
|
||||
DynamicObject dynamicObject = dataEntity.getDataEntity();
|
||||
String zcgjPricetype = dynamicObject.getString("zcgj_pricetype");
|
||||
if (zcgjPricetype.equals("gddj")){
|
||||
|
@ -34,4 +35,5 @@ public class ContractPublicValidator extends AbstractValidator {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@ import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|||
import kd.bos.entity.operate.result.OperationResult;
|
||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
||||
import kd.bos.entity.plugin.args.BeginOperationTransactionArgs;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
|
@ -13,17 +15,25 @@ public class ContractSettleOp extends AbstractOperationServicePlugIn {
|
|||
|
||||
@Override
|
||||
public void onAddValidators(AddValidatorsEventArgs e) {
|
||||
System.out.println();
|
||||
super.onAddValidators(e);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beginOperationTransaction(BeginOperationTransactionArgs e) {
|
||||
super.beginOperationTransaction(e);
|
||||
DynamicObject[] dataEntities1 = e.getDataEntities();
|
||||
if(dataEntities1!=null && dataEntities1.length>0){
|
||||
DynamicObject object = dataEntities1[0];
|
||||
Object changetype = object.getString("changetype");
|
||||
DynamicObject ecoutrevision = BusinessDataServiceHelper.loadSingle("ec_outrevision", new QFilter[]{new QFilter("billno", "=", object.getString("billno"))});
|
||||
Object changetype = ecoutrevision.getString("changetype");
|
||||
if (changetype != null) {
|
||||
if (changetype.toString().equals("03")) {
|
||||
DynamicObject contract = object.getDynamicObject("contract");
|
||||
DynamicObject contract = ecoutrevision.getDynamicObject("contract");
|
||||
String billName = contract.getDataEntityType().getName();
|
||||
DynamicObject zcgjpartb = object.getDynamicObject("zcgj_partb");
|
||||
DynamicObjectCollection zcgjOtherpart = object.getDynamicObjectCollection("zcgj_otherpart");
|
||||
DynamicObject zcgjpartb = ecoutrevision.getDynamicObject("zcgj_partb");
|
||||
DynamicObjectCollection zcgjOtherpart = ecoutrevision.getDynamicObjectCollection("zcgj_otherpart");
|
||||
if (billName.equals("ec_out_contract_f7")) {
|
||||
QFilter f1 = new QFilter("number", "=", contract.getString("number"));
|
||||
DynamicObject outContractF7 = BusinessDataServiceHelper.loadSingle("ec_out_contract_f7", new QFilter[]{f1});
|
||||
|
@ -33,12 +43,24 @@ public class ContractSettleOp extends AbstractOperationServicePlugIn {
|
|||
QFilter f2 = new QFilter("billno", "=", contract.getString("number"));
|
||||
DynamicObject outContract = BusinessDataServiceHelper.loadSingle("ec_out_contract", new QFilter[]{f2});
|
||||
outContract.set("partb", zcgjpartb);
|
||||
if (zcgjOtherpart != null) {
|
||||
// DynamicObjectCollection otherpart = (DynamicObjectCollection) this.getModel().getValue("zcgj_otherpart");
|
||||
outContract.set("otherpart", zcgjOtherpart);
|
||||
if (zcgjOtherpart.size()>0) {
|
||||
// 深度克隆集合
|
||||
DynamicObjectCollection otherpart = outContract.getDynamicObjectCollection("otherpart");
|
||||
DynamicObjectCollection clone =(DynamicObjectCollection) otherpart.clone();
|
||||
clone.clear();
|
||||
for(DynamicObject item : zcgjOtherpart) {
|
||||
DynamicObject bd_supplier = new DynamicObject(otherpart.getDynamicObjectType());
|
||||
bd_supplier.set("fbasedataid",item.get(2));
|
||||
clone.add(bd_supplier);
|
||||
}
|
||||
|
||||
// 设置并标记修改
|
||||
outContract.set("otherpart", clone);
|
||||
// outContract.set("otherpart", true); // 关键!
|
||||
|
||||
outContract.set("ismulticontract", true);
|
||||
}
|
||||
OperationResult saveOperationResult1 = SaveServiceHelper.saveOperate("ec_out_contract", new DynamicObject[]{outContract}, null);//支出合同实体
|
||||
SaveServiceHelper.save(new DynamicObject[]{outContract});//支出合同实体
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue