推式生单配置

by RainBirda 2015.7.14 09:45
 注:脚本执行有风险,对于客户正式环境请在研发指导下执行。 下面的示例是销售订单转调出单的SQL脚本,可按自己的需求进行修改,将脚本放到相应模块下的PostSQL文件夹中即可。   效果图    --定义变量 DECLARE @SourceEntity BIGINT --来源单据实体 DECLARE @TargetEntity BIGINT --目标单据实体 DECLARE @StartSN BIGINT DECLARE @RefType VARCHAR(50) --单据类型参照UID(Container) --ID写死,按照文档说明顺序递增 SET @StartSN=3015011001 --调出单参照UID SET @RefType = 'f96ec85b-120d-4fdb-a43c-f5097809a2df' --目的单据 调出单 SELECT @TargetEntity = Local_ID FROM UBF_MD_Class WHERE FullName = 'UFIDA.U9.InvDoc.TransferOut.TransferOut' --来源单据 销售订单 SELECT @SourceEntity = Local_ID FROM UBF_MD_Class WHERE FullName = 'UFIDA.U9.SM.SO.SO' --先删除 @SourceEntity @TargetEntity 为主键 DELETE FROM Base_PushToDocTypeConfig_Trl WHERE ID IN (SELECT ID FROM Base_PushToDocTypeConfig WHERE SourceEntity = @SourceEntity AND TargetEntity = @TargetEntity) DELETE FROM Base_PushToDocTypeConfig WHERE SourceEntity = @SourceEntity AND TargetEntity = @TargetEntity DELETE FROM Base_PushToDocTypeConfig_Trl WHERE ID = @StartSN DELETE FROM Base_PushToDocTypeConfig WHERE ID = @StartSN --新增 INSERT INTO Base_PushToDocTypeConfig (ID, CreatedOn, ModifiedOn, CreatedBy, ModifiedBy, Application, SourceEntity, TargetEntity, TargetDocTypeReference, --[来源单据类型], [AttrExpression1],--属性表达式1 [AttrType1],--属性类型 [UIParam1],--UI参数 [UserAttr1],--使用条件 [ParamName1],--参数名称 --[业务类型], [AttrExpression2], [AttrType2], [UIParam2], [UserAttr2], [ParamName2], --[调拨类型], [AttrExpression3], [AttrType3], [UIParam3], [UserAttr3], [ParamName3]) VALUES ( @StartSN, Getdate(), Getdate(), 'admin', 'admin', 3015, @SourceEntity, @TargetEntity, @RefType, --[来源单据类型(参照类型)], 'SrcDocType', 'UFIDA.U9.SM.SO.SODocType', '26242049-2e2a-4797-96c3-3429b9a9463b',--当条件为参照时预置参照的ID,否则取这个类型参照的第一个 'AttrName1', 'SrcDocType', --[业务类型], 'BusinessType', 'UFIDA.U9.Base.Doc.BusinessTypeEnum', '', 'AttrName2', 'BusinessType', --[调拨类型], 'TransferType', 'UFIDA.U9.InvDoc.Enums.TransferTypeEnum', '1,2',--当条件为枚举时预置枚举的值的范围,用逗号隔开,如果不预置则取枚举的全部 'AttrName3', 'TransferType' ) INSERT INTO Base_PushToDocTypeConfig_trl (ID, SysMLFlag, AttrName1, AttrName2, AttrName3) VALUES (@StartSN, 'zh-CN', '来源单据类型', '业务类型', '调拨类型')   注意:目的单据类型可根据调拨类型或业务类型自动过滤,但是当它们为空时,目的单据类型显示所有的。    

列表删除公共方法

by majiea 2014.7.16 08:53
列表通用删除
public static void Delete(IUIView view, BaseAction action) [更多...]

关于弱引用字段在查询列表中的显示问题

by 马杰 2012.8.31 08:52
注:脚本执行有风险,对于客户正式环境请在研发指导下执行。    弱引用字段由于需要规避逆向引用问题,在元数据中类型一般为长整形。如果客户在查询列表中拖出该字段,则显示为长整形,客户视之为乱码!   推荐的解法 增加一个表达式sql函数,通过配置查询方案计算列实现  另外经过测试查询方案计算列目前只支持sql函数

Tags:

BASECBO

领料单料品参照sql

by 马杰 2012.8.20 15:31
注:脚本执行有风险,对于客户正式环境请在研发指导下执行。  SELECT    A.[ID] AS [ID]                               FROM      MO_MOPickList AS A                    INNER JOIN [CBO_ItemMaster] AS A1 ON ( A.[ItemMaster] = A1.[ID] )                    LEFT JOIN [CBO_InventoryInfo] AS A2 ON ( A1.[InventoryInfo] = A2.[ID] )                    LEFT JOIN [MO_MO] AS A3 ON ( A.[MO] = A3.[ID] )                    LEFT JOIN [CBO_ItemMasterVersion] AS A4 ON ( A.[ItemVersion] = A4.[ID] )                    LEFT JOIN [Base_Organization] AS A5 ON ( A.[SupplyOrg] = A5.[ID] )                    LEFT JOIN Base_Language AS A7 ON ( A7.Code = 'zh-CN' )                                                     AND ( A7.Effective_IsEffective = 1 )                    LEFT JOIN [Base_Organization_Trl] AS A6 ON ( A6.SysMlFlag = 'zh-CN' )                                                              AND ( A6.SysMlFlag = A7.Code )                                                              AND ( A5.[ID] = A6.[ID] )                    LEFT JOIN [CBO_Wh] AS A8 ON ( A.[SupplyWh] = A8.[ID] )                    LEFT JOIN [CBO_Wh_Trl] AS A9 ON ( A9.SysMlFlag = 'zh-CN' )                                                    AND ( A9.SysMlFlag = A7.Code )                                                    AND ( A8.[ID] = A9.[ID] )                    LEFT JOIN [CBO_Bin] AS A10 ON ( A.[SupplyBin] = A10.[ID] )                    LEFT JOIN [CBO_Bin_Trl] AS A11 ON ( A11.SysMlFlag = 'zh-CN' )                                                      AND ( A11.SysMlFlag = A7.Code )                                                      AND ( A10.[ID] = A11.[ID] )                    LEFT JOIN [Base_UOM] AS A12 ON ( A1.[InventorySecondUOM] = A12.[ID] )                    LEFT JOIN [Base_UOM_Trl] AS A13 ON ( A13.SysMlFlag = 'zh-CN' )                                                       AND ( A13.SysMlFlag = A7.Code )                                                       AND ( A12.[ID] = A13.[ID] )                    LEFT JOIN [Base_UOM] AS A14 ON ( A.[IssueUOM] = A14.[ID] )                    LEFT JOIN [Base_UOM] AS A15 ON ( A.[RcvUOM] = A15.[ID] )                    LEFT JOIN [CBO_MfgInfo] AS A16 ON ( A1.[MfgInfo] = A16.[ID] )                    LEFT JOIN [CBO_Project] AS A17 ON ( A.[Project] = A17.[ID] )                    LEFT JOIN [CBO_Project] AS A18 ON ( A3.[Project] = A18.[ID] )                    LEFT JOIN [MO_MO] AS A19 ON ( A.[MO] = A19.[ID] )                    LEFT JOIN [MO_MODocType] AS A20 ON ( A19.[MODocType] = A20.[ID] )          WHERE     ( ( 1 = 1 )                      AND ( ( 1 = 1 )                            AND ( ( ( ( ( ( ( ( ( ( CASE WHEN ( A.[MaterialType] = 0 )                                                         THEN dbo.fn_MOIssueDoc_GetRoundValue(A.[IssueUOM],                                                              ( CASE                                                              WHEN ( ( ( A19.[IsStartQtyPicking] = 1 )                                                              AND ( A19.[ProductQty] != A19.[TotalStartQty] )                                                              )                                                              AND ( A.[QtyType] = 1 )                                                              )                                                              THEN dbo.fn_MOIssueDoc_GetRoundValue(A.[IssueUOM],                                                              ( A19.[TotalStartQty]                                                              * A.[QPA] ))                                                              ELSE A.[ActualReqQty]                                                              END * ( 1                                                              + A.[StandardMaterialScale] ) ))                                                         ELSE ( CASE                                                              WHEN ( ( ( A19.[IsStartQtyPicking] = 1 )                                                              AND ( A19.[ProductQty] != A19.[TotalStartQty] )                                                              )                                                              AND ( A.[QtyType] = 1 )                                                              )                                                              THEN dbo.fn_MOIssueDoc_GetRoundValue(A.[IssueUOM],                                                              ( A19.[TotalStartQty]                                                              * A.[QPA] ))                                                              ELSE A.[ActualReqQty]                                                              END                                                              + A.[FixedMaterialNum] )                                                    END - A.[IssuedQty] )                                                  - A.[IssueNotDeliverQty] ) > 0 )                                              AND ( A.[IssueStyle] != 4 )                                            )                                            AND ( ( ( A.[IsIssueOrgFixed] = 1 )                                                    AND ( A.[SupplyOrg] = 1001108305632979 )                                                  )                                                  OR ( A.[IsIssueOrgFixed] != 1 )                                                )                                          )                                          AND ( A19.[Org] = 1001108305632979 )                                        )                                        AND ( ( ( A19.[IsStartQtyPicking] = 1 )                                                AND ( A19.[DocState] = 2 )                                              )                                              OR ( ( A19.[IsStartQtyPicking] = 0 )                                                   AND ( ( A19.[DocState] = 1 )                                                         OR ( A19.[DocState] = 2 )                                                       )                                                 )                                            )                                      )                                      AND ( A19.[IsHoldRelease] = 0 )                                    )                                    AND ( A19.[Cancel_Canceled] = 0 )                                  )                                  AND ( A20.[BusinessType] = 47 )                                )                          )                    )                    AND A.ID=1001204100470476       

Tags:

BASECBO

关于报表取枚举名称clr函数GetEnumName报错问题

by 马杰 2012.8.17 14:45
注:脚本执行有风险,对于客户正式环境请在研发指导下执行。    如果报错为F_GetEnumName,Error 那么确定为加载的枚举项中存在多语言信息丢失的问题,需要补下多语言信息   注意:不是当前的多语项丢失,而在存在丢失的项所以报错!          string retval = null;            try            {                EnumValueStoreInstance evsi = DataStore.ExtEnumValueTable;                retval = (string)evsi.GetDisplayName( Code, Evalue, SysMLFlag);                return retval;            }            catch (Exception e)            {                return "<<F_GetEnumName,Error>>";            }   补上杨砚的分析: private void LoadTypeData(){    this.EnumTypeList= new SortedList<string, EnumTypeInfo>(0xbb8, StringComparer.OrdinalIgnoreCase);    this.BlackList= new SortedList<string, long>();    try    {        this.EnumValueCount= 0;        using (SqlConnection connection = new SqlConnection(Constant.ConnStr))        {            connection.Open();            SqlDataReader reader = new SqlCommand("select b.Code, b.ID , COUNT(*) as c  from UBF_Sys_ExtEnumValue as a  left join UBF_Sys_ExtEnumType as b on ( a.ExtEnumType = b.ID )  group by b.Code ,b.ID order by Code", connection).ExecuteReader();            using (reader)            {                while (reader.Read())                {                    if (!reader.IsDBNull(0))                    {                        string key = reader.GetString(0);                        EnumTypeInfo info = new EnumTypeInfo();                        info.ID = reader.GetInt64(1);                        info.Count = reader.GetInt32(2);                        this.EnumTypeList.Add(key, info);                        if (info.Count >= 200)                        {                            this.BlackList.Add(key, info.ID);                            BlackEnumCacheUnit unit = new BlackEnumCacheUnit();                            if (this._BlackEnumValueCache == null)                            {                                this._BlackEnumValueCache = new SortedDictionary<long, BlackEnumCacheUnit>();                            }                            this._BlackEnumValueCache.Add(info.ID, unit);                        }                        else                        {                            this.EnumValueCount += info.Count;                        }                    }                }            }        }    }上面标黄色部分的代码,是取出所有枚举类型的枚举项个数。 这段代码是根据上一步得出的个数,一次性加载后,逐一遍历枚举项。因此在执行F_GetEnumName(xxx,’5141’) 取5141这项时空引用,而是中间某一项为空,导致空引用异常。客户现场没办法调试,猜测解决。解决之后,仔细看了看杨历发的邮件,问题差不多,但也有不同,之前邮件说的是出错的那项枚举信息为空,而实际上只要有空值,都可能发生异常。主要是因为一次性加载。  

大冶“IsMFGConfigEnable”升级问题补丁日志和Portal日志@杨历@玄武G

by 马杰 2012.7.19 10:09
注:脚本执行有风险,对于客户正式环境请在研发指导下执行。问题分析 ---------------------Portal日志中存在的内容如下----------------------- A.[IsMFGConfigEnable] as [IsMFGConfigEnable], A3.[Code] as SysMlFlag from  CBO_ItemMaster as A 。。。 。。。 <ErrTO xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">   <Msg>列名 'IsMFGConfigEnable' 无效。</Msg>   <ET>System.Data.SqlClient.SqlException</ET>   <Views> <ViewErr>   由于CBO_ItemMaster表属于PUB补丁,所以检查PUB补丁升级日志U9V25.PUB.1001207110000004install.log 果然: [Info] [2012-07-16 11:41:28] 影响行数:-1 [Info] [2012-07-17 01:04:48] 执行sql出错:Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.sql:Delete_Table_Indexes 'CBO_ItemMaster' [Info] [2012-07-17 02:28:08] 执行sql出错:Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.sql:Delete_Def_Constraint 'CBO_ItemMaster'          … …   由于CBO_ItemMaster 的数据量显然不应该在执行这两句时产生1个多小时的时间。而U9升级程序在升级过程中会自动停止所有U9工作进程。 所以,怀疑是存在第三方程序不断的访问CBO_ItemMaster表。造成升级失败。   解决方法:          1:升级前首先停止对CBO_ItemMaster表访问的第三方程序          2:删除PUB补丁在数据库内的记录 delete from [system_InstalledAppModulePack] where Code = ' U9V25.PUB.1001207110000004'       3:删除上次元数据升级过程中升级在中间状态的字段 delete ubf_md_attribute where ID in ( select a.ID from ubf_md_attribute as a join UBF_MD_Class as c on ( a.MD_Class_ID = c.ID )    where c.DefaultTableName = 'CBO_ItemMaster' and a.Name = 'IsMFGConfigEnable' )         4:执行补丁同步。     5:然后应该就可以了。     ----------------------解决方案---------------------

Tags:

BASECBO

关于附件的权限-采购订单审核后附件不可修改新增的处理方式

by 马杰 2012.7.4 15:23
注:脚本执行有风险,对于客户正式环境请在研发指导下执行。    给附件增加数据权限针对增,删,改的情况:   Attachment.EntityFullName!='UFIDA.U9.PM.PO.PurchaseOrder' or (Attachment.EntityFullName=='UFIDA.U9.PM.PO.PurchaseOrder' and GetAttachmentDocConditionValue(Attachment.EntityFullName,FloatToStr(Attachment.EntityID),'Status<2')==1)    说明:GetAttachmentDocConditionValue 函数传入实体全名,实体ID,条件表达式 返回1 表达成立 返回0标示不成立   具体实体请自行处理,上面的例子中 表达式'Status<2' 中Status是对应录入单据的状态字段,2是枚举值对应的核准。整个表达式含义状态为非核准的可以编辑!  'UFIDA.U9.PM.PO.PurchaseOrder'  需要从元数据查询中找到!

Tags:

BASECBO

关于第三方接口导入数据报不符合值集错误问题分析

by 马杰 2012.7.4 10:41
注:脚本执行有风险,对于客户正式环境请在研发指导下执行。 原始问题描述: 把业务员作为私有段数据引用类型,添加到单据的会计科目的必填项。 并且添加过滤:Org.Code=GetCurrentOrgCode() 调用API给私有字段传值业务员编码,用API调用服务生单一直提示:上下文为[全局段],名称为[报销人]的段,其编码[803205]不符合值集定义,请重新录入 数据库已经查明:业务员的组织就是当前组织 而且在前台用参照又能选出来此业务员,通过编码查找。 经过排查: 校验SQL exec sp_executesql N'select  A.[ID] as [ID], A.[Code] as [Code], A1.[Name] as [Name], '''' as [DependantCode], A2.[Code] as SysMlFlag from  CBO_Operators as A  left join Base_Language as A2 on (A2.Effective_IsEffective = 1)  left join [CBO_Operators_Trl] as A1 on (A1.SysMlFlag = A2.Code) and (A.[ID] = A1.[ID])  left join [Base_Organization] as A3 on (A.[Org] = A3.[ID]) where  ((A3.[Code] = @__m101_0) and A.[Code] in (''700477''))',N'@__m101_0 nvarchar(4000)',@__m101_0=NULL GetCurrentOrgCode 返回值为空   确认通过第三方接口初始化上下文不会处理OrgCode! 建议的处理方式:  1   第三方接口自行传入OrgCode  2   修改值集约束条件为Org=GetCurrentOrgID()    

Tags:

BASECBO

实体修改或者删除debug备忘

by 马杰 2012.6.18 15:34
注:脚本执行有风险,对于客户正式环境请在研发指导下执行。\\u9blog\CCViews\UBFCode_INV\U9.VOB.UBF\ADF\Model\Persistence\Business\Entity\Entity\EntityObjectNotificationImpl.cs    

Tags:

BASECBO

上下文相关取值

by 马杰 2012.6.14 10:44
注意 后台赋值时有保护:
using (Util.Context.SystemWritablePolicy p = new SystemWritablePolicy())
{
context[PlatformContext.ORG_ID] = Convert.ToString(targetOrgId);
}
[更多...]

Tags:

BASECBO

弹性域下发参数同步脚本

by 马杰 2012.6.4 15:11
注:脚本执行有风险,对于客户正式环境请在研发指导下执行。同步弹性域下发参数脚本--特殊使用.sql (2.49 kb)    

Tags:

BASECBO

判断G档是否处于下发模式

by 马杰 2012.5.24 16:16
注:脚本执行有风险,对于客户正式环境请在研发指导下执行。  UFIDA.U9.CBO.Pub.Controller.BaseObject.EntitytIsSend(string EntityTypeFullName)    

Tags:

BASECBO

值集值设置权限通用方法

by 马杰 2012.5.11 09:52
值集值设置权限通用方法 [更多...]

附件相关

by 马杰 2012.4.25 10:09
注:脚本执行有风险,对于客户正式环境请在研发指导下执行。select AttachmentID,FileHandler,EntityFullName,EntityID from Base_Attachment where  AttachType IN (1,3) select * from CS_BASE_FileInfo  where ID=AttachmentID select * from 文档库.dbo.FileInfo where  ID=Base_Attachment.FileHandler select * from 文档库.dbo.FileInfo where  ID=CS_BASE_FileInfo.Handler

Tags:

BASECBO

G档新增字段支持下发步骤

by 马杰 2012.4.25 10:03
注:脚本执行有风险,对于客户正式环境请在研发指导下执行。 1  BE增加字段  2 往CBO_ObjectAttribute预置数据  3 升级CBO_AttributeController    --[维度-按照需求分类控制]DECLARE @EntityType bigint,@AttributeID bigint,@StartSN bigint,@BaseObjectClassUId uniqueidentifier,@BaseAttributeUId uniqueidentifier,@BaseObjectID bigint,@org bigint,@index bigint   DECLARE org_cursor   CURSOR FOR select ID  from Base_organization  SET @BaseObjectID=11SELECT @EntityType = local_id FROM ubf_md_class WHERE FullName = 'UFIDA.U9.CBO.SCM.Item.ItemMRPInfo'SELECT @BaseAttributeUId=ID,@AttributeID = Local_ID FROM UBF_MD_Attribute WHERE Local_Class_ID = @EntityType AND [Name] = 'IsControlByDC' if @AttributeID is not null and not exists(select 1 from CBO_ObjectAttribute where Attribute=@AttributeID and BaseObject=@BaseObjectID) INSERT INTO CBO_ObjectAttribute (ID,Attribute,IsSend,IsCanBeModified,BaseObject,IsSystem,U_ID) VALUES (1,@AttributeID,1,1,@BaseObjectID,0,@BaseAttributeUId)    set @index=10000  OPEN org_cursor   FETCH NEXT FROM org_cursor INTO @org  WHILE @@FETCH_STATUS = 0   BEGIN    if not exists(select 1 from CBO_AttributeController where ControlAttribute='IsControlByDC' and Org=@org and ControlEntityType='UFIDA.U9.CBO.SCM.Item.ItemMRPInfo')    insert into CBO_AttributeController(ID,CreatedOn,CreatedBy,ModifiedOn,ModifiedBy,SysVersion,ControlAttribute,IsCanBeModified,UpFloat,DownFloat,ControlEntityType,RelativeMainEntityType,Org,IsPropertyType,IsSystem,ControlObj,IsSend,U_ID)    VALUES(@index,getdate(),'sys',GETDATE(),'sys',0,'IsControlByDC',1,0.000000000,0.000000000,'UFIDA.U9.CBO.SCM.Item.ItemMRPInfo',null,@org,0,0,11,1,@BaseAttributeUId)    set @index=@index+10       FETCH NEXT FROM org_cursor INTO @org  end  close org_cursor  DEALLOCATE org_cursor    UPDATE CBO_AttributeController SET U_ID=@BaseAttributeUId WHERE ControlAttribute='IsControlByDC' and ControlEntityType='UFIDA.U9.CBO.SCM.Item.ItemMRPInfo'       

Tags:

BASECBO

同步编码到编码结构段上

by 马杰 2012.4.25 10:00
解决一些客户的关键性弹性域段值为空的情况
[更多...]

Tags:

BASECBO

关于自定义值集依赖的设置要素

by 马杰 2012.4.19 18:08
注:脚本执行有风险,对于客户正式环境请在研发指导下执行。  设置如下:特别是关联字段不能弄错,否则前台名称是出不来的!

Tags:

BASECBO

列表自增按钮通用脚本

by 马杰 2012.4.1 16:14
用于列表自增的按钮与Grid联动 兼容权限 [更多...]

关于IIS7下附件上传大小限制修改方法

by 马杰 2012.3.22 14:24
IIS7下的默认设置限制了上传大小。这个时候Web.Config中的大小设置也就失效了。 [更多...]

Tags:

BASECBO

参照支持多通配符查询

by 马杰 2012.2.29 14:00
注:脚本执行有风险,对于客户正式环境请在研发指导下执行。  update Base_Profile set DefaultValue='True' where Code='CBO_IsUseMatchChar'   9201201170001   38所器材规格比较长,例如:CC41L-0603-CG-50V-3.3P,现在系统支持前端或者按后端查询,但38所前端后端相同的规格很多,这样做效率低,只能进行精确输入。38所原来系统支持CC41LL%3.3查询,前后符合这种规则的料品都会显示。请支持,谢谢!   需要打开参数'CBO_IsUseMatchChar' 即可!    

Tags:

BASECBO

RecentComments

评论 RSS

Statistics

989 篇文章
0 个单页
546301 条评论
11 次评分
244322 次访问
访问统计开始于 2019年9月14日
平均日访问 7881 次
当前 207 人在线