【物料变更】详情界面复制报错问题修复

This commit is contained in:
tanfengling@x-ri.com 2025-12-01 18:51:41 +08:00
parent 14c9c3f36a
commit ef705ef8ef
2 changed files with 13 additions and 8 deletions

View File

@ -297,26 +297,30 @@ public class MaterialBillPlugin extends AbstractBillPlugIn {
} }
if("copyandchange".equals(operateKey)) { if("copyandchange".equals(operateKey)) {
super.beforeDoOperation(args); super.beforeDoOperation(args);
this.getPageCache().put("copyMatId", this.getModel().getValue("id").toString());
FormOperate operate = (FormOperate) args.getSource(); FormOperate operate = (FormOperate) args.getSource();
String operateNo = operate.getOperateKey(); String operateNo = operate.getOperateKey();
if(operateNo.equalsIgnoreCase("copy")){ if(operateNo.equalsIgnoreCase("copyandchange")){
DynamicObject bill = this.getModel().getDataEntity(); DynamicObject bill = this.getModel().getDataEntity();
this.getView().getFormShowParameter().setCustomParam("copySrcBillName", bill.getString("name")); this.getView().getFormShowParameter().setCustomParam("copySrcBillName", bill.getString("name"));
this.getView().getFormShowParameter().setCustomParam("copySrcBillNumber", bill.getString("number")); this.getView().getFormShowParameter().setCustomParam("copySrcBillNumber", bill.getString("number"));
this.getView().getFormShowParameter().setCustomParam("operateKey", "copyandchange");
} }
} }
} }
@Override @Override
public void afterCopyData(EventObject e) { public void afterCopyData(EventObject e) {
super.afterCopyData(e); super.afterCopyData(e);
String copySrcBillName = this.getView().getFormShowParameter().getCustomParam("copySrcBillName"); String operateKey = this.getView().getFormShowParameter().getCustomParam("operateKey");
String copySrcBillNumber = this.getView().getFormShowParameter().getCustomParam("copySrcBillNumber"); if("copyandchange".equals(operateKey)){
DynamicObject dataEntity = this.getModel().getDataEntity(true); String copySrcBillName = this.getView().getFormShowParameter().getCustomParam("copySrcBillName");
dataEntity.set("name", copySrcBillName + "_copy"); String copySrcBillNumber = this.getView().getFormShowParameter().getCustomParam("copySrcBillNumber");
dataEntity.set("tqq9_srcnumber", copySrcBillNumber); DynamicObject dataEntity = this.getModel().getDataEntity(true);
this.getView().invokeOperation("save"); dataEntity.set("name", copySrcBillName + "_copy");
dataEntity.set("tqq9_srcnumber", copySrcBillNumber);
this.getView().invokeOperation("save");
}
} }
public void afterDoOperation(AfterDoOperationEventArgs evt) { public void afterDoOperation(AfterDoOperationEventArgs evt) {

View File

@ -229,6 +229,7 @@ public class MaterialListPlugin extends AbstractListPlugin implements Plugin {
BillShowParameter parameter = e.getParameter(); BillShowParameter parameter = e.getParameter();
parameter.setCustomParam("copySrcBillName",bd_material.getString("name")); parameter.setCustomParam("copySrcBillName",bd_material.getString("name"));
parameter.setCustomParam("copySrcBillNumber",bd_material.getString("number")); parameter.setCustomParam("copySrcBillNumber",bd_material.getString("number"));
this.getView().getFormShowParameter().setCustomParam("operateKey", "copyandchange");
} }
} }