學習金蝶軟件過程當中學習到的東西,作總結,方便往後查閱!
\1. 新建解決方案。名稱空間:命名要求表達準確,無歧義web
\2. 斷點調試。sql
\3. 值監控。數據庫
FCustomerID數組
this.View.Model.GetValue("FCustomerID")瀏覽器
引用 using Kingdee.BOS.Core.Bill.PlugIn;this.View.Model.SetValue this.View.Model.GetValue服務器
--插件說明 [Description("表單插件")]ide
--熱啓動 [Kingdee.BOS.Util.HotUpdate]學習
表單插件引用 using Kingdee.BOS.Core.Bill.PlugIn;測試
this.View.Model.SetValue this.View.Model.GetValuethis
--插件說明 [Description("表單插件")]
--熱啓動 [Kingdee.BOS.Util.HotUpdate]
--調用值更新事件 this.View.InvokeFieldUpdateService
經常使用的表單插件屬性
this.View.GetFormTitle()------獲取單據標題
this.View.Model.DataObject["Id"]---獲取表單Fid
this.View.Model.GetPKValue---獲取表單Fid
this.View.GetControl("F_PAEZ_Remarks ").SetFocus()-------設置焦點
this.View.GetControl("F_PAEZ_Remarks").Enabled = false; ----鎖定字段
this.View.GetFieldEditor("F_PAEZ_Remarks ", 0).Enabled = false;----單據體行鎖定字段
this.View.GetControl("F_PAEZ_Remarks").Visible = false; ----隱藏字段
this.View.GetMainBarItem("tbSave").Enabled = false;----鎖定按鈕
this.View.GetMainBarItem("tbSave").Visible = false;---- 隱藏按鈕
this.View.UpdateView("F_SB_SumOutAmount")前臺刷新,不和服務器交互。
this.View.Refresh----整個頁面刷新,要和服務器交互,把後臺數據庫數據刷新過來
this.View.InvokeFormOperation("Save")---調用表單事件
經常使用的單據體屬性插件
this.View.Model.DeleteEntryData("FEntity");--刪除單據體信息
this.View.Model.DeleteEntryRow("FEntity",0);--刪除單據體信息
this.View.Model.CreateNewEntryRow("FEntity");-建立新行
this.View.Model.CopyEntryRow("FEntity",0,1,false);--複製一行。
this.View.Model.GetEntryPKValue("FEntity", 0);--獲取單據體FENTRYID內碼
this.View.Model.GetEntryRowCount("FEntity")---獲取單據體行數。
經常使用的提示信息框\1.
this.View.ShowMessage("你好");
\2.
this.View.ShowErrMessage("錯誤信息提示");
\3.
引用using Kingdee.BOS.Core.DynamicForm;
this.View.ShowMessage("信息提示?",
MessageBoxOptions.YesNo, new Action<MessageBoxResult>((result) =>
{
if (result == MessageBoxResult.Yes)
{
}
else if (result == MessageBoxResult.No)
{
return;
}
}));
提示信息:
終止、重試、忽略
是、否、取消\4. 警告
this.View.ShowWarnningMessage("不能對其進行操做,請確認。", action:(result) =>
{
this.View.Close();
});
BarItemClick點擊事件
public override void BarItemClick(Core.DynamicForm.PlugIn.Args.BarItemClickEventArgs e)
- e.BarItemKey方法
- e.Cancel方法
BeforeSave點擊事件
public override void BeforeSave (Core.DynamicForm.PlugIn.Args.BeforeSaveEventArgs e)
\1. e.Cancel方法AfterSave點擊事件
public override void AfterSave(Kingdee.BOS.Core.Bill.PlugIn.Args.AfterSaveEventArgs e)
e.OperationResult.IsSuccess方法
引用using Kingdee.BOS.App.Data;
執行sql語句 /*dialect*/DataChanged點擊事件
public override void DataChanged(DataChangedEventArgs e)
e.Field.Key---變化的值
e.NewValue---變化後的值
e.OldValue---變化前的值
e.Row----單據體變化的行。AfterBindData事件
public override void AfterBindData(EventArgs e)
這個是一個數據綁定後事件。這個事件是單據新增,編輯,查詢加載後最後一個事件。
this.View.OpenParameter.Status.Equals(OperationStatus.ADDNEW)
這個方法是判斷單據狀態。有四種:ADDNEW、EDIT、VIEW、DISASSEMBLY
新增、編輯、查看、卸載
CustomEvents事件之簡單的條碼掃描實例:
---用到的事件
public override void CustomEvents(CustomEventsArgs e)
條碼示例:
[1.01.001@20190102@190102@TS00001](mailto:1.01.001@20190102@190102@TS00001)
1.01.002@20190202@190202@TS00002
1.01.231-0298-000@20181202@191202@TS00003
CH4441@20181202@191202@TS00004
用到如下方法:
e.Key.Equals("F_SB_TM")----判斷變動的是那個元素控件
e.EventName == "EnterKeyPressed"----捕獲回車事件
this.View.GetControl("F_SB_TM").SetFocus();----設置焦點
-----字符串拆分數組
string[] strArray = this.View.Model.GetValue("FScomOne").ToString().Trim().Split('@');
--獲取單據體行數
this.Model.GetEntryRowCount("FEntity");
-----建立新行
this.View.Model.CreateNewEntryRow("FEntity");
-----彈出錯誤提示,清空數據,指向焦點。
this.View.ShowMessage("條碼位數出錯,請檢查。。。", MessageBoxOptions.OK,
new Action<MessageBoxResult>((result) =>
{
this.Model.SetValue("F_SB_TM", "");
this.View.GetControl("F_SB_TM").SetFocus();
}));
引用dllKingdee.BOS.dll
Kingdee.BOS.Core.dll
Kingdee.BOS.App.dll
Kingdee.BOS.Orm.DataEntity.dll
使用using
using System;
using System.Collections.Generic;
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.App.Data;
using System.Data;
using Kingdee.BOS.Orm.DataEntity;
**一.執行sql語句返回Int,表示影響了多少行**
DBUtils.Execute(this.Context, "/*dialect*/update T_SAL_OUTSTOCKENTRY set FNOTE='測試'");
**二.執行sql語句返回DataSet**
DataTable dt = DBUtils.ExecuteDataSet(this.Context, "/*dialect*/select FMATERIALID,FNumber from T_BD_MATERIAL where FUSEORGID=100006").Tables[0];
for (int i = 0; i < dt.Rows.Count; i++)
{
this.View.Model.CreateNewEntryRow("FEntity");
this.View.Model.SetValue("FMaterialID", dt.Rows[i]["FMATERIALID"].ToString(), i);
this.View.InvokeFieldUpdateService("FMaterialID", i);
this.View.Model.SetValue("FEntrynote", dt.Rows[i]["FNumber"].ToString(), i);
}
this.View.UpdateView("FEntity");
**三.執行sql語句返回IEnumerable**
IEnumerable<IDataRecord> itemDataTable = DBUtils.ExecuteEnumerable(this.Context, "/*dialect*/select FMATERIALID,FNumber from T_BD_MATERIAL where FUSEORGID=100006");
int i = 0;
foreach (IDataRecord drItem in itemDataTable)
{
this.View.Model.CreateNewEntryRow("FEntity");
this.View.Model.SetValue("FMaterialID", drItem["FMATERIALID"].ToString(), i);
this.View.InvokeFieldUpdateService("FMaterialID", i);
this.View.Model.SetValue("FEntrynote", drItem["FNumber"].ToString(), i);
i++;
}
this.View.UpdateView("FEntity");
**四.執行sql語句返回DynamicObjectCollection**
DynamicObjectCollection Dyobj = DBUtils.ExecuteDynamicObject(this.Context, "/*dialect*/select FMATERIALID,FNumber from T_BD_MATERIAL where FUSEORGID=100006");
int j = 0;
foreach(DynamicObject obj in Dyobj)
{
this.View.Model.CreateNewEntryRow("FEntity");
this.View.Model.SetValue("FMaterialID", obj["FMATERIALID"].ToString(), j);
this.View.InvokeFieldUpdateService("FMaterialID", j);
this.View.Model.SetValue("FEntrynote", obj["FNumber"].ToString(), j);
j++;
}
this.View.UpdateView("FEntity");
上下文,記錄一些公用的信息,好比當前登錄用戶、組織、鏈接的數據庫、區域等等信息,只要是基於Cloud的開發,基本不多有不用的時候。
CurrentOrganizationInfo
當前組織信息
CurrentOrganizationInfo.ID
當前登陸組織id
CurrentOrganizationInfo.Name
當前登陸組織的名稱
CurrentUserTimeZone
當前用戶時區
DatabaseType
數據庫類型
IsMultiOrg
是不是多組織數據中心
UserId
當前用戶Id
UserName
當前用戶名稱
DBId
數據庫ID
UserEmail
登陸用戶郵箱
UserPhone
登陸用戶移動電話
引用:Kingdee.BOS.dll
Kingdee.BOS.Core.dll
Kingdee.BOS.DataEntity
使用
using System;
using Kingdee.BOS;
using Kingdee.BOS.Core.Bill.PlugIn;
using System.ComponentModel;
using Kingdee.BOS.Core.List;
using Kingdee.BOS.Core.Enums;
using Kingdee.BOS.Core.DynamicForm;
新建一個listShowParameter實例
ListShowParameter listShowParameter = new ListShowParameter();
\1. FormId你要調用那個單據的列表。
listShowParameter.FormId = "SAL_SaleOrder";
\2. IsLookUp彈出的列表界面是否有「返回數據」按鈕
listShowParameter.IsLookUp = true;
\3. 列表顯示類型
顯示基本信息
listShowParameter.ListType = Convert.ToInt32(BOSEnums.Enu_ListType.BaseList);
所有顯示
listShowParameter.ListType = Convert.ToInt32(BOSEnums.Enu_ListType.List);
\4. 是否顯示覆選框。默認是true,若是false就是不顯示
listShowParameter.MultiSelect = false;
\5. 接受返回值
this.View.ShowForm(listShowParameter, delegate(FormResult result)
{
object returnData = result.ReturnData;
if (returnData is ListSelectedRowCollection)
{
ListSelectedRowCollection listSelectedRowCollection = returnData as ListSelectedRowCollection;
if (listSelectedRowCollection != null)
{
DynamicObjectDataRow datarow = (DynamicObjectDataRow)listSelectedRowCollection[0].DataRow;
this.View.Model.SetValue("F_PAEZ_Text",datarow.DynamicObject["FID"].ToString()) ;
}
}
});
JSONObject webobj = new JSONObject();webobj["source"] = @"http://www.baidu.com";
webobj["height"] = 600;
webobj["width"] = 910;
webobj["isweb"] = false; //是否新彈出一個瀏覽器窗(or選項卡)打開網頁地址金蝶軟件學習總結
學習金蝶軟件過程當中學習到的東西,作總結,方便往後查閱!
- 常量+流水號。
- 常量+日期+流水號:天天流水號從新開始。
- 常量+組織+流水號:
能夠用發展的視角去看待「數字化」,理理相關數字化的概念(信息數字化、流程數字化、業務數字化),就差很少能夠清楚數字化、數字化轉型是怎麼回事兒了。首先,信息數字化:諸如數字相機,數字電視,微軟的辦公軟件(Word、Excel、PowerPoint)這些將人類經過感官獲取的信息轉化成計算機能夠認知的形式;
其次,流程數字化:好比,生產製造使用的ERP系統,營銷使用的CRM系統,供應鏈管理(SCM)系統,辦公流程(OA)系統,可以利用計算機處理已經被數字化的信息,將工做流程數字化,可以提升工做協同和資源利用的效率,通常都是企業在用;
第三,業務數字化:就是商業模式的技術化,涉及到不只是企業自己,而是一個生態,用企業內部與外部生態的數據支撐,打破企業甚至是行業壁壘,業務+技術缺一不可。
以上,知悉~數字化轉型就不難理解了,涉及到其中任意一種,均可稱之爲轉型,只不過層次不一樣而已。
業務場景:採購寄存業務,某公司採購由於倉庫有限,商品比較緊張,須要提早備貨,因此每次採購的商品,須要先寄存到供應商那裏。等倉庫有地方後在進行實際入庫。
寄存單的使用流程圖以下
\1. 新建解決方案。名稱空間:命名要求表達準確,無歧義
\2. 斷點調試。
\3. 值監控。
FCustomerID
this.View.Model.GetValue("FCustomerID")
引用 using Kingdee.BOS.Core.Bill.PlugIn;this.View.Model.SetValue this.View.Model.GetValue
--插件說明 [Description("表單插件")]
--熱啓動 [Kingdee.BOS.Util.HotUpdate]
表單插件引用 using Kingdee.BOS.Core.Bill.PlugIn;
this.View.Model.SetValue this.View.Model.GetValue
--插件說明 [Description("表單插件")]
--熱啓動 [Kingdee.BOS.Util.HotUpdate]
--調用值更新事件 this.View.InvokeFieldUpdateService
經常使用的表單插件屬性
this.View.GetFormTitle()------獲取單據標題
this.View.Model.DataObject["Id"]---獲取表單Fid
this.View.Model.GetPKValue---獲取表單Fid
this.View.GetControl("F_PAEZ_Remarks ").SetFocus()-------設置焦點
this.View.GetControl("F_PAEZ_Remarks").Enabled = false; ----鎖定字段
this.View.GetFieldEditor("F_PAEZ_Remarks ", 0).Enabled = false;----單據體行鎖定字段
this.View.GetControl("F_PAEZ_Remarks").Visible = false; ----隱藏字段
this.View.GetMainBarItem("tbSave").Enabled = false;----鎖定按鈕
this.View.GetMainBarItem("tbSave").Visible = false;---- 隱藏按鈕
this.View.UpdateView("F_SB_SumOutAmount")前臺刷新,不和服務器交互。
this.View.Refresh----整個頁面刷新,要和服務器交互,把後臺數據庫數據刷新過來
this.View.InvokeFormOperation("Save")---調用表單事件
經常使用的單據體屬性插件
this.View.Model.DeleteEntryData("FEntity");--刪除單據體信息
this.View.Model.DeleteEntryRow("FEntity",0);--刪除單據體信息
this.View.Model.CreateNewEntryRow("FEntity");-建立新行
this.View.Model.CopyEntryRow("FEntity",0,1,false);--複製一行。
this.View.Model.GetEntryPKValue("FEntity", 0);--獲取單據體FENTRYID內碼
this.View.Model.GetEntryRowCount("FEntity")---獲取單據體行數。
經常使用的提示信息框\1.
this.View.ShowMessage("你好");
\2.
this.View.ShowErrMessage("錯誤信息提示");
\3.
引用using Kingdee.BOS.Core.DynamicForm;
this.View.ShowMessage("信息提示?",
MessageBoxOptions.YesNo, new Action<MessageBoxResult>((result) =>
{
if (result == MessageBoxResult.Yes)
{
}
else if (result == MessageBoxResult.No)
{
return;
}
}));
提示信息:
終止、重試、忽略
是、否、取消\4. 警告
this.View.ShowWarnningMessage("不能對其進行操做,請確認。", action:(result) =>
{
this.View.Close();
});
BarItemClick點擊事件
public override void BarItemClick(Core.DynamicForm.PlugIn.Args.BarItemClickEventArgs e)
- e.BarItemKey方法
- e.Cancel方法
BeforeSave點擊事件
public override void BeforeSave (Core.DynamicForm.PlugIn.Args.BeforeSaveEventArgs e)
\1. e.Cancel方法AfterSave點擊事件
public override void AfterSave(Kingdee.BOS.Core.Bill.PlugIn.Args.AfterSaveEventArgs e)
e.OperationResult.IsSuccess方法
引用using Kingdee.BOS.App.Data;
執行sql語句 /*dialect*/DataChanged點擊事件
public override void DataChanged(DataChangedEventArgs e)
e.Field.Key---變化的值
e.NewValue---變化後的值
e.OldValue---變化前的值
e.Row----單據體變化的行。AfterBindData事件
public override void AfterBindData(EventArgs e)
這個是一個數據綁定後事件。這個事件是單據新增,編輯,查詢加載後最後一個事件。
this.View.OpenParameter.Status.Equals(OperationStatus.ADDNEW)
這個方法是判斷單據狀態。有四種:ADDNEW、EDIT、VIEW、DISASSEMBLY
新增、編輯、查看、卸載
CustomEvents事件之簡單的條碼掃描實例:
---用到的事件
public override void CustomEvents(CustomEventsArgs e)
條碼示例:
[1.01.001@20190102@190102@TS00001](mailto:1.01.001@20190102@190102@TS00001)
1.01.002@20190202@190202@TS00002
1.01.231-0298-000@20181202@191202@TS00003
CH4441@20181202@191202@TS00004
用到如下方法:
e.Key.Equals("F_SB_TM")----判斷變動的是那個元素控件
e.EventName == "EnterKeyPressed"----捕獲回車事件
this.View.GetControl("F_SB_TM").SetFocus();----設置焦點
-----字符串拆分數組
string[] strArray = this.View.Model.GetValue("FScomOne").ToString().Trim().Split('@');
--獲取單據體行數
this.Model.GetEntryRowCount("FEntity");
-----建立新行
this.View.Model.CreateNewEntryRow("FEntity");
-----彈出錯誤提示,清空數據,指向焦點。
this.View.ShowMessage("條碼位數出錯,請檢查。。。", MessageBoxOptions.OK,
new Action<MessageBoxResult>((result) =>
{
this.Model.SetValue("F_SB_TM", "");
this.View.GetControl("F_SB_TM").SetFocus();
}));
引用dllKingdee.BOS.dll
Kingdee.BOS.Core.dll
Kingdee.BOS.App.dll
Kingdee.BOS.Orm.DataEntity.dll
使用using
using System;
using System.Collections.Generic;
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Core.DynamicForm;
using Kingdee.BOS.App.Data;
using System.Data;
using Kingdee.BOS.Orm.DataEntity;
**一.執行sql語句返回Int,表示影響了多少行**
DBUtils.Execute(this.Context, "/*dialect*/update T_SAL_OUTSTOCKENTRY set FNOTE='測試'");
**二.執行sql語句返回DataSet**
DataTable dt = DBUtils.ExecuteDataSet(this.Context, "/*dialect*/select FMATERIALID,FNumber from T_BD_MATERIAL where FUSEORGID=100006").Tables[0];
for (int i = 0; i < dt.Rows.Count; i++)
{
this.View.Model.CreateNewEntryRow("FEntity");
this.View.Model.SetValue("FMaterialID", dt.Rows[i]["FMATERIALID"].ToString(), i);
this.View.InvokeFieldUpdateService("FMaterialID", i);
this.View.Model.SetValue("FEntrynote", dt.Rows[i]["FNumber"].ToString(), i);
}
this.View.UpdateView("FEntity");
**三.執行sql語句返回IEnumerable**
IEnumerable<IDataRecord> itemDataTable = DBUtils.ExecuteEnumerable(this.Context, "/*dialect*/select FMATERIALID,FNumber from T_BD_MATERIAL where FUSEORGID=100006");
int i = 0;
foreach (IDataRecord drItem in itemDataTable)
{
this.View.Model.CreateNewEntryRow("FEntity");
this.View.Model.SetValue("FMaterialID", drItem["FMATERIALID"].ToString(), i);
this.View.InvokeFieldUpdateService("FMaterialID", i);
this.View.Model.SetValue("FEntrynote", drItem["FNumber"].ToString(), i);
i++;
}
this.View.UpdateView("FEntity");
**四.執行sql語句返回DynamicObjectCollection**
DynamicObjectCollection Dyobj = DBUtils.ExecuteDynamicObject(this.Context, "/*dialect*/select FMATERIALID,FNumber from T_BD_MATERIAL where FUSEORGID=100006");
int j = 0;
foreach(DynamicObject obj in Dyobj)
{
this.View.Model.CreateNewEntryRow("FEntity");
this.View.Model.SetValue("FMaterialID", obj["FMATERIALID"].ToString(), j);
this.View.InvokeFieldUpdateService("FMaterialID", j);
this.View.Model.SetValue("FEntrynote", obj["FNumber"].ToString(), j);
j++;
}
this.View.UpdateView("FEntity");
上下文,記錄一些公用的信息,好比當前登錄用戶、組織、鏈接的數據庫、區域等等信息,只要是基於Cloud的開發,基本不多有不用的時候。
CurrentOrganizationInfo
當前組織信息
CurrentOrganizationInfo.ID
當前登陸組織id
CurrentOrganizationInfo.Name
當前登陸組織的名稱
CurrentUserTimeZone
當前用戶時區
DatabaseType
數據庫類型
IsMultiOrg
是不是多組織數據中心
UserId
當前用戶Id
UserName
當前用戶名稱
DBId
數據庫ID
UserEmail
登陸用戶郵箱
UserPhone
登陸用戶移動電話
引用:Kingdee.BOS.dll
Kingdee.BOS.Core.dll
Kingdee.BOS.DataEntity
使用
using System;
using Kingdee.BOS;
using Kingdee.BOS.Core.Bill.PlugIn;
using System.ComponentModel;
using Kingdee.BOS.Core.List;
using Kingdee.BOS.Core.Enums;
using Kingdee.BOS.Core.DynamicForm;
新建一個listShowParameter實例
ListShowParameter listShowParameter = new ListShowParameter();
\1. FormId你要調用那個單據的列表。
listShowParameter.FormId = "SAL_SaleOrder";
\2. IsLookUp彈出的列表界面是否有「返回數據」按鈕
listShowParameter.IsLookUp = true;
\3. 列表顯示類型
顯示基本信息
listShowParameter.ListType = Convert.ToInt32(BOSEnums.Enu_ListType.BaseList);
所有顯示
listShowParameter.ListType = Convert.ToInt32(BOSEnums.Enu_ListType.List);
\4. 是否顯示覆選框。默認是true,若是false就是不顯示
listShowParameter.MultiSelect = false;
\5. 接受返回值
this.View.ShowForm(listShowParameter, delegate(FormResult result)
{
object returnData = result.ReturnData;
if (returnData is ListSelectedRowCollection)
{
ListSelectedRowCollection listSelectedRowCollection = returnData as ListSelectedRowCollection;
if (listSelectedRowCollection != null)
{
DynamicObjectDataRow datarow = (DynamicObjectDataRow)listSelectedRowCollection[0].DataRow;
this.View.Model.SetValue("F_PAEZ_Text",datarow.DynamicObject["FID"].ToString()) ;
}
}
});
JSONObject webobj = new JSONObject();webobj["source"] = @"http://www.baidu.com";
webobj["height"] = 600;
webobj["width"] = 910;
webobj["isweb"] = false; //是否新彈出一個瀏覽器窗(or選項卡)打開網頁地址
webobj["title"] = "百度";
this.View.AddAction("ShowKDWebbrowseForm", webobj);
this.View.SendDynamicFormAction(this.View);
文章持續更新,若是喜歡,請拿起大家可愛的小手,給我點個贊吧!點贊是一種積極的生活態度,贊一個吧!
webobj["title"] = "百度";
this.View.AddAction("ShowKDWebbrowseForm", webobj);
this.View.SendDynamicFormAction(this.View);
文章持續更新,若是喜歡,請拿起大家可愛的小手,給我點個贊吧!點贊是一種積極的生活態度,贊一個吧!