using LYFZ.ComponentLibrary;
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 ProcessMonitorFormMain : LYFZ.Software.UI.CameraControlBook.ProcessMonitorFormMain
{
public ProcessMonitorFormMain()
{
this.UcPagerEx1.EventPaging += UcPagerEx1_EventPaging;
this.flowLayoutPanel1.Height = 34;
}
///
/// 是否显示写真版
///
bool IsPortrait = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsEnablePhotoEdition;
///
/// 是否选择显示按钮上的版本
///
bool IsChk = false;
bool IsFirstRun = true;
LYFZ.BLL.BLL_ErpOrder orbll = new LYFZ.BLL.BLL_ErpOrder();
LYFZ.BLL.BLL_ErpSystemConfigure sgbll = new BLL.BLL_ErpSystemConfigure();
LYFZ.BLL.BLL_ErpOrderProcessMonitor ordpmbll = new BLL.BLL_ErpOrderProcessMonitor();
///
/// 窗体加载事件
///
///
///
protected override void ProcessMonitorFormMain_Shown(object sender, EventArgs e)
{
#region
this.chkKidsVersion.Visible = false;
this.chkDressVersion.Visible = false;
this.chkPortraitVersion.Visible = false;
switch (LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType())
{
case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.旗舰版:
this.chkKidsVersion.Visible = true;
this.chkDressVersion.Visible = true;
if (IsPortrait)
{ this.chkPortraitVersion.Visible = true; }
break;
case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.婚纱版:
if (IsPortrait)
{ this.chkPortraitVersion.Visible = true; this.chkDressVersion.Visible = true; }
break;
case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.儿童版:
if (IsPortrait)
{ this.chkPortraitVersion.Visible = true; this.chkKidsVersion.Visible = true; }
break;
}
#endregion
#region 权限
//if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.ProcessMonitoring, LYFZ.CustomAttributes.OperatingAuthority.Setting))
//{ this.btnWarningSet.Enabled = false; }
#endregion
this.panelEx5.BackColor = Color.LightSteelBlue;
this.panelEx6.BackColor = Color.Green;
this.panelEx7.BackColor = Color.Red;
this.panelEx8.BackColor = Color.Orange;
PublicFunctionRows();
this.IsFirstRun = false;
this.ProcessMonitorFormMain_Resize(this, null);
}
///
/// 回车
///
///
///
protected override void cmbQueryText_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{ this.btnQuery_Click(this, null); }
}
///
/// 窗体加载事件
///
///
///
protected override void ProcessMonitorFormMain_Load(object sender, EventArgs e)
{
if (this.dgvData.Columns.Count <= 0)
{
string[] strColumn = ("订单号,订单类型,客户姓名,客户电话,客户性别,接单人,订单日期,开拍日期,拍照日期,选片日期,拍照,选片,看样,件齐,取走").Split(',');
for (int i = 0; i < strColumn.Length; i++)
{
DataGridViewColumn column = null;
column = new DataGridViewColumn();
column.ReadOnly = true;
column.Name = strColumn[i].ToString().Trim();
column.HeaderText = strColumn[i].ToString().Trim();
this.dgvData.Columns.Add(column);
}
//this.dgvData.DataColumns(strColumn, LYFZ.Software.MainBusiness.CommonLogical.CacheData.StrOrderReportHideField);
}
}
///
/// 创建行
///
private void PublicFunctionRows()
{
this.UcPagerEx1.PageCurrent = 1;
this.UcPagerEx1.PageSize = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPageSize();//3;分页条数
this.UcPagerEx1.Bind();
}
///
/// 分页前数据,便于展开时用来查询订单的子数据
///
DataTable tbl = new DataTable();
///
/// 画分页
///
///
///
private int UcPagerEx1_EventPaging(UCPager.EventPagingArg e)
{
LYFZ.UCPager.PageData pageData = new LYFZ.UCPager.PageData();
pageData.TableName = "AView_WarningSet";
pageData.PageIndex = this.UcPagerEx1.PageCurrent;
pageData.PageSize = this.UcPagerEx1.PageSize;
pageData.QueryCondition = GetWhereStr();
pageData.QueryFieldName = "Ord_Type,Ord_CustomerListID,Ord_Number,Ord_ViceNumber,订单号,订单类型,姓名1,姓名2,电话1,电话2,接单人,订单日期,开拍日期,拍照日期,选片日期,拍照,选片,看样,件齐,取走";
pageData.OrderStr = "ID";
pageData.OrderType = 1;
string strType = GetVersion();//获取版本
LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
{
tbl = pageData.QueryDataTable().Tables[0];
string StrM = "";
string StrV = "";
for (int i = 0; i < tbl.Rows.Count; i++)
{
if (i == 0)
{ StrM += "'" + tbl.Rows[i]["Ord_Number"].ToString().Trim() + "'"; StrV += "'" + tbl.Rows[i]["Ord_ViceNumber"].ToString().Trim() + "'"; }
else
{ StrM += ",'" + tbl.Rows[i]["Ord_Number"].ToString().Trim() + "'"; StrV += ",'" + tbl.Rows[i]["Ord_ViceNumber"].ToString().Trim() + "'"; }
}
string ExecuteSql = "select Cus_CustomerNumber, Cus_Name, Cus_Sex, Cus_Telephone FROM dbo.tb_ErpCustomer;";
ExecuteSql += "select OPlist_ViceNumber, OPlist_CompletedStatus, OPlist_PickupStatus from dbo.tb_ErpOrderProductList where OPlist_Type='2' and OPlist_PickupTime != '' and OPlist_ViceNumber in (" + StrV + ") ;";
ExecuteSql += "select OPlist_ViceNumber,OPlist_PickupStatus,OPlist_CompletedStatus from dbo.tb_ErpOrderProductList where OPlist_Type = '2' and OPlist_ViceNumber in (" + StrV + ") ;";
ExecuteSql += "select Ordpg_ViceNumber,Ordpg_Sights,Ordpg_PhotographyStatus,dbo.fn_CheckUserIDGetUserName(Ordpg_Photographer) AS Ordpg_Photographer,Ordpg_PhotographyTime,dbo.fn_CheckUserIDGetUserName(Ordpg_MakeupArtist) AS Ordpg_MakeupArtist FROM tb_ErpOrdersPhotography where Ordpg_ViceNumber in (" + StrV + ");";
ExecuteSql += "select Ordpm_Number,Ordpm_ViceNumber,Ordpm_ProcessType,Ordpm_ProcessDays,Ordpm_ProcessDate,Ordpm_ProcessRemark,Ordpm_UpdateDateTime,Ordpm_UpdateName from tb_ErpOrderProcessMonitor where Ordpm_Number in (" + StrM + ");";
DataSet dsData = orbll.GetView_Custom(ExecuteSql);
DataTable tbl_Client = dsData.Tables["ds"];
tbl_Client.PrimaryKey = new DataColumn[] { tbl_Client.Columns["Cus_CustomerNumber"] };
DataTable tbl_PickupTime = dsData.Tables["ds1"];
DataTable tbl_PickupStatus = dsData.Tables["ds2"];
DataTable tbl_Sights = dsData.Tables["ds3"];
DataTable tblP = dsData.Tables["ds4"];
try
{
this.Invoke(new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl(delegate()
{
#region 列标题
this.dgvData.Columns.Clear();
this.dgvData.Rows.Clear();
this.dgvData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
this.dgvData.ColumnHeadersHeight = 24;
DataGridViewColumn dgvcl = new DataGridViewColumn();
dgvcl.HeaderText = "strNumber";
dgvcl.Name = "strNumber";
dgvcl.ReadOnly = true;
dgvcl.Width = 120;
dgvcl.Visible = false;
this.dgvData.Columns.Add(dgvcl);
dgvcl = new DataGridViewColumn();
dgvcl.HeaderText = "strViceNumber";
dgvcl.Name = "strViceNumber";
dgvcl.ReadOnly = true;
dgvcl.Width = 120;
dgvcl.Visible = false;
this.dgvData.Columns.Add(dgvcl);
dgvcl = new DataGridViewColumn();
dgvcl.HeaderText = "订单号";
dgvcl.Name = "strNumber";
dgvcl.ReadOnly = true;
dgvcl.Width = 120;
this.dgvData.Columns.Add(dgvcl);
dgvcl = new DataGridViewColumn();
dgvcl.HeaderText = "订单类型";
dgvcl.Name = "strType";
dgvcl.ReadOnly = true;
dgvcl.Width = 120;
this.dgvData.Columns.Add(dgvcl);
dgvcl = new DataGridViewColumn();
switch (strType)
{
case "": dgvcl.HeaderText = "男/家姓名"; break;
case "1": dgvcl.HeaderText = "家长姓名"; break;
case "0": dgvcl.HeaderText = "男宾姓名"; break;
case "2": dgvcl.HeaderText = "客户姓名"; break;
}
dgvcl.Name = "strName1";
dgvcl.ReadOnly = true;
dgvcl.Width = 80;
this.dgvData.Columns.Add(dgvcl);
if (strType == "" || strType == "0" || strType == "1")
{
dgvcl = new DataGridViewColumn();
switch (strType)
{
case "": dgvcl.HeaderText = "女/宝姓名"; break;
case "0": dgvcl.HeaderText = "女宾姓名"; break;
case "1": dgvcl.HeaderText = "宝贝姓名"; break;
}
dgvcl.Name = "strName2";
dgvcl.ReadOnly = true;
dgvcl.Width = 80;
this.dgvData.Columns.Add(dgvcl);
}
dgvcl = new DataGridViewColumn();
dgvcl.HeaderText = "接单人";
dgvcl.Name = "strStore";
dgvcl.ReadOnly = true;
dgvcl.Width = 120;
this.dgvData.Columns.Add(dgvcl);
dgvcl = new DataGridViewColumn();
dgvcl.HeaderText = "订单日期";
dgvcl.Name = "strOrdDate";
dgvcl.ReadOnly = true;
dgvcl.Width = 70;
this.dgvData.Columns.Add(dgvcl);
dgvcl = new DataGridViewColumn();
dgvcl.HeaderText = "拍照日期";
dgvcl.Name = "strPhotographDate";
dgvcl.ReadOnly = true;
dgvcl.Width = 70;
this.dgvData.Columns.Add(dgvcl);
dgvcl = new DataGridViewColumn();
dgvcl.HeaderText = "选片日期";
dgvcl.Name = "strSelectionFilmDate";
dgvcl.ReadOnly = true;
dgvcl.Width = 70;
this.dgvData.Columns.Add(dgvcl);
dgvcl = new DataGridViewColumn();
dgvcl.HeaderText = "拍照";
dgvcl.Name = "strPhotograph";
dgvcl.ReadOnly = true;
dgvcl.Width = 65;
this.dgvData.Columns.Add(dgvcl);
dgvcl = new DataGridViewColumn();
dgvcl.HeaderText = "拍完";
dgvcl.Name = "strPhotographOK";
dgvcl.ReadOnly = true;
dgvcl.Width = 65;
this.dgvData.Columns.Add(dgvcl);
dgvcl = new DataGridViewColumn();
dgvcl.HeaderText = "选片";
dgvcl.Name = "strSelectionFilm";
dgvcl.ReadOnly = true;
dgvcl.Width = 65;
this.dgvData.Columns.Add(dgvcl);
dgvcl = new DataGridViewColumn();
dgvcl.HeaderText = "看样";
dgvcl.Name = "strLookSample";
dgvcl.ReadOnly = true;
dgvcl.Width = 65;
this.dgvData.Columns.Add(dgvcl);
dgvcl = new DataGridViewColumn();
dgvcl.HeaderText = "件齐";
dgvcl.Name = "strPieceQi";
dgvcl.ReadOnly = true;
dgvcl.Width = 65;
this.dgvData.Columns.Add(dgvcl);
dgvcl = new DataGridViewColumn();
dgvcl.HeaderText = "取走";
dgvcl.Name = "strTakeAway";
dgvcl.ReadOnly = true;
dgvcl.Width = 65;
this.dgvData.Columns.Add(dgvcl);
dgvcl = new DataGridViewColumn();
switch (strType)
{
case "": dgvcl.HeaderText = "男/家电话"; break;
case "0": dgvcl.HeaderText = "男宾电话"; break;
case "1": dgvcl.HeaderText = "家长电话"; break;
case "2": dgvcl.HeaderText = "客户电话"; break;
}
dgvcl.Name = "strPhone1";
dgvcl.ReadOnly = true;
dgvcl.Width = 80;
this.dgvData.Columns.Add(dgvcl);
if (strType == "" || strType == "0")
{
dgvcl = new DataGridViewColumn();
dgvcl.HeaderText = "女宾电话";
dgvcl.Name = "strPhone2";
dgvcl.ReadOnly = true;
dgvcl.Width = 80;
this.dgvData.Columns.Add(dgvcl);
}
#endregion
#region 获取预警设置数据
string txtA = "";
string txtB = "";
string txtC = "";
string txtD = "";
string txtE = "";
string txtF = "";
DataTable tbl_Scon = sgbll.GetSystemConfigureCustom("Sconfig_Code,Sconfig_Value", "Sconfig_Remark = 'Alert'").Tables[0];
for (int i = 0; i < tbl_Scon.Rows.Count; i++)
{
if (tbl_Scon.Rows[i]["Sconfig_Code"].ToString().Trim() == "ProcessMonitor_OrderLater_NotShot")
{ txtA = tbl_Scon.Rows[i]["Sconfig_Value"].ToString().Trim(); }
else if (tbl_Scon.Rows[i]["Sconfig_Code"].ToString().Trim() == "ProcessMonitor_photographedLater_NotEnd")
{ txtB = tbl_Scon.Rows[i]["Sconfig_Value"].ToString().Trim(); }
else if (tbl_Scon.Rows[i]["Sconfig_Code"].ToString().Trim() == "ProcessMonitor_photograpOKLater_NotSelect")
{ txtC = tbl_Scon.Rows[i]["Sconfig_Value"].ToString().Trim(); }
else if (tbl_Scon.Rows[i]["Sconfig_Code"].ToString().Trim() == "ProcessMonitor_SelectOKLater_NotLook")
{ txtD = tbl_Scon.Rows[i]["Sconfig_Value"].ToString().Trim(); }
else if (tbl_Scon.Rows[i]["Sconfig_Code"].ToString().Trim() == "ProcessMonitor_SelectOKLater_NotQi")
{ txtE = tbl_Scon.Rows[i]["Sconfig_Value"].ToString().Trim(); }
else if (tbl_Scon.Rows[i]["Sconfig_Code"].ToString().Trim() == "ProcessMonitor_SelectOKLater_NotTake")
{ txtF = tbl_Scon.Rows[i]["Sconfig_Value"].ToString().Trim(); }
}
#endregion
#region 行
for (int i = 0; i < tbl.Rows.Count; i++)
{
string[] ArrayClient = tbl.Rows[i]["Ord_CustomerListID"].ToString().Trim().Split(',');
Hashtable htData_Client = LYFZ.Software.MainBusiness.DoorCityProcess.PublicGetTableName.GetClientData(tbl_Client, ArrayClient, tbl.Rows[i]["Ord_Type"].ToString().Trim());
Hashtable htData_Sights = LYFZ.Software.MainBusiness.DoorCityProcess.PublicGetTableName.GetSightsData(tbl_Sights, tbl.Rows[i]["Ord_ViceNumber"].ToString().Trim(), tbl.Rows[i]["Ord_Type"].ToString().Trim());
string strPhotographyTimeStart = htData_Sights["Ordpg_PhotographyTimeStart"].ToString();
string strPhotographyTimeEnd = htData_Sights["Ordpg_PhotographyTimeEnd"].ToString();
DataGridViewRow dgvl = new DataGridViewRow();
dgvl.Height = 25;
DataGridViewCell cell = null;
cell = new DataGridViewTextBoxCell();
cell.Value = tbl.Rows[i]["Ord_Number"].ToString().Trim();
dgvl.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = tbl.Rows[i]["Ord_ViceNumber"].ToString().Trim();
dgvl.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = tbl.Rows[i]["订单号"].ToString().Trim();
dgvl.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = tbl.Rows[i]["订单类型"].ToString().Trim();
dgvl.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = htData_Client["strManName"];// tbl.Rows[i]["姓名1"].ToString().Trim();
dgvl.Cells.Add(cell);
if (strType == "" || strType == "0" || strType == "1")
{
cell = new DataGridViewTextBoxCell();
cell.Value = htData_Client["strWoManName"];//tbl.Rows[i]["姓名2"].ToString().Trim();
dgvl.Cells.Add(cell);
}
cell = new DataGridViewTextBoxCell();
cell.Value = tbl.Rows[i]["接单人"].ToString().Trim();
dgvl.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = tbl.Rows[i]["订单日期"].ToString().Trim();
dgvl.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = strPhotographyTimeEnd;
dgvl.Cells.Add(cell);
cell = new DataGridViewTextBoxCell();
cell.Value = tbl.Rows[i]["选片日期"].ToString().Trim();
dgvl.Cells.Add(cell);
#region 拍照
cell = new DataGridViewTextBoxCell();
cell.Style.BackColor = Color.LightSteelBlue;
string strPz = htData_Sights["Ordpg_PhotographyStatus"].ToString();
cell.Value = strPz;
DataRow[] dtRow1 = tblP.Select("Ordpm_Number = '" + tbl.Rows[i]["Ord_Number"].ToString().Trim() + "' and Ordpm_ViceNumber = '" + tbl.Rows[i]["Ord_ViceNumber"].ToString().Trim() + "' and Ordpm_ProcessType = '拍照'");
if (dtRow1.Length > 0)
{
string StrToolTip = "当前为(拍照)延期\r\n延 期:3天\r\n延期至:" + Convert.ToDateTime(dtRow1[0]["Ordpm_ProcessDate"]).ToString("yyyy-MM-dd") + "\r\n原 因:" + dtRow1[0]["Ordpm_ProcessRemark"].ToString().Trim().Replace("\r\n", " ");
cell.ToolTipText = StrToolTip;
}
else { cell.ToolTipText = "无"; }
if (strPz == "未拍" || strPz == "拍摄中")
{
if (dtRow1.Length > 0)
{
if (SDateTime.Now <= Convert.ToDateTime(dtRow1[0]["Ordpm_ProcessDate"]))
{ cell.Style.BackColor = Color.Orange; }
else { cell.Style.BackColor = Color.Red; }
}
else
{
if ((SDateTime.Now - Convert.ToDateTime(tbl.Rows[i]["订单日期"])).Days >= Convert.ToInt32(txtA))
{ cell.Style.BackColor = Color.Red; }
}
}
else { cell.Style.BackColor = Color.Green; }
dgvl.Cells.Add(cell);
#endregion
#region 拍完
cell = new DataGridViewTextBoxCell();
cell.Style.BackColor = Color.LightSteelBlue;
string StrNotPw = "未拍完";
if (strPz == "OK")
{ StrNotPw = "OK"; }
cell.Value = StrNotPw;//拍完
DataRow[] dtRow2 = tblP.Select("Ordpm_Number = '" + tbl.Rows[i]["Ord_Number"].ToString().Trim() + "' and Ordpm_ViceNumber = '" + tbl.Rows[i]["Ord_ViceNumber"].ToString().Trim() + "' and Ordpm_ProcessType = '拍完'");
if (dtRow2.Length > 0)
{
string StrToolTip = "当前为(拍完)延期\r\n延 期:3天\r\n延期至:" + Convert.ToDateTime(dtRow2[0]["Ordpm_ProcessDate"]).ToString("yyyy-MM-dd") + "\r\n原 因:" + dtRow2[0]["Ordpm_ProcessRemark"].ToString().Trim().Replace("\r\n", " ");
cell.ToolTipText = StrToolTip;
}
else { cell.ToolTipText = "无"; }
if (StrNotPw != "OK")
{
if (dtRow2.Length > 0)
{
if (SDateTime.Now <= Convert.ToDateTime(dtRow2[0]["Ordpm_ProcessDate"]))
{ cell.Style.BackColor = Color.Orange; }
else { cell.Style.BackColor = Color.Red; }
}
else
{
//如果未开拍,则用订单日期,如果已开拍则用开始拍照日期
if (!String.IsNullOrEmpty(strPhotographyTimeStart))
{
if ((SDateTime.Now - Convert.ToDateTime(strPhotographyTimeStart)).Days >= Convert.ToInt32(txtB))
{ cell.Style.BackColor = Color.Red; }
}
else
{
if ((SDateTime.Now - Convert.ToDateTime(tbl.Rows[i]["订单日期"])).Days >= (Convert.ToInt32(txtA) + Convert.ToInt32(txtB)))
{ cell.Style.BackColor = Color.Red; }
}
}
}
else { cell.Style.BackColor = Color.Green; }
dgvl.Cells.Add(cell);
#endregion
#region 选片
cell = new DataGridViewTextBoxCell();
cell.Style.BackColor = Color.LightSteelBlue;
cell.Value = tbl.Rows[i]["选片"].ToString().Trim();
DataRow[] dtRow3 = tblP.Select("Ordpm_Number = '" + tbl.Rows[i]["Ord_Number"].ToString().Trim() + "' and Ordpm_ViceNumber = '" + tbl.Rows[i]["Ord_ViceNumber"].ToString().Trim() + "' and Ordpm_ProcessType = '选片'");
if (dtRow3.Length > 0)
{
string StrToolTip = "当前为(选片)延期\r\n延 期:3天\r\n延期至:" + Convert.ToDateTime(dtRow3[0]["Ordpm_ProcessDate"]).ToString("yyyy-MM-dd") + "\r\n原 因:" + dtRow3[0]["Ordpm_ProcessRemark"].ToString().Trim().Replace("\r\n", " ");
cell.ToolTipText = StrToolTip;
}
else { cell.ToolTipText = "无"; }
if (tbl.Rows[i]["选片"].ToString().Trim() == "未选")
{
if (dtRow3.Length > 0)
{
if (SDateTime.Now <= Convert.ToDateTime(dtRow3[0]["Ordpm_ProcessDate"]))
{ cell.Style.BackColor = Color.Orange; }
else { cell.Style.BackColor = Color.Red; }
}
else
{
if (!String.IsNullOrEmpty(strPhotographyTimeEnd))
{
if ((SDateTime.Now - Convert.ToDateTime(strPhotographyTimeEnd)).Days >= Convert.ToInt32(txtC))
{ cell.Style.BackColor = Color.Red; }
}
else
{
if ((SDateTime.Now - Convert.ToDateTime(tbl.Rows[i]["订单日期"])).Days >= (Convert.ToInt32(txtA) + Convert.ToInt32(txtB) + Convert.ToInt32(txtC)))
{ cell.Style.BackColor = Color.Red; }
}
}
}
else { cell.Style.BackColor = Color.Green; }
dgvl.Cells.Add(cell);
#endregion
#region 看样
cell = new DataGridViewTextBoxCell();
cell.Style.BackColor = Color.LightSteelBlue;
cell.Value = tbl.Rows[i]["看样"].ToString().Trim();
DataRow[] dtRow4 = tblP.Select("Ordpm_Number = '" + tbl.Rows[i]["Ord_Number"].ToString().Trim() + "' and Ordpm_ViceNumber = '" + tbl.Rows[i]["Ord_ViceNumber"].ToString().Trim() + "' and Ordpm_ProcessType = '看样'");
if (dtRow4.Length > 0)
{
string StrToolTip = "当前为(看样)延期\r\n延 期:3天\r\n延期至:" + Convert.ToDateTime(dtRow4[0]["Ordpm_ProcessDate"]).ToString("yyyy-MM-dd") + "\r\n原 因:" + dtRow4[0]["Ordpm_ProcessRemark"].ToString().Trim().Replace("\r\n", " ");
cell.ToolTipText = StrToolTip;
}
else { cell.ToolTipText = "无"; }
if (tbl.Rows[i]["看样"].ToString().Trim() == "未看")
{
if (dtRow4.Length > 0)
{
if (SDateTime.Now <= Convert.ToDateTime(dtRow4[0]["Ordpm_ProcessDate"]))
{ cell.Style.BackColor = Color.Orange; }
else { cell.Style.BackColor = Color.Red; }
}
else
{
if (!String.IsNullOrEmpty(tbl.Rows[i]["选片日期"].ToString()))
{
if ((SDateTime.Now - Convert.ToDateTime(tbl.Rows[i]["选片日期"])).Days >= Convert.ToInt32(txtD))
{ cell.Style.BackColor = Color.Red; }
}
else
{
if (!String.IsNullOrEmpty(strPhotographyTimeEnd))
{
if ((SDateTime.Now - Convert.ToDateTime(strPhotographyTimeEnd)).Days >= (Convert.ToInt32(txtC) + Convert.ToInt32(txtD)))
{ cell.Style.BackColor = Color.Red; }
}
else
{
if (!String.IsNullOrEmpty(strPhotographyTimeStart))
{
if ((SDateTime.Now - Convert.ToDateTime(strPhotographyTimeStart)).Days >= (Convert.ToInt32(txtB) + Convert.ToInt32(txtC) + Convert.ToInt32(txtD)))
{ cell.Style.BackColor = Color.Red; }
}
else
{
if (!String.IsNullOrEmpty(tbl.Rows[i]["订单日期"].ToString()))
{
if ((SDateTime.Now - Convert.ToDateTime(tbl.Rows[i]["订单日期"])).Days >= (Convert.ToInt32(txtB) + Convert.ToInt32(txtC) + Convert.ToInt32(txtD)))
{ cell.Style.BackColor = Color.Red; }
}
}
}
}
}
}
else { cell.Style.BackColor = Color.Green; }
dgvl.Cells.Add(cell);
#endregion
#region 件齐
cell = new DataGridViewTextBoxCell();
cell.Style.BackColor = Color.LightSteelBlue;
cell.Value = tbl.Rows[i]["件齐"].ToString().Trim();
DataRow[] dtRow5 = tblP.Select("Ordpm_Number = '" + tbl.Rows[i]["Ord_Number"].ToString().Trim() + "' and Ordpm_ViceNumber = '" + tbl.Rows[i]["Ord_ViceNumber"].ToString().Trim() + "' and Ordpm_ProcessType = '件齐'");
if (dtRow5.Length > 0)
{
string StrToolTip = "当前为(件齐)延期\r\n延 期:3天\r\n延期至:" + Convert.ToDateTime(dtRow5[0]["Ordpm_ProcessDate"]).ToString("yyyy-MM-dd") + "\r\n原 因:" + dtRow5[0]["Ordpm_ProcessRemark"].ToString().Trim().Replace("\r\n", " ");
cell.ToolTipText = StrToolTip;
}
else { cell.ToolTipText = "无"; }
if (tbl.Rows[i]["件齐"].ToString().Trim() == "未齐")
{
if (dtRow5.Length > 0)
{
if (SDateTime.Now <= Convert.ToDateTime(dtRow5[0]["Ordpm_ProcessDate"]))
{ cell.Style.BackColor = Color.Orange; }
else { cell.Style.BackColor = Color.Red; }
}
else
{
if (!String.IsNullOrEmpty(tbl.Rows[i]["选片日期"].ToString()))
{
if ((SDateTime.Now - Convert.ToDateTime(tbl.Rows[i]["选片日期"])).Days >= Convert.ToInt32(txtD))
{ cell.Style.BackColor = Color.Red; }
}
else
{
if (!String.IsNullOrEmpty(strPhotographyTimeEnd))
{
if ((SDateTime.Now - Convert.ToDateTime(strPhotographyTimeEnd)).Days >= (Convert.ToInt32(txtC) + Convert.ToInt32(txtD)))
{ cell.Style.BackColor = Color.Red; }
}
else
{
if (!String.IsNullOrEmpty(strPhotographyTimeStart))
{
if ((SDateTime.Now - Convert.ToDateTime(strPhotographyTimeStart)).Days >= (Convert.ToInt32(txtB) + Convert.ToInt32(txtC) + Convert.ToInt32(txtD)))
{ cell.Style.BackColor = Color.Red; }
}
else
{
if (!String.IsNullOrEmpty(tbl.Rows[i]["订单日期"].ToString()))
{
if ((SDateTime.Now - Convert.ToDateTime(tbl.Rows[i]["订单日期"])).Days >= (Convert.ToInt32(txtB) + Convert.ToInt32(txtC) + Convert.ToInt32(txtD)))
{ cell.Style.BackColor = Color.Red; }
}
}
}
}
}
}
else { cell.Style.BackColor = Color.Green; }
dgvl.Cells.Add(cell);
#endregion
#region 取走
cell = new DataGridViewTextBoxCell();
cell.Style.BackColor = Color.LightSteelBlue;
cell.Value = tbl.Rows[i]["取走"].ToString().Trim();
DataRow[] dtRow = tblP.Select("Ordpm_Number = '" + tbl.Rows[i]["Ord_Number"].ToString().Trim() + "' and Ordpm_ViceNumber = '" + tbl.Rows[i]["Ord_ViceNumber"].ToString().Trim() + "' and Ordpm_ProcessType = '取走'");
if (dtRow.Length > 0)
{
string StrToolTip = "当前为(取走)延期\r\n延 期:3天\r\n延期至:" + Convert.ToDateTime(dtRow[0]["Ordpm_ProcessDate"]).ToString("yyyy-MM-dd") + "\r\n原 因:" + dtRow[0]["Ordpm_ProcessRemark"].ToString().Trim().Replace("\r\n", " ");
cell.ToolTipText = StrToolTip;
}
else { cell.ToolTipText = "无"; }
if (tbl.Rows[i]["取走"].ToString().Trim() == "未取")
{
if (dtRow.Length > 0)
{
if (SDateTime.Now <= Convert.ToDateTime(dtRow[0]["Ordpm_ProcessDate"]))
{ cell.Style.BackColor = Color.Orange; }
else { cell.Style.BackColor = Color.Red; }
}
else
{
if (!String.IsNullOrEmpty(tbl.Rows[i]["选片日期"].ToString()))
{
if ((SDateTime.Now - Convert.ToDateTime(tbl.Rows[i]["选片日期"])).Days >= Convert.ToInt32(txtD))
{ cell.Style.BackColor = Color.Red; }
}
else
{
if (!String.IsNullOrEmpty(strPhotographyTimeEnd))
{
if ((SDateTime.Now - Convert.ToDateTime(strPhotographyTimeEnd)).Days >= (Convert.ToInt32(txtC) + Convert.ToInt32(txtD)))
{ cell.Style.BackColor = Color.Red; }
}
else
{
if (!String.IsNullOrEmpty(strPhotographyTimeStart))
{
if ((SDateTime.Now - Convert.ToDateTime(strPhotographyTimeStart)).Days >= (Convert.ToInt32(txtB) + Convert.ToInt32(txtC) + Convert.ToInt32(txtD)))
{ cell.Style.BackColor = Color.Red; }
}
else
{
if (!String.IsNullOrEmpty(tbl.Rows[i]["订单日期"].ToString()))
{
if ((SDateTime.Now - Convert.ToDateTime(tbl.Rows[i]["订单日期"])).Days >= (Convert.ToInt32(txtB) + Convert.ToInt32(txtC) + Convert.ToInt32(txtD)))
{ cell.Style.BackColor = Color.Red; }
}
}
}
}
}
}
else { cell.Style.BackColor = Color.Green; }
dgvl.Cells.Add(cell);
#endregion
cell = new DataGridViewTextBoxCell();
cell.Value = tbl.Rows[i]["电话1"].ToString().Trim();
dgvl.Cells.Add(cell);
if (strType == "" || strType == "0")
{
cell = new DataGridViewTextBoxCell();
cell.Value = tbl.Rows[i]["电话2"].ToString().Trim();//14
dgvl.Cells.Add(cell);
}
this.dgvData.Rows.Add(dgvl);
}
#endregion
}));
}
catch
{ }
});
try
{
this.UcPagerEx1.TbDataSource = tbl;
this.dgvData.Columns["订单号"].Frozen = true;
}
catch { }
this.dgvData.ClearSelection();
return pageData.TotalCount;
}
///
/// 获取版本
///
///
public string GetVersion()
{
string RetValue = "";
if ((this.chkPortraitVersion.Checked && !this.chkKidsVersion.Checked && !this.chkDressVersion.Checked) || LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.写真版 == LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType())
{ RetValue = "2"; }
else if ((this.chkDressVersion.Checked && !this.chkKidsVersion.Checked && !this.chkPortraitVersion.Checked) || LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.婚纱版 == LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType())
{ RetValue = "0"; }
else if ((this.chkKidsVersion.Checked && !this.chkDressVersion.Checked && !this.chkPortraitVersion.Checked) || LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.儿童版 == LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType())
{ RetValue = "1"; }
else if ((!this.chkKidsVersion.Checked && !this.chkDressVersion.Checked && !this.chkPortraitVersion.Checked) || LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.旗舰版 == LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType())
{ RetValue = ""; }
return RetValue;
}
///
/// 返回要操作的条件
///
///
private string GetWhereStr()
{
string StrWhere = " 1=1 ";
string StrText = this.cmbQueryText.Text.Trim().ToLower();
if (StrText != "")
{
Hashtable htData = new Hashtable();
htData["订单号"] = "";
htData["接单人"] = "";
htData["接单人拼音"] = "";
htData["姓名1"] = "";
htData["姓名拼音1"] = "";
htData["姓名2"] = "";
htData["姓名拼音2"] = "";
htData["电话1"] = "";
htData["电话2"] = "";
string Atext = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPrefix(LYFZ.EnumPublic.OrderNumberPrefixType.儿童订单).Trim();
string Ctext = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPrefix(LYFZ.EnumPublic.OrderNumberPrefixType.婚纱订单).Trim();
string Dtext = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetPrefix(LYFZ.EnumPublic.OrderNumberPrefixType.写真订单).Trim();
bool Isbl = true;
if (Atext != "" || Ctext != "" || Dtext != "")
{
if (LYFZ.Command.Command_Validate.IsOrderNumber(StrText))
{ htData["订单号"] = "1"; Isbl = false; }
}
if (LYFZ.Command.Command_Validate.IsNumber(StrText))
{
if (Atext == "" || Ctext == "" || Dtext == "")
{ htData["订单号"] = "1"; }
htData["电话1"] = "1";
htData["电话2"] = "1";
}
else if (LYFZ.Command.Command_Validate.IsEnglish(StrText))
{
if (Atext != "" || Ctext != "" || Dtext != "")
{ htData["订单号"] = "1"; }
htData["姓名拼音1"] = "1";
htData["姓名拼音2"] = "1";
htData["接单人拼音"] = "1";
}
else if (LYFZ.Command.Command_Validate.IsChinese(StrText))
{
htData["姓名1"] = "1";
htData["姓名2"] = "1";
htData["接单人"] = "1";
}
else if (Isbl)
{
htData["订单号"] = "1";
htData["姓名1"] = "1";
htData["姓名拼音1"] = "1";
htData["姓名2"] = "1";
htData["姓名拼音2"] = "1";
htData["电话1"] = "1";
htData["电话2"] = "1";
htData["接单人"] = "1";
htData["接单人拼音"] = "1";
}
string strV = "";
int i = 0;
foreach (DictionaryEntry dic in htData)
{
if (dic.Value.ToString().Trim() != "")
{
if (i == 0)
{ strV += dic.Key + " like '%" + StrText + "%'"; }
else
{ strV += " or " + dic.Key + " like '%" + StrText + "%'"; }
i++;
}
}
if (strV != "")
{ StrWhere += " and (" + strV + ")"; }
}
if (!IsChk)
{
if (IsPortrait)
{
if (LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.婚纱版 == LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType())
{ StrWhere += " And Ord_Type in ('" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.婚纱订单) + "','" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.写真订单) + "')"; }
else if (LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.儿童版 == LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType())
{ StrWhere += " And Ord_Type in ('" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.儿童订单) + "','" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.写真订单) + "')"; }
else if (LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.旗舰版 == LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType())
{ StrWhere += " And Ord_Type in ('" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.婚纱订单) + "','" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.儿童订单) + "','" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.写真订单) + "')"; }
}
else
{
if (LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.婚纱版 == LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType())
{ StrWhere += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.婚纱订单) + "'"; }
else if (LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.儿童版 == LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType())
{ StrWhere += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.儿童订单) + "'"; }
else if (LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.旗舰版 == LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType())
{ StrWhere += " And Ord_Type in ('" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.婚纱订单) + "','" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.儿童订单) + "')"; }
}
}
else
{
if (this.chkDressVersion.Checked)
{ StrWhere += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.婚纱订单) + "'"; }
else if (this.chkKidsVersion.Checked)
{ StrWhere += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.儿童订单) + "'"; }
else if (this.chkPortraitVersion.Checked)
{ StrWhere += " And Ord_Type = '" + Convert.ToInt32(LYFZ.EnumPublic.OrderType.写真订单) + "'"; }
}
return StrWhere;
}
///
/// 查询
///
///
///
protected override void btnQuery_Click(object sender, EventArgs e)
{ PublicFunctionRows(); }
///
/// 预警设置
///
///
///
protected override void btnWarningSet_Click(object sender, EventArgs e)
{
LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.SetProcessAlertSuperSmallForm frm = new SuperSmallForm.SetProcessAlertSuperSmallForm();
frm.ShowDialog();
if (frm.IsSave)
{ PublicFunctionRows(); }
}
///
/// 导出
///
///
///
protected override void btnExport_Click(object sender, EventArgs e)
{ this.dgvData.ExportDataTable(); }
///
/// 关闭
///
///
///
protected override void btnClose_Click(object sender, EventArgs e)
{ this.Close(); }
///
/// 婚纱版
///
///
///
protected override void chkDressVersion_Click(object sender, EventArgs e)
{
if (this.chkDressVersion.Checked)
{ this.chkPortraitVersion.Checked = false; this.chkKidsVersion.Checked = false; this.chkDressVersion.Checked = true; this.IsChk = true; }
else { this.IsChk = false; }
PublicFunctionRows();
}
///
/// 儿童版
///
///
///
protected override void chkKidsVersion_Click(object sender, EventArgs e)
{
if (this.chkKidsVersion.Checked)
{ this.chkPortraitVersion.Checked = false; this.chkKidsVersion.Checked = true; this.chkDressVersion.Checked = false; this.IsChk = true; }
else { this.IsChk = false; }
PublicFunctionRows();
}
///
/// 写真版
///
///
///
protected override void chkPortraitVersion_Click(object sender, EventArgs e)
{
if (this.chkPortraitVersion.Checked)
{ this.chkPortraitVersion.Checked = true; this.chkKidsVersion.Checked = false; this.chkDressVersion.Checked = false; this.IsChk = true; }
else { this.IsChk = false; }
PublicFunctionRows();
}
///
/// 双击事件
///
///
///
protected override void dgvData_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
{
if (this.dgvData.Rows.Count > 0)
{
if (e.RowIndex != -1 && e.ColumnIndex != -1)
{
#region 权限
//if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.ProcessMonitoring, LYFZ.CustomAttributes.OperatingAuthority.Monitor_Postpone))
//{ return; }
#endregion
if (this.dgvData.CurrentRow.Cells[e.ColumnIndex].Value.ToString().Trim().ToLower() != "ok")
{
LYFZ.Software.MainBusiness.CameraControlBook.SuperSmallForm.ProcessExtensionSetSuperSmallForm frm = new SuperSmallForm.ProcessExtensionSetSuperSmallForm();
frm.StrNumber = this.dgvData.CurrentRow.Cells["strNumber"].Value.ToString().Trim();
frm.StrViceNumber = this.dgvData.CurrentRow.Cells["strViceNumber"].Value.ToString().Trim();
frm.StrType = this.dgvData.Columns[e.ColumnIndex].HeaderText.Trim();
frm.ShowDialog();
if (frm.IsSaveed)
{ this.PublicFunctionRows(); }
}
}
}
}
///
/// 窗体大小发生变化事件
///
///
///
protected override void ProcessMonitorFormMain_Resize(object sender, EventArgs e)
{
if (!IsFirstRun)
{
int ControlsWidth = 0;
int ForCount = 0;
for (int i = 0; i < this.flowLayoutPanel1.Controls.Count; i++)
{
if (this.flowLayoutPanel1.Controls[i].Visible)
{
ForCount++;
ControlsWidth += this.flowLayoutPanel1.Controls[i].Width;
}
}
ControlsWidth += ForCount * 6 + this.btnClose.Width / 2;
int strWidth = this.Width;
if (strWidth > ControlsWidth)
{
this.flowLayoutPanel1.Height = 34;
//this.flowLayoutPanel1.Size = new Size(this.panelEx2.Width - 10, 34);
//this.panelEx2.Location = new Point(0, 50);
//this.dgvData.Location = new Point(this.dgvData.Location.X, 61);
//this.dgvData.Size = new Size(this.panelEx2.Width - (this.dgvData.Location.X * 2), this.panelEx1.Height - this.dgvData.Location.Y - this.ucPagerEx1.Height - 5);
}
else
{
this.flowLayoutPanel1.Height = 70;
//this.flowLayoutPanel1.Size = new Size(this.panelEx2.Width - 10, 70);
//this.panelEx2.Location = new Point(0, 85);
//this.dgvData.Location = new Point(this.dgvData.Location.X, 95);
//this.dgvData.Size = new Size(this.panelEx2.Width - (this.dgvData.Location.X * 2), this.panelEx1.Height - this.dgvData.Location.Y - this.ucPagerEx1.Height - 5);
}
}
}
}
}