【物料变更】处理变更内容
This commit is contained in:
parent
a3841451d2
commit
2d6d18e4d4
|
|
@ -37,6 +37,7 @@ public class MaterialBillPlugin extends AbstractBillPlugIn {
|
||||||
if("submit".equals(operateKey)){
|
if("submit".equals(operateKey)){
|
||||||
//复制后修改数据在提交时记录修改的内容,如果修改内容为空,则不记录
|
//复制后修改数据在提交时记录修改的内容,如果修改内容为空,则不记录
|
||||||
LinkedHashMap changeMap = new LinkedHashMap();
|
LinkedHashMap changeMap = new LinkedHashMap();
|
||||||
|
StringBuilder changeContent = new StringBuilder();
|
||||||
DynamicObject dataEntity = this.getModel().getDataEntity(true);
|
DynamicObject dataEntity = this.getModel().getDataEntity(true);
|
||||||
String newName = dataEntity.getString("name");
|
String newName = dataEntity.getString("name");
|
||||||
String srcNumber = null;
|
String srcNumber = null;
|
||||||
|
|
@ -48,15 +49,20 @@ public class MaterialBillPlugin extends AbstractBillPlugIn {
|
||||||
if(srcMaterialArr != null && srcMaterialArr.length > 0){
|
if(srcMaterialArr != null && srcMaterialArr.length > 0){
|
||||||
DynamicObject srcMaterial = srcMaterialArr[0];
|
DynamicObject srcMaterial = srcMaterialArr[0];
|
||||||
srcMaterial = BusinessDataServiceHelper.loadSingle(srcMaterial.getPkValue(), "bd_material");
|
srcMaterial = BusinessDataServiceHelper.loadSingle(srcMaterial.getPkValue(), "bd_material");
|
||||||
|
|
||||||
|
|
||||||
//获取实体中所有变更的属性
|
//获取实体中所有变更的属性
|
||||||
StringBuilder changeContent = new StringBuilder();
|
|
||||||
List<IDataEntityProperty> iDataEntityProperties = dataEntity.getDataEntityState().GetDirtyProperties();
|
List<IDataEntityProperty> iDataEntityProperties = dataEntity.getDataEntityState().GetDirtyProperties();
|
||||||
if(iDataEntityProperties.size()>0){
|
if(iDataEntityProperties.size()>0){
|
||||||
for(IDataEntityProperty prop :iDataEntityProperties){
|
for(IDataEntityProperty prop :iDataEntityProperties){
|
||||||
String name = prop.getName();//字段标识
|
String name = prop.getName();//字段标识
|
||||||
String displayName = prop.getDisplayName().get("zh_CN");//字段名称
|
if("name".equals(name) || "useorg".equals(name) || "modifytime".equals(name)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
LocaleString displayNameLocaleStr = prop.getDisplayName();
|
||||||
|
if(displayNameLocaleStr == null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String displayName = displayNameLocaleStr.get("zh_CN");//字段名称
|
||||||
String propTypeName = prop.getPropertyType().getName();
|
String propTypeName = prop.getPropertyType().getName();
|
||||||
if("kd.bos.dataentity.entity.DynamicObject".equals(propTypeName)){
|
if("kd.bos.dataentity.entity.DynamicObject".equals(propTypeName)){
|
||||||
DynamicObject dynamicObject = dataEntity.getDynamicObject(name);
|
DynamicObject dynamicObject = dataEntity.getDynamicObject(name);
|
||||||
|
|
@ -69,12 +75,12 @@ public class MaterialBillPlugin extends AbstractBillPlugIn {
|
||||||
changeContent.append("字段:"+displayName+"("+name+"),变更前:"+oldValue+",变更后:"+newValue+";");
|
changeContent.append("字段:"+displayName+"("+name+"),变更前:"+oldValue+",变更后:"+newValue+";");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
changeContent.append("字段:"+displayName+"("+name+"),变更前:null,变更后:"+newValue+";");
|
changeContent.append("字段:"+displayName+"("+name+"),变更前:空,变更后:"+newValue+";");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(dynamicObject1 != null) {
|
if(dynamicObject1 != null) {
|
||||||
String oldValue = dynamicObject1.getString("name");
|
String oldValue = dynamicObject1.getString("name");
|
||||||
changeContent.append("字段:"+displayName+"("+name+"),变更前:"+oldValue+",变更后:null;");
|
changeContent.append("字段:"+displayName+"("+name+"),变更前:"+oldValue+",变更后:空;");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if("java.util.Date".equals(propTypeName)){
|
}else if("java.util.Date".equals(propTypeName)){
|
||||||
|
|
@ -86,11 +92,11 @@ public class MaterialBillPlugin extends AbstractBillPlugIn {
|
||||||
changeContent.append("字段:"+displayName+"("+name+"),变更前:"+oldValue+",变更后:"+newValue+";");
|
changeContent.append("字段:"+displayName+"("+name+"),变更前:"+oldValue+",变更后:"+newValue+";");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
changeContent.append("字段:"+displayName+"("+name+"),变更前:null,变更后:"+newValue+";");
|
changeContent.append("字段:"+displayName+"("+name+"),变更前:空,变更后:"+newValue+";");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(oldValue != null){
|
if(oldValue != null){
|
||||||
changeContent.append("字段:"+displayName+"("+name+"),变更前:"+oldValue+",变更后:null;");
|
changeContent.append("字段:"+displayName+"("+name+"),变更前:"+oldValue+",变更后:空;");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -115,11 +121,11 @@ public class MaterialBillPlugin extends AbstractBillPlugIn {
|
||||||
changeContent.append("字段:"+displayName+"("+name+"),变更前:"+oldValue+",变更后:"+newValue+";");
|
changeContent.append("字段:"+displayName+"("+name+"),变更前:"+oldValue+",变更后:"+newValue+";");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
changeContent.append("字段:"+displayName+"("+name+"),变更前:null,变更后:"+newValue+";");
|
changeContent.append("字段:"+displayName+"("+name+"),变更前:空,变更后:"+newValue+";");
|
||||||
}
|
}
|
||||||
}else {
|
}else {
|
||||||
if(oldValue != null){
|
if(oldValue != null){
|
||||||
changeContent.append("字段:"+displayName+"("+name+"),变更前:"+oldValue+",变更后:null;");
|
changeContent.append("字段:"+displayName+"("+name+"),变更前:"+oldValue+",变更后:空;");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if("boolean".equals(propTypeName)){
|
}else if("boolean".equals(propTypeName)){
|
||||||
|
|
@ -137,11 +143,11 @@ public class MaterialBillPlugin extends AbstractBillPlugIn {
|
||||||
changeContent.append("字段:"+displayName+"("+name+"),变更前:"+oldValue+",变更后:"+newValue+";");
|
changeContent.append("字段:"+displayName+"("+name+"),变更前:"+oldValue+",变更后:"+newValue+";");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
changeContent.append("字段:"+displayName+"("+name+"),变更前:null,变更后:"+newValue+";");
|
changeContent.append("字段:"+displayName+"("+name+"),变更前:空,变更后:"+newValue+";");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
if(StringUtils.isNotBlank(oldValue)) {
|
if(StringUtils.isNotBlank(oldValue)) {
|
||||||
changeContent.append("字段:"+displayName+"("+name+"),变更前:"+oldValue+",变更后:null;");
|
changeContent.append("字段:"+displayName+"("+name+"),变更前:"+oldValue+",变更后:空;");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -151,32 +157,40 @@ public class MaterialBillPlugin extends AbstractBillPlugIn {
|
||||||
DynamicObjectCollection entryentity = dataEntity.getDynamicObjectCollection("entry_groupstandard");
|
DynamicObjectCollection entryentity = dataEntity.getDynamicObjectCollection("entry_groupstandard");
|
||||||
//获取单据体中已变更的属性
|
//获取单据体中已变更的属性
|
||||||
for(int x = 0; x < entryentity.size(); x++){
|
for(int x = 0; x < entryentity.size(); x++){
|
||||||
|
DynamicObject entry = entryentity.get(x);
|
||||||
List<IDataEntityProperty> iDataEntityProperties1 = entryentity.get(x).getDataEntityState().GetDirtyProperties();
|
List<IDataEntityProperty> iDataEntityProperties1 = entryentity.get(x).getDataEntityState().GetDirtyProperties();
|
||||||
for(IDataEntityProperty prop1 :iDataEntityProperties1){
|
for(IDataEntityProperty prop :iDataEntityProperties1){
|
||||||
String name = prop1.getName();
|
String name = prop.getName();
|
||||||
String propTypeName = prop1.getPropertyType().getName();
|
String propTypeName = prop.getPropertyType().getName();
|
||||||
// LocaleString displayName1 = prop1.getDisplayName();
|
LocaleString displayNameLocaleStr = prop.getDisplayName();
|
||||||
// changeMap.put("entry_groupstandard-"+(x+1)+":"+name,displayName1);
|
if(displayNameLocaleStr == null){
|
||||||
// if("kd.bos.dataentity.entity.DynamicObject".equals(propTypeName)){
|
continue;
|
||||||
// DynamicObject dynamicObject = dataEntity.getDynamicObject(name);
|
}
|
||||||
// }else if("java.util.Date".equals(propTypeName)){
|
LocaleString displayName1 = prop.getDisplayName();
|
||||||
// Date date = dataEntity.getDate(name);
|
changeMap.put("entry_groupstandard-"+(x+1)+":"+name,displayName1);
|
||||||
// }else if("java.lang.Integer".equals(propTypeName)){
|
if("kd.bos.dataentity.entity.DynamicObject".equals(propTypeName)){
|
||||||
// int anInt = dataEntity.getInt(name);
|
DynamicObject dynamicObject = entry.getDynamicObject(name);
|
||||||
// }else if("java.lang.Long".equals(propTypeName)){
|
}else if("java.util.Date".equals(propTypeName)){
|
||||||
// Long aLong = dataEntity.getLong(name);
|
Date date = entry.getDate(name);
|
||||||
// }else if("java.math.BigDecimal".equals(propTypeName)){
|
}else if("java.lang.Integer".equals(propTypeName)){
|
||||||
// BigDecimal bigDecimal = dataEntity.getBigDecimal(name);
|
int anInt = entry.getInt(name);
|
||||||
// }else if("boolean".equals(propTypeName)){
|
}else if("java.lang.Long".equals(propTypeName)){
|
||||||
// boolean aBoolean = dataEntity.getBoolean(name);
|
Long aLong = entry.getLong(name);
|
||||||
// }else {
|
}else if("java.math.BigDecimal".equals(propTypeName)){
|
||||||
// String string = dataEntity.getString(name);
|
BigDecimal bigDecimal = entry.getBigDecimal(name);
|
||||||
// }
|
}else if("boolean".equals(propTypeName)){
|
||||||
|
boolean aBoolean = entry.getBoolean(name);
|
||||||
|
}else {
|
||||||
|
String string = entry.getString(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("单据已变更的数据是:"+changeMap);
|
System.out.println("单据已变更的数据是:"+changeMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(StringUtils.isNotBlank(changeContent.toString())){
|
||||||
|
this.getModel().setValue("tqq9_changeinfo_tag", changeContent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if("copy".equals(operateKey)) {
|
if("copy".equals(operateKey)) {
|
||||||
super.beforeDoOperation(args);
|
super.beforeDoOperation(args);
|
||||||
|
|
@ -190,13 +204,13 @@ public class MaterialBillPlugin extends AbstractBillPlugIn {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterCopyData(EventObject e) {
|
public void afterCopyData(EventObject e) {
|
||||||
super.afterCopyData(e);
|
super.afterCopyData(e);
|
||||||
String copySrcBillNo = this.getView().getFormShowParameter().getCustomParam("copySrcBillNo");
|
String copySrcBillNo = this.getView().getFormShowParameter().getCustomParam("copySrcBillName");
|
||||||
DynamicObject dataEntity = this.getModel().getDataEntity(true);
|
DynamicObject dataEntity = this.getModel().getDataEntity(true);
|
||||||
dataEntity.set("name", copySrcBillNo + "_copy");
|
dataEntity.set("name", copySrcBillNo + "_copy");
|
||||||
|
dataEntity.set("tqq9_srcnumber", copySrcBillNo + "_copy");
|
||||||
this.getView().invokeOperation("save");
|
this.getView().invokeOperation("save");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,38 @@
|
||||||
package tqq9.lc123.cloud.app.plugin.form.sys;
|
package tqq9.lc123.cloud.app.plugin.form.sys;
|
||||||
|
|
||||||
|
import kd.bos.bill.BillShowParameter;
|
||||||
import kd.bos.dataentity.OperateOption;
|
import kd.bos.dataentity.OperateOption;
|
||||||
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.dataentity.entity.LocaleString;
|
||||||
|
import kd.bos.dataentity.metadata.IDataEntityProperty;
|
||||||
import kd.bos.dataentity.utils.StringUtils;
|
import kd.bos.dataentity.utils.StringUtils;
|
||||||
|
import kd.bos.entity.EntityMetadataCache;
|
||||||
|
import kd.bos.entity.datamodel.ListSelectedRow;
|
||||||
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
import kd.bos.entity.datamodel.ListSelectedRowCollection;
|
||||||
import kd.bos.entity.operate.result.IOperateInfo;
|
import kd.bos.entity.operate.result.IOperateInfo;
|
||||||
import kd.bos.entity.operate.result.OperationResult;
|
import kd.bos.entity.operate.result.OperationResult;
|
||||||
import kd.bos.form.control.events.ItemClickEvent;
|
import kd.bos.form.control.events.ItemClickEvent;
|
||||||
|
import kd.bos.form.events.AfterDoOperationEventArgs;
|
||||||
|
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
||||||
|
import kd.bos.form.operate.FormOperate;
|
||||||
import kd.bos.list.IListView;
|
import kd.bos.list.IListView;
|
||||||
|
import kd.bos.list.events.BeforeShowBillFormEvent;
|
||||||
import kd.bos.list.plugin.AbstractListPlugin;
|
import kd.bos.list.plugin.AbstractListPlugin;
|
||||||
|
import kd.bos.mvc.list.ListView;
|
||||||
|
import kd.bos.orm.ORM;
|
||||||
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 kd.bos.servicehelper.operation.OperationServiceHelper;
|
import kd.bos.servicehelper.operation.OperationServiceHelper;
|
||||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
import kd.fi.cas.helper.OperateServiceHelper;
|
||||||
|
import kd.imc.bdm.common.constant.BotpCallBackLogConstant;
|
||||||
import kd.sdk.plugin.Plugin;
|
import kd.sdk.plugin.Plugin;
|
||||||
import tqq9.lc123.cloud.app.api.utils.Constants;
|
import tqq9.lc123.cloud.app.api.utils.Constants;
|
||||||
|
|
||||||
import javax.swing.text.html.Option;
|
import javax.swing.text.html.Option;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物料列表界面插件
|
* 物料列表界面插件
|
||||||
|
|
@ -29,11 +40,8 @@ import java.util.List;
|
||||||
public class MaterialListPlugin extends AbstractListPlugin implements Plugin {
|
public class MaterialListPlugin extends AbstractListPlugin implements Plugin {
|
||||||
|
|
||||||
|
|
||||||
private static String BD_MATERIALSALINFO = "bd_materialsalinfo";//物料销售信息
|
private static String BD_MATERIALSALINFO = "bd_materialsalinfo";//物料销售信息H
|
||||||
private static String BD_MATERIALPURCHASEINFO = "bd_materialpurchaseinfo";//物料采购信息
|
private static String BD_MATERIALPURCHASEINFO = "bd_materialpurchaseinfo";//物料采购信息
|
||||||
private static String SH = "SHLC";
|
|
||||||
private static String BJ = "BJLC";
|
|
||||||
private static String GZ = "GZLC";
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void itemClick(ItemClickEvent evt) {
|
public void itemClick(ItemClickEvent evt) {
|
||||||
|
|
@ -186,4 +194,20 @@ public class MaterialListPlugin extends AbstractListPlugin implements Plugin {
|
||||||
// 将城市列表重新组合为字符串,城市间以逗号分隔
|
// 将城市列表重新组合为字符串,城市间以逗号分隔
|
||||||
return "," + String.join(",", cities) + ",";
|
return "," + String.join(",", cities) + ",";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeShowBill(BeforeShowBillFormEvent e) {
|
||||||
|
super.beforeShowBill(e);
|
||||||
|
Object focusRowPkId = ((ListView) this.getView()).getFocusRowPkId();
|
||||||
|
if(focusRowPkId != null){
|
||||||
|
DynamicObject bd_material = BusinessDataServiceHelper.loadSingle(focusRowPkId, "bd_material");
|
||||||
|
BillShowParameter parameter = e.getParameter();
|
||||||
|
parameter.setCustomParam("copySrcBillName",bd_material.getString("name"));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue