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.
756 lines
36 KiB
756 lines
36 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.Frame.Data.Entity;
|
|
using ICSSoft.Base.Lable.PrintTool;
|
|
|
|
namespace ICSSoft.Frame.APP
|
|
{
|
|
public partial class FormICSInput : DevExpress.XtraEditors.XtraForm
|
|
{
|
|
private string sqltxt = "";
|
|
private string sqlconn = "";
|
|
String guid = AppConfig.GetGuid();
|
|
private DataTable dataSource = null;
|
|
|
|
private string MoId = "";
|
|
private string MoCode = "";
|
|
private decimal Qty = 0.00m;
|
|
DataTable Serialdata = null;
|
|
|
|
private string StorageCode = "";
|
|
private string StackCode = "";
|
|
|
|
|
|
#region 构造函数
|
|
public FormICSInput()
|
|
{
|
|
InitializeComponent();
|
|
this.MaximumSize = new Size(Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height);
|
|
this.WindowState = FormWindowState.Maximized;
|
|
|
|
}
|
|
public FormICSInput(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(btnCreate);
|
|
ControlList.Add(btnOutPut);
|
|
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 rptPage_PageIndexChanged(object Sender, EventArgs e)
|
|
{
|
|
|
|
DataTable data = AppConfig.GetPageData(Serialdata, rptPage.PageIndex, rptPage.PageSize).Copy();
|
|
//DataTable data = AppConfig.GetPageDataByDb(tempTableName, "pagerowindex", rptPage.PageSize, rptPage.PageIndex, dataSource.Rows.Count);
|
|
grdDetail.DataSource = data;
|
|
}
|
|
#endregion
|
|
|
|
private bool check()
|
|
{
|
|
int i;
|
|
if (string.IsNullOrWhiteSpace(txtCode.Text.Trim()))
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("单据号不能为空!");
|
|
return false;
|
|
}
|
|
if (string.IsNullOrWhiteSpace(txtStackCode.Text.Trim()))
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("库位不能为空!");
|
|
return false;
|
|
}
|
|
//else if(!int.TryParse(cmbSEQ.Text.Trim(),out i))
|
|
//{
|
|
// ICSBaseSimpleCode.AppshowMessageBox("行号格式不正确!");
|
|
// return false;
|
|
//}
|
|
return true;
|
|
}
|
|
|
|
#region 入库
|
|
private void btnCreate_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 (!check())
|
|
return;
|
|
|
|
DataTable dt1 = ICSSoft.Frame.Data.BLL.ICSWareHouseLotInfoLogBLL.SelectStorageID(StorageCode);
|
|
DataTable dt2 = ICSSoft.Frame.Data.BLL.ICSWareHouseLotInfoLogBLL.SelectStsckID(StackCode);
|
|
List<ICSITEMTrans> ItemTransList = new List<ICSITEMTrans>();
|
|
List<ICSITEMTransLot> ItemTransLotList = new List<ICSITEMTransLot>();
|
|
List<FormICSWareHouseLotInfoUIModel> ICSWareHouseLotInfoList = new List<FormICSWareHouseLotInfoUIModel>();
|
|
List<ICSWareHouseInfo> ICSWareHouseInfoList = new List<ICSWareHouseInfo>();
|
|
List<Rdrecord10> rd10List = new List<Rdrecord10>();
|
|
for (int i = 0; i < grvDetail.RowCount; i++)
|
|
{
|
|
if (grvDetail.GetRowCellValue(i, colisSelect).ToString() == "Y" && grvDetail.GetRowCellValue(i, colisInput).ToString() == "False" && grvDetail.GetRowCellValue(i, colStorageCode).ToString().Equals(txtStorageCode.Text.Trim())) // && grvDetail.GetRowCellValue(i, colRECSTATUS).ToString() != "已经完成"
|
|
{
|
|
|
|
DataTable dt3 = ICSSoft.Frame.Data.BLL.ICSWareHouseLotInfoLogBLL.SelectItemID(grvDetail.GetRowCellValue(i, colcInvCode).ToString());
|
|
//DataTable ddt4 = ICSSoft.Frame.Data.BLL.ICSWareHouseLotInfoLogBLL.SelectLOTQTY(grvDetail.GetRowCellValue(i, colLOTNO).ToString());
|
|
string receiptno = txtCode.Text.Trim().ToString();
|
|
int receiptline = Convert.ToInt32(grvDetail.GetRowCellValue(i, colRdrecordSEQ));
|
|
|
|
#region 判断
|
|
|
|
//检查入库数量不能为零
|
|
if (Convert.ToInt32(grvDetail.GetRowCellValue(i, colQuantity)) == 0)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("入库数量为零,不能入库!");
|
|
return;
|
|
}
|
|
//检查库别和库位必须输入
|
|
if (string.IsNullOrEmpty(StorageCode) || string.IsNullOrEmpty(StackCode))
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox("仓库或库位不能为空");
|
|
return;
|
|
}
|
|
#endregion
|
|
|
|
#region 存入库存信息表
|
|
//if (grvDetail.GetRowCellValue(i, colINVCONTROLTYPE).ToString() == "批次管控" ||
|
|
// grvDetail.GetRowCellValue(i, colINVCONTROLTYPE).ToString() == "单件管控" ||
|
|
// grvDetail.GetRowCellValue(i, colINVCONTROLTYPE).ToString() == "不管控")
|
|
//{
|
|
ICSWareHouseInfo lotinfo = new ICSWareHouseInfo();
|
|
|
|
if (dt1 != null && dt1.Rows.Count > 0)
|
|
{
|
|
lotinfo.WHGUID = dt1.Rows[0][0].ToString();
|
|
}
|
|
lotinfo.WHCode = StorageCode;
|
|
if (dt2 != null && dt2.Rows.Count > 0)
|
|
{
|
|
lotinfo.BinGUID = dt2.Rows[0][0].ToString();
|
|
}
|
|
lotinfo.BinCode = StackCode;
|
|
if (dt3 != null && dt3.Rows.Count > 0)
|
|
{
|
|
lotinfo.INVGUID = dt3.Rows[0][0].ToString();
|
|
}
|
|
lotinfo.INVCode = grvDetail.GetRowCellValue(i, colcInvCode).ToString();
|
|
//DataTable dt4 = ICSSoft.Frame.Data.BLL.ICSWareHouseLotInfoLogBLL.SelectQTY(lotinfo.WHGUID, lotinfo.BinGUID, lotinfo.INVGUID);
|
|
//if (dt4 == null || dt4.Rows.Count == 0)
|
|
//{
|
|
if (!string.IsNullOrEmpty(grvDetail.GetRowCellValue(i, colQuantity).ToString()))
|
|
{
|
|
lotinfo.QTY = Convert.ToDecimal(grvDetail.GetRowCellValue(i, colQuantity));
|
|
}
|
|
//}
|
|
//if (dt4 != null && dt4.Rows.Count > 0)
|
|
//{
|
|
// if (!string.IsNullOrEmpty(grvDetail.GetRowCellValue(i, colQuantity).ToString()) && !string.IsNullOrEmpty(dt4.Rows[0]["QTY"].ToString()))
|
|
// {
|
|
// lotinfo.QTY = Convert.ToDecimal(dt4.Rows[0]["QTY"]) + Convert.ToDecimal(grvDetail.GetRowCellValue(i, colQuantity));
|
|
// }
|
|
//}
|
|
|
|
|
|
lotinfo.WorkPoint = AppConfig.WorkPointCode;
|
|
lotinfo.MUSER = AppConfig.UserId;
|
|
lotinfo.MUSERName = AppConfig.UserName;
|
|
lotinfo.MTIME = DateTime.Now;
|
|
lotinfo.EATTRIBUTE1 = null;
|
|
ICSWareHouseInfoList.Add(lotinfo);
|
|
//ICSWareHouseLotInfoLogBLL.WareHouseInfo(lotinfo, AppConfig.AppConnectString);
|
|
|
|
//}
|
|
#endregion
|
|
|
|
#region 存入物料,产品批次的库存信息
|
|
//if (grvDetail.GetRowCellValue(i, colINVCONTROLTYPE).ToString() == "批次管控" || grvDetail.GetRowCellValue(i, colINVCONTROLTYPE).ToString() == "单件管控")
|
|
//{
|
|
FormICSWareHouseLotInfoUIModel lotinfo2 = new FormICSWareHouseLotInfoUIModel();
|
|
|
|
//if (!string.IsNullOrEmpty(grvDetail.GetRowCellValue(i, colRdrecordSEQ).ToString()))
|
|
//{
|
|
// DataTable ddt = ICSSoft.Frame.Data.BLL.ICSWareHouseLotInfoLogBLL.SelectLotNO(txtCode.Text.Trim().ToString(), Convert.ToInt32(grvDetail.GetRowCellValue(i, colRdrecordSEQ)));
|
|
// if (ddt != null && ddt.Rows.Count > 0)
|
|
// {
|
|
// for (int j = 0; j < ddt.Rows.Count; j++)
|
|
// {
|
|
lotinfo2.ID = AppConfig.GetGuid();
|
|
lotinfo2.LotNO = grvDetail.GetRowCellValue(i, colLOTNO).ToString();
|
|
//DataTable ddt1 = ICSSoft.Frame.Data.BLL.ICSWareHouseLotInfoLogBLL.SelectStorageID(StorageCode);
|
|
//if (ddt1 != null && ddt1.Rows.Count > 0)
|
|
//{
|
|
// lotinfo2.WHGUID = ddt1.Rows[0][0].ToString();
|
|
//}
|
|
if (dt1 != null && dt1.Rows.Count > 0)
|
|
{
|
|
lotinfo2.WHGUID = dt1.Rows[0][0].ToString();
|
|
}
|
|
lotinfo2.WHCode = StorageCode;
|
|
//DataTable ddt2 = ICSSoft.Frame.Data.BLL.ICSWareHouseLotInfoLogBLL.SelectStsckID(StackCode);
|
|
//if (ddt2 != null && ddt2.Rows.Count > 0)
|
|
//{
|
|
// lotinfo2.BinGUID = ddt2.Rows[0][0].ToString();
|
|
//}
|
|
if (dt2 != null && dt2.Rows.Count > 0)
|
|
{
|
|
lotinfo2.BinGUID = dt2.Rows[0][0].ToString();
|
|
}
|
|
lotinfo2.BinCode = StackCode;
|
|
//DataTable ddt3 = ICSSoft.Frame.Data.BLL.ICSWareHouseLotInfoLogBLL.SelectItemID(grvDetail.GetRowCellValue(i, colcInvCode).ToString());
|
|
//if (ddt3 != null && ddt3.Rows.Count > 0)
|
|
//{
|
|
// lotinfo2.INVGUID = ddt3.Rows[0][0].ToString();
|
|
//}
|
|
if (dt3 != null && dt3.Rows.Count > 0)
|
|
{
|
|
lotinfo2.INVGUID = dt3.Rows[0][0].ToString();
|
|
}
|
|
lotinfo2.INVCode = grvDetail.GetRowCellValue(i, colcInvCode).ToString();
|
|
//if (ddt4 != null && ddt4.Rows.Count > 0)
|
|
//{
|
|
// if (!string.IsNullOrEmpty(ddt4.Rows[0][0].ToString()))
|
|
// {
|
|
// lotinfo2.LotQty = Convert.ToDecimal(ddt4.Rows[0][0]);
|
|
// }
|
|
//}
|
|
lotinfo2.LotQty =Convert.ToDecimal(grvDetail.GetRowCellValue(i,colQuantity).ToString());
|
|
lotinfo2.ReceiveDate = DateTime.Now;
|
|
lotinfo2.WorkPoint = AppConfig.WorkPointCode;
|
|
lotinfo2.MUSER = AppConfig.UserId;
|
|
lotinfo2.MUSERName = AppConfig.UserName;
|
|
lotinfo2.MTIME = DateTime.Now;
|
|
lotinfo2.EATTRIBUTE1 = null;
|
|
ICSWareHouseLotInfoList.Add(lotinfo2);
|
|
//ICSWareHouseLotInfoLogBLL.towh(lotinfo2, AppConfig.AppConnectString);
|
|
|
|
// }
|
|
|
|
// }
|
|
//}
|
|
//}
|
|
|
|
#endregion
|
|
|
|
#region 存入物料收发交易记录表
|
|
ICSITEMTrans lotinfo3 = new ICSITEMTrans();
|
|
//if (grvDetail.GetRowCellValue(i, colINVCONTROLTYPE).ToString() == "批次管控" ||
|
|
// grvDetail.GetRowCellValue(i, colINVCONTROLTYPE).ToString() == "单件管控" ||
|
|
// grvDetail.GetRowCellValue(i, colINVCONTROLTYPE).ToString() == "不管控")
|
|
//{
|
|
lotinfo3.ID = AppConfig.GetGuid();
|
|
lotinfo3.TransNO = txtCode.Text.Trim().ToString();
|
|
if (!string.IsNullOrEmpty(grvDetail.GetRowCellValue(i, colRdrecordSEQ).ToString()))
|
|
{
|
|
lotinfo3.TransLine = Convert.ToInt32(grvDetail.GetRowCellValue(i, colRdrecordSEQ));
|
|
}
|
|
lotinfo3.ITEMCODE = grvDetail.GetRowCellValue(i, colcInvCode).ToString();
|
|
lotinfo3.FRMStorageCODE = "";
|
|
lotinfo3.FRMStackCODE = "";
|
|
lotinfo3.TOStorageCODE = StorageCode;
|
|
lotinfo3.TOStackCODE = StackCode;
|
|
if (!string.IsNullOrEmpty(grvDetail.GetRowCellValue(i, colQuantity).ToString()))
|
|
{
|
|
lotinfo3.TransQTY = Convert.ToDecimal(grvDetail.GetRowCellValue(i, colQuantity));
|
|
}
|
|
lotinfo3.Memo = "";
|
|
lotinfo3.TransType = "收";
|
|
lotinfo3.BusinessCode = "";
|
|
lotinfo3.WorkPoint = AppConfig.WorkPointCode;
|
|
lotinfo3.MUSER = AppConfig.UserId;
|
|
lotinfo3.MUSERName = AppConfig.UserName;
|
|
lotinfo3.MTIME = DateTime.Now;
|
|
lotinfo3.EATTRIBUTE1 = null;
|
|
ItemTransList.Add(lotinfo3);
|
|
//ICSWareHouseLotInfoLogBLL.trans(lotinfo3, AppConfig.AppConnectString);
|
|
|
|
//}
|
|
|
|
#endregion
|
|
#region 存入物料收发交易批号记录表
|
|
//if (grvDetail.GetRowCellValue(i, colINVCONTROLTYPE).ToString() == "批次管控" ||
|
|
// grvDetail.GetRowCellValue(i, colINVCONTROLTYPE).ToString() == "单件管控")
|
|
//{
|
|
ICSITEMTransLot lotinfo4 = new ICSITEMTransLot();
|
|
//if (!string.IsNullOrEmpty(grvDetail.GetRowCellValue(i, colRdrecordSEQ).ToString()))
|
|
//{
|
|
// DataTable ddt = ICSSoft.Frame.Data.BLL.ICSWareHouseLotInfoLogBLL.SelectLotNO(txtCode.Text.Trim().ToString(), Convert.ToInt32(grvDetail.GetRowCellValue(i, colRdrecordSEQ)));
|
|
// if (ddt != null && ddt.Rows.Count > 0)
|
|
// {
|
|
// for (int j = 0; j < ddt.Rows.Count; j++)
|
|
// {
|
|
lotinfo4.ID = AppConfig.GetGuid();
|
|
//DataTable ddt1 = ICSSoft.Frame.Data.BLL.ICSWareHouseLotInfoLogBLL.SelectTransID(txtCode.Text.Trim().ToString(), Convert.ToInt32(grvDetail.GetRowCellValue(i, colRdrecordSEQ)));
|
|
|
|
//if (ddt1 != null && ddt1.Rows.Count > 0)
|
|
//{
|
|
// lotinfo4.ITEMTransID = ddt1.Rows[0][0].ToString();
|
|
//}
|
|
lotinfo4.ITEMTransID = lotinfo3.ID;
|
|
lotinfo4.LotNO = grvDetail.GetRowCellValue(i, colLOTNO).ToString();
|
|
lotinfo4.ITEMCODE = grvDetail.GetRowCellValue(i, colcInvCode).ToString();
|
|
//DataTable ddt4 = ICSSoft.Frame.Data.BLL.ICSWareHouseLotInfoLogBLL.SelectLOTQTY(lotinfo4.LotNO);
|
|
//if (ddt4 != null && ddt4.Rows.Count > 0)
|
|
//{
|
|
// if (!string.IsNullOrEmpty(ddt4.Rows[0][0].ToString()))
|
|
// {
|
|
// lotinfo4.TransQTY = Convert.ToDecimal(ddt4.Rows[0][0]);
|
|
// }
|
|
//}
|
|
lotinfo4.TransQTY = Convert.ToDecimal(grvDetail.GetRowCellValue(i, colQuantity).ToString());
|
|
|
|
|
|
lotinfo4.Memo = "";
|
|
|
|
lotinfo4.WorkPoint = AppConfig.WorkPointCode;
|
|
lotinfo4.MUSER = AppConfig.UserId;
|
|
lotinfo4.MUSERName = AppConfig.UserName;
|
|
lotinfo4.MTIME = DateTime.Now;
|
|
ItemTransLotList.Add(lotinfo4);
|
|
//ICSWareHouseLotInfoLogBLL.transLOT(lotinfo4, AppConfig.AppConnectString);
|
|
|
|
// }
|
|
// }
|
|
//}
|
|
|
|
//}
|
|
#endregion
|
|
|
|
Rdrecord10 rd10 = new Rdrecord10();
|
|
rd10.UserName = AppConfig.UserName;
|
|
rd10.rdsID = grvDetail.GetRowCellValue(i, colRowID).ToString();
|
|
rd10.cInvCode = grvDetail.GetRowCellValue(i, colcInvCode).ToString();
|
|
rd10.Quantity = grvDetail.GetRowCellValue(i, colQuantity).ToString();
|
|
rd10.ERPConStr = AppConfig.GetDataBaseConnectStringByKey("[DB.ERP]");
|
|
rd10.whCode = txtStorageCode.Text.Trim();
|
|
rd10List.Add(rd10);
|
|
|
|
//CloseStatus(receiptno, receiptline);
|
|
//ICSWareHouseLotInfoLogBLL.updatestatus(receiptno, receiptline);
|
|
}
|
|
}
|
|
if (ICSWareHouseLotInfoList.Count > 0 && ICSWareHouseInfoList.Count > 0 && ItemTransList.Count > 0 && ItemTransLotList.Count > 0 && rd10List.Count > 0)
|
|
{
|
|
string rst = ICSWareHouseLotInfoLogBLL.updateRd10(rd10List, ICSWareHouseLotInfoList, ICSWareHouseInfoList, ItemTransList, ItemTransLotList, AppConfig.AppConnectString);
|
|
if (!rst.Equals("OK"))
|
|
{
|
|
throw new Exception("回写ERP入库单失败!");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
throw new Exception("请检查所选仓库是否和应入仓库相同!");
|
|
}
|
|
|
|
ICSBaseSimpleCode.AppshowMessageBox("操作成功");
|
|
txtMOCode_EditValueChanged(null, null);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox(ex.Message);
|
|
}
|
|
}
|
|
#endregion
|
|
//加载
|
|
private void FormICSInput_Load(object sender, EventArgs e)
|
|
{
|
|
//string sql = @"select '' as isSelect,RCARD from ICSMO2RCARD where MOID='{0}' order by RCARD asc";
|
|
//sql = string.Format(sql, MoId);
|
|
////DataTable dt = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
|
|
////grdDetail.DataSource = dt;
|
|
|
|
//Serialdata = DBHelper.ExecuteDataset(AppConfig.AppConnectString, CommandType.Text, sql).Tables[0];
|
|
//rptPage.RecordNum = Serialdata.Rows.Count;
|
|
//rptPage.PageIndex = 1;
|
|
//rptPage.PageSize = 20;
|
|
//rptPage.ReLoad();
|
|
//rptPage_PageIndexChanged(null, null);
|
|
|
|
init();
|
|
|
|
}
|
|
|
|
#region 初始化查询条件
|
|
private void init()
|
|
{
|
|
try
|
|
{
|
|
string sql = "SELECT DISTINCT ReceiptNO AS [单据号] FROM ICSINVReceipt WHERE WorkPoint='{0}' ORDER BY ReceiptNO ";
|
|
|
|
sql += @"
|
|
SELECT
|
|
a.StackCode AS 库位代码,
|
|
a.StackName AS 库位名称,
|
|
b.StorageCode AS 仓库代码,
|
|
b.StorageName AS 仓库名称
|
|
FROM
|
|
ICSStack a
|
|
INNER JOIN ICSStorage b ON a.storage_serial = b.serial AND a.WorkPoint=b.WorkPoint
|
|
WHERE a.workpoint ='{0}'
|
|
ORDER BY a.StackCode";
|
|
|
|
sql = string.Format(sql, AppConfig.WorkPointCode);
|
|
DataSet ds= DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql);
|
|
txtCode.Properties.ValueMember = "单据号";
|
|
txtCode.Properties.DisplayMember = "单据号";
|
|
txtCode.Properties.DataSource = ds.Tables[0];
|
|
txtCode.Properties.NullText = "";//空时的值
|
|
txtCode.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
|
|
txtCode.Properties.ValidateOnEnterKey = true;//回车确认
|
|
txtCode.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
|
|
txtCode.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
|
|
//自适应宽度
|
|
txtCode.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
|
|
|
|
|
|
txtStackCode.Properties.ValueMember = "库位代码";
|
|
txtStackCode.Properties.DisplayMember = "库位代码";
|
|
txtStackCode.Properties.DataSource = ds.Tables[1];
|
|
txtStackCode.Properties.NullText = "";//空时的值
|
|
txtStackCode.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
|
|
txtStackCode.Properties.ValidateOnEnterKey = true;//回车确认
|
|
txtStackCode.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
|
|
txtStackCode.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
|
|
//自适应宽度
|
|
txtStackCode.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox(ex.ToString());
|
|
}
|
|
}
|
|
|
|
private void initBin()
|
|
{
|
|
try
|
|
{
|
|
string sql = @"
|
|
SELECT
|
|
a.StackCode AS 库位代码,
|
|
a.StackName AS 库位名称,
|
|
b.StorageCode AS 仓库代码,
|
|
b.StorageName AS 仓库名称
|
|
FROM
|
|
ICSStack a
|
|
INNER JOIN ICSStorage b ON a.storage_serial = b.serial AND a.WorkPoint=b.WorkPoint
|
|
INNER JOIN ICSINVReceipt c ON b.Serial = c.StorageID AND b.WorkPoint=c.WorkPoint
|
|
WHERE a.workpoint ='{0}' AND c.ReceiptNO='{1}'
|
|
ORDER BY a.StackCode";
|
|
|
|
sql = string.Format(sql, AppConfig.WorkPointCode,txtCode.EditValue.ToString());
|
|
DataSet ds = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql);
|
|
|
|
txtStackCode.Properties.ValueMember = "库位代码";
|
|
txtStackCode.Properties.DisplayMember = "库位代码";
|
|
txtStackCode.Properties.DataSource = ds.Tables[0];
|
|
txtStackCode.Properties.NullText = "";//空时的值
|
|
txtStackCode.Properties.ImmediatePopup = true;//输入值是否马上弹出窗体
|
|
txtStackCode.Properties.ValidateOnEnterKey = true;//回车确认
|
|
txtStackCode.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.Standard;//要使用户可以输入,这里须设为Standard
|
|
txtStackCode.Properties.AllowNullInput = DevExpress.Utils.DefaultBoolean.True; //可用Ctrl + Delete清空选择內容
|
|
//自适应宽度
|
|
txtStackCode.Properties.BestFitMode = DevExpress.XtraEditors.Controls.BestFitMode.BestFitResizePopup;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox(ex.ToString());
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
private void txtMOCode_EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
grdDetail.DataSource = null;
|
|
string Code = txtCode.EditValue.ToString();
|
|
string sql = @"SELECT
|
|
CASE WHEN b.LotNO IS NOT NULL THEN '' ELSE 'Y' END AS isSelect,
|
|
a.ID,
|
|
c.MOCODE,
|
|
c.MOSEQ,
|
|
c.RECSTATUS,
|
|
f.StorageCode,c.EATTRIBUTE1 AS RowID,
|
|
a.TransNO AS Rdrecord,
|
|
a.TransLine AS RdrecordSEQ,
|
|
a.LOTNO,
|
|
a.LOTQTY AS Quantity,
|
|
CAST(CASE WHEN b.LotNO IS NOT NULL THEN '1' ELSE '0' END AS BIT) AS isInput,
|
|
c.ITEMCODE AS cInvCode,
|
|
d.INVNAME,
|
|
d.INVCLASS,
|
|
d.INVCONTROLTYPE
|
|
FROM
|
|
ICSITEMLot a
|
|
LEFT JOIN ICSWareHouseLotInfo b ON a.LOTNO=b.LotNO AND a.WorkPoint=b.WorkPoint
|
|
LEFT JOIN ICSINVReceiptDetail c ON a.TransNO=c.ReceiptNO AND a.TransLine=c.ReceiptLine AND a.WorkPoint=c.WorkPoint
|
|
LEFT JOIN ICSINVENTORY d ON c.ITEMCODE=d.INVCODE AND c.WorkPoint=d.WorkPoint
|
|
LEFT JOIN ICSINVReceipt e ON a.TransNO=e.ReceiptNO AND a.WorkPoint=d.WorkPoint
|
|
LEFT JOIN ICSStorage f ON e.StorageID=f.Serial AND e.WorkPoint=f.WorkPoint
|
|
WHERE
|
|
a.TransNO = '{0}'
|
|
AND a.WorkPoint = '{1}'
|
|
ORDER BY
|
|
a.LOTNO";
|
|
sql = string.Format(sql, Code, AppConfig.WorkPointCode);
|
|
Serialdata = DBHelper.ExecuteDataset(AppConfig.AppConnectString.ToString(), CommandType.Text, sql).Tables[0];
|
|
|
|
grdDetail.DataSource = Serialdata;
|
|
grvDetail.BestFitColumns();
|
|
rptPage.RecordNum = Serialdata.Rows.Count;
|
|
rptPage.PageSize = 499;
|
|
rptPage.PageIndex = 1;
|
|
rptPage.ReLoad();
|
|
rptPage.PageSize = 500;
|
|
rptPage.PageIndex = 1;
|
|
rptPage.ReLoad();
|
|
rptPage_PageIndexChanged(null, null);
|
|
initBin();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox(ex.ToString());
|
|
}
|
|
}
|
|
|
|
private void txtStackCode_EditValueChanged(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
GridLookUpEdit edit = sender as GridLookUpEdit;
|
|
if(edit.EditValue !=null && edit.EditValue.ToString() != "" && edit.EditValue.ToString() != "nulltext")
|
|
{
|
|
var dr = edit.Properties.View.GetDataRow(edit.Properties.View.FocusedRowHandle);
|
|
if (dr is DataRow)
|
|
{
|
|
DataRow row = dr as DataRow;
|
|
|
|
txtStackName.Text = row["库位名称"].ToString();
|
|
txtStorageCode.Text = row["仓库代码"].ToString();
|
|
txtStorageName.Text = row["仓库名称"].ToString();
|
|
|
|
StorageCode = row["仓库代码"].ToString();
|
|
StackCode = row["库位代码"].ToString();
|
|
}
|
|
else
|
|
{
|
|
txtStackName.Text = "";
|
|
txtStorageCode.Text = "";
|
|
txtStorageName.Text = "";
|
|
|
|
StorageCode = "";
|
|
StackCode = "";
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ICSBaseSimpleCode.AppshowMessageBox(ex.ToString());
|
|
}
|
|
}
|
|
|
|
#region 全选
|
|
private void btnSelectAll_Click(object sender, EventArgs e)
|
|
{
|
|
grvDetail.PostEditor();
|
|
this.Validate();
|
|
for (int i = 0; i < grvDetail.RowCount; i++)
|
|
{
|
|
grvDetail.SetRowCellValue(i, colisSelect, "Y");
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 全消
|
|
private void btnCancelAll_Click(object sender, EventArgs e)
|
|
{
|
|
grvDetail.PostEditor();
|
|
this.Validate();
|
|
for (int i = 0; i < grvDetail.RowCount; i++)
|
|
{
|
|
grvDetail.SetRowCellValue(i, colisSelect, "");
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
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, "");
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
#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
|
|
|
|
private void grvDetail_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
|
|
{
|
|
if (grvDetail.GetRowCellValue(e.RowHandle, colisInput).ToString().Equals("True"))
|
|
{
|
|
e.Appearance.BackColor = Color.DeepSkyBlue;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|