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.CameraControlBook.SmallForm { public partial class SelectDressConfirmSmallForm : LYFZ.Software.UI.CameraControlBook.SmallForm.SelectDressConfirmSmallForm { public SelectDressConfirmSmallForm() { this.btnSelect.Click += btnSelect_Click; } LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder(); LYFZ.BLL.BLL_ErpOrderDigital odbll = new BLL.BLL_ErpOrderDigital(); /// /// 副订单号 /// public string strViceNumber; /// /// 是否保存过 /// public bool IsSave = false; /// /// 是否安排(只供本月提醒调用) /// public bool IsAnPai = false; /// /// 窗体加载事件 /// /// /// protected override void SelectDressConfirmSmallForm_Load(object sender, EventArgs e) { if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.CameraControlBook, LYFZ.CustomAttributes.OperatingAuthority.CameraControlBook_SelectDress)) { this.btnSaveed.Enabled = false; } #region 获取数据 //部门人员绑定 LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee(this.cmbtreevdgv, true); TreeNode root = new TreeNode(); root.Text = "OK"; root.Tag = "1"; this.cmbtreevStatus.Nodes.Add(root); root = new TreeNode(); root.Text = "未选"; root.Tag = "0"; this.cmbtreevStatus.Nodes.Add(root); if (this.IsAnPai) { this.cmbtreevdgv.TagFindText(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID); this.cmbtreevStatus.TagFindText("1"); this.cmbtreevdgv.Enabled = false; this.cmbtreevStatus.Enabled = false; } #endregion this.GetOrdNumberGetData(); } /// /// 查询获取订单信息 /// /// void GetOrdNumberGetData() { if (!string.IsNullOrEmpty(this.strViceNumber)) { string strViewName = "tb_ErpOrder Left Join dbo.tb_ErpOrderDigital ON Ord_Number = Ordv_Number left join dbo.tempTB_AggregationCustomer on Ord_Number = GP_OrderNumber Left Join CView_OrderPickupStatusVice on OPlist_ViceNumber = Ordv_ViceNumber"; string strColumnName = "Ordv_ClothingStatus,Ordv_ClothingNumber,Ordv_ClothingName,Ordv_ClothingTime,Ordv_ClothingRemark,Cus_Name,Cus_Sex_cs,CASE Ord_SinceOrderNumber WHEN '' THEN Ord_Number ELSE Ord_SinceOrderNumber END AS ShowOrdNumber,"+ "Ord_SeriesName,Ord_Type,(select stuff((select ',' + dbo.fn_CheckUserIDGetUserName( OrdPe_OrdersPerson) from tb_ErpOrdersPerson where OrdPe_OrderNumber=Ord_Number for xml path('')),1,1,'')) as OrdPe_OrdersPerson,Ordv_ViceNumber,"+ "Case when Ord_Type = '1' then (select top 1 Ordpg_Sights from dbo.tb_ErpOrdersPhotography where Ordpg_Number = Ordv_Number and Ordpg_ViceNumber = Ordv_ViceNumber) else '' end AS Ordpg_Sights,取件状态,"+ "'内景:' + CONVERT(varchar(10),isnull((select Sum(Ordpg_ApparelQuantity) from tb_ErpOrdersPhotography where Ordpg_ViceNumber = Ordv_ViceNumber And Ordpg_SightsType = '0'), 0)) + "+ "' 外景:' + CONVERT(varchar(10),isnull((select Sum(Ordpg_ApparelQuantity) from tb_ErpOrdersPhotography where Ordpg_ViceNumber = Ordv_ViceNumber And Ordpg_SightsType = '1'), 0)) AS 服装套数"; DataTable tbl = orbll.GetView_Custom(strViewName, StrWhere: "Ordv_ViceNumber = '" + this.strViceNumber + "'", filedOrder: "Ordv_DigitalNumber ASC", ShowColumnName: strColumnName).Tables[0]; if (tbl.Rows.Count > 0) { this.txtOrderNumber.Text = tbl.Rows[0]["ShowOrdNumber"].ToString().Trim(); this.txtSeriesName.Text = tbl.Rows[0]["Ord_SeriesName"].ToString().Trim(); this.txtOrdersPerson.Text = tbl.Rows[0]["OrdPe_OrdersPerson"].ToString().Trim(); this.txtClothingCount.Text = tbl.Rows[0]["服装套数"].ToString().Trim(); LYFZ.Software.MainBusiness.CameraControlBook.PublicClass.SetClientData(this.txtName1, this.txtName2, lblName1, lblName2, tbl.Rows[0]["Ord_Type"].ToString().Trim(), tbl.Rows[0]["Cus_Name"].ToString().Trim(), tbl.Rows[0]["Cus_Sex_cs"].ToString().Trim()); if (tbl.Rows.Count > 0) { string strDate = LYFZ.Command.Command_Validate.DateTimeToString(tbl.Rows[0]["Ordv_ClothingTime"]); this.dtpcdgv.DateValue = strDate; string Strtime = LYFZ.Command.Command_Validate.DateTimeToString(tbl.Rows[0]["Ordv_ClothingTime"], "HH:mm"); this.mskdgv.Text = Strtime == "00:00" ? "" : Strtime; this.cmbtreevdgv.Text = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetUserName(tbl.Rows[0]["Ordv_ClothingName"]); this.cmbtreevdgv.Tag = tbl.Rows[0]["Ordv_ClothingName"].ToString().Trim(); this.cmbtreevStatus.TagFindText(tbl.Rows[0]["Ordv_ClothingStatus"]); this.txtdgv.Text = tbl.Rows[0]["Ordv_ClothingRemark"].ToString().Trim(); this.txtDressNumber.Text = tbl.Rows[0]["Ordv_ClothingNumber"].ToString().Trim(); if (tbl.Rows[0]["取件状态"].ToString().Trim() == "OK") { string StrMaengd = tbl.Rows[0]["Ordpg_Sights"].ToString().Trim(); if (string.IsNullOrEmpty(StrMaengd)) { StrMaengd = "订单取件已完成!"; } else { StrMaengd = "'" + tbl.Rows[0]["Ordpg_Sights"].ToString().Trim() + "'取件已完成!"; } MessageBoxCustom.Show(StrMaengd); this.btnSaveed.Enabled = false; } else { this.btnSaveed.Enabled = true; } } } } } /// /// 保存 /// /// /// protected override void btnSaveed_Click(object sender, EventArgs e) { if (MessageBoxCustom.Show("您确定要保存吗?", "温馨提示", MessageBoxButtons.YesNo) != DialogResult.No) { DateTime strTime = SDateTime.Now; if (this.dtpcdgv.DateValue.Trim() != "") { if (this.mskdgv.Text.Trim() != ":") { try { DateTime ssa = Convert.ToDateTime(SDateTime.Now.ToString("yyyy-MM-dd") + " " + this.mskdgv.Text); } catch { MessageBoxCustom.Show("选片时间不是有效时间格式"); this.mskdgv.Text = ""; return; } } } LYFZ.Model.Model_ErpOrderDigital model = odbll.GetModel("Ordv_ViceNumber", this.strViceNumber); model.Ordv_ClothingNumber = this.txtDressNumber.Text.Trim(); model.Ordv_ClothingName = this.cmbtreevdgv.Tag.ToString(); model.Ordv_ClothingStatus = this.cmbtreevStatus.Tag.ToString(); if (this.dtpcdgv.DateValue.Trim() != "" && this.mskdgv.Text.Trim() != ":") { model.Ordv_ClothingTime = Convert.ToDateTime(this.dtpcdgv.DateValue.Trim() + " " + this.mskdgv.Text.Trim() + ":00"); } else if (this.dtpcdgv.DateValue.Trim() != "") { model.Ordv_ClothingTime = Convert.ToDateTime(this.dtpcdgv.DateValue.Trim()); this.mskdgv.Text = ""; } else { model.Ordv_ClothingTime = null; this.mskdgv.Text = ""; } if(model.Ordv_ClothingStatus=="1") { model.Ordv_ClothingShopID = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.CurrentCompanyInfoID; } model.Ordv_ClothingRemark = this.txtdgv.Text.Trim(); model.Ordv_UpdateDateTime = strTime; model.Ordv_UpdateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; if (odbll.Update(model)) { MessageBoxCustom.Show("保存成功"); this.IsSave = true; this.Close(); } else { MessageBoxCustom.Show("保存失败"); return; } } } /// /// 选择 /// /// /// void btnSelect_Click(object sender, EventArgs e) { LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.SelectDressSuperSmallForm frm = new SuperSmallForm.SelectDressSuperSmallForm(); frm.StrValue = this.txtDressNumber.Text.Trim(); frm.ShowDialog(); if (frm.IsSaveed) { this.txtDressNumber.Text = frm.StrValue; } } /// /// 取消 /// /// /// protected override void btnCancel_Click(object sender, EventArgs e) { this.Close(); } } }