车间管理--看板应用自定义插件
现在的车间管理-看板里面,想要写一个看板,只能写一长串的sql,无法用存储过程,如果是特别复杂的逻辑,写起来就特别费劲,现在把自定义插件做看板的方法拿出来给大家参考;里面可以写存储过程,但是最后必须是用结果插入到看板的那个结果元数据的基础资料表内,注意字段格式,否则会报错
上代码:
using Kingdee.BOS.App.Data;
using Kingdee.K3.MFG.App;
using Kingdee.K3.MFG.SFS.App.Core.Executor.ApiImpl;
using System;
using System.Collections.Generic;
using System.Linq;
namespace YD.pc.BusinessPlugIn.PRD.Report
{
public class KBtest : KBMoComExecutor
{
public override string PlugInGetDetailDataSql(string tmpName)
{
return string.Format("SELECT * FROM {0}", tmpName);
}
private string GetInsertSql(string tableName, System.Collections.Generic.List<string> lstMoBillType)
{
//系统本身的取数
// return string.Format("insert into {0}(FId, .....省略
//随便改了一个测试,注意字段类型
// return String.Format(@"/*dialect*/insert into T_SFC_MoComBoard(FId,
// FMasterId,
// FPrdOrgName,
// FWorkShopName,
// FMoNumberSeq,
// FMaterialNumberName,
// FSpecification,
// FPlanDate,
// FRealDate,
// FAlertContent,
// FPlanQty,
// FFinishQty,
// FQualifiedStockInQty,
// FQualifiedRate,
// FPickMtrlStatus,
// FPickMtlQty)
// SELECT Newid() FId,0,'分公司','铸铁','一车间','MO735736-1','BSH41-100B','08-03~08-18','2021-08-04 10:03:36','未按时开工','360.00','0.00','288.00','--','部分领料','0.00/20.00'
//");
//最终还是换存储过程,格式也是上面这种
return String.Format(@"/*dialect*/EXEC SP_TEST");
}
protected override void PlugInInsertDatas(string tableName)
{
base.PlugInInsertDatas(tableName);
Dictionary<string, int> dicBillTypeIsProcessTrack = this.GetBillTypeIsProcessTrack();
string sql = string.Format("delete from {0}", tableName);
DBUtils.Execute(this.Context, sql);
sql = GetInsertSql(tableName, dicBillTypeIsProcessTrack.Keys.ToList());
DBUtils.Execute(this.Context, sql);
}
protected virtual System.Collections.Generic.Dictionary<string, int> GetBillTypeIsProcessTrack()
{
Kingdee.BOS.Core.SqlBuilder.QueryBuilderParemeter para = new Kingdee.BOS.Core.SqlBuilder.QueryBuilderParemeter
{
FormId = "BOS_BillType",
SelectItems = Kingdee.BOS.Core.Metadata.SelectorItemInfo.CreateItems("FBILLTYPEID"),
FilterClauseWihtKey = "FBILLFORMID='PRD_MO'"
};
Kingdee.BOS.Orm.DataEntity.DynamicObjectCollection dynamicObjectCollection = AppServiceContext.QueryService.GetDynamicObjectCollection(base.Context, para, null);
System.Collections.Generic.Dictionary<string, int> dictionary = new System.Collections.Generic.Dictionary<string, int>();
foreach (Kingdee.BOS.Orm.DataEntity.DynamicObject current in dynamicObjectCollection)
{
string text = current["FBILLTYPEID"].ToString();
Kingdee.BOS.Orm.DataEntity.DynamicObject dynamicObject = AppServiceContext.BusinessDataService.LoadBillTypePara(base.Context, "MoBillTypeParaSetting", text, true);
int num = System.Convert.ToInt32(dynamicObject["IsProcessTrack"]);
if (num == 0)
{
dictionary.Add(text, num);
}
}
return dictionary;
}
}
}
最后还是希望总部既然出了这个功能,还是要多做案例,这东西藏着掖着用的人会越来越少
最后的最后:感谢王老师!
麻烦请问一下最后注册是注册到哪里呢?我看看板返回值里面也没有注册过插件
牛
【emoji】
车间管理--看板应用自定义插件
本文2024-09-16 17:47:58发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-18017.html