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.
612 lines
26 KiB
612 lines
26 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;
|
|
using ICSSoft.Base.Lable.PrintTool;
|
|
using DevExpress.XtraPrinting;
|
|
using ICSSoft.Frame.Data.Entity;
|
|
|
|
namespace ICSSoft.Frame.APP
|
|
{
|
|
public partial class FormICSItemBackNew : DevExpress.XtraEditors.XtraForm
|
|
{
|
|
private string sqltxt = "";
|
|
private string sqlconn = "";
|
|
String guid = AppConfig.GetGuid();
|
|
private DataTable dataSource = null;
|
|
private DataTable dataSourceAll = null;
|
|
private string MoId = "";
|
|
private string MoCode = "";
|
|
private decimal Qty = 0.00m;
|
|
|
|
#region 构造函数
|
|
public FormICSItemBackNew()
|
|
{
|
|
InitializeComponent();
|
|
this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
|
|
this.WindowState = FormWindowState.Maximized;
|
|
|
|
}
|
|
public FormICSItemBackNew(string moID, string moCode, decimal qty)
|
|
{
|
|
InitializeComponent();
|
|
this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
|
|
this.WindowState = FormWindowState.Maximized;
|
|
MoId = moID;
|
|
MoCode = moCode;
|
|
Qty = qty;
|
|
|
|
}
|
|
#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(btnPrint);
|
|
ControlList.Add(btnOutPut);
|
|
ControlList.Add(btnModify);
|
|
//ControlList.Add(btnCreate);
|
|
ControlList.Add(simpleButton1);
|
|
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();
|
|
}
|
|
|
|
private void btnExit_Click(object sender, EventArgs e)
|
|
{
|
|
AppConfig.CloseFormShow(this.Text);
|
|
this.Close();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 移动窗体
|
|
private const int WM_NCHITTEST = 0x84;
|
|
private const int HTCLIENT = 0x1;
|
|
private const int HTCAPTION = 0x2;
|
|
//首先必须了解Windows的消息传递机制,当有鼠标活动消息时,
|
|
//系统发送WM_NCHITTEST 消息给窗体作为判断消息发生地的根据。 nchittest
|
|
//假如你点击的是标题栏,窗体收到的消息值就是 HTCAPTION ,
|
|
//同样地,若接受到的消息是 HTCLIENT,说明用户点击的是客户区,也就是鼠标消息发生在客户区。
|
|
|
|
//重写窗体,使窗体可以不通过自带标题栏实现移动
|
|
protected override void WndProc(ref Message m)
|
|
{
|
|
|
|
|
|
//当重载窗体的 WndProc 方法时,可以截获 WM_NCHITTEST 消息并改些该消息,
|
|
//当判断鼠标事件发生在客户区时,改写改消息,发送 HTCAPTION 给窗体,
|
|
//这样,窗体收到的消息就时 HTCAPTION ,在客户区通过鼠标来拖动窗体就如同通过标题栏来拖动一样。
|
|
//注意:当你重载 WndProc 并改写鼠标事件后,整个窗体的鼠标事件也就随之改变了。
|
|
switch (m.Msg)
|
|
{
|
|
case WM_NCHITTEST:
|
|
base.WndProc(ref m);
|
|
if ((int)m.Result == HTCLIENT)
|
|
m.Result = (IntPtr)HTCAPTION;
|
|
return;
|
|
}
|
|
//拦截双击标题栏、移动窗体的系统消息
|
|
if (m.Msg != 0xA3)
|
|
{
|
|
base.WndProc(ref m);
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region 列表
|
|
private void grvDetail_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
|
|
{
|
|
if (e.Info.IsRowIndicator && e.RowHandle >= 0)
|
|
e.Info.DisplayText = (e.RowHandle + 1).ToString();
|
|
}
|
|
#endregion
|
|
|
|
#region 双击
|
|
private void grvDetail_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
if (grvDetail.FocusedRowHandle < 0)
|
|
{
|
|
return;
|
|
}
|
|
if (grvDetail.FocusedColumn == colisSelect)
|
|
{
|
|
if (grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, colisSelect).ToString() == "")
|
|
{
|
|
grvDetail.SetRowCellValue(grvDetail.FocusedRowHandle, colisSelect, "Y");
|
|
}
|
|
else
|
|
{
|
|
grvDetail.SetRowCellValue(grvDetail.FocusedRowHandle, colisSelect, "");
|
|
}
|
|
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
//加载
|
|
private void FormICSItemBackNew_Load(object sender, EventArgs e)
|
|
{
|
|
init();
|
|
}
|
|
|
|
#region 初始化查询条件
|
|
private void init()
|
|
{
|
|
#region 生产订单号
|
|
string sql = "SELECT DISTINCT MOCODE AS [生产订单号] FROM ICSMO WHERE WorkPoint='{0}' ORDER BY MOCODE ";
|
|
sql = string.Format(sql, AppConfig.WorkPointCode);
|
|
DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
|
|
txtMOCode.Properties.ValueMember = "生产订单号";
|
|
txtMOCode.Properties.DisplayMember = "生产订单号";
|
|
txtMOCode.Properties.DataSource = dt;
|
|
txtMOCode.Properties.NullText = "";//空时的值
|
|
txtMOCode.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
|
|
txtMOCode.Properties.ValidateOnEnterKey = true;//回车确认
|
|
txtMOCode.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
|
|
txtMOCode.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
|
|
//自适应宽度
|
|
txtMOCode.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
|
|
#endregion
|
|
}
|
|
#endregion
|
|
|
|
private void loadData()
|
|
{
|
|
DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm("正在查找...请稍等...");
|
|
try
|
|
{
|
|
_wait.Show();
|
|
dataSourceAll = null;
|
|
dataSource = null;
|
|
if (string.IsNullOrWhiteSpace(txtMOCode.Text.Trim()))
|
|
{
|
|
_wait.Close();
|
|
ICSBaseSimpleCode.AppshowMessageBox("请输入生产订单号!");
|
|
return;
|
|
}
|
|
|
|
string Where = txtMOCode.Text.Trim();
|
|
|
|
#region 查询
|
|
if (!string.IsNullOrWhiteSpace(cmbSEQ.Text.Trim()))
|
|
{
|
|
Where += "' AND e.MOSEQ='" + cmbSEQ.Text.Trim() + " ";
|
|
}
|
|
string sql = @" SELECT '' AS isSelect,
|
|
e.MOCODE,
|
|
e.MOSEQ,
|
|
e.ITEMCODE,
|
|
b.INVNAME,
|
|
b.INVSTD AS INVTYPE,
|
|
c.MOBITEMCODE,
|
|
d.INVNAME AS CINVNAME,
|
|
d.INVSTD AS CINVTYPE,
|
|
d.INVUOM,
|
|
CAST(ISNULL(c.MOBITEMQTY, 0)*e.MOPLANQTY AS DECIMAL(18,2)) AS QTY,
|
|
f.LotNO,
|
|
CASE WHEN f.LotNO IS NULL THEN '0' ELSE '1' END AS HasLotNO,
|
|
CASE WHEN d.INVCODE LIKE '3%' THEN '成品' WHEN d.INVCODE LIKE '2%' THEN '半成品' ELSE '原料' END AS TYPE,
|
|
CAST(ISNULL(g.QTY, 0) AS DECIMAL(18,2)) AS QTYB,
|
|
g.STATUS,
|
|
g.MUSERName,
|
|
g.MTIME,
|
|
g.ID
|
|
FROM
|
|
ICSMO e
|
|
LEFT JOIN ICSINVENTORY b ON e.ITEMCODE = b.INVCODE
|
|
LEFT JOIN ICSMOBOM c ON e.MOCODE = c.MOCODE AND c.SEQ=e.MOSEQ AND e.ITEMCODE = c.ITEMCODE
|
|
LEFT JOIN ICSINVENTORY d ON c.MOBITEMCODE = d.INVCODE
|
|
LEFT JOIN ICSItemBack g ON c.MOCODE=g.MOCODE AND c.SEQ=g.MOSEQ AND c.MOBITEMCODE=g.INVCode
|
|
LEFT JOIN
|
|
(
|
|
SELECT DISTINCT
|
|
h.TransNO,
|
|
h.TransLine,
|
|
h.ITEMCODE,
|
|
i.LotNO,
|
|
j.MTIME
|
|
FROM
|
|
ICSITEMTrans h
|
|
INNER JOIN ICSITEMTransLot i ON h.ID=i.ITEMTransID AND h.WorkPoint=i.WorkPoint
|
|
INNER JOIN ICSWareHouseLotInfo j ON i.LotNO=j.LotNO AND i.WorkPoint=j.WorkPoint
|
|
WHERE h.TransType='出库' AND h.TransNO='{2}' AND h.WorkPoint='{1}'
|
|
AND j.MTIME=
|
|
(
|
|
SELECT MIN(m.MTIME)
|
|
FROM
|
|
ICSITEMTrans k
|
|
INNER JOIN ICSITEMTransLot l ON k.ID=l.ITEMTransID AND k.WorkPoint=l.WorkPoint
|
|
INNER JOIN ICSWareHouseLotInfo m ON l.LotNO=m.LotNO AND l.WorkPoint=m.WorkPoint
|
|
WHERE k.TransType='出库' AND h.TransNO=k.TransNO AND h.ITEMCODE=k.ITEMCODE
|
|
GROUP BY k.TransNO,k.TransLine,k.ITEMCODE
|
|
)
|
|
) f ON c.MOCODE=f.TransNO AND c.MOBITEMCODE=f.ITEMCODE
|
|
WHERE e.MOCODE='{0}' AND
|
|
e.WorkPoint = '{1}'
|
|
ORDER BY e.MOSEQ,c.MOBOMLINE,c.MOBITEMCODE
|
|
";
|
|
sql = string.Format(sql, Where, AppConfig.WorkPointCode, txtMOCode.Text.Trim());
|
|
DataSet ds = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql);
|
|
|
|
if (ds != null && ds.Tables.Count == 1)
|
|
{
|
|
dataSourceAll = ds.Tables[0];
|
|
DataView dv = dataSourceAll.Copy().DefaultView;
|
|
dv.RowFilter = "HasLotNO='1'";
|
|
dataSource = dv.ToTable().Copy();
|
|
if (chkAll.Checked)
|
|
grdDetail.DataSource = dataSourceAll;
|
|
else
|
|
grdDetail.DataSource = dataSource;
|
|
grvDetail.BestFitColumns();
|
|
}
|
|
|
|
#endregion
|
|
|
|
_wait.Close();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_wait.Close();
|
|
ICSBaseSimpleCode.AppshowMessageBox(ex.ToString());
|
|
}
|
|
}
|
|
|
|
private void txtMOCode_EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
grdDetail.DataSource = null;
|
|
cmbSEQ.Text = "";
|
|
cmbSEQ.Properties.Items.Clear();
|
|
string MOCode = txtMOCode.EditValue.ToString();
|
|
string sql = "SELECT MOSEQ FROM ICSMO WHERE WorkPoint='{0}' AND MOCODE='{1}' ORDER BY MOSEQ";
|
|
sql = string.Format(sql, AppConfig.WorkPointCode, MOCode);
|
|
DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
|
|
cmbSEQ.Properties.Items.Add("");
|
|
cmbSEQ.Properties.Items.AddRange(dt.AsEnumerable().Select(a=>a["MOSEQ"]).ToList());
|
|
|
|
loadData();
|
|
}
|
|
|
|
private void cmbSEQ_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
grdDetail.DataSource = null;
|
|
|
|
loadData();
|
|
}
|
|
|
|
#region 导出
|
|
private void btnOutPut_Click(object sender, EventArgs e)
|
|
{
|
|
SimpleButton btntemp = (SimpleButton)sender;
|
|
if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
|
|
return;
|
|
}
|
|
FormOutExcel foe = new FormOutExcel(this.Tag.ToString(), grdDetail);
|
|
foe.ShowDialog();
|
|
}
|
|
#endregion
|
|
|
|
#region 打印
|
|
private void btnPrint_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
SimpleButton btntemp = (SimpleButton)sender;
|
|
if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
|
|
return;
|
|
}
|
|
|
|
if (string.IsNullOrWhiteSpace(txtMOCode.EditValue.ToString()))
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("请选择生产订单号!");
|
|
return;
|
|
}
|
|
|
|
List<PrintPara> parasList = new List<PrintPara>();
|
|
PrintPara para = new PrintPara();
|
|
para.PrintKey = "MOCODE";
|
|
para.PrintValues = new object[] { txtMOCode.EditValue };
|
|
parasList.Add(para);
|
|
|
|
if (parasList.Count == 0)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("请选择数据!");
|
|
return;
|
|
}
|
|
FormPrintDialog f = new FormPrintDialog("018", this.Text, parasList, false, null);
|
|
f.ShowDialog();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.ToString());
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 保存
|
|
private void btnModify_Click(object sender, EventArgs e)
|
|
{
|
|
DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm("正在查找...请稍等...");
|
|
try
|
|
{
|
|
_wait.Show();
|
|
SimpleButton btntemp = (SimpleButton)sender;
|
|
if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
|
|
{
|
|
_wait.Close();
|
|
ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
|
|
return;
|
|
}
|
|
|
|
List<ICSItemBack> editList = new List<ICSItemBack>();
|
|
for (int i = 0; i < grvDetail.RowCount; i++)
|
|
{
|
|
if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
|
|
{
|
|
if (grvDetail.GetRowCellValue(i, colSTATUS).ToString() == "已退")
|
|
{
|
|
_wait.Close();
|
|
ICSBaseSimpleCode.AppshowMessageBox("已退状态不能保存!");
|
|
return;
|
|
}
|
|
if (Convert.ToDecimal(grvDetail.GetRowCellValue(i, colQTYB).ToString()) <= 0)
|
|
{
|
|
_wait.Close();
|
|
ICSBaseSimpleCode.AppshowMessageBox("请填写正确的退库数量!");
|
|
return;
|
|
}
|
|
ICSItemBack entity = new ICSItemBack();
|
|
entity.ID = grvDetail.GetRowCellValue(i, colID).ToString();
|
|
entity.MOCODE = grvDetail.GetRowCellValue(i, colMOCODE).ToString();
|
|
entity.MOSEQ = grvDetail.GetRowCellValue(i, colMOSEQ).ToString();
|
|
entity.INVCode = grvDetail.GetRowCellValue(i, colMOBITEMCODE).ToString();
|
|
entity.QTY = Convert.ToDecimal(grvDetail.GetRowCellValue(i, colQTYB).ToString());
|
|
entity.STATUS = "初始";
|
|
editList.Add(entity);
|
|
}
|
|
}
|
|
if (editList.Count <= 0)
|
|
{
|
|
_wait.Close();
|
|
ICSBaseSimpleCode.AppshowMessageBox("请选择数据!!!");
|
|
return;
|
|
}
|
|
|
|
ICSItemBackBLL.AddandEditList(editList, AppConfig.AppConnectString);
|
|
_wait.Close();
|
|
ICSBaseSimpleCode.AppshowMessageBox("操作成功");
|
|
loadData();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_wait.Close();
|
|
MessageBox.Show(ex.ToString());
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 生成条码
|
|
private void btnCreate_Click(object sender, EventArgs e)
|
|
{
|
|
DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm("正在查找...请稍等...");
|
|
try
|
|
{
|
|
_wait.Show();
|
|
SimpleButton btntemp = (SimpleButton)sender;
|
|
if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
|
|
{
|
|
_wait.Close();
|
|
ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
|
|
return;
|
|
}
|
|
List<ICSITEMLot> InfoList = new List<ICSITEMLot>();
|
|
|
|
for (int i = 0; i < grvDetail.RowCount; i++)
|
|
{
|
|
if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
|
|
{
|
|
if (grvDetail.GetRowCellValue(i, colLotNO).ToString() != "")
|
|
{
|
|
_wait.Close();
|
|
ICSBaseSimpleCode.AppshowMessageBox("已生成条码不能再次生成!");
|
|
return;
|
|
}
|
|
if (Convert.ToDecimal(grvDetail.GetRowCellValue(i, colQTYB).ToString()) <= 0)
|
|
{
|
|
_wait.Close();
|
|
ICSBaseSimpleCode.AppshowMessageBox("请填写正确的退库数量!");
|
|
return;
|
|
}
|
|
ICSITEMLot Info = new ICSITEMLot();
|
|
|
|
DateTime time = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss");
|
|
Info.ID = "";
|
|
Info.LOTQTY = Convert.ToDecimal(grvDetail.GetRowCellValue(i, colQTYB).ToString());
|
|
Info.LotNO = time.ToString("yyyyMMddHHmmss") + grvDetail.GetRowCellValue(i, colMOBITEMCODE).ToString();
|
|
Info.ItemCode = grvDetail.GetRowCellValue(i, colMOBITEMCODE).ToString();
|
|
Info.TransNO = grvDetail.GetRowCellValue(i, colMOCODE).ToString();
|
|
//Info.TransLine =Convert.ToInt32(grvDetail.GetRowCellValue(i, colMOSEQ).ToString());
|
|
Info.TransLine = grvDetail.GetRowCellValue(i, colMOSEQ).ToString();
|
|
Info.VenderLotNO = time.ToString("yyMMdd").Substring(time.ToString("yyMMdd").Length - 6) + "0001"; //生产批号,每个工单一个
|
|
Info.PRODUCTDATE = time.Date;
|
|
Info.ACTIVE = "Y";
|
|
Info.Exdate = Convert.ToDateTime("2999-12-31");
|
|
Info.TYPE = grvDetail.GetRowCellValue(i, colTYPE).ToString();
|
|
InfoList.Add(Info);
|
|
}
|
|
}
|
|
if (InfoList.Count <= 0)
|
|
{
|
|
_wait.Close();
|
|
ICSBaseSimpleCode.AppshowMessageBox("请选择数据!!!");
|
|
return;
|
|
}
|
|
|
|
ICSRdrecord2LOTBLL.Add(InfoList, AppConfig.AppConnectString);
|
|
_wait.Close();
|
|
ICSBaseSimpleCode.AppshowMessageBox("操作成功");
|
|
loadData();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
_wait.Close();
|
|
MessageBox.Show(ex.ToString());
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 打印条码
|
|
private void simpleButton1_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
SimpleButton btntemp = (SimpleButton)sender;
|
|
if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
|
|
return;
|
|
}
|
|
bool identical = true;
|
|
string type = "";
|
|
List<PrintPara> parasList = new List<PrintPara>();
|
|
List<ICSITEMLot> InfoList = new List<ICSITEMLot>();
|
|
for (int i = 0; i < grvDetail.RowCount; i++)
|
|
{
|
|
if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y")
|
|
{
|
|
if (grvDetail.GetRowCellValue(i, colLotNO).ToString() == "")
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("没有此物料对应的领料信息!");
|
|
return;
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(type) && !type.Equals(grvDetail.GetRowCellValue(i, colTYPE).ToString()))
|
|
{
|
|
identical = false;
|
|
break;
|
|
}
|
|
type = grvDetail.GetRowCellValue(i, colTYPE).ToString();
|
|
PrintPara para = new PrintPara();
|
|
para.PrintKey = "LOTNO";
|
|
para.PrintValues = new object[] { grvDetail.GetRowCellValue(i, colLotNO).ToString() };
|
|
parasList.Add(para);
|
|
|
|
ICSITEMLot Info = new ICSITEMLot();
|
|
Info.LotNO = grvDetail.GetRowCellValue(i, colLotNO).ToString();
|
|
//Info.PrintTimes = Convert.ToInt32(grvDetail.GetRowCellValue(i, colPrintTimes).ToString()) + 1;
|
|
Info.lastPrintUSERID = AppConfig.UserId;
|
|
Info.lastPrintTime = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss");
|
|
Info.WorkPoint = AppConfig.WorkPointCode;
|
|
InfoList.Add(Info);
|
|
}
|
|
}
|
|
if (!identical)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("类型不同,不能打印!");
|
|
return;
|
|
}
|
|
if (parasList.Count == 0)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("请选择数据!");
|
|
return;
|
|
}
|
|
if (type.Equals("半成品"))
|
|
{
|
|
FormPrintDialog f = new FormPrintDialog("007", this.Text, parasList, false, null);
|
|
f.ShowDialog();
|
|
}
|
|
else if (type.Equals("成品"))
|
|
{
|
|
FormPrintDialog f = new FormPrintDialog("008", this.Text, parasList, false, null);
|
|
f.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
FormPrintDialog f = new FormPrintDialog("006", this.Text, parasList, false, null);
|
|
f.ShowDialog();
|
|
}
|
|
//更新打印信息
|
|
ICSRdrecord2LOTBLL.updatePrint(InfoList, AppConfig.AppConnectString);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.ToString());
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
private void chkAll_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
if (chkAll.Checked)
|
|
grdDetail.DataSource = dataSourceAll;
|
|
else
|
|
grdDetail.DataSource = dataSource;
|
|
grvDetail.BestFitColumns();
|
|
}
|
|
}
|
|
}
|