北京安通林JIS系统
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.
 
 
 

182 lines
5.1 KiB

using Stone.Common;
using Stone.WinBiz.JisData;
using Stone.WinModule.BasicData;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Text;
using System.Windows.Forms;
namespace Stone.WinModule.JisData
{
public partial class frmPJIS : Stone.WinModule.BasicData.frmBaseMain
{
private ToolStripButton btnError = null;
private ToolStripButton btnFile = null;
public frmPJIS()
{
InitializeComponent();
base.ReadOnly();
this.txtD1.Value = DateTime.Now.AddDays(-15);
this.txtD2.Value = DateTime.Now.AddMonths(1);
base.lblStateRecord.SendToBack();
if (User.UserInfo.UserVerify("001")) //错误处理小权限
{
btnError = base.CreateButton("错误处理", 4, 0);
btnError.Click += btnError_Click;
}
btnFile = base.CreateButton("定位到文件", 5, 0);
btnFile.Click += btnFile_Click;
}
private void btnFile_Click(object sender, EventArgs e)
{
try
{
if(this.dgrdView.SelectedRows.Count > 0)
{
string filename = this.dgrdView.SelectedRows[0].Cells["filename"].Value.ToString();
if (!File.Exists(filename))
throw new Exception($"{filename}在系统中不存在,请在服务器上执行该功能");
MyIO.ExplorerFile(filename);
}
else
{
throw new Exception("请选择一条记录");
}
}
catch(Exception ex)
{
MyMessageBox.ShowErrorMessage(ex.Message);
}
}
private void frmPJIS_Load(object sender, EventArgs e)
{
try
{
//if (((F_PJIS)m_Base).type == "1")
//{
// if (btnError != null) btnError.Visible = false;
//}
}
catch (Exception ex)
{
MyMessageBox.ShowErrorMessage(ex.Message);
}
}
private void btnError_Click(object sender, EventArgs e)
{
try
{
if (this.dgrdView.SelectedRows.Count > 0)
{
int ID = Convert.ToInt32(this.dgrdView.SelectedRows[0].Cells["ID"].Value);
DataTable dtData = m_Base.entity.GetData($"[ID]={ID}").Tables[0];
if (dtData.Rows.Count == 0) throw new Exception("选择的记录不存在");
if( Convert.ToBoolean( dtData.Rows[0]["IsError"]) == false)
{
throw new Exception("选择记录的没有错误,不能处理");
}
if (((F_PJIS)m_Base).jistype == 0) //门板
{
frmPJISError frm = new frmPJISError();
frm.m_Base = m_Base;
if (frm.ShowEdit(ID) == DialogResult.OK)
{
UpdateGridView();
}
frm.Dispose();
}
else
{
frmPJISErrorCarpet frm = new frmPJISErrorCarpet();
frm.m_Base = m_Base;
if (frm.ShowEdit(ID) == DialogResult.OK)
{
UpdateGridView();
}
frm.Dispose();
}
}
else
{
throw new Exception("请选择一条要处理错误的记录!");
}
}
catch (Exception ex)
{
MyMessageBox.ShowErrorMessage(ex.Message);
}
}
public override void Search(string code)
{
if(code != "")
{
strWhere = $"[ProductionNo]='{code}'";
strWhere += $" or [filename]='{code}'";
}
else
{
strWhere = "1=1";
}
if(chkError.Checked)
{
strWhere = $"[IsError]=1 and ({strWhere})";
}
}
public override void UpdateGridView()
{
string dateWhere = "";
if (m_Base.dateWhere != "")
{
this.txtD1.Visible = true;
this.txtD2.Visible = true;
dateWhere = m_Base.dateWhere;
dateWhere = string.Format(dateWhere, this.txtD1.Value.ToString("yyyyMMdd0000"), this.txtD2.Value.ToString("yyyyMMdd2359"));
dateWhere = " and (" + dateWhere + ")";
}
m_Base.BindPageData("(" + strWhere + ") " + dateWhere);
m_Base.GetView(this.dgrdView);
this.lblStateRecord.Text = "记录数:" + this.dgrdView.Rows.Count;
}
}
}