using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data; using System.Collections; using LYFZ.ComponentLibrary; using System.Drawing; using System.IO; using System.ComponentModel; using System.Globalization; using LYFZ.Helper; using System.Windows.Forms.DataVisualization.Charting; namespace LYFZ.Software.MainBusiness.DoorCityProcess { public class PublicGraphics { /// /// 标题字体笔刷 /// public static Brush btitle = Brushes.White; /// /// 标题分割线笔刷 /// public static Pen ptitle = new Pen(Brushes.White, 1); /// /// 标题 /// public static Brush backColortitle = Brushes.DarkSlateGray; /// /// 边框颜色 /// public static Pen PenborderColor = new Pen(Brushes.LightSlateGray, 1); /// /// 单行填充背景颜色 /// public static Brush brSingle = Brushes.PapayaWhip; /// /// 双行填充背景颜色 /// public static Brush brDouble = Brushes.PowderBlue; } /// /// 公共处理类 /// public class PublicCodeClasses { static LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder(); static LYFZ.BLL.BLL_ErpOrderDigital odbll = new BLL.BLL_ErpOrderDigital(); static LYFZ.BLL.BLL_ErpOrderDigitalStatus orsbll = new BLL.BLL_ErpOrderDigitalStatus(); public delegate void UpdateControl(); #region 图表颜色 public static Color[] myChartsColor = new Color[40] { Color.Red,//红 Color.Blue,//蓝 Color.Yellow,//黄 Color.Green, //绿 Color.Orange, //橙 Color.Cyan, //青 Color.Purple, //紫 Color.Gray, //灰 DeepPink Color.DarkRed, //深红 Color.DarkBlue,//深蓝 Maroon Color.Gold,//金(大黄) Color.DarkGreen,//深绿 Color.DarkOrange,//深橙 Color.DarkCyan,//深青 Color.MediumPurple,//中紫 Color.DarkGray,//深灰 Color.PaleVioletRed,//浅红 Color.LightBlue, Color.LightYellow, Color.LightGreen, Color.LightCyan, Color.LightGray, Color.MediumVioletRed,//中红 Color.MediumBlue , Color.MediumSeaGreen, Color.MediumSlateBlue, Color.MediumSpringGreen, Color.Magenta, Color.Navy, Color.Olive, Color.OliveDrab, Color.OrangeRed, Color.Orchid, Color.PaleGoldenrod, Color.PaleGreen, Color.Peru, Color.Crimson, Color.BlueViolet, Color.Fuchsia, Color.LawnGreen }; #endregion #region 农历、公历转换 /// /// 获取公历转成农历 /// /// /// public DateTime GetChineseLunisolarCalendar( string StrDateTime ) { ChineseLunisolarCalendar cls = new ChineseLunisolarCalendar(); DateTime time = Convert.ToDateTime(StrDateTime); //获取年 int Year = Convert.ToInt32(SDateTime.Now.Year); //获取月 int Mouth = Convert.ToInt32(time.Month); //获取日 int Day = Convert.ToInt32(time.Day); try { return cls.ToDateTime(Year, Mouth, Day, 0, 0, 0, 0); } catch { return cls.ToDateTime(Year, Mouth, Day - 1, 0, 0, 0, 0); } } /// /// 农历转公历 /// /// 农历日期 public static string GetLunarCalendarToSolarCalendar( string StrDateTime ) { if ( !string.IsNullOrEmpty(StrDateTime) ) { string[] str = StrDateTime.Split('-'); System.Globalization.ChineseLunisolarCalendar cls = new System.Globalization.ChineseLunisolarCalendar(); try { StrDateTime = cls.ToDateTime(Convert.ToInt32(str[0]), Convert.ToInt32(str[1]), Convert.ToInt32(str[2]), 0, 0, 0, 0).ToString(); return StrDateTime; } catch { } } return ""; } #endregion #region DataGridView、Table 相互转换 /// /// 把DataGridViewEc 放到DataTable /// /// /// public DataTable GetDataGridViewToTable( DataGridViewEc dgvData ) { DataTable newtbl = new DataTable(); for ( int i = 0; i < dgvData.Columns.Count; i++ ) { DataColumn dc = new DataColumn(dgvData.Columns[i].Name.ToString()); newtbl.Columns.Add(dc); } for ( int i = 0; i < dgvData.Rows.Count; i++ ) { DataRow dr = newtbl.NewRow(); for ( int j = 0; j < dgvData.Columns.Count; j++ ) { dr[j] = Convert.ToString(dgvData.Rows[i].Cells[j].Value.ToString()); } newtbl.Rows.Add(dr); } return newtbl; } /// /// 把一个DataTable 放到别一个DataTable,原因是不不让两个DataTable同步 /// /// /// public DataTable GetTableToTable( DataTable tbl ) { DataTable newtbl = new DataTable(); for ( int i = 0; i < tbl.Columns.Count; i++ ) { DataColumn dc = new DataColumn(tbl.Columns[i].ColumnName.ToString()); newtbl.Columns.Add(dc); } for ( int i = 0; i < tbl.Rows.Count; i++ ) { DataRow dr = newtbl.NewRow(); for ( int j = 0; j < tbl.Columns.Count; j++ ) { dr[j] = Convert.ToString(tbl.Rows[i][j].ToString()); } newtbl.Rows.Add(dr); } return newtbl; } /// /// 将套系包含商品DataGridView的列和值遍历放置DataTable去 /// /// /// public DataTable GetDgvToTable( DataGridView dgv, string OrderNumber, bool NumberType ) { DataTable dt = new DataTable(); dt.Columns.Add("OPlist_OrderNumber", typeof(string)); dt.Columns.Add("OPlist_Type", typeof(string)); dt.Columns.Add("OPlist_ProdNumber", typeof(string)); dt.Columns.Add("OPlist_ProdName", typeof(string)); dt.Columns.Add("OPlist_Batch", typeof(string)); dt.Columns.Add("OPlist_ProdSoldPrice", typeof(string)); dt.Columns.Add("OPlist_ProdQuantity", typeof(string)); dt.Columns.Add("OPlist_IsExpedited", typeof(string)); dt.Columns.Add("OPlist_PickupTime", typeof(string)); for ( int i = 0; i < dgv.Rows.Count; i++ ) { DataRow dr = dt.NewRow(); dr["OPlist_OrderNumber"] = OrderNumber; dr["OPlist_Type"] = "0";// 0为套系包含商品 1为服务 dr["OPlist_ProdNumber"] = dgv.Rows[i].Cells["T_Column1"].Value.ToString().Trim(); dr["OPlist_ProdName"] = dgv.Rows[i].Cells["T_Column2"].Value.ToString().Trim(); dr["OPlist_Batch"] = dgv.Rows[i].Cells["T_Column7"].Value.ToString().Trim() == "" ? "0" : dgv.Rows[i].Cells["T_Column7"].Value.ToString().Trim(); dr["OPlist_ProdSoldPrice"] = dgv.Rows[i].Cells["T_Column3"].Value.ToString().Trim() == "" ? "0" : dgv.Rows[i].Cells["T_Column3"].Value.ToString().Trim(); dr["OPlist_ProdQuantity"] = dgv.Rows[i].Cells["T_Column4"].Value.ToString().Trim() == "" ? "0" : dgv.Rows[i].Cells["T_Column4"].Value.ToString().Trim(); if ( NumberType ) { dr["OPlist_IsExpedited"] = dgv.Rows[i].Cells["T_Column5"].Value.ToString().Trim() == "" || dgv.Rows[i].Cells["T_Column5"].Value.ToString().Trim() == "否" ? "0" : "1"; } else { dr["OPlist_IsExpedited"] = "0"; } dr["OPlist_PickupTime"] = dgv.Rows[i].Cells["T_Column6"].Value.ToString().Trim() == "null" ? "" : dgv.Rows[i].Cells["T_Column6"].Value.ToString().Trim(); dt.Rows.Add(dr); } return dt; } /// /// 将套系包含商品mlist的列和值遍历放置DataTable去 /// /// /// public DataTable GetDgvToTable( List pllist, string OrderNumber, bool NumberType ) { DataTable dt = new DataTable(); dt.Columns.Add("OPlist_OrderNumber", typeof(string)); dt.Columns.Add("OPlist_Type", typeof(string)); dt.Columns.Add("OPlist_ProdNumber", typeof(string)); dt.Columns.Add("OPlist_ProdName", typeof(string)); dt.Columns.Add("OPlist_Batch", typeof(string)); dt.Columns.Add("OPlist_ProdSoldPrice", typeof(string)); dt.Columns.Add("OPlist_ProdQuantity", typeof(string)); dt.Columns.Add("OPlist_IsExpedited", typeof(string)); dt.Columns.Add("OPlist_PickupTime", typeof(string)); for ( int i = 0; i < pllist.Count; i++ ) { DataRow dr = dt.NewRow(); dr["OPlist_OrderNumber"] = OrderNumber; dr["OPlist_Type"] = "0";// 0为套系包含商品 1为服务 dr["OPlist_ProdNumber"] = pllist[i].OPlist_ProdNumber; dr["OPlist_ProdName"] = pllist[i].OPlist_ProdName; dr["OPlist_Batch"] = pllist[i].OPlist_Batch; dr["OPlist_ProdSoldPrice"] = pllist[i].OPlist_ProdSoldPrice; dr["OPlist_ProdQuantity"] = pllist[i].OPlist_ProdQuantity; if ( NumberType ) { dr["OPlist_IsExpedited"] = pllist[i].OPlist_IsExpedited; } else { dr["OPlist_IsExpedited"] = "0"; } dr["OPlist_PickupTime"] = pllist[i].OPlist_PickupTime; dt.Rows.Add(dr); } return dt; } /// /// 将服务DataGridView的列和值遍历放置DataTable去 /// /// /// /// public DataTable GetDgvToTable( DataTable ddt, DataTable dt, Hashtable htData ) { if ( dt.Rows.Count <= 0 ) { if ( dt.Columns.Count <= 0 ) { dt.Columns.Add("OPlist_OrderNumber", typeof(string)); dt.Columns.Add("OPlist_Type", typeof(string)); dt.Columns.Add("OPlist_ProdNumber", typeof(string)); dt.Columns.Add("OPlist_ProdName", typeof(string)); dt.Columns.Add("OPlist_Batch", typeof(string)); dt.Columns.Add("OPlist_ProdSoldPrice", typeof(string)); dt.Columns.Add("OPlist_ProdQuantity", typeof(string)); dt.Columns.Add("OPlist_IsExpedited", typeof(string)); dt.Columns.Add("OPlist_PickupTime", typeof(string)); } } for ( int i = 0; i < ddt.Rows.Count; i++ ) { DataRow dr = dt.NewRow(); dr["OPlist_OrderNumber"] = htData["OrderNumber"].ToString().Trim(); dr["OPlist_Type"] = 0;// 0为套系包含商品 1为服务 dr["OPlist_ProdNumber"] = ddt.Rows[i]["Prod_Number"].ToString().Trim(); dr["OPlist_ProdName"] = ddt.Rows[i]["Prod_Name"].ToString().Trim(); dr["OPlist_Batch"] = ddt.Rows[i]["Prod_Batch"].ToString().Trim(); dr["OPlist_ProdSoldPrice"] = ddt.Rows[i]["Prod_SalesPrice"].ToString().Trim(); dr["OPlist_ProdQuantity"] = ddt.Rows[i]["Prod_Quantity"].ToString().Trim(); if ( htData["ProductVesting"].ToString().Trim() == "1" ) { dr["OPlist_IsExpedited"] = ddt.Rows[i]["Prod_Expedited"].ToString().Trim(); dr["OPlist_PickupTime"] = "NULL"; } else { dr["OPlist_IsExpedited"] = ""; dr["OPlist_PickupTime"] = ""; } dt.Rows.Add(dr); } return dt; } /// /// 将服务DataGridView的列和值遍历放置DataTable去 /// /// /// public DataTable GetDgvToTable( DataRow dtRow, DataTable Oldtbl, Hashtable htData ) { if ( Oldtbl.Columns.Count <= 0 ) { Oldtbl.Columns.Add("OPlist_OrderNumber", typeof(string)); Oldtbl.Columns.Add("OPlist_Type", typeof(string)); Oldtbl.Columns.Add("OPlist_ProdNumber", typeof(string)); Oldtbl.Columns.Add("OPlist_ProdName", typeof(string)); Oldtbl.Columns.Add("OPlist_Batch", typeof(string)); Oldtbl.Columns.Add("OPlist_ProdSoldPrice", typeof(string)); Oldtbl.Columns.Add("OPlist_ProdQuantity", typeof(string)); Oldtbl.Columns.Add("OPlist_IsExpedited", typeof(string)); Oldtbl.Columns.Add("OPlist_PickupTime", typeof(string)); } if ( dtRow != null ) { DataRow dr = Oldtbl.NewRow(); dr["OPlist_OrderNumber"] = htData["OrderNumber"].ToString().Trim(); dr["OPlist_Type"] = 0;// 0为套系包含商品 1为服务 dr["OPlist_ProdNumber"] = dtRow["Prod_Number"].ToString().Trim(); dr["OPlist_ProdName"] = dtRow["Prod_Name"].ToString().Trim(); dr["OPlist_Batch"] = dtRow["Prod_Batch"].ToString().Trim(); dr["OPlist_ProdSoldPrice"] = dtRow["Prod_SalesPrice"].ToString().Trim(); dr["OPlist_ProdQuantity"] = htData["ProductQuantity"].ToString().Trim(); if ( htData["ProductVesting"].ToString().Trim() == "1" ) { dr["OPlist_IsExpedited"] = dtRow["Prod_Expedited"].ToString().Trim(); dr["OPlist_PickupTime"] = "NULL"; } else { dr["OPlist_IsExpedited"] = ""; dr["OPlist_PickupTime"] = ""; } Oldtbl.Rows.Add(dr); } return Oldtbl; } /// /// 将列表中相同的订单合并为一条(用于拍照客人打印——明细、派工) /// /// /// public DataGridViewEx GetDgvToDgv( DataGridViewEc dgv, bool IsSelect = true ) { DataGridViewEx newDgv = new DataGridViewEx(); for ( int i = 0; i < dgv.Columns.Count; i++ ) { DataGridViewColumn dgvcl = new DataGridViewColumn(); dgvcl.HeaderText = dgv.Columns[i].HeaderText; dgvcl.Name = dgv.Columns[i].Name; newDgv.Columns.Add(dgvcl); } if ( IsSelect ) { for ( int i = 0; i < dgv.SelectedRows.Count; i++ ) { if ( newDgv.Rows.Count == 0 ) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewTextBoxCell cell = null; for ( int j = 0; j < dgv.Columns.Count; j++ ) { cell = new DataGridViewTextBoxCell(); cell.Value = dgv.SelectedRows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim(); dgvr.Cells.Add(cell); } newDgv.Rows.Add(dgvr); } else { bool IsEnter = true; for ( int j = 0; j < newDgv.Rows.Count; j++ ) { try { if ( dgv.SelectedRows[i].Cells["订单号"].Value.ToString().Trim() == newDgv.Rows[j].Cells["订单号"].Value.ToString().Trim() ) { string StrSights = newDgv.Rows[j].Cells["景点"].Value.ToString().Trim(); newDgv.Rows[j].Cells["景点"].Value = StrSights + "," + dgv.SelectedRows[i].Cells["景点"].Value.ToString().Trim(); IsEnter = false; break; } } catch { } try { if ( dgv.SelectedRows[i].Cells["订单号"].Value.ToString().Trim() == newDgv.Rows[j].Cells["订单号"].Value.ToString().Trim() ) { if ( Convert.ToDateTime(newDgv.Rows[j].Cells["取件时间"].Value) > Convert.ToDateTime(dgv.SelectedRows[i].Cells["取件时间"].Value) ) { newDgv.Rows[j].Cells["取件时间"].Value = newDgv.Rows[j].Cells["取件时间"].Value.ToString().Trim(); } else { newDgv.Rows[j].Cells["取件时间"].Value = dgv.SelectedRows[i].Cells["取件时间"].Value.ToString().Trim(); } IsEnter = false; break; } } catch { } try { if ( dgv.SelectedRows[i].Cells["订单号"].Value.ToString().Trim() == newDgv.Rows[j].Cells["订单号"].Value.ToString().Trim() ) { if ( Convert.ToDateTime(newDgv.Rows[j].Cells["婚庆时间"].Value) > Convert.ToDateTime(dgv.SelectedRows[i].Cells["婚庆时间"].Value) ) { newDgv.Rows[j].Cells["婚庆时间"].Value = newDgv.Rows[j].Cells["婚庆时间"].Value.ToString().Trim(); } else { newDgv.Rows[j].Cells["婚庆时间"].Value = dgv.SelectedRows[i].Cells["婚庆时间"].Value.ToString().Trim(); } IsEnter = false; break; } } catch { } } if ( IsEnter ) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewTextBoxCell cell = null; for ( int j = 0; j < dgv.Columns.Count; j++ ) { cell = new DataGridViewTextBoxCell(); cell.Value = dgv.SelectedRows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim(); dgvr.Cells.Add(cell); } newDgv.Rows.Add(dgvr); } } } } else { for ( int i = 0; i < dgv.Rows.Count; i++ ) { if ( newDgv.Rows.Count == 0 ) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewTextBoxCell cell = null; for ( int j = 0; j < dgv.Columns.Count; j++ ) { cell = new DataGridViewTextBoxCell(); cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim(); dgvr.Cells.Add(cell); } newDgv.Rows.Add(dgvr); } else { bool IsEnter = true; for ( int j = 0; j < newDgv.Rows.Count; j++ ) { try { if ( dgv.Rows[i].Cells["订单号"].Value.ToString().Trim() == newDgv.Rows[j].Cells["订单号"].Value.ToString().Trim() ) { string StrSights = newDgv.Rows[j].Cells["景点"].Value.ToString().Trim(); newDgv.Rows[j].Cells["景点"].Value = StrSights + "," + dgv.Rows[i].Cells["景点"].Value.ToString().Trim(); IsEnter = false; break; } } catch { } try { if ( dgv.Rows[i].Cells["订单号"].Value.ToString().Trim() == newDgv.Rows[j].Cells["订单号"].Value.ToString().Trim() ) { if ( Convert.ToDateTime(newDgv.Rows[j].Cells["取件时间"].Value) > Convert.ToDateTime(dgv.Rows[i].Cells["取件时间"].Value) ) { newDgv.Rows[j].Cells["取件时间"].Value = newDgv.Rows[j].Cells["取件时间"].Value.ToString().Trim(); } else { newDgv.Rows[j].Cells["取件时间"].Value = dgv.Rows[i].Cells["取件时间"].Value.ToString().Trim(); } IsEnter = false; break; } } catch { } try { if ( dgv.Rows[i].Cells["订单号"].Value.ToString().Trim() == newDgv.Rows[j].Cells["订单号"].Value.ToString().Trim() ) { if ( Convert.ToDateTime(newDgv.Rows[j].Cells["婚庆时间"].Value) > Convert.ToDateTime(dgv.Rows[i].Cells["婚庆时间"].Value) ) { newDgv.Rows[j].Cells["婚庆时间"].Value = newDgv.Rows[j].Cells["婚庆时间"].Value.ToString().Trim(); } else { newDgv.Rows[j].Cells["婚庆时间"].Value = dgv.Rows[i].Cells["婚庆时间"].Value.ToString().Trim(); } IsEnter = false; break; } } catch { } } if ( IsEnter ) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewTextBoxCell cell = null; for ( int j = 0; j < dgv.Columns.Count; j++ ) { cell = new DataGridViewTextBoxCell(); cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim(); dgvr.Cells.Add(cell); } newDgv.Rows.Add(dgvr); } } } } return newDgv; } /// /// 返回新的DataGridViewEx /// /// /// public DataGridViewEx GetDgvToNewDgv( DataGridViewEx dgv ) { DataGridViewEx newDgv = new DataGridViewEx(); for ( int i = 0; i < dgv.Columns.Count; i++ ) { DataGridViewColumn dgvcl = new DataGridViewColumn(); dgvcl.HeaderText = dgv.Columns[i].HeaderText; dgvcl.Name = dgv.Columns[i].Name; newDgv.Columns.Add(dgvcl); } for ( int i = 0; i < dgv.Rows.Count; i++ ) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewTextBoxCell cell = null; for ( int j = 0; j < dgv.Columns.Count; j++ ) { cell = new DataGridViewTextBoxCell(); cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim(); cell.Tag = dgv.Rows[i].Cells[dgv.Columns[j].Name].Tag; dgvr.Cells.Add(cell); } newDgv.Rows.Add(dgvr); } return newDgv; } /// /// 返回新的DataGridViewEc /// /// /// public DataGridViewEc GetDgvToNewDgv( DataGridViewEc dgv ) { DataGridViewEc newDgv = new DataGridViewEc(); for ( int i = 0; i < dgv.Columns.Count; i++ ) { DataGridViewColumn dgvcl = new DataGridViewColumn(); dgvcl.HeaderText = dgv.Columns[i].HeaderText; dgvcl.Name = dgv.Columns[i].Name; newDgv.Columns.Add(dgvcl); } for ( int i = 0; i < dgv.Rows.Count; i++ ) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewTextBoxCell cell = null; for ( int j = 0; j < dgv.Columns.Count; j++ ) { cell = new DataGridViewTextBoxCell(); cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim(); cell.Tag = dgv.Rows[i].Cells[dgv.Columns[j].Name].Tag; dgvr.Cells.Add(cell); } newDgv.Rows.Add(dgvr); } return newDgv; } /// /// 门市流程开单里的套系商品合并相同数据_商品表 /// /// /// public DataGridViewEx GetDgvMergeDuplicateNewDgv_Prod( DataGridViewEx dgv ) { DataGridViewEx newDgv = new DataGridViewEx(); for ( int i = 0; i < dgv.Columns.Count; i++ ) { DataGridViewColumn dgvcl = new DataGridViewColumn(); dgvcl.HeaderText = dgv.Columns[i].HeaderText; dgvcl.Name = dgv.Columns[i].Name; newDgv.Columns.Add(dgvcl); } for ( int i = 0; i < dgv.Rows.Count; i++ ) { if ( newDgv.Rows.Count == 0 ) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewTextBoxCell cell = null; for ( int j = 0; j < dgv.Columns.Count; j++ ) { cell = new DataGridViewTextBoxCell(); cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim(); dgvr.Cells.Add(cell); } newDgv.Rows.Add(dgvr); } else { bool IsEnter = true; for ( int j = 0; j < newDgv.Rows.Count; j++ ) { if ( dgv.Rows[i].Cells["T_Column1"].Value.ToString().Trim() == newDgv.Rows[j].Cells["T_Column1"].Value.ToString().Trim() ) { if ( dgv.Rows[i].Cells["T_Column7"].Value.ToString().Trim() == newDgv.Rows[j].Cells["T_Column7"].Value.ToString().Trim() ) { if ( dgv.Columns["T_Column5"] != null ) { newDgv.Rows[j].Cells["T_Column5"].Value = dgv.Rows[i].Cells["T_Column5"].Value.ToString().Trim(); } if ( dgv.Rows[i].Cells["T_Column6"].Value.ToString().Trim() != "" ) { if ( Convert.ToDateTime(dgv.Rows[i].Cells["T_Column6"].Value) > Convert.ToDateTime(newDgv.Rows[j].Cells["T_Column6"].Value) ) { newDgv.Rows[j].Cells["T_Column6"].Value = dgv.Rows[i].Cells["T_Column6"].Value.ToString().Trim(); } } newDgv.Rows[j].Cells["T_Column4"].Value = (Convert.ToInt32(newDgv.Rows[j].Cells["T_Column4"].Value) + Convert.ToInt32(dgv.Rows[i].Cells["T_Column4"].Value)); IsEnter = false; break; } } } if ( IsEnter ) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewTextBoxCell cell = null; for ( int j = 0; j < dgv.Columns.Count; j++ ) { cell = new DataGridViewTextBoxCell(); cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim(); dgvr.Cells.Add(cell); } newDgv.Rows.Add(dgvr); } } } return newDgv; } /// /// 门市流程开单里的套系商品合并相同数据_商品表 /// /// /// public DataGridViewEx GetDgvMergeDuplicateNewDgv_Service( DataGridViewEx dgv ) { DataGridViewEx newDgv = new DataGridViewEx(); for ( int i = 0; i < dgv.Columns.Count; i++ ) { DataGridViewColumn dgvcl = new DataGridViewColumn(); dgvcl.HeaderText = dgv.Columns[i].HeaderText; dgvcl.Name = dgv.Columns[i].Name; newDgv.Columns.Add(dgvcl); } for ( int i = 0; i < dgv.Rows.Count; i++ ) { if ( newDgv.Rows.Count == 0 ) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewTextBoxCell cell = null; for ( int j = 0; j < dgv.Columns.Count; j++ ) { cell = new DataGridViewTextBoxCell(); cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim(); dgvr.Cells.Add(cell); } newDgv.Rows.Add(dgvr); } else { bool IsEnter = true; for ( int j = 0; j < newDgv.Rows.Count; j++ ) { if ( dgv.Rows[i].Cells["H_Column1"].Value.ToString().Trim() == newDgv.Rows[j].Cells["H_Column1"].Value.ToString().Trim() ) { newDgv.Rows[j].Cells["H_Column4"].Value = (Convert.ToInt32(newDgv.Rows[j].Cells["H_Column4"].Value) + Convert.ToInt32(dgv.Rows[i].Cells["H_Column4"].Value)); IsEnter = false; break; } } if ( IsEnter ) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewTextBoxCell cell = null; for ( int j = 0; j < dgv.Columns.Count; j++ ) { cell = new DataGridViewTextBoxCell(); cell.Value = dgv.Rows[i].Cells[dgv.Columns[j].Name].Value.ToString().Trim(); dgvr.Cells.Add(cell); } newDgv.Rows.Add(dgvr); } } } return newDgv; } #endregion #region 星期几 /// /// 星期几 /// public static string CaculateWeekDay( string StrE_WeekDay ) { switch ( StrE_WeekDay ) { case "Monday": StrE_WeekDay = "星期一"; break; case "Tuesday": StrE_WeekDay = "星期二"; break; case "Wednesday": StrE_WeekDay = "星期三"; break; case "Thursday": StrE_WeekDay = "星期四"; break; case "Friday": StrE_WeekDay = "星期五"; break; case "Saturday": StrE_WeekDay = "星期六"; break; case "Sunday": StrE_WeekDay = "星期日"; break; } return StrE_WeekDay; } #endregion #region 导入相片 /// /// 默认选择导出的路径 /// public static string defaultExportFilePath = ""; /// /// 默认选择导入的路径 /// public static string defaultImportFilePath = ""; /// /// 导入初修片 /// public static bool ImportRepairPiece( string StrOrdNumber, string StrViceNumber, string SightsName, ref LYFZ.Model.Model_ErpOrderDigital _modelDigital, string pickUpStatus = "") { bool IsSaveed = false; string StrStatus = "2"; List clist = new List(); string StrUserName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; DateTime StrTime = SDateTime.Now; LYFZ.Model.Model_ErpOrderDigital modelEarlyRepairStatus = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);// LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.ConductionPieceGuideSmallForm frm = new SuperSmallForm.ConductionPieceGuideSmallForm(); frm.processName = "初修"; if ( pickUpStatus.Contains("OK") ) { frm.chkImport.Enabled = false; frm.chkImport.Checked = false; frm.chkNotImport.Checked = true; } frm.IsStatusOK = modelEarlyRepairStatus.Ordv_EarlyRepairStatus == "2" ? true : false; frm.StrOrdNumber = StrOrdNumber; frm.StrOrdViceNumber = StrViceNumber; frm.IsShowPwd = true; frm.StrType = "3"; frm.StrStatusText = "初修"; frm.ShowDialog(); if ( frm.IsSaveed ) { if ( !frm.IsImportStatus ) { StrStatus = "1"; } else { StrStatus = "2"; } if ( frm.IsImport ) { FolderBrowserDialog fbd = new FolderBrowserDialog(); if ( defaultExportFilePath != "" ) { if ( Directory.Exists(defaultExportFilePath) ) //设置此次默认目录为上一次选中目录 { fbd.SelectedPath = defaultExportFilePath; } } if ( fbd.ShowDialog() == DialogResult.OK ) { defaultExportFilePath = fbd.SelectedPath;//记录选中的目录 #region 导入像片 try { LYFZ.Model.Model_ErpOrder ord_model = orbll.GetModel("Ord_Number", StrOrdNumber); System.IO.DirectoryInfo strprht = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetImportPhotoPath((EnumPublic.OrderType)Convert.ToInt32(ord_model.Ord_Type), LYFZ.BLL.SelectPhotoHandling.ImportExportType.EarlyRetouch, StrOrdNumber, SightsName); if ( strprht == null ) { return false; } LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);// LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(ord_model, vmodel); List sPrimitivePhotoList = sPh.GetSpecifyTypePhotoList(Model.Model_ErpOrder.DirectoryType.PrimitivePicture, BLL.SelectPhotoHandling.PhotoType.Original); List sEarlyPhotoList = sPh.GetSpecifyTypePhotoList(Model.Model_ErpOrder.DirectoryType.EarlyRetouch, BLL.SelectPhotoHandling.PhotoType.Original); #region 2017-03-12 杨云奕禁用,修改添加入上传队列 if ( !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableQueuingGuide ) { LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker ) { LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(ord_model, vmodel); IsSaveed = pe.ImportEarlyRetouchFilm(fbd.SelectedPath.ToString().Trim(), strprht.FullName, backgroundWorker, importGenerateThumbnails: frm.IsSmallMap); }, width: 500); if ( IsSaveed ) { #region 修改导入修片地址 LYFZ.Model.Model_ErpOrder modelOrder = orbll.GetModel("Ord_Number", StrOrdNumber); modelOrder.Ord_PhotoPath = sPh.UpdatePhotoImportDirectoryPath(Model.Model_ErpOrder.DirectoryType.EarlyRetouch, strprht.FullName); modelOrder.Ord_PhotoBackupPath = "NEW"; modelOrder.Ord_UpdateDateTime = StrTime; modelOrder.Ord_UpdateName = StrUserName; clist.Add(orbll.GetImportPhotoUpdateOrder(modelOrder)); #endregion } else { return false; } } else { LYFZ.Software.MainBusiness.MultipleFileImport.frmFileImportModel importFileMod = new MultipleFileImport.frmFileImportModel() { service_Path = strprht.FullName.Trim(), erpOrder = ord_model, directoryType = Model.Model_ErpOrder.DirectoryType.EarlyRetouch, erpDigOrder = vmodel, sPh = sPh, OrdNumber = StrOrdNumber, OrdViceNumber = StrViceNumber, StrStatus = StrStatus, takenName = SightsName, comeDirectoryPath = fbd.SelectedPath.ToString().Trim(), CurrentCompanyInfoID = LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID, importGenerateThumbnails = true,//frm.IsSmallMap, FrmClist = frm.clist }; if (MultipleFileImport.NewMultipFileImport.NewMultipFileImport.CheckImportFileByEarlyRetouch(importFileMod) ) { List importedPhotoList = importFileMod.sPh.GetLocalPhotoList(fbd.SelectedPath.ToString().Trim()); foreach ( string str in importedPhotoList ) { importFileMod.local_Path.Add(new LYFZ.Software.MainBusiness.MultipleFileImport.frmFileImportItemModel() { success = false, local_Path = str, upload_Msg = "", user_Time = 0 }); } string upFileInfo = ""; ///检查相同订单中是否存在相同的图片 if (MultipleFileImport.NewMultipFileImport.NewMultipFileImport.CheckOrderUp(importFileMod, Model.Model_ErpOrder.DirectoryType.EarlyRetouch, ref upFileInfo) ) { ///执行导入 MultipleFileImport.NewMultipFileImport.NewMultipFileImport.AddDataPools(importFileMod); MessageBoxCustom.Show("成功加入导片队列;"); IsSaveed = true; } else { LYFZ.PhotoSelectSystem.ImportRepairPieceWarning importWarning = new LYFZ.PhotoSelectSystem.ImportRepairPieceWarning("队列冲突", upFileInfo); importWarning.TopMost = true; importWarning.SbtnContinueImport.Visible = false; importWarning.ShowDialog(); return false; } } else { return false; } } #endregion } catch { MessageBoxCustom.Show("相片初修片路径的访问被拒绝"); return false; } #endregion } else { return false; } } LYFZ.Model.Model_ErpOrderDigital modelDigital = odbll.GetModel("Ordv_ViceNumber", StrViceNumber); if ( modelDigital.Ordv_EarlyRepairStatus.Trim() != "2" ) { modelDigital.Ordv_EarlyRepairName = StrUserName; modelDigital.Ordv_EarlyRepairTime = StrTime; modelDigital.Ordv_EarlyRepairStatus = StrStatus; } modelDigital.Ordv_UpdateDateTime = StrTime; modelDigital.Ordv_UpdateName = StrUserName; clist.Add(odbll.GetUpdateCommandInfo(modelDigital)); DataTable dt = orbll.GetView_Custom("tb_ErpOrderDigitalStatus", StrWhere: "Ords_OrdNumber = '" + StrOrdNumber + "' And Ords_ViceNumber = '" + StrViceNumber + "'", ShowColumnName: "*").Tables[0]; LYFZ.Model.Model_ErpOrderDigitalStatus modelStatus = null; if ( dt.Rows.Count > 0 ) { modelStatus = orsbll.DataRowToModel(dt.Rows[0]); if ( modelStatus.Ords_OutSendEarlyRepairStatus.Trim() == "已发" || modelStatus.Ords_OutSendEarlyRepairStatus.Trim() == "已回" ) { modelStatus.Ords_OutSendEarlyRepairName = StrUserName; modelStatus.Ords_OutSendEarlyRepairStatus = "已回"; modelStatus.Ords_OutSendEarlyRepairTime = StrTime; clist.Add(orsbll.GetUpdateCommandInfo(modelStatus)); } } clist.AddRange(frm.clist); if ( LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) <= 0 ) { IsSaveed = false; MessageBoxCustom.Show("导入失败;"); } else { if ( !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableQueuingGuide ) { if ( frm.itemEx != null ) { frm.itemEx.SetServicePhotographCount(LYFZ.Model.Model_ErpOrder.DirectoryType.EarlyRetouch); } } MessageBoxCustom.Show("导入成功;"); } _modelDigital = modelDigital; IsSaveed = true; } return IsSaveed; } /// /// 导入精修片 /// /// /// /// /// public static bool ImportRefinedRepairPiece( string StrOrdNumber, string StrViceNumber, string SightsName, ref LYFZ.Model.Model_ErpOrderDigital _modelDigital, string pickUpStatus = "" ) { bool IsSaveed = false; string StrStatus = "2"; List clist = new List(); string MainOrderNumber = StrOrdNumber; string StrUserName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; DateTime StrTime = SDateTime.Now; LYFZ.Model.Model_ErpOrderDigital modelRefinedRepairStatus = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);// LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.ConductionPieceGuideSmallForm frm = new SuperSmallForm.ConductionPieceGuideSmallForm(); frm.processName = "精修"; if ( pickUpStatus.Contains("OK") ) { frm.chkImport.Enabled = false; frm.chkImport.Checked = false; frm.chkNotImport.Checked = true; } frm.IsStatusOK = modelRefinedRepairStatus.Ordv_RefinementStatus == "2" ? true : false; frm.StrOrdNumber = MainOrderNumber; frm.StrOrdViceNumber = StrViceNumber; frm.StrStatusText = "精修"; frm.StrType = "5"; frm.ShowDialog(); if ( frm.IsSaveed ) { if ( !frm.IsImportStatus ) { StrStatus = "1"; } else { StrStatus = "2"; } if ( frm.IsImport ) { FolderBrowserDialog fbd = new FolderBrowserDialog(); if ( defaultExportFilePath != "" ) { if ( Directory.Exists(defaultExportFilePath) ) //设置此次默认目录为上一次选中目录 { fbd.SelectedPath = defaultExportFilePath; } } if ( fbd.ShowDialog() == DialogResult.OK ) { defaultExportFilePath = fbd.SelectedPath; try { LYFZ.Model.Model_ErpOrder ord_model = orbll.GetModel("Ord_Number", StrOrdNumber); System.IO.DirectoryInfo strprht = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetImportPhotoPath((EnumPublic.OrderType)Convert.ToInt32(ord_model.Ord_Type), LYFZ.BLL.SelectPhotoHandling.ImportExportType.FineRetouch, MainOrderNumber, SightsName); if ( strprht != null ) { LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber); LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(ord_model, vmodel); if ( !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableQueuingGuide ) { #region 精修修改 2017-03-12 杨云奕 LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker ) { LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(ord_model, vmodel); IsSaveed = pe.ImportFineRetouchFilm(fbd.SelectedPath.ToString().Trim(), strprht.FullName, backgroundWorker, importGenerateThumbnails: frm.IsSmallMap); }, width: 500); #region 修改 if ( IsSaveed ) { LYFZ.Model.Model_ErpOrder modelOrder = orbll.GetModel("Ord_Number", StrOrdNumber); modelOrder.Ord_PhotoPath = sPh.UpdatePhotoImportDirectoryPath(Model.Model_ErpOrder.DirectoryType.FineRetouch, strprht.FullName); modelOrder.Ord_PhotoBackupPath = "NEW"; modelOrder.Ord_UpdateDateTime = StrTime; modelOrder.Ord_UpdateName = StrUserName; clist.Add(orbll.GetImportPhotoUpdateOrder(modelOrder)); } else { return false; } #endregion } else { LYFZ.Software.MainBusiness.MultipleFileImport.frmFileImportModel importFileMod = new MultipleFileImport.frmFileImportModel() { service_Path = strprht.FullName.Trim(), erpOrder = ord_model, directoryType = Model.Model_ErpOrder.DirectoryType.FineRetouch, erpDigOrder = vmodel, sPh = sPh, OrdNumber = StrOrdNumber, OrdViceNumber = StrViceNumber, StrStatus = StrStatus, takenName = SightsName, comeDirectoryPath = fbd.SelectedPath.ToString().Trim(), CurrentCompanyInfoID = LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID, importGenerateThumbnails = true,//frm.IsSmallMap, FrmClist = frm.clist }; if (MultipleFileImport.NewMultipFileImport.NewMultipFileImport.CheckRefinedRepairPiece(importFileMod) ) { string Ordpg_Sights = ""; if ( sPh.PhotoModel != null ) { Ordpg_Sights = sPh.PhotoModel.Ordpg_Sights.Trim(); } string currentShootingName = Ordpg_Sights; string sourceDirectory = LYFZ.WinAPI.CustomPublicMethod.GetFullDirectoryPath(importFileMod.comeDirectoryPath); if ( currentShootingName.Length > 0 ) { //选择的来源目录下的目录集合,不含子目录 string[] tempShootingNameDirectoryNames = System.IO.Directory.GetDirectories(sourceDirectory); //判断要导入的源目录下的子目录名是否为当前拍摄阶段名 bool isCurrentTakenNameInDirName = false; if ( tempShootingNameDirectoryNames.Length > 0 ) { string tempDirPath = ""; foreach ( string dirPath in tempShootingNameDirectoryNames ) { string tempdirName = System.IO.Path.GetFileName(dirPath); if ( tempdirName.ToLower() == currentShootingName.ToLower() ) { tempDirPath = dirPath; isCurrentTakenNameInDirName = true; break; } } if ( isCurrentTakenNameInDirName && tempShootingNameDirectoryNames.Length > 1 ) { sourceDirectory = LYFZ.WinAPI.CustomPublicMethod.GetFullDirectoryPath(tempDirPath); } } } List sourcFileList = importFileMod.sPh.GetLocalPhotoList(sourceDirectory); foreach ( string str in sourcFileList ) { importFileMod.local_Path.Add(new LYFZ.Software.MainBusiness.MultipleFileImport.frmFileImportItemModel() { success = false, local_Path = str, upload_Msg = "", user_Time = 0 }); } string upFileInfo = ""; ///检查相同订单中是否存在相同的图片 if (MultipleFileImport.NewMultipFileImport.NewMultipFileImport.CheckOrderUp(importFileMod, Model.Model_ErpOrder.DirectoryType.FineRetouch, ref upFileInfo) ) { ///执行导入 MultipleFileImport.NewMultipFileImport.NewMultipFileImport.AddDataPools(importFileMod); MessageBoxCustom.Show("成功加入导片队列;"); } else { LYFZ.PhotoSelectSystem.ImportRepairPieceWarning importWarning = new LYFZ.PhotoSelectSystem.ImportRepairPieceWarning("队列冲突", upFileInfo); importWarning.TopMost = true; importWarning.SbtnContinueImport.Visible = false; importWarning.ShowDialog(); return false; } } else { return false; } #endregion } } } catch { MessageBoxCustom.Show("相片精修片路径的访问被拒绝"); return false; } } else { return false; } } LYFZ.Model.Model_ErpOrderDigital modelDigital = odbll.GetModel("Ordv_ViceNumber", StrViceNumber); _modelDigital = modelDigital; if ( modelDigital.Ordv_RefinementStatus.Trim() != "2" ) { modelDigital.Ordv_RefinementName = StrUserName; modelDigital.Ordv_RefinementStatus = StrStatus; modelDigital.Ordv_RefinementTime = StrTime; } modelDigital.Ordv_UpdateDateTime = StrTime; modelDigital.Ordv_UpdateName = StrUserName; clist.Add(odbll.GetUpdateCommandInfo(modelDigital)); clist.AddRange(frm.clist); if ( LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) <= 0 ) { MessageBoxCustom.Show("导入失败;"); } else { if ( !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableQueuingGuide ) { if ( frm.itemEx != null ) { frm.itemEx.SetServicePhotographCount(LYFZ.Model.Model_ErpOrder.DirectoryType.FineRetouch); } } } IsSaveed = true; } return IsSaveed; } /// /// 导入设计片 /// /// /// /// /// public static bool ImportDesignPiece( string StrOrdNumber, string StrViceNumber, string SightsName, ref LYFZ.Model.Model_ErpOrderDigital _modelDigital, string pickUpStatus = "" ) { string StrStatus = "2"; List clist = new List(); string StrUserName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; DateTime StrTime = SDateTime.Now; LYFZ.Model.Model_ErpOrderDigital modelDesignStatus = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);// LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.ConductionPieceGuideSmallForm frm = new SuperSmallForm.ConductionPieceGuideSmallForm(); if ( pickUpStatus.Contains("OK") ) { frm.chkImport.Enabled = false; frm.chkImport.Checked = false; frm.chkNotImport.Checked = true; } frm.IsStatusOK = modelDesignStatus.Ordv_DesignerStatus == "2" ? true : false; frm.StrOrdNumber = StrOrdNumber; frm.StrOrdViceNumber = StrViceNumber; frm.StrType = "4"; frm.StrStatusText = "设计"; frm.ShowDialog(); if ( frm.IsSaveed ) { if ( !frm.IsImportStatus ) { StrStatus = "1"; } else { StrStatus = "2"; } if ( frm.IsImport ) { FolderBrowserDialog fbd = new FolderBrowserDialog(); if ( defaultExportFilePath != "" ) { if ( Directory.Exists(defaultExportFilePath) ) //设置此次默认目录为上一次选中目录 { fbd.SelectedPath = defaultExportFilePath; } } if ( fbd.ShowDialog() == DialogResult.OK ) { defaultExportFilePath = fbd.SelectedPath; try { LYFZ.Model.Model_ErpOrder ord_model = orbll.GetModel("Ord_Number", StrOrdNumber); System.IO.DirectoryInfo strprht = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetImportPhotoPath((EnumPublic.OrderType)Convert.ToInt32(ord_model.Ord_Type), LYFZ.BLL.SelectPhotoHandling.ImportExportType.DesignPiece, StrOrdNumber, SightsName); LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber); LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(ord_model, vmodel); if ( !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableQueuingGuide ) { #region 导入设计 2017-3-12 杨云奕 添加 bool IsImp = false; LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker ) { LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(ord_model, vmodel); IsImp = pe.ImportDesignFilm(fbd.SelectedPath.ToString().Trim(), strprht.FullName, backgroundWorker, importGenerateThumbnails: frm.IsSmallMap); }, width: 500); if ( !IsImp ) { return false; } LYFZ.Model.Model_ErpOrder modelOrder = orbll.GetModel("Ord_Number", StrOrdNumber); modelOrder.Ord_PhotoPath = sPh.UpdatePhotoImportDirectoryPath(Model.Model_ErpOrder.DirectoryType.DesignPiece, strprht.FullName); modelOrder.Ord_PhotoBackupPath = "NEW"; modelOrder.Ord_UpdateDateTime = StrTime; modelOrder.Ord_UpdateName = StrUserName; clist.Add(orbll.GetImportPhotoUpdateOrder(modelOrder)); } else { LYFZ.Software.MainBusiness.MultipleFileImport.frmFileImportModel importFileMod = new MultipleFileImport.frmFileImportModel() { service_Path = strprht.FullName.Trim(), erpOrder = ord_model, directoryType = Model.Model_ErpOrder.DirectoryType.DesignPiece, erpDigOrder = vmodel, sPh = sPh, OrdNumber = StrOrdNumber, OrdViceNumber = StrViceNumber, StrStatus = StrStatus, takenName = SightsName, comeDirectoryPath = fbd.SelectedPath.ToString().Trim(), CurrentCompanyInfoID = LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID, importGenerateThumbnails = true,//frm.IsSmallMap, FrmClist = frm.clist }; string msg = ""; if (MultipleFileImport.NewMultipFileImport.NewMultipFileImport.CheckDesignPiece(importFileMod, ref msg) ) { importFileMod.okActive = msg; string Ordpg_Sights = ""; if ( sPh.PhotoModel != null ) { Ordpg_Sights = sPh.PhotoModel.Ordpg_Sights.Trim(); } string currentShootingName = Ordpg_Sights; string sourceDirectory = LYFZ.WinAPI.CustomPublicMethod.GetFullDirectoryPath(importFileMod.comeDirectoryPath); if ( currentShootingName.Length > 0 ) { //选择的来源目录下的目录集合,不含子目录 string[] tempShootingNameDirectoryNames = System.IO.Directory.GetDirectories(sourceDirectory); //判断要导入的源目录下的子目录名是否为当前拍摄阶段名 bool isCurrentTakenNameInDirName = false; if ( tempShootingNameDirectoryNames.Length > 0 ) { string tempDirPath = ""; foreach ( string dirPath in tempShootingNameDirectoryNames ) { string tempdirName = System.IO.Path.GetFileName(dirPath); if ( tempdirName.ToLower() == currentShootingName.ToLower() ) { tempDirPath = dirPath; isCurrentTakenNameInDirName = true; break; } } if ( isCurrentTakenNameInDirName && tempShootingNameDirectoryNames.Length > 1 ) { sourceDirectory = LYFZ.WinAPI.CustomPublicMethod.GetFullDirectoryPath(tempDirPath); } } } List sourcFileList = importFileMod.sPh.GetLocalPhotoList(sourceDirectory); foreach ( string str in sourcFileList ) { importFileMod.local_Path.Add(new LYFZ.Software.MainBusiness.MultipleFileImport.frmFileImportItemModel() { success = false, local_Path = str, upload_Msg = "", user_Time = 0 }); } string upFileInfo = ""; ///检查相同订单中是否存在相同的图片 if (MultipleFileImport.NewMultipFileImport.NewMultipFileImport.CheckOrderUp(importFileMod, Model.Model_ErpOrder.DirectoryType.DesignPiece, ref upFileInfo) ) { ///执行导入 MultipleFileImport.NewMultipFileImport.NewMultipFileImport.AddDataPools(importFileMod); LYFZ.Model.Model_ErpOrder modelOrder = orbll.GetModel("Ord_Number", StrOrdNumber); modelOrder.Ord_PhotoPath = sPh.UpdatePhotoImportDirectoryPath(Model.Model_ErpOrder.DirectoryType.DesignPiece, strprht.FullName); modelOrder.Ord_PhotoBackupPath = "NEW"; modelOrder.Ord_UpdateDateTime = StrTime; modelOrder.Ord_UpdateName = StrUserName; clist.Add(orbll.GetImportPhotoUpdateOrder(modelOrder)); } else { LYFZ.PhotoSelectSystem.ImportRepairPieceWarning importWarning = new LYFZ.PhotoSelectSystem.ImportRepairPieceWarning("队列冲突", upFileInfo); importWarning.TopMost = true; importWarning.SbtnContinueImport.Visible = false; importWarning.ShowDialog(); return false; } } else { return false; } //return true; #endregion } } catch { MessageBoxCustom.Show("设计相片路径的访问被拒绝"); return false; } } else { return false; } } LYFZ.Model.Model_ErpOrderDigital modelDigital = odbll.GetModel("Ordv_ViceNumber", StrViceNumber); _modelDigital = modelDigital; if ( modelDigital.Ordv_DesignerStatus.Trim() != "2" ) { modelDigital.Ordv_DesignerName = StrUserName; modelDigital.Ordv_DesignerTime = StrTime; modelDigital.Ordv_DesignerStatus = StrStatus; } modelDigital.Ordv_UpdateDateTime = StrTime; modelDigital.Ordv_UpdateName = StrUserName; clist.Add(odbll.GetUpdateCommandInfo(modelDigital)); modelDigital = _modelDigital; #region 导入设计片时,完成所有外发片 if ( StrStatus.Trim() == "2" ) { LYFZ.BLL.BLL_ErpOrderOutSendDesignList outbll = new BLL.BLL_ErpOrderOutSendDesignList(); List mlist = outbll.GetModelList("Odlst_OrdNumber = '" + StrOrdNumber + "' and Odlst_ViceNumber = '" + StrViceNumber + "' and Odlst_SendVendor != ''"); for ( int i = 0; i < mlist.Count; i++ ) { if ( mlist[i].Odlst_CompletedStatus != "1" ) { mlist[i].Odlst_CompletedStatus = "1"; mlist[i].Odlst_CompletedTime = StrTime; mlist[i].Odlst_CompletedName = StrUserName; mlist[i].Odlst_CreateDatetime = StrTime; mlist[i].Odlst_CreateName = StrUserName; clist.Add(outbll.GetUpdateCommandInfo(mlist[i])); } } } #endregion clist.AddRange(frm.clist); if ( LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) <= 0 ) { MessageBoxCustom.Show("导入失败;"); return false; } else { if ( !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableQueuingGuide ) { if ( frm.itemEx != null ) { frm.itemEx.SetServicePhotographCount(LYFZ.Model.Model_ErpOrder.DirectoryType.DesignPiece); } } } return true; } return false; } public static bool ImportN8UserPiece( string StrOrdNumber, string StrViceNumber, string SightsName ) { string StrStatus = "2"; List clist = new List(); string StrUserName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; DateTime StrTime = SDateTime.Now; LYFZ.Model.Model_ErpOrderDigital modelDesignStatus = odbll.GetModel("Ordv_ViceNumber", StrViceNumber);// LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.ConductionPieceGuideSmallForm frm = new SuperSmallForm.ConductionPieceGuideSmallForm(); frm.IsStatusOK = modelDesignStatus.Ordv_DesignerStatus == "2" ? true : false; frm.StrOrdNumber = StrOrdNumber; frm.StrOrdViceNumber = StrViceNumber; frm.StrType = "4"; frm.StrStatusText = "设计"; frm.ShowDialog(); if ( frm.IsSaveed ) { if ( !frm.IsImportStatus ) { StrStatus = "1"; } else { StrStatus = "2"; } if ( frm.IsImport ) { FolderBrowserDialog fbd = new FolderBrowserDialog(); if ( defaultExportFilePath != "" ) { if ( Directory.Exists(defaultExportFilePath) ) //设置此次默认目录为上一次选中目录 { fbd.SelectedPath = defaultExportFilePath; } } if ( fbd.ShowDialog() == DialogResult.OK ) { defaultExportFilePath = fbd.SelectedPath; try { LYFZ.Model.Model_ErpOrder ord_model = orbll.GetModel("Ord_Number", StrOrdNumber); System.IO.DirectoryInfo strprht = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetImportPhotoPath((EnumPublic.OrderType)Convert.ToInt32(ord_model.Ord_Type), LYFZ.BLL.SelectPhotoHandling.ImportExportType.NemoN8UserDirectory, StrOrdNumber, SightsName); LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber); LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(ord_model, vmodel); #region 获取N8是否存在已选版完成目录; string strN8HasFinishXml = ""; StringBuilder strN8HasFinishDirectory = new StringBuilder(); // N8共享目录; strN8HasFinishDirectory.Append(LYFZ.Network.PlatinumClientProcess.N8SvrConfig.N8ServerUserDirectory); // 是否是儿童订单; if ( (EnumPublic.OrderType)Convert.ToInt32(ord_model.Ord_Type) == EnumPublic.OrderType.儿童订单 ) { // 订单号; strN8HasFinishDirectory.Append(StrOrdNumber); strN8HasFinishDirectory.Append("\\[已选]" + SightsName); strN8HasFinishXml = string.Format("{0}{1}_[已选]{2}.xml", LYFZ.Network.PlatinumClientProcess.N8SvrConfig.N8ServerUserDirectory, StrOrdNumber, SightsName); } else { // 订单号; strN8HasFinishDirectory.Append("[已选]" + StrOrdNumber); strN8HasFinishXml = string.Format("{0}[已选]{1}.xml", LYFZ.Network.PlatinumClientProcess.N8SvrConfig.N8ServerUserDirectory, StrOrdNumber); } if ( Directory.Exists(strN8HasFinishDirectory.ToString()) ) { if ( MessageBoxCustom.Show("该选版已存在并已完成选版,继续导入将会删除已完成的选片,是否删除重新导入?", "重复提示", MessageBoxButtons.YesNo) == DialogResult.No ) { return false; } else { LYFZ.ExtendControlLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker ) { try { LYFZ.Network.FileOperations.FileOperation.DeleteDir(strN8HasFinishDirectory.ToString(), true); File.Delete(strN8HasFinishXml); } catch { } }); } } #endregion bool IsImp = false; LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker ) { LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(ord_model, vmodel); IsImp = pe.ImportN8UserFilm(fbd.SelectedPath.ToString().Trim(), strprht.FullName, backgroundWorker, importGenerateThumbnails: frm.IsSmallMap); }, width: 500); if ( !IsImp ) { return false; } LYFZ.Model.Model_ErpOrder modelOrder = orbll.GetModel("Ord_Number", StrOrdNumber); modelOrder.Ord_PhotoPath = sPh.UpdatePhotoImportDirectoryPath(Model.Model_ErpOrder.DirectoryType.DesignPiece, strprht.FullName); modelOrder.Ord_PhotoBackupPath = "NEW"; modelOrder.Ord_UpdateDateTime = StrTime; modelOrder.Ord_UpdateName = StrUserName; clist.Add(orbll.GetImportPhotoUpdateOrder(modelOrder)); } catch ( Exception ex ) { MessageBoxCustom.Show("N8选版用户目录的访问被拒绝:" + ex.Message); return false; } } else { return false; } } LYFZ.Model.Model_ErpOrderDigital modelDigital = odbll.GetModel("Ordv_ViceNumber", StrViceNumber); if ( modelDigital.Ordv_DesignerStatus.Trim() != "2" ) { modelDigital.Ordv_DesignerName = StrUserName; modelDigital.Ordv_DesignerTime = StrTime; modelDigital.Ordv_DesignerStatus = StrStatus; } modelDigital.Ordv_UpdateDateTime = StrTime; modelDigital.Ordv_UpdateName = StrUserName; clist.Add(odbll.GetUpdateCommandInfo(modelDigital)); #region 导入设计片时,完成所有外发片 if ( StrStatus.Trim() == "2" ) { LYFZ.BLL.BLL_ErpOrderOutSendDesignList outbll = new BLL.BLL_ErpOrderOutSendDesignList(); List mlist = outbll.GetModelList("Odlst_OrdNumber = '" + StrOrdNumber + "' and Odlst_ViceNumber = '" + StrViceNumber + "' and Odlst_SendVendor != ''"); for ( int i = 0; i < mlist.Count; i++ ) { if ( mlist[i].Odlst_CompletedStatus != "1" ) { mlist[i].Odlst_CompletedStatus = "1"; mlist[i].Odlst_CompletedTime = StrTime; mlist[i].Odlst_CompletedName = StrUserName; mlist[i].Odlst_CreateDatetime = StrTime; mlist[i].Odlst_CreateName = StrUserName; clist.Add(outbll.GetUpdateCommandInfo(mlist[i])); } } } #endregion clist.AddRange(frm.clist); if ( LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) <= 0 ) { MessageBoxCustom.Show("导入失败;"); return false; } else { if ( !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableQueuingGuide ) { if ( frm.itemEx != null ) { frm.itemEx.SetServicePhotographCount(LYFZ.Model.Model_ErpOrder.DirectoryType.PrimitivePicture); } } } return true; } return false; } /// /// 导出原片 /// /// /// /// /// public static void ExportOriginalPiece( string StrOrdNumber, string StrViceNumber, string SightsName ) { try { bool IsSaveed = false; DataTable tbl = orbll.GetView_Custom("tb_ErpOrdersPhotography", StrWhere: "Ordpg_ViceNumber = '" + StrViceNumber + "'", ShowColumnName: "Ordpg_Sights").Tables[0]; bool bZip = false; string item = ""; if ( tbl.Rows.Count > 0 ) { LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.PhotographedStatusConfirmedSuperSmallForm frm = new SuperSmallForm.PhotographedStatusConfirmedSuperSmallForm(); frm.tbl = tbl; frm.ShowDialog(); IsSaveed = frm.IsSaveed; if ( frm.IsSaveed && frm.Strlist.Count > 0 ) { SightsName = frm.Strlist[0]; } if(IsSaveed) { bZip = frm.chkZip.Checked; } } if ( IsSaveed ) { LYFZ.Model.Model_ErpOrder model = orbll.GetModel("Ord_Number", StrOrdNumber); LYFZ.Model.Model_ErpOrderDigital Vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber); LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(model, Vmodel); BLL.BLL_ErpCustomer bLL_ErpCustomer = new BLL.BLL_ErpCustomer(); List sPhotoList = sPh.GetSpecifyTypePhotoList(Model.Model_ErpOrder.DirectoryType.PrimitivePicture, BLL.SelectPhotoHandling.PhotoType.Original, SightsName); if ( sPhotoList.Count == 0 ) { sPhotoList = sPh.GetSpecifyTypePhotoList(Model.Model_ErpOrder.DirectoryType.PrimitivePicture, BLL.SelectPhotoHandling.PhotoType.RawData, SightsName); if ( sPhotoList.Count == 0 ) { MessageBoxCustom.Show("此单或景点未导片"); return; } } if ( !LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.IsEnterPassword(StrViceNumber) ) { return; } FolderBrowserDialog fbd = new FolderBrowserDialog(); if ( defaultImportFilePath != "" ) { if ( Directory.Exists(defaultImportFilePath) ) //设置此次默认目录为上一次选中目录 { fbd.SelectedPath = defaultImportFilePath; } } if ( fbd.ShowDialog() == DialogResult.OK ) { defaultImportFilePath = fbd.SelectedPath;//记录选中的目录 bool IsImp = false; LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker ) { LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(model, Vmodel); IsImp = pe.ExportOriginalFilm(fbd.SelectedPath.ToString().Trim(), backgroundWorker); //item = model.Ord_Number + "("+ sPh+")"; }, width: 500); item = model.Ord_Number + "("+bLL_ErpCustomer.GetCustomerNameList(model.Ord_Number)+"原片)"; if ( !IsImp ) { return; } else { if(bZip) { defaultImportFilePath = defaultImportFilePath + "\\" + item; if (Directory.Exists(defaultImportFilePath)) { DirectoryInfo info = new DirectoryInfo(defaultImportFilePath); if (info is DirectoryInfo) { LYFZ.CompressionProgress.FormCompressionProgress frm = new CompressionProgress.FormCompressionProgress( defaultImportFilePath, fbd.SelectedPath + "\\"+ item + ".zip", defaultImportFilePath,"",false); if (!frm.IsDisposed) { if (frm.ShowDialog() == DialogResult.No) { MessageBoxCustom.Show("压缩失败!"); } else { if (!string.IsNullOrEmpty(item)) { if (System.IO.Directory.Exists(item)) { LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker) { backgroundWorker.ReportProgress(0, "压缩完成,正在删除缓存......"); System.IO.Directory.Delete(item, true); }); } } } } } } } MessageBoxCustom.Show("导出完毕"); return; } } } } catch { MessageBoxCustom.Show("导片出错"); } } static bool ISExportRaw = true; /// /// 导出选好的片 /// /// public static void ExportSelectionPiece( string StrOrdNumber, string StrViceNumber ) { try { if ( !LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.IsEnterPassword(StrViceNumber) ) { return; } LYFZ.Model.Model_ErpOrder model = orbll.GetModel("Ord_Number", StrOrdNumber); LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber); LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.ExportCategorySuperSmallForm frm12 = new SuperSmallForm.ExportCategorySuperSmallForm(); frm12.cbxISRaw.Checked = ISExportRaw; frm12.ExportDirectoryType = vmodel.GetSelectPhotoDirectoryType(); frm12.ShowDialog(); bool isExportRAW = frm12.cbxISRaw.Checked; ISExportRaw = isExportRAW; if ( frm12.IsSaveed ) { FolderBrowserDialog fbd = new FolderBrowserDialog(); if ( defaultImportFilePath != "" ) { if ( Directory.Exists(defaultImportFilePath) ) //设置此次默认目录为上一次选中目录 { fbd.SelectedPath = defaultImportFilePath; } } if ( fbd.ShowDialog() == DialogResult.OK ) { defaultImportFilePath = fbd.SelectedPath;//记录选中的目录 string ExportSelectedToDirPath = ""; string ShopName = ""; string cusName = ""; string showOrderNumber = ""; bool IsSaveed = false; LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker ) { LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(model, vmodel); // bool IsSaveed = pe.ExportSelectedPhotoFile(fbd.SelectedPath.ToString().Trim(), frm12.IsOriginalFilm, backgroundWorker, true, !frm12.IsProductName, isbarode: frm12.ExportBarcode, isExportRaw: isExportRAW); IsSaveed = pe.ExportSelectedFineRetouchPhotoFile(fbd.SelectedPath.ToString().Trim(), frm12.ExportDirectoryType, backgroundWorker, !LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.ExportedSelectPhotoGenerateZIP, !frm12.IsProductName, isbarode: frm12.ExportBarcode, isExportRaw: isExportRAW); if ( IsSaveed ) { ExportSelectedToDirPath = pe.sPhotoHandling.ExportSelectedToDirPath; if (String.IsNullOrWhiteSpace(vmodel.Ordv_SelectionShopID)) { vmodel.Ordv_SelectionShopID = LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID; } ShopName = LYFZ.DAL.DAL_ErpCompanyInfo.GetCompanyIDToShopName(vmodel.Ordv_SelectionShopID); cusName = new BLL.BLL_ErpCustomer().GetCustomerNameList(model.Ord_Number, "&"); showOrderNumber = pe.sPhotoHandling.ShowOrderNumber; LYFZ.BLL.BLL_ErpSystemLogs.WriteSystemLog(LYFZ.EnumPublic.SystemLogsType.相片导入导出, LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name + "导出精修数据,订单号:" + StrOrdNumber + "场景编号:" + StrViceNumber, LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID, LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name); } }, width: 500); if (LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.ExportedSelectPhotoGenerateZIP) { if (IsSaveed) { LYFZ.CompressionProgress.CompressZipPak compressZipPak = new CompressionProgress.CompressZipPak(); compressZipPak.SourceDirectoryPath = ExportSelectedToDirPath; compressZipPak.ToTargetDirectoryPath = fbd.SelectedPath.ToString().Trim(); compressZipPak.TargetArchFileName = String.Format("{0}_{1}_{2}.zip", ShopName, cusName, showOrderNumber); if (compressZipPak.ShowDialog() == DialogResult.OK) { MessageBoxCustom.Show("已选相片Zip压缩包已生成完成"); } } } } } } catch { MessageBoxCustom.Show("导片出错"); } } /// /// 导出先好的片,用于发片取件 /// /// /// public static void ExportSelectionPiece( string StrOrdNumber, string StrViceNumber, List ExportList ) { try { if ( !LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.IsEnterPassword(StrViceNumber) ) { return; } LYFZ.Model.Model_ErpOrder model = orbll.GetModel("Ord_Number", StrOrdNumber); LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber); LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.ExportCategorySuperSmallForm frm12 = new SuperSmallForm.ExportCategorySuperSmallForm(); frm12.cbxISRaw.Checked = ISExportRaw; frm12.ExportDirectoryType = vmodel.GetSelectPhotoDirectoryType(); frm12.ShowDialog(); bool isExportRAW = frm12.cbxISRaw.Checked; ISExportRaw = isExportRAW; if ( frm12.IsSaveed ) { IEnumerable> GroupList = ExportList.GroupBy(n => n.StrPath); LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(model, vmodel); List StrExportOkPath = new List(); LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker ) { foreach ( IGrouping item in GroupList ) { List UidList = new List(); foreach ( LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.ExportSendPiece value in item ) { UidList.Add(value.StrUID); } string StrNewPath = item.Key + "_" + model.Ord_SinceOrderNumber + "_发片外发"; if ( pe.ExportSelectedPhotoFile(StrNewPath, frm12.IsOriginalFilm, backgroundWorker, false, !frm12.IsProductName, isbarode: frm12.ExportBarcode, _UniquelyIdentityList: UidList, isExportRaw: isExportRAW) ) { StrExportOkPath.Add(StrNewPath); } } }, width: 500); if ( StrExportOkPath.Count > 0 ) { foreach ( string item in StrExportOkPath ) { if ( Directory.GetDirectories(item).Length > 0 ) { string StrDirectPath = Directory.GetDirectories(item)[0]; if ( Directory.Exists(StrDirectPath) ) { DirectoryInfo info = new DirectoryInfo(StrDirectPath); if ( info is DirectoryInfo ) { LYFZ.CompressionProgress.FormCompressionProgress frm = new CompressionProgress.FormCompressionProgress(StrDirectPath, item + ".zip"); if ( !frm.IsDisposed ) { if ( frm.ShowDialog() == DialogResult.No ) { MessageBoxCustom.Show("压缩失败!"); } else { if ( !string.IsNullOrEmpty(item) ) { if ( System.IO.Directory.Exists(item) ) { LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker ) { backgroundWorker.ReportProgress(0, "压缩完成,正在删除缓存......"); System.IO.Directory.Delete(item, true); }); } } } } } } } } } } } catch { MessageBoxCustom.Show("导片出错"); } } /// /// 导出精修片 /// public static void ExportRefinedRepairPiece( string StrOrdNumber, string StrViceNumber, string SightsName ) { try { LYFZ.Model.Model_ErpOrder model = orbll.GetModel("Ord_Number", StrOrdNumber); LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber); LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(model, vmodel); List sPhotoList = sPh.GetSpecifyTypePhotoList(Model.Model_ErpOrder.DirectoryType.FineRetouch, BLL.SelectPhotoHandling.PhotoType.Original, SightsName); if ( sPhotoList.Count == 0 ) { MessageBoxCustom.Show("此单未导片"); return; } if ( !LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.IsEnterPassword(StrViceNumber) ) { return; } FolderBrowserDialog fbd = new FolderBrowserDialog(); if ( defaultImportFilePath != "" ) { if ( Directory.Exists(defaultImportFilePath) ) //设置此次默认目录为上一次选中目录 { fbd.SelectedPath = defaultImportFilePath; } } if ( fbd.ShowDialog() == DialogResult.OK ) { defaultImportFilePath = fbd.SelectedPath;//记录选中的目录 bool IsImp = false; LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker ) { LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(model, vmodel); IsImp = pe.ExportFineRetouchFilm(fbd.SelectedPath.ToString().Trim(), backgroundWorker); }, width: 500); if ( IsImp ) { vmodel.Ordv_ExportRefinement = "已导出"; new BLL.BLL_ErpOrderDigital().Update(vmodel); MessageBoxCustom.Show("导出完毕"); return; } } } catch { MessageBoxCustom.Show("导片出错"); } } /// /// 导出设计片 /// public static void ExportDesignPiece( string StrOrdNumber, string StrViceNumber, string SightsName ) { try { LYFZ.Model.Model_ErpOrder model = orbll.GetModel("Ord_Number", StrOrdNumber); LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber); LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(model, vmodel); List sPhotoList = sPh.GetSpecifyTypePhotoList(Model.Model_ErpOrder.DirectoryType.DesignPiece, BLL.SelectPhotoHandling.PhotoType.Original, SightsName); if ( sPhotoList.Count == 0 ) { MessageBoxCustom.Show("此单未导片"); return; } if ( !LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.IsEnterPassword(StrViceNumber) ) { return; } LYFZ.Model.Model_ErpOrderDigital modelEarlyRepairStatus = odbll.GetModel("Ordv_ViceNumber", StrViceNumber); string StrLookDesign = Enum.GetName(typeof(LYFZ.EnumPublic.LookDesignStatusEnum), Convert.ToInt32(modelEarlyRepairStatus.Ordv_LookDesignStatus)); FolderBrowserDialog fbd = new FolderBrowserDialog(); if ( defaultImportFilePath != "" ) { if ( Directory.Exists(defaultImportFilePath) ) //设置此次默认目录为上一次选中目录 { fbd.SelectedPath = defaultImportFilePath; } } if ( StrLookDesign == LYFZ.EnumPublic.LookDesignStatusEnum.未看.ToString().Trim() && modelEarlyRepairStatus.GetSelectPhotoDirectoryType() != Model.Model_ErpOrder.DirectoryType.DesignPiece ) { if ( fbd.ShowDialog() == DialogResult.OK ) { defaultImportFilePath = fbd.SelectedPath;//记录选中的目录 bool IsImp = false; LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker ) { LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(model, vmodel); IsImp = pe.ExportDesignFilm(fbd.SelectedPath.ToString().Trim(), false, backgroundWorker); }, width: 500); if ( !IsImp ) { return; } else { vmodel.Ordv_ExportDesign = "已导出"; new BLL.BLL_ErpOrderDigital().Update(vmodel); MessageBoxCustom.Show("设计片导出完毕"); return; } } } else { LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.DesignExportOptionSuperSmallForm frm = new SuperSmallForm.DesignExportOptionSuperSmallForm(); if ( StrLookDesign == LYFZ.EnumPublic.LookDesignStatusEnum.OK.ToString().Trim() ) { frm.IntEditDesign_Visible = false; } else { frm.IntEditDesign_Visible = true; } if ( modelEarlyRepairStatus.GetSelectPhotoDirectoryType() == Model.Model_ErpOrder.DirectoryType.DesignPiece ) { frm.IntSelectDesign_Visible = true; } else { frm.IntSelectDesign_Visible = false; } frm.ShowDialog(); if ( !frm.IsSave ) { return; } if ( fbd.ShowDialog() == DialogResult.OK ) { defaultImportFilePath = fbd.SelectedPath;//记录选中的目录 bool IsImp = false; LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker ) { LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(model, vmodel); if ( frm.OutOption == "Design" ) { IsImp = pe.ExportDesignFilm(fbd.SelectedPath.ToString().Trim(), false, backgroundWorker); } else if ( frm.OutOption == "EditDesign" ) { IsImp = pe.ExportSelectedDesignFilm(fbd.SelectedPath.ToString().Trim(), backgroundWorker); } else if ( frm.OutOption == "LookOk" ) { IsImp = pe.ExportDesignFilm(fbd.SelectedPath.ToString().Trim(), true, backgroundWorker); } else if ( frm.OutOption == "SelectDesign" ) { IsImp = pe.ExportSelectedDesignPhotoFile(fbd.SelectedPath.ToString().Trim(), backgroundWorker, true, frm.IsCreateProductFolder, isbarode: frm.ExportBarcode); } }, width: 500); if ( !IsImp ) { return; } else { if ( StrLookDesign == LYFZ.EnumPublic.LookDesignStatusEnum.OK.ToString().Trim() ) { vmodel.Ordv_ExportDesign = "已导出"; new BLL.BLL_ErpOrderDigital().Update(vmodel); MessageBoxCustom.Show("已确认设计片导出完毕"); return; } } } } } catch { MessageBoxCustom.Show("导片出错"); } } public static void ExportN8Piece( string StrOrdNumber, string StrViceNumber, string SightsName ) { try { LYFZ.Model.Model_ErpOrder model = orbll.GetModel("Ord_Number", StrOrdNumber); LYFZ.Model.Model_ErpOrderDigital vmodel = odbll.GetModel("Ordv_ViceNumber", StrViceNumber); LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(model, vmodel); #region 判断是否已经完成N8选版,若完成才能导出; // 判断是否是儿童订单; StringBuilder strN8HasFinishUserDirectory = new StringBuilder(); if ( (EnumPublic.OrderType)Convert.ToInt32(model.Ord_Type) == EnumPublic.OrderType.儿童订单 ) { strN8HasFinishUserDirectory.Append(LYFZ.Network.PlatinumClientProcess.N8SvrConfig.N8ServerUserDirectory); strN8HasFinishUserDirectory.Append(StrOrdNumber); strN8HasFinishUserDirectory.Append("\\[已选]" + SightsName); } else { strN8HasFinishUserDirectory.Append(LYFZ.Network.PlatinumClientProcess.N8SvrConfig.N8ServerUserDirectory); strN8HasFinishUserDirectory.Append("[已选]" + StrOrdNumber); } if ( !Directory.Exists(strN8HasFinishUserDirectory.ToString()) ) { MessageBoxCustom.Show("该选版未完成,不能导出"); return; } #endregion if ( !LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.IsEnterPassword(StrViceNumber) ) { return; } LYFZ.Model.Model_ErpOrderDigital modelEarlyRepairStatus = odbll.GetModel("Ordv_ViceNumber", StrViceNumber); string StrLookDesign = Enum.GetName(typeof(LYFZ.EnumPublic.LookDesignStatusEnum), Convert.ToInt32(modelEarlyRepairStatus.Ordv_LookDesignStatus)); FolderBrowserDialog fbd = new FolderBrowserDialog(); if ( defaultImportFilePath != "" ) { if ( Directory.Exists(defaultImportFilePath) ) //设置此次默认目录为上一次选中目录 { fbd.SelectedPath = defaultImportFilePath; } } if ( fbd.ShowDialog() == DialogResult.OK ) { defaultImportFilePath = fbd.SelectedPath;//记录选中的目录 bool IsImp = false; LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate ( object obj, BackgroundWorker backgroundWorker ) { LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(model, vmodel); IsImp = pe.ExportN8Film(fbd.SelectedPath.ToString().Trim(), false, backgroundWorker); }, width: 500); if ( !IsImp ) { return; } else { MessageBoxCustom.Show("N8选版导出完毕"); return; } } } catch { MessageBoxCustom.Show("导片出错"); } } #endregion #region 解 /// /// 给外部调用的DES算法解密。 /// public static string DecryptDES( string decryptString ) { return DecryptDES(decryptString, "cust-stu"); } /// /// DES解密字符串 /// /// 待解密的字符串 /// 解密密钥,要求为8位,和加密密钥相同 /// 解密成功返回解密后的字符串,失败返源串 private static string DecryptDES( string decryptString, string decryptKey ) { try { byte[] rgbKey = Encoding.UTF8.GetBytes(decryptKey); byte[] rgbIV = DesKeys; byte[] inputByteArray = Convert.FromBase64String(decryptString); System.Security.Cryptography.DESCryptoServiceProvider DCSP = new System.Security.Cryptography.DESCryptoServiceProvider(); System.IO.MemoryStream mStream = new System.IO.MemoryStream(); System.Security.Cryptography.CryptoStream cStream = new System.Security.Cryptography.CryptoStream(mStream, DCSP.CreateDecryptor(rgbKey, rgbIV), System.Security.Cryptography.CryptoStreamMode.Write); cStream.Write(inputByteArray, 0, inputByteArray.Length); cStream.FlushFinalBlock(); return Encoding.UTF8.GetString(mStream.ToArray()); } catch { return decryptString; } } #endregion #region 接单人控件 /// /// 接单人员 /// /// 接单人员控件 /// 是否显示接单类型 /// 是否显示离职人员 public void txtOrdersPerson( LYFZ.ComponentLibrary.TextBoxEx txtPersonnel, bool IsShowType = true, bool IsShowResign = false ) { LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.OrdersPersonnelSelectionSuperSmallForm frm = new SuperSmallForm.OrdersPersonnelSelectionSuperSmallForm(); frm.txtPersonnel = txtPersonnel; frm.IsShowType = IsShowType; frm.IsShowResign = IsShowResign; frm.ShowDialog(); txtPersonnel.Text = frm.txtPersonnel.Text; txtPersonnel.Tag = frm.txtPersonnel.Tag; } /// /// 接单人员 /// /// 接单人员控件 /// 是否显示接单类型 /// 是否显示离职人员 public string txtOrdersPerson( LYFZ.ComponentLibrary.TextBoxEx txtPersonnel, string strJsonData, bool IsShowType = true, bool IsShowResign = false ) { LYFZ.Software.MainBusiness.DoorCityProcess.SuperSmallForm.OrdersPersonnelSelectionSuperSmallForm frm = new SuperSmallForm.OrdersPersonnelSelectionSuperSmallForm(strJsonData); frm.txtPersonnel = txtPersonnel; frm.IsShowType = IsShowType; frm.IsShowResign = IsShowResign; frm.cbxAchievement.Visible = false; frm.ShowDialog(); txtPersonnel.Text = frm.txtPersonnel.Text; txtPersonnel.Tag = frm.txtPersonnel.Tag; strJsonData = ""; if ( frm.cbxAchievement.Checked ) { strJsonData = frm.ratioBll.ToString(); } return strJsonData; } /// /// 接单人员——获取Value(员工编号) 或 Tag(主或副门市) /// /// 接单人员控件 /// True:(员工编号),False:Tag(主或副门市) /// public string txtOrdersPersonGetValueOrTag( LYFZ.ComponentLibrary.TextBoxEx txtPersonnel, bool bl = true ) { if ( txtPersonnel.Tag != null ) { if ( bl ) { string[] StrValue = txtPersonnel.Tag.ToString().Trim().Split('|'); return StrValue[0].Trim(); } else { string[] StrTag = txtPersonnel.Tag.ToString().Trim().Split('|'); return StrTag[1].Trim(); } } return ""; } #endregion #region 控件值的优化 /// /// 获取自定义控件的Text值(去掉空格后的值) /// /// 自定义控件 /// public static string MaskedTextBoxExGetText( MaskedTextBoxEx maskedTextBoxEx ) { //char[] charList = maskedTextBoxEx.Text.ToCharArray(); //string StrChar = ""; //for (int i = 0; i < charList.Length; i++) //{ // if (charList[i].ToString().Trim() != "") // { StrChar += charList[i].ToString().Trim(); } //} //return StrChar; return maskedTextBoxEx.Text.Trim().Replace(" ", ""); } /// /// 写日志 /// /// 日志内容 /// 日志文件全路径 public static void WriteLogs( string txt, string fullPath ) { if ( fullPath.LastIndexOf(@"\") == (fullPath.Length - 1) ) { fullPath = fullPath + "new.txt"; } else { fullPath = fullPath + "\\new.txt"; } using ( System.IO.StreamWriter sw = new System.IO.StreamWriter(fullPath, true, Encoding.UTF8) ) { sw.WriteLine(txt); sw.Flush(); sw.Close(); } } /// /// 隐藏电话号码控件字符 /// /// public static void HidePhoneControls( LYFZ.ComponentLibrary.MaskedTextBoxEx objValue ) { bool IsShowPhone = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OtherPermissionsSet, LYFZ.CustomAttributes.OperatingAuthority.ProhibitViewCustomerPhoneNumber); if ( IsShowPhone && !LYFZ.BLL.BLL_ErpUser.IsAdministrator() ) { objValue.PasswordChar = '*'; } } /// /// 隐藏电话号码控件字符 /// /// public static void HidePhoneControls( LYFZ.ComponentLibrary.TextBoxEx objValue ) { bool IsShowPhone = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OtherPermissionsSet, LYFZ.CustomAttributes.OperatingAuthority.ProhibitViewCustomerPhoneNumber); if ( IsShowPhone && !LYFZ.BLL.BLL_ErpUser.IsAdministrator() ) { objValue.PassChar = '*'; } } /// /// 隐藏电话号码控件字符 /// /// public static void HidePhoneControls( LYFZ.ComponentLibrary.TextBoxBasicEx objValue ) { bool IsShowPhone = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OtherPermissionsSet, LYFZ.CustomAttributes.OperatingAuthority.ProhibitViewCustomerPhoneNumber); if ( IsShowPhone && !LYFZ.BLL.BLL_ErpUser.IsAdministrator() ) { objValue.PasswordChar = '*'; } } /// /// 隐藏电话号码控件字符 /// /// public static string HidePhoneControls( object objValue ) { if ( !string.IsNullOrEmpty(objValue.ToString().Trim()) ) { bool IsShowPhone = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.OtherPermissionsSet, LYFZ.CustomAttributes.OperatingAuthority.ProhibitViewCustomerPhoneNumber); if ( IsShowPhone && !LYFZ.BLL.BLL_ErpUser.IsAdministrator() ) { return LYFZ.Command.Command_Validate.HidePhone(objValue); } else { return objValue.ToString().Trim(); } } return ""; } #endregion #region 计件提成点绑定 /// /// 计件提成点绑定 /// /// 系统类别中的Sc_ClassCode值 /// 当前下拉树 /// 是否显示第一节点是否为空 /// 显示第一节点是否为空时的Text显示 /// 查询条件,比如 Sc_ClassCode!='BEBCADBFBCDFBGJHC' 等 public static void BindTreeView_PieceCommission( string StrParentCode, LYFZ.ComponentLibrary.TreeViewEx treev, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", string StrWhere = "" ) { string ExecuteSql = orbll.GetView_CustomReturnExecuteSql("tb_ErpSystemCategory", StrWhere: StrWhere, ShowColumnName: "ID,Sc_ClassCode,Sc_ClassName,Sc_ClassParentID"); ExecuteSql += ";" + orbll.GetView_CustomReturnExecuteSql("tb_ErpWageCommissionSet", StrWhere: "", ShowColumnName: "Wcs_TypeCode,Wcs_Percentage"); DataSet dtSet = orbll.GetView_Custom(ExecuteSql); DataTable tbl = dtSet.Tables["ds"]; DataTable tbl2 = dtSet.Tables["ds1"]; treev.Nodes.Clear(); DataRow[] dtRow = tbl.Select("Sc_ClassCode = '" + StrParentCode + "'"); if ( dtRow.Length > 0 ) { DataRow[] dtRow2 = tbl.Select("Sc_ClassParentID = '" + dtRow[0]["ID"].ToString().Trim() + "'"); TreeNode root = null; for ( int i = 0; i < dtRow2.Length; i++ ) { if ( i == 0 ) { if ( IsFirstNodeNull ) { root = new TreeNode(); root.Text = IsFirstNodeName; root.Tag = ""; root.Name = ""; treev.Nodes.Add(root); } } root = new TreeNode(); DataRow[] dtRow3 = tbl.Select("Sc_ClassParentID = '" + dtRow2[i]["ID"].ToString().Trim() + "'"); if ( dtRow3.Length > 0 ) { root.Text = dtRow2[i]["Sc_ClassName"].ToString(); CreateTreeViewPieceCommission(root, dtRow2[i]["ID"].ToString(), tbl, tbl2, dtRow3); } else { DataRow[] dtRow4 = tbl2.Select("Wcs_TypeCode = '" + dtRow2[i]["Sc_ClassCode"].ToString().Trim() + "'"); if ( dtRow4.Length > 0 ) { root.Text = dtRow2[i]["Sc_ClassName"].ToString() + AddEmpty(dtRow2[i]["Sc_ClassName"].ToString(), 0) + dtRow4[0]["Wcs_Percentage"].ToString().Trim(); } else { root.Text = dtRow2[i]["Sc_ClassName"].ToString() + AddEmpty(dtRow2[i]["Sc_ClassName"].ToString(), 0) + "0"; } } root.Tag = dtRow2[i]["Sc_ClassCode"].ToString(); treev.Nodes.Add(root); } treev.ExpandAll(); } } /// /// 第二级绑定 /// /// 父节点 /// 父节点的ID /// 当前数据源 private static void CreateTreeViewPieceCommission( TreeNode nodes, string ClassParentID, DataTable tbl, DataTable tbl2, DataRow[] dtRow ) { if ( dtRow.Length > 0 ) { TreeNode node; for ( int i = 0; i < dtRow.Length; i++ ) { node = new TreeNode(); DataRow[] dtRow1 = tbl.Select("Sc_ClassParentID = '" + dtRow[i]["ID"].ToString().Trim() + "'"); if ( dtRow1.Length > 0 ) { node.Text = dtRow[i]["Sc_ClassName"].ToString(); CreateTreeViewPieceCommission(node, dtRow[i]["ID"].ToString(), tbl, tbl2, dtRow1); } else { DataRow[] dtRow4 = tbl2.Select("Wcs_TypeCode = '" + dtRow[i]["Sc_ClassCode"].ToString().Trim() + "'"); if ( dtRow4.Length > 0 ) { node.Text = dtRow[i]["Sc_ClassName"].ToString() + AddEmpty(dtRow[i]["Sc_ClassName"].ToString(), 1) + dtRow4[0]["Wcs_Percentage"].ToString().Trim(); } else { node.Text = dtRow[i]["Sc_ClassName"].ToString() + AddEmpty(dtRow[i]["Sc_ClassName"].ToString(), 1) + "0"; } } node.Tag = dtRow[i]["Sc_ClassCode"].ToString(); nodes.Nodes.Add(node); //CreateTreeViewSystemCategory(node, dtRow[i]["ID"].ToString(), tbl); } } } private static string AddEmpty( string StrText, int Intlevel, int EmptyCount = 40 ) { string StrEmpty = ""; int TextCount = 0; char[] strArray = StrText.ToCharArray(); for ( int i = 0; i < strArray.Length; i++ ) { //TextCount += 2; if ( LYFZ.Command.Command_Validate.IsChinese(strArray[i].ToString()) ) { TextCount += 2; } else { TextCount++; } } EmptyCount -= TextCount; if ( Intlevel == 1 ) { EmptyCount -= 3; } for ( int i = 0; i < EmptyCount; i++ ) { StrEmpty += " "; } return StrEmpty; } #endregion #region 系统类别设置绑定 /// /// 系统设置的绑定数据 /// /// 系统类别中的Sc_ClassCode值 /// 当前下拉树 /// 是否显示第一节点是否为空 /// 显示第一节点是否为空时的Text显示 /// 查询条件,比如 Sc_ClassCode!='BEBCADBFBCDFBGJHC' 等 public static void BindTreeView_SystemCategory( string StrParentCode, LYFZ.ComponentLibrary.TreeViewEx treev, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", string StrWhere = "" ) { DataTable tbl = new BLL.BLL_ErpSystemCategory().GetCategory("ID,Sc_ClassCode,Sc_ClassName,Sc_ClassParentID", StrWhere).Tables[0]; treev.Nodes.Clear(); DataRow[] dtRow = tbl.Select("Sc_ClassCode = '" + StrParentCode + "'"); if ( dtRow.Length > 0 ) { DataRow[] dtRow2 = tbl.Select("Sc_ClassParentID = '" + dtRow[0]["ID"].ToString().Trim() + "'"); TreeNode root = null; for ( int i = 0; i < dtRow2.Length; i++ ) { if ( i == 0 ) { if ( IsFirstNodeNull ) { root = new TreeNode(); root.Text = IsFirstNodeName; root.Tag = ""; root.Name = ""; treev.Nodes.Add(root); } } root = new TreeNode(); root.Text = dtRow2[i]["Sc_ClassName"].ToString(); root.Tag = dtRow2[i]["Sc_ClassCode"].ToString(); CreateTreeView(root, dtRow2[i]["ID"].ToString(), tbl); treev.Nodes.Add(root); } treev.ExpandAll(); } } /// /// 第二级绑定 /// /// 父节点 /// 父节点的ID /// 当前数据源 private static void CreateTreeView( TreeNode nodes, string ClassParentID, DataTable tbl ) { DataRow[] dtRow = tbl.Select("Sc_ClassParentID='" + ClassParentID + "'"); if ( dtRow.Length > 0 ) { TreeNode node; for ( int i = 0; i < dtRow.Length; i++ ) { node = new TreeNode(); node.Text = dtRow[i]["Sc_ClassName"].ToString(); node.Tag = dtRow[i]["Sc_ClassCode"].ToString(); nodes.Nodes.Add(node); CreateTreeViewSystemCategory(node, dtRow[i]["ID"].ToString(), tbl); } } } #endregion #region 产品查看图片 /// /// 产品查看图片 /// /// public static void ProductViewPhoto( string StrProductNumber ) { DataTable tbl = orbll.GetView_Custom("tb_ErpProduct", StrWhere: " Prod_Number = '" + StrProductNumber + "'", ShowColumnName: "Prod_Thumbnail").Tables[0]; if ( tbl.Rows.Count > 0 ) { if ( !string.IsNullOrEmpty(tbl.Rows[0]["Prod_Thumbnail"].ToString().Trim()) ) { try { LYFZ.Software.MainBusiness.InitialSet.Product.FrmProductPic frm = new InitialSet.Product.FrmProductPic(); frm.FrmImage = PublicCodeClasses.GetImage(PublicCodeClasses.StringToByte(tbl.Rows[0]["Prod_Thumbnail"].ToString())); //frm.WindowState = FormWindowState.Maximized; frm.ShowDialog(); } catch { MessageBoxCustom.Show("获取图片出错!"); } } else { MessageBoxCustom.Show("未上传图片!"); } } } #endregion #region QQ与电话呼叫 /// /// QQ呼叫 /// /// public static void QQCall( string StrQQ ) { if ( StrQQ.Trim() != "" ) { WebBrowser wb = new WebBrowser(); wb.Url = new Uri("http://wpa.qq.com/msgrd?v=3&uin=" + StrQQ + "&site=qq&menu=yes"); } else { MessageBoxCustom.Show("请输入要联系的QQ帐号!"); } } /// /// 电话呼叫 /// /// public static void PhoneCall( LYFZ.ComponentLibrary.MaskedTextBoxEx mskText ) { try { LYFZ.BLL.BLL_ErpCallWizard cwbll = new BLL.BLL_ErpCallWizard(); LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.PhoneCall(PublicCodeClasses.MaskedTextBoxExGetText(mskText)); if ( !string.IsNullOrEmpty(PublicCodeClasses.MaskedTextBoxExGetText(mskText)) && LYFZ.Command.Command_Validate.IsMobilePhone(PublicCodeClasses.MaskedTextBoxExGetText(mskText)) && cwbll.ProgramStarts() == true ) { LYFZ.Software.MainBusiness.DoorCityProcess.SetSmallForm.CallPhoneMessage callPhone = new SetSmallForm.CallPhoneMessage(); callPhone.phoneNumber = PublicCodeClasses.MaskedTextBoxExGetText(mskText); callPhone.ShowDialog(); } } catch ( Exception ex ) { MessageBoxCustom.Show(ex.Message); } } /// /// 电话呼叫 /// /// public static void PhoneCall( object obj ) { try { if ( string.IsNullOrEmpty(obj.ToString().Trim()) ) { return; } if ( !LYFZ.Command.Command_Validate.IsMobilePhone(obj.ToString()) ) { MessageBoxCustom.Show("请输入完整呼叫号码!"); return; } LYFZ.BLL.BLL_ErpCallWizard cwbll = new BLL.BLL_ErpCallWizard(); if ( cwbll.ProgramStarts() == false ) { MessageBoxCustom.Show("来电精灵未启动,请启动"); return; } cwbll.GetCPhone(obj.ToString()); } catch ( Exception ex ) { } } #endregion #region 处理像片,处理于像片保到数据库与从数据库中拿放到PictureBox中去 /// /// 获取图片,将图片转成Byte[],用于存入数据库 /// /// public static byte[] ImageDatabytes( PictureBox pict ) { byte[] Photo_Byte = null; if ( pict.Image != null ) { using ( MemoryStream ms = new MemoryStream() ) { try { Bitmap bmp = new Bitmap(pict.Image); bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); Photo_Byte = new byte[ms.Length]; ms.Position = 0; ms.Read(Photo_Byte, 0, Convert.ToInt32(ms.Length)); bmp.Dispose(); } catch { } } } return Photo_Byte; } /// /// 获取图片,将图片转成Byte[],用于存入数据库 /// /// public static byte[] ImageDatabytes( string StrPath ) { if ( !File.Exists(StrPath) ) return null; byte[] bmpBytes = File.ReadAllBytes(StrPath); return bmpBytes; } /// /// 把Byte[]转成Image图片显示(数据库字段类型为:Image) /// /// /// public static Bitmap GetImage( byte[] ImageDatas ) { try { using ( MemoryStream ImageMS = new MemoryStream() ) { ImageMS.Write(ImageDatas, 0, ImageDatas.Length); Bitmap resultBitmap = new Bitmap(ImageMS); return resultBitmap; } } catch { return null; } } /// /// 把字节型转换成十六进制字符串 /// /// /// public static string ToHexString( byte[] bytes ) { string hexString = string.Empty; if ( bytes != null ) { StringBuilder strB = new StringBuilder(); for ( int i = 0; i < bytes.Length; i++ ) { strB.Append(bytes[i].ToString("X2")); } hexString = strB.ToString(); } return hexString; } /// /// 把十六进制字符串转换成字节型 /// /// /// public static byte[] StringToByte( string hexString ) { hexString = hexString.Replace(" ", ""); if ( (hexString.Length % 2) != 0 ) hexString += " "; byte[] returnBytes = new byte[hexString.Length / 2]; for ( int i = 0; i < returnBytes.Length; i++ ) returnBytes[i] = Convert.ToByte(hexString.Substring(i * 2, 2), 16); return returnBytes; } #endregion #region 下拉框绑定 /// /// 下拉框绑定 /// /// /// public static void BindCombox( LYFZ.ComponentLibrary.ComboBoxEx cmb, string StrBindData, bool IsFirstNodeNull = false ) { cmb.Items.Clear(); if ( !string.IsNullOrEmpty(StrBindData.Trim()) ) { string[] StrArray = StrBindData.Split(','); for ( int i = 0; i < StrArray.Length; i++ ) { if ( i == 0 ) { if ( IsFirstNodeNull ) { cmb.Items.Add(""); } } if ( !string.IsNullOrEmpty(StrArray[i].Trim()) ) { cmb.Items.Add(StrArray[i].Trim()); } } } } /// /// 下拉树绑定 /// /// 当前下拉树 /// 字符串数据 /// 是否显示第一节点是否为空 /// 显示第一节点是否为空时的Text显示 /// 每组中是否要再次分割(Tag:数组0;Text:数组1) /// 要分割的分割符 public static void BindComboxTreeView( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrBindData, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", bool IsSplit = false, char StrSplitSymbol = ':' ) { cmbtreev.Nodes.Clear(); if ( !string.IsNullOrEmpty(StrBindData.Trim()) ) { string[] StrArray = StrBindData.Split(','); TreeNode root = null; for ( int i = 0; i < StrArray.Length; i++ ) { if ( i == 0 ) { if ( IsFirstNodeNull ) { root = new TreeNode(); root.Text = IsFirstNodeName; root.Tag = ""; root.Name = ""; cmbtreev.Nodes.Add(root); } } if ( !string.IsNullOrEmpty(StrArray[i].Trim()) ) { root = new TreeNode(); if ( IsSplit ) { string[] StrSplitArray = StrArray[i].Trim().Split(StrSplitSymbol); root.Text = StrSplitArray[1].Trim(); root.Tag = StrSplitArray[0].Trim(); } else { root.Text = StrArray[i].Trim(); root.Tag = StrArray[i].Trim(); } root.Name = StrArray[i].Trim(); cmbtreev.Nodes.Add(root); } } } } #endregion #region 部门设置的绑定数据 /// /// 部门设置的绑定数据 /// /// 当前下拉树 /// 是否显示第一节点是否为空 /// 显示第一节点是否为空时的Text显示 /// 查询条件,比如 ID!='1' 等 public static void BindComboBoxTreeView_DepartmentSet( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", string StrWhere = "", DataTable tbl = null ) { if ( tbl == null ) { tbl = orbll.GetView_Custom("tb_ErpDepartment", StrWhere: StrWhere, ShowColumnName: "ID,Dt_Name").Tables[0]; } cmbtreev.Nodes.Clear(); TreeNode root = null; for ( int i = 0; i < tbl.Rows.Count; i++ ) { if ( i == 0 ) { if ( IsFirstNodeNull ) { root = new TreeNode(); root.Text = IsFirstNodeName; root.Tag = ""; root.Name = ""; cmbtreev.Nodes.Add(root); } } root = new TreeNode(); root.Text = tbl.Rows[i]["Dt_Name"].ToString(); root.Tag = tbl.Rows[i]["ID"].ToString(); root.Name = tbl.Rows[i]["ID"].ToString(); cmbtreev.TreeView.Nodes.Add(root); } } #endregion #region 分店信息绑定数据 /// /// 分店信息绑定数据 /// /// 当前下拉树 /// 是否显示第一节点是否为空 /// 显示第一节点是否为空时的Text显示 /// 查询条件,比如 ID!='1' 等 public static void BindComboBoxTreeView_StoreNameSet( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", string StrWhere = "", DataTable tbl = null ) { if ( tbl == null ) { tbl = orbll.GetView_Custom("tb_ErpCompanyInfo", StrWhere: StrWhere, ShowColumnName: "ID,Company_DividedShop,Company_Name").Tables[0]; } cmbtreev.Nodes.Clear(); TreeNode root = null; for ( int i = 0; i < tbl.Rows.Count; i++ ) { if ( i == 0 ) { if ( IsFirstNodeNull ) { root = new TreeNode(); root.Text = IsFirstNodeName; root.Tag = ""; root.Name = ""; cmbtreev.Nodes.Add(root); } } root = new TreeNode(); root.Text = tbl.Rows[i]["Company_Name"].ToString().Trim(); root.Tag = tbl.Rows[i]["Company_DividedShop"].ToString().Trim(); root.Name = tbl.Rows[i]["ID"].ToString().Trim(); cmbtreev.TreeView.Nodes.Add(root); } } /// /// 分店信息绑定数据 /// /// 当前下拉树 /// 是否显示第一节点是否为空 /// 显示第一节点是否为空时的Text显示 /// 查询条件,比如 ID!='1' 等 public static void BindComboBoxTreeView_StoreName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string IsFirstNodeName = " " ) { DataTable tbl = orbll.GetView_Custom("tb_ErpCompanyInfo", StrWhere: "", ShowColumnName: "ID,Company_DividedShop,Company_Name").Tables[0]; cmbtreev.Nodes.Clear(); TreeNode root = null; for ( int i = 0; i < tbl.Rows.Count; i++ ) { if ( i == 0 && tbl.Rows.Count > 1 ) { root = new TreeNode(); root.Text = IsFirstNodeName; root.Tag = ""; root.Name = ""; cmbtreev.Nodes.Add(root); } root = new TreeNode(); root.Text = tbl.Rows[i]["Company_Name"].ToString().Trim(); root.Tag = tbl.Rows[i]["Company_DividedShop"].ToString().Trim(); root.Name = tbl.Rows[i]["ID"].ToString().Trim(); cmbtreev.TreeView.Nodes.Add(root); } if ( tbl.Rows.Count > 1 ) { cmbtreev.TextFindTag(IsFirstNodeName); } else { cmbtreev.TagFindText(tbl.Rows[0]["Company_DividedShop"].ToString().Trim()); } } #endregion #region 套系类别与套系名称绑定 /// /// 套系类别与套系名称绑定 /// /// 控件 /// 父节点ID /// 第一节点是否为空 /// 是要过滤套系类别没有设置套系名称的节点 public static void BindComboBoxTreeView_PackagesCategoryAndName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrParentCode, bool IsFirstNodeNull = false, bool IsPackagesNameNull = true ) { LYFZ.BLL.BLL_ErpSystemCategory scbll = new BLL.BLL_ErpSystemCategory(); LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder(); DataTable tblBigCategory = scbll.GetAllList().Tables[0]; DataTable tblpak = orbll.GetView_Custom("tb_ErpPackages", StrWhere: "Pak_IsDisable = '0'", ShowColumnName: "ID,Pak_PackagesClass,Pak_Name,Pak_PackagesID,Pak_UnitPrice").Tables[0]; DataTable tbl = scbll.GetListAccordingToClassCode(StrParentCode).Tables[0]; cmbtreev.Nodes.Clear(); if ( tbl.Rows.Count > 0 ) { TreeNode root = null; for ( int i = 0; i < tbl.Rows.Count; i++ ) { if ( i == 0 ) { if ( IsFirstNodeNull ) { root = new TreeNode(); root.Text = " "; root.Tag = ""; root.Name = ""; cmbtreev.Nodes.Add(root); } } bool IsRun = false; if ( IsPackagesNameNull ) { DataRow[] dtRow = tblBigCategory.Select("Sc_ClassParentID='" + tbl.Rows[i]["ID"].ToString().Trim() + "'"); if ( dtRow.Length > 0 ) { string Strsql = ""; for ( int j = 0; j < dtRow.Length; j++ ) { if ( j == 0 ) { Strsql += " Pak_PackagesClass = '" + dtRow[j]["Sc_ClassCode"].ToString().Trim() + "'"; } else { Strsql += " or Pak_PackagesClass = '" + dtRow[j]["Sc_ClassCode"].ToString().Trim() + "'"; } } //DataRow[] dtRow2 = tblpak.Select("Pak_PackagesClass = '" + dtRow[j]["Sc_ClassCode"].ToString().Trim() + "'"); DataRow[] dtRow2 = tblpak.Select(Strsql); if ( dtRow2.Length <= 0 ) { IsRun = true; } else { IsRun = false; } } else { DataRow[] dtRow2 = tblpak.Select("Pak_PackagesClass = '" + tbl.Rows[i]["Sc_ClassCode"].ToString().Trim() + "'"); if ( dtRow2.Length <= 0 ) { IsRun = true; } } } if ( IsRun ) { continue; } root = new TreeNode(); root.Text = tbl.Rows[i]["Sc_ClassName"].ToString(); root.Tag = tbl.Rows[i]["Sc_ClassCode"].ToString(); root.Name = "true"; CreateTreeViewPackagesCategoryAndName(root, tbl.Rows[i]["ID"].ToString(), tbl.Rows[i]["Sc_ClassCode"].ToString(), tblBigCategory, tblpak, IsPackagesNameNull); cmbtreev.TreeView.Nodes.Add(root); } } } /// /// 绑定第二级套系名称 /// /// 节点 /// 父节点ID /// 套系名称编号 /// 套系类别数据源 /// 套系名称数据源 private static void CreateTreeViewPackagesCategoryAndName( TreeNode nodes, string ClassParentID, string ClassCode, DataTable ustbl, DataTable tblpak, bool IsPackagesNameNull ) { if ( ClassCode != "" ) { if ( ustbl.Rows.Count <= 0 ) { ustbl = new BLL.BLL_ErpSystemCategory().GetAllList().Tables[0]; } DataRow[] dtRow = ustbl.Select("Sc_ClassParentID='" + ClassParentID + "'"); if ( dtRow.Length > 0 ) { TreeNode node; for ( int i = 0; i < dtRow.Length; i++ ) { if ( IsPackagesNameNull ) { DataRow[] dtRow2 = tblpak.Select("Pak_PackagesClass = '" + dtRow[i]["Sc_ClassCode"].ToString() + "'"); if ( dtRow2.Length <= 0 ) { continue; } } node = new TreeNode(); node.Text = dtRow[i]["Sc_ClassName"].ToString(); node.Tag = dtRow[i]["Sc_ClassCode"].ToString(); node.Name = "true"; nodes.Nodes.Add(node); GetPak(node, dtRow[i]["Sc_ClassCode"].ToString(), tblpak); } } else { if ( IsPackagesNameNull ) { DataRow[] dtRow2 = tblpak.Select("Pak_PackagesClass = '" + ClassCode + "'"); if ( dtRow2.Length <= 0 ) { return; } } GetPak(nodes, ClassCode, tblpak); } } } /// /// 绑定第三级套系名称 /// /// TreeView的子节点 /// 编码 public static void GetPak( TreeNode nodes, string ClassCode, DataTable tblpak ) { if ( tblpak.Rows.Count <= 0 ) { tblpak = new BLL.BLL_ErpOrder().GetView_Custom("tb_ErpPackages", StrWhere: "Pak_IsDisable = '0'", ShowColumnName: "ID,Pak_PackagesClass,Pak_Name,Pak_PackagesID,Pak_UnitPrice,Pak_IsDisable").Tables[0]; } DataRow[] dtRow = tblpak.Select("Pak_PackagesClass = '" + ClassCode + "'"); if ( dtRow.Length > 0 ) { TreeNode node; for ( int i = 0; i < dtRow.Length; i++ ) { node = new TreeNode(); node.Text = dtRow[i]["Pak_Name"].ToString(); node.Tag = dtRow[i]["Pak_PackagesID"].ToString(); node.Name = dtRow[i]["Pak_UnitPrice"].ToString(); nodes.Nodes.Add(node); } } } #endregion #region 系统类别设置绑定 /// /// 系统设置的绑定数据 /// /// 系统类别中的Sc_ClassCode值 /// 当前下拉树 /// 是否显示第一节点是否为空 /// 显示第一节点是否为空时的Text显示 /// 查询条件,比如 Sc_ClassCode!='BEBCADBFBCDFBGJHC' 等 /// 是否把当前参数StrParentCode做为主级 public static void BindComboBoxTreeView_SystemCategory( string StrParentCode, LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", string StrWhere = "", DataTable tbl = null, bool IsBindParent = false, bool IsClearNodes = true ) { if ( tbl == null ) { tbl = new BLL.BLL_ErpSystemCategory().GetCategory("ID,Sc_ClassCode,Sc_ClassName,Sc_ClassParentID", StrWhere).Tables[0]; } if ( IsClearNodes ) { cmbtreev.Nodes.Clear(); } DataRow[] dtRow = tbl.Select("Sc_ClassCode = '" + StrParentCode + "'"); if ( dtRow.Length > 0 ) { TreeNode root = null; if ( IsBindParent ) { root = new TreeNode(); root.Text = dtRow[0]["Sc_ClassName"].ToString(); root.Tag = dtRow[0]["Sc_ClassCode"].ToString(); root.Name = dtRow[0]["ID"].ToString().Trim(); CreateTreeViewSystemCategory(root, dtRow[0]["ID"].ToString().Trim(), tbl); cmbtreev.TreeView.Nodes.Add(root); } else { DataRow[] dtRow2 = tbl.Select("Sc_ClassParentID = '" + dtRow[0]["ID"].ToString().Trim() + "'"); if ( dtRow2.Length > 0 ) { for ( int i = 0; i < dtRow2.Length; i++ ) { if ( i == 0 ) { if ( IsFirstNodeNull ) { root = new TreeNode(); root.Text = IsFirstNodeName; root.Tag = ""; root.Name = ""; cmbtreev.Nodes.Add(root); } } root = new TreeNode(); root.Text = dtRow2[i]["Sc_ClassName"].ToString(); root.Tag = dtRow2[i]["Sc_ClassCode"].ToString(); root.Name = dtRow2[i]["ID"].ToString(); CreateTreeViewSystemCategory(root, dtRow2[i]["ID"].ToString(), tbl); cmbtreev.TreeView.Nodes.Add(root); } } else { root = new TreeNode(); root.Text = dtRow[0]["Sc_ClassName"].ToString(); root.Tag = dtRow[0]["Sc_ClassCode"].ToString(); root.Name = dtRow[0]["ID"].ToString().Trim(); CreateTreeViewSystemCategory(root, dtRow[0]["ID"].ToString().Trim(), tbl); cmbtreev.TreeView.Nodes.Add(root); } } } } /// /// 第二级绑定 /// /// 父节点 /// 父节点的ID /// 当前数据源 private static void CreateTreeViewSystemCategory( TreeNode nodes, string ClassParentID, DataTable tbl ) { DataRow[] dtRow = tbl.Select("Sc_ClassParentID='" + ClassParentID + "'"); if ( dtRow.Length > 0 ) { TreeNode node; for ( int i = 0; i < dtRow.Length; i++ ) { node = new TreeNode(); node.Text = dtRow[i]["Sc_ClassName"].ToString(); node.Tag = dtRow[i]["Sc_ClassCode"].ToString(); node.Name = dtRow[i]["ID"].ToString(); nodes.Nodes.Add(node); CreateTreeViewSystemCategory(node, dtRow[i]["ID"].ToString(), tbl); } } } #endregion #region 系统类别与产品绑定 private static DataTable _tbl_Product = new DataTable(); /// /// 产品 /// public static DataTable Tbl_Product { get { return PublicCodeClasses._tbl_Product; } set { PublicCodeClasses._tbl_Product = value; } } /// /// 系统类别与产品绑定 /// /// 系统类别 /// 控件 /// 第一节点是否为空 /// 是否显示所有店的产品 public static void BindComboBoxTreeView_Product( string StrParentCode, LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false ) { DataTable tbl = new BLL.BLL_ErpSystemCategory().GetCategory("ID,Sc_ClassCode,Sc_ClassName,Sc_ClassParentID", "").Tables[0]; cmbtreev.Nodes.Clear(); DataRow[] dtRow = tbl.Select("Sc_ClassCode = '" + StrParentCode + "'"); if ( dtRow.Length > 0 ) { DataRow[] dtRow2 = tbl.Select("Sc_ClassParentID = '" + dtRow[0]["ID"].ToString().Trim() + "'"); if ( dtRow2.Length > 0 ) { TreeNode root = null; for ( int i = 0; i < dtRow2.Length; i++ ) { if ( i == 0 ) { if ( IsFirstNodeNull ) { root = new TreeNode(" "); root.Tag = ""; root.Name = ""; cmbtreev.Nodes.Add(root); } } root = new TreeNode(); root.Text = dtRow2[i]["Sc_ClassName"].ToString(); root.Tag = dtRow2[i]["Sc_ClassCode"].ToString(); root.Name = "System"; DataRow[] dtRow3 = tbl.Select("Sc_ClassParentID='" + dtRow2[i]["ID"].ToString() + "'"); if ( dtRow3.Length > 0 ) { CreateTreeViewSystemCategoryProduct(root, tbl, dtRow3); } else { GetProduct(root, dtRow2[i]["Sc_ClassCode"].ToString()); } cmbtreev.TreeView.Nodes.Add(root); } } } } /// /// 第二级绑定 /// /// 父节点 /// 父节点的ID /// 当前数据源 private static void CreateTreeViewSystemCategoryProduct( TreeNode nodes, DataTable tbl, DataRow[] dtRow ) { if ( dtRow.Length > 0 ) { TreeNode node; for ( int i = 0; i < dtRow.Length; i++ ) { node = new TreeNode(); node.Text = dtRow[i]["Sc_ClassName"].ToString(); node.Tag = dtRow[i]["Sc_ClassCode"].ToString(); node.Name = "System"; nodes.Nodes.Add(node); DataRow[] dtRow1 = tbl.Select("Sc_ClassParentID='" + dtRow[i]["ID"].ToString() + "'"); if ( dtRow1.Length > 0 ) { CreateTreeViewSystemCategoryProduct(node, tbl, dtRow1); } else { GetProduct(node, dtRow[i]["Sc_ClassCode"].ToString()); } } } } /// /// 第三级绑定 /// /// 节点 /// 父节点ID /// 是否显示所有店的产品 public static void GetProduct( TreeNode nodes, string ClassCode ) { if ( Tbl_Product.Rows.Count <= 0 ) { Tbl_Product = new BLL.BLL_ErpProduct().GetAllList().Tables[0]; } DataRow[] dtRow = Tbl_Product.Select(" Prod_Class='" + ClassCode + "'"); if ( dtRow.Length > 0 ) { TreeNode node; for ( int i = 0; i < dtRow.Length; i++ ) { node = new TreeNode(); node.Text = dtRow[i]["Prod_Name"].ToString(); node.Tag = dtRow[i]["Prod_Number"].ToString(); node.Name = "Product"; nodes.Nodes.Add(node); } } } #endregion #region 部门与人员绑定 /// /// 部门 /// public static DataTable Tbl_Department { get { return LYFZ.DAL.DAL_ErpUser.GetUser_Department(); //new BLL.BLL_ErpOrder().GetView_Custom("tb_ErpDepartment", ShowColumnName: "ID,Dt_Name,Dt_DividedShop").Tables[0]; } } /// /// 部门 /// public static DataTable Tbl_StoreName { get { return new BLL.BLL_ErpOrder().GetView_Custom("tb_ErpCompanyInfo", ShowColumnName: "Company_DividedShop,Company_Name").Tables[0]; } } /// /// 部门、员工绑定 /// /// 控件 /// 第一节点是否为空 /// 显示第一节点是否为空时所显示的Text /// 是否显示离职 /// 是否显示Admin /// 显示全部 public static void BindComboBoxTreeView_StoreDepartment( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", bool IsShowResign = true, bool IsShowAdmin = false, bool IsHaveAllTreeNode = false ) { TreeNode root = null; TreeNode nodes = null; cmbtreev.Nodes.Clear(); if ( IsHaveAllTreeNode ) { root = new TreeNode(); root.Text = "全部"; root.Tag = ""; root.Name = ""; cmbtreev.Nodes.Add(root); } DataTable tbl = Tbl_Department; DataTable dtStore = Tbl_StoreName; if ( dtStore.Rows.Count > 0 ) { for ( int i = 0; i < dtStore.Rows.Count; i++ ) { if ( i == 0 ) { if ( IsFirstNodeNull ) { root = new TreeNode(); root.Text = IsFirstNodeName; root.Tag = ""; root.Name = ""; cmbtreev.Nodes.Add(root); } } root = new TreeNode(); root.Text = dtStore.Rows[i]["Company_Name"].ToString(); root.Tag = dtStore.Rows[i]["Company_DividedShop"].ToString().Trim(); root.Name = "StoreName"; DataRow[] departRows = tbl.Select(" Dt_DividedShop = '" + dtStore.Rows[i]["Company_DividedShop"].ToString().Trim() + "' "); for ( int j = 0; j < departRows.Length; j++ ) { nodes = new TreeNode(); nodes.Text = departRows[j]["Dt_Name"].ToString(); nodes.Tag = departRows[j]["ID"].ToString().Trim(); nodes.Name = "Department"; root.Nodes.Add(nodes); } cmbtreev.TreeView.Nodes.Add(root); } } else { for ( int i = 0; i < tbl.Rows.Count; i++ ) { if ( i == 0 ) { if ( IsFirstNodeNull ) { root = new TreeNode(); root.Text = IsFirstNodeName; root.Tag = ""; root.Name = ""; cmbtreev.Nodes.Add(root); } } root = new TreeNode(); root.Text = tbl.Rows[i]["Dt_Name"].ToString(); root.Tag = tbl.Rows[i]["ID"].ToString().Trim(); root.Name = "Department"; cmbtreev.TreeView.Nodes.Add(root); } } } /// /// 部门、员工绑定 /// /// 控件 /// 第一节点是否为空 /// 显示第一节点是否为空时所显示的Text /// 是否显示离职 /// 是否显示Admin /// 显示全部 public static void BindComboBoxTreeView_DepartmentAndEmployee( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", bool IsShowResign = false, bool IsShowAdmin = false, DataTable tb_User = null, bool IsHaveAllTreeNode = false ) { if ( tb_User == null ) { tb_User = LYFZ.Software.MainBusiness.DoorCityProcess.PublicGetVersionDataTable.GetUserTable(IsShowResign: IsShowResign, IsShowAdmin: IsShowAdmin); } TreeNode root = null; TreeNode nodes = null; cmbtreev.Nodes.Clear(); if ( IsHaveAllTreeNode ) { root = new TreeNode(); root.Text = "全部"; root.Tag = ""; root.Name = ""; cmbtreev.Nodes.Add(root); } DataTable tbl = Tbl_Department; DataTable dtStore = Tbl_StoreName; if ( dtStore.Rows.Count > 1 ) { for ( int i = 0; i < dtStore.Rows.Count; i++ ) { if ( i == 0 ) { if ( IsFirstNodeNull ) { root = new TreeNode(); root.Text = IsFirstNodeName; root.Tag = ""; root.Name = ""; cmbtreev.Nodes.Add(root); } } root = new TreeNode(); root.Text = dtStore.Rows[i]["Company_Name"].ToString(); root.Tag = dtStore.Rows[i]["Company_DividedShop"].ToString().Trim(); root.Name = "StoreName"; for ( int j = 0; j < tbl.Rows.Count; j++ ) { DataRow[] dtRow = tb_User.Select("User_Department='" + tbl.Rows[j]["ID"].ToString().Trim() + "' And User_DividedShop = '" + dtStore.Rows[i]["Company_DividedShop"].ToString().Trim() + "'"); if ( dtRow.Length <= 0 ) { continue; } nodes = new TreeNode(); nodes.Text = tbl.Rows[j]["Dt_Name"].ToString(); nodes.Tag = tbl.Rows[j]["ID"].ToString().Trim(); nodes.Name = "Department"; CreateTreeViewDepartmentUser(nodes, tbl.Rows[j]["ID"].ToString(), tb_User, IsShowResign, dtStore.Rows[i]["Company_DividedShop"].ToString().Trim()); root.Nodes.Add(nodes); } cmbtreev.TreeView.Nodes.Add(root); } } else { for ( int i = 0; i < tbl.Rows.Count; i++ ) { if ( i == 0 ) { if ( IsFirstNodeNull ) { root = new TreeNode(); root.Text = IsFirstNodeName; root.Tag = ""; root.Name = ""; cmbtreev.Nodes.Add(root); } } DataRow[] dtRow = tb_User.Select("User_Department='" + tbl.Rows[i]["ID"].ToString().Trim() + "'"); if ( dtRow.Length <= 0 ) { continue; } root = new TreeNode(); root.Text = tbl.Rows[i]["Dt_Name"].ToString(); root.Tag = tbl.Rows[i]["ID"].ToString().Trim(); root.Name = "Department"; CreateTreeViewDepartmentUser(root, tbl.Rows[i]["ID"].ToString(), tb_User, IsShowResign); cmbtreev.TreeView.Nodes.Add(root); } } } /// /// 绑定第二级人员 /// /// TreeView的节点集合 /// 数据源 /// private static void CreateTreeViewDepartmentUser( TreeNode nodes, string ClassCode, DataTable tb_User, bool IsShowResign, string SotreNumber = "SSN001" ) { if ( ClassCode != "" ) { DataRow[] dtRow = tb_User.Select("User_Department='" + ClassCode + "' And User_DividedShop = '" + SotreNumber + "'"); if ( dtRow.Length > 0 ) { TreeNode node; for ( int i = 0; i < dtRow.Length; i++ ) { if ( dtRow[i]["User_Status"].ToString() != "离职" || IsShowResign ) { node = new TreeNode(); node.Text = dtRow[i]["User_Name"].ToString(); node.Tag = dtRow[i]["User_EmployeeID"].ToString(); node.Name = "User"; nodes.Nodes.Add(node); } } } } } #endregion #region 制作商绑定 /// /// 制作商 /// /// 要操作的控件 /// 要操作的数据源,如果数据源为NULL,则会去获取 /// 要给Tag指定值的字段名 public static void BindComboBoxTreeView_Vendor( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, DataTable tbl = null, string StrTagNameValue = "Vd_Number" ) { if ( tbl == null ) { tbl = new BLL.BLL_ErpVendor().GetAllList().Tables[0]; } cmbtreev.Nodes.Clear(); TreeNode root = null; for ( int i = 0; i < tbl.Rows.Count; i++ ) { if ( i == 0 ) { root = new TreeNode(" "); root.Tag = ""; root.Name = ""; cmbtreev.Nodes.Add(root); } root = new TreeNode(); root.Text = tbl.Rows[i]["Vd_Name"].ToString(); root.Tag = tbl.Rows[i][StrTagNameValue].ToString(); root.Name = tbl.Rows[i]["ID"].ToString(); cmbtreev.TreeView.Nodes.Add(root); } } #endregion #region 支付方式绑定 /// /// 支付方式绑定 /// /// 控件 /// 是否显示所有 /// 数据源 public static void BindComboBoxTreeView_PaymentMethod( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsShowAll = true, DataTable tbl = null, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", string StrWhere = "" ) { cmbtreev.Nodes.Clear(); string[] numMemberNotShowPaymentMethod = System.Enum.GetNames(typeof(EnumPublic.MemberNotShowPaymentMethod)); if ( tbl == null ) { tbl = new BLL.BLL_ErpSystemCategory().GetList(StrWhere).Tables[0]; } DataRow[] dtRow = tbl.Select("Sc_ClassCode = 'BEBACCAFCCEAGAIHH'"); if ( dtRow.Length > 0 ) { TreeNode root = null; DataRow[] dtRow2 = tbl.Select(" Sc_ClassParentID ='" + dtRow[0]["ID"].ToString().Trim() + "'"); for ( int i = 0; i < dtRow2.Length; i++ ) { bool Isbl = true; if ( !IsShowAll ) { for ( int j = 0; j < numMemberNotShowPaymentMethod.Length; j++ ) { if ( dtRow2[i]["Sc_ClassName"].ToString().Trim() == numMemberNotShowPaymentMethod[j].Trim() ) { Isbl = false; break; } } } if ( Isbl ) { if ( i == 0 ) { if ( IsFirstNodeNull ) { root = new TreeNode(); root.Text = IsFirstNodeName; root.Tag = ""; root.Name = ""; cmbtreev.Nodes.Add(root); } } root = new TreeNode(); root.Text = dtRow2[i]["Sc_ClassName"].ToString(); root.Tag = dtRow2[i]["Sc_ClassCode"].ToString(); root.Name = dtRow2[i]["ID"].ToString(); CreateTreeViewPaymentMethod(root, dtRow2[i]["ID"].ToString().Trim(), tbl); cmbtreev.TreeView.Nodes.Add(root); } } } } /// /// 绑定第二级人员 /// /// TreeView的节点 /// 父节点ID /// 数据源 private static void CreateTreeViewPaymentMethod( TreeNode nodes, string ClassCode, DataTable tbl ) { if ( ClassCode != "" ) { DataRow[] dtRow = tbl.Select("Sc_ClassParentID='" + ClassCode + "'"); if ( dtRow.Length > 0 ) { TreeNode node; for ( int i = 0; i < dtRow.Length; i++ ) { node = new TreeNode(); node.Text = dtRow[i]["Sc_ClassName"].ToString(); node.Tag = dtRow[i]["Sc_ClassCode"].ToString(); node.Name = dtRow[i]["ID"].ToString(); nodes.Nodes.Add(node); CreateTreeViewPaymentMethod(node, dtRow[i]["ID"].ToString().Trim(), tbl); } } } } #endregion #region 新开单页面绑定客户来源下拉树 /// /// 新开单页面绑定客户来源下拉树 /// /// 系统类别中的Sc_ClassCode值 /// 当前下拉树 /// 第一节点是否为空 /// 要隐藏的节点编号,多个时中间用','分割 public static void BindComboBoxTreeView_ClientSourec( string StrParentCode, LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false, string strHideFiled = "", string IsFirstNodeName = " ", DataTable tbl = null ) { string[] strHide = null; if ( strHideFiled != "" ) { strHide = strHideFiled.Split(','); } cmbtreev.Nodes.Clear(); if ( tbl == null ) { tbl = new BLL.BLL_ErpSystemCategory().GetCategory("ID,Sc_ClassCode,Sc_ClassName,Sc_ClassParentID", "").Tables[0]; } DataRow[] dtRow = tbl.Select("Sc_ClassCode = '" + StrParentCode + "'"); if ( dtRow.Length > 0 ) { DataRow[] dtRow2 = tbl.Select("Sc_ClassParentID = '" + dtRow[0]["ID"].ToString().Trim() + "'"); TreeNode root = null; for ( int i = 0; i < dtRow2.Length; i++ ) { if ( i == 0 ) { if ( IsFirstNodeNull ) { root = new TreeNode(IsFirstNodeName); root.Tag = ""; root.Name = ""; cmbtreev.Nodes.Add(root); } } if ( strHideFiled != "" ) { bool Isbl = false; for ( int j = 0; j < strHide.Length; j++ ) { if ( strHide[j].Trim() == dtRow2[i]["Sc_ClassCode"].ToString() ) { Isbl = true; break; } } if ( Isbl ) { continue; } } root = new TreeNode(); root.Text = dtRow2[i]["Sc_ClassName"].ToString(); root.Tag = dtRow2[i]["Sc_ClassCode"].ToString(); root.Name = dtRow2[i]["ID"].ToString(); CreateTreeViewClientSourec(root, dtRow2[i]["ID"].ToString(), tbl); cmbtreev.Nodes.Add(root); } } } private static void CreateTreeViewClientSourec( TreeNode nodes, string ClassParentID, DataTable tbl ) { DataRow[] dtRow = tbl.Select("Sc_ClassParentID='" + ClassParentID + "'"); if ( dtRow.Length > 0 ) { TreeNode node; for ( int i = 0; i < dtRow.Length; i++ ) { node = new TreeNode(); node.Text = dtRow[i]["Sc_ClassName"].ToString(); node.Tag = dtRow[i]["Sc_ClassCode"].ToString(); node.Name = dtRow[i]["ID"].ToString(); nodes.Nodes.Add(node); CreateTreeViewClientSourec(node, dtRow[i]["ID"].ToString(), tbl); } } } #endregion #region 团队PK /// /// 活动名称 /// public static void BindComboBoxTreeView_TeamActivityName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev ) { cmbtreev.Nodes.Clear(); DataTable dtActivity = orbll.GetView_Custom("tb_ErpTeamActiveSet", StrWhere: "Tas_IsEnabled = 1", ShowColumnName: "Tas_Number,Tas_Name", filedOrder: "ID").Tables[0]; TreeNode root = null; for ( int i = 0; i < dtActivity.Rows.Count; i++ ) { root = new TreeNode(); root.Tag = dtActivity.Rows[i]["Tas_Number"].ToString().Trim(); root.Name = dtActivity.Rows[i]["Tas_Number"].ToString().Trim(); root.Text = dtActivity.Rows[i]["Tas_Name"].ToString().Trim(); cmbtreev.Nodes.Add(root); } } /// /// 大队名称(大队名称设置表,获取表:tb_ErpTeamMaxNameSet) /// /// public static void BindComboBoxTreeView_TeamMaxName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev ) { cmbtreev.SetTextAndTag_ValueNull(); cmbtreev.Nodes.Clear(); DataTable dt = orbll.GetView_Custom("tb_ErpTeamMaxNameSet", StrWhere: "", ShowColumnName: "Tmxn_Number,Tmxn_Name", filedOrder: "ID DESC").Tables[0]; TreeNode root = null; for ( int i = 0; i < dt.Rows.Count; i++ ) { root = new TreeNode(); root.Tag = dt.Rows[i]["Tmxn_Number"].ToString().Trim(); root.Name = dt.Rows[i]["Tmxn_Number"].ToString().Trim(); root.Text = dt.Rows[i]["Tmxn_Name"].ToString().Trim(); cmbtreev.Nodes.Add(root); } } /// /// 大队名称(根据活动编号获取大队名称任务表,获取表:tb_ErpTeamMaxTaskSet Left Join tb_ErpTeamMaxNameSet on Tmxn_Number = Tmxt_TmxnNumber) /// /// public static void BindComboBoxTreeView_TeamMaxTaskName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrActivityNumber, bool IsFirstNodeNull = false, string IsFirstNodeName = " " ) { cmbtreev.SetTextAndTag_ValueNull(); cmbtreev.Nodes.Clear(); string StrWhere = "Tmxt_TasNumber = '" + StrActivityNumber + "'"; DataTable dt = orbll.GetView_Custom("tb_ErpTeamMaxTaskSet Left Join tb_ErpTeamMaxNameSet on Tmxn_Number = Tmxt_TmxnNumber", StrWhere: StrWhere, ShowColumnName: "Tmxt_Number,Tmxt_TmxnNumber,Tmxn_Name", filedOrder: "tb_ErpTeamMaxTaskSet.ID DESC").Tables[0]; TreeNode root = null; if ( IsFirstNodeNull ) { root = new TreeNode(); root.Tag = ""; root.Name = ""; root.Text = IsFirstNodeName; cmbtreev.Nodes.Add(root); } for ( int i = 0; i < dt.Rows.Count; i++ ) { root = new TreeNode(); root.Tag = dt.Rows[i]["Tmxt_TmxnNumber"].ToString().Trim(); root.Name = dt.Rows[i]["Tmxt_Number"].ToString().Trim(); root.Text = dt.Rows[i]["Tmxn_Name"].ToString().Trim(); cmbtreev.Nodes.Add(root); } } /// /// 小组名称(小组名称设置表,获取表:tb_ErpTeamMinNameSet) /// /// public static void BindComboBoxTreeView_TeamMinName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false, string IsFirstNodeName = " " ) { cmbtreev.SetTextAndTag_ValueNull(); cmbtreev.Nodes.Clear(); DataTable dt = orbll.GetView_Custom("tb_ErpTeamMinNameSet", StrWhere: "", ShowColumnName: "Tmin_Number,Tmin_Name", filedOrder: "ID DESC").Tables[0]; TreeNode root = null; if ( IsFirstNodeNull ) { root = new TreeNode(); root.Tag = ""; root.Name = ""; root.Text = IsFirstNodeName; cmbtreev.Nodes.Add(root); } for ( int i = 0; i < dt.Rows.Count; i++ ) { root = new TreeNode(); root.Tag = dt.Rows[i]["Tmin_Number"].ToString().Trim(); root.Name = dt.Rows[i]["Tmin_Number"].ToString().Trim(); root.Text = dt.Rows[i]["Tmin_Name"].ToString().Trim(); cmbtreev.Nodes.Add(root); } } /// /// 小组名称(根据活动编号获取小组名称任务表,获取表:tb_ErpTeamMinTaskSet Left Join tb_ErpTeamMinNameSet on Tmin_Number = Tmit_TminNumber) /// /// public static void BindComboBoxTreeView_TeamMinTaskName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrActivityNumber, string StrMaxNumber, bool IsFirstNodeNull = false, string IsFirstNodeName = " " ) { cmbtreev.SetTextAndTag_ValueNull(); cmbtreev.Nodes.Clear(); DataTable dt = orbll.GetView_Custom("tb_ErpTeamMinTaskSet Left Join tb_ErpTeamMinNameSet on Tmin_Number = Tmit_TminNumber", StrWhere: "Tmit_TasNumber = '" + StrActivityNumber + "' And Tmit_TmxnNumber = '" + StrMaxNumber + "'", ShowColumnName: "Tmit_Number,Tmit_TminNumber,Tmin_Name", filedOrder: "tb_ErpTeamMinTaskSet.ID").Tables[0]; TreeNode root = null; if ( IsFirstNodeNull ) { root = new TreeNode(); root.Tag = ""; root.Name = ""; root.Text = IsFirstNodeName; cmbtreev.Nodes.Add(root); } for ( int i = 0; i < dt.Rows.Count; i++ ) { root = new TreeNode(); root.Tag = dt.Rows[i]["Tmit_TminNumber"].ToString().Trim(); root.Name = dt.Rows[i]["Tmit_Number"].ToString().Trim(); root.Text = dt.Rows[i]["Tmin_Name"].ToString().Trim(); cmbtreev.Nodes.Add(root); } } #endregion #region 客户关系 /// /// 客户关系 /// /// 系统类别中的Sc_ClassCode值 /// 当前下拉树 /// 第一节点是否为空 public static void BindComboBoxTreeView_ClientRelation( string StrParentCode, LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, bool IsFirstNodeNull = false ) { cmbtreev.Nodes.Clear(); DataTable tbl = new BLL.BLL_ErpSystemCategory().GetCategory("ID,Sc_ClassCode,Sc_ClassName,Sc_ClassParentID", "").Tables[0]; DataRow[] dtRow = tbl.Select("Sc_ClassCode = '" + StrParentCode + "'"); if ( dtRow.Length > 0 ) { DataRow[] dtRow2 = tbl.Select("Sc_ClassParentID = '" + dtRow[0]["ID"].ToString().Trim() + "'"); TreeNode root = null; for ( int i = 0; i < dtRow2.Length; i++ ) { if ( i == 0 ) { if ( IsFirstNodeNull ) { root = new TreeNode(" "); root.Tag = ""; root.Name = ""; cmbtreev.Nodes.Add(root); } } root = new TreeNode(); root.Text = dtRow2[i]["Sc_ClassName"].ToString(); root.Tag = dtRow2[i]["Sc_ClassCode"].ToString(); root.Name = dtRow2[i]["ID"].ToString(); CreateTreeViewClientRelation(root, dtRow2[i]["ID"].ToString(), tbl); cmbtreev.Nodes.Add(root); } } } private static void CreateTreeViewClientRelation( TreeNode nodes, string ClassParentID, DataTable tbl ) { DataRow[] dtRow = tbl.Select("Sc_ClassParentID='" + ClassParentID + "'"); if ( dtRow.Length > 0 ) { TreeNode node; for ( int i = 0; i < dtRow.Length; i++ ) { node = new TreeNode(); node.Text = dtRow[i]["Sc_ClassName"].ToString(); node.Tag = dtRow[i]["Sc_ClassCode"].ToString(); node.Name = dtRow[i]["ID"].ToString(); nodes.Nodes.Add(node); CreateTreeViewClientRelation(node, dtRow[i]["ID"].ToString(), tbl); } } } #endregion #region 获取订单版本权限 /// /// 获取系统版本 /// public static void GetSystemVersion( LYFZ.ComponentLibrary.CheckBoxEx chkPortraitVersion, LYFZ.ComponentLibrary.CheckBoxEx chkDressVersion, LYFZ.ComponentLibrary.CheckBoxEx chkKidsVersion ) { bool IsPortrait = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsEnablePhotoEdition; chkKidsVersion.Visible = false;//儿童 chkDressVersion.Visible = false;//婚纱 chkPortraitVersion.Visible = false;//写真 switch ( LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType() ) { case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.旗舰版: chkKidsVersion.Visible = true; chkDressVersion.Visible = true; if ( IsPortrait ) { chkPortraitVersion.Visible = true; } break; case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.婚纱版: chkDressVersion.Visible = true; if ( IsPortrait ) { chkPortraitVersion.Visible = true; } break; case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.儿童版: chkKidsVersion.Visible = true; if ( IsPortrait ) { chkPortraitVersion.Visible = true; } break; } } #endregion #region 获取版本 (用于门市流程查询报表) /// /// 获取版本(用于门市流程查询报表) /// /// public static string GetVersion( LYFZ.ComponentLibrary.CheckBoxEx chkPortraitVersion, LYFZ.ComponentLibrary.CheckBoxEx chkDressVersion, LYFZ.ComponentLibrary.CheckBoxEx chkKidsVersion ) { string RetValue = ""; bool IsPortrait = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsEnablePhotoEdition; if ( !IsPortrait ) { if ( chkPortraitVersion.Checked ) { RetValue = "2"; } else if ( chkDressVersion.Checked || LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.婚纱版 == LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType() ) { if ( IsPortrait && !chkDressVersion.Checked ) { RetValue = "-1"; } else { RetValue = "0"; } } else if ( chkKidsVersion.Checked || LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.儿童版 == LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType() ) { if ( IsPortrait && !chkKidsVersion.Checked ) { RetValue = "-1"; } else { RetValue = "1"; } } else { RetValue = "-1"; } } else if ( IsPortrait ) { RetValue = "-1"; } return RetValue; } #endregion #region 根据时间字段 返回时间段 /// /// 根据时间字段 返回时间段 /// /// 字段名称 /// 开始时间 /// 结束时间(结束时间可以等于开始时间) /// 开始时间与结束时间相同时,结束时间或以退后时间,默认为1天 /// 连接关键字,默认为'And' /// public static string GetDateTime( string StrFieldName, string StartDateTime, string EndDateTime, int DateAddDays = 1, string ConnectWord = "And" ) { string StrWhere = ""; if ( StartDateTime.Trim() != "" && EndDateTime.Trim() != "" ) { StrWhere = " (" + StrFieldName + " between '" + Convert.ToDateTime(StartDateTime).ToString("yyyy-MM-dd HH:mm:ss") + "' and '" + Convert.ToDateTime(EndDateTime).AddDays(DateAddDays).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss") + "')"; } else if ( StartDateTime.Trim() != "" && EndDateTime.Trim() == "" ) { StrWhere = StrFieldName + " = '" + Convert.ToDateTime(StartDateTime).ToString("yyyy-MM-dd HH:mm:ss") + "'"; } else if ( StartDateTime.Trim() == "" && EndDateTime.Trim() != "" ) { StrWhere = StrFieldName + " = '" + Convert.ToDateTime(EndDateTime).ToString("yyyy-MM-dd HH:mm:ss") + "'"; } if ( !string.IsNullOrEmpty(StrWhere) && !string.IsNullOrEmpty(ConnectWord) ) { StrWhere = " " + ConnectWord + " " + StrWhere; } return StrWhere; } /// /// 根据时间字段 返回时间段(通用于DataTable的查找) /// /// 字段名称 /// 开始时间 /// 结束时间(结束时间可以等于开始时间) /// 开始时间与结束时间相同时,结束时间或以退后时间,默认为1天 /// 连接关键字,默认为'And' /// public static string GetDateTime2( string StrFieldName, string StartDateTime, string EndDateTime, int DateAddDays = 1, string ConnectWord = "And" ) { string StrWhere = ""; if ( StartDateTime.Trim() != "" && EndDateTime.Trim() != "" ) { StrWhere = " (" + StrFieldName + " >= '" + Convert.ToDateTime(StartDateTime).ToString("yyyy-MM-dd HH:mm:ss") + "' and " + StrFieldName + " <= '" + Convert.ToDateTime(EndDateTime).AddDays(DateAddDays).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss") + "')"; } else if ( StartDateTime.Trim() != "" && EndDateTime.Trim() == "" ) { StrWhere = StrFieldName + " = '" + Convert.ToDateTime(StartDateTime).ToString("yyyy-MM-dd HH:mm:ss") + "'"; } else if ( StartDateTime.Trim() == "" && EndDateTime.Trim() != "" ) { StrWhere = StrFieldName + " = '" + Convert.ToDateTime(EndDateTime).ToString("yyyy-MM-dd HH:mm:ss") + "'"; } if ( !string.IsNullOrEmpty(StrWhere) && !string.IsNullOrEmpty(ConnectWord) ) { StrWhere = " " + ConnectWord + " " + StrWhere; } return StrWhere; } /// /// 获取今年的时间段 /// /// /// /// /// /// /// public static string GetDateTimeNowYear( string StrName, string StartDateTime, string EndDateTime, int DateAddDays = 1, string ConnectWord = "And" ) { string StrValue = ""; if ( StartDateTime.Trim() != "" && EndDateTime.Trim() != "" ) { StrValue = " " + ConnectWord + " (" + StrName + " between '" + Convert.ToDateTime(SDateTime.Now.Year + Convert.ToDateTime(StartDateTime).ToString("-MM-dd")).ToString("yyyy-MM-dd HH:mm:ss") + "' and '" + Convert.ToDateTime(SDateTime.Now.Year + Convert.ToDateTime(EndDateTime).ToString("-MM-dd")).AddDays(DateAddDays).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss") + "')"; } else if ( StartDateTime.Trim() != "" && EndDateTime.Trim() == "" ) { StrValue = " " + ConnectWord + " " + StrName + " = '" + Convert.ToDateTime(SDateTime.Now.Year + Convert.ToDateTime(StartDateTime).ToString("-MM-dd")).ToString("yyyy-MM-dd HH:mm:ss") + "'"; } else if ( StartDateTime.Trim() == "" && EndDateTime.Trim() != "" ) { StrValue = " " + ConnectWord + " " + StrName + " = '" + Convert.ToDateTime(SDateTime.Now.Year + Convert.ToDateTime(EndDateTime).ToString("-MM-dd")).ToString("yyyy-MM-dd HH:mm:ss") + "'"; } return StrValue; } /// /// 获取sql查询条件 /// /// 当前要添加的where条件 /// 已经组串好的SQL查询条件语句 /// public static void GetSQLWhere( string StrWhere, ref string StrSQLWhere ) { if ( !string.IsNullOrEmpty(StrSQLWhere) ) { StrSQLWhere += " And " + StrWhere; } else { StrSQLWhere += StrWhere; } } #endregion #region 获取查询条件 /// /// 获取版本查询sql /// /// 写真 /// 婚纱 /// 儿童 /// 服务 /// 婚庆 /// 订单类型串,用逗号分开 /// public static string GetVersionQuerySQL( LYFZ.ComponentLibrary.CheckBoxEx chkPortraitVersion, LYFZ.ComponentLibrary.CheckBoxEx chkDressVersion, LYFZ.ComponentLibrary.CheckBoxEx chkKidsVersion, LYFZ.ComponentLibrary.CheckBoxEx chkServiceVersion = null, LYFZ.ComponentLibrary.CheckBoxEx chkWeddingCelebration = null, string StrOrdType = "" ) { string StrWhere = ""; bool IsPortrait = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsEnablePhotoEdition; if ( chkDressVersion.Checked ) { StrWhere += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.婚纱订单) + "'"; } else if ( chkKidsVersion.Checked ) { StrWhere += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.儿童订单) + "'"; } else if ( chkPortraitVersion.Checked ) { StrWhere += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.写真订单) + "'"; } else if ( chkWeddingCelebration != null && chkWeddingCelebration.Checked ) { StrWhere += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.婚庆订单) + "'"; } else if ( chkServiceVersion != null && chkServiceVersion.Checked ) { StrWhere += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.服务订单) + "'"; } else if ( !string.IsNullOrEmpty(StrOrdType) ) { string[] StrSpilt = StrOrdType.Split(','); StrWhere = " And Ord_Type in ("; for ( int i = 0; i < StrSpilt.Length; i++ ) { StrWhere += "'" + StrSpilt[i].Trim() + "',"; } StrWhere = StrWhere.TrimEnd(',') + ")"; } return StrWhere; } /// /// 获取门市流程文本框搜索的条件获取查询条件语句 /// /// /// public static string GetQueryTextQueryCondition( string StrText ) { string StrWhere = ""; if ( !string.IsNullOrEmpty(StrText.Trim()) ) { StrText = StrText.Trim().ToLower(); if ( LYFZ.Command.Command_Validate.IsChinese(StrText.Replace("/", "")) ) { StrWhere = " And Cus_Name like '%" + StrText.Trim() + "%'"; } else if ( LYFZ.Command.Command_Validate.IsNumber(StrText) ) { if ( LYFZ.MY_LocalSettings.MyLocalSettings.Ordernumbersearch ) { StrWhere = " And (Ord_SinceOrderNumber like '%" + StrText.Trim() + "%' or Cus_Telephone like '%" + StrText.Trim() + "%')"; } else { StrWhere += " And Cus_Telephone like '%" + StrText.Trim() + "%'"; } } else if ( LYFZ.Command.Command_Validate.IsEnglish(StrText.Replace("/", "")) ) { StrWhere = " And Cus_Name_py like '%" + StrText.Trim() + "%'"; } else if ( LYFZ.Command.Command_Validate.IsOrderNumber(StrText) ) { StrWhere = " And Ord_SinceOrderNumber like '" + StrText.Trim() + "%'"; } } return StrWhere; } /// /// 获取菜单树所选择的节点及下级所有节点 /// /// /// public static void GetTreeViewQueryCondition( ref string StrWhere, LYFZ.ComponentLibrary.ComboBoxTreeViewEx treev, string StrFieldName, string ConnectWord = "And" ) { if ( treev.Nodes.Count > 0 ) { if ( treev.SelectedNode != null ) { string classString = "'" + treev.SelectedNode.Tag.ToString().Trim() + "'"; for ( int i = 0; i < treev.SelectedNode.Nodes.Count; i++ ) { if ( treev.SelectedNode.Nodes[i].Nodes.Count > 0 ) { GrtTreeViewNodesCondition(treev.Nodes[i], ref classString); } else { classString += ",'" + treev.SelectedNode.Nodes[i].Tag.ToString().Trim() + "'"; } } if ( classString.Trim().Length > 0 ) { StrWhere += " " + ConnectWord + " " + StrFieldName + " in(" + classString + ")"; } } } } /// /// /// /// /// static void GrtTreeViewNodesCondition( TreeNode root, ref string StrWhere ) { for ( int i = 0; i < root.Nodes.Count; i++ ) { if ( root.Nodes[i].Nodes.Count > 0 ) { GrtTreeViewNodesCondition(root.Nodes[i], ref StrWhere); } else { StrWhere += ",'" + root.Nodes[i].Tag.ToString().Trim() + "'"; } } } /// /// 获取选中的下拉员工树员工,以模糊查询做为条件 /// /// /// /// /// public static void GetTreeViewSelectPersonTagQueryConditionLike( LYFZ.ComponentLibrary.ComboBoxTreeViewEx treev, ref string StrWhere, string StrFieldName, string ConnectWord = "And" ) { if ( treev.Tag != null ) { if ( treev.StrGetName.Trim() == "User" ) { StrWhere = ConnectWord + " (" + StrFieldName + " like '%" + treev.Tag.ToString().Trim() + "%')"; } else if ( treev.StrGetName.Trim() == "Department" ) { for ( int i = 0; i < treev.SelectedNode.Nodes.Count; i++ ) { StrWhere += " " + StrFieldName + " like '%" + treev.SelectedNode.Nodes[i].Tag.ToString().Trim() + "%' or"; } if ( !string.IsNullOrEmpty(StrWhere) ) { StrWhere = ConnectWord + " (" + StrWhere.TrimEnd('r').TrimEnd('o') + ")"; } } else if ( treev.StrGetName.Trim() == "StoreName" ) { for ( int i = 0; i < treev.SelectedNode.Nodes.Count; i++ ) { if ( treev.SelectedNode.Nodes[i].Name.Trim() == "Department" && treev.SelectedNode.Nodes[i].Nodes.Count > 0 ) { for ( int j = 0; j < treev.SelectedNode.Nodes[i].Nodes.Count; j++ ) { StrWhere += " " + StrFieldName + " like '%" + treev.SelectedNode.Nodes[i].Nodes[j].Tag.ToString().Trim() + "%' or"; } } } if ( !string.IsNullOrEmpty(StrWhere) ) { StrWhere = ConnectWord + " (" + StrWhere.TrimEnd('r').TrimEnd('o') + ")"; } } } } /// /// 获取选中的下拉员工树员工,以in ('','')查询做为条件 /// /// /// /// /// public static void GetTreeViewSelectPersonTagQueryConditionEqual( LYFZ.ComponentLibrary.ComboBoxTreeViewEx treev, ref string StrWhere, string StrFieldName, string ConnectWord = "And" ) { string StrOrdersPerson = ""; if ( treev.Tag != null ) { if ( treev.StrGetName.Trim() == "User" ) { StrWhere = ConnectWord + " " + StrFieldName + " = '" + treev.Tag.ToString().Trim() + "'"; } else if ( treev.StrGetName.Trim() == "Department" ) { for ( int i = 0; i < treev.SelectedNode.Nodes.Count; i++ ) { StrOrdersPerson += "'" + treev.SelectedNode.Nodes[i].Tag.ToString().Trim() + "',"; } if ( !string.IsNullOrEmpty(StrOrdersPerson) ) { StrWhere = ConnectWord + " " + StrFieldName + " in (" + StrOrdersPerson.TrimEnd(',') + ")"; } } else if ( treev.StrGetName.Trim() == "StoreName" ) { for ( int i = 0; i < treev.SelectedNode.Nodes.Count; i++ ) { if ( treev.SelectedNode.Nodes[i].Name.Trim() == "Department" && treev.SelectedNode.Nodes[i].Nodes.Count > 0 ) { for ( int j = 0; j < treev.SelectedNode.Nodes[i].Nodes.Count; j++ ) { StrOrdersPerson += "'" + treev.SelectedNode.Nodes[i].Nodes[j].Tag.ToString().Trim() + "',"; } } } if ( !string.IsNullOrEmpty(StrOrdersPerson) ) { StrWhere = ConnectWord + " " + StrFieldName + " in (" + StrOrdersPerson.TrimEnd(',') + ")"; } } } } #endregion #region 根据数据库的User_EmployeeID 获取User_Name /// /// 根据数据库的User_EmployeeID 获取User_Name /// /// 员工编号 /// public static string GetUserName( object User_EmployeeID ) { try { if ( !string.IsNullOrEmpty(User_EmployeeID.ToString()) ) { DataRow dtRow = LYFZ.DAL.DAL_ErpUser.SimpleUserDataTable.Rows.Find(User_EmployeeID); if ( dtRow != null ) { return dtRow["User_Name"].ToString().Trim(); } } } catch { } return ""; } #endregion #region ModelLog /// /// 获取写日志对象 /// /// 日志类类 /// 日志内容 /// 用户ID /// 用户名 /// ip 可以为空 /// public static LYFZ.Model.Model_ErpACVBSYS GetModelLog( string SysType, string StrContent, string StrContentDetails = "", object strTime = null ) { if ( strTime == null ) { strTime = SDateTime.Now.ToString(); } LYFZ.Model.Model_ErpACVBSYS modelsys = new Model.Model_ErpACVBSYS(); modelsys.ACVBSYS002 = EncryptDES(SysType.ToString()); modelsys.ACVBSYS003 = EncryptDES(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Name); modelsys.ACVBSYS004 = EncryptDES(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID); modelsys.ACVBSYS005 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.User_IP;// EncryptDES(GetCurrentHostIP()); modelsys.ACVBSYS006 = EncryptDES(StrContent); modelsys.ACVBSYS007 = EncryptDES(LYFZ.Command.Command_Validate.DateTimeToString(strTime, "yyyy-MM-dd HH:mm:ss")); modelsys.ACVBSYS008 = EncryptDES(StrContentDetails); return modelsys; } static string GetCurrentHostIP() { System.Net.IPHostEntry ipe = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()); return ipe.HostName.ToString().Trim() + " " + ipe.AddressList[3].ToString().Trim(); } private static byte[] DesKeys = { 0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF };//默认密钥向量 /// /// 给外部调用的DES算法加密。 /// public static string EncryptDES( string decryptString ) { return EncryptDES(decryptString, "cust-stu"); } /// /// DES加密字符串 /// /// 待加密的字符串 /// 加密密钥,要求为8位 /// 加密成功返回加密后的字符串,失败返回源串 private static string EncryptDES( string encryptString, string encryptKey ) { try { byte[] rgbKey = Encoding.UTF8.GetBytes(encryptKey.Substring(0, 8)); byte[] rgbIV = DesKeys; byte[] inputByteArray = Encoding.UTF8.GetBytes(encryptString); System.Security.Cryptography.DESCryptoServiceProvider dCSP = new System.Security.Cryptography.DESCryptoServiceProvider(); MemoryStream mStream = new MemoryStream(); System.Security.Cryptography.CryptoStream cStream = new System.Security.Cryptography.CryptoStream(mStream, dCSP.CreateEncryptor(rgbKey, rgbIV), System.Security.Cryptography.CryptoStreamMode.Write); cStream.Write(inputByteArray, 0, inputByteArray.Length); cStream.FlushFinalBlock(); return Convert.ToBase64String(mStream.ToArray()); } catch { return encryptString; } } #endregion #region 集团 /// /// 绑定集团名称(像用于门市流程) /// /// 控件 /// 菜单组编号 /// 当前窗体编号 /// 默认值 /// 是否显示'全部' public static void BindStoreNameALL( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrDefaultStoreText = "", bool IsShowAllText = true ) { cmbtreev.Nodes.Clear(); DataTable dt = orbll.GetView_Custom("tb_ErpCompanyInfo", StrWhere: "", ShowColumnName: "ID,Company_DividedShop,Company_Name").Tables[0]; TreeNode node; if ( IsShowAllText ) { if ( dt.Rows.Count > 1 ) { node = new TreeNode(); node.Text = "全部"; node.Tag = ""; node.Name = "0"; cmbtreev.Nodes.Add(node); } } for ( int i = 0; i < dt.Rows.Count; i++ ) { node = new TreeNode(); node.Text = dt.Rows[i]["Company_Name"].ToString().Trim(); node.Tag = dt.Rows[i]["Company_DividedShop"].ToString().Trim(); node.Name = dt.Rows[i]["ID"].ToString().Trim(); cmbtreev.Nodes.Add(node); } if ( !string.IsNullOrEmpty(StrDefaultStoreText) ) { if ( cmbtreev.GetNodeItem_TextToTag(StrDefaultStoreText) != null ) { cmbtreev.TextFindTag(StrDefaultStoreText); } } if ( string.IsNullOrEmpty(cmbtreev.Text.Trim()) ) { DataRow[] dtRow = dt.Select("Company_DividedShop = '" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.CurrentCompanyInfoID + "'"); if ( dtRow.Length > 0 ) { cmbtreev.TagFindText(dtRow[0]["Company_DividedShop"]); } else { cmbtreev.TagFindText(dt.Rows[0]["Company_DividedShop"]); } } } /// /// 绑定集团名称(像用于门市流程) /// /// 控件 /// 菜单组编号 /// 当前窗体编号 /// 默认值 /// 是否显示'全部' public static void BindGroupStoreName( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrGroupKeyCode = "", string StrKeyCode = "", string StrDefaultStoreText = "", bool IsShowAllText = true,bool bhidelocalData=false,bool bHideMainOpenForm=true ) { cmbtreev.Nodes.Clear(); if ( string.IsNullOrEmpty(StrGroupKeyCode) ) { StrGroupKeyCode = LYFZ.Model.Model_UserRights.GetQuickToolsPet(); } List mlist = LYFZ.BLL.BLL_ErpUser.GetGroupRights(StrGroupKeyCode, StrKeyCode); string StrWhere = ""; for ( int i = 0; i < mlist.Count; i++ ) { StrWhere += "'" + mlist[i].Trim() + "',"; } if ( !string.IsNullOrEmpty(StrWhere) ) { StrWhere = "Company_DividedShop in (" + StrWhere.TrimEnd(',') + ")"; } DataTable dt = orbll.GetView_Custom("tb_ErpCompanyInfo", StrWhere: StrWhere, ShowColumnName: "ID,Company_DividedShop,Company_Name").Tables[0]; TreeNode node; if ( IsShowAllText ) { if ( dt.Rows.Count > 1 ) { node = new TreeNode(); node.Text = "全部"; node.Tag = ""; node.Name = "0"; cmbtreev.Nodes.Add(node); } } for ( int i = 0; i < dt.Rows.Count; i++ ) { node = new TreeNode(); node.Text = dt.Rows[i]["Company_Name"].ToString().Trim(); node.Tag = dt.Rows[i]["Company_DividedShop"].ToString().Trim(); node.Name = dt.Rows[i]["ID"].ToString().Trim(); cmbtreev.Nodes.Add(node); } if ( !string.IsNullOrEmpty(StrDefaultStoreText) ) { if ( cmbtreev.GetNodeItem_TextToTag(StrDefaultStoreText) != null ) { cmbtreev.TextFindTag(StrDefaultStoreText); } } if ( string.IsNullOrEmpty(cmbtreev.Text.Trim()) ) { DataRow[] dtRow = dt.Select("Company_DividedShop = '" + LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.CurrentCompanyInfoID + "'"); if ( dtRow.Length > 0 ) { cmbtreev.TagFindText(dtRow[0]["Company_DividedShop"]); } else { cmbtreev.TagFindText(dt.Rows[0]["Company_DividedShop"]); } } if (bHideMainOpenForm) { if (dt.Rows.Count <= 1) { if (!bhidelocalData) { cmbtreev.Parent.Visible = false; } else { cmbtreev.Visible = false; } } } } /// /// /// /// /// /// public static DataTable BindGroupStoreName( string StrKeyCode, string StrGroupKeyCode = "" ) { if ( string.IsNullOrEmpty(StrGroupKeyCode) ) { StrGroupKeyCode = LYFZ.Model.Model_UserRights.GetQuickToolsPet(); } List mlist = LYFZ.BLL.BLL_ErpUser.GetGroupRights(StrGroupKeyCode, StrKeyCode); string StrWhere = ""; for ( int i = 0; i < mlist.Count; i++ ) { StrWhere += "'" + mlist[i].Trim() + "',"; } if ( !string.IsNullOrEmpty(StrWhere) ) { StrWhere = "Company_DividedShop in (" + StrWhere.TrimEnd(',') + ")"; } return orbll.GetView_Custom("tb_ErpCompanyInfo", StrWhere: StrWhere, ShowColumnName: "ID,Company_DividedShop,Company_Name").Tables[0]; } /// /// 集团店面权限 /// /// 集团控件 /// 权限模块名 /// 权限名 /// public static bool GetGroupStoreRights( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string moduleBlock, LYFZ.CustomAttributes.OperatingAuthority operatingAuthority ) { bool IsRights = false; if ( !string.IsNullOrEmpty(cmbtreev.Tag.ToString().Trim()) ) { IsRights = LYFZ.BLL.BLL_ErpUser.GetGroupRights(moduleBlock, operatingAuthority, cmbtreev.Tag.ToString().Trim()); } else { for ( int i = 0; i < cmbtreev.Nodes.Count; i++ ) { if ( !string.IsNullOrEmpty(cmbtreev.Nodes[i].Tag.ToString().Trim()) ) { IsRights = LYFZ.BLL.BLL_ErpUser.GetGroupRights(moduleBlock, operatingAuthority, cmbtreev.Nodes[i].Tag.ToString().Trim()); if ( !IsRights ) { break; } } } } return IsRights; } /// /// 集团查询获取条件信息 /// /// 集团控件 /// /// /// public static string GetGroupQueryWhere( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrFieldName, string ConnectWord = "And" ) { string StrWhere = ""; if ( LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsGroupEdition ) { if ( cmbtreev.Text.Trim() == "全部" ) { string StrSQL = ""; for ( int i = 0; i < cmbtreev.Nodes.Count; i++ ) { if ( cmbtreev.Nodes[i].Text.Trim() != "全部" ) { StrSQL += "'" + cmbtreev.Nodes[i].Tag.ToString().Trim() + "',"; } } if ( !string.IsNullOrEmpty(StrSQL) ) { StrWhere = StrFieldName + " in (" + StrSQL.TrimEnd(',') + ")"; } } else { StrWhere = StrFieldName + " = '" + cmbtreev.Tag.ToString().Trim() + "'"; } if ( !string.IsNullOrEmpty(ConnectWord) ) { StrWhere = " " + ConnectWord + " " + StrWhere; } } else { StrWhere = " " + ConnectWord + " 1 = 1"; } return StrWhere; } /// /// 订单点击查看的分店 /// /// /// /// /// public static string GetGroupQueryOrderClickWhere( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrFieldName, string ConnectWord = "And" ) { string StrWhere = ""; for ( int i = 0; i < cmbtreev.Nodes.Count; i++ ) { if ( !string.IsNullOrEmpty(cmbtreev.Tag.ToString().Trim()) ) { StrWhere += "'" + cmbtreev.Nodes[i].Tag.ToString().Trim() + "',"; } } StrWhere = StrFieldName + " in (" + StrWhere.TrimEnd(',') + ")"; if ( !string.IsNullOrEmpty(ConnectWord) ) { StrWhere = " " + ConnectWord + " " + StrWhere; } return StrWhere; } public static Dictionary GetGroupQueryOrderClickWhereByDataList( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev, string StrFieldName, ref Dictionary dicWhere ) { string StrWhere = ""; TreeNode treeNode = new TreeNode() { Tag = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.CurrentCompanyInfoID }; if ( cmbtreev.Tag != null ) { if ( cmbtreev.Tag.ToString().Trim() == "" ) { for ( int i = 0; i < cmbtreev.Nodes.Count; i++ ) { StrWhere += "'" + cmbtreev.Nodes[i].Tag.ToString().Trim() + "',"; } dicWhere.Add(StrFieldName, " in (" + StrWhere.TrimEnd(',') + ")"); } else { if ( cmbtreev.Tag != null && !string.IsNullOrEmpty(cmbtreev.Tag.ToString().Trim()) ) { StrWhere += "'" + cmbtreev.Tag.ToString().Trim() + "',"; dicWhere.Add(StrFieldName, " in (" + StrWhere.TrimEnd(',') + ")"); } } } else { StrWhere += "'" + treeNode.Tag.ToString().Trim() + "',"; dicWhere.Add(StrFieldName, " in (" + StrWhere.TrimEnd(',') + ")"); } //StrWhere = StrFieldName + " in (" + StrWhere.TrimEnd(',') + ")"; //if (!string.IsNullOrEmpty(ConnectWord)) //{ StrWhere = " " + ConnectWord + " " + StrWhere; } return dicWhere; } #endregion #region 礼服相片 /// /// 获取礼服缩略图 /// /// /// public static Image GetDressImage_Small( string StrPhoto, bool IsShowDefaultPhoto = true ) { Bitmap img = null; if ( !string.IsNullOrEmpty(StrPhoto) ) { try { string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_DressPhoto() + @"\Small\" + System.IO.Path.GetFileNameWithoutExtension(StrPhoto) + ".jpg"; string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, strImgPath); //loadMessage = "加载成功"; } catch ( Exception e ) { //loadMessage = e.Message; } } if ( img == null && IsShowDefaultPhoto ) { img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2; //loadMessage = "未找到图片路径,使用系统默认图片"; } return img; } /// /// 获取礼服缩略图 /// /// /// public static Image GetDressImage_Small( string StrPhoto, ref string loadMessage, bool IsShowDefaultPhoto = true ) { Bitmap img = null; loadMessage = "图片数据为Null"; if ( !string.IsNullOrEmpty(StrPhoto) ) { try { string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_DressPhoto() + @"\Small\" + System.IO.Path.GetFileNameWithoutExtension(StrPhoto) + ".jpg"; string tempFlePath = LYFZ.WinAPI.CustomPublicMethod.GetFullDirectoryPath(LYFZ.WinAPI.CustomPublicMethod.BasePath) + strImgPath.Substring(1); if ( File.Exists(tempFlePath) ) { img = new Bitmap(Image.FromFile(tempFlePath)); } else { string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, strImgPath); } loadMessage = "加载成功"; } catch ( Exception e ) { loadMessage = e.Message; } } if ( img == null && IsShowDefaultPhoto ) { img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2; loadMessage = "未找到图片路径,使用系统默认图片"; } return img; } /// /// 获取礼服原图 /// /// /// public static Image GetDressImage_Original( string StrPhoto, bool IsShowDefaultPhoto = true ) { Bitmap img = null; if ( !string.IsNullOrEmpty(StrPhoto) ) { try { string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_DressPhoto() + @"\" + StrPhoto; if ( string.IsNullOrEmpty(System.IO.Path.GetExtension(StrPhoto)) ) { strImgPath += ".jpg"; } string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, strImgPath); } catch { } } if ( img == null && IsShowDefaultPhoto ) { img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2; } return img; } /// /// 上传礼服相片 /// /// 选择的相片路径 /// 礼服的编号 /// 是否递归上传失败的相片 /// 上传类型 0:上传缩略图 1:上传原图 /// public static bool UpdateDressPhoto( string StrSelectPath, string StrDressNumber, bool IsRecursion = false, int UpdateDressType = 0 ) { string[] StrArray = StrSelectPath.Trim().Split('|'); string StrParentPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_DressPhoto(); if ( UpdateDressType == 0 ) { string StrPhotoName = StrDressNumber + "_" + System.IO.Path.GetFileNameWithoutExtension(StrArray[0].Trim()) + ".jpg"; Bitmap SmallMap = LYFZ.BLL.SelectPhotoHandling.GeneratePreviewBitmap(StrArray[0].Trim(), 100, 100); StrParentPath += @"\Small\" + StrPhotoName; string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.UploadFileToServer(SmallMap, System.Drawing.Imaging.ImageFormat.Jpeg, StrParentPath, backgroundWorker: null); if ( ret.IndexOf("成功") == -1 ) { if ( !IsRecursion ) { return UpdateDressPhoto(StrSelectPath, StrDressNumber, IsRecursion); } else { return false; } } else { return true; } } else { string StrPhotoName = StrDressNumber + "_" + System.IO.Path.GetFileName(StrArray[0].Trim()); Bitmap OriginalMap = null; if ( System.IO.Path.GetExtension(StrArray[0].Trim()) == ".gif" ) { OriginalMap = new Bitmap(Image.FromStream(new MemoryStream(System.IO.File.ReadAllBytes(StrArray[0].Trim())))); } else { OriginalMap = LYFZ.BLL.SelectPhotoHandling.GeneratePreviewBitmap(StrArray[0].Trim(), 1080, 720); } StrParentPath += @"\" + StrPhotoName; string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.UploadFileToServer(OriginalMap, System.Drawing.Imaging.ImageFormat.Jpeg, StrParentPath, backgroundWorker: null); if ( ret.IndexOf("成功") == -1 ) { if ( !IsRecursion ) { return UpdateDressPhoto(StrSelectPath, StrDressNumber, IsRecursion); } else { return false; } } else { return true; } } } /// /// 删除礼服相片 /// /// /// /// public static bool DeleteDressPhoto( string StrSelectPath, bool IsRecursion = false, int DeleteDressType = 0 ) { string StrParentPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_DressPhoto(); if ( DeleteDressType == 0 ) { StrParentPath += @"\Small\" + StrSelectPath; string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DeleteFile(StrParentPath, backgroundWorker: null); if ( ret.IndexOf("成功") == -1 ) { if ( !IsRecursion ) { return DeleteDressPhoto(StrSelectPath, IsRecursion, DeleteDressType: 0); } else { return false; } } else { return true; } } else { StrParentPath += @"\" + StrSelectPath; string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DeleteFile(StrParentPath, backgroundWorker: null); if ( ret.IndexOf("成功") == -1 ) { if ( !IsRecursion ) { return DeleteDressPhoto(StrSelectPath, IsRecursion, DeleteDressType: 1); } else { return false; } } else { return true; } } } #endregion #region 其他消费相片 /// /// 获取其他消费缩略图 /// /// /// public static Image GetOtherConsumeImage_Small( string StrPhoto, bool IsShowDefaultPhoto = true ) { Bitmap img = null; if ( !string.IsNullOrEmpty(StrPhoto) ) { try { string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_OtherConsumePhoto() + @"\Small\" + System.IO.Path.GetFileNameWithoutExtension(StrPhoto) + ".jpg"; string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, strImgPath); } catch { } } if ( img == null && IsShowDefaultPhoto ) { img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2; } return img; } /// /// 获取其他消费原图 /// /// /// public static Image GetOtherConsumeImage_Original( string StrPhoto, bool IsShowDefaultPhoto = true ) { Bitmap img = null; if ( !string.IsNullOrEmpty(StrPhoto) ) { try { string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_OtherConsumePhoto() + @"\" + StrPhoto; if ( string.IsNullOrEmpty(System.IO.Path.GetExtension(StrPhoto)) ) { strImgPath += ".jpg"; } string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, strImgPath); } catch { } } if ( img == null && IsShowDefaultPhoto ) { img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2; } return img; } /// /// 上传其他消费相片 /// /// 选择的相片路径 /// 其他消费的编号 /// 是否递归上传失败的相片 /// 上传类型 0:上传缩略图 1:上传原图 /// public static bool UpdateOtherConsumePhoto( string StrSelectPath, string StrOtherOrderNumber, bool IsRecursion = false, int UpdateDressType = 0 ) { string[] StrArray = StrSelectPath.Trim().Split('|'); string StrParentPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_OtherConsumePhoto(); if ( UpdateDressType == 0 ) { string StrPhotoName = StrOtherOrderNumber + "_" + System.IO.Path.GetFileNameWithoutExtension(StrArray[0].Trim()) + ".jpg"; Bitmap SmallMap = LYFZ.BLL.SelectPhotoHandling.GeneratePreviewBitmap(StrArray[0].Trim(), 100, 100); StrParentPath += @"\Small\" + StrPhotoName; string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.UploadFileToServer(SmallMap, System.Drawing.Imaging.ImageFormat.Jpeg, StrParentPath, backgroundWorker: null); if ( ret.IndexOf("成功") == -1 ) { if ( !IsRecursion ) { return UpdateOtherConsumePhoto(StrSelectPath, StrOtherOrderNumber, IsRecursion); } else { return false; } } else { return true; } } else { string StrPhotoName = StrOtherOrderNumber + "_" + System.IO.Path.GetFileName(StrArray[0].Trim()); StrParentPath += @"\" + StrPhotoName; string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.UploadFileToServer(StrArray[0].Trim(), StrParentPath, backgroundWorker: null); if ( ret.IndexOf("成功") == -1 ) { if ( !IsRecursion ) { return UpdateOtherConsumePhoto(StrSelectPath, StrOtherOrderNumber, IsRecursion); } else { return false; } } else { return true; } } } /// /// 删除其他消费相片 /// /// /// /// public static bool DeleteOtherConsumePhoto( string StrSelectPath, bool IsRecursion = false, int DeleteDressType = 0 ) { string StrParentPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_OtherConsumePhoto(); if ( DeleteDressType == 0 ) { StrParentPath += @"\Small\" + StrSelectPath; string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DeleteFile(StrParentPath, backgroundWorker: null); if ( ret.IndexOf("成功") == -1 ) { if ( !IsRecursion ) { return DeleteOtherConsumePhoto(StrSelectPath, IsRecursion, DeleteDressType: 0); } else { return false; } } else { return true; } } else { StrParentPath += @"\" + StrSelectPath; string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DeleteFile(StrParentPath, backgroundWorker: null); if ( ret.IndexOf("成功") == -1 ) { if ( !IsRecursion ) { return DeleteOtherConsumePhoto(StrSelectPath, IsRecursion, DeleteDressType: 1); } else { return false; } } else { return true; } } } #endregion #region 医院跟踪 static string StrReminderSettingsArray = "预产期:1,客户生日:2,婚庆日期:3,结婚纪念日:4"; /// /// 系统自动提醒设置 /// /// /// public static string ReminderSettings( string objValue ) { string StrReturn = "满"; string[] StrArray = StrReminderSettingsArray.Split(','); for ( int i = 0; i < StrArray.Length; i++ ) { string[] StrArray2 = StrArray[i].Trim().Split(':'); if ( objValue.Trim() == StrArray2[0].Trim() ) { StrReturn = "前"; break; } if ( objValue.Trim().IndexOf(StrArray2[0].Trim()) != -1 ) { StrReturn = "前"; break; } } return StrReturn; } /// /// 系统自动提醒设置 /// /// /// public static string ReminderSettings( int objValue ) { string StrReturn = "满"; string[] StrArray = StrReminderSettingsArray.Split(','); for ( int i = 0; i < StrArray.Length; i++ ) { string[] StrArray2 = StrArray[i].Trim().Split(':'); if ( objValue == Convert.ToInt32(StrArray2[1].Trim()) ) { StrReturn = "前"; break; } } return StrReturn; } /// /// 获取医院跟踪缩略图 /// /// /// public static Image GetHospitalImage_Small( string StrOrdNumber, string StrPhotoPath, bool IsShowDefaultPhoto = true ) { Bitmap img = null; if ( !string.IsNullOrEmpty(StrPhotoPath) ) { try { string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_OtherConsumePhoto() + "\\" + StrOrdNumber + @"\Small\" + System.IO.Path.GetFileNameWithoutExtension(StrPhotoPath) + ".jpg"; string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, StrPhotoPath); } catch { } } if ( img == null && IsShowDefaultPhoto ) { img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2; } return img; } /// /// 获取医院跟踪缩略图 /// /// /// public static void GetHospitalImage_Small( LYFZ.ComponentLibrary.ListViewEx listViewData, ImageList mlistImagePhoto, string StrOrdNumber, bool IsShowDefaultPhoto = true ) { listViewData.Items.Clear(); if ( !string.IsNullOrEmpty(StrOrdNumber) ) { try { string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_HospitalPhoto() + @"\" + StrOrdNumber + @"\Small\"; List StrList = new List(); string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.GetDirectoryFileList(out StrList, strImgPath); for ( int i = 0; i < StrList.Count; i++ ) { Bitmap img = null; retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, StrList[i].Trim()); if ( img == null && IsShowDefaultPhoto ) { img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2; } ListViewItem lvi = new ListViewItem(); lvi.ImageKey = StrList[i].Trim(); lvi.Text = System.IO.Path.GetFileNameWithoutExtension(StrList[i].Trim()); lvi.Tag = StrList[i].Trim(); lvi.ToolTipText = lvi.Text; if ( !mlistImagePhoto.Images.Keys.Contains(StrList[i].Trim()) ) { mlistImagePhoto.Images.Add(StrList[i].Trim(), img); } listViewData.Items.Add(lvi); } } catch { } } } /// /// 获取医院跟踪原图 /// /// /// public static Image GetHospitalImage_Original( string StrOrdNumber, string StrPhoto, bool IsShowDefaultPhoto = true ) { Bitmap img = null; if ( !string.IsNullOrEmpty(StrPhoto) ) { try { string strImgPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_HospitalPhoto() + "\\" + StrOrdNumber + @"\" + StrPhoto; string retmsg2 = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DownloadBitmap(ref img, strImgPath); } catch { } } if ( img == null && IsShowDefaultPhoto ) { img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2; } return img; } /// /// 上传医院跟踪相片 /// /// 选择的相片路径 /// 其他消费的编号 /// 是否递归上传失败的相片 /// 上传类型 0:上传缩略图 1:上传原图 /// public static bool UpdateHospitalPhoto( string StrSelectPath, string StrOrderNumber, bool IsRecursion = false, int UpdateDressType = 0 ) { string[] StrArray = StrSelectPath.Trim().Split('|'); string StrParentPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_HospitalPhoto() + @"\" + StrOrderNumber; if ( UpdateDressType == 0 ) { string StrParentPath_Small = StrParentPath + @"\Small\" + System.IO.Path.GetFileNameWithoutExtension(StrArray[0].Trim()) + ".jpg"; Bitmap SmallMap = LYFZ.BLL.SelectPhotoHandling.GeneratePreviewBitmap(StrArray[0].Trim(), 100, 100); string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.UploadFileToServer(SmallMap, System.Drawing.Imaging.ImageFormat.Jpeg, StrParentPath_Small, backgroundWorker: null); if ( ret.IndexOf("成功") == -1 ) { if ( !IsRecursion ) { return UpdateHospitalPhoto(StrSelectPath, StrOrderNumber, IsRecursion); } else { return false; } } else { return true; } } else { string StrParentPath_Original = StrParentPath + @"\" + System.IO.Path.GetFileName(StrArray[0].Trim()); string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.UploadFileToServer(StrArray[0].Trim(), StrParentPath_Original, backgroundWorker: null); if ( ret.IndexOf("成功") == -1 ) { if ( !IsRecursion ) { return UpdateHospitalPhoto(StrSelectPath, StrOrderNumber, IsRecursion); } else { return false; } } else { return true; } } } /// /// 删除其他消费相片 /// /// /// /// public static bool DeleteHospitalPhoto( string StrSelectPath, string StrOrdNumber, bool IsRecursion = false, int DeleteDressType = 0 ) { string StrParentPath = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TCP_HospitalPhoto(); if ( DeleteDressType == 0 ) { StrParentPath += "\\" + StrOrdNumber + @"\Small\" + StrSelectPath; string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DeleteFile(StrParentPath, backgroundWorker: null); if ( ret.IndexOf("成功") == -1 ) { if ( !IsRecursion ) { return DeleteHospitalPhoto(StrSelectPath, StrOrdNumber, IsRecursion, DeleteDressType: 0); } else { return false; } } else { return true; } } else { StrParentPath += "\\" + StrOrdNumber + @"\" + StrSelectPath; string ret = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.TcpClient.DeleteFile(StrParentPath, backgroundWorker: null); if ( ret.IndexOf("成功") == -1 ) { if ( !IsRecursion ) { return DeleteHospitalPhoto(StrSelectPath, StrOrdNumber, IsRecursion, DeleteDressType: 1); } else { return false; } } else { return true; } } } #endregion #region 图片处理 /// /// 获取产品图片 /// /// /// public static Image GetProductImage( string StrPhoto ) { Bitmap img = null; if ( !string.IsNullOrEmpty(StrPhoto) ) { try { img = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetImage(LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.StringToByte(StrPhoto)); } catch { } } if ( img == null ) { img = LYFZ.PhotoSelectSystem.ResourcesJPGE2.RJPGE2; } return img; } /// /// 下载图片 /// /// 控件 /// 要保存的名字 public static void DownloadLog( LYFZ.ComponentLibrary.PictureBoxEx pict, string StrName ) { if ( pict.Image != null ) { DownloadLog(pict.Image, StrName + ".jpg"); //string dir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); //Bitmap bmp = new Bitmap(pict.Image); //bmp.Save(dir + "\\" + StrName + ".jpg"); //MessageBoxCustom.Show("下载成功!\r\n下载储存于桌面"); } else { MessageBoxCustom.Show("图片未上传!"); } } /// /// 下载图片 /// /// 图片 /// 图片名 public static void DownloadLog( Image Img, string StrName, bool IsShowPromptOK = true ) { if ( Img != null ) { string dir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); Bitmap bmp = new Bitmap(Img); LYFZ.ImageFunction.ThumbImgae.SaveIamge(Img, 90, dir + "\\" + StrName); if ( IsShowPromptOK ) { MessageBoxCustom.Show("下载成功!\r\n下载储存于桌面"); } } else { MessageBoxCustom.Show("图片不存在!"); } } /// /// 下载图片 /// /// 图片 /// 图片名 public static void DownloadToDirectory( Image Img, string StrPath, bool IsShowPromptOK = true ) { if ( Img != null ) { LYFZ.ImageFunction.ThumbImgae.SaveIamge(Img, 90, StrPath); if ( IsShowPromptOK ) { MessageBoxCustom.Show("下载成功!下载储存于:\r\n" + System.IO.Path.GetDirectoryName(StrPath)); } } else { MessageBoxCustom.Show("图片不存在!"); } } /// /// 图片另存为 /// public static void DownloadSaveAs( Image Img, string StrFilleName = "", bool IsShowPromptOK = true ) { if ( Img != null ) { SaveFileDialog saveFileDialog1 = new SaveFileDialog(); saveFileDialog1.InitialDirectory = @"C:\Users\e_teng\Desktop\"; saveFileDialog1.Filter = "*.jpg,*.jpeg,*.bmp,*.gif,*.ico,*.png,*.tif,*.wmf|*.jpg;*.jpeg;*.bmp;*.gif;*.ico;*.png;*.tif;*.wmf"; saveFileDialog1.Title = "保存图像"; saveFileDialog1.FileName = StrFilleName; if ( saveFileDialog1.ShowDialog() == DialogResult.OK ) { string StrPath = saveFileDialog1.FileName; string QStrPath = StrPath.Substring(0, StrPath.IndexOf('.'));//后缀 string HstrPath = StrPath.Substring(StrPath.IndexOf('.'), StrPath.Length - (StrPath.IndexOf('.'))); string StrPathNow = QStrPath; Img.Save(StrPathNow + HstrPath); if ( IsShowPromptOK ) { MessageBoxCustom.Show("保存为完毕"); } } } } #endregion #region 礼服处理 /// /// 礼服是否撞期 /// public static string IsDressClashDateTime( LYFZ.ComponentLibrary.ListViewEx listViewData, DateTime TakeDressTime ) { Hashtable htData = new Hashtable(); for ( int i = 0; i < listViewData.Items.Count; i++ ) { LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel columnModel = (Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel)listViewData.Items[i].Tag; htData[columnModel] = listViewData.Items[i].SubItems["礼服名称"].Text.Trim(); } return IsDressClashDateTime(htData, TakeDressTime); } /// /// 礼服是否撞期 /// /// /// /// public static string IsDressClashDateTime( Hashtable htData, DateTime TakeDressTime ) { string StrDressClash = ""; DataTable dtSaleRental = orbll.GetView_Custom("tb_ErpDressSaleRentalDetail Left Join tb_ErpDressSaleRentalOrder on Dsrd_Number = Dsro_Number", StrWhere: "Dsro_Type='0' and Dsrd_BackStatus='3' And Dsrd_TakeDressTime is not null", ShowColumnName: "Dsrd_DressNumber,DateAdd(d, -CONVERT(int,dbo.fn_GetAlsoClothesDays('AlsoClothesDay')),Dsro_TakeDressTime) as '还衣天数取衣日期',DateAdd(d, CONVERT(int,dbo.fn_GetAlsoClothesDays('AlsoClothesDay')),Dsro_ReservationBackTime) as '还衣天数加还衣日期'", GroupBy: "Dsrd_DressNumber,Dsro_TakeDressTime,Dsro_ReservationBackTime").Tables[0]; foreach ( DictionaryEntry item in htData ) { LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel columnModel = (Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel)item.Key; bool IsFind = true; if ( columnModel.ID > 0 ) { DataTable dt = orbll.GetView_Custom("tb_ErpDressSaleRentalDetail", StrWhere: "ID = '" + columnModel.ID + "'", ShowColumnName: "Dsrd_TakeDressTime").Tables[0]; if ( dt.Rows.Count > 0 ) { if ( !string.IsNullOrEmpty(LYFZ.Command.Command_Validate.DateTimeToString(dt.Rows[0]["Dsrd_TakeDressTime"].ToString().Trim())) ) { IsFind = false; } } } if ( IsFind ) { DataRow[] row_DSRD = dtSaleRental.Select("Dsrd_DressNumber = '" + columnModel.StrDressNumber.Trim() + "' "); if ( row_DSRD.Length > 0 ) { bool isFind = false; for ( int t = 0; t < row_DSRD.Length; t++ ) { if ( TakeDressTime >= Convert.ToDateTime(row_DSRD[t]["还衣天数取衣日期"]) && TakeDressTime <= Convert.ToDateTime(row_DSRD[t]["还衣天数加还衣日期"]) ) { isFind = true; } } if ( isFind ) { StrDressClash += "礼服编号:" + columnModel.StrDressNumber.Trim() + " " + " 礼服名称:" + item.Value.ToString().Trim() + "\r\n"; } } } } if ( string.IsNullOrEmpty(StrDressClash) ) { DataTable dtSendWash = orbll.GetView_Custom("tb_ErpDressSendWashOrder Left Join tb_ErpDressSendWashDetail on Dswd_Number = Dswo_Number", StrWhere: "Dswd_BackStatus='3'", ShowColumnName: "Dswd_DressNumber,DateAdd(d, -CONVERT(int,dbo.fn_GetAlsoClothesDays('AlsoClothesDay')),Dswo_SendWashTime) as '还衣天数取衣日期',DateAdd(d, CONVERT(int,dbo.fn_GetAlsoClothesDays('AlsoClothesDay')),Dswo_ReservationBackTime) as '还衣天数加还衣日期'", GroupBy: "Dswd_DressNumber,Dswo_SendWashTime,Dswo_ReservationBackTime").Tables[0]; foreach ( DictionaryEntry item in htData ) { LYFZ.Software.MainBusiness.Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel columnModel = (Dresses.SetSmallForm.DressOpenOrderRentSaleFormMain_ColumnHeaderModel)item.Key; DataRow[] row_DSRD = dtSendWash.Select("Dswd_DressNumber = '" + columnModel.StrDressNumber.Trim() + "' "); if ( row_DSRD.Length > 0 ) { bool isFind = false; for ( int t = 0; t < row_DSRD.Length; t++ ) { if ( TakeDressTime >= Convert.ToDateTime(row_DSRD[t]["还衣天数取衣日期"]) && TakeDressTime <= Convert.ToDateTime(row_DSRD[t]["还衣天数加还衣日期"]) ) { isFind = true; } } if ( isFind ) { StrDressClash += "礼服编号:" + columnModel.StrDressNumber.Trim() + " " + " 礼服名称:" + item.Value.ToString().Trim() + "\r\n"; } } } } if ( !string.IsNullOrEmpty(StrDressClash) ) { StrDressClash += "已经撞期,无法租售!"; } return StrDressClash; } #endregion #region 客服任务 /// /// 获取任务事项 /// /// public static string GetTaskItem() { string[] StrEnumArray = Enum.GetNames(typeof(LYFZ.EnumPublic.ClientServiceTaskType)); return string.Join(",", StrEnumArray).Replace(LYFZ.EnumPublic.ClientServiceTaskType.无分类.ToString(), "").Trim(','); } /// /// 获取任务事项的具体事项 /// /// 任务事项 /// public static string GetTaskItemSelect( string StrItem ) { List StrList = new List(); switch ( (LYFZ.EnumPublic.ClientServiceTaskType)Enum.Parse(typeof(LYFZ.EnumPublic.ClientServiceTaskType), StrItem.Trim()) ) { case EnumPublic.ClientServiceTaskType.摄控确认: StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.选衣服客人.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.拍照客人.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.选片客人.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.看版客人.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.取件客人.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.服务客人.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.摄控医院客人.ToString()); break; case EnumPublic.ClientServiceTaskType.流程通知: StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.已定未拍.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.已拍未拍完.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.已拍未选.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.已修未选.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.已设计未看.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.部分回件未取.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.全部回件未取.ToString()); break; case EnumPublic.ClientServiceTaskType.沟通助手: StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.结婚客人.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.结婚纪念日.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.客户生日.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.宝贝生日.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.转介绍客户.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.会员积分.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.孕妇周期.ToString()); break; case EnumPublic.ClientServiceTaskType.意向跟踪: StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.意向客户.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.订单意向.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.医院意向.ToString()); break; case EnumPublic.ClientServiceTaskType.满意度回访: StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.接单回访.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.选衣回访.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.拍照回访.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.选片回访.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.看版回访.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.取件回访.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.服务回访.ToString()); StrList.Add(LYFZ.EnumPublic.ClientServiceTaskItem.其它回访.ToString()); break; } if ( StrList.Count > 0 ) { return string.Join(",", StrList).Trim(','); } else { return ""; } } /// /// 安排客服 /// /// /// /// public static void ClientServiceAnPai(LYFZ.ComponentLibrary.DataGridViewEc dgvData, LYFZ.EnumPublic.ClientServiceTaskType EnumTaskModule, LYFZ.Model.ClientServiceTaskAnPaiModel modelClientServiceTask, LYFZ.EnumPublic.ClientServiceTaskItem ClientServiceTaskType ) { string StrWhere = ""; DateTime StrTime = SDateTime.Now; List clist = new List(); LYFZ.BLL.BLL_ErpClientServiceTask cstbll = new BLL.BLL_ErpClientServiceTask(); LYFZ.Model.Model_ErpClientServiceTask modelCst = null; DataTable dtprompt = new DataTable(); DataTable dt = orbll.GetView_Custom("tb_ErpClientServiceTask", StrWhere: "Cst_TaskItem = '" + ClientServiceTaskType.ToString().Trim() + "' And Cst_TaskTermTime = '" + modelClientServiceTask.StrDateTime + "' And Cst_CompletionIntStatus = 0", ShowColumnName: "*").Tables[0]; #region 获取查询条件 switch ( ClientServiceTaskType ) { case EnumPublic.ClientServiceTaskItem.接单回访: case EnumPublic.ClientServiceTaskItem.其它回访: case EnumPublic.ClientServiceTaskItem.订单意向: for ( int i = 0; i < dgvData.SelectedRows.Count; i++ ) { StrWhere += "'" + dgvData.SelectedRows[i].Cells["Ord_Number"].Value.ToString().Trim() + "',"; } if ( StrWhere.Trim().Length > 0 ) { StrWhere = "GP_OrderNumber in (" + StrWhere.TrimEnd(',') + ")"; } break; case EnumPublic.ClientServiceTaskItem.选衣回访: case EnumPublic.ClientServiceTaskItem.拍照回访: case EnumPublic.ClientServiceTaskItem.选片回访: case EnumPublic.ClientServiceTaskItem.看版回访: case EnumPublic.ClientServiceTaskItem.取件回访: case EnumPublic.ClientServiceTaskItem.服务回访: case EnumPublic.ClientServiceTaskItem.已拍未选: case EnumPublic.ClientServiceTaskItem.已修未选: case EnumPublic.ClientServiceTaskItem.已设计未看: case EnumPublic.ClientServiceTaskItem.部分回件未取: case EnumPublic.ClientServiceTaskItem.全部回件未取: case EnumPublic.ClientServiceTaskItem.已定未拍: case EnumPublic.ClientServiceTaskItem.已拍未拍完: case EnumPublic.ClientServiceTaskItem.选衣服客人: case EnumPublic.ClientServiceTaskItem.选片客人: case EnumPublic.ClientServiceTaskItem.看版客人: for ( int i = 0; i < dgvData.SelectedRows.Count; i++ ) { StrWhere += "'" + dgvData.SelectedRows[i].Cells["Ordv_ViceNumber"].Value.ToString().Trim() + "',"; } if ( StrWhere.Trim().Length > 0 ) { StrWhere = "Ords_ViceNumber in (" + StrWhere.TrimEnd(',') + ")"; } break; case EnumPublic.ClientServiceTaskItem.拍照客人: case EnumPublic.ClientServiceTaskItem.取件客人: case EnumPublic.ClientServiceTaskItem.服务客人: Hashtable htData = new Hashtable(); for ( int i = 0; i < dgvData.SelectedRows.Count; i++ ) { htData[dgvData.SelectedRows[i].Cells["Ordv_ViceNumber"].Value.ToString().Trim()] = dgvData.SelectedRows[i].Cells["Ordv_ViceNumber"].Value.ToString().Trim(); } foreach ( string item in htData.Keys ) { StrWhere += "'" + item + "',"; } if ( StrWhere.Trim().Length > 0 ) { StrWhere = "Ords_ViceNumber in (" + StrWhere.TrimEnd(',') + ")"; } break; case EnumPublic.ClientServiceTaskItem.摄控医院客人: for ( int i = 0; i < dgvData.SelectedRows.Count; i++ ) { StrWhere += "'" + dgvData.SelectedRows[i].Cells["ID"].Value.ToString().Trim() + "',"; } if ( StrWhere.Trim().Length > 0 ) { StrWhere = "tb_ErpHospitalDispatchDoor.ID in (" + StrWhere.TrimEnd(',') + ")"; } break; case EnumPublic.ClientServiceTaskItem.意向客户: string StrClientNumber = ""; string StrClientGroupNumber = ""; for ( int i = 0; i < dgvData.SelectedRows.Count; i++ ) { StrClientNumber += "'" + dgvData.SelectedRows[i].Cells["客户编号"].Value.ToString().Trim() + "',"; StrClientGroupNumber += "'" + dgvData.SelectedRows[i].Cells["客户组编号"].Value.ToString().Trim() + "',"; } if ( StrClientNumber.Trim().Length > 0 && StrClientGroupNumber.Trim().Length > 0 ) { StrWhere = "GP_CustomerGroupID in (" + StrClientGroupNumber.TrimEnd(',') + ") And GM_CustomerID in (" + StrClientNumber.TrimEnd(',') + ")"; } break; case EnumPublic.ClientServiceTaskItem.医院意向: case EnumPublic.ClientServiceTaskItem.孕妇周期: for ( int i = 0; i < dgvData.SelectedRows.Count; i++ ) { StrWhere += "'" + dgvData.SelectedRows[i].Cells["来单批号"].Value.ToString().Trim() + "',"; } if ( StrWhere.Trim().Length > 0 ) { StrWhere = "Hct_Oddnumber in (" + StrWhere.TrimEnd(',') + ")"; } break; case EnumPublic.ClientServiceTaskItem.结婚客人: case EnumPublic.ClientServiceTaskItem.结婚纪念日: case EnumPublic.ClientServiceTaskItem.客户生日: case EnumPublic.ClientServiceTaskItem.宝贝生日: case EnumPublic.ClientServiceTaskItem.转介绍客户: case EnumPublic.ClientServiceTaskItem.会员积分: for ( int i = 0; i < dgvData.SelectedRows.Count; i++ ) { StrWhere += "'" + dgvData.SelectedRows[i].Cells["客户编号"].Value.ToString().Trim() + "',"; } if ( StrWhere.Trim().Length > 0 ) { StrWhere = "Cus_CustomerNumber in (" + StrWhere.TrimEnd(',') + ")"; } break; } #endregion #region 获取保存数据 switch ( ClientServiceTaskType ) { case EnumPublic.ClientServiceTaskItem.接单回访: case EnumPublic.ClientServiceTaskItem.其它回访: case EnumPublic.ClientServiceTaskItem.订单意向: #region 按订单分 if ( StrWhere.Trim().Length > 0 ) { DataTable dtClientGroup = orbll.GetView_Custom("tempTB_AggregationCustomer Left Join tb_ErpOrder on Ord_Number = GP_OrderNumber", StrWhere: StrWhere, ShowColumnName: "GP_OrderNumber,GP_CustomerGroupID,Cus_Name,Ord_SeriesName,Ord_SeriesPrice,Ord_SinceOrderNumber,(select stuff((select ',' + Ordpg_Sights from tb_ErpOrdersPhotography where Ordpg_Number = Ord_Number for xml path('')),1,1,'')) AS Ords_SightsName").Tables[0]; for ( int i = 0; i < dtClientGroup.Rows.Count; i++ ) { DataRow[] dtRows = dt.Select("Cst_OrderNumber = '" + dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim() + "'"); if ( dtRows.Length > 0 ) { string StrUserName = LYFZ.BLL.BLL_ErpOrderView.GetUserName(dtRows[0]["Cst_ServicePerson"]); if ( StrUserName.Trim().Equals(modelClientServiceTask.StrUserName.Trim()) ) { continue; } if ( StrUserName.Trim().Length > 0 ) { if ( MessageBoxCustom.Show("客户'" + dtClientGroup.Rows[i]["Cus_Name"].ToString().Trim() + "' 套系名称'" + dtClientGroup.Rows[i]["Ord_SeriesName"].ToString().Trim() + "'(" + LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtClientGroup.Rows[i]["Ord_SeriesPrice"]) + ")\r\n'" + modelClientServiceTask.StrDateTime.Trim() + "'已安排了客服'" + StrUserName.Trim() + "'\r\n是否要修改客服人员为'" + modelClientServiceTask.StrUserName + "'?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No ) { continue; } } modelCst = GetClientServiceUpdateModel(dtRows[0], StrTime, modelClientServiceTask); clist.Add(cstbll.GetUpdateCommandInfo(modelCst)); } else { modelCst = GetClientServiceAddModel(EnumTaskModule, modelClientServiceTask, ClientServiceTaskType); modelCst.Cst_ClientGroupNumber = dtClientGroup.Rows[i]["GP_CustomerGroupID"].ToString().Trim(); modelCst.Cst_OrderNumber = dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim(); modelCst.Cst_ViceNumber = dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim(); modelCst.Cst_SightsName = dtClientGroup.Rows[i]["Ords_SightsName"].ToString().Trim(); modelCst.Cst_ShowOrderNumber = dtClientGroup.Rows[i]["Ord_SinceOrderNumber"].ToString().Trim(); modelCst.Cst_CreateDatetime = StrTime; clist.Add(cstbll.GetAddCommandInfo(modelCst)); } } } #endregion break; case EnumPublic.ClientServiceTaskItem.选衣回访: case EnumPublic.ClientServiceTaskItem.拍照回访: case EnumPublic.ClientServiceTaskItem.选片回访: case EnumPublic.ClientServiceTaskItem.看版回访: case EnumPublic.ClientServiceTaskItem.取件回访: case EnumPublic.ClientServiceTaskItem.服务回访: case EnumPublic.ClientServiceTaskItem.已拍未选: case EnumPublic.ClientServiceTaskItem.已修未选: case EnumPublic.ClientServiceTaskItem.已设计未看: case EnumPublic.ClientServiceTaskItem.部分回件未取: case EnumPublic.ClientServiceTaskItem.全部回件未取: case EnumPublic.ClientServiceTaskItem.已定未拍: case EnumPublic.ClientServiceTaskItem.已拍未拍完: case EnumPublic.ClientServiceTaskItem.选衣服客人: case EnumPublic.ClientServiceTaskItem.拍照客人: case EnumPublic.ClientServiceTaskItem.选片客人: case EnumPublic.ClientServiceTaskItem.看版客人: case EnumPublic.ClientServiceTaskItem.取件客人: case EnumPublic.ClientServiceTaskItem.服务客人: #region 按数码分 if ( StrWhere.Trim().Length > 0 ) { DataTable dtClientGroup = orbll.GetView_Custom("tempTB_AggregationCustomer Left Join tb_ErpOrderDigitalStatus on Ords_OrdNumber = GP_OrderNumber Left Join tb_ErpOrder on Ord_Number = GP_OrderNumber", StrWhere: StrWhere, ShowColumnName: "GP_OrderNumber,GP_CustomerGroupID,Cus_Name,Ords_ViceNumber,Ord_SinceOrderNumber,Ords_SightsName").Tables[0]; for ( int i = 0; i < dtClientGroup.Rows.Count; i++ ) { DataRow[] dtRows = dt.Select("Cst_OrderNumber = '" + dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim() + "' And Cst_ViceNumber = '" + dtClientGroup.Rows[i]["Ords_ViceNumber"].ToString().Trim() + "'"); if ( dtRows.Length > 0 ) { string StrUserName = LYFZ.BLL.BLL_ErpOrderView.GetUserName(dtRows[0]["Cst_ServicePerson"]); if ( StrUserName.Trim().Equals(modelClientServiceTask.StrUserName.Trim()) ) { continue; } if ( StrUserName.Trim().Length > 0 ) { if ( MessageBoxCustom.Show("客户'" + dtClientGroup.Rows[i]["Cus_Name"].ToString().Trim() + "' 拍摄名称'" + dtClientGroup.Rows[i]["Ords_SightsName"].ToString().Trim() + "'\r\n'" + modelClientServiceTask.StrDateTime.Trim() + "'已安排了客服'" + StrUserName.Trim() + "'\r\n是否要修改客服人员为'" + modelClientServiceTask.StrUserName + "'?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No ) { continue; } } modelCst = GetClientServiceUpdateModel(dtRows[0], StrTime, modelClientServiceTask); clist.Add(cstbll.GetUpdateCommandInfo(modelCst)); } else { modelCst = GetClientServiceAddModel(EnumTaskModule, modelClientServiceTask, ClientServiceTaskType); modelCst.Cst_ClientGroupNumber = dtClientGroup.Rows[i]["GP_CustomerGroupID"].ToString().Trim(); modelCst.Cst_OrderNumber = dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim(); modelCst.Cst_ViceNumber = dtClientGroup.Rows[i]["Ords_ViceNumber"].ToString().Trim(); modelCst.Cst_SightsName = dtClientGroup.Rows[i]["Ords_SightsName"].ToString().Trim(); modelCst.Cst_ShowOrderNumber = dtClientGroup.Rows[i]["Ord_SinceOrderNumber"].ToString().Trim(); modelCst.Cst_CreateDatetime = StrTime; clist.Add(cstbll.GetAddCommandInfo(modelCst)); } } } #endregion break; case EnumPublic.ClientServiceTaskItem.摄控医院客人: #region 摄控医院客人 if ( StrWhere.Trim().Length > 0 ) { DataTable dtClientGroup = orbll.GetView_Custom("tb_ErpHospitalDispatchDoor Left Join tb_ErpHospitalClient on Hct_Oddnumber = Hdr_Number ", StrWhere: StrWhere, ShowColumnName: "tb_ErpHospitalDispatchDoor.ID,Hct_Oddnumber,Hct_CustomerName,Hct_MyselfMobile").Tables[0]; for ( int i = 0; i < dtClientGroup.Rows.Count; i++ ) { DataRow[] dtRows = dt.Select("Cst_OrderNumber = '" + dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim() + "' And Cst_ViceNumber = '" + dtClientGroup.Rows[i]["ID"].ToString().Trim() + "'"); if ( dtRows.Length > 0 ) { string StrUserName = LYFZ.BLL.BLL_ErpOrderView.GetUserName(dtRows[0]["Cst_ServicePerson"]); if ( StrUserName.Trim().Equals(modelClientServiceTask.StrUserName.Trim()) ) { continue; } if ( StrUserName.Trim().Length > 0 ) { if ( MessageBoxCustom.Show("医院客户'" + dtClientGroup.Rows[i]["Hct_CustomerName"].ToString().Trim() + "' 电话'" + dtClientGroup.Rows[i]["Hct_MyselfMobile"].ToString().Trim() + "'\r\n'" + modelClientServiceTask.StrDateTime.Trim() + "'已安排了客服'" + StrUserName.Trim() + "'\r\n是否要修改客服人员为'" + modelClientServiceTask.StrUserName + "'?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No ) { continue; } } modelCst = GetClientServiceUpdateModel(dtRows[0], StrTime, modelClientServiceTask); clist.Add(cstbll.GetUpdateCommandInfo(modelCst)); } else { modelCst = GetClientServiceAddModel(EnumTaskModule, modelClientServiceTask, ClientServiceTaskType); modelCst.Cst_ClientGroupNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim(); modelCst.Cst_OrderNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim(); modelCst.Cst_ViceNumber = dtClientGroup.Rows[i]["ID"].ToString().Trim(); modelCst.Cst_SightsName = "派单上门"; modelCst.Cst_ShowOrderNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim(); modelCst.Cst_CreateDatetime = StrTime; clist.Add(cstbll.GetAddCommandInfo(modelCst)); } } } #endregion break; case EnumPublic.ClientServiceTaskItem.意向客户: #region 意向客户 if ( StrWhere.Trim().Length > 0 ) { DataTable dtClientGroup = orbll.GetView_Custom("tb_ErpCustomerGroup Left Join tb_ErpCustomerGroupMembers on GM_CustomerGroupID = GP_CustomerGroupID Left Join tb_ErpCustomer on Cus_CustomerNumber = GM_CustomerGroupID", StrWhere: StrWhere, ShowColumnName: "GP_OrderNumber,GP_CustomerGroupID,GM_CustomerID,Cus_Name,Cus_Telephone").Tables[0]; for ( int i = 0; i < dtClientGroup.Rows.Count; i++ ) { DataRow[] dtRows = dt.Select("Cst_ClientGroupNumber = '" + dtClientGroup.Rows[i]["GP_CustomerGroupID"].ToString().Trim() + "' And Cst_ViceNumber = '" + dtClientGroup.Rows[i]["GM_CustomerID"].ToString().Trim() + "'"); if ( dtRows.Length > 0 ) { string StrUserName = LYFZ.BLL.BLL_ErpOrderView.GetUserName(dtRows[0]["Cst_ServicePerson"]); if ( StrUserName.Trim().Equals(modelClientServiceTask.StrUserName.Trim()) ) { continue; } if ( StrUserName.Trim().Length > 0 ) { if ( MessageBoxCustom.Show("客户'" + dtClientGroup.Rows[i]["Cus_Name"].ToString().Trim() + "' 电话'" + dtClientGroup.Rows[i]["Cus_Telephone"].ToString().Trim() + "'\r\n'" + modelClientServiceTask.StrDateTime.Trim() + "'已安排了客服'" + StrUserName.Trim() + "'\r\n是否要修改客服人员为'" + modelClientServiceTask.StrUserName + "'?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No ) { continue; } } modelCst = GetClientServiceUpdateModel(dtRows[0], StrTime, modelClientServiceTask); clist.Add(cstbll.GetUpdateCommandInfo(modelCst)); } else { string StrSightsName = ""; string StrShowOrdNumber = ""; if ( dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim().Length > 0 ) { DataTable dtOrder = orbll.GetView_Custom("tb_ErpOrder Left Join tb_ErpOrderDigitalStatus on Ords_OrdNumber = Ord_Number", StrWhere: "Ord_Number = '" + dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim() + "'", ShowColumnName: "Ord_SinceOrderNumber,Ords_SightsName").Tables[0]; if ( dtOrder.Rows.Count > 0 ) { StrShowOrdNumber = dtOrder.Rows[0]["Ord_SinceOrderNumber"].ToString().Trim(); for ( int j = 0; j < dtOrder.Rows.Count; j++ ) { StrSightsName += dtOrder.Rows[0]["Ords_SightsName"].ToString().Trim() + ","; } } } modelCst = GetClientServiceAddModel(EnumTaskModule, modelClientServiceTask, ClientServiceTaskType); modelCst.Cst_ClientGroupNumber = dtClientGroup.Rows[i]["GP_CustomerGroupID"].ToString().Trim(); modelCst.Cst_OrderNumber = dtClientGroup.Rows[i]["GP_OrderNumber"].ToString().Trim(); modelCst.Cst_ViceNumber = dtClientGroup.Rows[i]["GM_CustomerID"].ToString().Trim(); modelCst.Cst_SightsName = StrSightsName.TrimEnd(','); modelCst.Cst_ShowOrderNumber = StrShowOrdNumber; modelCst.Cst_CreateDatetime = StrTime; clist.Add(cstbll.GetAddCommandInfo(modelCst)); } } } #endregion break; case EnumPublic.ClientServiceTaskItem.医院意向: case EnumPublic.ClientServiceTaskItem.孕妇周期: #region 医院意向 if ( StrWhere.Trim().Length > 0 ) { DataTable dtClientGroup = orbll.GetView_Custom("tb_ErpHospitalClient", StrWhere: StrWhere, ShowColumnName: "Hct_Oddnumber,Hct_CustomerName,Hct_MyselfMobile").Tables[0]; for ( int i = 0; i < dtClientGroup.Rows.Count; i++ ) { DataRow[] dtRows = dt.Select("Cst_OrderNumber = '" + dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim() + "'"); if ( dtRows.Length > 0 ) { string StrUserName = LYFZ.BLL.BLL_ErpOrderView.GetUserName(dtRows[0]["Cst_ServicePerson"]); if ( StrUserName.Trim().Equals(modelClientServiceTask.StrUserName.Trim()) ) { continue; } if ( StrUserName.Trim().Length > 0 ) { if ( MessageBoxCustom.Show("医院客户'" + dtClientGroup.Rows[i]["Hct_CustomerName"].ToString().Trim() + "' 电话'" + dtClientGroup.Rows[i]["Hct_MyselfMobile"].ToString().Trim() + "'\r\n'" + modelClientServiceTask.StrDateTime.Trim() + "'已安排了客服'" + StrUserName.Trim() + "'\r\n是否要修改客服人员为'" + modelClientServiceTask.StrUserName + "'?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No ) { continue; } } modelCst = GetClientServiceUpdateModel(dtRows[0], StrTime, modelClientServiceTask); clist.Add(cstbll.GetUpdateCommandInfo(modelCst)); } else { modelCst = GetClientServiceAddModel(EnumTaskModule, modelClientServiceTask, ClientServiceTaskType); modelCst.Cst_ClientGroupNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim(); modelCst.Cst_OrderNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim(); modelCst.Cst_ViceNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim(); modelCst.Cst_SightsName = ""; modelCst.Cst_ShowOrderNumber = dtClientGroup.Rows[i]["Hct_Oddnumber"].ToString().Trim(); modelCst.Cst_CreateDatetime = StrTime; clist.Add(cstbll.GetAddCommandInfo(modelCst)); } } } #endregion break; case EnumPublic.ClientServiceTaskItem.结婚客人: case EnumPublic.ClientServiceTaskItem.结婚纪念日: case EnumPublic.ClientServiceTaskItem.客户生日: case EnumPublic.ClientServiceTaskItem.宝贝生日: case EnumPublic.ClientServiceTaskItem.转介绍客户: #region 结婚客人 if ( StrWhere.Trim().Length > 0 ) { DataTable dtClientGroup = orbll.GetView_Custom("tb_ErpCustomer", StrWhere: StrWhere, ShowColumnName: "Cus_CustomerNumber,Cus_Name,Cus_Telephone").Tables[0]; for ( int i = 0; i < dtClientGroup.Rows.Count; i++ ) { DataRow[] dtRows = dt.Select("Cst_ViceNumber = '" + dtClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim() + "'"); if ( dtRows.Length > 0 ) { string StrUserName = LYFZ.BLL.BLL_ErpOrderView.GetUserName(dtRows[0]["Cst_ServicePerson"]); if ( StrUserName.Trim().Equals(modelClientServiceTask.StrUserName.Trim()) ) { continue; } if ( StrUserName.Trim().Length > 0 ) { if ( MessageBoxCustom.Show("客户'" + dtClientGroup.Rows[i]["Cus_Name"].ToString().Trim() + "' 电话'" + dtClientGroup.Rows[i]["Cus_Telephone"].ToString().Trim() + "'\r\n'" + modelClientServiceTask.StrDateTime.Trim() + "'已安排了客服'" + StrUserName.Trim() + "'\r\n是否要修改客服人员为'" + modelClientServiceTask.StrUserName + "'?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No ) { continue; } } modelCst = GetClientServiceUpdateModel(dtRows[0], StrTime, modelClientServiceTask); clist.Add(cstbll.GetUpdateCommandInfo(modelCst)); } else { modelCst = GetClientServiceAddModel(EnumTaskModule, modelClientServiceTask, ClientServiceTaskType); modelCst.Cst_ClientGroupNumber = dtClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim(); modelCst.Cst_OrderNumber = dtClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim(); modelCst.Cst_ViceNumber = dtClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim(); modelCst.Cst_SightsName = ""; modelCst.Cst_ShowOrderNumber = ""; modelCst.Cst_CreateDatetime = StrTime; clist.Add(cstbll.GetAddCommandInfo(modelCst)); } } } #endregion break; case EnumPublic.ClientServiceTaskItem.会员积分: #region 会员积分 if ( StrWhere.Trim().Length > 0 ) { DataTable dtClientGroup = orbll.GetView_Custom("tb_ErpCustomer Left Join tb_ErpMemberCard on Mc_CustomerNumber = Cus_CustomerNumber", StrWhere: StrWhere, ShowColumnName: "Mc_Number,Mc_CradNumber,Cus_CustomerNumber,Cus_Name,Cus_Telephone").Tables[0]; for ( int i = 0; i < dtClientGroup.Rows.Count; i++ ) { DataRow[] dtRows = dt.Select("Cst_ClientGroupNumber = '" + dtClientGroup.Rows[i]["Mc_Number"].ToString().Trim() + "' And Cst_ViceNumber = '" + dtClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim() + "'"); if ( dtRows.Length > 0 ) { string StrUserName = LYFZ.BLL.BLL_ErpOrderView.GetUserName(dtRows[0]["Cst_ServicePerson"]); if ( StrUserName.Trim().Equals(modelClientServiceTask.StrUserName.Trim()) ) { continue; } if ( StrUserName.Trim().Length > 0 ) { if ( MessageBoxCustom.Show("客户'" + dtClientGroup.Rows[i]["Cus_Name"].ToString().Trim() + "' 电话'" + dtClientGroup.Rows[i]["Cus_Telephone"].ToString().Trim() + "'\r\n'" + modelClientServiceTask.StrDateTime.Trim() + "'已安排了客服'" + StrUserName.Trim() + "'\r\n是否要修改客服人员为'" + modelClientServiceTask.StrUserName + "'?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No ) { continue; } } modelCst = GetClientServiceUpdateModel(dtRows[0], StrTime, modelClientServiceTask); clist.Add(cstbll.GetUpdateCommandInfo(modelCst)); } else { modelCst = GetClientServiceAddModel(EnumTaskModule, modelClientServiceTask, ClientServiceTaskType); modelCst.Cst_ClientGroupNumber = dtClientGroup.Rows[i]["Mc_Number"].ToString().Trim(); modelCst.Cst_OrderNumber = dtClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim(); modelCst.Cst_ViceNumber = dtClientGroup.Rows[i]["Cus_CustomerNumber"].ToString().Trim(); modelCst.Cst_SightsName = ""; modelCst.Cst_ShowOrderNumber = dtClientGroup.Rows[i]["Mc_CradNumber"].ToString().Trim(); modelCst.Cst_CreateDatetime = StrTime; clist.Add(cstbll.GetAddCommandInfo(modelCst)); } } } #endregion break; } #endregion if ( clist.Count > 0 ) { if ( MessageBoxCustom.Show("您确定要安排吗?", "温馨提示", MessageBoxButtons.YesNo) == DialogResult.No ) { return; } if ( LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0 ) { MessageBoxCustom.Show("安排成功!"); } else { MessageBoxCustom.Show("安排失败!"); } } else { MessageBoxCustom.Show("没有可以安排的数据!"); } } /// /// 重新安排客户服务任务 /// /// /// /// /// public static LYFZ.Model.Model_ErpClientServiceTask GetClientServiceUpdateModel( DataRow dtRow, DateTime StrTime, LYFZ.Model.ClientServiceTaskAnPaiModel modelClientServiceTask ) { LYFZ.BLL.BLL_ErpClientServiceTask cstbll = new BLL.BLL_ErpClientServiceTask(); LYFZ.Model.Model_ErpClientServiceTask modelCst = cstbll.DataRowToModel(dtRow); modelCst.Cst_TaskTermTime = Convert.ToDateTime(modelClientServiceTask.StrDateTime); modelCst.Cst_ServicePerson = modelClientServiceTask.StrUserID; modelCst.Cst_TaskRemark = modelClientServiceTask.StrRemark; modelCst.Cst_UpdateDateTime = StrTime; modelCst.Cst_UpdateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; return modelCst; } /// /// 添加客户服务任务 /// /// /// /// /// /// /// /// /// public static LYFZ.Model.Model_ErpClientServiceTask GetClientServiceAddModel( LYFZ.EnumPublic.ClientServiceTaskType EnumTaskModule, LYFZ.Model.ClientServiceTaskAnPaiModel modelClientServiceTask, LYFZ.EnumPublic.ClientServiceTaskItem ClientServiceAnPaiType ) { LYFZ.Model.Model_ErpClientServiceTask modelCst = new Model.Model_ErpClientServiceTask(); modelCst.Cst_Number = "CST" + LYFZ.BLL.BLL_ErpCustomer.GetClientNumber(); modelCst.Cst_TaskModule = EnumTaskModule.ToString().Trim(); modelCst.Cst_TaskItem = ClientServiceAnPaiType.ToString().Trim(); modelCst.Cst_TaskTermTime = Convert.ToDateTime(modelClientServiceTask.StrDateTime); modelCst.Cst_ServicePerson = modelClientServiceTask.StrUserID; modelCst.Cst_TaskRemark = modelClientServiceTask.StrRemark; modelCst.Cst_CompletionIntStatus = 0; modelCst.Cst_CompletionStatus = "未完成"; modelCst.Cst_CompletionRemark = ""; modelCst.Cst_CompletionPerson = ""; modelCst.Cst_CreateName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; return modelCst; } #endregion #region 相片查看输入密码认证 /// /// /// /// /// public static bool IsEnterPassword( string StrViceNumber ) { DataTable dt = orbll.GetView_Custom("tb_ErpOrderDigital", StrWhere: "Ordv_ViceNumber = '" + StrViceNumber + "'", ShowColumnName: "Ordv_PhotoPassword").Tables[0]; if ( dt.Rows.Count > 0 ) { if ( dt.Rows[0]["Ordv_PhotoPassword"].ToString().Trim().Length > 0 ) { LYFZ.Software.MainBusiness.MembershipManage.SuperSmallForm.EnterPasswordSuperSmallForm frm = new MembershipManage.SuperSmallForm.EnterPasswordSuperSmallForm(); frm.StrWindowText = "请输入相片查看密码"; frm.ShowDialog(); if ( frm.IsSaveed ) { if ( LYFZ.Command.Command_MD5.md5(frm.Pwd) == dt.Rows[0]["Ordv_PhotoPassword"].ToString().Trim() ) { return true; } MessageBoxCustom.Show("密码输入错误!"); } } else { return true; } } return false; } #endregion /// /// 财务(日、月、年)订单类型 /// /// public static void BindFinanceOrderType( LYFZ.ComponentLibrary.ComboBoxTreeViewEx cmbtreev ) { Hashtable htData = new Hashtable(); htData["0"] = LYFZ.EnumPublic.OrderNumberPrefixType.婚纱订单.ToString().Trim(); htData["1"] = LYFZ.EnumPublic.OrderNumberPrefixType.儿童订单.ToString().Trim(); htData["2"] = LYFZ.EnumPublic.OrderNumberPrefixType.写真订单.ToString().Trim(); htData["3"] = LYFZ.EnumPublic.OrderNumberPrefixType.服务订单.ToString().Trim(); htData["4"] = LYFZ.EnumPublic.OrderNumberPrefixType.婚庆订单.ToString().Trim(); switch ( LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType() ) { case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.婚纱版: htData.Remove("1"); break; case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.儿童版: htData.Remove("0"); break; } if ( !LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsEnablePhotoEdition ) { htData.Remove("2"); } cmbtreev.SetTextAndTag_ValueNull(); cmbtreev.Nodes.Clear(); TreeNode root = null; if ( htData.Count > 0 ) { root = new TreeNode(); root.Text = " "; root.Tag = ""; root.Name = ""; cmbtreev.Nodes.Add(root); } for ( int i = 0; i < 5; i++ ) { if ( htData.ContainsKey("" + i + "") ) { string StrValue = htData["" + i + ""].ToString().Trim(); root = new TreeNode(); root.Text = StrValue.Trim(); root.Tag = StrValue.Trim(); root.Name = StrValue.Trim(); cmbtreev.Nodes.Add(root); } } cmbtreev.TagFindText(""); } /// /// 日财务报表双击查看详情 /// /// /// public static void FinanceDayRowsDoubleClick( string StrID, string StrType ) { switch ( StrType ) { case "0": case "1": case "2": case "3": case "4": LYFZ.Software.MainBusiness.StatisticalInquiry.MonthFinance.FinanceDayDetails frm = new StatisticalInquiry.MonthFinance.FinanceDayDetails(); frm.StrID = StrID; frm.ShowDialog(); break; default: break; } } /// /// ListView控件绘制列表单双行 /// /// public static void ListViewDrawSingleOrDoubleRows( ListViewEx ltView ) { int IntCount = 0; if ( ltView.Groups.Count > 0 && ltView.ShowGroups ) { for ( int i = 0; i < ltView.Groups.Count; i++ ) { for ( int j = 0; j < ltView.Groups[i].Items.Count; j++ ) { if ( (IntCount % 2) > 0 ) { ltView.Groups[i].Items[j].BackColor = System.Drawing.Color.PapayaWhip; } else { ltView.Groups[i].Items[j].BackColor = System.Drawing.Color.PowderBlue; } IntCount++; } } } else { for ( int j = 0; j < ltView.Items.Count; j++ ) { if ( (IntCount % 2) > 0 ) { ltView.Items[j].BackColor = System.Drawing.Color.PapayaWhip; } else { ltView.Items[j].BackColor = System.Drawing.Color.PowderBlue; } IntCount++; } } } /// /// DataGridView设置列标题显示隐藏字段 /// /// /// /// public static bool ShowDataGridViewSetColumn( object sender, string StrEnabled = "" ) { DataGridViewEc dgvNewData = (DataGridViewEc)sender; if ( !string.IsNullOrEmpty(dgvNewData.dgvGuidName) && dgvNewData.AllowUserToOrderColumns ) { LYFZ.ComponentLibrary.DataGridViewSetColumn frm = new DataGridViewSetColumn(); frm.dgvNewData = dgvNewData; frm.listEnabled = new List(StrEnabled.Trim().Split(',')); frm.ShowDialog(); return frm.IsSaveed; } return false; } /// /// 获取订单的人员所相关的数据 /// /// /// /// public static Hashtable GetOrderExtractIntoItemHashtable( string StrOrdNumber, string StrOrdViceNumber, string StrType ) { Hashtable htData = new Hashtable(); htData["StrOrdNumber"] = StrOrdNumber; htData["StrOrdViceNumber"] = StrOrdViceNumber; htData["StrType"] = StrType; htData["tblDepartment"] = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.Tbl_Department; htData["tblUser"] = LYFZ.Software.MainBusiness.DoorCityProcess.PublicGetVersionDataTable.GetUserTable(IsShowResign: true, IsShowAdmin: false);// LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.Tbl_User; htData["StrUsrID"] = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; return htData; } internal static void BindComboBoxTreeView_SystemCategory( string StrParentCode, LYFZ.ComponentLibrary.TreeViewEx cmbtreev, bool IsFirstNodeNull = false, string IsFirstNodeName = " ", string StrWhere = "", DataTable tbl = null, bool IsBindParent = false, bool IsClearNodes = true ) { if ( tbl == null ) { tbl = new BLL.BLL_ErpSystemCategory().GetCategory("ID,Sc_ClassCode,Sc_ClassName,Sc_ClassParentID", StrWhere).Tables[0]; } if ( IsClearNodes ) { cmbtreev.Nodes.Clear(); } DataRow[] dtRow = tbl.Select("Sc_ClassCode = '" + StrParentCode + "'"); if ( dtRow.Length > 0 ) { TreeNode root = null; if ( IsBindParent ) { root = new TreeNode(); root.Text = dtRow[0]["Sc_ClassName"].ToString(); root.Tag = dtRow[0]["Sc_ClassCode"].ToString(); root.Name = dtRow[0]["ID"].ToString().Trim(); CreateTreeViewSystemCategory(root, dtRow[0]["ID"].ToString().Trim(), tbl); cmbtreev.Nodes.Add(root); } else { DataRow[] dtRow2 = tbl.Select("Sc_ClassParentID = '" + dtRow[0]["ID"].ToString().Trim() + "'"); if ( dtRow2.Length > 0 ) { for ( int i = 0; i < dtRow2.Length; i++ ) { if ( i == 0 ) { if ( IsFirstNodeNull ) { root = new TreeNode(); root.Text = IsFirstNodeName; root.Tag = ""; root.Name = ""; cmbtreev.Nodes.Add(root); } } root = new TreeNode(); root.Text = dtRow2[i]["Sc_ClassName"].ToString(); root.Tag = dtRow2[i]["Sc_ClassCode"].ToString(); root.Name = dtRow2[i]["ID"].ToString(); CreateTreeViewSystemCategory(root, dtRow2[i]["ID"].ToString(), tbl); cmbtreev.Nodes.Add(root); } } else { root = new TreeNode(); root.Text = dtRow[0]["Sc_ClassName"].ToString(); root.Tag = dtRow[0]["Sc_ClassCode"].ToString(); root.Name = dtRow[0]["ID"].ToString().Trim(); CreateTreeViewSystemCategory(root, dtRow[0]["ID"].ToString().Trim(), tbl); cmbtreev.Nodes.Add(root); } } } } } /// /// DatatTable处理 /// public class PublicGetVersionDataTable { static LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder(); /// /// 获取用户数据 /// /// 是否显示离职人员 /// 是否显示Admin帐号 /// public static DataTable GetUserTable( bool IsShowResign = true, bool IsShowAdmin = false ) { string StrWhere = ""; if ( !IsShowResign ) { StrWhere = "User_Status != '离职'"; } if ( !IsShowAdmin ) { if ( StrWhere != "" ) { StrWhere += " And "; } StrWhere += "User_Account != 'admin'"; } return orbll.GetView_Custom("tb_ErpUser", StrWhere: StrWhere, ShowColumnName: "User_Account,User_Name,User_EmployeeID,User_Department,User_Status,User_DividedShop").Tables[0]; } } /// /// 处理数据库数据 /// public static class PublicGetTableName { /// /// 获取客户数据 /// /// /// /// /// public static Hashtable GetClientData( DataTable tbl_Client, string[] ArrayClient, string StrOrdType ) { Hashtable htData = new Hashtable(); htData["strManName"] = ""; htData["strManPhone"] = ""; htData["strManSex"] = ""; htData["strWoManName"] = ""; htData["strWoManPhone"] = ""; htData["strWoManSex"] = ""; for ( int i = 0; i < ArrayClient.Length; i++ ) { if ( !string.IsNullOrEmpty(ArrayClient[i].Trim()) ) { DataRow dtRow = tbl_Client.Rows.Find(ArrayClient[i]); if ( StrOrdType == "1" ) { if ( i > 1 ) { break; } if ( i == 0 ) { htData["strManName"] = dtRow["Cus_Name"].ToString().Trim(); htData["strManPhone"] = dtRow["Cus_Telephone"].ToString().Trim(); htData["strManSex"] = Convert.ToBoolean(dtRow["Cus_Sex"]) ? "女" : "男"; } else { htData["strWoManName"] = dtRow["Cus_Name"].ToString().Trim(); htData["strWoManPhone"] = dtRow["Cus_Telephone"].ToString().Trim(); htData["strWoManSex"] = Convert.ToBoolean(dtRow["Cus_Sex"]) ? "女" : "男"; } } else { if ( StrOrdType == "2" || StrOrdType == "3" ) { if ( i > 0 ) { break; } } if ( !Convert.ToBoolean(dtRow["Cus_Sex"]) ) { htData["strManName"] = dtRow["Cus_Name"].ToString().Trim(); htData["strManPhone"] = dtRow["Cus_Telephone"].ToString().Trim(); htData["strManSex"] = "男"; } else { htData["strWoManName"] = dtRow["Cus_Name"].ToString().Trim(); htData["strWoManPhone"] = dtRow["Cus_Telephone"].ToString().Trim(); htData["strWoManSex"] = "女"; } } } } return htData; } /// /// 获取景点数据 /// /// /// /// /// public static Hashtable GetSightsData( DataTable tbl_Sights, string StrViceNumber, string StrOrdType ) { Hashtable htData = new Hashtable(); int NotCount = 0; int OkCount = 0; int InCount = 0; htData["Ordpg_Sights"] = ""; htData["Ordpg_Photographer"] = ""; htData["Ordpg_MakeupArtist"] = ""; htData["Ordpg_PhotographyTimeStart"] = ""; htData["Ordpg_PhotographyTimeEnd"] = ""; htData["Ordpg_PhotographyStatus"] = ""; for ( int i = 0; i < tbl_Sights.Rows.Count; i++ ) { if ( tbl_Sights.Rows[i]["Ordpg_ViceNumber"].ToString().Trim() == StrViceNumber ) { try { if ( tbl_Sights.Rows[i]["Ordpg_Sights"].ToString().Trim() != "" ) { if ( StrOrdType == "1" ) { htData["Ordpg_Sights"] = tbl_Sights.Rows[i]["Ordpg_Sights"].ToString().Trim(); } } } catch { } try { if ( tbl_Sights.Rows[i]["Ordpg_Photographer"].ToString().Trim() != "" ) { if ( htData["Ordpg_Photographer"].ToString().Trim() == "" ) { htData["Ordpg_Photographer"] += tbl_Sights.Rows[i]["Ordpg_Photographer"].ToString().Trim(); } else { htData["Ordpg_Photographer"] += "," + tbl_Sights.Rows[i]["Ordpg_Photographer"].ToString().Trim(); } } } catch { } try { if ( tbl_Sights.Rows[i]["Ordpg_MakeupArtist"].ToString().Trim() != "" ) { if ( htData["Ordpg_MakeupArtist"].ToString().Trim() == "" ) { htData["Ordpg_MakeupArtist"] += tbl_Sights.Rows[i]["Ordpg_MakeupArtist"].ToString().Trim(); } else { htData[".Ordpg_MakeupArtist"] += "," + tbl_Sights.Rows[i]["Ordpg_MakeupArtist"].ToString().Trim(); } } //开始拍摄日期 if ( tbl_Sights.Rows[i]["Ordpg_PhotographyTime"].ToString().Trim() != "" ) { if ( htData["Ordpg_PhotographyTimeStart"].ToString().Trim() == "" ) { htData["Ordpg_PhotographyTimeStart"] = Convert.ToDateTime(tbl_Sights.Rows[i]["Ordpg_PhotographyTime"]).ToString("yyyy-MM-dd"); } else { if ( Convert.ToDateTime(htData["Ordpg_PhotographyTimeStart"]) > Convert.ToDateTime(tbl_Sights.Rows[i]["Ordpg_PhotographyTime"]) ) { htData["Ordpg_PhotographyTimeStart"] = Convert.ToDateTime(tbl_Sights.Rows[i]["Ordpg_PhotographyTime"]).ToString("yyyy-MM-dd"); } } } } catch { } try { //最后拍摄日期 if ( tbl_Sights.Rows[i]["Ordpg_PhotographyTime"].ToString().Trim() != "" ) { if ( htData["Ordpg_PhotographyTimeEnd"].ToString().Trim() == "" ) { htData["Ordpg_PhotographyTimeEnd"] = Convert.ToDateTime(tbl_Sights.Rows[i]["Ordpg_PhotographyTime"]).ToString("yyyy-MM-dd"); } else { if ( Convert.ToDateTime(htData["Ordpg_PhotographyTimeEnd"]) < Convert.ToDateTime(tbl_Sights.Rows[i]["Ordpg_PhotographyTime"]) ) { htData["Ordpg_PhotographyTimeEnd"] = Convert.ToDateTime(tbl_Sights.Rows[i]["Ordpg_PhotographyTime"]).ToString("yyyy-MM-dd"); } } } } catch { } try { if ( tbl_Sights.Rows[i]["Ordpg_PhotographyStatus"].ToString().Trim() == "0" ) { NotCount++; } if ( tbl_Sights.Rows[i]["Ordpg_PhotographyStatus"].ToString().Trim() == "1" ) { OkCount++; } if ( tbl_Sights.Rows[i]["Ordpg_PhotographyStatus"].ToString().Trim() == "2" ) { InCount++; } } catch { } } } if ( NotCount > 0 && OkCount == 0 ) { htData["Ordpg_PhotographyStatus"] = "未拍"; } else if ( NotCount > 0 && OkCount > 0 ) { htData["Ordpg_PhotographyStatus"] = "拍摄中"; } else if ( NotCount == 0 && OkCount > 0 ) { htData["Ordpg_PhotographyStatus"] = "OK"; } if ( InCount > 0 ) { htData["Ordpg_PhotographyStatus"] = "拍摄中"; } return htData; } } /// /// 项 /// public class ListItem { /// /// 显示的文本 /// public string StrText { get; set; } /// /// 隐藏的值 /// public object StrValue { get; set; } /// /// /// /// 要显示在页面的值 /// 隐藏的值 public ListItem( string strText, object strValue ) { this.StrText = strText; this.StrValue = strValue; } public override string ToString() { return this.StrText; } /// /// 根据ListItem中的Value找到特定的ListItem(仅在ComboBox的Item都为ListItem时有效) /// /// 要查找的ComboBox /// 要查找ListItem的Value /// 返回传入的ComboBox中符合条件的第一个ListItem,如果没有找到则返回null. public static ListItem ValueFindByText( ComboBoxEx cmb, string strValue ) { foreach ( ListItem li in cmb.Items ) { if ( li.StrValue.ToString().Trim() == strValue ) { return li; } } return null; } /// /// 根据ListItem中的Key找到特定的ListItem(仅在ComboBox的Item都为ListItem时有效) /// /// 要查找的ComboBox /// 要查找ListItem的Key /// 返回传入的ComboBox中符合条件的第一个ListItem,如果没有找到则返回null. public static ListItem TextFindByValue( ComboBoxEx cmb, string strText ) { foreach ( ListItem li in cmb.Items ) { if ( li.StrText.ToString().Trim() == strText ) { return li; } } return null; } } }