123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- 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();
- /// <summary>
- /// 副订单号
- /// </summary>
- public string strViceNumber;
- /// <summary>
- /// 是否保存过
- /// </summary>
- public bool IsSave = false;
- /// <summary>
- /// 是否安排(只供本月提醒调用)
- /// </summary>
- public bool IsAnPai = false;
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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();
- }
- /// <summary>
- /// 查询获取订单信息
- /// </summary>
- /// <param name="StrNumber"></param>
- 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; }
- }
- }
- }
- }
- /// <summary>
- /// 保存
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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; }
- }
- }
- /// <summary>
- /// 选择
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- 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; }
- }
- /// <summary>
- /// 取消
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected override void btnCancel_Click(object sender, EventArgs e)
- { this.Close(); }
- }
- }
|