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.
820 lines
34 KiB
820 lines
34 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using DevExpress.XtraEditors;
|
|
using ICSSoft.Base.Language.Tool;
|
|
using ICSSoft.Base.UserControl.MessageControl;
|
|
using ICSSoft.Base.Config.AppConfig;
|
|
using ICSSoft.Base.Config.DBHelper;
|
|
using ICSSoft.Base.Report.Filter;
|
|
using ICSSoft.Base.UserControl.FormControl;
|
|
using ICSSoft.Base.ReferForm.AppReferForm;
|
|
using ICSSoft.Frame.Data.Entity;
|
|
using ICSSoft.Frame.Data.BLL;
|
|
using ICSSoft.Base.Lable.PrintTool;
|
|
using System.Data.SqlClient;
|
|
|
|
namespace ICSSoft.Frame.APP
|
|
{
|
|
public partial class FormICSWBSSpecailEdit : DevExpress.XtraEditors.XtraForm
|
|
{
|
|
private string sqltxt = "";
|
|
private string sqlconn = "";
|
|
private DataTable dataSource = null;
|
|
private DataTable dtNewRcard = null;
|
|
public List<Dictionary<string, object>> Rows = new List<Dictionary<string, object>>();
|
|
|
|
public FormICSWBSSpecailEdit()
|
|
{
|
|
InitializeComponent();
|
|
this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
|
|
this.WindowState = FormWindowState.Maximized;
|
|
txtInvCode.Enabled = false;
|
|
txtBatch.ReadOnly = true;
|
|
txtBatch.Enabled = false;
|
|
}
|
|
|
|
#region SystemOptition
|
|
|
|
/// <summary>
|
|
/// 操作权限
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
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(btnSearch);
|
|
ControlList.Add(btnOk);
|
|
ControlList.Add(simpleButton4);
|
|
ControlList.Add(btnConfig);
|
|
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;
|
|
}
|
|
/// <summary>
|
|
/// 数据权限
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
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 btnConfig_Click(object sender, EventArgs e)//绑定数据源
|
|
{
|
|
if (AppConfig.UserCode.ToLower() != "demo")
|
|
{
|
|
//ICSBaseSimpleCode.AppshowMessageBox("您没有权限设置数据源,请联系软件提供商!");
|
|
return;
|
|
}
|
|
FormDataSource fdata = new FormDataSource(AppConfig.GetMenuId(this.Tag.ToString()), btnConfig.Name);
|
|
fdata.ShowDialog();
|
|
}
|
|
#endregion
|
|
|
|
#region 过滤
|
|
private string tempTableName = "";
|
|
private void btnFilter_Click(object sender, EventArgs e)
|
|
{
|
|
FormFilter filter = new FormFilter(AppConfig.GetSourceId(this.Tag.ToString(), btnConfig.Name));
|
|
filter.OldTempTableName = tempTableName;
|
|
if (filter.ShowDialog() == DialogResult.OK)
|
|
{
|
|
DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm("正在查找...请稍等...");
|
|
try
|
|
{
|
|
|
|
_wait.Show();
|
|
tempTableName = filter.NewTempTableName;
|
|
sqltxt = filter.SqlText;
|
|
sqlconn = filter.FilterConnectString;
|
|
dataSource = filter.FilterData.Tables[0];
|
|
grdDetail.DataSource = dataSource;
|
|
grvDetail.BestFitColumns();
|
|
_wait.Close();
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show("异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
_wait.Close();
|
|
}
|
|
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
public static string searchSQl()
|
|
{
|
|
string sql = @" SELECT CAST ('' AS NVARCHAR(50)) AS 选择,b.POCode,b.PORow,b.VenName,
|
|
b.PersonName,b.POType,b.InvCode,c.INVNAME,c.INVSTD,a.LotNO,a.LOTQTY
|
|
FROM dbo.ICSITEMLot a
|
|
INNER JOIN dbo.ICSPO_PoMain b ON a.TransNO = b.POCode AND a.TransLine = b.PORow
|
|
INNER JOIN dbo.ICSINVENTORY c ON b.InvCode = c.INVCODE
|
|
WHERE a.Status = '新增' ";
|
|
return sql;
|
|
}
|
|
|
|
#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
|
|
|
|
private void btnClose_Click(object sender, EventArgs e)
|
|
{
|
|
AppConfig.CloseFormShow(this.Text);
|
|
this.DialogResult = DialogResult.Cancel;
|
|
}
|
|
|
|
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();
|
|
}
|
|
|
|
private void btnDel_Click(object sender, EventArgs e)
|
|
{
|
|
grvDetail.PostEditor();
|
|
this.Validate();
|
|
if (grvDetail.FocusedRowHandle < 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
grvDetail.DeleteRow(grvDetail.FocusedRowHandle);
|
|
}
|
|
|
|
private void grvDetail_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
if (grvDetail.RowCount == 0)
|
|
{
|
|
return;
|
|
}
|
|
if (grvDetail.FocusedRowHandle < 0)
|
|
{
|
|
return;
|
|
}
|
|
if (grvDetail.FocusedColumn == coSelect)
|
|
{
|
|
if (grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, coSelect).ToString() == "")
|
|
{
|
|
grvDetail.SetRowCellValue(grvDetail.FocusedRowHandle, coSelect, "Y");
|
|
// txtInvCode.Text = grvDetail.GetRowCellValue(grvDetail.FocusedRowHandle, whCode).ToString();
|
|
}
|
|
else
|
|
{
|
|
grvDetail.SetRowCellValue(grvDetail.FocusedRowHandle, coSelect, "");
|
|
}
|
|
|
|
}
|
|
//int count = 0;
|
|
//for (int i = 0; i < grvDetail.RowCount; i++)
|
|
//{
|
|
// if (grvDetail.GetRowCellValue(i, coSelect).ToString() == "Y")
|
|
// {
|
|
// count++;
|
|
// }
|
|
//}
|
|
//if (count != 1 && count != 0)
|
|
//{
|
|
// ICSBaseSimpleCode.AppshowMessageBox("请选择数据,且只能选择一条进行编辑!!!");
|
|
// grvDetail.SetRowCellValue(grvDetail.FocusedRowHandle, coSelect, "");
|
|
// return;
|
|
//}
|
|
}
|
|
|
|
private void btnSearch_Click(object sender, EventArgs e)
|
|
{
|
|
// string wareHouse = txtInvCode.Text;
|
|
// string InvCode = txtInvCode.Text;
|
|
// string sqlWhere = "";
|
|
// string sql = @" select A.ID
|
|
// ,'' as 选择
|
|
// ,'' as TransferType
|
|
// ,'' as NEWWBS
|
|
// ,'' as Reason
|
|
// ,WHCode as whCode
|
|
// ,A.LotNO as LotNO
|
|
// ,B.INVCODE AS ItemCode
|
|
// ,B.INVUOM as InvUom
|
|
// ,B.INVNAME as INVNAME
|
|
// ,B.INVSTD as INVSTD
|
|
// ,A.ORDERNO as oldWBS
|
|
// ,A.LotQty as WBSQty
|
|
// from ICSWareHouseLotInfo A
|
|
// INNER join ICSITEMLot C
|
|
// on C.LotNo=A.LotNO
|
|
// left join ICSINVENTORY B
|
|
// on B.INVCODE=C.itemCODE
|
|
// left join Sys_EnumValues D
|
|
// ON D.EnumValue=B.INVTYPE
|
|
// where A.LotQty!=0 ";
|
|
// if (wbsOld == " ALL")
|
|
// { }
|
|
// if (wbsOld == "")
|
|
// {
|
|
// sql += " and (A.ORDERNO is null or A.ORDERNO='')";
|
|
// }
|
|
// if (wbsOld != "" && wbsOld != " ALL")
|
|
// {
|
|
// sql += " and A.ORDERNO='" + wbsOld + "'";
|
|
// }
|
|
// if (wareHouse != "")
|
|
// {
|
|
// sql += " and WHCode='" + wareHouse + "'";
|
|
// }
|
|
// if (InvCode != "")
|
|
// {
|
|
// string[] InvCodeList = InvCode.Split(',');
|
|
// string ItemCodeList = "";
|
|
// for (int i = 0; i < InvCodeList.Length; i++)
|
|
// {
|
|
// if (ItemCodeList == "")
|
|
// {
|
|
// ItemCodeList = "'" + InvCodeList[i] + "'";
|
|
// }
|
|
// else
|
|
// {
|
|
// ItemCodeList += ",'" + InvCodeList[i] + "'";
|
|
// }
|
|
// }
|
|
// sql += " and A.InvCode in (" + ItemCodeList + ")";
|
|
// }
|
|
// DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
|
|
// if (data.Rows.Count != 0)
|
|
// {
|
|
// grdDetail.DataSource = data;
|
|
// grvDetail.BestFitColumns();
|
|
// }
|
|
// else
|
|
// {
|
|
// grdDetail.DataSource = null;
|
|
// grvDetail.BestFitColumns();
|
|
// }
|
|
}
|
|
|
|
private void btnSelectAll_Click(object sender, EventArgs e)
|
|
{
|
|
for (int i = 0; i < grvDetail.RowCount; i++)
|
|
{
|
|
grvDetail.SetRowCellValue(i, coSelect, true);
|
|
}
|
|
}
|
|
|
|
#region 刷新
|
|
private void btnRefresh_Click(object sender, EventArgs e)
|
|
{
|
|
if (sqlconn == null || sqlconn == "")
|
|
{
|
|
return;
|
|
}
|
|
DevExpress.Utils.WaitDialogForm _wait = new DevExpress.Utils.WaitDialogForm("正在查找...请稍等...");
|
|
try
|
|
{
|
|
_wait.Show();
|
|
FormFilter filter = new FormFilter(AppConfig.GetSourceId(this.Tag.ToString(), btnConfig.Name), false);
|
|
filter.OldTempTableName = tempTableName;
|
|
dataSource = DBHelper.ExecuteDataset(sqlconn, CommandType.Text, sqltxt).Tables[0];
|
|
grdDetail.DataSource = dataSource;
|
|
grvDetail.BestFitColumns();
|
|
_wait.Close();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show("异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
_wait.Close();
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
private void btnOk_Click(object sender, EventArgs e)
|
|
{
|
|
bool isXT = false;
|
|
int count = 0;
|
|
string invnew = "";
|
|
string batch = "";
|
|
///手动填写的数据
|
|
if (checkInv.Checked)
|
|
{
|
|
invnew = txtInvCode.Text.Trim();
|
|
if (txtInvCode.Text.Trim() == "")
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("请选择转换物料!!!");
|
|
return;
|
|
}
|
|
isXT = true;
|
|
}
|
|
if (checkBatch.Checked)
|
|
{
|
|
batch = txtBatch.Text.Trim();
|
|
if (txtBatch.Text.Trim() == "")
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("请选择转换批次!!!");
|
|
return;
|
|
}
|
|
isXT = true;
|
|
}
|
|
string reason = txtReason.Text.Trim();
|
|
string WMSErrorMessage = "";
|
|
List<ICSWBSSpecialTransfer> InfoList = new List<ICSWBSSpecialTransfer>();
|
|
List<ICSITEMLot> lotList = new List<ICSITEMLot>();
|
|
DataTable dtNewRcard = new DataTable();
|
|
dtNewRcard.Columns.Add("IsSelect", typeof(bool));
|
|
dtNewRcard.Columns.Add("ID", typeof(string));
|
|
dtNewRcard.Columns.Add("whCode", typeof(string));
|
|
dtNewRcard.Columns.Add("LotNO", typeof(string));
|
|
dtNewRcard.Columns.Add("WBSQty", typeof(Decimal));
|
|
dtNewRcard.Columns.Add("INVCOENew", typeof(string));
|
|
dtNewRcard.Columns.Add("INVCOEOld", typeof(string));
|
|
dtNewRcard.Columns.Add("INVNAME", typeof(string));
|
|
dtNewRcard.Columns.Add("INVSTD", typeof(string));
|
|
dtNewRcard.Columns.Add("BATCHNew", typeof(string));
|
|
dtNewRcard.Columns.Add("BATCHOld", typeof(string));
|
|
dtNewRcard.Columns.Add("Reason", typeof(string));
|
|
dtNewRcard.Columns.Add("Itype", typeof(string));
|
|
dtNewRcard.Columns.Add("Idesc", typeof(string));
|
|
dtNewRcard.Columns.Add("Ipersetype", typeof(string));
|
|
dtNewRcard.Columns.Add("MTIME", typeof(DateTime));
|
|
|
|
try
|
|
{
|
|
int NewLot = 0;
|
|
string sql = "SELECT TOP 1 LotNO FROM ICSITEMLot WHERE 1=1 AND LotNO LIKE '{0}' AND WorkPoint = '{1}' ORDER BY LotNO DESC";
|
|
sql = string.Format(sql, "XT" + DateTime.Now.ToString("yyyyMMdd") + "%", AppConfig.WorkPointCode);
|
|
DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
|
|
if (data.Rows.Count > 0 && data != null)
|
|
{
|
|
NewLot = Convert.ToInt16(data.Rows[0]["LotNO"].ToString().Substring(data.Rows[0]["LotNO"].ToString().Length - 3, 3));
|
|
}
|
|
else
|
|
{
|
|
NewLot = 0;
|
|
}
|
|
if (isXT)
|
|
{
|
|
bool isBatch = false;//判断是否要有批次号
|
|
for (int i = 0; i < grvDetail.RowCount; i++)
|
|
{
|
|
if (Convert.ToBoolean(grvDetail.GetRowCellValue(i, coSelect).ToString()))
|
|
{
|
|
count++;
|
|
///带出的数据
|
|
string WHCODE = grvDetail.GetRowCellValue(i, whCode).ToString();
|
|
string lotno = grvDetail.GetRowCellValue(i, LotNO).ToString();
|
|
string ItemLotNo = grvDetail.GetRowCellValue(i, LotNO).ToString();
|
|
string invold = grvDetail.GetRowCellValue(i, colItemCode).ToString();
|
|
decimal LotQTY = Convert.ToDecimal(grvDetail.GetRowCellValue(i, WBSQty).ToString());
|
|
string cBatch = grvDetail.GetRowCellValue(i, colVenderLotNO).ToString();
|
|
string invname = grvDetail.GetRowCellValue(i, colInvName).ToString();
|
|
string invstd = grvDetail.GetRowCellValue(i, colINVSTD).ToString();
|
|
ICSWBSSpecialTransfer transferinfo = new ICSWBSSpecialTransfer();
|
|
transferinfo.WareHouseCode = WHCODE;
|
|
transferinfo.LotNo = lotno;
|
|
if (checkInv.Checked)
|
|
{
|
|
transferinfo.INVCOENew = invnew;
|
|
}
|
|
else
|
|
{
|
|
transferinfo.INVCOENew = invold;
|
|
}
|
|
transferinfo.INVCOEOld = invold;
|
|
isBatch = CheckData(transferinfo.INVCOENew);
|
|
if (checkBatch.Checked)
|
|
{
|
|
transferinfo.BATCHNew = batch;
|
|
if (isBatch)
|
|
{
|
|
if (batch == "")
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("转换物料已启用批号,批号信息不能为空!!!");
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (batch != "")
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("转换物料未启用批号,批号信息应为空!!!");
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
transferinfo.BATCHNew = cBatch;
|
|
}
|
|
transferinfo.BATCHOld = cBatch;
|
|
transferinfo.TransferReason = reason;
|
|
transferinfo.MUSER = AppConfig.UserId;
|
|
transferinfo.MUSERNAME = AppConfig.UserName;
|
|
transferinfo.MTIME = DateTime.Now;
|
|
transferinfo.WorkPoint = AppConfig.WorkPointCode;
|
|
transferinfo.NewLotNo = "XT" + DateTime.Now.ToString("yyyyMMdd") + (NewLot + count).ToString().PadLeft(3, '0');
|
|
transferinfo.LotStatus = "待审核";
|
|
InfoList.Add(transferinfo);
|
|
|
|
ICSITEMLot Info = new ICSITEMLot();
|
|
Info.LOTQTY = LotQTY;
|
|
Info.LotNO = "XT" + DateTime.Now.ToString("yyyyMMdd") + (NewLot + count).ToString().PadLeft(3, '0');
|
|
if (checkInv.Checked)
|
|
{
|
|
Info.MCODE = invnew;
|
|
}
|
|
else
|
|
{
|
|
Info.MCODE = invold;
|
|
}
|
|
Info.TransNO = "";
|
|
Info.TransLine = "";
|
|
Info.VENDORITEMCODE = "";
|
|
if (checkBatch.Checked)
|
|
{
|
|
Info.VenderLotNO = batch;
|
|
}
|
|
else
|
|
{
|
|
Info.VenderLotNO = cBatch;
|
|
}
|
|
Info.PRODUCTDATE = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss");
|
|
Info.ACTIVE = "Y";
|
|
Info.Exdate = Convert.ToDateTime("2999-12-31");
|
|
Info.TYPE = "形态转换";
|
|
Info.EATTRIBUTE3 = Convert.ToDecimal(grvDetail.GetRowCellValue(i, EATTRIBUTE3).ToString());
|
|
lotList.Add(Info);
|
|
|
|
//写入内存
|
|
DataRow row = dtNewRcard.NewRow();
|
|
row["IsSelect"] = false;
|
|
row["whCode"] = WHCODE;
|
|
row["LotNO"] = lotno;
|
|
row["WBSQty"] = LotQTY;
|
|
if (checkInv.Checked)
|
|
{
|
|
row["INVCOENew"] = invnew;
|
|
}
|
|
else
|
|
{
|
|
row["INVCOENew"] = invold;
|
|
}
|
|
row["INVCOEOld"] = invold;
|
|
row["INVNAME"] = invname;
|
|
row["INVSTD"] = invstd;
|
|
row["BATCHOld"] = cBatch;
|
|
if (checkBatch.Checked)
|
|
{
|
|
row["BATCHNew"] = batch;
|
|
}
|
|
else
|
|
{
|
|
row["BATCHNew"] = cBatch;
|
|
}
|
|
row["Reason"] = reason;
|
|
row["MTIME"] = AppConfig.GetSeverDateTime("yyyy-MM-dd HH:mm:ss");
|
|
dtNewRcard.Rows.Add(row);
|
|
}
|
|
}
|
|
if (count == 0)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("请至少选择一条数据进行保存!");
|
|
return;
|
|
}
|
|
using (SqlConnection conn = new SqlConnection(AppConfig.AppConnectString))
|
|
{
|
|
conn.Open();
|
|
using (SqlTransaction trans = conn.BeginTransaction())
|
|
{
|
|
try
|
|
{
|
|
ICSWBSSpecailTransferBLL.UpdateTransWMS(conn, trans, InfoList, lotList, AppConfig.AppConnectString);
|
|
|
|
trans.Commit();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
trans.Rollback();
|
|
MessageBox.Show("转换异常:" + ex.Message);
|
|
return;
|
|
}
|
|
}
|
|
conn.Close();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("未选择转换的信息!");
|
|
return;
|
|
}
|
|
//ICSWBSSpecailTransferBLL.Add(transferinfo, AppConfig.AppConnectString);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show("异常:" + ex.Message, "异常", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
return;
|
|
}
|
|
if (WMSErrorMessage == "")
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("保存成功!");
|
|
gridControlDetail.DataSource = dtNewRcard;
|
|
grvDetailView.BestFitColumns();
|
|
btnRefresh_Click(null, null);
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show(WMSErrorMessage);
|
|
}
|
|
}
|
|
|
|
private void btncancle_Click(object sender, EventArgs e)
|
|
{
|
|
this.DialogResult = DialogResult.Cancel;
|
|
this.Close();
|
|
}
|
|
|
|
private void FormCartonProtectSelect_Load(object sender, EventArgs e)
|
|
{
|
|
LanguageConvert.ChangeLanguage(this, "1");
|
|
init();
|
|
btnFilter_Click(sender, e);
|
|
}
|
|
|
|
private bool CheckData(string cInvCode)
|
|
{
|
|
#region 判断是否要有批次号
|
|
DataTable dt = ICSPOArriveBLL.GetBatch(cInvCode, AppConfig.WorkPointCode, AppConfig.AppConnectString);
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
{
|
|
if (dt.Rows[0]["INVCONTROLTYPE"].ToString().Trim().ToUpper() == "TRUE")
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
throw new Exception("物料存货信息取得失败");
|
|
}
|
|
#endregion
|
|
}
|
|
|
|
private void init()
|
|
{
|
|
|
|
string sql = @"select distinct INVCODE AS 物料编号,INVNAME AS 物料名称 from ICSINVENTORY";
|
|
sql = string.Format(sql);
|
|
DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
|
|
txtInvCode.Properties.ValueMember = "物料编号";
|
|
txtInvCode.Properties.DisplayMember = "物料编号";
|
|
txtInvCode.Properties.DataSource = dt;
|
|
txtInvCode.Properties.NullText = "";//空时的值
|
|
txtInvCode.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
|
|
txtInvCode.Properties.ValidateOnEnterKey = true;//回车确认
|
|
txtInvCode.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
|
|
txtInvCode.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
|
|
//自适应宽度
|
|
txtInvCode.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
|
|
|
|
}
|
|
|
|
private void txtPORow_Click(object sender, EventArgs e)
|
|
{
|
|
//if (txtWBS.Text.Trim() == "") return;
|
|
//try
|
|
//{
|
|
// if (txtWBS.Text.Trim() == "") return;
|
|
// string sql = @"SELECT DISTINCT PORow FROM [dbo].[ICSPO_PoMain]
|
|
// WHERE POCode = '" + txtWBS.Text.Trim()+ @"'
|
|
// ORDER BY PORow";
|
|
// DataTable InvTypeDt = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
|
|
// txtPORow.DataSource = InvTypeDt;
|
|
// txtPORow.ValueMember = "PORow";
|
|
// txtPORow.DisplayMember = "PORow";
|
|
|
|
//}
|
|
//catch (Exception ex)
|
|
//{
|
|
// ICSBaseSimpleCode.AppshowMessageBox(ex.ToString());
|
|
//}
|
|
}
|
|
|
|
private void txtWHCode_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
|
|
{
|
|
ButtonEdit btn = (ButtonEdit)sender;
|
|
string sql = @" SELECT Serial,StorageCode AS 仓库编码,StorageName AS 仓库名称
|
|
FROM dbo.ICSStorage";
|
|
DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
|
|
FormDataRefer reForm = new FormDataRefer();
|
|
reForm.FormTitle = "人员信息";
|
|
DataTable menuData = data;
|
|
reForm.DataSource = menuData;
|
|
reForm.MSelectFlag = false;
|
|
reForm.RowIndexWidth = 35;
|
|
reForm.HideCols.Add("Serial");
|
|
reForm.FormWidth = 500;
|
|
reForm.FormHeight = 500;
|
|
|
|
if (reForm.ShowDialog() == DialogResult.OK)
|
|
{
|
|
DataTable retData = reForm.ReturnData;
|
|
foreach (DataRow dr in retData.Rows)
|
|
{
|
|
txtInvCode.Text = dr["仓库名称"].ToString();
|
|
txtInvCode.Tag = dr["Serial"].ToString();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void labelControl7_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
private void txtInvCode_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
|
|
{
|
|
ButtonEdit btn = (ButtonEdit)sender;
|
|
string sql = @"select distinct INVCODE AS 物料编号,INVNAME AS 物料名称 from ICSINVENTORY";
|
|
DataTable data = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
|
|
FormDataRefer reForm = new FormDataRefer();
|
|
reForm.FormTitle = "物料列表";
|
|
DataTable menuData = data;
|
|
reForm.DataSource = menuData;
|
|
reForm.MSelectFlag = false;
|
|
reForm.RowIndexWidth = 35;
|
|
reForm.FormWidth = 500;
|
|
reForm.FormHeight = 500;
|
|
|
|
if (reForm.ShowDialog() == DialogResult.OK)
|
|
{
|
|
DataTable retData = reForm.ReturnData;
|
|
foreach (DataRow dr in retData.Rows)
|
|
{
|
|
txtInvCode.Text = dr["物料编号"].ToString();
|
|
//txtQTY.Text = dr["库存"].ToString();
|
|
//txtUnit.Text = dr["物料单位"].ToString();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void txtTransferQTY_KeyPress(object sender, KeyPressEventArgs e)
|
|
{
|
|
if (!(Char.IsNumber(e.KeyChar)) && e.KeyChar != (char)8)
|
|
{
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
|
|
private void btnCancelAll_Click(object sender, EventArgs e)
|
|
{
|
|
for (int i = 0; i < grvDetail.RowCount; i++)
|
|
{
|
|
grvDetail.SetRowCellValue(i, coSelect, false);
|
|
}
|
|
}
|
|
|
|
private void simpleButton4_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
SimpleButton btntemp = (SimpleButton)sender;
|
|
if (AppConfig.GetUserExcuteRight(this.Tag.ToString(), btntemp.Name) == false)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("对不起您没有:" + btntemp.Text + "权限,请联系系统管理员!");
|
|
return;
|
|
}
|
|
|
|
List<PrintPara> parasList = new List<PrintPara>();
|
|
List<ICSITEMLot> InfoList = new List<ICSITEMLot>();
|
|
for (int i = 0; i < grvDetail.RowCount; i++)
|
|
{
|
|
if (grvDetail.GetRowCellValue(i, coSelect).ToString() == "Y")
|
|
{
|
|
PrintPara para = new PrintPara();
|
|
para.PrintKey = "LOTNO";
|
|
para.PrintValues = new object[] { grvDetail.GetRowCellValue(i, LotNO).ToString() };
|
|
parasList.Add(para);
|
|
|
|
ICSITEMLot Info = new ICSITEMLot();
|
|
Info.LotNO = grvDetail.GetRowCellValue(i, LotNO).ToString();
|
|
Info.lastPrintUSERID = AppConfig.UserId;
|
|
Info.lastPrintTime = AppConfig.GetSeverDateTime("yyyy-MM-dd hh:mm:ss");
|
|
Info.WorkPoint = AppConfig.WorkPointCode;
|
|
InfoList.Add(Info);
|
|
}
|
|
}
|
|
if (parasList.Count == 0)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("请选择数据!");
|
|
return;
|
|
}
|
|
FormPrintDialog f = new FormPrintDialog("015", this.Text, parasList, false, null);
|
|
f.ShowDialog();
|
|
//更新打印信息
|
|
//ICSRdrecord2LOTBLL.updatePrint(InfoList, AppConfig.AppConnectString);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.ToString());
|
|
}
|
|
}
|
|
|
|
private void checkInv_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (checkInv.Checked)
|
|
{
|
|
txtInvCode.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
txtInvCode.Enabled = false;
|
|
txtInvCode.Text = null;
|
|
}
|
|
}
|
|
|
|
private void checkBatch_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (checkBatch.Checked)
|
|
{
|
|
txtBatch.ReadOnly = false;
|
|
txtBatch.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
txtBatch.ReadOnly = true;
|
|
txtBatch.Enabled = false;
|
|
txtBatch.Text = null;
|
|
}
|
|
}
|
|
|
|
private void grvDetail_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
}
|