优化代码

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

View File

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

View File

@ -65,7 +65,8 @@ public class ResourceFilterExtPlugin extends ResourceItemListPlugin {
} else if (contractType.toString().equals("sbcg")) {//设备采购
this.getView().setVisible(true, new String[]{"flexpanelequipment"});
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(false, new String[]{"flexpanelsub", "flexpanellabour", "flexpanelcomposite", "flexpanelequipment", "flexpanelmaterial","flexpanelother"});
}