优化代码

This commit is contained in:
xiaoshi 2024-12-17 17:12:21 +08:00
parent 050dcde6c8
commit 0612c52985
3 changed files with 102 additions and 101 deletions

View File

@ -77,9 +77,9 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin
} }
} }
@Override // @Override
public void propertyChanged(PropertyChangedArgs e) { // public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e); // super.propertyChanged(e);
// String name = e.getProperty().getName(); // String name = e.getProperty().getName();
// ChangeData changeData = e.getChangeSet()[0]; // ChangeData changeData = e.getChangeSet()[0];
// int rowIndex = changeData.getRowIndex(); // int rowIndex = changeData.getRowIndex();
@ -88,49 +88,49 @@ public class ContractEeasurementBillPlugin extends ContractMeasureBillEditPlugin
// BigDecimal currentprice = BigDecimal.ZERO;//当前单价 // BigDecimal currentprice = BigDecimal.ZERO;//当前单价
// BigDecimal qty = BigDecimal.ZERO;//数量 // BigDecimal qty = BigDecimal.ZERO;//数量
// BigDecimal taxrate = BigDecimal.ZERO;//税率 // BigDecimal taxrate = BigDecimal.ZERO;//税率
// if(name.equals("curtaxprice")||name.equals("currentprice")) { //// if(name.equals("curtaxprice")||name.equals("currentprice")) {
// if (parentRowIndex>=0&&rowIndex>=0){ //// if (parentRowIndex>=0&&rowIndex>=0){
// Object curtaxpriceobj = this.getModel().getValue("curtaxprice", rowIndex, parentRowIndex); //// Object curtaxpriceobj = this.getModel().getValue("curtaxprice", rowIndex, parentRowIndex);
// if (curtaxpriceobj != null) { //// if (curtaxpriceobj != null) {
// curtaxprice = (BigDecimal) curtaxpriceobj; //// curtaxprice = (BigDecimal) curtaxpriceobj;
// } //// }
// Object currentpriceobj = this.getModel().getValue("currentprice", rowIndex, parentRowIndex); //// Object currentpriceobj = this.getModel().getValue("currentprice", rowIndex, parentRowIndex);
// if (currentpriceobj != null) { //// if (currentpriceobj != null) {
// currentprice = (BigDecimal) currentpriceobj; //// currentprice = (BigDecimal) currentpriceobj;
// ; //// ;
// } //// }
// Object totalqtyibj = this.getModel().getValue("totalqty", rowIndex, parentRowIndex); //// Object totalqtyibj = this.getModel().getValue("totalqty", rowIndex, parentRowIndex);
// if (totalqtyibj != null) { //// if (totalqtyibj != null) {
// qty = (BigDecimal) totalqtyibj; //// qty = (BigDecimal) totalqtyibj;
// } //// }
// Object entrytaxrateobj = this.getModel().getValue("entrytaxrate", rowIndex, parentRowIndex); //// Object entrytaxrateobj = this.getModel().getValue("entrytaxrate", rowIndex, parentRowIndex);
// if (entrytaxrateobj != null) { //// if (entrytaxrateobj != null) {
// BigDecimal entrytaxrate = (BigDecimal) entrytaxrateobj; //// BigDecimal entrytaxrate = (BigDecimal) entrytaxrateobj;
// taxrate = entrytaxrate.divide(new BigDecimal(100)).add(new BigDecimal(1)); //// taxrate = entrytaxrate.divide(new BigDecimal(100)).add(new BigDecimal(1));
// } //// }
// if (name.equals("curtaxprice") && curtaxprice.compareTo(new BigDecimal(0))>0) { //// if (name.equals("curtaxprice") && curtaxprice.compareTo(new BigDecimal(0))>0) {
// BigDecimal divide = curtaxprice.divide(taxrate,6, RoundingMode.HALF_UP);//当前单价 //// BigDecimal divide = curtaxprice.divide(taxrate,6, RoundingMode.HALF_UP);//当前单价
// BigDecimal multiply = divide.multiply(qty);//当前金额 //// BigDecimal multiply = divide.multiply(qty);//当前金额
// BigDecimal multiply1 = curtaxprice.multiply(qty);//当前价税合计 //// BigDecimal multiply1 = curtaxprice.multiply(qty);//当前价税合计
// BigDecimal subtract = multiply1.subtract(multiply);//当前税额 //// BigDecimal subtract = multiply1.subtract(multiply);//当前税额
//// this.getModel().getDataEntity().set("currentprice",divide, rowIndex, parentRowIndex); ////// this.getModel().getDataEntity().set("currentprice",divide, rowIndex, parentRowIndex);
// this.getModel().setValue("currentprice",divide, rowIndex, parentRowIndex);//当前单价 //// this.getModel().setValue("currentprice",divide, rowIndex, parentRowIndex);//当前单价
// this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额 //// this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额
// this.getModel().setValue("currenttaxamt", subtract,rowIndex, parentRowIndex);//当前税额 //// this.getModel().setValue("currenttaxamt", subtract,rowIndex, parentRowIndex);//当前税额
// this.getModel().setValue("currentoftax", multiply1,rowIndex, parentRowIndex);//当前价税合计 //// this.getModel().setValue("currentoftax", multiply1,rowIndex, parentRowIndex);//当前价税合计
// } else if (name.equals("currentprice")&&currentprice.compareTo(new BigDecimal(0))>0) { //// } else if (name.equals("currentprice")&&currentprice.compareTo(new BigDecimal(0))>0) {
// BigDecimal divide = currentprice.multiply(taxrate);//当前含税单价 //// BigDecimal divide = currentprice.multiply(taxrate);//当前含税单价
// BigDecimal multiply = currentprice.multiply(qty);//当前金额 //// BigDecimal multiply = currentprice.multiply(qty);//当前金额
// BigDecimal multiply1 = divide.multiply(qty);//当前价税合计 //// BigDecimal multiply1 = divide.multiply(qty);//当前价税合计
// BigDecimal subtract = multiply1.subtract(multiply);//当前税额 //// BigDecimal subtract = multiply1.subtract(multiply);//当前税额
// this.getModel().setValue("curtaxprice",divide, rowIndex, parentRowIndex);//当前含税单价 //// this.getModel().setValue("curtaxprice",divide, rowIndex, parentRowIndex);//当前含税单价
// this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额 //// this.getModel().setValue("currentamt", multiply,rowIndex, parentRowIndex);//当前金额
// this.getModel().setValue("currenttaxamt",multiply1, rowIndex, parentRowIndex);//当前税额 //// this.getModel().setValue("currenttaxamt",multiply1, rowIndex, parentRowIndex);//当前税额
// this.getModel().setValue("currentoftax",subtract, rowIndex, parentRowIndex);//当前价税合计 //// this.getModel().setValue("currentoftax",subtract, rowIndex, parentRowIndex);//当前价税合计
// } //// }
// this.getView().updateView(); //// this.getView().updateView();
// } //// }
// ////
// } //// }
} // }
} }

View File

@ -26,16 +26,16 @@ public class ContractSettleBillPlugin extends AbstractBillPlugIn implements Plug
@Override @Override
public void afterCreateNewData(EventObject e) { public void afterCreateNewData(EventObject e) {
super.afterCreateNewData(e); super.afterCreateNewData(e);
Object changetype = this.getModel().getValue("changetype"); // Object changetype = this.getModel().getValue("changetype");
if(changetype!=null){ // if(changetype!=null){
if(changetype.toString().equals("03")){ // if(changetype.toString().equals("03")){
this.getView().setVisible(true,"zcgj_partb"); // this.getView().setVisible(true,"zcgj_partb");
this.getView().setVisible(true,"zcgj_otherpart"); // this.getView().setVisible(true,"zcgj_otherpart");
}else { // }else {
this.getView().setVisible(false,"zcgj_partb"); // this.getView().setVisible(false,"zcgj_partb");
this.getView().setVisible(false,"zcgj_otherpart"); // this.getView().setVisible(false,"zcgj_otherpart");
} // }
} // }
} }
@Override @Override
@ -44,7 +44,7 @@ public class ContractSettleBillPlugin extends AbstractBillPlugIn implements Plug
// 注册按钮点击事件 // 注册按钮点击事件
// this.addClickListeners("bar_audit"); // this.addClickListeners("bar_audit");
// this.addItemClickListeners("bar_audit"); // this.addItemClickListeners("bar_audit");
// Button button = this.getView().getControl("bar_audit"); // Button button = this.getView().getControl("bar_save");
// button.addClickListener(this); // button.addClickListener(this);
} }
@ -67,35 +67,35 @@ public class ContractSettleBillPlugin extends AbstractBillPlugIn implements Plug
String key = source.getKey(); String key = source.getKey();
if (StringUtils.equals("bar_audit", key)) { if (StringUtils.equals("bar_audit", key)) {
// 在此添加业务逻辑 // 在此添加业务逻辑
Object changetype = this.getModel().getValue("changetype"); // Object changetype = this.getModel().getValue("changetype");
if (changetype != null) { // if (changetype != null) {
if (changetype.toString().equals("03")) { // if (changetype.toString().equals("03")) {
Object contract = this.getModel().getValue("contract"); // Object contract = this.getModel().getValue("contract");
DynamicObject contractInfo = (DynamicObject) contract; // DynamicObject contractInfo = (DynamicObject) contract;
String billName = contractInfo.getDataEntityType().getName(); // String billName = contractInfo.getDataEntityType().getName();
DynamicObject zcgjpartb = (DynamicObject)this.getModel().getValue("zcgj_partb"); // DynamicObject zcgjpartb = (DynamicObject)this.getModel().getValue("zcgj_partb");
Object zcgjOtherpart = this.getModel().getValue("zcgj_otherpart"); // Object zcgjOtherpart = this.getModel().getValue("zcgj_otherpart");
if (billName.equals("ec_out_contract_f7")) { // if (billName.equals("ec_out_contract_f7")) {
QFilter f1 = new QFilter("number", "=", contractInfo.getString("number")); // QFilter f1 = new QFilter("number", "=", contractInfo.getString("number"));
DynamicObject outContractF7 = BusinessDataServiceHelper.loadSingle("ec_out_contract_f7", new QFilter[]{f1}); // DynamicObject outContractF7 = BusinessDataServiceHelper.loadSingle("ec_out_contract_f7", new QFilter[]{f1});
outContractF7.set("partb",zcgjpartb); // outContractF7.set("partb",zcgjpartb);
OperationResult saveOperationResult = SaveServiceHelper.saveOperate("ec_out_contract_f7", new DynamicObject[]{outContractF7}, null);//支出合同F7实体 // OperationResult saveOperationResult = SaveServiceHelper.saveOperate("ec_out_contract_f7", new DynamicObject[]{outContractF7}, null);//支出合同F7实体
//
QFilter f2 = new QFilter("billno", "=", contractInfo.getString("number")); // QFilter f2 = new QFilter("billno", "=", contractInfo.getString("number"));
DynamicObject outContract = BusinessDataServiceHelper.loadSingle("ec_out_contract", new QFilter[]{f2}); // DynamicObject outContract = BusinessDataServiceHelper.loadSingle("ec_out_contract", new QFilter[]{f2});
outContract.set("partb",zcgjpartb); // outContract.set("partb",zcgjpartb);
if(zcgjOtherpart!=null){ // if(zcgjOtherpart!=null){
DynamicObjectCollection otherpart = (DynamicObjectCollection) this.getModel().getValue("zcgj_otherpart"); // DynamicObjectCollection otherpart = (DynamicObjectCollection) this.getModel().getValue("zcgj_otherpart");
outContract.set("otherpart",otherpart); // outContract.set("otherpart",otherpart);
outContract.set("ismulticontract",true); // outContract.set("ismulticontract",true);
} // }
OperationResult saveOperationResult1 = SaveServiceHelper.saveOperate("ec_out_contract", new DynamicObject[]{outContractF7}, null);//支出合同实体 // OperationResult saveOperationResult1 = SaveServiceHelper.saveOperate("ec_out_contract", new DynamicObject[]{outContractF7}, null);//支出合同实体
System.out.println(saveOperationResult1); // System.out.println(saveOperationResult1);
}else{ // }else{
//
} // }
} // }
} // }
evt.setCancel(true); // 取消后续处理将不会再触发click事件 evt.setCancel(true); // 取消后续处理将不会再触发click事件
} }
} }
@ -104,17 +104,17 @@ public class ContractSettleBillPlugin extends AbstractBillPlugIn implements Plug
public void propertyChanged(PropertyChangedArgs e) { public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e); super.propertyChanged(e);
String name = e.getProperty().getName(); String name = e.getProperty().getName();
if(name.equals("changetype")){ // if(name.equals("changetype")){
Object changetype = this.getModel().getValue("changetype"); // Object changetype = this.getModel().getValue("changetype");
if(changetype!=null){ // if(changetype!=null){
if(changetype.toString().equals("03")){ // if(changetype.toString().equals("03")){
this.getView().setVisible(true,"zcgj_partb"); // this.getView().setVisible(true,"zcgj_partb");
this.getView().setVisible(true,"zcgj_otherpart"); // this.getView().setVisible(true,"zcgj_otherpart");
}else { // }else {
this.getView().setVisible(false,"zcgj_partb"); // this.getView().setVisible(false,"zcgj_partb");
this.getView().setVisible(false,"zcgj_otherpart"); // this.getView().setVisible(false,"zcgj_otherpart");
} // }
} // }
} // }
} }
} }

View File

@ -65,7 +65,8 @@ public class ResourceFilterExtPlugin extends ResourceItemListPlugin {
} else if (contractType.toString().equals("sbcg")) {//设备采购 } else if (contractType.toString().equals("sbcg")) {//设备采购
this.getView().setVisible(true, new String[]{"flexpanelequipment"}); this.getView().setVisible(true, new String[]{"flexpanelequipment"});
this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelmaterial", "flexpanelturnover","flexpanelother"}); this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelmaterial", "flexpanelturnover","flexpanelother"});
}else if (contractType.toString().equals("qtcc") || contractType.toString().equals("lwlcc")) {//产出物 }else if (contractType.toString().equals("qtcc") || contractType.toString().equals("lwlcc")|| contractType.toString().equals("ck")||
contractType.toString().equals("zyfbcc")|| contractType.toString().equals("jjbc")) {//产出物
this.getView().setVisible(true, new String[]{"flexpanelturnover"}); this.getView().setVisible(true, new String[]{"flexpanelturnover"});
this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelequipment", "flexpanelmaterial","flexpanelother"}); this.getView().setVisible(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelequipment", "flexpanelmaterial","flexpanelother"});
} }