495 lines
18 KiB
C#
495 lines
18 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.Frm.Base;
|
|||
|
|
using WMS.Model.Stock;
|
|||
|
|
using WMS.Common;
|
|||
|
|
|
|||
|
|
using System.Collections;
|
|||
|
|
using WMS.Model.Base;
|
|||
|
|
using DevExpress.XtraCharts;
|
|||
|
|
using System.Threading;
|
|||
|
|
using DevExpress.Utils;
|
|||
|
|
using WMS.Business;
|
|||
|
|
using WMS.Business.Report;
|
|||
|
|
using WMS.Business.Stock;
|
|||
|
|
using DevExpress.XtraGrid.Views.Grid;
|
|||
|
|
using DevExpress.XtraExport.Helpers;
|
|||
|
|
using WMS.DBUtility;
|
|||
|
|
using DevExpress.Emf;
|
|||
|
|
|
|||
|
|
namespace WMS.FrmReport
|
|||
|
|
{
|
|||
|
|
public partial class FrmMIStockSearch : FormBase
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 库存Model
|
|||
|
|
/// </summary>
|
|||
|
|
MIStockModel miStockModel = new MIStockModel();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 库存List
|
|||
|
|
/// </summary>
|
|||
|
|
List<MIStockModel> miStockList = new List<MIStockModel>();
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
public StorageAreaLocationModel loc;
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 无参构造
|
|||
|
|
/// </summary>
|
|||
|
|
public FrmMIStockSearch()
|
|||
|
|
{
|
|||
|
|
InitializeComponent();
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 通用查询
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="table"></param>
|
|||
|
|
public override void LoadListData(DataTable table)
|
|||
|
|
{
|
|||
|
|
miStockList = ConvertHelper<MIStockModel>.ConvertToList(table);
|
|||
|
|
|
|||
|
|
GVMiStock.RefreshData();
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 窗体加载
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
public void FrmMIStockSearch_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
BindMiStockData( );
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 绑定库存数据
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="mistock"></param>
|
|||
|
|
public void BindMiStockData()
|
|||
|
|
{
|
|||
|
|
DevExpress.Utils.WaitDialogForm loadForm = new DevExpress.Utils.WaitDialogForm("请稍后...", "正在查询数据请等待...");
|
|||
|
|
|
|||
|
|
miStockList = IBussFactory<BussMIStockSearch>.Instance().GetMiStockForLookUp();
|
|||
|
|
|
|||
|
|
if (miStockList != null)
|
|||
|
|
{
|
|||
|
|
bgsStock.DataSource = miStockList;
|
|||
|
|
}
|
|||
|
|
loadForm.Dispose();
|
|||
|
|
loadForm.Close();
|
|||
|
|
|
|||
|
|
//new Thread(delegate()
|
|||
|
|
//{
|
|||
|
|
// string errText = string.Empty;
|
|||
|
|
// try
|
|||
|
|
// {
|
|||
|
|
// this.Invoke(new MethodInvoker(delegate
|
|||
|
|
// {
|
|||
|
|
|
|||
|
|
// }));
|
|||
|
|
// }
|
|||
|
|
// catch (Exception)
|
|||
|
|
// {
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("error");
|
|||
|
|
// }
|
|||
|
|
//}).Start();
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 构造函数 传参查询
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="lo"></param>
|
|||
|
|
public void BindMiStockDataByLoc(StorageAreaLocationModel lo)
|
|||
|
|
{
|
|||
|
|
new Thread(delegate()
|
|||
|
|
{
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
this.Invoke(new MethodInvoker(delegate
|
|||
|
|
{
|
|||
|
|
miStockModel = new MIStockModel();
|
|||
|
|
miStockModel.STORAGE_ID = lo.STORAGE_ID;
|
|||
|
|
miStockModel.AREA_ID = lo.STORAGE_AREA_ID;
|
|||
|
|
miStockModel.LOCATION_ID = lo.LOCATION_ID;
|
|||
|
|
// miStockList = new List<MIStockModel>();
|
|||
|
|
miStockList.Clear();
|
|||
|
|
|
|||
|
|
miStockList = IBussFactory<BussMIStockSearch>.Instance().GetMiStockForLookUp();
|
|||
|
|
if (miStockList != null)
|
|||
|
|
{
|
|||
|
|
GCMiStock.DataSource = miStockList;
|
|||
|
|
GVMiStock.RefreshData();
|
|||
|
|
|
|||
|
|
if (miStockList.Count > 0)
|
|||
|
|
{
|
|||
|
|
foreach (MIStockModel item in miStockList)
|
|||
|
|
{
|
|||
|
|
item.DUE_DATE = item.PRODUCTION_DATE.AddMonths(Convert.ToInt32(item.PERIOD));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bgsStock.DataSource = miStockList;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}));
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("获取数据失败,请检查网络连接!");
|
|||
|
|
}
|
|||
|
|
}).Start();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 刷新
|
|||
|
|
/// </summary>
|
|||
|
|
public void Refresh()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
BindMiStockData();
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 导出
|
|||
|
|
/// </summary>
|
|||
|
|
public void Export()
|
|||
|
|
{
|
|||
|
|
GCMiStock.ShowExportDialog();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 导入
|
|||
|
|
/// </summary>
|
|||
|
|
public void Import()
|
|||
|
|
{
|
|||
|
|
OpenFileDialog fileDialog = new OpenFileDialog();
|
|||
|
|
fileDialog.Title = "Import";
|
|||
|
|
fileDialog.Filter = "Excel(*.xls;*.xlsx)|*.xls;*.xlsx";
|
|||
|
|
DialogResult dialogResult = fileDialog.ShowDialog(this);
|
|||
|
|
if (dialogResult == DialogResult.OK)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
Hashtable ht = new Hashtable();
|
|||
|
|
ht.Add("GOODS_ID", "GOODS ID");
|
|||
|
|
ht.Add("GOODS_NAME", "GOODS_NAM");
|
|||
|
|
ht.Add("SHELVES_NUM", "Qty");
|
|||
|
|
ht.Add("DOCCTNUMBER", "Sheet_no");
|
|||
|
|
ht.Add("LOCATION_ID", "LOCATION");
|
|||
|
|
ht.Add("CTl", "Pallet");
|
|||
|
|
|
|||
|
|
List<MIStockModel> list = NPOIHelper<MIStockModel>.Import(fileDialog, ht);
|
|||
|
|
|
|||
|
|
|
|||
|
|
//if (list == null)
|
|||
|
|
//{
|
|||
|
|
// return;
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
//list.RemoveAll(p => string.IsNullOrEmpty(p.LOCATION_ID));//p.SHELVES_NUM == 0 ||
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (list.Count > 0)
|
|||
|
|
{ //保存
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
errText = IBussFactory<BussMIStock>.Instance().AddMIStockList(list);
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox("error!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (errText.Trim().Length== 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("sucess");
|
|||
|
|
Refresh();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox(errText);
|
|||
|
|
Refresh();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 清空按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Clear()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 条件查询
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
public void Search()
|
|||
|
|
{
|
|||
|
|
GCMiStock.Focus();
|
|||
|
|
|
|||
|
|
BindMiStockData();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
private void btnSearch_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
// chartControl1.Series.Clear();
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
private void GVMiStock_DoubleClick(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
// xtraTabControl1.SelectedTabPageIndex = 1;
|
|||
|
|
// chartControl1.Series.Clear();
|
|||
|
|
MIStockModel m = this.GVMiStock.GetFocusedRow() as MIStockModel;
|
|||
|
|
// xtraTabPage2.Text = m.GOODS_NAME + " - 商品走势";
|
|||
|
|
|
|||
|
|
|
|||
|
|
MIStockBackModel mm = new MIStockBackModel();
|
|||
|
|
List<MIStockBackModel> llist = new List<MIStockBackModel>();
|
|||
|
|
mm.GOODS_ID = m.GOODS_ID;
|
|||
|
|
mm.STORAGE_ID = m.STORAGE_ID;
|
|||
|
|
mm.AREA_ID = m.AREA_ID;
|
|||
|
|
mm.LOCATION_ID = m.LOCATION_ID;
|
|||
|
|
mm.TIMESTART = Convert.ToDateTime(DateTime.Now.AddDays(-(DateTime.Now.Day - 1)).AddMonths(-1).ToString("yyyy-MM-dd"));
|
|||
|
|
mm.TIMEEND = DateTime.Now;
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
|
|||
|
|
string strResult = string.Empty;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
llist = IBussFactory<BussMIStockSearch>.Instance().DayReportData(mm);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void GVBackReport_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (e.Column.FieldName == "OPERATOR_TYPE")
|
|||
|
|
{
|
|||
|
|
if (e.Value == null)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
switch (e.Value.ToString().Trim())
|
|||
|
|
{
|
|||
|
|
case "0":
|
|||
|
|
e.DisplayText = "入库";
|
|||
|
|
break;
|
|||
|
|
case "1":
|
|||
|
|
e.DisplayText = "出库";
|
|||
|
|
break;
|
|||
|
|
case "2":
|
|||
|
|
e.DisplayText = "调整";
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
e.DisplayText = "其他";
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void btnClear_Click(object sender, EventArgs e)
|
|||
|
|
{ }
|
|||
|
|
|
|||
|
|
private void GVMiStock_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
|
|||
|
|
{
|
|||
|
|
//t.STS when '0' then '正常' when '1' then '出库中' when '2' then '已下发堆垛机' when '6' then '堆垛机完成' when '9' then '手持拣货完成' when '10' then '库存扣除处理中'
|
|||
|
|
//GridView View = sender as GridView;
|
|||
|
|
//if (e.Column.FieldName == "手持拣货完成")//设背景
|
|||
|
|
//{
|
|||
|
|
// //int pointID = (gridView1.GetRow(e.RowHandle) as object).BgColor;
|
|||
|
|
// e.Appearance.BackColor = Color.Yellow;
|
|||
|
|
//}
|
|||
|
|
////else if (e.Column.FieldName == "BgColor2")//设渐变背景
|
|||
|
|
////{
|
|||
|
|
//// //int pointID = (gridView1.GetRow(e.RowHandle) as object).BgColor;
|
|||
|
|
//// e.Appearance.BackColor = Color.Red;
|
|||
|
|
//// e.Appearance.BackColor2 = Color.FromArgb(255, 255, 255);
|
|||
|
|
//// e.Appearance.ForeColor = Color.Red;//Color.FromArgb(42, 173, 231);
|
|||
|
|
////}
|
|||
|
|
//else /*if (e.Column.FieldName == "FontColor")//设字体颜色*/
|
|||
|
|
//{
|
|||
|
|
// //int pointID = (gridView1.GetRow(e.RowHandle) as object).BgColor;
|
|||
|
|
// e.Appearance.BackColor = Color.Transparent;//Color.FromArgb(42, 173, 231);
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (e.RowHandle >= 0) //
|
|||
|
|
{
|
|||
|
|
string status_MES = GVMiStock.GetRowCellDisplayText(e.RowHandle, GVMiStock.Columns["STSEBS"]);//获取限制变色条件行的值
|
|||
|
|
// 获取行的数据
|
|||
|
|
DataRow rowInfo = GVMiStock.GetRow(e.RowHandle) as DataRow;
|
|||
|
|
string status = GVMiStock.GetRowCellDisplayText(e.RowHandle, GVMiStock.Columns["STSEBS"]);//获取限制变色条件行的值
|
|||
|
|
|
|||
|
|
{
|
|||
|
|
// 假设你有一个字段叫 "Status" 用来决定颜色
|
|||
|
|
//string status = rowInfo["STS"].ToString();
|
|||
|
|
if (status == "mes上报失败"||status=="未上报mes")
|
|||
|
|
{
|
|||
|
|
e.Appearance.BackColor = Color.Red; // 设置背景色
|
|||
|
|
}
|
|||
|
|
else /*if (status == "Inactive")*/
|
|||
|
|
{
|
|||
|
|
e.Appearance.BackColor = Color.Transparent; // 设置背景色
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//private void button1_Click(object sender, EventArgs e)
|
|||
|
|
//{
|
|||
|
|
// string sql = " SELECT * FROM T_MI_STOCK where stsebs in(2,9)";
|
|||
|
|
// DataSet dt= OracleHelper.ExecuteDataset(CommandType.Text, sql);
|
|||
|
|
// if (dt.Tables[0].Rows.Count>0)
|
|||
|
|
// {
|
|||
|
|
// for (int i = 0; i < dt.Tables[0].Rows.Count; i++)
|
|||
|
|
// {
|
|||
|
|
// string STORAGE_ID = dt.Tables[0].Rows[i]["STORAGE_ID"].ToString(); //字库编号
|
|||
|
|
// string LOCATION_ID = dt.Tables[0].Rows[i]["LOCATION_ID"].ToString();
|
|||
|
|
// string BARCODE = dt.Tables[0].Rows[i]["BARCODE"].ToString();//外箱子 + 内箱子条码
|
|||
|
|
// string CUSTOMER_ID = dt.Tables[0].Rows[i]["CUSTOMER_ID"].ToString();//客户代码
|
|||
|
|
// string newLoc = STORAGE_ID + "-WMS-00";
|
|||
|
|
|
|||
|
|
// string strJsonRK = GetWmsData("http://" + MesIpPort + "/Camstar/PackStock.asmx/PackStockIn?pkwPackLot=" + BARCODE + "&pCustPackId=&pSubInventory=" + STORAGE_ID + "&pLocation=" + newLoc + "", "");
|
|||
|
|
// if (errText.Length > 0)
|
|||
|
|
// {
|
|||
|
|
// AddText("WCS定时上报mes成功回传MES异常:" + errText);
|
|||
|
|
// continue;
|
|||
|
|
// }
|
|||
|
|
// if (strJsonRK.Length > 0)
|
|||
|
|
// {
|
|||
|
|
// AddText("WCS定时上报mes成功回传MES返回:" + strJsonRK);
|
|||
|
|
|
|||
|
|
// if (!strJsonRK.Contains("当前工位 '成品仓'") && strJsonRK.Contains("Error"))
|
|||
|
|
// {
|
|||
|
|
// if (DataClass.Instance().Update_T_MI_STOCK_STSEBS(LOCATION_ID, BARCODE, "9"))
|
|||
|
|
// {
|
|||
|
|
// AddText("WCS定时上报mes成功回传MES错误:编号:" + BARCODE + "," + strJsonRK + ",更新数据库状态9成功");
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
// AddText("WCS定时上报mes成功回传MES错误:编号:" + BARCODE + "," + strJsonRK + ",更新数据库状态9失败");
|
|||
|
|
// }
|
|||
|
|
// AddText("WCS定时上报mes成功回传MES错误:编号:" + BARCODE + "," + strJsonRK + "");
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
// if (DataClass.Instance().Update_T_MI_STOCK_STSEBS(LOCATION_ID, BARCODE, "1"))
|
|||
|
|
// {
|
|||
|
|
// AddText("WCS定时上报mes成功回传MES成功:编号:" + BARCODE + "," + strJsonRK + ",更新数据库状态1成功");
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
// AddText("WCS定时上报mes成功回传MES成功:编号:" + BARCODE + "," + strJsonRK + ",更新数据库状态1失败");
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// //string errTex.Rt = "";
|
|||
|
|
// //DataSet dt = IBussFactory<BussMIStock>.Instance().STATUS_GET();
|
|||
|
|
// //DataSet dt = DataClass.Instance().SELECTT_MI_STOCK_9(ref errText);
|
|||
|
|
// //if (dt != null && dt.Tables[0].Rows.Count > 0)
|
|||
|
|
// //{
|
|||
|
|
// // for (int i = 0; i < dt.Tables[0].Rows.Count; i++)
|
|||
|
|
// // {
|
|||
|
|
// // string STORAGE_ID = dt.Tables[0].Rows[i]["STORAGE_ID"].ToString(); //字库编号
|
|||
|
|
// // string LOCATION_ID = dt.Tables[0].Rows[i]["LOCATION_ID"].ToString();
|
|||
|
|
// // string BARCODE = dt.Tables[0].Rows[i]["BARCODE"].ToString();//外箱子 + 内箱子条码
|
|||
|
|
// // string CUSTOMER_ID = dt.Tables[0].Rows[i]["CUSTOMER_ID"].ToString();//客户代码
|
|||
|
|
// // string newLoc = STORAGE_ID + "-WMS-00";
|
|||
|
|
|
|||
|
|
// // string strJsonRK = GetWmsData("http://" + MesIpPort + "/Camstar/PackStock.asmx/PackStockIn?pkwPackLot=" + BARCODE + "&pCustPackId=&pSubInventory=" + STORAGE_ID + "&pLocation=" + newLoc + "", "");
|
|||
|
|
// // if (errText.Length > 0)
|
|||
|
|
// // {
|
|||
|
|
// // AddText("WCS入装箱线成功回传MES异常:" + errText);
|
|||
|
|
// // continue;
|
|||
|
|
// // }
|
|||
|
|
// // if (strJsonRK.Length > 0)
|
|||
|
|
// // {
|
|||
|
|
// // AddText("WCS入装箱线成功回传MES返回:" + strJsonRK);
|
|||
|
|
|
|||
|
|
// // if (strJsonRK.Contains("Error"))
|
|||
|
|
// // {
|
|||
|
|
// // if (DataClass.Instance().Update_T_SSX_TASK(BARCODE, dt.Tables[0].Rows[i]["CTL"].ToString(), "10"))
|
|||
|
|
// // {
|
|||
|
|
// // AddText("WCS入装箱线成功回传MES错误:编号:" + BARCODE + "," + strJsonRK + ",更新数据库状态10成功");
|
|||
|
|
// // }
|
|||
|
|
// // else
|
|||
|
|
// // {
|
|||
|
|
// // AddText("WCS入装箱线成功回传MES错误:编号:" + BARCODE + "," + strJsonRK + ",更新数据库状态9失败");
|
|||
|
|
// // }
|
|||
|
|
// // AddText("WCS入装箱线成功回传MES错误:编号:" + BARCODE + "," + strJsonRK + "");
|
|||
|
|
// // }
|
|||
|
|
// // else
|
|||
|
|
// // {
|
|||
|
|
// // if (DataClass.Instance().Update_T_SSX_TASK(BARCODE, dt.Tables[0].Rows[i]["CTL"].ToString(), "1"))
|
|||
|
|
// // {
|
|||
|
|
// // AddText("WCS入装箱线成功回传MES成功:编号:" + BARCODE + "," + strJsonRK + ",更新数据库状态1成功");
|
|||
|
|
// // }
|
|||
|
|
// // else
|
|||
|
|
// // {
|
|||
|
|
// // AddText("WCS入装箱线成功回传MES成功:编号:" + BARCODE + "," + strJsonRK + ",更新数据库状态1失败");
|
|||
|
|
// // }
|
|||
|
|
// // }
|
|||
|
|
// // }
|
|||
|
|
|
|||
|
|
// // }
|
|||
|
|
// //}
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
private void button2_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
// 1. 初始化 DataSet(无需提前声明,直接接收查询结果)
|
|||
|
|
string sql = "SELECT DISTINCT CTL FROM T_MI_STOCK where STS=0";
|
|||
|
|
DataSet ds = OracleHelper.ExecuteDataset(CommandType.Text, sql);
|
|||
|
|
|
|||
|
|
// 2. 安全获取行数(处理可能的空表或查询失败)
|
|||
|
|
int rowCount = ds?.Tables?.Count > 0 ? ds.Tables[0].Rows.Count : 0;
|
|||
|
|
|
|||
|
|
// 3. 将行数显示到 textBox1(确保控件存在且可写)
|
|||
|
|
textBox1.Text = rowCount.ToString();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|