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); }
/// <summary> /// 添加自定义页面传输参数 /// </summary> /// <param name="para"></param> private void addCustParas(MobileShowParameter para) { //客户信息 string _FCustID = CZ_GetValue("FCustID", "Id"); //项目信息 string _FPrjName = CZ_GetValue("FPrjName"); string _FPrjAddress = CZ_GetValue("FPrjAddress"); string _FRemarks = CZ_GetValue("FRemarks"); //单号 string _FBillNo = CZ_GetValue("FBillNo"); //持有信息 string _FCrmHdOrgID = CZ_GetValue("FCrmHdOrgID", "Id"); string _FCrmHdDept = CZ_GetValue("FCrmHdDept", "Id"); string _FCrmHolder = CZ_GetValue("FCrmHolder", "Id"); //CRM标识码 string _FCrmSN = CZ_GetValue("FCrmSN"); para.CustomParams.Add("FCustID", _FCustID); para.CustomParams.Add("FPrjName", _FPrjName); para.CustomParams.Add("FPrjAddress", _FPrjAddress); para.CustomParams.Add("FRemarks", _FRemarks); para.CustomParams.Add("FClueID", _FBillNo); para.CustomParams.Add("FClueNo", _FBillNo); para.CustomParams.Add("FCrmHdOrgID", _FCrmHdOrgID); para.CustomParams.Add("FCrmHdDept", _FCrmHdDept); para.CustomParams.Add("FCrmHolder", _FCrmHolder); para.CustomParams.Add("FCrmSN", _FCrmSN); }
/// <summary> /// 下推选择单据类型 /// </summary> private void Act_Push() { //打开选择界面 var para1 = new MobileShowParameter(); para1.FormId = "ora_CRM_MBL_SJXT"; para1.OpenStyle.ShowType = ShowType.Modal; para1.Height = 143; para1.Width = 240; para1.ParentPageId = this.View.PageId; para1.Status = OperationStatus.EDIT; string pushFormId = ""; this.View.ShowForm(para1, (formResult) => { if (formResult.ReturnData == null) { return; } pushFormId = formResult.ReturnData.ToString(); if (pushFormId == "ora_CRM_MBL_BJ") { Act_PushSaleOffer(); } else if (pushFormId == "ora_CRM_MBL_LawEntrust") { Act_PushLawEntrust(); } }); }
/// <summary> /// 商机复制 /// </summary> private void Act_ABC_CopyNiche() { var para = new MobileShowParameter(); para.FormId = "ora_CRM_MBL_SJ"; //商机的标识 para.OpenStyle.ShowType = ShowType.Modal; //打开方式 para.ParentPageId = this.View.PageId; para.CustomParams.Add("Flag", "COPY"); para.CustomParams.Add("FID", this.View.BillModel.DataObject["Id"].ToString()); this.View.ShowForm(para); }
/// <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); } }); } }
/// <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); }
/// <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); } }); } }
/// <summary> /// 下推退换货维修 /// </summary> private void Act_ABC_PushChangeRefund() { var para = new MobileShowParameter(); para.FormId = "ora_CRM_AfterSaleOptions"; para.OpenStyle.ShowType = ShowType.Modal; para.Height = 91; para.Width = 240; para.ParentPageId = this.View.PageId; para.Status = OperationStatus.EDIT; string pushFormId = ""; this.View.ShowForm(para, (formResult) => { if (formResult.ReturnData == null) { return; } pushFormId = formResult.ReturnData.ToString(); string FID = "0"; string _FBillNo = this.View.BillModel.GetValue("FBillNo").ToString(); string sql; if (pushFormId == "ora_CRM_MBL_SHFW") //配件更换及退换货维修 { sql = "select FID from ora_CRM_AfterSaleSrv where F_ora_SourceBillNo='" + _FBillNo + "'"; var objs = DBUtils.ExecuteDynamicObject(this.Context, sql); if (objs.Count > 0) { FID = objs[0]["FID"].ToString(); } Act_Push_Common("ora_CRM_MBL_SHFW", "配件更换及退换货维修", FID); } else if (pushFormId == "ora_CRM_MBL_MaintainOffer") { sql = "select FID from ora_CRM_MantainOffer where FSourceBillNo='" + _FBillNo + "'"; var objs = DBUtils.ExecuteDynamicObject(this.Context, sql); if (objs.Count > 0) { FID = objs[0]["FID"].ToString(); } Act_Push_Common("ora_CRM_MBL_MaintainOffer", "维修报价", FID); } }); }
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); } }
/// <summary> /// 打开报价详情页面 /// </summary> private void OpenDetailedPage() { var entity = this.View.BillModel.DataObject["FEntityBPR"] as DynamicObjectCollection; string FMtlGroup = (entity[currSelectedRow]["FBMtlGroup"] as DynamicObject)["Id"].ToString(); string FMtlItem = (entity[currSelectedRow]["FBMtlItem"] as DynamicObject)["Id"].ToString(); string FQty = entity[currSelectedRow]["FBQty"].ToString(); string FPAmt = entity[currSelectedRow]["FBPAmt"].ToString(); string FBGUID = entity[currSelectedRow]["FBGUID"].ToString(); int mbRow = GetMainBodyRowInGroup(FBGUID); string FPAmtGroup = entity[mbRow]["FBPAmtGroup"].ToString(); //获取组基价汇总,位于本体行上,单独附件位于组内第一行 string FBRangeAmtGP = entity[mbRow]["FBRangeAmtGP"].ToString(); //组扣款 double FRptPriceGroup = -double.Parse(entity[currSelectedRow]["FBRptPrice"].ToString()); //累加组内减去本行的报价 foreach (var row in entity) { if (row["FBGUID"].ToString() == FBGUID) { FRptPriceGroup += double.Parse(row["FBRptPrice"].ToString()); } } //string FPAmtGroup = entity[currSelectedRow]["FBPAmtGroup"].ToString(); string FDescribe = entity[currSelectedRow]["FBDescribe"].ToString(); string FModel = entity[currSelectedRow]["FBModel"].ToString(); string FRptPrice = entity[currSelectedRow]["FBRptPrice"].ToString(); string FDownPoints = entity[currSelectedRow]["FBDownPoints"].ToString(); var para = new MobileShowParameter(); para.FormId = "ora_CRM_MBL_BJD"; //报价详情的标识 para.OpenStyle.ShowType = ShowType.Modal; //打开方式 para.Width = 240; para.Height = 257; para.ParentPageId = this.View.PageId; para.CustomParams.Add("FMtlGroup", FMtlGroup); para.CustomParams.Add("FMtlItem", FMtlItem); para.CustomParams.Add("FQty", FQty); para.CustomParams.Add("FPAmt", FPAmt); para.CustomParams.Add("FPAmtGroup", FPAmtGroup); para.CustomParams.Add("FRangeAmtGP", FBRangeAmtGP); para.CustomParams.Add("FDescribe", FDescribe); para.CustomParams.Add("FModel", FModel); para.CustomParams.Add("FRptPrice", FRptPrice); para.CustomParams.Add("FRptPriceGroup", FRptPriceGroup.ToString()); para.CustomParams.Add("FDownPoints", FDownPoints); var FDocumentStatus = this.View.BillModel.GetValue("FDocumentStatus").ToString(); if (FDocumentStatus == "A" || FDocumentStatus == "Z") { para.Status = OperationStatus.EDIT; } else { para.Status = OperationStatus.VIEW; } this.View.ShowForm(para, formResult => { if (formResult.ReturnData == null) { return; } FRptPrice = formResult.ReturnData.ToString(); this.View.BillModel.SetValue("FBRptPrice", FRptPrice, currSelectedRow); this.View.InvokeFieldUpdateService("FBRptPrice", currSelectedRow); }); }
/// <summary> /// 根据单据唯一标识下推单据 /// </summary> private void PushFormByFormId() { string status = this.View.BillModel.GetValue("FDocumentStatus").ToString(); if (status == "Z") { return; } string formId = this.View.BillView.GetFormId(); string targetFormId = "k0c6b452fa8154c4f8e8e5f55f96bcfac"; // 个人资金 var rules = ConvertServiceHelper.GetConvertRules(this.View.Context, formId, targetFormId); var rule = rules.FirstOrDefault(t => t.IsDefault); string fid = this.View.BillModel.GetPKValue().ToString(); ListSelectedRow[] selectedRows; if (formId == "k0c30c431418e4cf4a60d241a18cb241c") // 出差申请 { int count = this.View.BillModel.GetEntryRowCount("FEntity"); selectedRows = new ListSelectedRow[count]; for (int i = 0; i < count; i++) { string entryId = this.View.BillModel.GetEntryPKValue("FEntryID", i).ToString(); selectedRows[i] = new ListSelectedRow(fid, entryId, i, formId); } } else { ListSelectedRow row = new ListSelectedRow(fid, string.Empty, 0, formId); selectedRows = new ListSelectedRow[] { row }; } // 调用下推服务,生成下游单据数据包 ConvertOperationResult operationResult = null; PushArgs pushArgs = new PushArgs(rule, selectedRows) { TargetBillTypeId = "", TargetOrgId = 0, }; try { //执行下推操作,并获取下推结果 operationResult = ConvertServiceHelper.Push(this.View.Context, pushArgs, OperateOption.Create()); } catch (KDExceptionValidate ex) { this.View.ShowErrMessage(ex.Message, ex.ValidateString); return; } catch (Exception ex) { this.View.ShowErrMessage(ex.Message); return; } // 获取生成的目标单据数据包 DynamicObject[] objs = operationResult.TargetDataEntities.Select(p => p.DataEntity).ToArray(); // 读取目标单据元数据 var targetBillMeta = MetaDataServiceHelper.Load(this.View.Context, targetFormId) as FormMetadata; OperateOption option = OperateOption.Create(); // 忽略全部需要交互性质的提示 option.SetIgnoreWarning(true); // 暂存数据 var saveResult = BusinessDataServiceHelper.Draft(this.View.Context, targetBillMeta.BusinessInfo, objs, option); string targetId = saveResult.SuccessDataEnity.Select(item => item["Id"].ToString()).Distinct().FirstOrDefault(); // 打开目标单据 if (targetId != null) { MobileShowParameter param = new MobileShowParameter(); param.Caption = "个人资金申请"; param.FormId = "ora_GRZJJZ"; param.PKey = targetId; param.ParentPageId = this.View.PageId; param.Status = OperationStatus.EDIT; param.OpenStyle.ShowType = ShowType.Default; this.View.ShowForm(param); } }
/// <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); } }); } }
/// <summary> /// 打卡下推选择界面 /// </summary> private void Act_BC_OpenPushOptions() { //打开选择界面 var para = new MobileShowParameter(); para.FormId = "ora_CRM_SaleOrderOptions"; para.OpenStyle.ShowType = ShowType.Modal; para.Height = 132; para.Width = 240; para.ParentPageId = this.View.PageId; para.Status = OperationStatus.EDIT; string pushFormId = ""; this.View.ShowForm(para, (formResult) => { if (formResult.ReturnData == null) { return; } pushFormId = formResult.ReturnData.ToString(); string FID = "0"; string _FBillNo = this.View.BillModel.GetValue("FBillNo").ToString(); string sql; /* * if (pushFormId == "ora_CRM_MBL_DeliverNotify") //发货通知 * { * sql = "select Distinct FID from T_SAL_DELIVERYNOTICEENTRY where FSrcBillNo='" + _FBillNo + "'"; * var objs = DBUtils.ExecuteDynamicObject(this.Context, sql); * if (objs.Count > 0) * { * FID = objs[0]["FID"].ToString(); * } * Act_Push_Common("ora_CRM_MBL_DeliverNotify", "发货通知", FID); * } * else */ if (pushFormId == "ora_CRM_MBL_SaleInvoice") //销售开票 { sql = "select FID from ora_CRM_SaleInvoice where FSaleOrderID='" + _FBillNo + "'"; var objs = DBUtils.ExecuteDynamicObject(this.Context, sql); if (objs.Count > 0) { FID = objs[0]["FID"].ToString(); } Act_Push_Common("ora_CRM_MBL_SaleInvoice", "销售开票", FID); } else if (pushFormId == "ora_CRM_MBL_CCRP") //售后服务 { sql = "select FID from ora_CRM_CCRP where F_ora_SourceBillNo='" + _FBillNo + "'"; var objs = DBUtils.ExecuteDynamicObject(this.Context, sql); if (objs.Count > 0) { FID = objs[0]["FID"].ToString(); } Act_Push_Common("ora_CRM_MBL_CCRP", "售后服务", FID); } else if (pushFormId == "ora_CRM_MBL_TSDDJS") //特殊订单 { sql = "select FID from ora_CRM_SpcBussCost where FSaleOrderID='" + _FBillNo + "'"; var objs = DBUtils.ExecuteDynamicObject(this.Context, sql); if (objs.Count > 0) { FID = objs[0]["FID"].ToString(); } Act_Push_Common("ora_CRM_MBL_TSDDJS", "特殊订单业务费结算", FID); } }); }