You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
258 lines
8.6 KiB
258 lines
8.6 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Data.Linq;
|
|
using System.Linq;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using DevExpress.XtraEditors;
|
|
using DevExpress.XtraGrid.Views.BandedGrid;
|
|
using DevExpress.XtraGrid.Columns;
|
|
using DevExpress.XtraGrid;
|
|
using System.IO;
|
|
using System.Threading;
|
|
using ICSSoft.Base.Language.Tool;
|
|
using ICSSoft.Base.Config.AppConfig;
|
|
using ICSSoft.Base.UserControl.MessageControl;
|
|
using ICSSoft.Base.Config.DBHelper;
|
|
using ICSSoft.Base.Report.Filter;
|
|
using ICSSoft.Base.UserControl.FormControl;
|
|
using ICSSoft.Base.Report.GridReport;
|
|
using ICSSoft.Base.ReferForm.AppReferForm;
|
|
using ICSSoft.Frame.Data.BLL;
|
|
|
|
namespace ICSSoft.Frame.APP
|
|
{
|
|
public partial class FormMatter : DevExpress.XtraEditors.XtraForm
|
|
{
|
|
String guid = AppConfig.GetGuid();
|
|
private DataTable dt = null;
|
|
|
|
#region 构造函数
|
|
public FormMatter()
|
|
{
|
|
InitializeComponent();
|
|
this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
|
|
this.WindowState = FormWindowState.Maximized;
|
|
}
|
|
#endregion
|
|
|
|
#region 操作权限
|
|
public DataTable RightOfExute()
|
|
{
|
|
DataTable rData = new DataTable();
|
|
rData.Columns.Add("BtnName");
|
|
rData.Columns.Add("ActionName");
|
|
//查看权限(必须有)
|
|
DataRow seeRow = rData.NewRow();
|
|
seeRow["BtnName"] = "see";
|
|
seeRow["ActionName"] = "查看";
|
|
rData.Rows.Add(seeRow);
|
|
List<Control> ControlList = new List<Control>();
|
|
ControlList.Add(btnRefresh);
|
|
ControlList.Add(btnShow);
|
|
foreach (Control ctr in ControlList)
|
|
{
|
|
if (ctr.GetType() == typeof(SimpleButton))
|
|
{
|
|
DataRow dr = rData.NewRow();
|
|
dr["BtnName"] = ctr.Name;
|
|
dr["ActionName"] = ctr.Text;
|
|
rData.Rows.Add(dr);
|
|
}
|
|
}
|
|
rData.AcceptChanges();
|
|
return rData;
|
|
}
|
|
|
|
public DataTable RightOfData()// 数据权限
|
|
{
|
|
DataTable rData = new DataTable();
|
|
rData.Columns.Add("BodyName");
|
|
rData.Columns.Add("ControlName");
|
|
rData.Columns.Add("ControlCaption");
|
|
rData.AcceptChanges();
|
|
return rData;
|
|
}
|
|
#endregion
|
|
|
|
#region 退出
|
|
private void btnClose_Click(object sender, EventArgs e)
|
|
{
|
|
AppConfig.CloseFormShow(this.Text);
|
|
this.Close();
|
|
}
|
|
#endregion
|
|
|
|
#region 分页
|
|
private void rptPage_PageIndexChanged(object Sender, EventArgs e)
|
|
{
|
|
DataTable data = AppConfig.GetPageData(dt, rptPage.PageIndex, rptPage.PageSize).Copy();
|
|
grdDetail.DataSource = data;
|
|
}
|
|
#endregion
|
|
|
|
private void FormMatter_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
}
|
|
|
|
private void FormMatter_Load(object sender, EventArgs e)
|
|
{
|
|
//this.tRefresh.Interval = 24 * 60 * 60 * 1000;
|
|
//this.tRefresh.Enabled = true;
|
|
this.loadData();
|
|
this.Check.Interval = 60 * 1000;
|
|
this.CheckDate.Enabled = true;
|
|
this.CheckDate.Interval = 60 * 1000;
|
|
}
|
|
|
|
public void loadData()
|
|
{
|
|
string sql = @"select distinct
|
|
c.LotNO,
|
|
d.WHCode,
|
|
e.StorageName,
|
|
d.BinCode,
|
|
f.StackName,
|
|
a.INVCODE,
|
|
b.INVNAME,
|
|
b.INVDESC,
|
|
b.INVUOM,
|
|
d.LotQty,
|
|
a.EATTRIBUTE1,
|
|
case when isnull(d.MTIME,0)=0 then '' when isnull(a.EATTRIBUTE1,0) = 0 then d.MTIME ELSE DATEADD(day,cast(a.EATTRIBUTE1 as int),d.MTIME)
|
|
end as daytime,
|
|
d.MTIME,
|
|
a.MUSERName,
|
|
a.MTIME 维护时间
|
|
FROM dbo.ICSWareHouseLotInfo d
|
|
inner join ICSITEMLot c on c.LotNO = d.LotNO
|
|
inner join dbo.ICSINVInfo a on a.INVCODE = d.INVCODE
|
|
inner join ICSINVENTORY b on a.INVCODE = b.INVCODE
|
|
LEFT JOIN dbo.ICSStorage e ON d.WHCode = e.StorageCode
|
|
left JOIN dbo.ICSStack f ON d.BinCode = f.StackCode
|
|
where 1=1 and a.INVCODE<> '' and c.LotNO <> '' and d.WHCode = '0300' and d.LotQty <> '0.00'
|
|
order by d.MTIME";
|
|
sql = string.Format(sql, AppConfig.WorkPointCode);
|
|
dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
|
|
grdDetail.DataSource = dt;
|
|
grvDetail.BestFitColumns();
|
|
rptPage.RecordNum = dt.Rows.Count;
|
|
rptPage.PageSize = 499;
|
|
rptPage.PageIndex = 1;
|
|
rptPage.ReLoad();
|
|
rptPage.PageSize = 500;
|
|
rptPage.PageIndex = 1;
|
|
rptPage.ReLoad();
|
|
}
|
|
|
|
private void grvDetail_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
|
|
{
|
|
if (e.RowHandle >= 0 && e.Column.FieldName == "DCTCODE")
|
|
{
|
|
e.CellValue = "cccc";
|
|
}
|
|
}
|
|
|
|
private void btnRefresh_Click(object sender, EventArgs e)
|
|
{
|
|
this.dt.Clear();
|
|
this.grdDetail.DataSource = null;
|
|
this.loadData();
|
|
}
|
|
|
|
private void tRefresh_Tick(object sender, EventArgs e)
|
|
{
|
|
this.btnRefresh_Click(sender, e);
|
|
}
|
|
|
|
private void btnShow_Click(object sender, EventArgs e)
|
|
{
|
|
SimpleButton btntemp = (SimpleButton)sender;
|
|
if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
|
|
return;
|
|
}
|
|
try
|
|
{
|
|
if (dt.Rows.Count > 0 && dt != null)
|
|
{
|
|
FormMatterShow show = new FormMatterShow(dt);
|
|
show.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("为查询到原材料信息");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
|
|
}
|
|
}
|
|
|
|
private void Show()
|
|
{
|
|
try
|
|
{
|
|
FormMatterShow show = new FormMatterShow(dt);
|
|
show.ShowDialog();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
|
|
}
|
|
}
|
|
|
|
private void grvDetail_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
|
|
{
|
|
int hand = e.RowHandle;
|
|
if (hand < 0) return;
|
|
DataRow dr = this.grvDetail.GetDataRow(hand);
|
|
if (dr == null) return;
|
|
if (((DateTime)dr["daytime"] - DateTime.Now).Days <= 3)
|
|
{
|
|
e.Appearance.BackColor = Color.Red;// 改变行背景颜色
|
|
//根据需求
|
|
}
|
|
else if (((DateTime)dr["daytime"] - DateTime.Now).Days <= 7)
|
|
{
|
|
e.Appearance.BackColor = Color.Yellow;// 改变行背景颜色
|
|
//根据需求
|
|
}
|
|
}
|
|
|
|
private void Check_Tick(object sender, EventArgs e)
|
|
{
|
|
string str1 = DateTime.Now.ToString("yyyyMMdd") + "000200";
|
|
string str2 = DateTime.Now.ToString("yyyyMMdd") + "000300";
|
|
IFormatProvider format = new System.Globalization.CultureInfo("zh-CN");
|
|
string TarStr = "yyyyMMddHHmmss"; //注意这里用到HH
|
|
DateTime MyDate1 = DateTime.ParseExact(str1, TarStr, format);
|
|
DateTime MyDate2 = DateTime.ParseExact(str2, TarStr, format);
|
|
if (MyDate1 < DateTime.Now && DateTime.Now <= MyDate2)
|
|
{
|
|
this.btnRefresh_Click(sender, e);
|
|
this.Show();
|
|
this.Check.Enabled = false;
|
|
}
|
|
}
|
|
|
|
private void CheckDate_Tick(object sender, EventArgs e)
|
|
{
|
|
string str1 = DateTime.Now.ToString("yyyyMMdd") + "000100";
|
|
string str2 = DateTime.Now.ToString("yyyyMMdd") + "000200";
|
|
IFormatProvider format = new System.Globalization.CultureInfo("zh-CN");
|
|
string TarStr = "yyyyMMddHHmmss"; //注意这里用到HH
|
|
DateTime MyDate1 = DateTime.ParseExact(str1, TarStr, format);
|
|
DateTime MyDate2 = DateTime.ParseExact(str2, TarStr, format);
|
|
if (MyDate1 < DateTime.Now && DateTime.Now <= MyDate2)
|
|
{
|
|
this.Check.Enabled = true;
|
|
}
|
|
}
|
|
}
|
|
}
|