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.

163 lines
5.1 KiB

3 years ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Stone.Common;
using Stone.Entity;
using Stone.WinBiz.JISAdmin;
using Gm_WMS.DataAccess.DataService;
using System.IO;
namespace Stone.WinModule.JISAdmin
{
public partial class frmEdiPlan : Stone.WinModule.frmBase
{
public frmEdiPlan()
{
InitializeComponent();
try
{
this.txtPackageGroupName.DataSource = new Entity_t_Sys_AppconfigItem().GetData("Code='print_group' and Value1 is not null").Tables[0];
this.txtPackageGroupName.ValueMember = "Value1";
this.txtPackageGroupName.DisplayMember = "Value1";
}
catch (Exception ex)
{
MyMessageBox.ShowErrorMessage(ex.Message);
}
}
private void frmEdiPrintAssemble_Load(object sender, EventArgs e)
{
}
private void btnQuery_Click(object sender, EventArgs e)
{
try
{
string PackageGroupName = this.txtPackageGroupName.SelectedValue.ToString();
string d = MyDateTime.Format(this.dateTimePicker2.Value, MyDateTimeType.Date) + " 23:59:59";
string strWhere = "[PackageGroupName]='{0}' and [IsFix]=0 and [SwetTime]<='{1}'";
object[] obj = new object[10];
obj[0] = PackageGroupName;
obj[1] = d;
strWhere = string.Format(strWhere, obj);
Entity_t_JIS_Seq5000 t_JIS_Seq5000 = new Entity_t_JIS_Seq5000();
this.dgrdView1.DataSource = t_JIS_Seq5000.GetData("", strWhere, "[SequenceNumber] asc").Tables[0];
MyGridViewStyle.SetDataGridRowNumber(this.dgrdView1);
MyGridViewStyle.SetDataGridMenuCommon(this.dgrdView1);
MyGridViewStyle.GetGridViewState(this.dgrdView1, this.Text);
this.dgrdView1.Columns["ID"].Visible = false;
this.dgrdView1.Columns["SequenceNumber"].HeaderText = "EINSTEIN Seq";
this.lblShow.Text = "记录:" + this.dgrdView1.Rows.Count;
}
catch (Exception ex)
{
MyMessageBox.ShowErrorMessage(ex.Message);
}
}
private void btnSet_Click(object sender, EventArgs e)
{
MyGridViewStyle.Show(this.dgrdView1, this.Text);
}
private void btnOutPut_Click(object sender, EventArgs e)
{
try
{
Stone.Common.MyExport.ShowExport(this.dgrdView1);
}
catch (Exception ex)
{
MyMessageBox.ShowInfoMessage(ex.Message);
}
}
private void frmEdiPrintAssemble_FormClosing(object sender, FormClosingEventArgs e)
{
try
{
MyGridViewStyle.SaveGridViewState(this.dgrdView1, this.Text);
}
catch
{
}
}
private void btnOK_Click(object sender, EventArgs e)
{
try
{
if (this.dgrdView1.Rows.Count == 0) throw new Exception("请查询出要确定的记录");
string PackageGroupName = this.txtPackageGroupName.SelectedValue.ToString();
if (!MyMessageBox.ShowQuestion("是否要确定 [" + PackageGroupName + "]" + this.dateTimePicker2.Value.ToString("yyyy-MM-dd") + "(包含)之前的数据?")) return;
btnQuery_Click(new object(), new EventArgs());
string d = this.dateTimePicker2.Value.ToString("yyyy-MM-dd") + " 23:59:59";
string strWhere = "[PackageGroupName]='{0}' and [IsFix]=0 and [SwetTime]<='{1}'";
object[] obj = new object[10];
obj[0] = PackageGroupName;
obj[1] = d;
strWhere = string.Format(strWhere, obj);
Entity_t_JIS_Seq5000 t_JIS_Seq5000 = new Entity_t_JIS_Seq5000();
DataTable dtData = t_JIS_Seq5000.GetData("", strWhere, "[SequenceNumber] asc").Tables[0];
if (dtData.Rows.Count == 0) throw new Exception("没有数据,请重新选择日期查询");
int min_number = Convert.ToInt32(dtData.Rows[0]["CheckSequence"]);
int max_number = Convert.ToInt32(dtData.Rows[dtData.Rows.Count - 1]["CheckSequence"]);
if (max_number - min_number != dtData.Rows.Count - 1)
{
if (!MyMessageBox.ShowQuestion("数据不连续,是否要继续发布?")) return;
t_JIS_Seq5000.Edit("[IsFix]=1, [FixTime]=getdate()", strWhere);
}
else
{
t_JIS_Seq5000.Edit("[IsFix]=1, [FixTime]=getdate()", strWhere);
}
btnQuery_Click(new object(), new EventArgs());
}
catch (Exception ex)
{
MyMessageBox.ShowErrorMessage(ex.Message);
}
}
}
}