1347 lines
49 KiB
C#
1347 lines
49 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;//debug
|
||
|
||
namespace DeiNiu.wms.win
|
||
{
|
||
public partial class GoodsReceive : 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;
|
||
// DataTable dtIndetail;
|
||
private int selectedRowIndex = -1;
|
||
private Erp_purch selectedRequest;
|
||
private bool isShowingInRequest = true;
|
||
int cachePartion = -1;
|
||
bool IsToCacheStore = false;
|
||
public GoodsReceive()
|
||
{
|
||
|
||
InitializeComponent();
|
||
|
||
initialControls();
|
||
|
||
// loadData();
|
||
|
||
}
|
||
#region initialControls
|
||
private void initialControls()
|
||
{
|
||
setDatePiker(dateEditFrom, dateEditTo);
|
||
initialComboBoxes();
|
||
initialPagerControls();
|
||
initialDataGrid();
|
||
initialQueryInput();
|
||
setValidationRule();
|
||
textEditBarcode.GotFocus += new EventHandler(textEditBarcode_GotFocus);
|
||
textEditBarcode.MouseUp += new MouseEventHandler(textEditBarcode_MouseUp);
|
||
|
||
|
||
}
|
||
private void initialComboBoxes()
|
||
{
|
||
this.comboState.Properties.TextEditStyle = TextEditStyles.DisableTextEditor;
|
||
|
||
Dictionary<int, string> dic = Utils.Util.convertEnumToDic(typeof(enumInStockOrderStatus));
|
||
dic.Remove((int)enumInStockOrderStatus.订单明细日期错误);
|
||
dic.Remove((int)enumInStockOrderStatus.待上架);
|
||
dic.Remove((int)enumInStockOrderStatus.货位不足);
|
||
|
||
initialComboBoxs(comboState, dic,false); //默认选待收货状态
|
||
|
||
|
||
Node[] nds = { };
|
||
DataRow[] drs = Park.getDictionary(true).Select("flag >0");
|
||
foreach (DataRow dr in drs)
|
||
{
|
||
int flag = Convert.ToInt32(dr["flag"].ToString());
|
||
int parentId = Convert.ToInt32(dr["id"].ToString());
|
||
DataRow[] drss = Park.getDictionary(false).Select("parentId =" + parentId);
|
||
switch (flag)
|
||
{
|
||
case 2017:
|
||
initialComboBoxs(this.combCache, drss,false); //缓存分区
|
||
break;
|
||
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
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);
|
||
|
||
|
||
if (gridView == gridView1)
|
||
{
|
||
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 = "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.shipDate.ToString() };
|
||
GridColumn myCol7 = new GridColumn() { Caption = "状态", Visible = true, FieldName = Erp_purch.fields.wms_state.ToString() };
|
||
|
||
gridView.Columns.Add(myCol1);
|
||
gridView.Columns.Add(myCol6);
|
||
gridView1.Columns.Add(myCol2);
|
||
gridView.Columns.Add(myCol7);
|
||
gridView.Columns.Add(myCol3);
|
||
gridView.Columns.Add(myCol5);
|
||
}
|
||
else if (gridView == gridviewShip)
|
||
{
|
||
setupGridView(gridView, false, false);
|
||
GridColumn myCol12 = new GridColumn() { Caption = "运输单号", Visible = true, FieldName = Erp_purch_ship.fields.shipOrder.ToString() };
|
||
GridColumn myCol13 = new GridColumn() { Caption = "车辆牌号", Visible = true, FieldName = Erp_purch_ship.fields.veNumber.ToString() };
|
||
GridColumn myCol14 = new GridColumn() { Caption = "箱内温度", Visible = true, FieldName = Erp_purch_ship.fields.temperature.ToString() };
|
||
GridColumn myCol15 = new GridColumn() { Caption = "送货电话", Visible = true, FieldName = Erp_purch_ship.fields.driverPhone.ToString() };
|
||
GridColumn myCol16 = new GridColumn() { Caption = "送货公司", Visible = true, FieldName = Erp_purch_ship.fields.company.ToString() };
|
||
GridColumn myCol18 = new GridColumn() { Caption = "送货人", Visible = true, FieldName = Erp_purch_ship.fields.driverName.ToString() };
|
||
GridColumn myCol20 = new GridColumn() { Caption = "送货备注", Visible = true, FieldName = Erp_purch_ship.fields.remark.ToString() };
|
||
|
||
|
||
|
||
|
||
gridView.Columns.Add(myCol12);
|
||
gridView.Columns.Add(myCol13);
|
||
gridView1.Columns.Add(myCol18);
|
||
gridView.Columns.Add(myCol16);
|
||
gridView.Columns.Add(myCol15);
|
||
gridView.Columns.Add(myCol14);
|
||
gridView1.Columns.Add(myCol20);
|
||
}
|
||
|
||
|
||
|
||
// this.gridView1.Columns.Add(myCol4);
|
||
|
||
|
||
//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 = "ID", Visible = true, FieldName = "id" };
|
||
myCol0.Visible = false;
|
||
gridview.Columns.Add(myCol0);
|
||
GridColumn myCol1 = new GridColumn() { Caption = "商品编码", Visible = true, FieldName = Erp_purch_d.fields.goods_id.ToString() };
|
||
GridColumn myCol2 = new GridColumn() { Caption = "商品名称", Visible = true, FieldName = "goodsName"};
|
||
GridColumn myCol3 = new GridColumn() { Caption = "厂家", Visible = true, FieldName ="manufacturer"};
|
||
GridColumn myCol4 = new GridColumn() { Caption = "规格", Visible = true, FieldName = WmsGoods.exfields.spec.ToString() };
|
||
GridColumn myCol5 = new GridColumn() { Caption = "单位", Visible = true, FieldName = WmsGoods.exfields.unit.ToString() };
|
||
GridColumn myCol6 = new GridColumn() { Caption = "大包装数量", Visible = true, FieldName = WmsGoods.exfields.bigCount.ToString() };
|
||
GridColumn myCol7 = new GridColumn() { Caption = "剂型", Visible = true, FieldName = WmsGoods.exfields.type.ToString() };
|
||
GridColumn myCol8 = new GridColumn() { Caption = "商品类型", Visible = true, FieldName = WmsGoods.exfields.goodsTypeName.ToString() };
|
||
// GridColumn myCol9 = new GridColumn() { Caption = "大零", Visible = true, FieldName = WmsGoods.fields.bulkMax.ToString() };
|
||
// GridColumn myCol10 = new GridColumn() { Caption = "小整", Visible = true, FieldName = WmsGoods.fields.batchMax1.ToString() };
|
||
// GridColumn myCol11 = new GridColumn() { Caption = "大整", Visible = true, FieldName = WmsGoods.fields.batchMax2.ToString() };
|
||
GridColumn myCol12 = new GridColumn() { Caption = "国药准字", Visible = true, FieldName = WmsGoods.exfields.regeditCode.ToString() };
|
||
|
||
GridColumn myCol13 = new GridColumn() { Caption = "订单数量", Visible = true, FieldName = Erp_purch_d.fields.count.ToString() };
|
||
GridColumn myCol132 = new GridColumn() { Caption = "应收数量", Visible = true, FieldName = "count1" };
|
||
|
||
GridColumn myCol131 = new GridColumn() { Caption = "收货数量", Visible = true, FieldName = Erp_purch_d.fields.receiveCount.ToString() };
|
||
GridColumn myCol133 = new GridColumn() { Caption = "拒收数量", Visible = true, FieldName = Erp_purch_d.fields.rejectCount.ToString() };
|
||
GridColumn myCol134 = new GridColumn() { Caption = "到货数量", Visible = true, FieldName = Erp_purch_d.fields.arriveCount.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 myCol17 = new GridColumn() { Caption = "状态", Visible = true, FieldName = "wms_state" };
|
||
GridColumn myCol18 = new GridColumn() { Caption = "说明", Visible = true, FieldName = Erp_purch_d.fields.receiveRemark.ToString() };
|
||
|
||
// GridColumn myCol19 = new GridColumn() { Caption = "货位", Visible = true, FieldName = WmsOutPickLable.fields.locationId.ToString() };
|
||
// GridColumn myCol20 = new GridColumn() { Caption = "入库数量", Visible = true, FieldName = WmsOutPickLable.fields.count.ToString() };
|
||
// GridColumn myCol21 = new GridColumn() { Caption = "上架数量", Visible = true, FieldName = WmsInUpPort.fields.upCount.ToString() };
|
||
// GridColumn myCol22 = new GridColumn() { Caption = "上架说明", Visible = true, FieldName = WmsInUpPort.fields.description.ToString() };
|
||
// GridColumn myCol23 = new GridColumn() { Caption = "ABC", Visible = true, FieldName = "goodsABC" };
|
||
// GridColumn myCol24 = new GridColumn() { Caption = "箱", Visible = true, FieldName = "box" };
|
||
GridColumn myCol25 = new GridColumn() { Caption = "操作人", Visible = true, FieldName = "em_name" };
|
||
GridColumn myCol26 = new GridColumn() { Caption = "操作时间", Visible = true, FieldName = "createtime" };
|
||
GridColumn myCol27 = new GridColumn() { Caption = "需质检", Visible = true, FieldName = WmsGoods.exfields.isQc.ToString() };
|
||
GridColumn myCol28 = new GridColumn() { Caption = "直通商品", Visible = true, FieldName = WmsGoods.exfields.isZhitong.ToString() };
|
||
GridColumn myCol29 = new GridColumn() { Caption = "销售订单", Visible = true, FieldName = Erp_purch_d.fields.custPoNo.ToString() };
|
||
GridColumn myCol30 = new GridColumn() { Caption = "销售数量", Visible = true, FieldName = Erp_purch_d.fields.custQty.ToString() };
|
||
GridColumn myCol31 = new GridColumn() { Caption = "销售客户", Visible = true, FieldName = "custName" };
|
||
|
||
gridview.Columns.Add(myCol2);
|
||
|
||
if (gridview == gridView2)
|
||
{
|
||
gridview.Columns.Add(myCol17);
|
||
// gridview.Columns.Add(myCol14);
|
||
gridview.Columns.Add(myCol13);
|
||
gridview.Columns.Add(myCol132);
|
||
gridview.Columns.Add(myCol134);
|
||
gridview.Columns.Add(myCol131);
|
||
|
||
gridview.Columns.Add(myCol133);
|
||
// gridview.Columns.Add(myCol23);
|
||
gridview.Columns.Add(myCol5);
|
||
|
||
gridview.Columns.Add(myCol27);
|
||
gridview.Columns.Add(myCol28);
|
||
gridview.Columns.Add(myCol29);
|
||
gridview.Columns.Add(myCol30);
|
||
gridview.Columns.Add(myCol31);
|
||
|
||
|
||
// gridview.Columns.Add(myCol14);
|
||
// gridview.Columns.Add(myCol13);
|
||
// gridview.Columns.Add(myCol5);
|
||
gridview.Columns.Add(myCol3);
|
||
// gridview.Columns.Add(myCol15);
|
||
// gridview.Columns.Add(myCol16);
|
||
gridview.Columns.Add(myCol3);
|
||
|
||
|
||
|
||
|
||
|
||
// gridview.Columns.Add(myCol8);
|
||
// gridview.Columns.Add(myCol9);
|
||
// gridview.Columns.Add(myCol10);
|
||
// gridview.Columns.Add(myCol11);
|
||
|
||
gridview.Columns.Add(myCol2);
|
||
gridview.Columns.Add(myCol6);
|
||
|
||
|
||
gridview.Columns.Add(myCol4);
|
||
gridview.Columns.Add(myCol7);
|
||
|
||
gridview.Columns.Add(myCol12);
|
||
gridview.Columns.Add(myCol1);
|
||
gridview.Columns.Add(myCol18);
|
||
}
|
||
|
||
else if (gridview == gridviewRecs)
|
||
{
|
||
gridview.Columns.Add(myCol1);
|
||
gridview.Columns.Add(myCol2);
|
||
gridview.Columns.Add(myCol131);
|
||
gridview.Columns.Add(myCol133);
|
||
gridview.Columns.Add(myCol134);
|
||
gridview.Columns.Add(myCol5);
|
||
gridview.Columns.Add(myCol3);
|
||
gridview.Columns.Add(myCol2);
|
||
gridview.Columns.Add(myCol6);
|
||
gridview.Columns.Add(myCol4);
|
||
gridview.Columns.Add(myCol7);
|
||
gridview.Columns.Add(myCol12);
|
||
gridview.Columns.Add(myCol18);
|
||
gridview.Columns.Add(myCol25);
|
||
gridview.Columns.Add(myCol26);
|
||
|
||
}
|
||
|
||
|
||
//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();
|
||
lbVender.Text = "";
|
||
lbOrderNo.Text = "";
|
||
clearShipInfo();
|
||
try
|
||
{
|
||
// this.splashScreenManager1.ShowWaitForm();
|
||
string query = (this.txtOrderNo.Text.Trim().Length == 0 ? "" : string.Format("{0} =#'{1}';", "pur_order", filtRiskChar(txtOrderNo.Text.Trim())));
|
||
query = !string.IsNullOrEmpty(query) ? query : (this.txtOrderNo.Text.Trim().Length == 0 ? "" : string.Format("{0} =#'{1}';", WmsInRequest.fields.preInOrder.ToString(), filtRiskChar(txtOrderNo.Text.Trim())))
|
||
+ (this.txtVender.Text.Trim().Length == 0 ? "" : string.Format("{0} like # '%{1}%';", "venderName", filtRiskChar(txtVender.Text.Trim())))
|
||
+ (this.dateEditFrom.Text.Trim().Length == 0 ? "" : string.Format("{0} >= # '{1}';" ,Erp_purch.fields.shipDate.ToString(), dateEditFrom.DateTime ))
|
||
+ (this.dateEditTo.Text.Trim().Length == 0 ? "" : string.Format("{0} <= # '{1}';", Erp_purch.fields.shipDate.ToString(), dateEditTo.DateTime))
|
||
+ (this.comboState.SelectedIndex <0 ? "" : string.Format("{0} = #{1};", Erp_purch.fields.wms_state.ToString(), ((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 = inClient.queryReceives(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;
|
||
initialDataGridColumns(gridView1);
|
||
//update selected row index to the last updated one.
|
||
|
||
if (selectedRequest !=null)
|
||
{
|
||
selectedRowIndex = -1;
|
||
DataRow dr = dt.Rows.Find(selectedRequest.ID);
|
||
if (dr != null)
|
||
{
|
||
selectedRowIndex = dt.Rows.IndexOf(dr);
|
||
}
|
||
|
||
if (selectedRowIndex >= 0 && dt.Rows.Count > selectedRowIndex)
|
||
{
|
||
// gridView1.SelectRow(selectedRowIndex);
|
||
gridView1.FocusedRowHandle = selectedRowIndex;
|
||
// gridView1.MakeRowVisible(selectedRowIndex);
|
||
|
||
}
|
||
|
||
//gridView1.FocusedRowHandle = selectedRowIndex;
|
||
}else
|
||
// if (firstLoad)
|
||
{
|
||
selectedRowIndex = 0;
|
||
gridView1.FocusedRowHandle = 0;
|
||
gridView1.SelectRow(0);
|
||
|
||
}
|
||
setCurrentRequestDetail();
|
||
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)
|
||
{
|
||
if (gridView1.FocusedRowHandle < 0 || gridView1.FocusedRowHandle == selectedRowIndex || gridView1.FocusedRowHandle==0 && isCheckedIn)
|
||
{
|
||
isCheckedIn = gridView1.FocusedRowHandle > 0;
|
||
if (gridView1.IsGroupRow(e.RowHandle)) //set first row of group selected
|
||
{
|
||
selectedRowIndex = gridView1.GetChildRowHandle(e.RowHandle, 0);
|
||
setCurrentRequestDetail();
|
||
}
|
||
if (isCheckedIn)
|
||
{
|
||
isCheckedIn = false;
|
||
}
|
||
return;
|
||
|
||
}
|
||
selectedRowIndex = gridView1.FocusedRowHandle;
|
||
// showErrorMsg("selection:"+ selectedRowIndex);
|
||
setCurrentRequestDetail();
|
||
|
||
}
|
||
|
||
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
|
||
int selectedInIndex = -1;
|
||
string goodsName;
|
||
int selectedPdId;
|
||
int selectedPurDetailId = -1;
|
||
Erp_purch_d currentDetail = null;
|
||
private void gridView2_FocusedRowObjectChanged(object sender, FocusedRowObjectChangedEventArgs e)
|
||
{
|
||
if (!isShowingInRequest)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if (gridView2.FocusedRowHandle < 0 || gridView2.FocusedRowHandle == selectedInIndex)
|
||
{
|
||
if (gridView2.IsGroupRow(e.RowHandle)) //set first row of group selected
|
||
{
|
||
selectedInIndex = gridView2.GetChildRowHandle(e.RowHandle, 0);
|
||
setCurrentInDetail();
|
||
}
|
||
|
||
return;
|
||
|
||
}
|
||
selectedInIndex = gridView2.FocusedRowHandle;
|
||
// showErrorMsg("selection:"+ selectedRowIndex);
|
||
setCurrentInDetail();
|
||
|
||
}
|
||
|
||
|
||
|
||
private void gridView2_DataSourceChanged(object sender, EventArgs e)
|
||
{
|
||
if (!isShowingInRequest)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if (selectedInIndex >= 0)// && dtIndetail.Rows.Count > selectedInIndex)
|
||
{
|
||
gridView2.FocusedRowHandle = selectedInIndex;
|
||
gridView2.MakeRowVisible(selectedInIndex);
|
||
|
||
}
|
||
}
|
||
|
||
private bool getCurrentInObject()
|
||
{/*
|
||
if (!isShowingInRequest)
|
||
{
|
||
return false;
|
||
}
|
||
*/
|
||
if (selectedInIndex < 0)// || selectedInIndex >= dtIndetail.Rows.Count)
|
||
{
|
||
return false;
|
||
}
|
||
|
||
// DataRow currentRow = dt.Rows[selectedRowIndex];
|
||
DataRowView dr = (DataRowView)(GetGridViewFilteredAndSortedData(gridView2)[selectedInIndex]);
|
||
goodsName = dr["GoodsName"].ToString();
|
||
selectedPdId = Convert.ToInt32(dr["id"].ToString());
|
||
currentDetail = new Erp_purch_d(dr.Row);
|
||
|
||
return true;
|
||
|
||
}
|
||
private void setCurrentInDetail()
|
||
{
|
||
|
||
if (!getCurrentInObject() || string.IsNullOrEmpty( goodsName))
|
||
{
|
||
return;
|
||
}
|
||
/// gridView1.FocusedRowHandle = selectedRowIndex;//
|
||
// gridView1.SelectRow(selectedRowIndex);
|
||
showWaitForm();
|
||
|
||
try
|
||
{
|
||
lbPGoodsName.Text = goodsName;
|
||
textEditReceiveNum.Text = currentDetail.count - currentDetail.receiveCount - currentDetail.rejectCount + "";
|
||
this.txtArrave.Text = textEditReceiveNum.Text;
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
showErrorMsg(e.Message);
|
||
}
|
||
closeWaitForm();
|
||
}
|
||
|
||
|
||
int selectedInShipId = 0;
|
||
int selectedShipIndex;
|
||
string shipDate;
|
||
|
||
string selectedShipDriver = "";
|
||
|
||
private void gridViewship_FocusedRowObjectChanged(object sender, FocusedRowObjectChangedEventArgs e)
|
||
{
|
||
|
||
|
||
if (gridviewShip.FocusedRowHandle < 0 || gridviewShip.FocusedRowHandle == selectedShipIndex)
|
||
{
|
||
if (gridviewShip.IsGroupRow(e.RowHandle)) //set first row of group selected
|
||
{
|
||
selectedShipIndex = gridviewShip.GetChildRowHandle(e.RowHandle, 0);
|
||
setCurrentShipDetail();
|
||
}
|
||
|
||
return;
|
||
|
||
}
|
||
selectedShipIndex = gridviewShip.FocusedRowHandle;
|
||
// showErrorMsg("selection:"+ selectedRowIndex);
|
||
setCurrentShipDetail();
|
||
|
||
}
|
||
|
||
|
||
private void setCurrentShipDetail()
|
||
{
|
||
|
||
if (!getCurrentShipObject() || selectedInShipId <=0)
|
||
{
|
||
return;
|
||
}
|
||
/// gridView1.FocusedRowHandle = selectedRowIndex;//
|
||
// gridView1.SelectRow(selectedRowIndex);
|
||
showWaitForm();
|
||
|
||
try
|
||
{
|
||
// lbPGoodsName.Text = selectedShipDriver;
|
||
lbShipInfo.Text = string.Format("【运输人】:{0} 【记录时间】:{1}", selectedShipDriver,shipDate);
|
||
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
showErrorMsg(e.Message);
|
||
}
|
||
closeWaitForm();
|
||
}
|
||
|
||
private bool getCurrentShipObject()
|
||
{
|
||
if (selectedShipIndex < 0)// || selectedInIndex >= dtIndetail.Rows.Count)
|
||
{
|
||
return false;
|
||
}
|
||
|
||
// DataRow currentRow = dt.Rows[selectedRowIndex];
|
||
DataRowView dr = (DataRowView)(GetGridViewFilteredAndSortedData(gridviewShip)[selectedShipIndex]);
|
||
selectedShipDriver = dr["driverName"].ToString();
|
||
selectedInShipId = Convert.ToInt32(dr["id"].ToString());
|
||
shipDate = dr["createtime"].ToString();
|
||
return true;
|
||
|
||
}
|
||
|
||
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();
|
||
|
||
}
|
||
|
||
|
||
}
|
||
string lastSelectedPurOrder = "";
|
||
private bool getCurrentObject()
|
||
{
|
||
if (selectedRowIndex <0 || selectedRowIndex >= dt.Rows.Count)
|
||
{
|
||
return false;
|
||
}
|
||
|
||
// DataRow currentRow = dt.Rows[selectedRowIndex];
|
||
DataRowView dr = (DataRowView)(GetGridViewFilteredAndSortedData(gridView1)[selectedRowIndex]);
|
||
|
||
lastSelectedPurOrder = selectedRequest ==null? "" : selectedRequest.pur_order;
|
||
|
||
selectedRequest = new Erp_purch(dr.Row);
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
this.gridControl2.DataSource = null;
|
||
btnIn.Enabled = false;
|
||
btnCache.Enabled = false;
|
||
|
||
lbVender.Text = "";
|
||
lbOrderNo.Text = "";
|
||
return true;
|
||
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
private void btnQuery_Click(object sender, EventArgs e)
|
||
{
|
||
queryGoods();
|
||
}
|
||
|
||
private void gridView1_SelectionChanged(object sender, DevExpress.Data.SelectionChangedEventArgs e)
|
||
{
|
||
if (gridView1.FocusedRowHandle <0 || gridView1.FocusedRowHandle == selectedRowIndex)
|
||
{
|
||
return;
|
||
}
|
||
selectedRowIndex = gridView1.FocusedRowHandle;
|
||
// showErrorMsg("selection:"+ selectedRowIndex);
|
||
setCurrentRequestDetail();
|
||
}
|
||
|
||
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;
|
||
|
||
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 = 40;
|
||
this.gridView1.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView_CustomDrawRowIndicator);
|
||
this.gridView2.IndicatorWidth = 40;
|
||
this.gridView2.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView_CustomDrawRowIndicator);
|
||
|
||
gridView2.CustomColumnDisplayText += gridView2_CustomColumnDisplayText;
|
||
gridView2.CustomDrawCell += gridView_CustomDrawCell;
|
||
gridView2.RowCellStyle += gridView_RowCellStyle;
|
||
gridView1.RowCellStyle += gridView_RowCellStyle;
|
||
|
||
this.gridView2.FocusedRowObjectChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventHandler(this.gridView2_FocusedRowObjectChanged);
|
||
this.gridviewShip.FocusedRowObjectChanged +=
|
||
new DevExpress.XtraGrid.Views.Base.FocusedRowObjectChangedEventHandler(this.gridViewship_FocusedRowObjectChanged);
|
||
|
||
|
||
gridView1.CustomColumnDisplayText += gridView2_CustomColumnDisplayText;
|
||
gridView1.CustomDrawCell += gridView_CustomDrawCell;
|
||
|
||
this.gridviewRecs.IndicatorWidth = 40;
|
||
this.gridviewRecs.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView_CustomDrawRowIndicator);
|
||
|
||
|
||
}
|
||
|
||
|
||
|
||
|
||
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);
|
||
if (sender == gridView2)
|
||
{
|
||
e.DisplayText = this.enumReceiveDetailStatus[display];
|
||
}
|
||
else
|
||
{
|
||
e.DisplayText = this.inRequestStatus[display];
|
||
}
|
||
}
|
||
catch
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
|
||
return;
|
||
// e.DisplayText = stockInLocationStatus.ContainsKey(display) ? stockInLocationStatus[display] : display+"";
|
||
|
||
}
|
||
|
||
|
||
|
||
if (e.Column.FieldName == "isQc" || e.Column.FieldName == "isZhitong")
|
||
{
|
||
int display = -100;
|
||
string disTxt = e.DisplayText;
|
||
|
||
try
|
||
{
|
||
display = Convert.ToInt32(e.DisplayText);
|
||
if (sender == gridView2)
|
||
{
|
||
e.DisplayText = (display == 1) ? "是" : "否";
|
||
}
|
||
|
||
}
|
||
catch
|
||
{
|
||
return;
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
}
|
||
}
|
||
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 == "wms_state" && 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;
|
||
}
|
||
else if(b.Equals("已收货"))
|
||
{
|
||
e.Appearance.ForeColor = Color.Gray;
|
||
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 == "2" )
|
||
{
|
||
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 setCurrentRequestDetail()
|
||
{
|
||
this.gridControl2.DataSource = null;
|
||
|
||
if (!getCurrentObject() || selectedRequest == null)
|
||
{
|
||
return;
|
||
}
|
||
/// gridView1.FocusedRowHandle = selectedRowIndex;//
|
||
// gridView1.SelectRow(selectedRowIndex);
|
||
showWaitForm();
|
||
|
||
|
||
lbVender.Text = selectedRequest.venderName;
|
||
lbOrderNo.Text = selectedRequest.pur_order;
|
||
lbType.Text = "[" + selectedRequest.order_typeName + "]";
|
||
try
|
||
{
|
||
isShowingInRequest = true;
|
||
|
||
DataTable dtLog = inClient.getReceiveHistory(selectedRequest.pur_order);
|
||
closeClient();
|
||
|
||
this.gridcontrolRecords.DataSource = dtLog;
|
||
|
||
initialGridView2Columns(gridviewRecs);
|
||
|
||
|
||
DataTable dt1 = inClient.getRequestInDetail(selectedRequest.pur_order, -1); closeClient();
|
||
DataView dv = dt1.DefaultView;
|
||
dv.RowFilter = "wms_state <=1";
|
||
this.gridControl2.DataSource = dv;
|
||
initialGridView2Columns(gridView2);
|
||
selectedInIndex = gridView2.FocusedRowHandle;
|
||
setCurrentInDetail();
|
||
|
||
|
||
btnIn.Enabled = selectedRequest.wms_state == (int)enumInStockOrderStatus.待收货;
|
||
btnCache.Enabled = btnIn.Enabled;
|
||
|
||
clearShipInfo();
|
||
|
||
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
showErrorMsg(e.Message);
|
||
}
|
||
finally
|
||
{
|
||
closeClient();
|
||
}
|
||
closeWaitForm();
|
||
}
|
||
void clearShipInfo()
|
||
{
|
||
|
||
if (selectedRequest ==null || lastSelectedPurOrder.Equals(selectedRequest.pur_order))
|
||
{
|
||
return;
|
||
}
|
||
|
||
gridcontrolShip.DataSource = null;
|
||
|
||
selectedInShipId = 0;
|
||
selectedShipIndex = -1; ;
|
||
shipDate ="";
|
||
selectedShipDriver = "";
|
||
lbShipInfo.Text = "";
|
||
|
||
|
||
|
||
}
|
||
private void btnIn_Click(object sender, EventArgs e)
|
||
{
|
||
IsToCacheStore = false;
|
||
cachePartion = -1;
|
||
doReceive();
|
||
|
||
}
|
||
void doReceive()
|
||
{
|
||
if (selectedInShipId <= 0)
|
||
{
|
||
// showErrorMsg("请设置运输信息。");
|
||
// return;
|
||
}
|
||
|
||
lastSelectedPurOrder = selectedRequest.pur_order;
|
||
if (tbReceive.SelectedTabPageIndex == 0)
|
||
{
|
||
receiveByItem();
|
||
}
|
||
else
|
||
{
|
||
takeAllOrder();
|
||
}
|
||
}
|
||
void receiveByItem()
|
||
{
|
||
int lastSelectedIndex = 0;
|
||
showWaitForm();
|
||
try
|
||
{
|
||
// lgt.requestInStock(selectedRequest.orderNo);
|
||
|
||
|
||
decimal arriveNumber = Convert.ToDecimal(txtArrave.Text.ToString().Trim());
|
||
decimal number = Convert.ToDecimal(textEditReceiveNum.Text.ToString().Trim());
|
||
|
||
if (arriveNumber < number)
|
||
{
|
||
showErrorMsg("收货、拒收数量不能大于到货数量。");
|
||
return;
|
||
}
|
||
if (number + currentDetail.receiveCount > currentDetail.count)
|
||
{
|
||
showInfoMsg("数量超收。");
|
||
}
|
||
|
||
int receiveType = this.comboPdStatus.SelectedIndex;
|
||
if (receiveType == 1)
|
||
{
|
||
IsToCacheStore = false;
|
||
}
|
||
IsToCacheStore = IsToCacheStore && receiveType == 0;
|
||
|
||
inClient.receiveDetail("OBSOLETED!!!!!!!!!!!!!",selectedPdId, arriveNumber, number, receiveType, filtRiskChar(memPdRemark.Text.Trim()),selectedInShipId,IsToCacheStore,cachePartion);
|
||
closeClient();
|
||
lastSelectedIndex = gridView2.FocusedRowHandle;
|
||
memPdRemark.Text = "";
|
||
isCheckedIn = true;
|
||
query();
|
||
}
|
||
catch (Exception er)
|
||
{
|
||
// setCurrentRequestDetail();
|
||
showErrorMsg(er.Message);
|
||
}
|
||
|
||
setCurrentRequestDetail();
|
||
gridView2.FocusedRowHandle = lastSelectedIndex;
|
||
|
||
closeWaitForm();
|
||
}
|
||
|
||
|
||
|
||
private void GoodsInForm_FormClosing(object sender, FormClosingEventArgs e)
|
||
{
|
||
//closeClient();
|
||
}
|
||
|
||
protected new void gridview_GotFocus(object sender, EventArgs e)
|
||
{
|
||
if (sender == gridView1)
|
||
{
|
||
//grid4Valid.ForeColor = Color.Blue;
|
||
// gridView4Valid.OptionsSelection.EnableAppearanceHideSelection = true;
|
||
if (!isShowingInRequest)
|
||
{
|
||
this.setCurrentRequestDetail();
|
||
}
|
||
switchGridViewRowSelection(gridView1, true);
|
||
|
||
}
|
||
|
||
else
|
||
{
|
||
switchGridViewRowSelection((GridView)sender, true);
|
||
}
|
||
|
||
}
|
||
|
||
|
||
void textEditBarcode_MouseUp(object sender, MouseEventArgs e)
|
||
{
|
||
//如果鼠标左键操作并且标记存在,则执行全选
|
||
if (e.Button == MouseButtons.Left && textEditBarcode.Tag != null && (bool)textEditBarcode.Tag == true)
|
||
{
|
||
textEditBarcode.SelectAll();
|
||
}
|
||
|
||
//取消全选标记
|
||
textEditBarcode.Tag = false;
|
||
}
|
||
|
||
|
||
void textEditBarcode_GotFocus(object sender, EventArgs e)
|
||
{
|
||
textEditBarcode.Tag = true; //设置标记
|
||
textEditBarcode.SelectAll(); //注意1
|
||
}
|
||
|
||
private void txtQuery_KeyDown(object sender, KeyEventArgs e)
|
||
{
|
||
if (e.KeyCode != Keys.Enter)
|
||
{
|
||
return;
|
||
}
|
||
string barcode = this.textEditBarcode.Text.Trim();
|
||
|
||
if (string.IsNullOrEmpty(barcode) || barcode.Length<5)
|
||
{
|
||
return;
|
||
}
|
||
|
||
DataRow[] drs = this.dt.Select(string.Format("pur_order ='{0}'", barcode)); ;
|
||
if (drs.Length > 0)
|
||
{
|
||
// selectedValidatedItem = dtPickOrdersValidated.Rows.IndexOf(dr0);
|
||
this.selectedRowIndex = 0;
|
||
foreach (DataRowView drv in GetGridViewFilteredAndSortedData(gridView1))
|
||
{
|
||
if (drv["pur_order"].ToString().Trim().Equals(barcode))
|
||
{
|
||
break;
|
||
}
|
||
selectedRowIndex++;
|
||
|
||
}
|
||
|
||
if (selectedRowIndex >= 0 && dt.Rows.Count > selectedRowIndex)
|
||
{
|
||
this.gridView1.FocusedRowHandle = selectedRowIndex;
|
||
setCurrentRequestDetail();
|
||
|
||
}
|
||
else
|
||
{
|
||
|
||
showErrorMsg(string.Format("当前列表没定位到单号'{0}'", barcode));
|
||
|
||
}
|
||
|
||
|
||
}
|
||
else
|
||
{
|
||
|
||
showErrorMsg(string.Format("当前列表没定位到单号'{0}'",barcode));
|
||
|
||
}
|
||
|
||
|
||
textEditBarcode.SelectAll();
|
||
textEditBarcode.Focus();
|
||
|
||
|
||
}
|
||
|
||
private void barBiSyncGoods_ItemClick(object sender, ItemClickEventArgs e)
|
||
{
|
||
initailErpData();
|
||
}
|
||
/// <summary>
|
||
/// 同步erp 信息
|
||
/// </summary>
|
||
private void initailErpData()
|
||
{
|
||
|
||
showWaitForm("正在同步商品信息");
|
||
try
|
||
{
|
||
//同步商品信息
|
||
//lWmsGoods lg = new lWmsGoods();
|
||
//lg.getWmsGoods.syncGoods();
|
||
|
||
|
||
goodClient.syncGoods();
|
||
closeClient();
|
||
closeWaitForm();
|
||
|
||
}
|
||
catch (Exception e)
|
||
{
|
||
LogHelper.WriteLog(this.GetType(), e);
|
||
// showErrorMsg(e.Message);
|
||
closeWaitForm();
|
||
|
||
}
|
||
|
||
}
|
||
|
||
private void takeAllOrder()
|
||
{
|
||
int lastSelectedIndex = 0;
|
||
showWaitForm();
|
||
try
|
||
{
|
||
// lgt.requestInStock(selectedRequest.orderNo);
|
||
|
||
int receiveType = this.coboPhStatus.SelectedIndex;
|
||
IsToCacheStore = IsToCacheStore && receiveType == 0;
|
||
inClient.receiveByOrder(selectedRequest.pur_order, receiveType, filtRiskChar(mePhRemark.Text.Trim()), selectedInShipId, IsToCacheStore,cachePartion);
|
||
closeClient();
|
||
lastSelectedIndex = gridView2.FocusedRowHandle;
|
||
mePhRemark.Text = "";
|
||
isCheckedIn = true;
|
||
// query();
|
||
}
|
||
catch (Exception er)
|
||
{
|
||
// setCurrentRequestDetail();
|
||
showErrorMsg(er.Message);
|
||
}
|
||
|
||
setCurrentRequestDetail();
|
||
gridView2.FocusedRowHandle = lastSelectedIndex;
|
||
|
||
closeWaitForm();
|
||
}
|
||
|
||
|
||
//值改变事件
|
||
private void textLocation_EditValueChanged(object sender, EventArgs e)
|
||
{
|
||
string daID = this.txtShipOrder.EditValue.ToString(); //是ookUpEdit.Properties.ValueMember的值
|
||
string xm = this.txtShipOrder.Text.Trim();
|
||
}
|
||
|
||
private void btnQueryShip_Click(object sender, EventArgs e)
|
||
{
|
||
|
||
|
||
string shipOrder = txtShipOrder.Text.Trim();
|
||
|
||
if(string.IsNullOrEmpty(shipOrder)){
|
||
|
||
showErrorMsg("请输入运输单号码");
|
||
txtShipOrder.Focus();
|
||
return;
|
||
}
|
||
|
||
getShipDetails(shipOrder);
|
||
}
|
||
|
||
void getShipDetails(string shipOrder)
|
||
{
|
||
dtship = inClient.getShipDetail(shipOrder);
|
||
closeClient();
|
||
gridcontrolShip.DataSource = dtship.DefaultView;
|
||
|
||
initialDataGridColumns(gridviewShip);
|
||
|
||
}
|
||
|
||
private void btnCache_Click_1(object sender, EventArgs e)
|
||
{
|
||
/**
|
||
明细若有需要QC的,则到Validation 页面操作直通收货
|
||
*/
|
||
cachePartion = ((Node)this.combCache.SelectedItem).ID;
|
||
IsToCacheStore = true;
|
||
doReceive();
|
||
}
|
||
}
|
||
} |