395 lines
12 KiB
C#
395 lines
12 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
using WMS.Model.Stock;
|
|
using WMS.Common;
|
|
using WMS.Model.CK;
|
|
using WMS.Frm.Base;
|
|
using WMS.Business;
|
|
using WMS.Business.CK;
|
|
using WMS.Model;
|
|
using System.Configuration;
|
|
using WMS.Model.Base;
|
|
using System.Threading;
|
|
using WMS.Business.Base;
|
|
using System.Net;
|
|
using System.Net.Sockets;
|
|
|
|
namespace WMS.FrmCK
|
|
{
|
|
public partial class AutoFrmPick : FormBase
|
|
{
|
|
string outStand = ConfigurationManager.ConnectionStrings["outStand"].ConnectionString;
|
|
public AutoFrmPick()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
List<PakWaitOut> DataErpoutPick = new List<PakWaitOut>();
|
|
List<PickingWaveGoodsModel> listPickingGoods = new List<PickingWaveGoodsModel>();
|
|
public void BindErpGoods()
|
|
{
|
|
|
|
try
|
|
{
|
|
DataErpoutPick = IBussFactory<BussPickingWaveGoods>.Instance().GeterpData();
|
|
if (DataErpoutPick != null)
|
|
{
|
|
bdc_pick.DataSource = DataErpoutPick;
|
|
if (DataErpoutPick.Count > 0)
|
|
{
|
|
gdvMxBind.FocusedRowHandle = 0;
|
|
// gdvMxBind_RowClick(null, null);
|
|
}
|
|
//t_code.Focus();
|
|
//t_code.SelectAll();
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
SystemCommon.ShowInfoMessageBox("err");
|
|
}
|
|
|
|
|
|
}
|
|
|
|
void BindPick()
|
|
{
|
|
listPickingGoods = IBussFactory<BussPickingWaveGoods>.Instance().LtkgetPickData(outStand);
|
|
if (listPickingGoods != null)
|
|
{
|
|
bgc_outMx.DataSource = listPickingGoods;
|
|
//if (listPickingGoods.Count > 0)
|
|
//{
|
|
// tb_select.SelectedTabPageIndex = 1;
|
|
|
|
//}
|
|
|
|
}
|
|
}
|
|
string GetAddressIP()
|
|
{
|
|
///获取本地的IP地址
|
|
try
|
|
{
|
|
string HostName = Dns.GetHostName(); //得到主机名
|
|
IPHostEntry IpEntry = Dns.GetHostEntry(HostName);
|
|
for (int i = 0; i < IpEntry.AddressList.Length; i++)
|
|
{
|
|
if (IpEntry.AddressList[i].AddressFamily == AddressFamily.InterNetwork)
|
|
{
|
|
return IpEntry.AddressList[i].ToString();
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(" IP ERROR:" + ex.Message);
|
|
return "";
|
|
}
|
|
}
|
|
string stsDec = string.Empty;
|
|
private void AutoFrmPick_Load(object sender, EventArgs e)
|
|
{
|
|
this.Select();
|
|
timer1.Start();
|
|
string ip = GetAddressIP();
|
|
DataTable tbpcIpccy = IBussFactory<BussDecSts>.Instance().GetDecIPDecData(ip);
|
|
if (tbpcIpccy != null)
|
|
{
|
|
if (tbpcIpccy.Rows.Count == 0)
|
|
{
|
|
stsDec = "HP";
|
|
// t_message.Text = "Config error";
|
|
//this.Enabled = false;
|
|
//return;
|
|
}
|
|
else
|
|
{
|
|
stsDec = tbpcIpccy.Rows[0]["optype"].ToString();
|
|
}
|
|
}
|
|
|
|
// stsDec = ConfigurationManager.ConnectionStrings["dectype"].ConnectionString;
|
|
BindErpGoods();
|
|
BindPick();
|
|
new Thread(delegate ()
|
|
{
|
|
this.Invoke(new MethodInvoker(delegate
|
|
{
|
|
t_code.Focus();
|
|
t_code.SelectAll();
|
|
}));
|
|
}).Start();
|
|
// gridControlCustom3.Focus();
|
|
// gdvMxBind.OptionsFind.AllowFindPanel = true;// (gdvMxBind.OptionsFind);
|
|
|
|
|
|
// gridControlCustom3
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ctrlButtons7_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
BindErpGoods();
|
|
|
|
BindPick();
|
|
}
|
|
|
|
private void ctrlButtons6_Click(object sender, EventArgs e)
|
|
{
|
|
timer1.Start();
|
|
if (dataSelect.Count == 0)
|
|
{
|
|
t_code.Focus();
|
|
t_code.SelectAll();
|
|
SystemCommon.ShowInfoMessageBox("No Scan");
|
|
return;
|
|
}
|
|
if (t_station.Text.Trim().Length == 0)
|
|
{
|
|
t_code.Focus();
|
|
t_code.SelectAll();
|
|
SystemCommon.ShowInfoMessageBox("No data station");
|
|
return;
|
|
}
|
|
if (t_station.Text.Trim()=="0")
|
|
{
|
|
t_code.Focus();
|
|
t_code.SelectAll();
|
|
SystemCommon.ShowInfoMessageBox("No data station");
|
|
return;
|
|
}
|
|
// string errtex = IBussFactory<BussPickingWaveGoods>.Instance().ErpDataExpress(dataSelect, outStand);
|
|
// if (errtex.Length == 0)
|
|
// {
|
|
// tb_select.SelectedTabPageIndex = 1;
|
|
// BindPick();
|
|
// SystemCommon.ShowInfoMessageBox("data uccess");
|
|
// dataSelect.Clear();
|
|
// BindErpGoods();
|
|
// t_station.Text = "";
|
|
// outStand = "";
|
|
// t_message.Text = "success";
|
|
timer1.Start();
|
|
// }
|
|
t_code.Focus();
|
|
t_code.SelectAll();
|
|
}
|
|
List<PakWaitOut> dataSelect = new List<PakWaitOut>();
|
|
private void gdvMxBind_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
|
|
{
|
|
if (gdvMxBind.RowCount > 0)
|
|
{
|
|
string loc = gdvMxBind.GetFocusedRowCellValue("Location").ToString();
|
|
|
|
List<StorageAreaLocationModel> listLoc = IBussFactory<BussPickingWaveGoods>.Instance().GetLocaStationAllData(loc);
|
|
if (listLoc != null)
|
|
{
|
|
bindingSource1.DataSource = listLoc;
|
|
if (listLoc.Count > 0)
|
|
{
|
|
|
|
if (stsDec == "HP")
|
|
{
|
|
t_station.Text = listLoc[0].outStand;
|
|
outStand = listLoc[0].outStand;
|
|
|
|
t_code.Focus();
|
|
t_code.SelectAll();
|
|
}
|
|
else
|
|
{
|
|
t_station.Text = listLoc[listLoc.Count-1].outStand;
|
|
outStand = listLoc[listLoc.Count - 1].outStand;
|
|
gridView7.FocusedRowHandle = 1;
|
|
|
|
t_code.Focus();
|
|
t_code.SelectAll();
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
private void ctrlButtons1_Click_1(object sender, EventArgs e)
|
|
{
|
|
if (listPickingGoods.Count == 0)
|
|
{
|
|
return;
|
|
}
|
|
if (SystemCommon.ShowMessageBoxResult("Confirm Out") == DialogResult.OK)
|
|
{
|
|
string sts = gdv_Kcmx.GetFocusedRowCellValue("status").ToString().Trim();
|
|
string loc = gdv_Kcmx.GetFocusedRowCellValue("LOC_ID").ToString().Trim();
|
|
string sheet = gdv_Kcmx.GetFocusedRowCellValue("PICKINGID").ToString().Trim();
|
|
string PROVIDER_ID = gdv_Kcmx.GetFocusedRowCellValue("PROVIDER_ID").ToString().Trim();
|
|
if (sts != "2")
|
|
{
|
|
SystemCommon.ShowInfoMessageBox("device is not out");
|
|
return;
|
|
}
|
|
List<PickingWaveGoodsModel> selectLoc= listPickingGoods.FindAll(r => r.LOC_ID == loc);
|
|
if (selectLoc.Count > 0)
|
|
{
|
|
// List<Pak_io_complete> pkData= IBussFactory<BussPickingWaveGoods>.Instance().OutMisData(loc, sheet, PROVIDER_ID, userData.USER_ID);
|
|
|
|
// if (pkData != null)
|
|
// {
|
|
// bgc_kc.DataSource = pkData;
|
|
|
|
BindPick();
|
|
// SystemCommon.ShowInfoMessageBox("data uccess");
|
|
dataSelect.Clear();
|
|
BindErpGoods();
|
|
//}
|
|
}
|
|
}
|
|
}
|
|
void OutDataExce()
|
|
{
|
|
|
|
}
|
|
|
|
private void timer1_Tick(object sender, EventArgs e)
|
|
{
|
|
|
|
|
|
BindPick();
|
|
BindErpGoods();
|
|
try
|
|
|
|
{
|
|
new Thread(delegate ()
|
|
{
|
|
this.Invoke(new MethodInvoker(delegate
|
|
{
|
|
t_code.Focus();
|
|
t_code.SelectAll();
|
|
}));
|
|
}).Start();
|
|
}catch(Exception ex)
|
|
{ }
|
|
|
|
}
|
|
|
|
private void gridView7_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
|
|
{
|
|
if (gridView7.RowCount > 0)
|
|
{
|
|
if (gridView7.FocusedRowHandle >= 0)
|
|
{
|
|
string stand = gridView7.GetFocusedRowCellValue("outStand").ToString();
|
|
t_station.Text = stand;
|
|
outStand = stand;
|
|
}
|
|
}
|
|
}
|
|
|
|
private void label3_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void t_code_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
if (DataErpoutPick.Count > 0)
|
|
{
|
|
|
|
timer1.Stop();
|
|
int bgs = DataErpoutPick.FindIndex(r => r.Sheet_no.Trim() == t_code.Text.Trim());
|
|
if (bgs >= 0)
|
|
{
|
|
t_message.Text = "";
|
|
|
|
dataSelect = DataErpoutPick.FindAll(r => r.Sheet_no.Trim() == t_code.Text.Trim());
|
|
if (dataSelect.Count > 0)
|
|
{
|
|
bdc_pick.DataSource = dataSelect;
|
|
gdvMxBind.FocusedRowHandle = 0;
|
|
gdvMxBind_RowClick(null, null);
|
|
}
|
|
timer1.Stop();
|
|
gdvMxBind.RefreshData();
|
|
// gdvMxBind.FocusedRowHandle = bgs;
|
|
// ctrlButtons6_Click(null, null);
|
|
}
|
|
else
|
|
{
|
|
timer1.Start();
|
|
|
|
if (dataSelect != null)
|
|
{
|
|
dataSelect.Clear();
|
|
bdc_pick.DataSource = dataSelect;
|
|
gdvMxBind.RefreshData();
|
|
}
|
|
|
|
t_message.Text = "No Data";
|
|
|
|
|
|
}
|
|
t_code.Focus();
|
|
t_code.SelectAll();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void AutoFrmPick_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
t_code_KeyDown(null, e);
|
|
}
|
|
|
|
}
|
|
|
|
private void ctrlButtons2_Click(object sender, EventArgs e)
|
|
{
|
|
if (t_code.Text.Trim().Length == 0)
|
|
{
|
|
return;
|
|
}
|
|
int bgs = DataErpoutPick.FindIndex(r => r.Sheet_no.Trim() == t_code.Text.Trim());
|
|
if (bgs >= 0)
|
|
{
|
|
dataSelect = DataErpoutPick.FindAll(r => r.Sheet_no.Trim() == t_code.Text.Trim());
|
|
if (dataSelect.Count > 0)
|
|
{
|
|
bdc_pick.DataSource = dataSelect;
|
|
gdvMxBind.FocusedRowHandle = 0;
|
|
gdvMxBind_RowClick(null,null);
|
|
}
|
|
// ctrlButtons6_Click(null, null);
|
|
}
|
|
else
|
|
{
|
|
t_message.Text = "No Data";
|
|
|
|
}
|
|
t_code.Focus();
|
|
t_code.SelectAll();
|
|
}
|
|
|
|
private void AutoFrmPick_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
timer1.Stop();
|
|
Thread.Sleep(500);
|
|
}
|
|
}
|
|
}
|