123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.HospitalTrackingSystem
- {
- public partial class AddingTrackRecord : LYFZ.Software.UI.HospitalTrackingSystem.AddingTrackRecord
- {
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- LYFZ.BLL.BLL_ErpClientServiceTask cstbll = new BLL.BLL_ErpClientServiceTask();
- LYFZ.BLL.BLL_ErpHospitalContactRecord ambll = new BLL.BLL_ErpHospitalContactRecord();
- public AddingTrackRecord()
- {
- this.bntClose.Click += bntClose_Click;
- this.bntSave.Click += bntSave_Click;
- this.txtCallTime.KeyPress += txtCallTime_KeyPress;
- this.Load += AddingTrackRecord_Load;
- this.btnDial.Click += btnDial_Click;
- this.buttonForm2.Click += buttonForm2_Click;
- this.cmbConcreteMatter.SelectedIndexChanged += cmbConcreteMatter_SelectedIndexChanged;
- #region 上传沟通记录相关相片;
- this.btn_AddFiles.Click += Btn_AddFiles_Click;
- this.listbox_files.DoubleClick += Listbox_files_DoubleClick;
- this.btn_Getfiles.Click += Btn_Getfiles_Click;
- #endregion
- }
- #region 上传沟通记录相关相片;
- private void GetFiles()
- {
- if (this.listbox_files.SelectedItem != null)
- {
- BLL.OssCloudDiskSDK.UploadOssCloudDisk uploadOss = new BLL.OssCloudDiskSDK.UploadOssCloudDisk();
- BLL.OssCloudDiskSDK.OSSUpdateReturnData retData = uploadOss.DownloadFile(this.listbox_files.SelectedItem.ToString());
- if (retData.State)
- {
- try
- {
- // 创建新的进程;
- System.Diagnostics.Process pro = new System.Diagnostics.Process();
- // 设置要打开的文件名;
- pro.StartInfo.FileName = retData.FileLocalFullPath;
- // 打开;
- pro.Start();
- }
- catch (Exception ex)
- {
- if (DialogResult.Yes == MessageBoxCustom.Show(ex.Message + "\n 文件是否另存为", "出错提示", MessageBoxButtons.YesNo))
- {
- SaveFileDialog savedlg = new SaveFileDialog();
- savedlg.Filter = "所有文件(*.*)|*.*";
- savedlg.Title = "另存为";
- savedlg.FileName = retData.FileLocalFullPath.Substring(retData.FileLocalFullPath.LastIndexOf('\\') + 1);
- if (savedlg.ShowDialog() == DialogResult.OK)
- {
- System.IO.File.Copy(retData.FileLocalFullPath, savedlg.FileName, true);
- }
- }
- }
- }
- else
- {
- MessageBoxCustom.Show("下载文件失败\n" + retData.Description);
- }
- }
- }
- /// <summary>
- /// 查看或下载相片;
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Btn_Getfiles_Click(object sender, EventArgs e)
- {
- GetFiles();
- }
- /// <summary>
- /// 双击listbox时, 从中移除选中项;
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Listbox_files_DoubleClick(object sender, EventArgs e)
- {
- if (!string.IsNullOrEmpty(StrOrderNumber))
- {
- GetFiles();
- return;
- }
- if ( this.listbox_files.SelectedItems.Count > 0 )
- {
- this.listbox_files.Items.Remove(this.listbox_files.SelectedItem.ToString());
- }
- }
- /// <summary>
- /// 添加文件按钮;
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- private void Btn_AddFiles_Click(object sender, EventArgs e)
- {
- OpenFileDialog dialog = new OpenFileDialog();
- dialog.Multiselect = true;//该值确定是否可以选择多个文件
- dialog.Title = "请选择文件夹";
- dialog.Filter = "所有文件(*.*)|*.*";
- if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- foreach ( string file in dialog.FileNames )
- {
- if (this.listbox_files.Items.Contains(file))
- continue;
- this.listbox_files.Items.Add(file);
- }
- }
- }
- #endregion
- /// <summary>
- /// 是否保存
- /// </summary>
- public bool IsSaveed = false;
- /// <summary>
- /// 订单编号
- /// </summary>
- public string StrOrderNumber = "";
- /// <summary>
- /// 联系记录编号
- /// </summary>
- public string StrOrderRecordID = "";
- /// <summary>
- /// 订单派单ID
- /// </summary>
- public int intDispatchDoorID = 0;
- /// <summary>
- /// 是否显示下次提醒时间设置
- /// </summary>
- public bool IsShowDatimeRemind = true;
- /// <summary>
- /// 是否要打开选择派单界面
- /// </summary>
- public bool IsGoForm = true;
- /// <summary>
- /// 任务完成时间
- /// </summary>
- public string StrClientServiceDateTime = "";
- /// <summary>
- /// 任务完成说明
- /// </summary>
- public string StrCompletionRemark = "";
- string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
- /// <summary>
- /// 窗体加载
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void AddingTrackRecord_Load(object sender, EventArgs e)
- {
- // 查看时,不显示添加附件按钮;
- this.btn_AddFiles.Visible = string.IsNullOrEmpty(this.StrOrderRecordID);
- // 添加时,不显示查看附件按钮;
- this.btn_Getfiles.Visible = !string.IsNullOrEmpty(this.StrOrderRecordID);
- this.bntSave.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.HospitalTrackingSystem, CustomAttributes.OperatingAuthority.AddCommunicateRecord);
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.HidePhoneControls(this.txtPhone);
- this.datimeCallDate.DateValue = SDateTime.Now.ToString("yyyy-MM-dd");
- if (!string.IsNullOrEmpty(this.StrOrderNumber))
- {
- DataTable dt = orbll.GetView_Custom("View_HospitalContact", StrWhere: "来单批号='" + this.StrOrderNumber + "'", ShowColumnName: "客户姓名,本人手机").Tables[0];
- this.txtName.Text = dt.Rows[0]["客户姓名"].ToString();
- this.txtPhone.Text = dt.Rows[0]["本人手机"].ToString();
- }
- if (!string.IsNullOrEmpty(this.StrOrderRecordID))
- {
- this.panelEx2.Visible = false;
- DataTable dts = orbll.GetView_Custom("tb_ErpHospitalContactRecord", StrWhere: "ID='" + this.StrOrderRecordID + "'", ShowColumnName: "Hcr_CallTime,Hcr_CallDuration,Hcr_CallType,Hcr_Homeaddress,Hcr_CallStaff,Hcr_CallCases,Hcr_CallMode,Hcr_RemindTime,Hcr_Remarks,Hcr_TrackImages").Tables[0];
- this.datimeCallDate.DateValue = dts.Rows[0]["Hcr_CallTime"].ToString().Trim();
- this.txtCallTime.Text = dts.Rows[0]["Hcr_CallDuration"].ToString().Trim();
- this.cmbCallType.Text = dts.Rows[0]["Hcr_CallType"].ToString().Trim();
- this.cmbConcreteMatter.Text = dts.Rows[0]["Hcr_Homeaddress"].ToString().Trim();
- this.cbxCallMode.Text = dts.Rows[0]["Hcr_CallMode"].ToString().Trim();
- this.txtRemark.Text = dts.Rows[0]["Hcr_Remarks"].ToString().Trim();
- this.datimeRemind.DateValue = dts.Rows[0]["Hcr_RemindTime"].ToString().Trim();
- if (dts.Rows[0]["Hcr_Homeaddress"].ToString().Trim() == "预约上门")
- {
- this.IsShowDatimeRemind = false;
- }
- // 在listbox中显示key值;
- string[] strKeys = dts.Rows[0]["Hcr_TrackImages"].ToString().Split('|');
- foreach ( string item in strKeys )
- {
- this.listbox_files.Items.Add(item);
- }
- }
- else
- {
- this.cmbCallType.SelectedIndex = 0;
- }
- if (intDispatchDoorID > 0)
- {
- this.cmbConcreteMatter.Text = "预约上门";
- this.cmbConcreteMatter.Enabled = false;
- }
- this.cmbCallType.Enabled = false;
- this.datimeRemind.Visible = this.IsShowDatimeRemind;
- this.labelEx11.Visible = this.IsShowDatimeRemind;
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("AAAAAAE", this.cbxCallMode);
- }
- /// <summary>
- /// 通话时长只能为数字
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void txtCallTime_KeyPress(object sender, KeyPressEventArgs e)
- {
- if (e.KeyChar != 8 && !Char.IsDigit(e.KeyChar))
- {
- e.Handled = true;
- }
- }
- /// <summary>
- /// 保存按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void bntSave_Click(object sender, EventArgs e)
- {
- DateTime strTime = SDateTime.Now;
- Model.Model_ErpHospitalContactRecord model = null;
- if (this.datimeCallDate.DateValue.Trim() == "")
- { MessageBoxCustom.Show("请选择通话时间!"); return; }
- if (this.cmbCallType.Text.Trim() == "")
- { MessageBoxCustom.Show("请选择通话类型!"); return; }
- if (this.cmbConcreteMatter.Text.Trim() == "")
- { MessageBoxCustom.Show("请选择具体事项"); return; }
- if (this.txtCallTime.Text.Trim() == "")
- { MessageBoxCustom.Show("通话时长只能为数字,如果是空可以输入0"); return; }
- string StrWhere = "";
- if (this.cmbConcreteMatter.Text.Trim().Equals("预约上门"))
- { StrWhere = "Cst_TaskModule = '" + LYFZ.EnumPublic.ClientServiceTaskType.摄控确认 + "' And Cst_TaskItem = '" + LYFZ.EnumPublic.ClientServiceTaskItem.摄控医院客人 + "'"; }
- else
- { StrWhere = "Cst_TaskModule = '" + LYFZ.EnumPublic.ClientServiceTaskType.意向跟踪 + "' And Cst_TaskItem = '" + LYFZ.EnumPublic.ClientServiceTaskItem.医院意向 + "'"; }
- List<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
- string strTaskNumber = "";
- DataTable dt = orbll.GetView_Custom("tb_ErpClientServiceTask", StrWhere: StrWhere, ShowColumnName: "*", filedOrder: "Cst_TaskTermTime ASC", TopCount: 1).Tables[0];
- if (dt.Rows.Count > 0)
- {
- LYFZ.Model.Model_ErpClientServiceTask modelCstask = cstbll.DataRowToModel(dt.Rows[0]);
- modelCstask.Cst_CompletionIntStatus = 1;
- modelCstask.Cst_CompletionStatus = "OK";
- modelCstask.Cst_CompletionTime = strTime;
- modelCstask.Cst_CompletionPerson = this.strUserID;
- modelCstask.Cst_CompletionRemark = this.txtRemark.Text.Trim();
- modelCstask.Cst_UpdateDateTime = strTime;
- modelCstask.Cst_UpdateName = this.strUserID;
- clist.Add(cstbll.GetUpdateCommandInfo(modelCstask));
- strTaskNumber = modelCstask.Cst_Number;
- }
- model = new Model.Model_ErpHospitalContactRecord();
- model.Hcr_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID();
- model.Hcr_Number = this.StrOrderNumber;
- model.Hcr_TaskNumber = strTaskNumber;
- model.Hcr_CallTime = Convert.ToDateTime(this.datimeCallDate.DateValue.Trim());
- model.Hcr_CallDuration = Convert.ToInt32(this.txtCallTime.Text.Trim());
- model.Hcr_CallType = this.cmbCallType.Text.Trim().ToString();
- model.Hcr_Homeaddress = this.cmbConcreteMatter.Text.Trim().ToString().Trim();
- model.Hcr_CallStaff = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Name;
- model.Hcr_Remarks = this.txtRemark.Text.Trim().ToString().Trim();
- model.Hcr_CallMode = this.cbxCallMode.Text.Trim().ToString().Trim();
- model.Hcr_DispatchDoorID = this.intDispatchDoorID;
- model.Hcr_CreateDatetime = strTime;
- model.Hcr_CreateName = strUserID;
- if (string.IsNullOrEmpty(this.datimeRemind.DateValue.Trim()))
- {
- model.Hcr_RemindTime = LYFZ.WinAPI.CustomPublicMethod.GetNullDateTime();
- }
- else
- {
- model.Hcr_RemindTime = Convert.ToDateTime(this.datimeRemind.DateValue.Trim());
- }
-
- if (this.listbox_files.Items.Count > 0)
- {
- // 附件数理;
- int nAnnexCount = 0;
- string strResult = "";
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- {
- backgroundWorker.ReportProgress(0, "正在上传......");
- foreach (string item in this.listbox_files.Items)
- {
- BLL.OssCloudDiskSDK.UploadOssCloudDisk uploadOss = new BLL.OssCloudDiskSDK.UploadOssCloudDisk();
- BLL.OssCloudDiskSDK.OSSUpdateReturnData retData = uploadOss.UpLoadFile(item);
- if (retData.State == true)
- {
- // 组串更新语句;
- nAnnexCount++;
- System.Diagnostics.Debug.Write("key=" + retData.OssFileKey + "\n");
- model.Hcr_TrackImages += retData.OssFileKey + "|";
- }
- else
- {
- strResult += item + " " + retData.Description + "\n";
- }
- }
- });
- if (nAnnexCount != this.listbox_files.Items.Count)
- {
- MessageBoxCustom.Show("文件上传失败!\n"+ strResult);
- return;
- }
- model.Hcr_TrackImages = model.Hcr_TrackImages.Trim('|');
- }
- clist.Add(ambll.GetAddCommandInfo(model));
- if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0)
- {
- this.IsSaveed = true;
- this.StrClientServiceDateTime = this.datimeCallDate.DateValue.Trim();
- this.StrCompletionRemark = this.txtRemark.Text.Trim();
- MessageBoxCustom.Show("保存成功");
- #if IGNORE
- if ( DialogResult.Yes == MessageBoxCustom.Show("保存成功,是否上传相片?", "提示消息!",MessageBoxButtons.YesNo) )
- {
- OpenFileDialog dialog = new OpenFileDialog();
- dialog.Multiselect = true;//该值确定是否可以选择多个文件
- dialog.Title = "请选择文件夹";
- dialog.Filter = "所有文件(*.*)|*.*";
- if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
- {
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
- {
- backgroundWorker.ReportProgress(0, "正在上传......");
- string strKey = "";
- string strFile = "";
- foreach (string myfile in dialog.FileNames)
- {
- System.Diagnostics.Debug.Write("文件名:" + myfile + "\n");
- BLL.OssCloudDiskSDK.UploadOssCloudDisk uploadOss = new BLL.OssCloudDiskSDK.UploadOssCloudDisk();
- BLL.OssCloudDiskSDK.OSSUpdateReturnData retData = uploadOss.UpLoadFile(myfile);
- if ( retData.State == true )
- {
- // 组串更新语句;
- System.Diagnostics.Debug.Write("key=" + retData.OssFileKey + "\n");
- strKey += retData.OssFileKey + "|";
- }
- else
- {
- // 保存上传失败的文件, 结束后提示;
- strFile += myfile + "|";
- }
- }
- // 更新;
- model.Hcr_TrackImages = strKey.Trim('|');
- clist.Clear();
- clist.Add(ambll.GetAddCommandInfo(model));
- if ( LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0)
- {
- MessageBoxCustom.Show("上传完成!");
- if (!string.IsNullOrEmpty(strFile))
- {
- strFile = strFile.Replace('|', '\n');
- MessageBoxCustom.Show("文件\n" + strFile + "上传失败,请重新上传");
- }
- }
- else
- {
- MessageBoxCustom.Show("上传失败!");
- }
- });
- }
- }
- #endif
- this.Close();
- }
- else
- { MessageBoxCustom.Show("保存失败!"); }
- }
- /// <summary>
- /// 关闭窗体
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void bntClose_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 选择预约上门,弹出派单上门数据
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void cmbConcreteMatter_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (this.IsGoForm)
- {
- if (this.cmbConcreteMatter.Text.Trim() == "预约上门")
- {
- LYFZ.Software.MainBusiness.HospitalTrackingSystem.DispatchDoor frm = new DispatchDoor();
- frm.StrOrderNumber = this.StrOrderNumber;
- frm.ShowDialog();
- if (frm.IsSaveed)
- {
- intDispatchDoorID = frm.SelectID;
- this.datimeRemind.DateValue = "";
- this.datimeRemind.Visible = false;
- this.labelEx11.Visible = false;
- return;
- }
- }
- intDispatchDoorID = 0;
- this.datimeRemind.Visible = true;
- this.labelEx11.Visible = true;
- }
- }
- #region 设置按钮
- /// <summary>
- /// 通话方式设置按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void buttonForm2_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.InitialSet.FrmSystemSet frm = new InitialSet.FrmSystemSet();
- frm.TypeName = "AAAAAAE";
- frm.Version = "Version";
- if (frm.ShowDialog() == DialogResult.OK)
- { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("AAAAAAE", this.cbxCallMode); }
- }
- /// <summary>
- /// 拨打电话按钮
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnDial_Click(object sender, EventArgs e)
- {
- LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.PhoneCall(this.txtPhone); //手机
- }
- #endregion
- }
- }
|