123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.CameraControlBook
- {
- public partial class OrderControlFormMain : LYFZ.Software.UI.CameraControlBook.OrderControlFormMain
- {
- LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
- public OrderControlFormMain()
- {
- this.Load += OrderControlFormMain_Load;
- this.Shown += OrderControlFormMain_Shown;
- this.btnQuery.Click += btnQuery_Click;
- this.btnExport.Click += btnExport_Click;
- this.btnCloses.Click += btnCloses_Click;
- this.tabControlEx1.SelectedIndexChanged += tabControlEx1_SelectedIndexChanged;
- this.dgvData.EventRowExpandCollapse += dgvData_EventRowExpandCollapse;
- }
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void OrderControlFormMain_Load(object sender, EventArgs e)
- {
- string StrColumnName = "订单号,订单类型,分店,客户姓名,客户拼音,客户性别,客户电话,预约拍照日期,完成状态,取件状态";
- this.dgvData.DataColumns(StrColumns: StrColumnName);
- }
- /// <summary>
- /// 窗体加载事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void OrderControlFormMain_Shown(object sender, EventArgs e)
- {
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 查询
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnQuery_Click(object sender, EventArgs e)
- {
- this.PublicFunctionRows();
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnExport_Click(object sender, EventArgs e)
- {
- if (this.dgvData.Rows.Count > 0)
- {
- string StrtableName = this.tabControlEx1.SelectedTab.Text.Trim();
- this.dgvData.ExportDataTable(StrtableName);
- }
- }
- /// <summary>
- /// 关闭
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void btnCloses_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- /// <summary>
- /// 选项卡选择事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- void tabControlEx1_SelectedIndexChanged(object sender, EventArgs e)
- {
- this.PublicFunctionRows();
- }
- /// <summary>
- /// 分页前数据,便于展开时用来查询订单的子数据
- /// </summary>
- DataTable tblMianSelectData = new DataTable();
- /// <summary>
- /// 创建行
- /// </summary>
- void PublicFunctionRows()
- {
- int intViceCount = 1;
- switch (this.tabControlEx1.SelectedTab.Name.Trim())
- {
- case "tabPage_ExpiredReservationPhotographyNotPhotography":
- intViceCount = 2;
- break;
- }
- tblMianSelectData = new DataTable();
- tblMianSelectData = orbll.GetView_Custom(this.GetTableName()).Tables[0];
- this.dgvData.ViceCount = intViceCount;
- this.dgvData.DataSourceMain(tblMianSelectData, strHideField: "PID,Ord_Number,Ord_ViceOrderCount");
- this.dgvData.FillLastColumn(isAddNullColumns: true);
- Hashtable htData = new Hashtable();
- for (int i = 0; i < tblMianSelectData.Rows.Count; i++)
- { htData[tblMianSelectData.Rows[i]["Ord_Number"].ToString().Trim()] = tblMianSelectData.Rows[i]["Ord_Number"].ToString().Trim(); }
- this.dataGridViewStatisticsCount1.LocationX = this.dgvData.RowHeadersWidth;
- this.dataGridViewStatisticsCount1.CurrenQuantity = htData.Count;
- this.dataGridViewStatisticsCount1.TotalQuantity = htData.Count;
- bool b = LYFZ.Software.MainBusiness.VersionControl.StaticVersion.UIFunctionVersion(VersionControl.VersionFunctionEnum.客服中心已过预约把控);
- if (!b)
- {
- this.Close();
- }
- }
- /// <summary>
- /// 获取视图表
- /// </summary>
- /// <returns></returns>
- string GetTableName()
- {
- string StrWhere = "";
- string StrTableName = "";
- if (!string.IsNullOrEmpty(this.txtQuery.Text.Trim()))
- { StrWhere = "Where (订单号 like '%" + this.txtQuery.Text.Trim() + "%' or 客户姓名 like '%" + this.txtQuery.Text.Trim() + "%' or 客户拼音 like '%" + this.txtQuery.Text.Trim() + "%' or 客户电话 like '%" + this.txtQuery.Text.Trim() + "%')"; }
- switch (this.tabControlEx1.SelectedTab.Name.Trim())
- {
- case "tabPage_ExpiredReservationPhotographyNotPhotography":
- StrTableName = "with t AS ( " +
- "select Max(ID) AS PID,Ordpg_Number,Ordpg_ViceNumber,dbo.fn_CheckDateTimeReturn_Date(dbo.fn_CheckDateTime(Ordpg_ReservationPhotographyTime)) AS Ordpg_ReservationPhotographyTime,Ordpg_PhotographyStatus " +
- "from tb_ErpOrdersPhotography " +
- "where Ordpg_PhotographyStatus != '1' And Ordpg_ReservationPhotographyTime is not null And Ordpg_ViceNumber != '' " +
- "Group By Ordpg_Number,Ordpg_ViceNumber,dbo.fn_CheckDateTimeReturn_Date(dbo.fn_CheckDateTime(Ordpg_ReservationPhotographyTime)),Ordpg_PhotographyStatus " +
- ") " +
- ", t1 AS( " +
- "select PID,Ord_Number,Ordpg_ViceNumber,Ord_DividedShop, " +
- "CASE Ord_SinceOrderNumber WHEN '' THEN Ord_Number ELSE Ord_SinceOrderNumber END AS 订单号, " +
- "dbo.fn_CheckOrderType(Ord_Type) AS 订单类型, " +
- "Company_Name AS 分店, " +
- "Cus_Name AS 客户姓名, " +
- "Cus_Name_py AS 客户拼音, " +
- "Cus_Sex_cs AS 客户性别, " +
- "Cus_Telephone AS 客户电话, " +
- "Ordpg_ReservationPhotographyTime AS 预约拍照日期, " +
- "dbo.fn_CheckOrderPhotographyStatus(t.Ordpg_PhotographyStatus) AS 拍摄状态, " +
- "(SELECT Count(Ordpg_ViceNumber) AS CountID FROM t AS tt WHERE tt.Ordpg_ViceNumber = t.Ordpg_ViceNumber) AS Ord_ViceOrderCount " +
- "from t " +
- "Left Join tb_ErpOrder on Ord_Number = t.Ordpg_Number " +
- "Left Join tempTB_AggregationCustomer on tb_ErpOrder.Ord_Number = GP_OrderNumber " +
- "Left Join tb_ErpCompanyInfo on Company_DividedShop = Ord_DividedShop " +
- "where Ord_Number is not null And convert(datetime,Ordpg_ReservationPhotographyTime,120) < GETDATE() " +
- ") " +
- "select PID,Ord_Number,订单号,订单类型,分店,客户姓名,客户性别,客户电话,预约拍照日期,拍摄状态,Ord_ViceOrderCount " +
- "from t1 " + StrWhere + " " +
- "order by Ordpg_ViceNumber,预约拍照日期";
- break;
- case "tabPage_ExpiredReservationLookDesignNotLookDesign":
- StrTableName = "with t AS( " +
- "select tb_ErpOrderDigital.ID AS PID, " +
- "Ord_Number, " +
- "Ordv_ViceNumber, " +
- "Ord_DividedShop, " +
- "CASE Ord_SinceOrderNumber WHEN '' THEN Ord_Number ELSE Ord_SinceOrderNumber END AS 订单号, " +
- "dbo.fn_CheckOrderType(Ord_Type) AS 订单类型, " +
- "Company_Name AS 分店, " +
- "Cus_Name AS 客户姓名, " +
- "Cus_Name_py AS 客户拼音, " +
- "Cus_Sex_cs AS 客户性别, " +
- "Cus_Telephone AS 客户电话, " +
- "dbo.fn_CheckDateTimeReturn_Date(dbo.fn_CheckDateTime(Ordv_ReservationLookDesignTime)) AS 预约看版日期, " +
- "dbo.fn_CheckOrderLookDesignStatus(Ordv_LookDesignStatus) AS 看版状态, " +
- "(SELECT Count(Ordv_ViceNumber) AS CountID FROM tb_ErpOrderDigital AS tt WHERE tt.Ordv_ViceNumber = tb_ErpOrderDigital.Ordv_ViceNumber) AS Ord_ViceOrderCount " +
- "from tb_ErpOrderDigital " +
- "Left Join tb_ErpOrder on Ord_Number = Ordv_Number " +
- "Left Join tempTB_AggregationCustomer on tb_ErpOrder.Ord_Number = GP_OrderNumber " +
- "Left Join tb_ErpCompanyInfo on Company_DividedShop = Ord_DividedShop " +
- "where Ord_Number is not null And Ordv_LookDesignStatus != '1' And convert(datetime,Ordv_ReservationLookDesignTime,120) < GETDATE() " +
- ") " +
- "select PID,Ord_Number,订单号,订单类型,分店,客户姓名,客户性别,客户电话,预约看版日期,看版状态,Ord_ViceOrderCount " +
- "from t " + StrWhere + " " +
- "order by Ordv_ViceNumber,预约看版日期";
- break;
- case "tabPage_ExpiredReservationPickupNotComplete":
- StrTableName = "with t AS " +
- "(" +
- "select " +
- "Max(ID) AS PID," +
- "OPlist_ViceNumber," +
- "dbo.fn_CheckDateTimeReturn_Date(dbo.fn_CheckDateTime(OPlist_ReservationTakeTime)) AS OPlist_ReservationTakeTime," +
- "OPlist_CompletedStatus," +
- "OPlist_PickupStatus " +
- "from tb_ErpOrderProductList " +
- "where OPlist_Type = '2' And OPlist_ReservationTakeTime is not null And OPlist_PickupStatus = '0' And OPlist_CompletedStatus = '0' And OPlist_ViceNumber != '' " +
- "Group By OPlist_ViceNumber,OPlist_CompletedStatus,OPlist_PickupStatus,dbo.fn_CheckDateTimeReturn_Date(dbo.fn_CheckDateTime(OPlist_ReservationTakeTime))" +
- ")" +
- ", t1 AS " +
- "(" +
- "select " +
- "PID," +
- "Ord_Number," +
- "Ordv_ViceNumber," +
- "Ord_DividedShop," +
- "CASE Ord_SinceOrderNumber WHEN '' THEN Ord_Number ELSE Ord_SinceOrderNumber END AS 订单号," +
- "dbo.fn_CheckOrderType(Ord_Type) AS 订单类型," +
- "Company_Name AS 分店," +
- "Cus_Name AS 客户姓名," +
- "Cus_Name_py AS 客户拼音," +
- "Cus_Sex_cs AS 客户性别," +
- "Cus_Telephone AS 客户电话," +
- "OPlist_ReservationTakeTime AS 预约取件日期," +
- "dbo.fn_CheckProductCompletedStatus(t.OPlist_CompletedStatus) AS 完成状态," +
- "dbo.fn_CheckProductTakePiecesStatus(t.OPlist_PickupStatus) AS 取件状态," +
- "(SELECT Count(OPlist_ViceNumber) AS CountID FROM t AS tt WHERE tt.OPlist_ViceNumber = Ordv_ViceNumber) AS Ord_ViceOrderCount " +// tt.OPlist_ReservationTakeTime = t.OPlist_ReservationTakeTime
- "from t " +
- "Left Join tb_ErpOrderDigital on Ordv_ViceNumber = OPlist_ViceNumber " +
- "Left Join tb_ErpOrder on Ord_Number = Ordv_Number " +
- "Left Join tempTB_AggregationCustomer on tb_ErpOrder.Ord_Number = GP_OrderNumber " +
- "Left Join tb_ErpCompanyInfo on Company_DividedShop = Ord_DividedShop " +
- "where Ord_Number is not null And convert(datetime,OPlist_ReservationTakeTime,120) < GETDATE() " +
- ")" +
- "select PID,Ord_Number,订单号,订单类型,分店,客户姓名,客户性别,客户电话,预约取件日期,完成状态,取件状态,Ord_ViceOrderCount from t1 " + StrWhere + " " +
- "order by Ordv_ViceNumber,预约取件日期";
- break;
- case "tabPage_ExpiredReservationPickupNotPickup":
- StrTableName = "with t AS " +
- "(" +
- "select " +
- "Max(ID) AS PID," +
- "OPlist_ViceNumber," +
- "dbo.fn_CheckDateTimeReturn_Date(dbo.fn_CheckDateTime(OPlist_ReservationTakeTime)) AS OPlist_ReservationTakeTime," +
- "OPlist_CompletedStatus," +
- "OPlist_PickupStatus " +
- "from tb_ErpOrderProductList " +
- "where OPlist_Type = '2' And OPlist_ReservationTakeTime is not null And OPlist_PickupStatus = '0' And OPlist_ViceNumber != '' " +
- "Group By OPlist_ViceNumber,OPlist_CompletedStatus,OPlist_PickupStatus,dbo.fn_CheckDateTimeReturn_Date(dbo.fn_CheckDateTime(OPlist_ReservationTakeTime))" +
- ")" +
- ", t1 AS" +
- "(" +
- "select " +
- "PID," +
- "Ord_Number," +
- "Ordv_ViceNumber," +
- "Ord_DividedShop," +
- "CASE Ord_SinceOrderNumber WHEN '' THEN Ord_Number ELSE Ord_SinceOrderNumber END AS 订单号," +
- "dbo.fn_CheckOrderType(Ord_Type) AS 订单类型," +
- "Company_Name AS 分店," +
- "Cus_Name AS 客户姓名," +
- "Cus_Name_py AS 客户拼音," +
- "Cus_Sex_cs AS 客户性别," +
- "Cus_Telephone AS 客户电话," +
- "OPlist_ReservationTakeTime AS 预约取件日期," +
- "dbo.fn_CheckProductCompletedStatus(t.OPlist_CompletedStatus) AS 完成状态," +
- "dbo.fn_CheckProductTakePiecesStatus(t.OPlist_PickupStatus) AS 取件状态," +
- "(SELECT Count(OPlist_ViceNumber) AS CountID FROM t AS tt WHERE tt.OPlist_ViceNumber = Ordv_ViceNumber) AS Ord_ViceOrderCount " +// And tt.OPlist_ReservationTakeTime = t.OPlist_ReservationTakeTime
- "from t " +
- "Left Join tb_ErpOrderDigital on Ordv_ViceNumber = OPlist_ViceNumber " +
- "Left Join tb_ErpOrder on Ord_Number = Ordv_Number " +
- "Left Join tempTB_AggregationCustomer on tb_ErpOrder.Ord_Number = GP_OrderNumber " +
- "Left Join tb_ErpCompanyInfo on Company_DividedShop = Ord_DividedShop " +
- "where Ord_Number is not null And convert(datetime,OPlist_ReservationTakeTime,120) < GETDATE() " +
- ")" +
- "select PID,Ord_Number,订单号,订单类型,分店,客户姓名,客户性别,客户电话,预约取件日期,完成状态,取件状态,Ord_ViceOrderCount from t1 " + StrWhere + " " +
- "order by Ordv_ViceNumber,预约取件日期";
- break;
- case "tabPage_ExpireReservationSelect":
- StrTableName = "with t AS( " +
- "select tb_ErpOrderDigital.ID AS PID, " +
- "Ord_Number, " +
- "Ordv_ViceNumber, " +
- "Ord_DividedShop, " +
- "CASE Ord_SinceOrderNumber WHEN '' THEN Ord_Number ELSE Ord_SinceOrderNumber END AS 订单号, " +
- "dbo.fn_CheckOrderType(Ord_Type) AS 订单类型, " +
- "Company_Name AS 分店, " +
- "Cus_Name AS 客户姓名, " +
- "Cus_Name_py AS 客户拼音, " +
- "Cus_Sex_cs AS 客户性别, " +
- "Cus_Telephone AS 客户电话, " +
- "dbo.fn_CheckDateTimeReturn_Date(dbo.fn_CheckDateTime(Ordv_ReservationFilmSelectionTime)) AS 预约选样日期, " +
- "dbo.fn_CheckOrderFilmSelectionStatus(Ordv_FilmSelectionStatus) AS 选样状态, " +
- "(SELECT Count(Ordv_ViceNumber) AS CountID FROM tb_ErpOrderDigital AS tt WHERE tt.Ordv_ViceNumber = tb_ErpOrderDigital.Ordv_ViceNumber) AS Ord_ViceOrderCount " +
- "from tb_ErpOrderDigital " +
- "Left Join tb_ErpOrder on Ord_Number = Ordv_Number " +
- "Left Join tempTB_AggregationCustomer on tb_ErpOrder.Ord_Number = GP_OrderNumber " +
- "Left Join tb_ErpCompanyInfo on Company_DividedShop = Ord_DividedShop " +
- "where Ord_Number is not null And Ordv_FilmSelectionStatus != '1' And convert(datetime,Ordv_ReservationFilmSelectionTime,120) < GETDATE() " +
- ") " +
- "select PID,Ord_Number,订单号,订单类型,分店,客户姓名,客户性别,客户电话,预约选样日期,选样状态,Ord_ViceOrderCount " +
- "from t " + StrWhere + " " +
- "order by Ordv_ViceNumber,预约选样日期";
- break;
- }
- return StrTableName;
- }
- /// <summary>
- /// 展开副级
- /// </summary>
- /// <param name="e"></param>
- void dgvData_EventRowExpandCollapse(ComponentLibrary.DataGridViewEc.EventExpandCollapse e)
- {
- //现再为展开
- if (e.ExpandOrCollapse)
- {
- if (tblMianSelectData.Rows.Count > 0)
- {
- string StrOrderBy = "";
- switch (this.tabControlEx1.SelectedTab.Name.Trim())
- {
- case "tabPage_ExpiredReservationPhotographyNotPhotography":
- StrOrderBy = "预约拍照日期";
- break;
- case "tabPage_ExpiredReservationLookDesignNotLookDesign":
- StrOrderBy = "预约看版日期";
- break;
- case "tabPage_ExpiredReservationPickupNotComplete":
- case "tabPage_ExpiredReservationPickupNotPickup":
- StrOrderBy = "预约取件日期";
- break;
- }
- DataRow[] dtRow = this.tblMianSelectData.Select("Ord_Number = '" + this.dgvData.CurrentRow.Cells["Ord_Number"].Value.ToString().Trim() + "' and PID <> '" + this.dgvData.CurrentRow.Cells["PID"].Value.ToString().Trim() + "'", StrOrderBy);
- this.dgvData.DgvValueFiledNull = this.dgvData.StrValueNullColumn + ",订单号,订单类型,分店";
- this.dgvData.DataSourceViceRow(dtRow);
- }
- }
- //现再为折叠
- else { }
- }
- }
- }
|