using LYFZ.Software.MainBusiness.CameraControlBook.SmallForm; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Web.UI.WebControls; using System.Windows.Forms; namespace LYFZ.Software.MainBusiness.HospitalTrackingSystem { public partial class AddingSendSingle : LYFZ.Software.UI.HospitalTrackingSystem.AddingSendSingle { BLL.BLL_ErpHospitalDispatchDoor ambll = new BLL.BLL_ErpHospitalDispatchDoor(); public AddingSendSingle() { this.Load += AddingSendSingle_Load; this.Shown += AddingSendSingle_Shown; this.btnClos.Click += btnClos_Click; this.btnAdding.Click += btnAdding_Click; this.mskDoorPeriod.Leave += mskDoorPeriod_Leave; this.btnSelectTime.Click += BtnSelectTime_Click; if (LYFZSS.SystemSpecterPossessed.IsNewCameraControlBook()) { this.btnSelectTime.Show(); } else { this.btnSelectTime.Hide(); } } private void BtnSelectTime_Click(object sender, EventArgs e) { DateTime dayDate = SDateTime.Now; string shopID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID(); if (!String.IsNullOrWhiteSpace(deteDoorTime.DateValue)) { dayDate = Convert.ToDateTime(deteDoorTime.DateValue); } if (String.IsNullOrWhiteSpace(deteDoorTime.DateValue)) { MessageBoxCustom.Show("需要先选择拍照日期"); return; } Model.CameraTimeTemplate cameraTime = PhotographedReservationSmallForm.GetCameraTime(dayDate, shopID, Model.CameraType.爱婴上门, Model.CameraOrderType.爱婴跟踪); if (cameraTime != null) { this.mskDoorPeriod.Text = cameraTime.CameraTime; } } /// /// 是否保存 /// public bool IsSaveed = false; /// /// 订单号 /// public string StrOrderNumber; /// /// 当前操作人员编号 /// string strUserID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; /// /// 窗体加载事件 /// /// /// void AddingSendSingle_Load(object sender, EventArgs e) { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee(this.cbxPhotographers); LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee(this.cbxBootDivision); LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee(this.cbxDriver); LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee(this.comboBoxTreeViewEx1); this.btnAdding.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.HospitalTrackingSystem, CustomAttributes.OperatingAuthority.AddSendSingleTask); } /// /// 窗体加载事件 /// /// /// void AddingSendSingle_Shown(object sender, EventArgs e) { if (TeskRow != null) { this.Text = "修改派单"; this.deteDoorTime.DateValue = Convert.ToDateTime(TeskRow.Cells["上门时间"].Value).ToString("yyyy-MM-dd"); this.comboBoxEx1.Text = TeskRow.Cells["上门状态"].Value.ToString().Trim() == "OK" ? "已上门" : "未上门"; this.cbxPhotographers.Text = TeskRow.Cells["上门人员1"].Value.ToString().Trim(); this.cbxBootDivision.Text = TeskRow.Cells["上门人员2"].Value.ToString().Trim(); this.comboBoxTreeViewEx1.Text = TeskRow.Cells["上门人员3"].Value.ToString().Trim(); this.cbxDriver.Text = TeskRow.Cells["上门人员4"].Value.ToString().Trim(); this.txtVehicle.Text = TeskRow.Cells["车辆"].Value.ToString().Trim(); this.txtRemark.Text = TeskRow.Cells["备注"].Value.ToString().Trim(); this.mskDoorPeriod.Text = Convert.ToDateTime(TeskRow.Cells["上门时间"].Value).ToString("HH:mm"); } else { this.deteDoorTime.DateValue = SDateTime.Now.ToString("yyyy-MM-dd"); } } /// /// 检查输入时间 /// /// /// void mskDoorPeriod_Leave(object sender, EventArgs e) { try { string[] strValueTime = this.mskDoorPeriod.Text.Trim().Split(':'); if (strValueTime[0].Trim() != "") { if (Convert.ToInt32(strValueTime[0]) <= 0 || Convert.ToInt32(strValueTime[0]) > 24) { MessageBoxCustom.Show("不是有效的时间格式"); this.mskDoorPeriod.Text = ""; this.mskDoorPeriod.Focus(); return; } } if (strValueTime[1].Trim() != "") { if (Convert.ToInt32(strValueTime[1]) < 0 || Convert.ToInt32(strValueTime[1]) > 59) { MessageBoxCustom.Show("不是有效的时间格式"); this.mskDoorPeriod.Text = ""; this.mskDoorPeriod.Focus(); return; } } } catch { MessageBoxCustom.Show("不是有效的时间格式"); this.mskDoorPeriod.Text = ""; this.mskDoorPeriod.Focus(); return; } } DataGridViewRow _teskRow = null; public DataGridViewRow TeskRow { get { return _teskRow; } set { _teskRow = value; } } LYFZ.BLL.ReservationTimeData timeDataBll = new BLL.ReservationTimeData(); /// /// 添加按钮 /// /// /// void btnAdding_Click(object sender, EventArgs e) { DateTime strTime = SDateTime.Now; LYFZ.Model.Model_ErpHospitalDispatchDoor model = null; if (TeskRow == null) { if (this.comboBoxEx1.Text.Trim() == "") { MessageBoxCustom.Show("请选择上门状态"); return; } if (this.comboBoxEx1.Text.Trim() == "已上门") { if (this.cbxPhotographers.Text.Trim() == "") { MessageBoxCustom.Show("请选择一个上门人员!"); return; } if (this.deteDoorTime.DateValue.Trim() == "") { MessageBoxCustom.Show("请输入上门日期!"); return; } if (this.mskDoorPeriod.Text.Trim() != ":") { try { Convert.ToDateTime(this.deteDoorTime.DateValue.Trim() + " " + this.mskDoorPeriod.Text.Trim()); } catch { MessageBoxCustom.Show("请输入上门时间!"); return; } } } model = new Model.Model_ErpHospitalDispatchDoor(); model.Hdr_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID(); model.Hdr_ReservationDoorShopID= LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID(); model.Hdr_DoorShopID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID(); model.Hdr_Number = this.StrOrderNumber; if (this.deteDoorTime.DateValue != "") { model.Hdr_DoorTime = Convert.ToDateTime(this.deteDoorTime.DateValue.Trim().ToString()); } else { model.Hdr_DoorTime = LYFZ.WinAPI.CustomPublicMethod.GetNullDateTime(); } if (this.mskDoorPeriod.Text.Trim() == ":") { model.Hdr_DoorPeriod = ""; } else { model.Hdr_DoorPeriod = this.mskDoorPeriod.Text.Trim(); } if (this.comboBoxEx1.Text == "已上门") { model.Hdr_HomeState = 1; model.Hdr_DoorShopID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.CurrentCompanyInfoID; if (string.IsNullOrEmpty(model.Hdr_ReservationDoorShopID)) { model.Hdr_ReservationDoorShopID = model.Hdr_DoorShopID; } } else { model.Hdr_HomeState = 0; } model.Hdr_DoorPersonOne = this.cbxPhotographers.Text.Trim().ToString(); model.Hdr_DoorPersonTwo = this.cbxBootDivision.Text.Trim().ToString(); model.Hdr_Vehicle = this.txtVehicle.Text.Trim().ToString(); model.Hdr_DoorPersonThree = this.comboBoxTreeViewEx1.Text.Trim().ToString(); model.Hdr_DoorPersonFour = this.cbxDriver.Text.Trim().ToString(); model.Hdr_DispatchDoorRemark = this.txtRemark.Text.Trim(); model.Hdr_CreateDatetime = strTime; model.Hdr_CreateName = strUserID; if (ambll.Add(model)) { this.IsSaveed = true; MessageBoxCustom.Show("添加成功!"); } else { MessageBoxCustom.Show("添加失败!"); } } else { List cameraParameterList = new List(); if (this.comboBoxEx1.Text == "") { MessageBoxCustom.Show("请选择上门状态"); return; } if (this.comboBoxEx1.Text == "已上门") { if (this.cbxPhotographers.Text == "") { MessageBoxCustom.Show("请选择一个上门人员!"); return; } if (this.deteDoorTime.Text == "") { MessageBoxCustom.Show("请输入上门日期!"); return; } //if (this.mskDoorPeriod.Text == "") //{ MessageBoxCustom.Show("请输入上门时间!"); return; } } model = ambll.GetModel(Convert.ToInt32(TeskRow.Cells["ID"].Value)); model.Hdr_DoorTime = Convert.ToDateTime(this.deteDoorTime.Text.Trim().ToString()); if (this.mskDoorPeriod.Text.Trim() == ":") { model.Hdr_DoorPeriod = ""; } else { model.Hdr_DoorPeriod = this.mskDoorPeriod.Text.Trim().ToString().Trim(); } if (this.comboBoxEx1.Text == "已上门") { model.Hdr_HomeState = 1; model.Hdr_DoorShopID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.CurrentCompanyInfoID; if (string.IsNullOrEmpty(model.Hdr_ReservationDoorShopID)) { model.Hdr_ReservationDoorShopID = model.Hdr_DoorShopID; } } else { model.Hdr_HomeState = 0; } model.Hdr_DoorPersonOne = this.cbxPhotographers.Text.Trim().ToString(); model.Hdr_DoorPersonTwo = this.cbxBootDivision.Text.Trim().ToString(); model.Hdr_Vehicle = this.txtVehicle.Text.Trim().ToString(); model.Hdr_DoorPersonThree = this.comboBoxTreeViewEx1.Text.Trim().ToString(); model.Hdr_DoorPersonFour = this.cbxDriver.Text.Trim().ToString(); model.Hdr_DispatchDoorRemark = this.txtRemark.Text.Trim(); model.Hdr_DividedShop = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID(); model.Hdr_ReservationDoorShopID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID(); model.Hdr_DoorShopID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID(); List clist = new List(); #region 设置模板预约 string shopID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetLocalCompanyInfoID(); cameraParameterList.Add(new Model.ReservtionParameter { ShopID = shopID , DayDate = this.deteDoorTime.DateValue.Trim() , Time = this.mskDoorPeriod.Text.Trim() , VID = model.ID.ToString() }); string retErrorMsg = ""; if (!this.timeDataBll.UpdateReservationTimeDataCommandInfoList(model.Hdr_Number, model.Hdr_Number, Model.CameraType.爱婴上门, Model.CameraOrderType.爱婴跟踪, cameraParameterList, ref clist, ref retErrorMsg)) { MessageBoxCustom.Show(String.Format("保存预约失败:{0}", retErrorMsg)); return; } #endregion clist.Add(ambll.GetUpdateCommandInfo(model)); if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0) { this.IsSaveed = true; MessageBoxCustom.Show("更新成功!"); } else { MessageBoxCustom.Show("更新失败!"); } } } /// /// 关闭窗体 /// /// /// void btnClos_Click(object sender, EventArgs e) { this.Close(); } } }