Compare commits
No commits in common. "f3c6c7d0db50f4e723ad65b4dcfe5a696be93c2e" and "cf89760709f1e6040d93cbc4c89fe62222f88359" have entirely different histories.
f3c6c7d0db
...
cf89760709
|
@ -20,22 +20,12 @@ public class Calculation {
|
||||||
//合价(含税)
|
//合价(含税)
|
||||||
Double entry_amount;
|
Double entry_amount;
|
||||||
|
|
||||||
//单价
|
public Calculation(String entry_longnumber, String entry_accountname, String entry_workloadunit, Double entry_adjustcoefficient, Double entry_amount) {
|
||||||
Double entry_price;
|
|
||||||
|
|
||||||
//工程量
|
|
||||||
Double entry_workload;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Calculation(String entry_longnumber, String entry_accountname, String entry_workloadunit, Double entry_adjustcoefficient, Double entry_amount,Double entry_price,Double entry_workload) {
|
|
||||||
this.entry_longnumber = entry_longnumber;
|
this.entry_longnumber = entry_longnumber;
|
||||||
this.entry_accountname = entry_accountname;
|
this.entry_accountname = entry_accountname;
|
||||||
this.entry_workloadunit = entry_workloadunit;
|
this.entry_workloadunit = entry_workloadunit;
|
||||||
this.entry_adjustcoefficient = entry_adjustcoefficient;
|
this.entry_adjustcoefficient = entry_adjustcoefficient;
|
||||||
this.entry_amount = entry_amount;
|
this.entry_amount = entry_amount;
|
||||||
this.entry_price = entry_price;
|
|
||||||
this.entry_workload = entry_workload;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getEntry_longnumber() {
|
public String getEntry_longnumber() {
|
||||||
|
@ -78,23 +68,6 @@ public class Calculation {
|
||||||
this.entry_amount = entry_amount;
|
this.entry_amount = entry_amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Double getEntry_price() {
|
|
||||||
return entry_price;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEntry_price(Double entry_price) {
|
|
||||||
this.entry_price = entry_price;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getEntry_workload() {
|
|
||||||
return entry_workload;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEntry_workload(Double entry_workload) {
|
|
||||||
this.entry_workload = entry_workload;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Calculation() {
|
public Calculation() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,29 +2,28 @@ package shkd.repc.recos.formplugin;
|
||||||
|
|
||||||
import kd.bos.dataentity.entity.DynamicObject;
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
import kd.bos.form.IFormView;
|
|
||||||
import kd.bos.form.control.AttachmentPanel;
|
import kd.bos.form.control.AttachmentPanel;
|
||||||
import kd.bos.form.control.events.UploadListener;
|
import kd.bos.form.control.events.UploadListener;
|
||||||
import kd.bos.form.events.AfterDoOperationEventArgs;
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
||||||
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
||||||
import kd.bos.form.operate.FormOperate;
|
import kd.bos.form.operate.FormOperate;
|
||||||
import kd.bos.form.plugin.AbstractFormPlugin;
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||||
import kd.bos.mvc.bill.BillView;
|
|
||||||
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.AttachmentDto;
|
import kd.bos.servicehelper.AttachmentDto;
|
||||||
import kd.bos.servicehelper.AttachmentServiceHelper;
|
import kd.bos.servicehelper.AttachmentServiceHelper;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import kd.bos.servicehelper.QueryServiceHelper;
|
|
||||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
import org.apache.poi.ss.usermodel.*;
|
import org.apache.poi.ss.usermodel.*;
|
||||||
import shkd.repc.recos.domain.Calculation;
|
import shkd.repc.recos.domain.Calculation;
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.EventObject;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class RecosMeasurecosFormPlugin extends AbstractFormPlugin implements UploadListener {
|
public class RecosMeasurecosFormPlugin extends AbstractFormPlugin implements UploadListener {
|
||||||
|
|
||||||
|
@ -46,19 +45,6 @@ public class RecosMeasurecosFormPlugin extends AbstractFormPlugin implements Upl
|
||||||
case "qeug_test":
|
case "qeug_test":
|
||||||
Long id = (Long) this.getModel().getValue("id");//获取单据id
|
Long id = (Long) this.getModel().getValue("id");//获取单据id
|
||||||
|
|
||||||
Map<String, String> result = new HashMap<>();
|
|
||||||
//获取不同楼对应标签得pageid
|
|
||||||
Map<String, String> all = this.getPageCache().getAll();
|
|
||||||
for (Map.Entry<String, String> entry : all.entrySet()) {
|
|
||||||
if (entry.getKey().startsWith("tab_measureci")) {//建安测算
|
|
||||||
IFormView view = this.getView().getView(entry.getValue());//标签里面的页面
|
|
||||||
Long producttypeid = (Long) view.getModel().getValue("producttypeid");//产品类型id
|
|
||||||
DynamicObject single = BusinessDataServiceHelper.loadSingle(producttypeid,"repmd_producttypes");
|
|
||||||
String fullname = single.getString("fullname");
|
|
||||||
result.put(fullname, entry.getValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//遍历附件前校验
|
//遍历附件前校验
|
||||||
AttachmentPanel att = this.getView().getControl("attachmentpanelap");
|
AttachmentPanel att = this.getView().getControl("attachmentpanelap");
|
||||||
if (att.getAttachmentData().size()==0){
|
if (att.getAttachmentData().size()==0){
|
||||||
|
@ -102,13 +88,11 @@ public class RecosMeasurecosFormPlugin extends AbstractFormPlugin implements Upl
|
||||||
row.getCell(9).getStringCellValue(),//单位
|
row.getCell(9).getStringCellValue(),//单位
|
||||||
//Double.parseDouble(row.getCell(12).getStringCellValue().replace("%", ""))/100.0,
|
//Double.parseDouble(row.getCell(12).getStringCellValue().replace("%", ""))/100.0,
|
||||||
Double.parseDouble(row.getCell(12).toString()),// 调整系数
|
Double.parseDouble(row.getCell(12).toString()),// 调整系数
|
||||||
row.getCell(17).getNumericCellValue(),//合价(含税)
|
row.getCell(17).getNumericCellValue()//合价(含税)
|
||||||
row.getCell(16).getNumericCellValue(),//单价
|
|
||||||
row.getCell(13).getNumericCellValue()//工程量
|
|
||||||
);
|
);
|
||||||
arrayList.add(calculation);
|
arrayList.add(calculation);
|
||||||
}
|
}
|
||||||
String res = updateRecosMeasurecos(arrayList, sheetName,result);
|
String res = updateRecosMeasurecos(arrayList, sheetName);
|
||||||
if (!"success".equals(res)){
|
if (!"success".equals(res)){
|
||||||
this.getView().showSuccessNotification("功能失败:"+res);
|
this.getView().showSuccessNotification("功能失败:"+res);
|
||||||
return;
|
return;
|
||||||
|
@ -118,8 +102,6 @@ public class RecosMeasurecosFormPlugin extends AbstractFormPlugin implements Upl
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.getView().showSuccessNotification("功能成功");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,45 +120,19 @@ public class RecosMeasurecosFormPlugin extends AbstractFormPlugin implements Upl
|
||||||
/*
|
/*
|
||||||
* 根据入参信息修改成本测算方法
|
* 根据入参信息修改成本测算方法
|
||||||
* */
|
* */
|
||||||
public String updateRecosMeasurecos(List<Calculation> arrayList,String sheetName,Map<String, String> result) {
|
public String updateRecosMeasurecos(List<Calculation> arrayList,String sheetName) {
|
||||||
try {
|
try {
|
||||||
//处理
|
//处理
|
||||||
List<String> numberStrings = arrayList.stream()
|
System.out.println(arrayList);
|
||||||
.map(calculation -> String.valueOf(calculation.getEntry_longnumber()))
|
System.out.println(sheetName);
|
||||||
.collect(Collectors.toList());
|
// QFilter filter = new QFilter("measurecostid", QCP.equals, (Long) this.getModel().getValue("id"));
|
||||||
String sheetNamepage = result.get(sheetName);
|
// DynamicObject[] DynamicObjects = BusinessDataServiceHelper.load("recos_measureci", "id,status,cientry", filter.toArray());
|
||||||
BillView sheetNameView = (BillView) this.getView().getView(sheetNamepage);
|
// Long fid = (Long) DynamicObjects[0].get("id");
|
||||||
DynamicObject dataEntity = sheetNameView.getModel().getDataEntity(true);
|
// DynamicObject loadSingle = BusinessDataServiceHelper.loadSingle(fid,"recos_measureci");
|
||||||
DynamicObjectCollection cientry = dataEntity.getDynamicObjectCollection("cientry");
|
// DynamicObjectCollection cientry = loadSingle.getDynamicObjectCollection("cientry");
|
||||||
|
// cientry.get(4).set("entry_amount",666);
|
||||||
Map<Integer, Calculation> hashMap = new HashMap<>();//存储修改的数据和下标
|
// Object[] save = SaveServiceHelper.save(new DynamicObject[]{loadSingle});
|
||||||
for (DynamicObject dynamicObject : cientry) {
|
// System.out.println(save);
|
||||||
if (numberStrings.contains(dynamicObject.getString("entry_longnumber"))){
|
|
||||||
Calculation res = arrayList.stream()
|
|
||||||
.filter(calculation -> dynamicObject.getString("entry_longnumber").equals(calculation.getEntry_longnumber()))
|
|
||||||
.findFirst() // 获取第一个匹配的元素
|
|
||||||
.orElse(null);
|
|
||||||
hashMap.put((int) dynamicObject.get("seq")-1,res);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
hashMap.forEach((key, value) -> {
|
|
||||||
|
|
||||||
String entry_workloadunit = value.getEntry_workloadunit();
|
|
||||||
DynamicObject unit = QueryServiceHelper.queryOne("bd_measureunits", "id,name,number", new QFilter("name", QCP.equals, entry_workloadunit).toArray());
|
|
||||||
DynamicObject single = BusinessDataServiceHelper.loadSingle(unit.getString("id"),"bd_measureunits");
|
|
||||||
sheetNameView.getModel().setValue("entry_workloadunit",single,key);//单位
|
|
||||||
|
|
||||||
sheetNameView.getModel().setValue("entry_adjustcoefficient",value.getEntry_adjustcoefficient(),key);//调整系数
|
|
||||||
|
|
||||||
sheetNameView.getModel().setValue("entry_price",value.getEntry_price(),key);//单价
|
|
||||||
|
|
||||||
sheetNameView.getModel().setValue("entry_workload",value.getEntry_workload(),key);//工程量
|
|
||||||
|
|
||||||
sheetNameView.getModel().setValue("entry_amount",value.getEntry_amount(),key);//合价(含税)
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
getView().sendFormAction(sheetNameView);
|
|
||||||
return "success";
|
return "success";
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return e.getMessage();
|
return e.getMessage();
|
||||||
|
|
Loading…
Reference in New Issue