合同类型控制字段
This commit is contained in:
parent
73cd665b75
commit
fb127cd05c
|
@ -70,8 +70,8 @@ public class EcInFinalsettleJusCustPlugin extends AbstractBillPlugIn implements
|
||||||
Date zcgjEnddate = contractInfo.getDate("zcgj_enddate");
|
Date zcgjEnddate = contractInfo.getDate("zcgj_enddate");
|
||||||
Date nowdate = new Date();
|
Date nowdate = new Date();
|
||||||
int timeDays = PluginUtils.getTimeDays(zcgjEnddate, nowdate);
|
int timeDays = PluginUtils.getTimeDays(zcgjEnddate, nowdate);
|
||||||
// int endDays = Integer.parseInt(System.getProperty("endDays"));
|
int endDays = Integer.parseInt(System.getProperty("contract.enddays"));
|
||||||
int endDays = 100;
|
// int endDays = 100;
|
||||||
if (timeDays-endDays<=0){
|
if (timeDays-endDays<=0){
|
||||||
this.getView().showTipNotification("当前选择合同距离到期不足"+endDays+"天!");
|
this.getView().showTipNotification("当前选择合同距离到期不足"+endDays+"天!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import kd.bos.entity.datamodel.events.ChangeData;
|
||||||
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
|
||||||
import kd.bos.form.field.ComboEdit;
|
import kd.bos.form.field.ComboEdit;
|
||||||
import kd.bos.form.field.ComboItem;
|
import kd.bos.form.field.ComboItem;
|
||||||
|
import kd.bos.form.field.FieldEdit;
|
||||||
import kd.bos.orm.ORM;
|
import kd.bos.orm.ORM;
|
||||||
import kd.bos.orm.query.QFilter;
|
import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
@ -31,21 +32,55 @@ public class OutContractFromPlugin extends AbstractBillPlugIn implements Plugin
|
||||||
public void propertyChanged(PropertyChangedArgs e) {
|
public void propertyChanged(PropertyChangedArgs e) {
|
||||||
super.propertyChanged(e);
|
super.propertyChanged(e);
|
||||||
String changeName = e.getProperty().getName();
|
String changeName = e.getProperty().getName();
|
||||||
|
ChangeData changeData = e.getChangeSet()[0];
|
||||||
if (changeName.equals(contracttype)) {//收入合同字段值改变
|
if (changeName.equals(contracttype)) {//收入合同字段值改变
|
||||||
ChangeData changeData = e.getChangeSet()[0];
|
|
||||||
DynamicObject contractType = (DynamicObject)changeData.getNewValue();
|
DynamicObject contractType = (DynamicObject)changeData.getNewValue();
|
||||||
String number = contractType.getString("number");
|
String number = contractType.getString("number");
|
||||||
List<ComboItem> comboList = new ArrayList<>();
|
List<ComboItem> comboList = new ArrayList<>();
|
||||||
|
List<ComboItem> comboList1 = new ArrayList<>();
|
||||||
if(number.equals("sbzl")){
|
if(number.equals("sbzl")){
|
||||||
comboList.add(new ComboItem(new LocaleString("全部租赁"), "C"));
|
comboList.add(new ComboItem(new LocaleString("全部租赁"), "C"));
|
||||||
comboList.add(new ComboItem(new LocaleString("部分租赁"), "D"));
|
comboList.add(new ComboItem(new LocaleString("部分租赁"), "D"));
|
||||||
comboList.add(new ComboItem(new LocaleString("零星租赁"), "F"));
|
comboList.add(new ComboItem(new LocaleString("零星租赁"), "F"));
|
||||||
}else{
|
} else if (number.equals("ZCHLX02")) {
|
||||||
|
comboList1.add(new ComboItem(new LocaleString("固定单价"), "gddj"));
|
||||||
|
comboList1.add(new ComboItem(new LocaleString("不定量不定价"), "bdlbdj"));
|
||||||
|
Object pricetype = this.getModel().getValue("zcgj_pricetype");
|
||||||
|
if (pricetype!=null){
|
||||||
|
if (pricetype.toString().equals("bdlbdj")){
|
||||||
|
this.getModel().setValue("isonlist",true);
|
||||||
|
this.getView().setEnable(false,"isonlist");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else{
|
||||||
|
comboList1.add(new ComboItem(new LocaleString("固定单价"), "gddj"));
|
||||||
|
comboList1.add(new ComboItem(new LocaleString("不定量不定价"), "bdlbdj"));
|
||||||
|
comboList1.add(new ComboItem(new LocaleString("总价包干"), "zjbg"));
|
||||||
comboList.add(new ComboItem(new LocaleString("全面合作"), "A"));
|
comboList.add(new ComboItem(new LocaleString("全面合作"), "A"));
|
||||||
comboList.add(new ComboItem(new LocaleString("局部合作"), "B"));
|
comboList.add(new ComboItem(new LocaleString("局部合作"), "B"));
|
||||||
}
|
}
|
||||||
ComboEdit comboEdit = getView().getControl("zcgj_cooperatemode");
|
ComboEdit comboEdit = getView().getControl("zcgj_cooperatemode");
|
||||||
comboEdit.setComboItems(comboList);
|
comboEdit.setComboItems(comboList);
|
||||||
|
ComboEdit comboEdit1 = getView().getControl("zcgj_pricetype");
|
||||||
|
comboEdit1.setComboItems(comboList1);
|
||||||
|
} else if (changeName.equals("zcgj_pricetype")) {
|
||||||
|
Object newValue = changeData.getNewValue();
|
||||||
|
if (newValue!=null){
|
||||||
|
if (newValue.toString().equals("gddj")){
|
||||||
|
//设置必填
|
||||||
|
((FieldEdit)this.getControl("treeprice")).setMustInput(true);
|
||||||
|
}else {
|
||||||
|
((FieldEdit)this.getControl("treeprice")).setMustInput(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Object value = this.getModel().getValue(contracttype);
|
||||||
|
if (value!=null){
|
||||||
|
DynamicObject contractType = (DynamicObject)value;
|
||||||
|
if (contractType.getString("number").equals("ZCHLX02")){
|
||||||
|
this.getModel().setValue("isonlist",true);
|
||||||
|
this.getView().setEnable(false,"isonlist");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,7 @@ import kd.bos.list.plugin.AbstractListPlugin;
|
||||||
import kd.bos.orm.query.QCP;
|
import kd.bos.orm.query.QCP;
|
||||||
import kd.bos.orm.query.QFilter;
|
import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import org.stringtemplate.v4.ST;
|
||||||
|
|
||||||
import java.util.EventObject;
|
import java.util.EventObject;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -24,28 +25,32 @@ import java.util.Map;
|
||||||
|
|
||||||
public class QueryInstancesFromPlugin extends AbstractFormPlugin implements CellClickListener {
|
public class QueryInstancesFromPlugin extends AbstractFormPlugin implements CellClickListener {
|
||||||
|
|
||||||
|
String Qtype = "";
|
||||||
@Override
|
@Override
|
||||||
public void afterCreateNewData(EventObject e) {
|
public void afterCreateNewData(EventObject e) {
|
||||||
super.afterCreateNewData(e);
|
super.afterCreateNewData(e);
|
||||||
Map<String, Object> customParams = this.getView().getFormShowParameter().getCustomParams();
|
Map<String, Object> customParams = this.getView().getFormShowParameter().getCustomParams();
|
||||||
Object list = customParams.get("list");
|
Object list = customParams.get("list");
|
||||||
if (list!=null){
|
if (list != null) {
|
||||||
JSONArray jsonArray = JSONArray.parseArray(list.toString());
|
JSONArray jsonArray = JSONArray.parseArray(list.toString());
|
||||||
DynamicObjectCollection entrys = (DynamicObjectCollection)getModel().getValue("zcgj_entryentity");
|
DynamicObjectCollection entrys = (DynamicObjectCollection) getModel().getValue("zcgj_entryentity");
|
||||||
entrys.remove(0);
|
entrys.remove(0);
|
||||||
for (int i = 0; i < jsonArray.size(); i++) {
|
for (int i = 0; i < jsonArray.size(); i++) {
|
||||||
|
|
||||||
DynamicObjectType type = entrys.getDynamicObjectType();
|
DynamicObjectType type = entrys.getDynamicObjectType();
|
||||||
DynamicObject entry = new DynamicObject(type);
|
DynamicObject entry = new DynamicObject(type);
|
||||||
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
JSONObject jsonObject = jsonArray.getJSONObject(i);
|
||||||
entry.set("zcgj_billno",jsonObject.getString("zcgj_billno"));
|
entry.set("zcgj_billno", jsonObject.getString("zcgj_billno"));
|
||||||
entry.set("zcgj_billname",jsonObject.getString("zcgj_billname"));
|
entry.set("zcgj_billname", jsonObject.getString("zcgj_billname"));
|
||||||
entry.set("zcgj_renewalnum",jsonObject.getString("zcgj_renewalnum"));
|
entry.set("zcgj_renewalnum", jsonObject.getString("zcgj_renewalnum"));
|
||||||
entry.set("zcgj_renewalname",jsonObject.getString("zcgj_renewalname"));
|
entry.set("zcgj_renewalname", jsonObject.getString("zcgj_renewalname"));
|
||||||
|
entry.set("zcgj_type", jsonObject.getString("type"));
|
||||||
entrys.add(entry);
|
entrys.add(entry);
|
||||||
this.getModel().setValue("zcgj_billno",jsonObject.getString("zcgj_billno"),i);
|
this.getModel().setValue("zcgj_billno", jsonObject.getString("zcgj_billno"), i);
|
||||||
this.getModel().setValue("zcgj_billname",jsonObject.getString("zcgj_billname"),i);
|
this.getModel().setValue("zcgj_billname", jsonObject.getString("zcgj_billname"), i);
|
||||||
this.getModel().setValue("zcgj_renewalnum",jsonObject.getString("zcgj_renewalnum"),i);
|
this.getModel().setValue("zcgj_renewalnum", jsonObject.getString("zcgj_renewalnum"), i);
|
||||||
this.getModel().setValue("zcgj_renewalname",jsonObject.getString("zcgj_renewalname"),i);
|
this.getModel().setValue("zcgj_renewalname", jsonObject.getString("zcgj_renewalname"), i);
|
||||||
|
this.getModel().setValue("zcgj_type", jsonObject.getString("type"), i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,37 +58,36 @@ public class QueryInstancesFromPlugin extends AbstractFormPlugin implements Cell
|
||||||
|
|
||||||
public void registerListener(EventObject e) {
|
public void registerListener(EventObject e) {
|
||||||
super.registerListener(e);
|
super.registerListener(e);
|
||||||
EntryGrid control = (EntryGrid)getView().getControl("zcgj_entryentity");
|
EntryGrid control = (EntryGrid) getView().getControl("zcgj_entryentity");
|
||||||
control.addCellClickListener(this);
|
control.addCellClickListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cellClick(CellClickEvent cellClickEvent) {
|
public void cellClick(CellClickEvent cellClickEvent) {
|
||||||
String fieldKey = cellClickEvent.getFieldKey();
|
String fieldKey = cellClickEvent.getFieldKey();
|
||||||
|
DynamicObject contract = new DynamicObject();//收入/支出
|
||||||
|
// String type = "";
|
||||||
if (!fieldKey.equals("0")) {
|
if (!fieldKey.equals("0")) {
|
||||||
int row = cellClickEvent.getRow();
|
int row = cellClickEvent.getRow();
|
||||||
if (fieldKey.equals("zcgj_billno")){
|
Object number = getModel().getValue("zcgj_billno", row);
|
||||||
Object number = getModel().getValue("zcgj_billno", row);
|
Object type = getModel().getValue("zcgj_type", row);
|
||||||
if (number!=null){
|
if (number != null) {
|
||||||
DynamicObject contract = BusinessDataServiceHelper.loadSingle("ec_in_contract", "id,billno,zcgj_renewal,zcgj_isrenewal", new QFilter[]{new QFilter("billno", QCP.equals, number.toString())});
|
contract = BusinessDataServiceHelper.loadSingle(type.toString(), "id,billno,zcgj_renewal,zcgj_isrenewal", new QFilter[]{new QFilter("billno", QCP.equals, number.toString())});
|
||||||
BillShowParameter formShowParameter = new BillShowParameter();
|
if (contract != null) {
|
||||||
formShowParameter.setFormId("ec_in_contract");
|
// Qtype = "ec_in_contract";
|
||||||
formShowParameter.setPkId(contract.getLong("id"));
|
// } else {
|
||||||
formShowParameter.getOpenStyle().setShowType(ShowType.Modal);
|
// contract = BusinessDataServiceHelper.loadSingle("ec_out_contract", "id,billno,zcgj_renewal,zcgj_isrenewal", new QFilter[]{new QFilter("billno", QCP.equals, number.toString())});
|
||||||
getView().showForm(formShowParameter);
|
// type = "ec_out_contract";
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
} else if (fieldKey.equals("zcgj_renewalnum")) {
|
if (fieldKey.equals("zcgj_billno") || fieldKey.equals("zcgj_renewalnum")) {
|
||||||
Object number = getModel().getValue("zcgj_renewalnum", row);
|
|
||||||
if (number!=null){
|
|
||||||
DynamicObject contract = BusinessDataServiceHelper.loadSingle("ec_in_contract", "id,billno,zcgj_renewal,zcgj_isrenewal", new QFilter[]{new QFilter("billno", QCP.equals, number.toString())});
|
|
||||||
BillShowParameter formShowParameter = new BillShowParameter();
|
BillShowParameter formShowParameter = new BillShowParameter();
|
||||||
formShowParameter.setFormId("ec_in_contract");
|
formShowParameter.setFormId(type.toString());
|
||||||
formShowParameter.setPkId(contract.getLong("id"));
|
formShowParameter.setPkId(contract.getLong("id"));
|
||||||
formShowParameter.getOpenStyle().setShowType(ShowType.Modal);
|
formShowParameter.getOpenStyle().setShowType(ShowType.Modal);
|
||||||
getView().showForm(formShowParameter);
|
getView().showForm(formShowParameter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,8 @@ import kd.bos.form.FormShowParameter;
|
||||||
import kd.bos.form.ShowType;
|
import kd.bos.form.ShowType;
|
||||||
import kd.bos.form.control.events.BeforeItemClickEvent;
|
import kd.bos.form.control.events.BeforeItemClickEvent;
|
||||||
import kd.bos.form.control.events.ItemClickEvent;
|
import kd.bos.form.control.events.ItemClickEvent;
|
||||||
|
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
||||||
|
import kd.bos.form.operate.FormOperate;
|
||||||
import kd.bos.list.plugin.AbstractListPlugin;
|
import kd.bos.list.plugin.AbstractListPlugin;
|
||||||
import kd.bos.mvc.bill.BillModel;
|
import kd.bos.mvc.bill.BillModel;
|
||||||
import kd.bos.orm.query.QCP;
|
import kd.bos.orm.query.QCP;
|
||||||
|
@ -26,18 +28,23 @@ public class RenewalContractBillPlugin extends AbstractListPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterCopyData(EventObject e) {
|
public void afterCopyData(EventObject e) {
|
||||||
BillModel billModel = (BillModel) e.getSource();
|
|
||||||
Object billno = billModel.getValue("billno");
|
//获取列表父界面缓存信息
|
||||||
DynamicObject contract = BusinessDataServiceHelper.loadSingle("ec_in_contract", "id,billno,billname,zcgj_renewal,zcgj_isrenewal", new QFilter[]{new QFilter("billno", QCP.equals, billno)});
|
Object srcBillNo2 = this.getView().getParentView().getPageCache().get("srcBillNo");
|
||||||
super.afterCopyData(e);
|
if(srcBillNo2!=null){
|
||||||
this.getModel().setValue("id", null);//id
|
// this.getView().showMessage("源单编号:"+srcBillNo2);
|
||||||
|
// BillModel billModel = (BillModel) e.getSource();
|
||||||
|
DynamicObject contract = BusinessDataServiceHelper.loadSingle("ec_out_contract", "id,billno,billname,zcgj_renewal,zcgj_isrenewal", new QFilter[]{new QFilter("billno", QCP.equals, srcBillNo2.toString())});
|
||||||
|
this.getModel().setValue("id", null);//id
|
||||||
this.getModel().setValue("billno", null);//合同编码
|
this.getModel().setValue("billno", null);//合同编码
|
||||||
this.getModel().setValue("billname", contract.getString("billname")+"-续签");//合同名称
|
this.getModel().setValue("billname", contract.getString("billname")+"-续签");//合同名称
|
||||||
this.getModel().setValue("zcgj_startdate", null);//起始日期
|
this.getModel().setValue("zcgj_startdate", null);//起始日期
|
||||||
this.getModel().setValue("zcgj_enddate", null);//终止日期
|
this.getModel().setValue("zcgj_enddate", null);//终止日期
|
||||||
// DynamicObject contract = BusinessDataServiceHelper.loadSingle("ec_in_contract", "id,billno,zcgj_renewal", new QFilter[]{new QFilter("billno", QCP.equals, billno)});
|
// DynamicObject contract = BusinessDataServiceHelper.loadSingle("ec_out_contract", "id,billno,zcgj_renewal", new QFilter[]{new QFilter("billno", QCP.equals, billno)});
|
||||||
this.getModel().setValue("zcgj_renewal", contract);//续签主合同
|
this.getModel().setValue("zcgj_renewal", contract);//续签主合同
|
||||||
this.getModel().setValue("zcgj_isrenewal", true);//是否续签
|
this.getModel().setValue("zcgj_isrenewal", true);//是否续签
|
||||||
|
this.getView().getParentView().getPageCache().remove("srcBillNo");//读取后清理缓存
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,6 +80,7 @@ public class RenewalContractBillPlugin extends AbstractListPlugin {
|
||||||
DynamicObject[] recontracts = BusinessDataServiceHelper.load("ec_in_contract", "id,billno,billname,zcgj_renewal", new QFilter[]{qf});
|
DynamicObject[] recontracts = BusinessDataServiceHelper.load("ec_in_contract", "id,billno,billname,zcgj_renewal", new QFilter[]{qf});
|
||||||
for (DynamicObject recontract : recontracts) {
|
for (DynamicObject recontract : recontracts) {
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("type","ec_in_contract");
|
||||||
jsonObject.put("zcgj_billno",billno);
|
jsonObject.put("zcgj_billno",billno);
|
||||||
jsonObject.put("zcgj_billname",receiveApplication.getString("billname"));
|
jsonObject.put("zcgj_billname",receiveApplication.getString("billname"));
|
||||||
jsonObject.put("zcgj_renewalnum",recontract.getString("billno"));
|
jsonObject.put("zcgj_renewalnum",recontract.getString("billno"));
|
||||||
|
@ -141,4 +149,17 @@ public class RenewalContractBillPlugin extends AbstractListPlugin {
|
||||||
}
|
}
|
||||||
return setIds;
|
return setIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
||||||
|
super.beforeDoOperation(args);
|
||||||
|
FormOperate operate = (FormOperate) args.getSource();
|
||||||
|
String operateNo = operate.getOperateKey();
|
||||||
|
if(operateNo.equalsIgnoreCase("copy")){
|
||||||
|
ListSelectedRowCollection listSelectedData = args.getListSelectedData();
|
||||||
|
String srcBillNo = listSelectedData.get(0).getBillNo();
|
||||||
|
this.getView().getPageCache().put("srcBillNo",srcBillNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,166 @@
|
||||||
|
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.greenpineyu.fel.common.NumberUtil;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.entity.datamodel.ListSelectedRow;
|
||||||
|
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
||||||
|
import kd.bos.form.CloseCallBack;
|
||||||
|
import kd.bos.form.FormShowParameter;
|
||||||
|
import kd.bos.form.ShowType;
|
||||||
|
import kd.bos.form.control.events.BeforeItemClickEvent;
|
||||||
|
import kd.bos.form.control.events.ItemClickEvent;
|
||||||
|
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
||||||
|
import kd.bos.form.operate.FormOperate;
|
||||||
|
import kd.bos.list.plugin.AbstractListPlugin;
|
||||||
|
import kd.bos.mvc.bill.BillModel;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.util.EventObject;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class RenewalOutContractBillPlugin extends AbstractListPlugin {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterCopyData(EventObject e) {
|
||||||
|
super.afterCopyData(e);
|
||||||
|
//获取列表父界面缓存信息
|
||||||
|
Object srcBillNo2 = this.getView().getParentView().getPageCache().get("srcBillNo");
|
||||||
|
if(srcBillNo2!=null){
|
||||||
|
// this.getView().showMessage("源单编号:"+srcBillNo2);
|
||||||
|
// BillModel billModel = (BillModel) e.getSource();
|
||||||
|
DynamicObject contract = BusinessDataServiceHelper.loadSingle("ec_out_contract", "id,billno,billname,zcgj_renewal,zcgj_isrenewal", new QFilter[]{new QFilter("billno", QCP.equals, srcBillNo2.toString())});
|
||||||
|
this.getModel().setValue("id", null);//id
|
||||||
|
// this.getModel().setValue("billno", null);//合同编码
|
||||||
|
this.getModel().setValue("billname", contract.getString("billname")+"-续签");//合同名称
|
||||||
|
this.getModel().setValue("zcgj_startdate", null);//起始日期
|
||||||
|
this.getModel().setValue("zcgj_enddate", null);//终止日期
|
||||||
|
// DynamicObject contract = BusinessDataServiceHelper.loadSingle("ec_out_contract", "id,billno,zcgj_renewal", new QFilter[]{new QFilter("billno", QCP.equals, billno)});
|
||||||
|
this.getModel().setValue("zcgj_renewal", contract);//续签主合同
|
||||||
|
this.getModel().setValue("zcgj_isrenewal", true);//是否续签
|
||||||
|
this.getView().getParentView().getPageCache().remove("srcBillNo");//读取后清理缓存
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerListener(EventObject e) {
|
||||||
|
super.registerListener(e);
|
||||||
|
// 工具栏注册监听(注意这里是把整个工具栏注册监听,工具栏项是没有运行时控件模型的)
|
||||||
|
this.addItemClickListeners("tbmain");//监听按钮
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void itemClick(ItemClickEvent evt) {
|
||||||
|
String itemKey = evt.getItemKey();
|
||||||
|
// List<String> objects = new ArrayList<>();
|
||||||
|
JSONArray jsonArray = new JSONArray();
|
||||||
|
// Map<Long,String> map = new HashMap<>();
|
||||||
|
if (itemKey.equals("zcgj_queryinstances")) {
|
||||||
|
Set<Long> setIds = getSelectOrderIds(this.getSelectedRows());
|
||||||
|
if (setIds.size() == 0) {
|
||||||
|
this.getView().showTipNotification("请选择要执行的数据。");
|
||||||
|
return;
|
||||||
|
} else if (setIds.size() > 1) {
|
||||||
|
this.getView().showTipNotification("只能选择一条数据查看!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DynamicObject[] receiveApplications = BusinessDataServiceHelper.load("ec_out_contract", "billno,billname,zcgj_renewal,zcgj_isrenewal", new QFilter[]{new QFilter("id", "in", setIds)});
|
||||||
|
DynamicObject receiveApplication = receiveApplications[0];
|
||||||
|
String billno = receiveApplication.getString("billno");
|
||||||
|
|
||||||
|
QFilter qf = new QFilter("zcgj_renewal.billno", QCP.equals,billno);
|
||||||
|
DynamicObject[] recontracts = BusinessDataServiceHelper.load("ec_out_contract", "id,billno,billname,zcgj_renewal", new QFilter[]{qf});
|
||||||
|
for (DynamicObject recontract : recontracts) {
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
System.out.println();
|
||||||
|
jsonObject.put("type","ec_out_contract");
|
||||||
|
jsonObject.put("zcgj_billno",billno);
|
||||||
|
jsonObject.put("zcgj_billname",receiveApplication.getString("billname"));
|
||||||
|
jsonObject.put("zcgj_renewalnum",recontract.getString("billno"));
|
||||||
|
jsonObject.put("zcgj_renewalname",recontract.getString("billname"));
|
||||||
|
// objects.add( ));
|
||||||
|
// map.put(recontract.getLong("id"),recontract.getString("billno"));
|
||||||
|
jsonArray.add(jsonObject);
|
||||||
|
}
|
||||||
|
if (jsonArray.size()<1){
|
||||||
|
this.getView().showTipNotification("该合同暂无续签合同!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 如果是弹出动态表单工具栏项被点击,则打开指定的动态表单
|
||||||
|
if ("zcgj_queryinstances".equalsIgnoreCase(itemKey)) {
|
||||||
|
FormShowParameter formShowParameter = new FormShowParameter();
|
||||||
|
// 弹窗案例-动态表单 页面标识
|
||||||
|
formShowParameter.setFormId("zcgj_ec_renewal");
|
||||||
|
// 自定义传参,把当前单据的文本字段传过去
|
||||||
|
formShowParameter.setCustomParam("list", jsonArray.toJSONString());
|
||||||
|
// 设置回调事件,回调插件为当前插件,标识为zcgj_
|
||||||
|
formShowParameter.setCloseCallBack(new CloseCallBack(this, "zcgj_queryinstances"));
|
||||||
|
// 设置打开类型为模态框(不设置的话指令参数缺失,没办法打开页面)
|
||||||
|
formShowParameter.getOpenStyle().setShowType(ShowType.Modal);
|
||||||
|
// 当前页面发送showform指令。注意也可以从其他页面发送指令,后续有文章介绍
|
||||||
|
this.getView().showForm(formShowParameter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
super.itemClick(evt);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeItemClick(BeforeItemClickEvent evt) {
|
||||||
|
super.beforeItemClick(evt);
|
||||||
|
String itemKey = evt.getItemKey();
|
||||||
|
if (itemKey.equals("zcgj_inrenewal")) {
|
||||||
|
Set<Long> setIds = getSelectOrderIds(this.getSelectedRows());
|
||||||
|
if (setIds.size() == 0) {
|
||||||
|
this.getView().showTipNotification("请选择要执行的数据。");
|
||||||
|
return;
|
||||||
|
} else if (setIds.size() > 1) {
|
||||||
|
this.getView().showTipNotification("只能选择一条数据查看!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
DynamicObject[] receiveApplications = BusinessDataServiceHelper.load("ec_out_contract", "billno,zcgj_renewal,zcgj_isrenewal,contstatus", new QFilter[]{new QFilter("id", "in", setIds)});
|
||||||
|
DynamicObject receiveApplication = receiveApplications[0];
|
||||||
|
boolean isrenewal = receiveApplication.getBoolean("zcgj_isrenewal");
|
||||||
|
if (isrenewal){
|
||||||
|
this.getView().showTipNotification("续签合同不能进行续签!");
|
||||||
|
evt.setCancel(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String contstatus = receiveApplication.getString("contstatus");
|
||||||
|
if (!contstatus.equals("01")){
|
||||||
|
this.getView().showTipNotification("收入合同需执行中才可进行续签!");
|
||||||
|
evt.setCancel(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
private Set<Long> getSelectOrderIds(@NotNull ListSelectedRowCollection selectedRows) {
|
||||||
|
Set<Long> setIds = new HashSet<>();
|
||||||
|
for (ListSelectedRow selectedRow : selectedRows) {
|
||||||
|
setIds.add(NumberUtil.toLong(selectedRow.getPrimaryKeyValue()));
|
||||||
|
}
|
||||||
|
return setIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
||||||
|
super.beforeDoOperation(args);
|
||||||
|
FormOperate operate = (FormOperate) args.getSource();
|
||||||
|
String operateNo = operate.getOperateKey();
|
||||||
|
if(operateNo.equalsIgnoreCase("copy")){
|
||||||
|
ListSelectedRowCollection listSelectedData = args.getListSelectedData();
|
||||||
|
String srcBillNo = listSelectedData.get(0).getBillNo();
|
||||||
|
this.getView().getPageCache().put("srcBillNo",srcBillNo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue