private void transformToNiche() { var para = new MobileShowParameter(); para.FormId = "ora_CRM_MBL_SJ"; //商机的标识 para.OpenStyle.ShowType = ShowType.Modal; //打开方式 para.ParentPageId = this.View.PageId; //查询是否已经存在下推商机单据 string _BillNo = (this.View.BillModel.DataObject["BillNo"] == null) ? "" : this.View.BillModel.DataObject["BillNo"].ToString(); string sql = "select FID from ora_CRM_Niche where FClueID='" + _BillNo + "'"; var data = CZDB_GetData(sql); if (data.Count > 0) { this.View.ShowMessage("已经存在下推的商机,确定打开吗?", MessageBoxOptions.YesNo, new Action <MessageBoxResult>((result) => { para.Status = OperationStatus.VIEW; para.PKey = data[0]["FID"].ToString(); //已有单据内码 para.CustomParams.Add("Flag", "EDIT"); this.View.ShowForm(para); })); } else { addCustParas(para); para.CustomParams.Add("Flag", "ADD"); this.View.ShowForm(para); } string strTitle = "我的商机"; LocaleValue formTitle = new LocaleValue(); formTitle.Add(new KeyValuePair <int, string>(this.Context.UserLocale.LCID, strTitle)); this.View.SetFormTitle(formTitle); }
private string GetName(LocaleValue value) { string str = ""; value.TryGetValue(base.Context.UserLocale.LCID, out str); return(str); }
public object GetPropertyOwner(PropertyDescriptor pd) { LocaleValue loc; IEnumerable <AmbientValueAttribute> col = pd.Attributes.OfType <AmbientValueAttribute>(); Strings.InitializeResource(); if (col.Count() > 0) { AmbientValueAttribute ambient = col.ElementAt(0); string[] tab = ((string)ambient.Value).Split(','); if (tab.Length > 0) { loc = new LocaleValue(tab[0], Strings._resources.GetString(tab[0])); loc.Parameters.AddRange(tab.TakeWhile((s, i) => i > 0)); } else { loc = new LocaleValue(pd.Name, pd.Name); } } else { loc = new LocaleValue(pd.Name, pd.Name); } return(loc); }
/// <summary> /// 下推报价 /// </summary> private void Act_PushSaleOffer() { var para = new MobileShowParameter(); para.FormId = "ora_CRM_MBL_BJ"; //报价的标识 para.OpenStyle.ShowType = ShowType.Modal; //打开方式 para.ParentPageId = this.View.PageId; //查询是否已经存在下推商机单据 string _BillNo = (this.View.BillModel.DataObject["BillNo"] == null) ? "" : this.View.BillModel.DataObject["BillNo"].ToString(); string sql = "select FID from ora_CRM_SaleOffer where FNicheID='" + _BillNo + "'"; var data = CZDB_GetData(sql); string strTitle; LocaleValue formTitle; if (data.Count > 0) { this.View.ShowMessage("已经存在下推的报价单,确定打开吗?", MessageBoxOptions.YesNo, new Action <MessageBoxResult>((result) => { //para.Status = OperationStatus.VIEW; para.PKey = data[0]["FID"].ToString(); //已有单据内码 para.CustomParams.Add("Flag", "EDIT"); para.CustomParams.Add("FID", data[0]["FID"].ToString()); this.View.ShowForm(para); //设置表单Title strTitle = "销售报价"; formTitle = new LocaleValue(); formTitle.Add(new KeyValuePair <int, string>(this.Context.UserLocale.LCID, strTitle)); this.View.SetFormTitle(formTitle); })); } else { this.View.ShowMessage("是否下推生成销售报价?", MessageBoxOptions.YesNo, (result) => { if (result == MessageBoxResult.Yes) { string _FID = this.View.BillModel.DataObject["Id"] == null ? "" : this.View.BillModel.DataObject["Id"].ToString(); sql = string.Format("exec proc_czly_GeneSaleOffer @NFID='{0}'", _FID); var objs = CZDB_GetData(sql); para.PKey = objs[0]["FID"].ToString();//已有单据内码 para.CustomParams.Add("Flag", "ADD"); para.CustomParams.Add("FID", objs[0]["FID"].ToString()); this.View.ShowForm(para); //设置表单Title strTitle = "销售报价"; formTitle = new LocaleValue(); formTitle.Add(new KeyValuePair <int, string>(this.Context.UserLocale.LCID, strTitle)); this.View.SetFormTitle(formTitle); } }); } }
public void OneReBindControl(System.Windows.Forms.Control c, string name, params object[] pars) { if (!this.DesignMode) { LocaleValue lv = this.values[0]; lv.Key = name; lv.Parameters.Clear(); lv.Parameters.AddRange(pars); this.Refresh(); } }
/// <summary> /// 下推合同评审 /// </summary> private void PushContact() { string _FID = this.View.BillModel.DataObject["Id"] == null ? "" : this.View.BillModel.DataObject["Id"].ToString(); if (_FID == "") { this.View.ShowMessage("单据还未提交!"); return; } var para = new MobileShowParameter(); para.FormId = "ora_CRM_MBL_HTPS"; //报价的标识 para.OpenStyle.ShowType = ShowType.Modal; //打开方式 para.ParentPageId = this.View.PageId; //查询是否已经存在下推商机单据 string _BillNo = (this.View.BillModel.DataObject["BillNo"] == null) ? "" : this.View.BillModel.DataObject["BillNo"].ToString(); string sql = "select FID from ora_CRM_Contract where FNicheID='" + _BillNo + "'"; var data = CZDB_GetData(sql); if (data.Count > 0) { this.View.ShowMessage("已经存在下推的合同评审,确定打开吗?", MessageBoxOptions.YesNo, new Action <MessageBoxResult>((result) => { para.Status = OperationStatus.EDIT; para.PKey = data[0]["FID"].ToString(); //已有单据内码 para.CustomParams.Add("Flag", "EDIT"); this.View.ShowForm(para); })); } else { //生成下推销售合同单据 sql = string.Format("EXEC proc_czly_CRMGeneContact @FUserId='{0}', @FID='{1}'", this.Context.UserId, _FID); var datas = CZDB_GetData(sql); //para.CustomParams.Add("FID", _FID); //para.CustomParams.Add("Flag", "ADD"); para.Status = OperationStatus.EDIT; para.PKey = datas[0]["FID"].ToString();//已有单据内码 para.CustomParams.Add("Flag", "ADD"); this.View.ShowForm(para); } //设置表单Title string strTitle = "销售合同评审"; LocaleValue formTitle = new LocaleValue(); formTitle.Add(new KeyValuePair <int, string>(this.Context.UserLocale.LCID, strTitle)); this.View.SetFormTitle(formTitle); }
public override void AfterBindData(EventArgs e) { this.View.GetControl("F_JD_BTNOK").Enabled = false; string CustomKey = this.View.OpenParameter.GetCustomParameter("CustomKey").ToString(); if (CustomKey == "2001") { LocaleValue str = new LocaleValue("「平板」INVOICE 引入"); this.View.SetFormTitle(str); } else if (CustomKey == "2002") { LocaleValue str = new LocaleValue("「手机」INVOICE 引入"); this.View.SetFormTitle(str); } }
/// <summary> /// 通用下推 /// </summary> private void Act_Push_Common(string formId, string title, string distFID) { var para = new MobileShowParameter(); para.FormId = formId; para.OpenStyle.ShowType = ShowType.Modal; para.ParentPageId = this.View.PageId; para.Status = OperationStatus.EDIT; string srcFID = this.View.BillModel.DataObject["Id"] == null ? "0" : this.View.BillModel.DataObject["Id"].ToString(); para.CustomParams.Add("FID", srcFID); if (distFID != "0") { this.View.ShowMessage("已存在下推的单据,是否打开?", MessageBoxOptions.YesNo, new Action <MessageBoxResult>((result) => { if (result == MessageBoxResult.Yes) { para.PKey = distFID; para.CustomParams.Add("Flag", "EDIT"); //设置表单Title string strTitle = title; var formTitle = new LocaleValue(); formTitle.Add(new KeyValuePair <int, string>(this.Context.UserLocale.LCID, strTitle)); this.View.SetFormTitle(formTitle); this.View.ShowForm(para); } })); } else { para.CustomParams.Add("Flag", "ADD"); this.View.ShowMessage("是否要下推生成" + title + "?", MessageBoxOptions.YesNo, (result) => { if (result == MessageBoxResult.Yes) { //设置表单Title string strTitle = title; var formTitle = new LocaleValue(); formTitle.Add(new KeyValuePair <int, string>(this.Context.UserLocale.LCID, strTitle)); this.View.SetFormTitle(formTitle); this.View.ShowForm(para); } }); } }
private void Act_TrackUp() { string FBillNo = this.View.BillModel.GetValue("FSourceBillNo").ToString(); string sql = "SELECT FID FROM ora_CRM_MantainOffer WHERE FBillNo='" + FBillNo + "'"; var objs = DBUtils.ExecuteDynamicObject(this.Context, sql); if (objs.Count > 0) { var para = new MobileShowParameter(); para.FormId = "ora_CRM_MBL_MaintainOffer"; //源单FormId para.OpenStyle.ShowType = ShowType.Modal; para.ParentPageId = this.View.PageId; para.Status = OperationStatus.EDIT; para.PKey = objs[0]["FID"].ToString(); string strTitle = "维修报价"; var formTitle = new LocaleValue(); formTitle.Add(new KeyValuePair <int, string>(this.Context.UserLocale.LCID, strTitle)); this.View.SetFormTitle(formTitle); this.View.ShowForm(para); } }
private void BindControls(object obj, params object[] pars) { try { string text = this.GetText(obj); string name = this.GetName(obj); if (!String.IsNullOrEmpty(name) && IsContentTextStatic(obj)) { foreach (object param in pars) { text += "," + param.ToString(); } PropertyDescriptor newProperty = TypeDescriptor.CreateProperty(typeof(LocaleValue), "Value", typeof(string), new AmbientValueAttribute(text)); props.Add(newProperty); LocaleValue lv = this.GetPropertyOwner(newProperty) as LocaleValue; lv.RefObject = obj; lv.Parameters.AddRange(pars); this.values.Add(lv); } } catch { } }
/// <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); }
}//end method public static string Value(this LocaleValue localeValue, Context ctx) { return(Value(localeValue, ctx.UserLocale.LCID)); } //end method
public static string Value(this LocaleValue localeValue, int localeId) { return(localeValue == null ? string.Empty : localeValue.GetString(localeId)); }//end method
/// <summary> /// 下推开具法委 /// </summary> private void Act_PushLawEntrust() { var para = new MobileShowParameter(); para.FormId = "ora_CRM_MBL_LawEntrust"; //标识 para.OpenStyle.ShowType = ShowType.Modal; //打开方式 para.ParentPageId = this.View.PageId; //查询是否已经存在下推商机单据 string _BillNo = (this.View.BillModel.DataObject["BillNo"] == null) ? "" : this.View.BillModel.DataObject["BillNo"].ToString(); string sql = "select FID from ora_CRM_LawEntrust where FNicheID='" + _BillNo + "'"; var data = CZDB_GetData(sql); string strTitle; LocaleValue formTitle; if (data.Count > 0) { this.View.ShowMessage("已经存在下推的开具发委单,确定打开吗?", MessageBoxOptions.YesNo, new Action <MessageBoxResult>((result) => { if (result == MessageBoxResult.Yes) { //para.Status = OperationStatus.VIEW; para.PKey = data[0]["FID"].ToString(); //已有单据内码 para.CustomParams.Add("Flag", "EDIT"); para.CustomParams.Add("FID", data[0]["FID"].ToString()); //设置表单Title strTitle = "开具法委"; formTitle = new LocaleValue(); formTitle.Add(new KeyValuePair <int, string>(this.Context.UserLocale.LCID, strTitle)); this.View.SetFormTitle(formTitle); this.View.ShowForm(para); } })); } else { this.View.ShowMessage("是否下推生成开具法委?", MessageBoxOptions.YesNo, (result) => { if (result == MessageBoxResult.Yes) { //para.PKey = objs[0]["FID"].ToString();//已有单据内码 string FCustID = this.View.BillModel.GetValue("FCustID") == null ? "0" : (this.View.BillModel.GetValue("FCustID") as DynamicObject)["Id"].ToString(); string FPrjName = CZ_GetValue("FPrjName"); string FCrmSN = CZ_GetValue("FCrmSN"); para.CustomParams.Add("Flag", "ADD"); para.CustomParams.Add("FBillNo", _BillNo); para.CustomParams.Add("FCustID", FCustID); para.CustomParams.Add("FPrjName", FPrjName); para.CustomParams.Add("FCrmSN", FCrmSN); //设置表单Title strTitle = "开具法委"; formTitle = new LocaleValue(); formTitle.Add(new KeyValuePair <int, string>(this.Context.UserLocale.LCID, strTitle)); this.View.SetFormTitle(formTitle); this.View.ShowForm(para); } }); } }
public static LocaleValue TranslateFormula(Context ctx, ExpTransContext expContext, string formula, LocaleValue formulaDesc) { if ((formulaDesc != null) && !string.IsNullOrWhiteSpace(formulaDesc.ToString())) { return(formulaDesc); } if (expContext == null) { return(new LocaleValue()); } return(new LocaleValue(TranslateFormula(expContext, formula), ctx.UserLocale.LCID)); }