796 lines
28 KiB
C#
796 lines
28 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.utils.print;
|
|
//using DeiNiu.wms.win.ServiceReferenceInRequest;
|
|
//using DeiNiu.wms.win.ServiceReferenceInRequestLocal;
|
|
using DeiNiu.wms.win.ServiceReferenceStockInRequest;
|
|
using DeiNiu.wms.win.portalService;//debug
|
|
|
|
namespace DeiNiu.wms.win
|
|
{
|
|
public partial class GoodsValidationRecs : BasicRibbonForm
|
|
{
|
|
printIn reportPrint = new printIn() ;
|
|
|
|
// lWmsStock ls = new lWmsStock();
|
|
// lWmsInRequest lgt = new lWmsInRequest();
|
|
private string fieldName = WmsLocation.fields.locationId.ToString();
|
|
private string fieldGoodType = WmsLocation.fields.whGoodsType.ToString();
|
|
private string lastQuery = "";
|
|
private DataTable dt;
|
|
private DataTable dtship;
|
|
private decimal bigcount;
|
|
decimal seedsCount = 0;
|
|
bool isDoubleChk = false;
|
|
// DataTable dtIndetail;
|
|
private int selectedRowIndex = -1;
|
|
private Erp_purch selectedRequest;
|
|
private bool isShowingInRequest = true;
|
|
Dictionary<string, string> isDoublChk = new Dictionary<string, string>();
|
|
public GoodsValidationRecs()
|
|
{
|
|
|
|
InitializeComponent();
|
|
|
|
try
|
|
{
|
|
initialControls();
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
showErrorMsg(er);
|
|
}
|
|
// loadData();
|
|
|
|
isDoublChk.Add("N", "否");
|
|
isDoublChk.Add("Y", "是");
|
|
}
|
|
#region initialControls
|
|
private void initialControls()
|
|
{
|
|
setDatePiker(dateEditFrom, dateEditTo);
|
|
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, false);
|
|
//setupGridView(gridView2, false,false);
|
|
//setupGridView(gridView3, false,false);
|
|
// gridviewGoodsType.PopulateColumns();
|
|
gridView.Columns.Clear();
|
|
// gridviewGoodsType.Columns.Remove(gridviewGoodsType.Columns["DealerPrice"]);
|
|
GridColumn myCol0 = new GridColumn() { Caption = "ID", Visible = true, FieldName = "id" };
|
|
myCol0.Visible = false;
|
|
gridView.Columns.Add(myCol0);
|
|
GridColumn myCol1 = new GridColumn() { Caption = "收货单号", Visible = true, FieldName = Erp_purch.fields.pur_order.ToString()};
|
|
GridColumn myCol2 = new GridColumn() { Caption = "订单类别", Visible = true, FieldName = Erp_purch.fields.order_typeName.ToString() };
|
|
GridColumn myCol3 = new GridColumn() { Caption = "供货商", Visible = true, FieldName = "venderName" };
|
|
GridColumn myCol4 = new GridColumn() { Caption = "货主", Visible = true, FieldName = WmsInRequest.fields.owner.ToString() };
|
|
GridColumn myCol5 = new GridColumn() { Caption = "备注", Visible = true, FieldName = WmsInRequest.fields.description. ToString() };
|
|
GridColumn myCol6 = new GridColumn() { Caption = "日期", Visible = true, FieldName = Erp_purch.fields.endDate.ToString() };
|
|
GridColumn myCol7 = new GridColumn() { Caption = "状态", Visible = true, FieldName = Erp_purch.fields.wms_state.ToString() };
|
|
|
|
|
|
|
|
|
|
gridView.Columns.Add(myCol1);
|
|
gridView.Columns.Add(myCol6);
|
|
gridView.Columns.Add(myCol7);
|
|
gridView.Columns.Add(myCol3);
|
|
|
|
// this.gridView1.Columns.Add(myCol4);
|
|
gridView.Columns.Add(myCol5);
|
|
|
|
//to show bottom scroll bar
|
|
gridView.OptionsView.ColumnAutoWidth = false;
|
|
gridView.BestFitColumns();
|
|
// gridView.Focus();
|
|
|
|
//if (gridView1 == gridView)
|
|
//{
|
|
// this.gridView1.Focus(); ;
|
|
//}
|
|
|
|
|
|
// initialGridView2Columns();
|
|
// gridControl2.DataSource = null;
|
|
}
|
|
private void initialGridView2Columns(GridView gridview)
|
|
{
|
|
setupGridView(gridview, false, true, false);
|
|
gridview.FocusRectStyle = DrawFocusRectStyle.None;
|
|
// gridviewGoodsType.PopulateColumns();
|
|
gridview.Columns.Clear();
|
|
// gridviewGoodsType.Columns.Remove(gridviewGoodsType.Columns["DealerPrice"]);
|
|
GridColumn myCol0 = new GridColumn() { Caption = "validId", Visible = true, FieldName = "validId" };
|
|
myCol0.Visible = false;
|
|
gridview.Columns.Add(myCol0);
|
|
|
|
|
|
|
|
GridColumn myCol1 = new GridColumn() { Caption = "商品编码", Visible = true, FieldName = WmsGoods.fields.goodsId.ToString() };
|
|
GridColumn myCol2 = new GridColumn() { Caption = "订单类别", Visible = true, FieldName = Erp_purch.fields.order_typeName.ToString() };
|
|
GridColumn myCol3 = new GridColumn() { Caption = "供货商", Visible = true, FieldName = "vender" };
|
|
GridColumn myCol4 = new GridColumn() { Caption = "货主", Visible = true, FieldName = WmsInRequest.fields.owner.ToString() };
|
|
GridColumn myCol5 = new GridColumn() { Caption = "备注", Visible = true, FieldName = WmsInRequest.fields.description.ToString() };
|
|
GridColumn myCol6 = new GridColumn() { Caption = "日期", Visible = true, FieldName = Erp_purch.fields.endDate.ToString() };
|
|
GridColumn myCol7 = new GridColumn() { Caption = "状态", Visible = true, FieldName = Erp_purch.fields.wms_state.ToString() };
|
|
GridColumn myCol29 = new GridColumn() { Caption = "供应商", Visible = true, FieldName = "venderName" };
|
|
|
|
|
|
|
|
|
|
|
|
// gridview.Columns.Add(myCol7);
|
|
// gridview.Columns.Add(myCol3);
|
|
// gridview.Columns.Add(myCol4);
|
|
// gridview.Columns.Add(myCol5);
|
|
|
|
|
|
|
|
|
|
GridColumn myCol100 = new GridColumn() { Caption = "单号", Visible = true, FieldName = WmsInRequest.fields.preInOrder.ToString() };
|
|
|
|
myCol2 = new GridColumn() { Caption = "商品名称", Visible = true, FieldName ="goodsName" };
|
|
myCol3 = new GridColumn() { Caption = "厂家", Visible = true, FieldName = "manufacturer" };
|
|
myCol4 = new GridColumn() { Caption = "规格", Visible = true, FieldName = WmsGoods.exfields.spec.ToString() };
|
|
myCol5 = new GridColumn() { Caption = "单位", Visible = true, FieldName = WmsGoods.exfields.unit.ToString() };
|
|
myCol6 = new GridColumn() { Caption = "大包装数量", Visible = true, FieldName = WmsGoods.exfields.bigCount.ToString() };
|
|
myCol7 = new GridColumn() { Caption = "剂型", Visible = true, FieldName = WmsGoods.exfields.type.ToString() };
|
|
GridColumn myCol8 = new GridColumn() { Caption = "商品类型", Visible = true, FieldName = WmsGoods.exfields.goodsTypeName.ToString() };
|
|
GridColumn myCol12 = new GridColumn() { Caption = "国药准字", Visible = true, FieldName = WmsGoods.exfields.regeditCode.ToString() };
|
|
|
|
GridColumn myCol135 = new GridColumn() { Caption = "验收数量", Visible = true, FieldName = Erp_purch_d.fields.validCount.ToString() };
|
|
|
|
GridColumn myCol136 = new GridColumn() { Caption = "抽样箱数", Visible = true, FieldName = "seedsCount" };
|
|
|
|
GridColumn myCol137 = new GridColumn() { Caption = "验收人1", Visible = true, FieldName = "validByName" };
|
|
GridColumn myCol138 = new GridColumn() { Caption = "验收人2", Visible = true, FieldName = "validByName1" };
|
|
GridColumn myCol140 = new GridColumn() { Caption = "验收结果", Visible = true, FieldName = WmsInRequestDetail.fields.whType.ToString() };
|
|
GridColumn myCol14 = new GridColumn() { Caption = "批号", Visible = true, FieldName = WmsInRequestDetail.fields.batch.ToString() };
|
|
GridColumn myCol15 = new GridColumn() { Caption = "生产日期", Visible = true, FieldName = WmsInRequestDetail.fields.productDate.ToString() };
|
|
GridColumn myCol16 = new GridColumn() { Caption = "有效期", Visible = true, FieldName = WmsInRequestDetail.fields.validDate.ToString() };
|
|
GridColumn myCol19 = new GridColumn() { Caption = "双人验收", Visible = true, FieldName = "isDouChk" };
|
|
|
|
|
|
|
|
|
|
GridColumn myCol26 = new GridColumn() { Caption = "操作时间", Visible = true, FieldName = "createtime" };
|
|
GridColumn myCol27 = new GridColumn() { Caption = "验收时间", Visible = true, FieldName = "validbyTime" };
|
|
GridColumn myCol28 = new GridColumn() { Caption = "验收时间", Visible = true, FieldName = "validbyTime1" };
|
|
|
|
GridColumn myCol30 = new GridColumn() { Caption = "上架数量", Visible = true, FieldName = "upShelfCount" };
|
|
|
|
GridColumn myCol31 = new GridColumn() { Caption = "容器号码", Visible = true, FieldName = "flowNo" };
|
|
|
|
if (chkGoodsSum.Checked)
|
|
{
|
|
gridview.Columns.Add(myCol2);
|
|
gridview.Columns.Add(myCol1);
|
|
|
|
gridview.Columns.Add(myCol135);
|
|
|
|
gridview.Columns.Add(myCol5);
|
|
gridview.Columns.Add(myCol4);
|
|
|
|
gridview.Columns.Add(myCol6);
|
|
gridview.Columns.Add(myCol3);
|
|
|
|
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
gridview.Columns.Add(myCol100);
|
|
gridview.Columns.Add(myCol29);
|
|
|
|
myCol3 = new GridColumn() { Caption = "供货商ID", Visible = true, FieldName = "vender" };
|
|
myCol4 = new GridColumn() { Caption = "货主", Visible = true, FieldName = WmsInRequest.fields.owner.ToString() };
|
|
gridview.Columns.Add(myCol2);
|
|
gridview.Columns.Add(myCol135);
|
|
gridview.Columns.Add(myCol30);
|
|
gridview.Columns.Add(myCol31);
|
|
gridview.Columns.Add(myCol5);
|
|
gridview.Columns.Add(myCol14);
|
|
gridview.Columns.Add(myCol15);
|
|
gridview.Columns.Add(myCol16);
|
|
gridview.Columns.Add(myCol140);
|
|
gridview.Columns.Add(myCol19);
|
|
gridview.Columns.Add(myCol137);
|
|
gridview.Columns.Add(myCol27);
|
|
gridview.Columns.Add(myCol138);
|
|
gridview.Columns.Add(myCol28);
|
|
gridview.Columns.Add(myCol3);
|
|
gridview.Columns.Add(myCol4);
|
|
|
|
gridview.Columns.Add(myCol3);
|
|
|
|
|
|
gridview.Columns.Add(myCol6);
|
|
gridview.Columns.Add(myCol4);
|
|
gridview.Columns.Add(myCol7);
|
|
// gridview.Columns.Add(myCol12);
|
|
gridview.Columns.Add(myCol1);
|
|
|
|
//gridview.Columns.Add(myCol136);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//to show bottom scroll bar
|
|
gridview.OptionsView.ColumnAutoWidth = false;
|
|
gridview.BestFitColumns();
|
|
// gridView2.Focus();
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
private void initialRequestOrders()
|
|
{
|
|
showWaitForm();
|
|
try{
|
|
//inClient.getInRequests();
|
|
// getInValidOrders();
|
|
}
|
|
//catch (DeiNiuTimeOutException te)
|
|
//{
|
|
//
|
|
//}
|
|
catch(Exception e){
|
|
showErrorMsg(e.Message);
|
|
}
|
|
finally{
|
|
closeWaitForm();
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// loading data
|
|
/// </summary>
|
|
private int loadData()
|
|
{
|
|
|
|
//this.gridviewGoodsType.DataSource = lgt.GetAllActiveData().Tables[0].DefaultView;
|
|
showWaitForm();
|
|
|
|
try
|
|
{
|
|
|
|
// this.splashScreenManager1.ShowWaitForm();
|
|
string query = (this.txtOrderNo.Text.Trim().Length == 0 ? "" : string.Format("{0} =#'{1}';", WmsInRequest.fields.preInOrder.ToString(), filtRiskChar(txtOrderNo.Text.Trim())));
|
|
query = !string.IsNullOrEmpty(query) ? query :
|
|
(this.dateEditFrom.Text.Trim().Length == 0 ? "" : string.Format("{0} >= # '{1}';", "validByTime", dateEditFrom.DateTime))
|
|
+ (this.dateEditTo.Text.Trim().Length == 0 ? "" : string.Format("{0} <= # '{1}';", "validByTime", dateEditTo.DateTime))
|
|
+ (this.txtvenderId.Text.Trim().Length == 0 ? "" : string.Format("{0} = # '{1}';", "vender", filtRiskChar(txtvenderId.Text.Trim())))
|
|
+ (this.txtVender.Text.Trim().Length == 0 ? "" : string.Format("{0} like # '%{1}%' or pinyin like # '%{2}%';", "venderName", filtRiskChar(txtVender.Text.Trim()), filtRiskChar(txtVender.Text.Trim())))
|
|
+ (this.txtValidBy.Text.Trim().Length == 0 ? "" : string.Format("{0} like # '%{1}%' or isnull({2},'') like # '%{3}%';", "validByName", filtRiskChar(txtValidBy.Text.Trim()), "validByName1",filtRiskChar(txtValidBy.Text.Trim())))
|
|
|
|
;
|
|
|
|
if(chkOnShelf.Checked)
|
|
{
|
|
|
|
query += " isZhitong=0 and validCount!=upShelfCount ";
|
|
}
|
|
|
|
|
|
|
|
// + (this.comboState.SelectedIndex < 0 ? "" : string.Format("{0} = #{1};", Erp_purch.fields.wms_state.ToString(),(int)enumInStockOrderStatus.待验收 ));// ((Colitem)this.comboState.SelectedItem).key));
|
|
// 、、 + (this.txtGoodName.Text.Trim().Length == 0 ? "" : string.Format("{0} like # '%{1}%';", WmsInRequest.exfields.goodName.ToString(), txtGoodName.Text))
|
|
bool isQueryNotChanged = lastQuery.Equals(query);
|
|
this.pager1.PageCurrent = isQueryNotChanged ? this.pager1.PageCurrent : 1; //根据查询条件的变化给pager赋值
|
|
int start = (pager1.PageSize * (pager1.PageCurrent - 1) + 1);
|
|
int end = (pager1.PageSize * pager1.PageCurrent);
|
|
lastQuery = query;
|
|
DataSet ds;
|
|
if (chkGoodsSum.Checked)
|
|
{
|
|
ds = inClient.queryStockInSum(query, start, end);// lgt.Query(query, start, end);
|
|
}
|
|
else
|
|
{
|
|
ds = inClient.queryValidationLog(query, start, end);// lgt.Query(query, start, end);
|
|
}
|
|
|
|
|
|
|
|
closeClient();
|
|
dt = 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;
|
|
|
|
// dt.PrimaryKey = new DataColumn[] { dt.Columns["ID"] };
|
|
bool firstLoad = !isQueryNotChanged || this.gridControl1.DataSource == null;
|
|
this.gridControl1.DataSource = dt.DefaultView;
|
|
initialGridView2Columns(gridView1);
|
|
//update selected row index to the last updated one.
|
|
|
|
|
|
closeWaitForm();
|
|
return cnt;
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
showErrorMsg(e,e.Message);
|
|
}
|
|
|
|
closeWaitForm();
|
|
return 0;// lgt.getRowCount(query);
|
|
// return lgt.GetGoodType.QueryCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 = -1; //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
|
|
|
|
}
|
|
|
|
bool isCheckedIn = false;
|
|
private void gridView1_FocusedRowObjectChanged(object sender, FocusedRowObjectChangedEventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void clearInputs()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
private void gridView1_DataSourceChanged(object sender, EventArgs e)
|
|
{
|
|
if (selectedRowIndex >= 0 && dt.Rows.Count > selectedRowIndex)
|
|
{
|
|
gridView1.FocusedRowHandle = selectedRowIndex;
|
|
gridView1.MakeRowVisible(selectedRowIndex);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//to show in detail
|
|
|
|
|
|
|
|
private bool getCurrentInObject()
|
|
{
|
|
return true;
|
|
|
|
}
|
|
private void setCurrentInDetail()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
private void btnDelete_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
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(goods);
|
|
|
|
//get updated data
|
|
query();
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
showErrorMsg(e.Message);
|
|
}
|
|
finally
|
|
{
|
|
// WaitFormService.Close();
|
|
closeWaitForm();
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
void clearDetail()
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void btnQuery_Click(object sender, EventArgs e)
|
|
{
|
|
queryGoods();
|
|
}
|
|
|
|
private void gridView1_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
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.FocusRectStyle = DevExpress.XtraGrid.Views.Grid.DrawFocusRectStyle.CellFocus;
|
|
this.gridView1.OptionsBehavior.Editable = false;
|
|
// this.gridView1.OptionsSelection.EnableAppearanceFocusedCell = false;
|
|
|
|
//show line number
|
|
this.gridView1.IndicatorWidth = 80;
|
|
this.gridView1.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView_CustomDrawRowIndicator);
|
|
|
|
gridView1.RowCellStyle += gridView_RowCellStyle;
|
|
|
|
gridView1.CustomColumnDisplayText += gridView2_CustomColumnDisplayText;
|
|
|
|
gridView1.CustomDrawCell += gridView_CustomDrawCell;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void gridView2_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
|
{
|
|
|
|
// if (sender == gridView2)
|
|
{
|
|
if (e.Column.FieldName == "wms_state")
|
|
{
|
|
|
|
if (!stockInLocationStatus.ContainsValue(e.DisplayText))
|
|
{
|
|
|
|
int display = -100;
|
|
string disTxt = e.DisplayText;
|
|
|
|
try
|
|
{
|
|
display = Convert.ToInt32(e.DisplayText);
|
|
|
|
|
|
{
|
|
e.DisplayText = this.inRequestStatus[display];
|
|
}
|
|
|
|
}
|
|
catch
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
// e.DisplayText = stockInLocationStatus.ContainsKey(display) ? stockInLocationStatus[display] : display+"";
|
|
|
|
}
|
|
else if (e.Column.FieldName == "whType")
|
|
{
|
|
if (!stockInLocationStatus.ContainsValue(e.DisplayText))
|
|
{
|
|
|
|
int display = -100;
|
|
string disTxt = e.DisplayText;
|
|
|
|
try
|
|
{
|
|
display = Convert.ToInt32(e.DisplayText);
|
|
e.DisplayText = this.whType[display];
|
|
|
|
}
|
|
catch
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
}
|
|
else if (e.Column.FieldName == "isDouChk")
|
|
{
|
|
|
|
if (!isDoublChk.ContainsValue(e.DisplayText))
|
|
{
|
|
string disTxt = e.DisplayText;
|
|
|
|
try
|
|
{
|
|
|
|
e.DisplayText = isDoublChk[disTxt];
|
|
|
|
}
|
|
catch
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
|
|
}
|
|
else if (e.Column.FieldName.ToLower().Contains("time"))
|
|
{
|
|
e.Column.DisplayFormat.FormatString = "yyyy-MM-dd HH:mm:ss";
|
|
}
|
|
}
|
|
}
|
|
void gridView_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e)
|
|
{
|
|
//var currentView = sender as GridView;
|
|
//if (currentView != null && e.RowHandle == currentView.FocusedRowHandle) return;
|
|
Rectangle r = e.Bounds;
|
|
if (e.Column.FieldName == "isDouChk" && e.CellValue !=null)
|
|
{
|
|
string a = e.CellValue.ToString();
|
|
string b = e.DisplayText;
|
|
if (b.Equals("是"))
|
|
{
|
|
e.Appearance.ForeColor = Color.Red;
|
|
e.Appearance.DrawString(e.Cache, e.DisplayText, r);
|
|
e.Handled = true;
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
void gridView_RowCellStyle(object sender,DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
|
|
{
|
|
|
|
var currentView = sender as GridView;
|
|
if( currentView == null){return;}
|
|
if (!currentView.GetDataRow(e.RowHandle).Table.Columns.Contains("wms_state"))
|
|
{
|
|
return;
|
|
}
|
|
|
|
string state = currentView.GetDataRow(e.RowHandle)["wms_state"].ToString().Trim();
|
|
|
|
if (state == "0")
|
|
{
|
|
return;
|
|
}
|
|
|
|
bool isFocused = e.RowHandle == currentView.FocusedRowHandle;
|
|
DevExpress.Utils.AppearanceDefault rowStyle = null;
|
|
DevExpress.Utils.AppearanceDefault appBlueRed =
|
|
new DevExpress.Utils.AppearanceDefault (Color.White, Color.Red, Color.Empty, Color.Blue, System.Drawing.Drawing2D.LinearGradientMode.Horizontal);
|
|
DevExpress.Utils.AppearanceDefault appYB =
|
|
new DevExpress.Utils.AppearanceDefault(Color.White, Color.Red, Color.Green);
|
|
|
|
DevExpress.Utils.AppearanceDefault alertFocus = new DevExpress.Utils.AppearanceDefault(Color.White, Color.Red, Color.Green, Color.Yellow);
|
|
DevExpress.Utils.AppearanceDefault alert = new DevExpress.Utils.AppearanceDefault(Color.Red, Color.White );
|
|
|
|
DevExpress.Utils.AppearanceDefault passedFocus = new DevExpress.Utils.AppearanceDefault(Color.White, Color.Gray);
|
|
DevExpress.Utils.AppearanceDefault passed = new DevExpress.Utils.AppearanceDefault(Color.Gray, Color.White);
|
|
|
|
if (state == "3" )
|
|
{
|
|
rowStyle = isFocused ? passedFocus : passed;
|
|
}
|
|
else if (state == "1")
|
|
{
|
|
rowStyle = isFocused ? alertFocus : alert;
|
|
}
|
|
|
|
|
|
DevExpress.Utils.AppearanceHelper.Apply(e.Appearance, rowStyle);
|
|
/*
|
|
if (sender == this.gridView2)
|
|
{
|
|
if (this.gridView2.GetDataRow(e.RowHandle)["state"].ToString().Trim() == "2")
|
|
{
|
|
DevExpress.Utils.AppearanceHelper.Apply(e.Appearance, alert);
|
|
}
|
|
}else if(sender == this.gridView1){
|
|
|
|
if ( state == "2")
|
|
{
|
|
if (currentView != null && e.RowHandle == currentView.FocusedRowHandle)
|
|
{
|
|
DevExpress.Utils.AppearanceHelper.Apply(e.Appearance, alertFocus);
|
|
}
|
|
else
|
|
{
|
|
DevExpress.Utils.AppearanceHelper.Apply(e.Appearance, alert);
|
|
}
|
|
}
|
|
else if (state == "1")
|
|
{
|
|
DevExpress.Utils.AppearanceHelper.Apply(e.Appearance, passed);
|
|
}
|
|
}
|
|
*/
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void GoodsInForm_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
//closeClient();
|
|
}
|
|
|
|
private void txtVender_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode != Keys.Enter)
|
|
{
|
|
return;
|
|
}
|
|
if (string.IsNullOrEmpty(txtVender.Text))
|
|
{
|
|
return;
|
|
}
|
|
query();
|
|
}
|
|
|
|
private void bbexport_ItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
exportExcel(gridView1);
|
|
}
|
|
|
|
private void chkGoodsSum_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (chkGoodsSum.Checked)
|
|
{
|
|
chkOnShelf.Checked = false;
|
|
}
|
|
}
|
|
|
|
private void chkOnShelf_CheckedChanged(object sender, EventArgs e)
|
|
{
|
|
if (chkOnShelf.Checked)
|
|
{
|
|
chkGoodsSum.Checked = false;
|
|
}
|
|
}
|
|
}
|
|
} |