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.
198 lines
7.7 KiB
198 lines
7.7 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;
|
||
|
|
||
|
namespace Stone.WinModule.JISAdmin
|
||
|
{
|
||
|
public partial class frmEdiPrintPackingList : Stone.WinModule.frmBase
|
||
|
{
|
||
|
public frmEdiPrintPackingList()
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
}
|
||
|
|
||
|
private void frmEdiPrintPackingList_Load(object sender, EventArgs e)
|
||
|
{
|
||
|
if (User.UserInfo.UserName.ToLower() == "admin")
|
||
|
{
|
||
|
this.btnPrintHand.Visible = true;
|
||
|
}
|
||
|
|
||
|
this.cbFields.SelectedIndex = 0;
|
||
|
|
||
|
this.timer1.Interval = Convert.ToInt32(MyAppconfig.ReadValue("EDI显示刷新时间")) * 1000;
|
||
|
this.timer1.Enabled = true;
|
||
|
}
|
||
|
|
||
|
private void btnQuery_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
string PackageGroupName = ""; if (rbType1.Checked) PackageGroupName = rbType1.Text; if (rbType2.Checked) PackageGroupName = rbType2.Text; if (rbType3.Checked) PackageGroupName = rbType3.Text; if (rbType4.Checked) PackageGroupName = rbType4.Text; if (rbType5.Checked) PackageGroupName = rbType5.Text;
|
||
|
|
||
|
string Fields = this.cbFields.SelectedItem.ToString();
|
||
|
string value = this.txtKey.Text.Trim();
|
||
|
|
||
|
string d1 = MyDateTime.Format(this.dateTimePicker1.Value, MyDateTimeType.Date) + " 00:00:00";
|
||
|
string d2 = MyDateTime.Format(this.dateTimePicker2.Value, MyDateTimeType.Date) + " 23:59:59";
|
||
|
|
||
|
string strWhere = "[PackageGroupName]='{4}' and [IsPrintAssemble]=1 and [IsPrintPackingList]={0} and [SwetTime]>='{1}' and [SwetTime]<='{2}' {3}";
|
||
|
object[] obj = new object[10];
|
||
|
obj[0] = rbPrint1.Checked ? "1" : "0";
|
||
|
obj[1] = d1;
|
||
|
obj[2] = d2;
|
||
|
obj[3] = " and " + Fields + "='" + value + "'";
|
||
|
obj[4] = PackageGroupName;
|
||
|
if (value == "") obj[3] = "";
|
||
|
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, [SwetTime] asc").Tables[0];
|
||
|
MyGridViewStyle.SetDataGridRowNumber(this.dgrdView1);
|
||
|
MyGridViewStyle.SetDataGridMenuCommon(this.dgrdView1);
|
||
|
MyGridViewStyle.GetGridViewState(this.dgrdView1, "JIS装箱单");
|
||
|
this.dgrdView1.Columns["ID"].Visible = false;
|
||
|
this.dgrdView1.Columns["SequenceNumber"].HeaderText = "EINSTEIN Seq";
|
||
|
|
||
|
|
||
|
this.lblState.Text = "记录:" + this.dgrdView1.Rows.Count.ToString();
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
this.lblShow.Text = ex.Message;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void btnPrintHand_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
if (!MyMessageBox.ShowQuestion("请按Sift或Ctrl键选择需要手动打印的多条记录,是否要手动打印?")) return;
|
||
|
if (this.dgrdView1.SelectedRows.Count == 0) throw new Exception("请选择需要打印的多条记录!");
|
||
|
|
||
|
string ids = "";
|
||
|
for (int i = 0; i < this.dgrdView1.SelectedRows.Count; i++)
|
||
|
{
|
||
|
ids += this.dgrdView1.SelectedRows[i].Cells["ID"].Value.ToString() + ",";
|
||
|
}
|
||
|
if (ids.Length > 0) ids = ids.Substring(0, ids.Length - 1);
|
||
|
string strWhere = "[ID] in (" + ids + ")";
|
||
|
|
||
|
Gm_WMS.DataAccess.DataService.LocalDBService db = new Gm_WMS.DataAccess.DataService.LocalDBService();
|
||
|
Entity_t_JIS_Seq5000 t_JIS_Seq5000 = new Entity_t_JIS_Seq5000();
|
||
|
DataSet dsData = t_JIS_Seq5000.GetData("", strWhere, "[SequenceNumber] asc, [SwetTime] asc");
|
||
|
if (dsData.Tables[0].Select("[IsPrintPackingList]=1").Length > 0)
|
||
|
throw new Exception("选择的记录中有已经打印的数据,请刷新数据!");
|
||
|
dsData.Tables[0].TableName = "BillHead";
|
||
|
|
||
|
string PackageGroupName = dsData.Tables[0].Rows[0]["PackageGroupName"].ToString();
|
||
|
string BillNo = F_JIS5000_Print.GetPackingListNumber(db, PackageGroupName);
|
||
|
string PagerNumber = F_JIS5000_Print.GetNumber(db, PackageGroupName, 2);
|
||
|
|
||
|
for (int i = 0; i < dsData.Tables[0].Rows.Count; i++)
|
||
|
{
|
||
|
t_JIS_Seq5000.Edit("[IsPrintPackingList]=1, [PackingListNumber]='" + BillNo + "', [PagerNumber]='" + PagerNumber + "'", "[ID]=" + dsData.Tables[0].Rows[i]["ID"].ToString());
|
||
|
}
|
||
|
|
||
|
F_JIS5000_Print.PrintPackingList(dsData, BillNo, PackageGroupName, PagerNumber);
|
||
|
|
||
|
btnQuery_Click(new object(), new EventArgs());
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
MyMessageBox.ShowErrorMessage(ex.Message);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void btnRePrint_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
if (MyMessageBox.ShowQuestion("请选择一条已经打印数据,是否要补打?"))
|
||
|
{
|
||
|
string PackingListNumber = this.dgrdView1.SelectedRows[0].Cells["PackingListNumber"].Value.ToString();
|
||
|
|
||
|
Entity_t_JIS_Seq5000 t_Edi_CallOff = new Entity_t_JIS_Seq5000();
|
||
|
|
||
|
DataSet dsData = t_Edi_CallOff.GetData("", "[PackingListNumber]='" + PackingListNumber + "'", "[SequenceNumber] asc, [SwetTime] asc");
|
||
|
if (dsData.Tables[0].Rows.Count == 0)
|
||
|
throw new Exception(PackingListNumber + " 单据中没有可打印的数据!");
|
||
|
|
||
|
string PackageGroupName = dsData.Tables[0].Rows[0]["PackageGroupName"].ToString();
|
||
|
string PagerNumber = dsData.Tables[0].Rows[0]["PagerNumber"].ToString();
|
||
|
|
||
|
F_JIS5000_Print.PrintPackingList(dsData, PackingListNumber, PackageGroupName, PagerNumber);
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
MyMessageBox.ShowErrorMessage(ex.Message);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void btnSet_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
MyGridViewStyle.Show(this.dgrdView1, "JIS装箱单");
|
||
|
}
|
||
|
|
||
|
private void btnOutPut_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
Stone.Common.MyExport.ShowExport(this.dgrdView1);
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
MyMessageBox.ShowInfoMessage(ex.Message);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void chkAuto_CheckedChanged(object sender, EventArgs e)
|
||
|
{
|
||
|
AutoUpdate();
|
||
|
}
|
||
|
|
||
|
private void AutoUpdate()
|
||
|
{
|
||
|
if (chkAuto.Checked)
|
||
|
{
|
||
|
this.lblShow.Text = "自动刷新中...";
|
||
|
this.Update();
|
||
|
|
||
|
btnQuery_Click(new object(), new EventArgs());
|
||
|
|
||
|
this.lblShow.Text = DateTime.Now.ToString() + " 自动刷新完成,下次刷新 " + Convert.ToString(this.timer1.Interval / 1000) + " 秒以后";
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
this.lblShow.Text = "自动刷新关闭";
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
private void frmEdiPrintPackingList_FormClosed(object sender, FormClosedEventArgs e)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
MyGridViewStyle.SaveGridViewState(this.dgrdView1, "JIS装箱单");
|
||
|
}
|
||
|
catch
|
||
|
{
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|