1014 lines
33 KiB
C#
1014 lines
33 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Linq;
|
|
using System.Windows.Forms;
|
|
using DevExpress.XtraBars;
|
|
using DevExpress.XtraGrid.Views.Base;
|
|
//using DeiNiu.wms.Logical;
|
|
using DeiNiu.wms.Data;
|
|
using DevExpress.XtraGrid.Columns;
|
|
|
|
using System.Threading;
|
|
using DevExpress.XtraGrid.Views.Grid;
|
|
using DevExpress.XtraEditors.DXErrorProvider;
|
|
using DeiNiu.wms.Data.Model;
|
|
using DevExpress.XtraEditors;
|
|
using DevExpress.XtraEditors.Controls;
|
|
using DeiNiu.Utils;
|
|
using DeiNiu.wms.win.ServiceReferenceGoods;
|
|
|
|
|
|
namespace DeiNiu.wms.win
|
|
{
|
|
public partial class StockPandianDetailForm : BasicRibbonForm
|
|
{
|
|
// lWmsGoods lgt = new lWmsGoods();
|
|
private string fieldName = WmsLocation.fields.locationId.ToString();
|
|
private string fieldGoodType = WmsLocation.fields.whGoodsType.ToString();
|
|
private string lastQuery = "";
|
|
private DataTable dtPandian;
|
|
string queryStr = "";
|
|
private DataTable dtDetail;
|
|
private int selectedRowIndex = -1;
|
|
private string currentOrderNo;
|
|
private WmsStockPandian currentPandian;
|
|
|
|
public StockPandianDetailForm()
|
|
{
|
|
InitializeComponent();
|
|
try
|
|
{
|
|
initialControls();
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
showErrorMsg(er);
|
|
}
|
|
query();
|
|
}
|
|
#region initialControls
|
|
private void initialControls()
|
|
{
|
|
|
|
btnStop.Enabled = btnFinish.Enabled = btnFix.Enabled = btnRollback.Enabled = false;
|
|
//layoutControlWaitting.Expanded = true;
|
|
initialComboBoxes();
|
|
initialPagerControls();
|
|
initialDataGrid();
|
|
initialQueryInput();
|
|
setValidationRule();
|
|
|
|
|
|
}
|
|
private void initialComboBoxes()
|
|
{
|
|
//initialComboBoxe(comboType, this.stkdiff);
|
|
|
|
|
|
}
|
|
|
|
private void setValidationRule()
|
|
{
|
|
// dxValidationProvider.SetValidationRule(comWarehouse, ValidationRules.notEmptyValidationRule);
|
|
//txtGoodType.Properties.MaxLength = 40;
|
|
//txtGoodDesc.Properties.MaxLength = 250;
|
|
//textEdit1.Properties.MaxLength = txtGoodType.Properties.MaxLength;
|
|
}
|
|
|
|
private void initialQueryInput()
|
|
{
|
|
|
|
}
|
|
|
|
private void initialDataGridColumns(GridView gridview)
|
|
{
|
|
setupGridView(gridview, true);
|
|
// gridviewGoodsType.PopulateColumns();
|
|
gridview.Columns.Clear();
|
|
|
|
|
|
GridColumn myCol1 = new GridColumn() { Caption = "商品编码", Visible = true, FieldName = WmsGoods.fields.goodsId.ToString() };
|
|
GridColumn myCol2 = new GridColumn() { Caption = "商品名称", Visible = true, FieldName = WmsGoods.exfields.goodsName.ToString() };
|
|
// GridColumn myCol3 = new GridColumn() { Caption = "厂家", Visible = true, FieldName = WmsGoods.exfields.manufacturer.ToString() };
|
|
GridColumn myCol4 = new GridColumn() { Caption = "规格", Visible = true, FieldName = WmsGoods.exfields.spec.ToString(), Width = 100 };
|
|
GridColumn myCol5 = new GridColumn() { Caption = "单位", Visible = true, FieldName = WmsGoods.exfields.unit.ToString() };
|
|
|
|
GridColumn myCol6 = new GridColumn() { Caption = "盘点单号", Visible = true, FieldName = WmsStockPandian.fields.orderNo.ToString() };
|
|
GridColumn myCol7 = new GridColumn() { Caption = "货位", Visible = true, FieldName = "locationId" };
|
|
GridColumn myCol8 = new GridColumn() { Caption = "skuId", Visible = true, FieldName = "skuId" };
|
|
// GridColumn myCol9 = new GridColumn() { Caption = "sku", Visible = true, FieldName = "skuCode" };
|
|
GridColumn myCol10 = new GridColumn() { Caption = "数量", Visible = true, FieldName = "count" };
|
|
GridColumn myCol11 = new GridColumn() { Caption = "数据类别", Visible = true, FieldName = "data" };
|
|
|
|
|
|
|
|
// gridview.Columns.Add(myCol6);
|
|
|
|
if (gridview == gridView1)
|
|
{
|
|
|
|
gridview.Columns.Add(myCol11);
|
|
gridview.Columns.Add(myCol7);
|
|
gridview.Columns.Add(myCol8);
|
|
// gridview.Columns.Add(myCol9);
|
|
gridview.Columns.Add(myCol10);
|
|
gridview.Columns.Add(myCol5);
|
|
|
|
gridview.Columns.Add(myCol1);
|
|
gridview.Columns.Add(myCol2);
|
|
//gridview.Columns.Add(myCol3);
|
|
gridview.Columns.Add(myCol4);
|
|
|
|
}
|
|
else if (gridview == gridView4)
|
|
{
|
|
GridColumn myCol13 = new GridColumn() { Caption = "数量", Visible = true, FieldName = "avCount" };
|
|
|
|
// gridview.Columns.Add(myCol6);
|
|
gridview.Columns.Add(myCol2);
|
|
gridview.Columns.Add(myCol1);
|
|
gridview.Columns.Add(myCol13);
|
|
gridview.Columns.Add(myCol5);
|
|
gridview.Columns.Add(myCol4);
|
|
|
|
|
|
}
|
|
else if (gridview == gridView3)
|
|
{
|
|
GridColumn myCol13 = new GridColumn() { Caption = "数量", Visible = true, FieldName = "avCount" };
|
|
GridColumn myCol12= new GridColumn() { Caption = "生产日期", Visible = true, FieldName = "productDate" };
|
|
GridColumn myCol14 = new GridColumn() { Caption = "采集人员", Visible = true, FieldName = "em_name" };
|
|
GridColumn myCol15 = new GridColumn() { Caption = "采集时间", Visible = true, FieldName = "createtime" , MinWidth = 200 };
|
|
|
|
// gridview.Columns.Add(myCol6);
|
|
gridview.Columns.Add(myCol7);
|
|
gridview.Columns.Add(myCol2);
|
|
gridview.Columns.Add(myCol1);
|
|
gridview.Columns.Add(myCol13);
|
|
gridview.Columns.Add(myCol5);
|
|
gridview.Columns.Add(myCol12);
|
|
gridview.Columns.Add(myCol4);
|
|
gridview.Columns.Add(myCol14);
|
|
gridview.Columns.Add(myCol15);
|
|
|
|
}
|
|
|
|
else if (gridview == gridView2)
|
|
{
|
|
|
|
gridview.Columns.Add(myCol1);
|
|
gridview.Columns.Add(myCol2);
|
|
|
|
GridColumn myCol12 = new GridColumn() { Caption = "盘点数量", Visible = true, FieldName = "pcount" };
|
|
GridColumn myCol13 = new GridColumn() { Caption = "系统数量", Visible = true, FieldName = "avcount" };
|
|
GridColumn myCol14 = new GridColumn() { Caption = "盘点差异", Visible = true, FieldName = "resultCount" };
|
|
|
|
gridview.Columns.Add(myCol12);
|
|
gridview.Columns.Add(myCol13);
|
|
gridview.Columns.Add(myCol14);
|
|
gridview.Columns.Add(myCol5);
|
|
|
|
// gridview.Columns.Add(myCol3);
|
|
gridview.Columns.Add(myCol4);
|
|
|
|
}
|
|
//to show bottom scroll bar
|
|
gridview.OptionsView.ColumnAutoWidth = false;
|
|
gridview.BestFitColumns();
|
|
// gridview.Focus();
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// loading data
|
|
/// </summary>
|
|
private int loadData()
|
|
{
|
|
//this.gridviewGoodsType.DataSource = lgt.GetAllActiveData().Tables[0].DefaultView;
|
|
|
|
btnStop.Enabled =
|
|
|
|
btnFinish.Enabled =
|
|
|
|
btnFix.Enabled =
|
|
|
|
btnRollback.Enabled = false;
|
|
|
|
lbOrder.Text =
|
|
lbAdjust.Text =
|
|
lbStart.Text =
|
|
lbEndtime.Text =
|
|
lbStatus.Text = "";
|
|
|
|
gridControl1.DataSource = null;
|
|
|
|
showWaitForm();
|
|
try
|
|
{
|
|
// this.splashScreenManager1.ShowWaitForm();
|
|
// isWhLocationQuery =(comboBoWarehouse.SelectedIndex > 0 || txtLocation.Text.Trim().Length > 0);
|
|
|
|
|
|
queryStr = string.Format("{0} = #'{1}';", WmsStockPandian.fields.orderNo.ToString(), filtRiskChar(txtorderQ.Text.Trim()));
|
|
|
|
|
|
this.pager1.PageCurrent = lastQuery.Equals(queryStr) ? this.pager1.PageCurrent : 1; //根据查询条件的变化给pager赋值
|
|
this.pager1.PageCurrent = this.pager1.PageCurrent > 0 ? this.pager1.PageCurrent : 1;
|
|
int start = (pager1.PageSize * (pager1.PageCurrent - 1) + 1);
|
|
int end = (pager1.PageSize * pager1.PageCurrent);
|
|
lastQuery = queryStr;
|
|
|
|
if (string.IsNullOrEmpty(queryStr))
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
DataSet ds = stkLocClient.queryPandianBanlanceDetail(filtRiskChar(txtorderQ.Text.Trim()), "",start, end);
|
|
|
|
|
|
closeClient();
|
|
dtPandian = ds.Tables[0];
|
|
int cnt = Convert.ToInt32(ds.Tables[1].Rows[0][0].ToString());
|
|
//dt = lgt.Query(query, start, end); //string.IsNullOrEmpty(query) ? lgt.GetGoodType.getAllData(start, end) : lgt.g;
|
|
|
|
foreach (DataRow dr in ds.Tables[2].Rows)
|
|
{
|
|
currentPandian = new WmsStockPandian(dr);
|
|
break;
|
|
}
|
|
|
|
btnStop.Enabled = currentPandian.status == (int)enumPandianStatus.开始采集;
|
|
|
|
btnFinish.Enabled = currentPandian.status != (int)enumPandianStatus.盘点结束;
|
|
|
|
btnFix.Enabled = (currentPandian.status == (int)enumPandianStatus.采集结束) && (enumPandianAdjustStatus)currentPandian.adjustStatus == enumPandianAdjustStatus.未校正;
|
|
|
|
btnRollback.Enabled = (currentPandian.status == (int)enumPandianStatus.采集结束) && (enumPandianAdjustStatus)currentPandian.adjustStatus == enumPandianAdjustStatus.已校正;
|
|
|
|
if( currentPandian.status == (int)enumPandianStatus.盘点结束)
|
|
{
|
|
btnFix.Enabled = btnRollback.Enabled = false;
|
|
}
|
|
|
|
|
|
|
|
|
|
// dtSum.PrimaryKey = new DataColumn[] { dtSum.Columns["goodsId"], dtSum.Columns["batch"] };
|
|
this.gridControl1.DataSource = dtPandian.DefaultView;
|
|
// gridView1.OptionsView.ColumnAutoWidth = true;
|
|
initialDataGridColumns(this.gridView1);
|
|
//update selected row index to the last updated one.
|
|
|
|
lbOrder.Text = currentPandian.orderNo;
|
|
lbAdjust.Text = ((enumPandianAdjustStatus) currentPandian.adjustStatus).ToString();
|
|
lbStart.Text ="开始于:" +currentPandian.startTime;
|
|
lbEndtime.Text = "结束于:" + currentPandian.endTime;
|
|
lbStatus.Text = ((enumPandianStatus)currentPandian.status).ToString();
|
|
|
|
|
|
|
|
/*
|
|
if ( !string.IsNullOrEmpty(currentOrderNo))
|
|
{
|
|
|
|
DataRow[] drs = dtPandian.Select(string.Format("orderNo='{0}'", currentOrderNo));
|
|
|
|
DataRow dr = null;
|
|
if (drs.Length > 0)
|
|
{
|
|
dr = drs[0];
|
|
}
|
|
|
|
if (dr != null)
|
|
{
|
|
selectedRowIndex = dtPandian.Rows.IndexOf(dr);
|
|
if (selectedRowIndex > 0 && dtPandian.Rows.Count > selectedRowIndex)
|
|
{
|
|
// gridView1.SelectRow(selectedRowIndex);
|
|
gridView1.FocusedRowHandle = selectedRowIndex;
|
|
// gridView1.MakeRowVisible(selectedRowIndex);
|
|
|
|
}
|
|
}
|
|
else
|
|
{
|
|
gridView1.FocusedRowHandle = 0;
|
|
gridView1.SelectRow(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
//gridView1.FocusedRowHandle = selectedRowIndex;
|
|
}
|
|
else
|
|
{
|
|
gridView1.FocusedRowHandle = 0;
|
|
gridView1.SelectRow(0);
|
|
|
|
}
|
|
|
|
if (dtPandian.Rows.Count > 0 && selectedRowIndex ==-1)
|
|
{
|
|
selectedRowIndex = 0;
|
|
}
|
|
setCurrentRequestDetail();
|
|
* */
|
|
closeWaitForm();
|
|
return cnt;// lgt.getRowCount(query);
|
|
// return lgt.GetGoodType.QueryCount();
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
showErrorMsg(er,er.Message);
|
|
closeWaitForm();
|
|
closeClient();
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
private int loadDetailData()
|
|
{
|
|
//this.gridviewGoodsType.DataSource = lgt.GetAllActiveData().Tables[0].DefaultView;
|
|
|
|
|
|
gridControl3.DataSource = null;
|
|
|
|
showWaitForm();
|
|
try
|
|
{
|
|
// this.splashScreenManager1.ShowWaitForm();
|
|
// isWhLocationQuery =(comboBoWarehouse.SelectedIndex > 0 || txtLocation.Text.Trim().Length > 0);
|
|
|
|
|
|
queryStr = string.Format("{0} = #'{1}';", WmsStockPandian.fields.orderNo.ToString(), filtRiskChar(txtorderQ.Text.Trim()));
|
|
|
|
|
|
this.pager2.PageCurrent = lastQuery.Equals(queryStr) ? this.pager2.PageCurrent : 1; //根据查询条件的变化给pager赋值
|
|
this.pager2.PageCurrent = this.pager2.PageCurrent > 0 ? this.pager2.PageCurrent : 1;
|
|
int start = (pager2.PageSize * (pager2.PageCurrent - 1) + 1);
|
|
int end = (pager2.PageSize * pager2.PageCurrent);
|
|
lastQuery = queryStr;
|
|
|
|
if (string.IsNullOrEmpty(queryStr))
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
DataSet ds = stkLocClient.queryPandianResult(filtRiskChar(txtorderQ.Text.Trim()), "", start, end);
|
|
|
|
|
|
closeClient();
|
|
dtPandian = ds.Tables[0];
|
|
int cnt = Convert.ToInt32(ds.Tables[1].Rows[0][0].ToString());
|
|
|
|
this.gridControl3.DataSource = dtPandian.DefaultView;
|
|
// gridView1.OptionsView.ColumnAutoWidth = true;
|
|
initialDataGridColumns(this.gridView3);
|
|
|
|
closeWaitForm();
|
|
return cnt;// lgt.getRowCount(query);
|
|
// return lgt.GetGoodType.QueryCount();
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
showErrorMsg(er, er.Message);
|
|
closeWaitForm();
|
|
closeClient();
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
private int loadDetailSumData()
|
|
{
|
|
//this.gridviewGoodsType.DataSource = lgt.GetAllActiveData().Tables[0].DefaultView;
|
|
|
|
|
|
gridControl4.DataSource = null;
|
|
|
|
showWaitForm();
|
|
try
|
|
{
|
|
// this.splashScreenManager1.ShowWaitForm();
|
|
// isWhLocationQuery =(comboBoWarehouse.SelectedIndex > 0 || txtLocation.Text.Trim().Length > 0);
|
|
|
|
|
|
queryStr = string.Format("{0} = #'{1}';", WmsStockPandian.fields.orderNo.ToString(), filtRiskChar(txtorderQ.Text.Trim()));
|
|
|
|
|
|
this.pager3.PageCurrent = lastQuery.Equals(queryStr) ? this.pager3.PageCurrent : 1; //根据查询条件的变化给pager赋值
|
|
this.pager3.PageCurrent = this.pager3.PageCurrent > 0 ? this.pager3.PageCurrent : 1;
|
|
int start = (pager3.PageSize * (pager3.PageCurrent - 1) + 1);
|
|
int end = (pager3.PageSize * pager3.PageCurrent);
|
|
lastQuery = queryStr;
|
|
|
|
if (string.IsNullOrEmpty(queryStr))
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
DataSet ds = stkLocClient.queryPandianResultSum(filtRiskChar(txtorderQ.Text.Trim()), "", start, end);
|
|
|
|
|
|
closeClient();
|
|
dtPandian = ds.Tables[0];
|
|
int cnt = Convert.ToInt32(ds.Tables[1].Rows[0][0].ToString());
|
|
|
|
this.gridControl4.DataSource = dtPandian.DefaultView;
|
|
// gridView1.OptionsView.ColumnAutoWidth = true;
|
|
initialDataGridColumns(this.gridView4);
|
|
|
|
closeWaitForm();
|
|
return cnt;// lgt.getRowCount(query);
|
|
// return lgt.GetGoodType.QueryCount();
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
showErrorMsg(er, er.Message);
|
|
closeWaitForm();
|
|
closeClient();
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
int queryTotal()
|
|
{
|
|
|
|
gridControl2.DataSource = null;
|
|
|
|
showWaitForm();
|
|
try
|
|
{
|
|
// this.splashScreenManager1.ShowWaitForm();
|
|
// isWhLocationQuery =(comboBoWarehouse.SelectedIndex > 0 || txtLocation.Text.Trim().Length > 0);
|
|
|
|
|
|
queryStr = string.Format("{0} = #'{1}';", WmsStockPandian.fields.orderNo.ToString(), filtRiskChar(txtorderQ.Text.Trim()));
|
|
|
|
|
|
this.pager4.PageCurrent = lastQuery.Equals(queryStr) ? this.pager4.PageCurrent : 1; //根据查询条件的变化给pager赋值
|
|
this.pager4.PageCurrent = this.pager4.PageCurrent > 0 ? this.pager4.PageCurrent : 1;
|
|
int start = (pager4.PageSize * (pager4.PageCurrent - 1) + 1);
|
|
int end = (pager4.PageSize * pager4.PageCurrent);
|
|
lastQuery = queryStr;
|
|
|
|
if (string.IsNullOrEmpty(queryStr))
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
DataSet ds = stkLocClient.getPandianBanlance(filtRiskChar(txtorderQ.Text.Trim()), start, end);
|
|
|
|
|
|
closeClient();
|
|
|
|
int cnt = Convert.ToInt32(ds.Tables[1].Rows[0][0].ToString());
|
|
|
|
this.gridControl2.DataSource = ds.Tables[0] ;
|
|
// gridView1.OptionsView.ColumnAutoWidth = true;
|
|
initialDataGridColumns(this.gridView2);
|
|
|
|
closeWaitForm();
|
|
return cnt;// lgt.getRowCount(query);
|
|
// return lgt.GetGoodType.QueryCount();
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
showErrorMsg(er, er.Message);
|
|
closeWaitForm();
|
|
closeClient();
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
/// <summary>
|
|
/// 分页控件产生的事件
|
|
/// </summary>
|
|
private int pager_EventPaging(DeiNiu.Controls.pager.EventPagingArg e)
|
|
{
|
|
// selectedRowIndex = 0; //reset currentRowIndex
|
|
return loadData();
|
|
}
|
|
private int pager_EventPaging2(DeiNiu.Controls.pager.EventPagingArg e)
|
|
{
|
|
// selectedRowIndex = 0; //reset currentRowIndex
|
|
int i= loadDetailData();
|
|
|
|
|
|
return i;
|
|
}
|
|
|
|
private int pager_EventPaging3(DeiNiu.Controls.pager.EventPagingArg e)
|
|
{
|
|
// selectedRowIndex = 0; //reset currentRowIndex
|
|
return loadDetailSumData();
|
|
}
|
|
private int pager_EventPaging4(DeiNiu.Controls.pager.EventPagingArg e)
|
|
{
|
|
// selectedRowIndex = 0; //reset currentRowIndex
|
|
int i= queryTotal();
|
|
|
|
return i;
|
|
}
|
|
private void initialPagerControls()
|
|
{
|
|
|
|
pager1.MaximumSize = new Size(0, 20);
|
|
pager1.EventPaging += new DeiNiu.Controls.pager.EventPagingHandler(pager_EventPaging);
|
|
#region DataGridView与Pager控件绑定
|
|
this.pager1.PageCurrent = 1;//当前页为第一页
|
|
pager1.PageSize = Utils.WmsConstants.PAGER_SIZE;//每页行数
|
|
// this.pager1.Bind();//绑定
|
|
#endregion
|
|
|
|
|
|
|
|
pager2.MaximumSize = new Size(0, 20);
|
|
pager2.EventPaging += new DeiNiu.Controls.pager.EventPagingHandler(pager_EventPaging2);
|
|
#region DataGridView与Pager控件绑定
|
|
this.pager2.PageCurrent = 1;//当前页为第一页
|
|
pager2.PageSize = Utils.WmsConstants.PAGER_SIZE;//每页行数
|
|
|
|
#endregion
|
|
|
|
|
|
pager3.MaximumSize = new Size(0, 20);
|
|
pager3.EventPaging += new DeiNiu.Controls.pager.EventPagingHandler(pager_EventPaging3);
|
|
#region DataGridView与Pager控件绑定
|
|
this.pager3.PageCurrent = 1;//当前页为第一页
|
|
pager3.PageSize = Utils.WmsConstants.PAGER_SIZE;//每页行数
|
|
|
|
#endregion
|
|
|
|
|
|
pager4.MaximumSize = new Size(0, 20);
|
|
pager4.EventPaging += new DeiNiu.Controls.pager.EventPagingHandler(pager_EventPaging4);
|
|
#region DataGridView与Pager控件绑定
|
|
this.pager4.PageCurrent = 1;//当前页为第一页
|
|
pager4.PageSize = Utils.WmsConstants.PAGER_SIZE;//每页行数
|
|
|
|
#endregion
|
|
|
|
}
|
|
private void initialDataGrid()
|
|
{
|
|
gridView1.OptionsSelection.MultiSelect = true;//按shift / control 多选
|
|
this.gridView1.OptionsBehavior.AutoPopulateColumns = false;
|
|
this.gridView1.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.RowFocus;
|
|
this.gridView1.OptionsBehavior.Editable = false;
|
|
this.gridView1.OptionsSelection.EnableAppearanceFocusedCell = false;
|
|
// this.gridView1.FocusedRowObjectChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventHandler(this.gridView1_FocusedRowObjectChanged);
|
|
// this.gridView1.DataSourceChanged += new System.EventHandler(this.gridView1_DataSourceChanged);
|
|
|
|
|
|
//show line number
|
|
this.gridView1.IndicatorWidth = 60;
|
|
this.gridView1.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView1_CustomDrawRowIndicator);
|
|
gridView1.CustomColumnDisplayText += gridView1_CustomColumnDisplayText;
|
|
|
|
this.gridView2.IndicatorWidth = 60;
|
|
this.gridView2.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView1_CustomDrawRowIndicator);
|
|
gridView2.CustomColumnDisplayText += gridView1_CustomColumnDisplayText;
|
|
|
|
gridView3.CustomColumnDisplayText += gridView1_CustomColumnDisplayText;
|
|
gridView4.CustomColumnDisplayText += gridView1_CustomColumnDisplayText;
|
|
this.gridView3.IndicatorWidth =60;
|
|
this.gridView3.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView1_CustomDrawRowIndicator);
|
|
this.gridView4.IndicatorWidth = 60;
|
|
this.gridView4.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView1_CustomDrawRowIndicator);
|
|
|
|
|
|
}
|
|
//显示行的序号
|
|
private void gridView1_CustomDrawRowIndicator(object sender, RowIndicatorCustomDrawEventArgs e)
|
|
{
|
|
if (e.Info.IsRowIndicator && e.RowHandle >= 0)
|
|
{
|
|
e.Info.DisplayText = (e.RowHandle + 1).ToString();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
protected void query()
|
|
{
|
|
|
|
string orderNo = filtRiskChar(txtorderQ.Text.Trim());
|
|
|
|
if (string.IsNullOrEmpty(orderNo))
|
|
{
|
|
return;
|
|
}
|
|
|
|
//queryTotal();
|
|
pager3.Bind();
|
|
|
|
pager2.Bind();
|
|
|
|
|
|
pager1.Bind();
|
|
pager4.Bind();
|
|
|
|
|
|
}
|
|
|
|
|
|
private void queryGoods()
|
|
{
|
|
|
|
showWaitForm();
|
|
try
|
|
{
|
|
query();// loadData();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
showErrorMsg(e,e.Message);
|
|
}
|
|
finally
|
|
{
|
|
// WaitFormService.Close();
|
|
closeWaitForm();
|
|
bbQuery.Enabled = true;
|
|
}
|
|
|
|
}
|
|
|
|
private void bbQuery_ItemClick_1(object sender, ItemClickEventArgs e)
|
|
{
|
|
this.bbQuery.Enabled = false;
|
|
queryGoods();
|
|
}
|
|
|
|
|
|
|
|
private void updateObjects(List<WmsGoods> goods)
|
|
{
|
|
showWaitForm();
|
|
//WaitFormService.Show(this);
|
|
try
|
|
{
|
|
|
|
|
|
// lgt.update(wgoods);
|
|
|
|
//get updated data
|
|
query();
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
showErrorMsg(e,e.Message);
|
|
}
|
|
finally
|
|
{
|
|
// WaitFormService.Close();
|
|
closeWaitForm();
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void btnQuery_Click_1(object sender, EventArgs e)
|
|
{
|
|
query();
|
|
}
|
|
|
|
private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
|
{
|
|
|
|
|
|
if (e.Column.FieldName == "data")
|
|
{
|
|
|
|
if (!stockState.ContainsValue(e.DisplayText))
|
|
{
|
|
|
|
int display = -100;
|
|
string disTxt = e.DisplayText;
|
|
|
|
try
|
|
{
|
|
display = Convert.ToInt32(e.DisplayText);
|
|
|
|
e.DisplayText = display ==0?"预期":"结果";
|
|
|
|
}
|
|
catch
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
}
|
|
else if (e.Column.FieldName == "locState")
|
|
{
|
|
|
|
if (!stockState.ContainsValue(e.DisplayText))
|
|
{
|
|
|
|
int display = -100;
|
|
string disTxt = e.DisplayText;
|
|
|
|
try
|
|
{
|
|
display = Convert.ToInt32(e.DisplayText);
|
|
|
|
e.DisplayText = stockState[display];
|
|
|
|
}
|
|
catch
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
}
|
|
else if (e.Column.FieldName == "createtime")
|
|
{
|
|
e.Column.DisplayFormat.FormatString = "yyyy-MM-dd HH:mm:ss";
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isDataSourceChanged = false;
|
|
private void gridView1_DataSourceChanged(object sender, EventArgs e)
|
|
{
|
|
isDataSourceChanged = true;
|
|
if (selectedRowIndex > 0 && dtPandian.Rows.Count > selectedRowIndex)
|
|
{
|
|
gridView1.FocusedRowHandle = selectedRowIndex;
|
|
gridView1.MakeRowVisible(selectedRowIndex);
|
|
|
|
}
|
|
else
|
|
{
|
|
selectedRowIndex = 0;
|
|
}
|
|
}
|
|
|
|
private void gridView1_FocusedRowObjectChanged(object sender, FocusedRowObjectChangedEventArgs e)
|
|
{
|
|
|
|
if (gridView1.FocusedRowHandle < 0 || gridView1.FocusedRowHandle == selectedRowIndex || isDataSourceChanged)
|
|
{
|
|
isDataSourceChanged = false;
|
|
if (gridView1.IsGroupRow(e.RowHandle)) //set first row of group selected
|
|
{
|
|
selectedRowIndex = gridView1.GetChildRowHandle(e.RowHandle, 0);
|
|
// setCurrentRequestDetail();
|
|
}
|
|
setCurrentRequestDetail();
|
|
return;
|
|
|
|
}
|
|
selectedRowIndex = gridView1.FocusedRowHandle;
|
|
// showErrorMsg("selection:"+ selectedRowIndex);
|
|
|
|
clearInputs();
|
|
setCurrentRequestDetail();
|
|
|
|
|
|
}
|
|
|
|
private void clearInputs()
|
|
{
|
|
|
|
}
|
|
|
|
private void setCurrentRequestDetail()
|
|
{
|
|
|
|
if (!getCurrentObject() || string.IsNullOrEmpty(currentOrderNo))
|
|
{
|
|
return;
|
|
}
|
|
|
|
showWaitForm();
|
|
|
|
try
|
|
{
|
|
|
|
|
|
|
|
clearInputs();
|
|
|
|
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
showErrorMsg(e,e.Message);
|
|
}
|
|
closeWaitForm();
|
|
}
|
|
|
|
private bool getCurrentObject()
|
|
{
|
|
// btnFinish.Enabled = false;
|
|
|
|
if (selectedRowIndex < 0 || selectedRowIndex >= dtPandian.Rows.Count)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
// DataRow currentRow = dt.Rows[selectedRowIndex];
|
|
// DataRowView dr = (DataRowView)(GetGridViewFilteredAndSortedData(gridView1)[selectedRowIndex]);
|
|
// currentOrderNo = dr["orderNo"].ToString(); ;
|
|
// currentPandian = new WmsStockPandian(dr.Row);
|
|
// btnFix.Enabled = currentPandian.status == (int)enumPandianStatus.已开始;
|
|
// btnFinish.Enabled = currentPandian.status == (int)enumPandianStatus.已开始;
|
|
|
|
return true;
|
|
}
|
|
|
|
private void btnQuery2_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
query();
|
|
}
|
|
|
|
private void bbiExport_ItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
string prefix = "";
|
|
if (currentPandian != null)
|
|
{
|
|
prefix = currentPandian.orderNo;
|
|
}
|
|
|
|
pager4.PageSize = pager2.PageSize = pager1.PageSize = pager3.PageSize = 5000;
|
|
query();
|
|
exportExcel(gridView2, prefix + "-差异汇总");
|
|
exportExcel(gridView1, prefix + "-差异明细");
|
|
exportExcel(gridView3, prefix + "-采集明细");
|
|
exportExcel(gridView4, prefix + "-采集汇总");
|
|
pager4.PageSize = pager2.PageSize = pager1.PageSize = pager3.PageSize = WmsConstants.PAGER_SIZE;
|
|
query();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void btnAdd_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
|
|
DialogResult r = MessageBox.Show(string.Format("确定要根据盘点结果修正库存吗 ?", currentPandian.orderNo),
|
|
"确认", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
|
if (r == DialogResult.No)
|
|
{
|
|
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
showWaitForm();
|
|
stkLocClient.adjustPandianStock(currentPandian.orderNo,false);
|
|
|
|
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
|
|
closeWaitForm();
|
|
|
|
showErrorMsg(er, er.Message);
|
|
}
|
|
closeWaitForm();
|
|
closeClient();
|
|
query();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void setPandianNo(string orderNo)
|
|
{
|
|
this.txtorderQ.Text = orderNo;
|
|
//query();
|
|
|
|
}
|
|
|
|
private void btnFinish_Click(object sender, EventArgs e)
|
|
{ try
|
|
{
|
|
|
|
DialogResult r = MessageBox.Show(string.Format("确定要完成盘点单{0}吗 ?", currentPandian.orderNo),
|
|
"确认完成", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
|
if (r == DialogResult.No)
|
|
{
|
|
|
|
return;
|
|
}
|
|
|
|
showWaitForm();
|
|
|
|
stkLocClient.finishPandian(currentPandian.orderNo);
|
|
closeClient();
|
|
query();
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
closeWaitForm();
|
|
closeClient();
|
|
showErrorMsg(er, er.Message);
|
|
}
|
|
closeWaitForm();
|
|
|
|
}
|
|
|
|
private void btnRollback_Click(object sender, EventArgs e)
|
|
{ try
|
|
{
|
|
DialogResult r = MessageBox.Show(string.Format("确定要回退库存吗 ?", currentPandian.orderNo),
|
|
"确认", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
|
if (r == DialogResult.No)
|
|
{
|
|
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
showWaitForm();
|
|
stkLocClient.adjustPandianStock(currentPandian.orderNo, true);
|
|
|
|
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
|
|
closeWaitForm();
|
|
|
|
showErrorMsg(er, er.Message);
|
|
}
|
|
closeWaitForm();
|
|
closeClient();
|
|
query();
|
|
|
|
}
|
|
|
|
private void bbQuery_ItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
query();
|
|
}
|
|
|
|
private void btnStop_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
DialogResult r = MessageBox.Show(string.Format("确定停止采集吗 ?", currentPandian.orderNo),
|
|
"确认", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
|
if (r == DialogResult.No)
|
|
{
|
|
|
|
return;
|
|
}
|
|
|
|
showWaitForm();
|
|
stkLocClient.stopPandianPick(currentPandian.orderNo);
|
|
query();
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
|
|
closeWaitForm();
|
|
|
|
showErrorMsg(er, er.Message);
|
|
}
|
|
closeWaitForm();
|
|
closeClient();
|
|
|
|
}
|
|
}
|
|
} |