U9培训记录
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Common.targets(2318,5): error MSB3091: 任务失败,因为未找到“resgen.exe”,
或未安装正确的 Microsoft Windows SDK。
任务正在注册表项 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A\WinSDK-NetFx35Tools-x86 的 InstallationFolder 值中所指定位置下的“bin”子目录中查找“resgen.exe”。
--C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\
通过执行下列操作之一可以解决此问题:
1) 安装 Microsoft Windows SDK。
2) 安装 Visual Studio 2010。
3) 手动向正确的位置设置上面的注册表项。
4) 将正确的位置传入任务的“ToolPath”参数中。 [D:\Code\BE\WorkApplyBE\Deploy\WorkApplyBE.Deploy.csproj]
解决方法如下:
电脑上有的
C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin 就两个文件夹 NETFX 4.0 Tools 和 x64 报错时需要复制两个文件过来
找安装了..net 3.5或者是vs2010的机器上面 到
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin里
复制 ResGen.exe 和 resgen.exe.config
.\..\..\UBFV50\U9.VOB.Product.Metadata\App\UFIDA.U9.CBO.PubBE.MetaData.dll
.\..\UBFV50\U9.VOB.Product.Metadata\UBF\UFIDA.U9.Base.BaseBE.MetaData.dll
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
添加U9两个基础实体引用
添加2个引用,在发布对象栏目中,在选择目录中,将APP下面的UFIDA.U9.CBO.PubBE.MetaData和UBF下面的UFIDA.U9.Base.BaseBE.MetaData拖放到解决方案页签的Reference引用下。
(注:在引用解决方案时,先要双击打开所引用的MetaData,然后拖到Reference中)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
添加U9系统的2个基本UI 引用和客开的UI引用;
(UI->UFIDA.U9.CBO.Ref.BaseReferenceUI.MetaData
和UI->UFIDA.U9.CBO.Ref.CBOReferenceUI.MetaData)
把要显示的实体属性一个个拖到界面中。(ID和事务版本栏位设置隐藏)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
UI给控件赋默认值,UI的解决方案会生成三个文件夹,Action、Model、WebPart
在Model文件夹里修改界面的默认值
public override void AfterInitModel()
{
this.CustSO.FiledBussinessDate.DefaultValue=DateTime.Now;//CustSO是建的UI界面,BussinessDate是BE里面建的字段
}
在WebPart文件夹里的JiangWorkApplyUIFormWebPartCodeBehindExtend.cs里可以修改弹性域还有查询按钮的设置 以及 设置默认行号
public void AfterCreateChildControls()
{
//开启个性化
UFIDA.U9.UI.PDHelper.PersonalizationHelper.SetPersonalizationEnable((BaseWebForm)this, true);
//查询按钮设置
PDFormMessage.ShowConfirmDialog(this.Page, "5d46aade-63f8-469e-9512-84ea1d2d95c1 ", "580", "408", "标题名称", wpFindID.ClientID, this.BtnFind, null);
//弹性域设置
//处理表头弹性域
FlexFieldHelper.SetDescFlexField(new DescFlexFieldParameter[] { new DescFlexFieldParameter(this.FlexFieldPicker0, this.Model.WorkApplyHead) });
//处理表体弹性域处理,需要UIForm中表体最后一列添加一个Text的列.平台代码自动实现,DescFlexField为BE里定义的扩展字段名称
FlexFieldHelper.SetDescFlexField(this.DataGrid5, this.DataGrid5.Columns.Count - 1, "DescFlexField");
//查询按钮设置
PDFormMessage.ShowConfirmDialog(this.Page, "007a3c50-39d3-4223-8ce6-8f9952d6daae", "580", "408", "改为自己的参照的FormID", wpFindID.ClientID, this.BtnFind, null);
//取得提示信息资源:是否删除当前记录
string message = PDResource.GetDeleteConfirmInfo();
//绑定注册弹出对话框到删除按钮
PDFormMessage.ShowConfirmDialog(this.Page, message, "", this.BtnDelete);
PDFormMessage.ShowConfirmDialog(this.Page, "确认放弃当前记录?", "", this.BtnCancel);
//设置默认行号
GetProfileValueProxy bpObj = new GetProfileValueProxy();//需要添加引用:\U9.VOB.Product.Component\UBF\UFIDA.U9.Base.BaseBP.Deploy.dll和UFIDA.U9.Base.BaseBP.Agent.dll文件。
bpObj.ProfileCode = "SysLineNo";
PVDTOData pVTDOData = bpObj.Do();
//行GRID
((IAutoRowNo)this.DataGrid5.Columns["RowNo"]).Sequence = true;
((IAutoRowNo)this.DataGrid5.Columns["RowNo"]).SequenceStep = Int32.Parse(pVTDOData.ProfileValue);
((IAutoRowNo)this.DataGrid5.Columns["RowNo"]).SequenceStart = Int32.Parse(pVTDOData.ProfileValue);
}
在按钮事件里 获取当时页面提交的数据
this.Model.WorkApplyHead.FocusedRecord.SysVersion //获取当前的数据
this.Action.NavigateAction.Refresh(null); //按钮事件里 刷新页面
this.docNO131.ReadOnly = true;//设为只读状态 已弃用
((IUIFieldBindingDataBindControl)this.docNO131).ReadOnly = true; //单据表头里面(上部分)里的字段设为只读状态
//表格里的列单号,改为只读
((UFSoft.UBF.UI.WebControlAdapter.UFWebTextBoxColumnWrapper)this.DataGrid5.Columns["DocNo"]).Enable = false;//表格列单号,改为只读
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--在BE中设置枚举的默认值时,如果默认值填的是-1那么界面显示时可以留空
--同步单个枚举
declare @FN varchar(550),
@ClsID bigint,
@UID varchar(50)
select @FN='UFIDA.U9.Cust.VW.SO.SOSPRBE.VWPubBE.YearAreaTypeEnum' --此处只需填入你要更新的枚举FullName(自已建的枚举的全名称),示例为标准产品的业务员类型枚举
select @ClsID=Local_ID,@UID=ID from UBF_MD_Class where FullName =@FN and ClassType=3
select @ClsID,@UID
--先删除已有的数据
delete from UBF_Sys_ExtEnumType_Trl where ID=@ClsID or ID in (select ID from ubf_sys_extenumtype where UID=@UID)
delete from ubf_sys_extenumtype where ID=@ClsID or UID=@UID
delete from UBF_Sys_ExtEnumValue_Trl where ID in (select ID from ubf_sys_extenumvalue where ExtEnumType=@ClsID or ExtEnumTypeUID=@UID)
delete from ubf_sys_extenumvalue where ExtEnumType=@ClsID or ExtEnumTypeUID=@UID
--下面为插入最新数据
insert into ubf_sys_extenumtype
select local_id as id,'20101111','demo','20101111','demo',0,fullname as code,isextend,id as uid,0
from ubf_md_class where Local_ID = @ClsID
insert into ubf_sys_extenumtype_trl
select a.local_id as id,'zh-CN',b.[displayname] as [name],b.[Description]
from ubf_md_class a
left join ubf_RES_resourcevalue b on cast(a.[iD] as varchar(50)) = cast(b.resourcename as varchar(50))
where Local_ID = @ClsID
insert into ubf_sys_extenumvalue
select a.local_id as id,'20101111','demo','20101111','demo',0,a.[Local_Class_ID] as ExtEnumType ,
a.[name] as code,a.defaultvalue as evalue,issystem,md_class_id as ExtEnumTypeUID
from ubf_md_attribute as a
inner join ubf_md_class as b on cast(a.md_class_id as varchar(50))=cast(b.id as varchar(50))
where b.Local_ID = @ClsID
insert into ubf_sys_extenumvalue_trl
select a.local_id as id,'zh-CN',c.[displayname] as [name]
from ubf_md_attribute as a
inner join ubf_md_class as b on cast(a.md_class_id as varchar(50))=cast(b.id as varchar(50))
left join ubf_RES_resourcevalue c on cast(a.[ID] as varchar(50)) = cast(c.resourcename as varchar(50))
where b.Local_ID = @ClsID
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
这里控制按钮状态 在WebPart文件夹里Extend.cs中的
public void AfterUIModelBinding()
{
//这里控制按钮状态
}
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
BP实例化用代理类 引用BP解决方案里面的 BpAgent\bin下面的dll文件UFIDA.U9.WK.Jiang.JiangWorkApplyBP.Agent.dll和UFIDA.U9.WK.Jiang.JiangWorkApplyBP.Deploy.dll,
代理类的类名为原BP类后面加上Proxy , BP组件只需要发布一次
UFIDA.U9.WK.Jiang.JiangWorkApplyBP.Proxy.ApproveSOProxy bpSo = new Jiang.JiangWorkApplyBP.Proxy.ApproveSOProxy();
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
BP 里面的DO方法
public override object Do(object obj)
{
CreatCustSO bpObj = (CreatCustSO)obj;
//get business operation context is as follows
//IContext context = ContextManager.Context
//auto generating code end,underside is user custom code
//and if you Implement replace this Exception Code...
if (bpObj == null)
return null;
if (bpObj.SODataDTOList == null || bpObj.SODataDTOList.Count == 0)
throw new Exception("请选择数据");
long createSOID = 0;
using (ISession session= Session.Open())
{
UFIDA.U9.Cust.CustTrain.CBO.CustTrainBE.CustSO custso = UFIDA.U9.Cust.CustTrain.CBO.CustTrainBE.CustSO.Create();
UFIDA.U9.Cust.CustTrain.CBO.CustTrainBE.CustSODocType docType = UFIDA.U9.Cust.CustTrain.CBO.CustTrainBE.CustSODocType.Finder.Find("DocHeaderSequenceStyle=0");
if (docType == null)
throw new Exception("请维护客开销售订单的单据类型,且编号方式为“自动编号”");
custso.SODocType = docType;
custso.BusinessDate = DateTime.Now;
U9.CBO.SCM.Customer.Customer customer = U9.CBO.SCM.Customer.Customer.Finder.FindByID(bpObj.SODataDTOList[0].Customer);
custso.CustomerKey = customer.Key;
UFIDA.U9.Cust.CustTrain.CBO.CustTrainBE.CustSOLine soLine = null;
//设置默认行号
GetProfileValueProxy bpObjLineNo = new GetProfileValueProxy();
//需要添加引用:..\U9.VOB.Product.Component\UBF\UFIDA.U9.Base.BaseBP.Deploy.dll和UFIDA.U9.Base.BaseBP.Agent.dll文件。
bpObjLineNo.ProfileCode = "SysLineNo";
PVDTOData pVTDOData = bpObjLineNo.Do();
int docLine = Convert.ToInt32(pVTDOData.ProfileValue);
foreach (SODataDTO dto in bpObj.SODataDTOList)
{
soLine = UFIDA.U9.Cust.CustTrain.CBO.CustTrainBE.CustSOLine.Create(custso);
soLine.DocLineNo = docLine;
UFIDA.U9.CBO.SCM.Item.ItemMaster item = UFIDA.U9.CBO.SCM.Item.ItemMaster.Finder.FindByID(dto.Item);
if (item == null)
throw new Exception("传入料品ID字段找不到相关数据");
soLine.ItemMasterKey = item.Key;
soLine.Price = dto.Price;
soLine.Qty = dto.Qty;
soLine.Money = dto.Price * dto.Qty;
soLine.UOM = item.InventoryUOM;
docLine += Convert.ToInt32(pVTDOData.ProfileValue);
}
session.Commit();
createSOID = custso.ID;
}
return createSOID;
}
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
客户与料品的实体都在 APP/UFIDA.U9.CBO.PubBE.dll里
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
在BP与BE代码里获取当前组织的ID,需要引用D:\Yonyou\UBFV50\U9.VOB.Product.UBF\UBFStudio\Runtime\UFIDA.U9.Base.BaseBE.dll
D:\Yonyou\UBFV50\U9.VOB.Product.UBF\UBFStudio\Runtime\UFIDA.U9.Base.BaseBE.Deploy.dll
D:\Yonyou\UBFV50\U9.VOB.Product.UBF\UBFStudio\Runtime\UFIDA.U9.Base.Util.dll
UFIDA.U9.Base.Context.LoginOrg.ID // 在BP与BE代码里获取当前组织的ID.UI里不能用
PlatformContext.Current.OrgID //UI代码里获取当前组织的ID
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
在浏览器里查看Grid中的字段名称 让到该form的url 然后在地址后面加上&__dm=true
http://192.168.0.98/U9/ufsoft/simple.aspx?lnk=aba2a55e-cb1a-4cb9-95ec-086a714880e0&chromeType=4&ShowType=ShowModal&ParentTaskID=a5af675a-cf25-4007-a9dd-a12c3fc0ad49&__sk=__SK88543&__curOId=1001609280000268&RefereshThis=1&ShowAtlasModalDialog=true&__dm=true
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#region 自定义数据初始化加载和数据收集
private void OnLoadData_Extend(object sender)
{
if (this.Model.JiangWorkApplyUI2HeadView==null)
{
this.Model.JiangWorkApplyUI2HeadView.AddNewUIRecord(); //防止数据为空
}
OnLoadData_DefaultImpl(sender);
}
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
弹出指定的formid
this.ShowModalDialog("948ddddb-5598-4115-b9f5-2fd4ecdced6a", "加工清单", "960", "520", null, null);
this.ShowAtlasModalDialog("948ddddb-5598-4115-b9f5-2fd4ecdced6a", "加工清单", "960", "520", this.TaskId.ToString(), null,false,false,false);
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
页面绑定数据清除代码
this.Model.JiangWorkApplyUI2SubView.Records.Clear();
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
实体名称 客户 Customer app目录下 命名空间为 ufida.u9.cbo.scm.customer::Customer 程序集为 ufida.u9.cbo.pubbe.dll 后台的所有BE程序集在ApplicationServer\libs目录下
实体名称 料品 ItemMaster app目录下 命名空间为 UFIDA::U9::CBO::SCM::Item::ItemMaster 程序集为 UFIDA.U9.CBO.PubBE.dll
实体名称 销售订单 SO app目录下 命名空间为 UFIDA::U9::SM::SO::SO 程序集为 UFIDA.U9.SM.SMBE.dll
实体名称 销售订单行 SOLine app目录下 命名空间为 UFIDA::U9::SM::SO::SOLine 程序集为 UFIDA.U9.SM.SMBE.dll
实体名称 销售订单子行 SOShipline app目录下 命名空间为 UFIDA::U9::SM::SO::SOShipline 程序集为 UFIDA.U9.SM.SMBE.dll
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
用sql 查询 引用 D:\Yonyou\UBFV50\U9.VOB.Product.UBF\UBFStudio\Runtime\UFSoft.UBF.Util.Data.dll
D:\Yonyou\UBFV50\U9.VOB.Product.UBF\UBFStudio\Runtime\UFSoft.UBF.Util.DataAccess.dll
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
BusinessEntity 业务实体基类 所有的BE类多会继承该类 public abstract class BusinessEntity : Entity
WorkApplySub.EntityList workApplyEntityList = WorkApplySub.Finder.FindAll(sb.ToString()); //BE类查询操作 得到多条结果
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
取form里面的数据
string doccode = this.doccode164.Text;
//另一种获取方法
// string doccode = this.Model.JiangWorkApplyUI2HeadView.FocusedRecord.doccode;
//当页面上面没有数据时 想查询所有数据, 先把mode添加一条默认的实现
#region 自定义数据初始化加载和数据收集
private void OnLoadData_Extend(object sender)
{
if (this.Model.JiangWorkApplyUI2HeadView==null)
{
//对当前的View产生一个新的记录对象并加入View的记录集中.
int index=this.JiangWorkApplyUI2HeadView.FocuseedIndex;
IUIRecord newRecord= this.Model.JiangWorkApplyUI2HeadView.AddNewUIRecord(); //防止数据为空,在卡片做"新增"等操作时,需要增加一条空Record,这条记录与界面完成绑定,达到清空界面的效果
if(this.JiangWorkApplyUI2HeadView.RecordCount==0 || index<0) index=0;
this.JiangWorkApplyUI2HeadView.Records.Insert(index,newRecord);
this.JiangWorkApplyUI2HeadView.FocuseRecord=newRecord;
}
OnLoadData_DefaultImpl(sender);
}
------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
表格列单号,改为只读
((UFSoft.UBF.UI.WebControlAdapter.UFWebTextBoxColumnWrapper)this.DataGrid5.Columns["DocNo"]).Enable = false;//表格列单号,改为只读
------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
关闭当前窗体
this.CloseDialog(true);
------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
获取Grid中选中行的数据
this.Model.JiangWorkApplyUI2SubView.GetSelectRecords()
跨页面传输数据 当前缓存对象,Session级
this.CurrentSessionState["custSOID"] = "需要传输到其它页面的值或对象";
当前缓存对象,Page级
this.CurrentState["custSOID"] = "需要传输到其它页面的值或对象";
用法:
private void BtnOk_Click_Extend(object sender, EventArgs e)
{
//调用模版提供的默认实现.--默认实现可能会调用相应的Action.
if (this.Model.InstrumentDoorHeadView.SelectRecords.Count > 0)
{
CurrentState["WKInstrumentDoor"] = this.Model.InstrumentDoorHeadView;
}
else
{
throw new Exception("请选择要生成的单据行");
}
CloseDialog(true);
BtnOk_Click_DefaultImpl(sender,e);
}
//获取列表中选择的数据,代码写在列表UI里
private void OnOk0_Click_Extend(object sender, EventArgs e)
{
IList<IUIRecord> list = this.Model.POShipLine.Cache.GetSalectRecord(); //获取选中的行 放到集合list中去
foreach(IUIRecord record in list)
{
string po = record["MainID"].ToString();//主实体的ID
string id = record["ID"].ToString();//销售订单行(子实体的ID)
}
}
页面加载UIModel之前,指定跳转到指定的记录id
public void BeforeUIModelBinding()
{
if (this.CurrentSessionState["custID"]!=null)
{
this.Action.NavigateAction.MovePageAt(null, Convert.ToInt32(this.CurrentSessionState["custID"]));
this.CurrentSessionState["custID"] = null;
}
}
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
单据界面调转到列表:
private void ListClick_Extend(object sender, UIActionEventArgs e)
{
this.CurrentPart.NavigatePage("列表的URI(装配 工具里面)", null);
}
列表跳转到单据:
private void OnGridRowDbClick_Extend(object sender, UIActionEventArgs e)//默认双击行事件
{
string dataId = this.CurrentModel.ItemMatchParameter.FocusedRecord["MainID"].ToString();
OnNavigatCard("Browse", dataId, "单据界面的URI(装配工具中)"); //调用下面自已写的方法
//调用模版定义的默认实现方法.如需扩展,请直接在此编程.
this.OnGridRowDbClick_DefaultImpl(sender,e);
}
private void OnNavigatCard(string type, string dataID, string formID)
{
string FormID = formID;//AddFormID
string DataID = dataID;
System.Collections.Specialized.NameValueCollection nameValCol = new System.Collections.Specialized.NameValueCollection();
nameValCol.Add("PDPageStatus", type);//参数:界面状态
nameValCol.Add("ID", DataID);//参数ID
this.CommonAction.CurrentPart.NavigatePage(FormID, nameValCol);
}
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------