478 lines
15 KiB
C#
478 lines
15 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 PerfomanceForm : BasicRibbonForm
|
|
{
|
|
|
|
// lWmsGoods lgt = new lWmsGoods();
|
|
private string fieldName = WmsLocation.fields.locationId.ToString();
|
|
private string fieldGoodType = WmsLocation.fields.whGoodsType.ToString();
|
|
private string lastQuery = "";
|
|
private DataTable dtRecs;
|
|
|
|
private int selectedRowIndex = -1;
|
|
private string selectedGoodsId;
|
|
private string selectedBatch;
|
|
private int activeTabIndex = 0;
|
|
|
|
string queryStr = "";
|
|
|
|
|
|
public PerfomanceForm()
|
|
{
|
|
InitializeComponent();
|
|
try
|
|
{
|
|
initialControls();
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
showErrorMsg(er);
|
|
}
|
|
// loadData();
|
|
}
|
|
#region initialControls
|
|
private void initialControls()
|
|
{
|
|
setDatePiker(dateEdit1, dateEdit2);
|
|
|
|
dateEdit1.EditValue = DateTime.Now.Date;
|
|
dateEdit2.EditValue = DateTime.Now.Date.AddDays(0).AddHours(23).AddMinutes(59);
|
|
|
|
initialComboBoxes();
|
|
initialPagerControls();
|
|
initialDataGrid();
|
|
initialQueryInput();
|
|
setValidationRule();
|
|
|
|
|
|
}
|
|
private void initialComboBoxes()
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
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();
|
|
// gridviewGoodsType.Columns.Remove(gridviewGoodsType.Columns["DealerPrice"]);
|
|
GridColumn myCol0 = new GridColumn() { Caption = "operater", Visible = true, FieldName = "operater" };
|
|
myCol0.Visible = false;
|
|
|
|
|
|
GridColumn myCol1 = new GridColumn() { Caption = "员工名称", Visible = true, FieldName = "ownerName" };
|
|
GridColumn myCol2 = new GridColumn() { Caption = "入库验收", Visible = true, FieldName = "入库验收" };
|
|
GridColumn myCol3 = new GridColumn() { Caption = "入库上架", Visible = true, FieldName = "入库上架" };
|
|
GridColumn myCol4 = new GridColumn() { Caption = "播种分货", Visible = true, FieldName = "播种分货" };
|
|
GridColumn myCol5 = new GridColumn() { Caption = "补货下架", Visible = true, FieldName = "补货下架" };
|
|
GridColumn myCol6 = new GridColumn() { Caption = "补货上架", Visible = true, FieldName = "补货上架" };
|
|
// GridColumn myCol7 = new GridColumn() { Caption = "入库上架", Visible = true, FieldName = "入库上架" };
|
|
GridColumn myCol8 = new GridColumn() { Caption = "出库下架", Visible = true, FieldName = "出库下架" };
|
|
GridColumn myCol9 = new GridColumn() { Caption = "移库下架", Visible = true, FieldName = "移库下架" };
|
|
GridColumn myCol10 = new GridColumn() { Caption = "移库上架", Visible = true, FieldName = "移库上架" };
|
|
GridColumn myCol11 = new GridColumn() { Caption = "不良品入库", Visible = true, FieldName = "不良品入库" };
|
|
|
|
|
|
GridColumn myCol12 = new GridColumn() { Caption = "报废下架", Visible = true, FieldName = "报废下架" };
|
|
GridColumn myCol13 = new GridColumn() { Caption = "退供应商下架", Visible = true, FieldName = "退供应商下架" };
|
|
GridColumn myCol14 = new GridColumn() { Caption = "退供应商上架", Visible = true, FieldName = "退供应商上架" };
|
|
GridColumn myCol15 = new GridColumn() { Caption = "出库检验", Visible = true, FieldName = "出库检验" };
|
|
|
|
GridColumn myCol16 = new GridColumn() { Caption = "装车运输", Visible = true, FieldName = "装车运输" };
|
|
GridColumn myCol17 = new GridColumn() { Caption = "盘点采集", Visible = true, FieldName = "盘点采集" };
|
|
GridColumn myCol18 = new GridColumn() { Caption = "直通分货", Visible = true, FieldName = "直通分货" };
|
|
GridColumn myCol19 = new GridColumn() { Caption = "客户集货", Visible = true, FieldName = "客户集货" };
|
|
GridColumn myCol22 = new GridColumn() { Caption = "日常理货", Visible = true, FieldName = "日常理货" };
|
|
|
|
GridColumn myCol20 = new GridColumn() { Caption = "日期", Visible = true, FieldName = "taskDay" };
|
|
|
|
GridColumn myCol21 = new GridColumn() { Caption = "任务汇总", Visible = true, FieldName = "总数" };
|
|
|
|
|
|
if (!chkSum.Checked)
|
|
{
|
|
gridview.Columns.Add(myCol20);
|
|
}
|
|
|
|
gridview.Columns.Add(myCol1);
|
|
gridview.Columns.Add(myCol21);
|
|
gridview.Columns.Add(myCol2);
|
|
gridview.Columns.Add(myCol3);
|
|
|
|
gridview.Columns.Add(myCol4);
|
|
// gridview.Columns.Add(myCol5);
|
|
// gridview.Columns.Add(myCol6);
|
|
// gridview.Columns.Add(myCol7);
|
|
gridview.Columns.Add(myCol8);
|
|
gridview.Columns.Add(myCol22);
|
|
gridview.Columns.Add(myCol9);
|
|
gridview.Columns.Add(myCol10);
|
|
gridview.Columns.Add(myCol11);
|
|
gridview.Columns.Add(myCol12);
|
|
// gridview.Columns.Add(myCol13);
|
|
//gridview.Columns.Add(myCol14);
|
|
gridview.Columns.Add(myCol15);
|
|
gridview.Columns.Add(myCol16);
|
|
gridview.Columns.Add(myCol17);
|
|
gridview.Columns.Add(myCol18);
|
|
gridview.Columns.Add(myCol19);
|
|
|
|
//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;
|
|
|
|
showWaitForm();
|
|
try
|
|
{
|
|
|
|
|
|
queryStr = (string.Format("{0} >= # '{1}';", "taskday", this.dateEdit1.DateTime)) + (string.Format("{0} <= # '{1}';", "taskday", this.dateEdit2.DateTime))
|
|
|
|
+ (this.txtOperater.Text.Trim().Length == 0 ? "" : string.Format("{0} like #'%{1}%';", "ownerName", filtRiskChar(txtOperater.Text.Trim())))
|
|
|
|
;
|
|
|
|
|
|
|
|
this.pager1.PageCurrent = lastQuery.Equals(queryStr) ? this.pager1.PageCurrent : 1; //根据查询条件的变化给pager赋值
|
|
int start = (pager1.PageSize * (pager1.PageCurrent - 1) + 1);
|
|
int end = (pager1.PageSize * pager1.PageCurrent);
|
|
lastQuery = queryStr;
|
|
DataSet ds = null;
|
|
|
|
dtRecs = stkLocClient.queryPerformanceKPI(queryStr,chkSum.Checked );
|
|
|
|
closeClient();
|
|
|
|
|
|
//dt = lgt.Query(query, start, end); //string.IsNullOrEmpty(query) ? lgt.GetGoodType.getAllData(start, end) : lgt.g;
|
|
|
|
// dtDiffs.PrimaryKey = new DataColumn[] { dtDiffs.Columns["goodsId"], dtDiffs.Columns["batch"] };
|
|
DataView dv = dtRecs.DefaultView;
|
|
dv.Sort = "总数 desc";
|
|
|
|
this.gridControl1.DataSource = dv;//.DefaultView;
|
|
// gridView1.OptionsView.ColumnAutoWidth = true;
|
|
initialDataGridColumns(this.gridView1);
|
|
//update selected row index to the last updated one.
|
|
|
|
|
|
closeWaitForm();
|
|
return 1;// lgt.getRowCount(query);
|
|
// return lgt.GetGoodType.QueryCount();
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
showErrorMsg(er,er.Message);
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void bindDetail()
|
|
{
|
|
|
|
}
|
|
private void setDataBack()
|
|
{
|
|
|
|
|
|
}
|
|
private bool validData()
|
|
{
|
|
bool isvalid = dxValidationProvider1.Validate();
|
|
|
|
// MessageBox.Show("goodtype is " + txtGoodType.Text +", is valid ? " + isvalid);
|
|
|
|
return isvalid;
|
|
//String gdtype = txtGoodType.Text.Trim();
|
|
//if (gdtype.Length == 0)
|
|
//{
|
|
|
|
// dxValidationProvider.Validate();
|
|
// return false;
|
|
//}
|
|
|
|
//return true;
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 分页控件产生的事件
|
|
/// </summary>
|
|
private int pager_EventPaging(DeiNiu.Controls.pager.EventPagingArg e)
|
|
{
|
|
selectedRowIndex = 0; //reset currentRowIndex
|
|
return loadData();
|
|
}
|
|
|
|
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
|
|
|
|
}
|
|
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;
|
|
//show line number
|
|
this.gridView1.IndicatorWidth = 40;
|
|
this.gridView1.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView1_CustomDrawRowIndicator);
|
|
gridView1.CustomColumnDisplayText += gridView1_CustomColumnDisplayText;
|
|
|
|
}
|
|
//显示行的序号
|
|
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()
|
|
{
|
|
pager1.Bind();
|
|
}
|
|
|
|
|
|
private void queryGoods()
|
|
{
|
|
|
|
showWaitForm();
|
|
try
|
|
{
|
|
query();// loadData();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
showErrorMsg(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.Message);
|
|
}
|
|
finally
|
|
{
|
|
// WaitFormService.Close();
|
|
closeWaitForm();
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void btnQuery_Click(object sender, EventArgs e)
|
|
{
|
|
this.query();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void txtpinyin_KeyUp(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
loadData();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void bbQuery_ItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
query();
|
|
}
|
|
|
|
private void layoutControlGroup2_Shown(object sender, EventArgs e)
|
|
{
|
|
|
|
if (activeTabIndex > 0)
|
|
{
|
|
gridControl1.DataSource = null;
|
|
}
|
|
activeTabIndex = 0;
|
|
}
|
|
|
|
private void layoutControlGroup3_Shown(object sender, EventArgs e)
|
|
{
|
|
activeTabIndex = 1;
|
|
gridControl1.DataSource = null;
|
|
}
|
|
|
|
private void layoutControlGroup5_Shown(object sender, EventArgs e)
|
|
{
|
|
activeTabIndex = 2;
|
|
gridControl1.DataSource = null;
|
|
}
|
|
|
|
private void layoutControlGroup6_Shown(object sender, EventArgs e)
|
|
{
|
|
activeTabIndex = 3;
|
|
gridControl1.DataSource = null;
|
|
}
|
|
|
|
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 == "taskDay")
|
|
{
|
|
// e.Column.DisplayFormat.FormatString = "yyyy-MM-dd";
|
|
// e.Column.DisplayFormat.FormatString = "{0:d}";
|
|
// e.Column.DisplayFormat.FormatString = "{0:N0}";
|
|
|
|
e.DisplayText = string.Format("{0:d}",e.DisplayText);
|
|
}
|
|
else if (e.Column.FieldName == "ownerName")
|
|
{
|
|
//e.Column.DisplayFormat.FormatString = "{0:N0}";
|
|
|
|
}
|
|
else
|
|
{
|
|
// e.DisplayText = string.Format("{0:###.##}", e.DisplayText);
|
|
string s= e.DisplayText ;
|
|
if (s.Length > 0)
|
|
{
|
|
e.DisplayText = string.Format("{0:###.##}", Convert.ToDecimal(e.DisplayText));
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
private void bbiExport_ItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
exportExcel(gridView1);
|
|
}
|
|
|
|
private void simpleButton1_Click(object sender, EventArgs e)
|
|
{
|
|
showWaitForm();
|
|
try
|
|
{
|
|
//stkLocClient.initalSkus();
|
|
stkLocClient.initalErpSaleSku();
|
|
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
showErrorMsg(er, "出错了");
|
|
}
|
|
closeWaitForm();
|
|
closeClient();
|
|
}
|
|
}
|
|
} |