コード例 #1
0
        //定义
        private object CreateTargetBillView(BusinessInfo oBusinessInfo)
        {
            string            formId = oBusinessInfo.GetForm().Id;
            BillOpenParameter param  = new BillOpenParameter(formId, null);

            param.SetCustomParameter("formID", formId);
            param.SetCustomParameter("pk", 0);
            param.SetCustomParameter("status", OperationStatus.ADDNEW);
            param.SetCustomParameter("PlugIns", oBusinessInfo.GetForm().CreateFormPlugIns());
            param.Context      = this.Context;
            param.FormMetaData = ((FormMetadata)Kingdee.BOS.Contracts.ServiceFactory.GetMetaDataService(this.Context).Load(this.Context, formId, true));
            param.LayoutId     = param.FormMetaData.GetLayoutInfo().Id;
            param.PkValue      = 0;
            param.Status       = OperationStatus.ADDNEW;
            object service = oBusinessInfo.GetForm().GetFormServiceProvider(false).GetService(typeof(IDynamicFormView));

            (service as IBillViewService).Initialize(param, oBusinessInfo.GetForm().GetFormServiceProvider(false));
            (service as IBillView).OpenParameter.Status = OperationStatus.ADDNEW;
            try
            {
                (service as IBillViewService).LoadData();
            }
            catch (Exception ex)
            {
            }

            return(service);
        }
コード例 #2
0
        /// <summary>
        /// 根据单据体内码,加载单据内码
        /// </summary>
        /// <param name="targetBusinessInfo"></param>
        /// <param name="entityKey"></param>
        /// <param name="entityIds"></param>
        /// <returns></returns>
        private HashSet <long> LoadTargetBillIds(
            BusinessInfo targetBusinessInfo,
            string entityKey,
            HashSet <long> entityIds)
        {
            // 根据单据体内码,读取取下游单据的单据内码
            HashSet <long> billIds = new HashSet <long>();
            Entity         entity  = targetBusinessInfo.GetEntity(entityKey);

            if (entity is HeadEntity)
            {
                foreach (var billId in entityIds)
                {
                    billIds.Add(billId);
                }
            }
            else
            {
                string entityPKFieldNameAs       = string.Concat(entity.Key, "_", entity.EntryPkFieldName);
                QueryBuilderParemeter queryParem = new QueryBuilderParemeter()
                {
                    FormId       = targetBusinessInfo.GetForm().Id,
                    BusinessInfo = targetBusinessInfo,
                };
                queryParem.SelectItems.Add(new SelectorItemInfo(targetBusinessInfo.GetForm().PkFieldName));
                queryParem.SelectItems.Add(new SelectorItemInfo(entityPKFieldNameAs));
                queryParem.ExtJoinTables.Add(
                    new ExtJoinTableDescription()
                {
                    TableName   = "table(fn_StrSplit(@EntryPKValue,',',1))",
                    TableNameAs = "sp",
                    FieldName   = "FID",
                    ScourceKey  = entityPKFieldNameAs,
                });
                queryParem.SqlParams.Add(new SqlParam("@EntryPKValue", KDDbType.udt_inttable, entityIds.ToArray()));

                IQueryService           queryService = ServiceHelper.GetService <IQueryService>();
                DynamicObjectCollection rows         = queryService.GetDynamicObjectCollection(this.Context, queryParem);
                foreach (var row in rows)
                {
                    long billId = Convert.ToInt64(row[0]);
                    if (billIds.Contains(billId) == false)
                    {
                        billIds.Add(billId);
                    }
                }
            }
            return(billIds);
        }
コード例 #3
0
        public static bool CheckFeature(BudgetVerifyEntity verifyEntity, BusinessInfo businessInfo)
        {
            string id       = businessInfo.GetForm().Id;
            string subsysId = businessInfo.GetForm().SubsysId;
            bool   flag     = false;

            if (verifyEntity.bExpenseBudget && ((subsysId == "ER") || (id == "AP_OtherPayable")))
            {
                return(true);
            }
            if (verifyEntity.bCapitalBudget && ((subsysId == "8") || (subsysId == "SC")))
            {
                return(true);
            }
            if (((verifyEntity.bBusinessBudget && (subsysId != "ER")) && ((subsysId != "8") && (subsysId != "SC"))) && (id != "AP_OtherPayable"))
            {
                flag = true;
            }
            return(flag);
        }
コード例 #4
0
        public override void OnPreparePropertys(PreparePropertysEventArgs e)
        {
            //string s=this.BusinessInfo.GetForm().Id;
            List <string[]> colKey = GetColKeyToArray(BusinessInfo.GetForm().Id, "F_PAEZ_ENTITYPROPERTIES");

            // 如下代码行,指定字段xxxxx的Key,强制要求加载字段
            for (int i = 0; i < colKey[0].Length; i++)
            {
                e.FieldKeys.Add(colKey[0][i]);
            }
        }
        /// <summary>
        /// 打开PC的Web页面,暂时不好用
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="FormId"></param>
        /// <param name="pkid"></param>
        /// <returns></returns>
        private IDynamicFormView OpenWebView(Context ctx, string FormId, string pkid = null)
        {
            var          meta = MetaDataServiceHelper.Load(ctx, FormId) as FormMetadata;
            BusinessInfo info = meta.BusinessInfo;
            var          form = info.GetForm();

            BillOpenParameter param = new BillOpenParameter(form.Id, null);

            //param.SetCustomParameter("formID", form.Id);
            //param.SetCustomParameter("status", (pkid != null ? "View" : "AddNew"));
            //param.SetCustomParameter("formID", form.CreateFormPlugIns());
            param.Context               = ctx;
            param.ServiceName           = form.FormServiceName;
            param.PageId                = Guid.NewGuid().ToString();
            param.FormMetaData          = meta;
            param.LayoutId              = param.FormMetaData.GetLayoutInfo().Id;
            param.Status                = pkid != null ? OperationStatus.EDIT : OperationStatus.ADDNEW;
            param.PkValue               = pkid;
            param.CreateFrom            = CreateFrom.Default;
            param.ParentId              = 0;
            param.GroupId               = "";
            param.DefaultBillTypeId     = null;
            param.DefaultBusinessFlowId = null;
            param.SetCustomParameter("ShowConfirmDialogWhenChangeOrg", false);

            //IResourceServiceProvider provider = form.GetFormServiceProvider();
            //IDynamicFormView bv = provider.GetService(typeof(IDynamicFormView)) as IDynamicFormView;
            //(bv as IBillViewService).Initialize(param, provider);
            //(bv as IDynamicFormView).RegisterPlugIn(getFormStatePlugIn);
            Type             type = Type.GetType("Kingdee.BOS.Web.Import.ImportBillView,Kingdee.BOS.Web");
            IDynamicFormView bv   = (IDynamicFormView)Activator.CreateInstance(type);
            var provider          = form.GetFormServiceProvider();

            (bv as IBillViewService).Initialize(param, provider);
            (bv as IBillView).CreateNewModelData();
            if (param.Status != OperationStatus.ADDNEW)
            {
                (bv as IBillViewService).LoadData();
            }
            return(bv);
        }
コード例 #6
0
        public void GetBudgetDimensionInfo()
        {
            DynamicObjectCollection objects = this.dyRptScheme["DimensionEntity"] as DynamicObjectCollection;

            this.dicDimensionInfo.Clear();
            this.dicDimensionField.Clear();
            int num = 1;

            foreach (DynamicObject obj2 in objects)
            {
                DynamicObject obj3 = obj2["DimensionID"] as DynamicObject;
                if (((obj3 != null) && (Convert.ToString(obj3["BaseDataType_Id"]) != "BM_BUDGETCALENDAR")) && (Convert.ToString(obj3["BaseDataType_Id"]) != "BM_DEPTORG"))
                {
                    string        str    = Convert.ToString(obj3["Category"]);
                    string        formId = Convert.ToString(obj3["BaseDataType_Id"]);
                    int           key    = Convert.ToInt32(obj3["Id"]);
                    DimensionInfo info   = new DimensionInfo {
                        Id              = key,
                        Name            = Convert.ToString(obj3["Name"]),
                        Category        = str,
                        DataControlType = 1
                    };
                    if (str == "10")
                    {
                        formId               = "BOS_ASSISTANTDATA_SELECT";
                        info.PKFieldName     = "FEntryID";
                        info.TableName       = "T_BAS_ASSISTANTDATAENTRY";
                        info.NumberFieldName = "FNUMBER";
                        info.NameFieldName   = "FDATAVALUE";
                        info.NameTableName   = "T_BAS_ASSISTANTDATAENTRY_L";
                    }
                    else
                    {
                        info.FormId = formId;
                        BusinessInfo demensionMetaData = this.GetDemensionMetaData(formId);
                        info.PKFieldName = demensionMetaData.GetForm().PkFieldName;
                        string nameFieldKey = demensionMetaData.GetForm().NameFieldKey;
                        if (!string.IsNullOrWhiteSpace(nameFieldKey))
                        {
                            info.NameFieldName = nameFieldKey;
                            if (demensionMetaData.GetField(nameFieldKey) is MultiLangTextField)
                            {
                                info.NameTableName = demensionMetaData.GetField(nameFieldKey).TableName + "_L";
                            }
                            else
                            {
                                info.NameTableName = demensionMetaData.GetField(nameFieldKey).TableName;
                            }
                        }
                        info.NumberFieldName = demensionMetaData.GetForm().NumberFieldKey;
                        info.TableName       = demensionMetaData.GetField(demensionMetaData.GetForm().NumberFieldKey).TableName;
                        int baseDataType = ServiceHelper.GetService <IOrganizationService>().GetBaseDataType(base.Context, formId);
                        if (baseDataType == 2)
                        {
                            string masterPKFieldName = demensionMetaData.GetForm().MasterPKFieldName;
                            if (!string.IsNullOrWhiteSpace(masterPKFieldName))
                            {
                                info.DataControlType   = baseDataType;
                                info.MasterIDFieldName = masterPKFieldName;
                            }
                        }
                    }
                    if (this.filterParameter.DicDimissionFilter.ContainsKey(key))
                    {
                        info.IsShowField = true;
                        string str5 = string.Format("FDIMENSIONID{0}", num);
                        string str6 = string.Format("FDIMENSIONNAME{0}", num);
                        info.ShowFieldId   = str5;
                        info.ShowFieldName = str6;
                        this.dicDimensionField.Add(str5, str6);
                        num++;
                    }
                    else
                    {
                        info.IsShowField = false;
                    }
                    this.dicDimensionInfo.Add(key, info);
                }
            }
        }
コード例 #7
0
ファイル: SaleQuoteService.cs プロジェクト: gordonjie/VTRERP
        /// <summary>
        /// 根据销售报价明细分录创建产品代码
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="info">销售报价单模型信息</param>
        /// <param name="saleQuoteEntryRows">销售报价单表体分录集合信息</param>
        /// <param name="option"></param>
        /// <returns></returns>
        public IOperationResult CreateProductMaterial(Context ctx, BusinessInfo info, DynamicObject[] saleQuoteEntryRows, OperateOption option, DynamicObject dynamicO = null)
        {
            IOperationResult result = new OperationResult();

            result.IsSuccess = false;


            DynamicObject customer = dynamicO["CustId"] as DynamicObject;//客户信息

            //if (customer == null)
            //{
            //    throw new KDBusinessException("", "产品创建失败:请先录入客户信息!");
            //}
            string custName = (customer == null) ? "" : customer["Name"].ToString();
            long   userId   = (long)dynamicO["SaleOrgId_Id"];       //使用组织
            string billno   = Convert.ToString(dynamicO["BillNo"]); //单据号

            if (saleQuoteEntryRows == null || saleQuoteEntryRows.Any() == false)
            {
                return(result);
            }

            Dictionary <DynamicObject, DynamicObject> dctQuoteMaterialData = new Dictionary <DynamicObject, DynamicObject>();

            var billTypeField = info.GetBillTypeField();

            if (billTypeField == null)
            {
                return(result);
            }

            FormMetadata mtrlMetadata = AppServiceContext.MetadataService.Load(ctx, "BD_MATERIAL") as FormMetadata;

            var saleQuoteEntryGroups = saleQuoteEntryRows.GroupBy(o => billTypeField.RefIDDynamicProperty.GetValue <string>(o.Parent as DynamicObject));

            foreach (var saleQuoteGroup in saleQuoteEntryGroups)
            {
                var billTypeParaObj = AppServiceContext.GetService <ISysProfileService>().LoadBillTypeParameter(ctx, info.GetForm().Id, saleQuoteGroup.Key);
                if (billTypeParaObj == null)
                {
                    continue;
                }

                //产品组别没有配置对应物料模板
                var billTypeParaTplMtrlRows = billTypeParaObj["QuoteMtrlTplEntity"] as DynamicObjectCollection;
                foreach (var quoteEntryRow in saleQuoteGroup)
                {
                    var matchTplMtrlRowObj = billTypeParaTplMtrlRows.FirstOrDefault(o => (long)o["F_JN_MtrlGroupId_Id"] == (long)quoteEntryRow["F_JN_MtrlGroupId_Id"]);
                    if (matchTplMtrlRowObj == null)
                    {
                        var strMtrlGroupName = "";
                        if (quoteEntryRow["F_JN_MtrlGroupId"] is DynamicObject)
                        {
                            strMtrlGroupName = Convert.ToString((quoteEntryRow["F_JN_MtrlGroupId"] as DynamicObject)["name"]);
                        }
                        throw new KDBusinessException("", string.Format("产品创建失败:产品组别{0}未配置对应的模板物料!", strMtrlGroupName));
                    }

                    var           lRefMtrlTplId = (long)matchTplMtrlRowObj["F_JN_TplMtrlId_Id"];
                    DynamicObject refMtrlObject = null;
                    if (lRefMtrlTplId > 0)
                    {
                        refMtrlObject = AppServiceContext.ViewService.LoadWithCache(ctx, new object[] { lRefMtrlTplId }, mtrlMetadata.BusinessInfo.GetDynamicObjectType(), true, null)
                                        .FirstOrDefault();
                    }

                    if (refMtrlObject == null)
                    {
                        var strMtrlGroupName = "";
                        if (quoteEntryRow["F_JN_MtrlGroupId"] is DynamicObject)
                        {
                            strMtrlGroupName = Convert.ToString((quoteEntryRow["F_JN_MtrlGroupId"] as DynamicObject)["name"]);
                        }
                        throw new KDBusinessException("", string.Format("产品创建失败:产品组别{0}关联的模板物料不存在!", strMtrlGroupName));
                    }

                    //通过克隆生成新物料数据包
                    var newMtrlObject = refMtrlObject.Clone(false, true) as DynamicObject;
                    dctQuoteMaterialData[quoteEntryRow] = newMtrlObject;

                    //TODO:新物料数据包需要覆盖及重写的属性
                    newMtrlObject["DocumentStatus"] = "Z";
                    newMtrlObject["ForbidStatus"]   = "A";
                    string name = quoteEntryRow["F_JN_ProductName"] as string;
                    if (name.IsNullOrEmptyOrWhiteSpace())
                    {
                        name = custName + "特配";
                    }
                    newMtrlObject["Name"]             = new LocaleValue(name);
                    newMtrlObject["MaterialGroup_Id"] = quoteEntryRow["F_JN_MtrlGroupId_Id"];
                    newMtrlObject["CreateOrgId_Id"]   = userId;
                    newMtrlObject["UseOrgId_Id"]      = userId;
                    newMtrlObject["F_JNSRCBillNo"]    = billno;
                    //统一根据编码规则生成
                    newMtrlObject["Number"] = AppServiceContext.GetService <IBusinessDataService>().GetListBillNO(ctx, "BD_MATERIAL", 1, "565c204c1f5abf")[0];
                    //计量单位本可以根据报价分录去重写,但目前可以考虑放在模板物料中设置,一个行业的产品代码特性通常相同的。
                }
            }


            if (dctQuoteMaterialData.Any())
            {
                var saveRet = AppServiceContext.SaveService.Save(ctx, mtrlMetadata.BusinessInfo, dctQuoteMaterialData.Values.ToArray(), option, "Save");
                result.MergeResult(saveRet);

                if (saveRet.SuccessDataEnity != null)
                {
                    //更新msterID--解决工序汇报已添加相同键的项
                    DynamicObject mtrl = saveRet.SuccessDataEnity.FirstOrDefault();

                    string sql = string.Format("update T_BD_MATERIAL set FMASTERID=FMATERIALID where FMATERIALID={0}", mtrl["ID"]);
                    DBUtils.Execute(ctx, sql);
                }

                /*
                 * //启动审批流
                 *  // 读取单据的工作流配置模板
                 *  var submitRowObjs = saveRet.SuccessDataEnity.Where(o => Convert.ToString(o["DocumentStatus"]).EqualsIgnoreCase("A")
                 || Convert.ToString(o["DocumentStatus"]).EqualsIgnoreCase("D")).Select(o => o["Id"]).ToArray();
                 || string formId = "BD_MATERIAL";
                 || String[] Billarray = null;
                 || int length = submitRowObjs.GetLength(0);
                 || Billarray = new String[length];
                 || for (int i = 0; i < length; i++)
                 || {
                 ||     Billarray[i] = Convert.ToString(submitRowObjs.GetValue(i));
                 || }
                 || IWorkflowTemplateService wfTemplateService = Kingdee.BOS.Workflow.Contracts.ServiceFactory.GetWorkflowTemplateService(ctx);
                 || List<FindPrcResult> findProcResultList = wfTemplateService.GetPrcListByFormID(
                 ||                 formId, Billarray, ctx);
                 || if (findProcResultList == null || findProcResultList.Count == 0)
                 || {
                 ||     throw new KDBusinessException("AutoSubmit-002", "查找单据适用的流程模板失败,不允许提交工作流!");
                 || }
                 ||
                 || // 设置提交参数:忽略操作过程中的警告,避免与用户交互
                 || OperateOption submitOption = OperateOption.Create();
                 || submitOption.SetIgnoreWarning(true);
                 || IOperationResult submitResult = null;
                 ||
                 || FindPrcResult findProcResult = findProcResultList[0];
                 || if (findProcResult.Result == TemplateResultType.Error)
                 || {
                 ||     throw new KDBusinessException("AutoSubmit-003", "单据不符合流程启动条件,不允许提交工作流!");
                 || }
                 || else if (findProcResult.Result != TemplateResultType.Normal)
                 || {// 本单无适用的流程图,直接走传统审批
                 ||     ISubmitService submitService = Kingdee.BOS.App.ServiceHelper.GetService<ISubmitService>();
                 ||     submitResult = submitService.Submit(ctx, mtrlMetadata.BusinessInfo,
                 ||         submitRowObjs, "Submit", submitOption);
                 || }
                 || else
                 || {// 走工作流
                 ||     IBOSWorkflowService wfService = Kingdee.BOS.Workflow.Contracts.ServiceFactory.GetBOSWorkflowService(ctx);
                 ||     submitResult = wfService.ListSubmit(ctx, mtrlMetadata.BusinessInfo,
                 ||         0, submitRowObjs, findProcResultList, submitOption);
                 ||     result.MergeResult(submitResult);
                 || }
                 ||
                 ||
                 ||var submitRet = AppServiceContext.SubmitService.Submit(ctx, mtrlMetadata.BusinessInfo, saveRet.SuccessDataEnity.Select(o => o["Id"]).ToArray(), "Submit", option);
                 ||result.MergeResult(submitRet);
                 ||if (submitRet.SuccessDataEnity != null)
                 ||{
                 || var auditResult = AppServiceContext.SetStatusService.SetBillStatus(ctx, mtrlMetadata.BusinessInfo,
                 ||     submitRet.SuccessDataEnity.Select(o => new KeyValuePair<object, object>(o["Id"], 0)).ToList(),
                 ||     new List<object> { "1", "" },
                 ||     "Audit", option);
                 ||
                 || result.MergeResult(auditResult);
                 ||}
                 ||
                 ||}*/
            }
            result.IsSuccess  = true;
            result.FuncResult = dctQuoteMaterialData;
            return(result);
        }
        private static List <ClassDefinition> BuildClassDefinitions(BusinessInfo businessInfo, Entity entity, string ns, string formId)
        {
            List <ClassDefinition> results = new List <ClassDefinition>();

            ClassDefinition definition = new ClassDefinition();
            List <ClassPropertyDefinition> classProperties = new List <ClassPropertyDefinition>(entity.DynamicObjectType.Properties.Count);
            HashSet <string> usingNamespaces = new HashSet <string>();

            List <Field> fields = entity.Fields;

            foreach (DynamicProperty property in entity.DynamicObjectType.Properties)
            {
                Field  field          = fields.FirstOrDefault(u => u.PropertyName.Equals(property.Name));
                string usingNamespace = GetNamespaceName(property);
                if (!string.IsNullOrWhiteSpace(usingNamespace))
                {
                    usingNamespaces.Add(usingNamespace);
                }

                string annotation = field?.Name;
                if (string.IsNullOrWhiteSpace(annotation))
                {
                    annotation = property.Name;
                }

                string type = GetPropertyTypeName(property, field);
                string name = property.Name;

                // 基础资料类型属性、单选辅助资料属性
                if (property is IComplexProperty complexProperty)
                {
                    string lookUpObjectId = GetFieldLookUpObjectId(field);

                    type = lookUpObjectId;
                    results.Add(BuildClassDefinition(complexProperty, ns, lookUpObjectId));
                }

                var singlePropertyDefinition = new ClassPropertyDefinition()
                {
                    Name = name, Annotation = annotation, TypeName = type
                };
                //给字段加上数据表列的特性
                if (field != null)
                {
                    singlePropertyDefinition.Attributes.Add($"[Column(\"{field.FieldName}\")]");
                }
                else
                {
                    if (property == entity.DynamicObjectType.PrimaryKey)
                    {
                        singlePropertyDefinition.Attributes.Add($"[Column(\"{entity.EntryPkFieldName}\")]");
                    }
                    else if (property == businessInfo.GetForm().MasterIdDynamicProperty)
                    {
                        singlePropertyDefinition.Attributes.Add($"[Column(\"{businessInfo.GetForm().MasterPKFieldName}\")]");
                    }
                    else if (entity.SeqDynamicProperty == property)
                    {
                        singlePropertyDefinition.Attributes.Add($"[Column(\"{entity.SeqFieldKey}\")]");
                    }
                }


                classProperties.Add(singlePropertyDefinition);
            }

            string className       = GetClassName(entity, formId);
            var    classDefinition = definition.SetAnnotation(entity.Name).SetName(className).SetNamespace(ns)
                                     .SetProperties(classProperties).SetUsingNamespaces(usingNamespaces);

            if (!string.IsNullOrWhiteSpace(entity.TableName))
            {
                classDefinition.AddAttribute($"[Table(\"{entity.TableName}\")]");
#warning 需自行定义Table特性所在命名空间(.NET 4.0不提供Table特性定义)ref:https://docs.microsoft.com/en-us/dotnet/api/system.componentmodel.dataannotations.schema.tableattribute?view=netframework-4.8&viewFallbackFrom=netframework-4.0
                classDefinition.AddUsingNamespaces("Kingdee.Vincent.Core.Domain.Entities");
            }

            results.Add(classDefinition);
            return(results);
        }
コード例 #9
0
        public override void AfterExecuteOperationTransaction(AfterExecuteOperationTransaction e)
        {
            colist          = new List <Dictionary <string, string> >();
            newvaluesfoItem = new List <Dictionary <string, string> >();
            GetOldOrNewDataList(e.DataEntitys, newvaluesfoItem);
            Dictionary <string, string> colname      = new Dictionary <string, string>();
            List <string[]>             colKeyValues = GetColKeyToArray(BusinessInfo.GetForm().Id, "F_PAEZ_ENTITYPROPERTIES", "F_PAEZ_COLUMN");//key/val

            //字段名和字段实体属性组成字典
            for (int i = 0; i < colKeyValues[0].Length; i++)
            {
                colname.Add(colKeyValues[0][i], colKeyValues[1][i]);
            }

            //修改
            foreach (var olditem in oldvaluesfoItem)
            {
                foreach (var newitem in newvaluesfoItem)
                {
                    //修改
                    if (olditem["Number"] == newitem["Number"] && olditem["BillROM"] == newitem["BillROM"] && olditem["Id"] == newitem["Id"])
                    {
                        foreach (var oitem in olditem)
                        {
                            foreach (var nitem in newitem)
                            {
                                if (nitem.Key != "Number" && nitem.Key != "BillROM" && nitem.Key != "Id" && nitem.Key != "Row" &&
                                    oitem.Key != "Number" && oitem.Key != "BillROM" && oitem.Key != "Id" && oitem.Key != "Row")
                                {
                                    if (oitem.Key == nitem.Key && oitem.Value != nitem.Value)
                                    {
                                        colist.Add(new Dictionary <string, string>()
                                        {
                                            { "BillNo", newitem["Number"] },
                                            { "Column", colname[nitem.Key] },
                                            { "ColKey", nitem.Key },
                                            { "ColEntityKey", "e.Field.PropertyName" },
                                            { "OperateName", "修改" },
                                            { "Row", newitem["Row"] },
                                            { "Old", oitem.Value },
                                            { "New", nitem.Value }
                                        });
                                    }
                                }
                            }
                        }
                    }
                }
            }

            //删除
            foreach (var olditem in oldvaluesfoItem)
            {
                //var a = newvaluesfoItem.Select(n => n["Number"]);
                if (newvaluesfoItem.Select(n => n["Number"]).Contains(olditem["Number"]) &&
                    newvaluesfoItem.Select(n => n["BillROM"]).Contains(olditem["BillROM"]) &&
                    !newvaluesfoItem.Select(n => n["Id"]).Contains(olditem["Id"]))
                {
                    foreach (var oitem in olditem)
                    {
                        if (oitem.Key != "Number" && oitem.Key != "BillROM" && oitem.Key != "Id" && oitem.Key != "Row")
                        {
                            colist.Add(new Dictionary <string, string>()
                            {
                                { "BillNo", olditem["Number"] },
                                { "Column", colname[oitem.Key] },
                                { "ColKey", oitem.Key },
                                { "ColEntityKey", "e.Field.PropertyName" },
                                { "OperateName", "删除" },
                                { "Row", olditem["Row"] },
                                { "Old", oitem.Value },
                                { "New", "" }
                            });
                        }
                    }
                }
            }

            //新增
            foreach (var newitem in newvaluesfoItem)
            {
                //var a = newvaluesfoItem.Select(n => n["Number"]);
                if (oldvaluesfoItem.Select(n => n["Number"]).Contains(newitem["Number"]) &&
                    oldvaluesfoItem.Select(n => n["BillROM"]).Contains(newitem["BillROM"]) &&
                    !oldvaluesfoItem.Select(n => n["Id"]).Contains(newitem["Id"]))
                {
                    foreach (var nitem in newitem)
                    {
                        if (nitem.Key != "Number" && nitem.Key != "BillROM" && nitem.Key != "Id" && nitem.Key != "Row")
                        {
                            colist.Add(new Dictionary <string, string>()
                            {
                                { "BillNo", newitem["Number"] },
                                { "Column", colname[nitem.Key] },
                                { "ColKey", nitem.Key },
                                { "ColEntityKey", "e.Field.PropertyName" },
                                { "OperateName", "新增" },
                                { "Row", newitem["Row"] },
                                { "Old", "" },
                                { "New", nitem.Value }
                            });
                        }
                    }
                }
                else if (oldvaluesfoItem.Select(n => n["Number"]).Count() == 0)
                {
                    //List<string[]> billnocol= GetColKeyToArray(billkey);
                    //string number_ = e.DataEntitys[0][billnocol[0][0]].ToString();
                    foreach (var nitem in newitem)
                    {
                        if (nitem.Key != "Number" && nitem.Key != "BillROM" && nitem.Key != "Id" && nitem.Key != "Row" && nitem.Value != "")
                        {
                            colist.Add(new Dictionary <string, string>()
                            {
                                { "BillNo", newitem["Number"] },
                                { "Column", colname[nitem.Key] },
                                { "ColKey", nitem.Key },
                                { "ColEntityKey", "e.Field.PropertyName" },
                                { "OperateName", "新增" },
                                { "Row", newitem["Row"] },
                                { "Old", "" },
                                { "New", nitem.Value }
                            });
                        }
                    }
                }
            }

            //用户\操作时间\组织\子系统\操作类型\IP\单据\字段名\改前\改后\第几行\表名\表标识\单据编号
            string sql = @"/*dialect*/ insert into PAEZ_t_BillRecordLog
(FUSERID,FDATETIME,FORGID,FSUBSYSTEMID,FOPERATENAME,FCLIENTIP,F_PAEZ_Bill,F_PAEZ_ColumnName,F_PAEZ_OldValue,F_PAEZ_NewValue,F_PAEZ_DataRowNumber,F_PAEZ_BILLNAME,F_PAEZ_BILLKEY,F_PAEZ_BILLNO) 
values('{0}','{1}','{2}','','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}')";

            foreach (var item in colist)
            {
                DBServiceHelper.Execute(Context, string.Format(sql,
                                                               Context.UserName,                             //用户
                                                               DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), //操作时间
                                                               Context.CurrentOrganizationInfo.Name,         //组织
                                                               item["OperateName"],                          //操作类型
                                                               Context.ClientInfo.IpAddress,                 //IP
                                                               BusinessInfo.Elements[0].Name,                //单据
                                                               item["Column"],                               //字段名
                                                               item["Old"],                                  //改前
                                                               item["New"],                                  //改后
                                                               item["Row"],                                  //行
                                                               BusinessInfo.Elements[0].Name,                //表名
                                                               BusinessInfo.Elements[0].Id,
                                                               item["BillNo"]
                                                               ));
            }
        }