youhua
This commit is contained in:
parent
ef7c631314
commit
53249a396f
|
@ -1,5 +1,6 @@
|
|||
package zcgj.zcdev.zcdev.pr.plugin.form;
|
||||
|
||||
import com.alibaba.excel.util.StringUtils;
|
||||
import com.greenpineyu.fel.common.NumberUtil;
|
||||
import kd.bos.coderule.api.CodeRuleInfo;
|
||||
import kd.bos.coderule.service.cache.CodeRuleCache;
|
||||
|
@ -7,6 +8,8 @@ import kd.bos.dataentity.entity.DynamicObject;
|
|||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.datamodel.ListSelectedRow;
|
||||
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
||||
import kd.bos.entity.operate.result.IOperateInfo;
|
||||
import kd.bos.entity.operate.result.OperateErrorInfo;
|
||||
import kd.bos.entity.operate.result.OperationResult;
|
||||
import kd.bos.form.IFormView;
|
||||
import kd.bos.form.control.events.BeforeItemClickEvent;
|
||||
|
@ -64,6 +67,7 @@ public class EquipmentCardListPlugin extends AbstractListPlugin implements Plugi
|
|||
IFormView view = this.getView();
|
||||
view.invokeOperation("refresh");
|
||||
} else if (itemKey.equals("zcgj_asset")) {//同步资产卡片
|
||||
String operationResultErrorInfos = null;
|
||||
Set<String> strings = new HashSet();
|
||||
DynamicObject[] equipmenttype = BusinessDataServiceHelper.load("zcgj_equipmenttype", "number,zcgj_assetcat",new QFilter[]{new QFilter("zcgj_assetcat.number", QCP.is_notnull,"" )});
|
||||
for (DynamicObject dynamicObject : equipmenttype) {
|
||||
|
@ -183,12 +187,16 @@ public class EquipmentCardListPlugin extends AbstractListPlugin implements Plugi
|
|||
}
|
||||
if (eceq_equipment_card!=null){
|
||||
SaveServiceHelper.update(equipmentcard);
|
||||
System.out.println();
|
||||
}else {
|
||||
OperationResult result = OperationServiceHelper.executeOperate("save", "eceq_equipment_card", new DynamicObject[]{equipmentcard}, null);
|
||||
System.out.println();
|
||||
String operationResultErrorInfo = getOperationResultErrorInfos(result);
|
||||
if (!operationResultErrorInfo.isEmpty() && operationResultErrorInfo!=null){
|
||||
operationResultErrorInfos = operationResultErrorInfo + operationResultErrorInfos;
|
||||
System.out.println(number+assetname+"报错信息为:"+operationResultErrorInfos);
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("总报错信息为:"+operationResultErrorInfos);
|
||||
this.getView().showMessage("同步操作成功。");
|
||||
}
|
||||
}
|
||||
|
@ -289,4 +297,36 @@ public class EquipmentCardListPlugin extends AbstractListPlugin implements Plugi
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取操作错误信息
|
||||
* @param operationResult
|
||||
* @return
|
||||
*/
|
||||
private String getOperationResultErrorInfos(OperationResult operationResult){
|
||||
if(operationResult.isSuccess()){
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
List<IOperateInfo> errorInfos = operationResult.getAllErrorOrValidateInfo();
|
||||
int size = errorInfos.size() + operationResult.getSuccessPkIds().size();
|
||||
if (size > 1) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
int i = 0;
|
||||
for(int len = errorInfos.size(); i < 5 && i < len; ++i) {
|
||||
stringBuilder.append((errorInfos.get(i)).getMessage());
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
} else if (!errorInfos.isEmpty()) {
|
||||
OperateErrorInfo errorInfo = (OperateErrorInfo)errorInfos.get(0);
|
||||
String msg = errorInfo.getMessage() == null ? "" : errorInfo.getMessage();
|
||||
return msg;
|
||||
} else{
|
||||
String msg = operationResult.getMessage() == null ? "" : operationResult.getMessage();
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
package zcgj.zcdev.zcdev.pr.task;
|
||||
|
||||
import com.alibaba.excel.util.StringUtils;
|
||||
import kd.bos.algo.DataSet;
|
||||
import kd.bos.coderule.api.CodeRuleInfo;
|
||||
import kd.bos.coderule.service.cache.CodeRuleCache;
|
||||
import kd.bos.context.RequestContext;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.operate.result.IOperateInfo;
|
||||
import kd.bos.entity.operate.result.OperateErrorInfo;
|
||||
import kd.bos.entity.operate.result.OperationResult;
|
||||
import kd.bos.exception.KDException;
|
||||
import kd.bos.logging.Log;
|
||||
|
@ -64,6 +67,7 @@ public class EquipmentCardTaskPlugin extends AbstractTask {
|
|||
DynamicObject[] realcards = BusinessDataServiceHelper.load("fa_asset_card", "zcgj_costcenter,headusedept,finentry,assetcat,number,assetname,model,realaccountdate," +
|
||||
"assetunit,supplier,zcgj_platenumber,unit,zcgj_manufacturer,zcgj_prodate,storeplace,creator,createtime,modifier,modifytime,auditdate,auditor,finentry.fin_originalval,finentry.fin_preresidualval,finentry.fin_depredamount,finentry.fin_preusingamount,finentry.fin_accumdepre,finentry.fin_networth", new QFilter[]{qFilter,qFilter2});
|
||||
log.info("同步的实物数量有"+realcards.length);
|
||||
String operationResultErrorInfos = null;
|
||||
for (DynamicObject realcard : realcards) {
|
||||
String number = realcard.getString("number");//资产编码
|
||||
// DynamicObject assetcat = realcard.getDynamicObject("assetcat");//资产类别
|
||||
|
@ -157,12 +161,15 @@ public class EquipmentCardTaskPlugin extends AbstractTask {
|
|||
equipmentcard.set("zcgj_preusingamount",fin_preusingamount);
|
||||
equipmentcard.set("unitprice",finOriginalval);
|
||||
}
|
||||
if (eceq_equipment_card != null) {
|
||||
if (eceq_equipment_card!=null){
|
||||
SaveServiceHelper.update(equipmentcard);
|
||||
System.out.println();
|
||||
} else {
|
||||
}else {
|
||||
OperationResult result = OperationServiceHelper.executeOperate("save", "eceq_equipment_card", new DynamicObject[]{equipmentcard}, null);
|
||||
System.out.println();
|
||||
String operationResultErrorInfo = getOperationResultErrorInfos(result);
|
||||
if (!operationResultErrorInfo.isEmpty() && operationResultErrorInfo!=null){
|
||||
operationResultErrorInfos = operationResultErrorInfo + operationResultErrorInfos;
|
||||
System.out.println(number+assetname+"报错信息为:"+operationResultErrorInfos);
|
||||
}
|
||||
}
|
||||
DynamicObject eceq_equipment = BusinessDataServiceHelper.loadSingle("eceq_equipinfo", new QFilter[]{new QFilter("number", QCP.equals, number)});
|
||||
if (eceq_equipment != null) {
|
||||
|
@ -212,6 +219,7 @@ public class EquipmentCardTaskPlugin extends AbstractTask {
|
|||
}
|
||||
SaveServiceHelper.save(new DynamicObject[]{eceq_equipment});
|
||||
}
|
||||
System.out.println("总报错信息为:"+operationResultErrorInfos);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -293,6 +301,35 @@ public class EquipmentCardTaskPlugin extends AbstractTask {
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取操作错误信息
|
||||
* @param operationResult
|
||||
* @return
|
||||
*/
|
||||
private String getOperationResultErrorInfos(OperationResult operationResult){
|
||||
if(operationResult.isSuccess()){
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
List<IOperateInfo> errorInfos = operationResult.getAllErrorOrValidateInfo();
|
||||
int size = errorInfos.size() + operationResult.getSuccessPkIds().size();
|
||||
if (size > 1) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
int i = 0;
|
||||
for(int len = errorInfos.size(); i < 5 && i < len; ++i) {
|
||||
stringBuilder.append((errorInfos.get(i)).getMessage());
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
} else if (!errorInfos.isEmpty()) {
|
||||
OperateErrorInfo errorInfo = (OperateErrorInfo)errorInfos.get(0);
|
||||
String msg = errorInfo.getMessage() == null ? "" : errorInfo.getMessage();
|
||||
return msg;
|
||||
} else{
|
||||
String msg = operationResult.getMessage() == null ? "" : operationResult.getMessage();
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// DynamicObject[] depresplitdetails = BusinessDataServiceHelper.load("fa_depresplitdetail", "billno,period,splitdept,assentry.costcentrer,assentry.splitamount", new QFilter[]{qf});
|
||||
|
|
Loading…
Reference in New Issue