1331 lines
49 KiB
C#
1331 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.ServiceReferenceStockOutPickRequest;
|
|
using Deiniu.win.elelab;
|
|
using DeiNiu.wms.win.ServiceReferenceStockOutRequest;
|
|
using DeiNiu.wms.win.waveRuleService;
|
|
|
|
|
|
namespace DeiNiu.wms.win
|
|
{
|
|
public partial class GoodsOutTasks : BasicRibbonForm
|
|
{
|
|
|
|
|
|
printIn reqportPrint = new printIn() ;
|
|
|
|
// lWmsStock ls = new lWmsStock();
|
|
// lWmsOutPickRequest lgt = new lWmsOutPickRequest();
|
|
private string fieldName = WmsLocation.fields.locationId.ToString();
|
|
private string fieldGoodType = WmsLocation.fields.whGoodsType.ToString();
|
|
private string lastQuery = "";
|
|
string waveNo = "", lastWaveNo = "";
|
|
private DataTable dtRepOrders;
|
|
private int selectedRowIndex = -1;
|
|
|
|
bool autoOrder;
|
|
int lightId = 0;
|
|
int comId = 1;
|
|
|
|
public GoodsOutTasks()
|
|
{
|
|
InitializeComponent();
|
|
try
|
|
{
|
|
initialControls();
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
showErrorMsg(er);
|
|
}
|
|
// loadData();
|
|
|
|
}
|
|
|
|
#region initialControls
|
|
private void initialControls()
|
|
{
|
|
setDatePiker(dateEditFrom, dateEditTo);
|
|
initialComboBoxes();
|
|
initialPagerControls();
|
|
initialDataGrid();
|
|
initialQueryInput();
|
|
setValidationRule();
|
|
|
|
initialChannelLight();
|
|
// searchLight();
|
|
// swAutoOrder.IsOn = WmsConstants.AUTO_PICK_BATCH_PICK_ORDER;
|
|
|
|
}
|
|
/// <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;//每页行数
|
|
|
|
#endregion
|
|
|
|
|
|
this.pager1.Bind();//绑定
|
|
}
|
|
|
|
private void initialDataGrid()
|
|
{
|
|
this.gridView3.IndicatorWidth =60;
|
|
this.gridView3.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(gridView_CustomDrawRowIndicator);
|
|
gridView3.CustomColumnDisplayText += gridView2_CustomColumnDisplayText;
|
|
initialGridView2Columns(gridView3);
|
|
GridCheckEdit(gridView3, CheckBoxField, 50);
|
|
|
|
}
|
|
|
|
|
|
private void initialComboBoxes()
|
|
{
|
|
|
|
initialComboBoxs(comboState, pickOrNot);
|
|
Dictionary<int, string> dic = new Dictionary<int, string>();
|
|
|
|
dic[(int)enumStockRecordType.销售出库] = enumStockRecordType.销售出库.ToString();
|
|
dic[(int)enumStockRecordType.补零出库] = enumStockRecordType.补零出库.ToString();
|
|
dic[(int)enumStockRecordType.报废出库] = enumStockRecordType.报废出库.ToString();
|
|
// dic[(int)enumStockRecordType.退供应商出库] = enumStockRecordType.退供应商出库.ToString();
|
|
// dic[(int)enumStockRecordType.仓间调出] = enumStockRecordType.仓间调出.ToString();
|
|
dic[(int)enumStockRecordType.领用出库] = enumStockRecordType.领用出库.ToString();
|
|
|
|
initialComboBoxs(comRecType, dic);
|
|
|
|
dic.Clear();
|
|
dic[0] = "已分配" ;
|
|
dic[1] = "未分配";
|
|
initialComboBoxs(comAssigned, dic);
|
|
|
|
|
|
|
|
|
|
waveRuleService.WcfWaveRule[] rules = wrClient.getWaveRules(enumWaveRuleType.普通波次);
|
|
closeClient();
|
|
|
|
dic = new Dictionary<int, string>();
|
|
|
|
foreach (WcfWaveRule rule in rules)
|
|
{
|
|
dic.Add(rule.ID, rule.ruleName);
|
|
}
|
|
|
|
initialComboBoxs(comWaveRule, dic);
|
|
|
|
WcfWaveRule rulex = wrClient.getCurrentActiveRule( enumWaveRuleType.普通波次 );
|
|
closeClient();
|
|
|
|
if (rulex.ID > 0)
|
|
{
|
|
int i=0;
|
|
foreach (Object item in comWaveRule.Properties.Items)
|
|
{
|
|
if (((Colitem)item).key == rulex.ID)
|
|
{
|
|
comWaveRule.SelectedItem = item;
|
|
// comboState.SelectedIndex = i;
|
|
break;
|
|
}
|
|
i++;
|
|
}
|
|
|
|
this.spinWave.Value = rulex.interval;
|
|
}
|
|
|
|
|
|
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 2005:
|
|
initialComboBoxs(this.comPartion, drss);//分区
|
|
break;
|
|
|
|
case 3001:
|
|
initialComboBoxs(this.comLine, drss);//线路
|
|
break;
|
|
case 2001:
|
|
|
|
initialComboBoxs(this.comWarehouse, drss);//库房
|
|
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);
|
|
GridColumn myCol1 = new GridColumn() { Caption = "波次号", Visible = true, FieldName = WmsWave.fields.waveNo.ToString() };
|
|
GridColumn myCol2 = new GridColumn() { Caption = "类型", Visible = true, FieldName = WmsWave.fields.type.ToString(),MinWidth=80 };
|
|
GridColumn myCol3 = new GridColumn() { Caption = "状态", Visible = true, FieldName = WmsWave.fields.state.ToString(), MinWidth = 60 };
|
|
GridColumn myCol4 = new GridColumn() { Caption = "时间", Visible = true, FieldName = "createtime", MinWidth = 120 };
|
|
|
|
|
|
gridView.Columns.Add(myCol1);
|
|
gridView.Columns.Add(myCol2);
|
|
gridView.Columns.Add(myCol3);
|
|
gridView.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();
|
|
GridColumn colChk = new GridColumn() { Caption = CheckBoxField, Visible = true, FieldName = CheckBoxField };
|
|
gridview.Columns.Add(colChk);
|
|
// gridviewGoodsType.Columns.Remove(gridviewGoodsType.Columns["DealerPrice"]);
|
|
GridColumn myCol0 = new GridColumn() { Caption = "下架序号", Visible = true, FieldName = "id" };
|
|
myCol0.Visible = true;
|
|
gridview.Columns.Add(myCol0);
|
|
|
|
/* 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() };
|
|
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 = WmsOutPickDetail.fields.batch1Count.ToString() };
|
|
GridColumn myCol131 = new GridColumn() { Caption = "大整数量", Visible = true, FieldName = WmsOutPickDetail.fields.batch2Count.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 = gridview == gridView3 ? "state" : WmsOutPickDetail .fields.batchPickState.ToString() };
|
|
GridColumn myCol18 = new GridColumn() { Caption = "说明", Visible = true, FieldName = WmsInRequestDetail.fields.description.ToString() };
|
|
|
|
GridColumn myCol20 = new GridColumn() { Caption = "出库数量", Visible = true, FieldName = WmsOutPickLable.fields.count.ToString() };
|
|
GridColumn myCol21 = new GridColumn() { Caption = "集货货位", Visible = true, FieldName = WmsOutPickPort.fields.tranLocationId.ToString() };
|
|
*/
|
|
GridColumn myCol1 = new GridColumn() { Caption = "商品名称", Visible = true, FieldName = WmsGoods.exfields.goodsName.ToString() };
|
|
GridColumn myCol222 = new GridColumn() { Caption = "商品编号", Visible = true, FieldName = WmsGoods.fields.goodsId.ToString() };
|
|
GridColumn myCol2 = new GridColumn() { Caption = "货位", Visible = true, FieldName = WmsOutPickLable.fields.locationId.ToString() };
|
|
GridColumn myCol3 = new GridColumn() { Caption = "状态", Visible = true, FieldName = "state" ,MinWidth = 100};
|
|
GridColumn myCol4 = new GridColumn() { Caption = "计划数量", Visible = true, FieldName = WmsOutPickPort.fields.count.ToString() };
|
|
GridColumn myCol5 = new GridColumn() { Caption = "拣货数量", Visible = true, FieldName = WmsOutPickPort.fields.pickCount.ToString() };
|
|
GridColumn myCol6 = new GridColumn() { Caption = "单位", Visible = true, FieldName = WmsGoods.exfields.unit.ToString() };
|
|
GridColumn myCol7 = new GridColumn() { Caption = "批号", Visible = true, FieldName = WmsInRequestDetail.fields.batch.ToString() };
|
|
GridColumn myCol8 = new GridColumn() { Caption = "分拣单", Visible = true, FieldName = "pickOrderNo" };
|
|
GridColumn myCol9 = new GridColumn() { Caption = "集货区", Visible = true, FieldName = "tranAreaName" };
|
|
GridColumn myCol10 = new GridColumn() { Caption = "集货货位", Visible = true, FieldName = WmsOutPickPort.fields.tranLocationId.ToString() };
|
|
GridColumn myCol11 = new GridColumn() { Caption = "skuId", Visible = true, FieldName = "skuId" };
|
|
GridColumn myCol12 = new GridColumn() { Caption = "sku", Visible = true, FieldName = "skuCode" };
|
|
GridColumn myCol13= new GridColumn() { Caption = "货主", Visible = true, FieldName = "ownerName" };
|
|
GridColumn myCol14 = new GridColumn() { Caption = "货位分区", Visible = true, FieldName = "partName" };
|
|
GridColumn myCol15 = new GridColumn() { Caption = "波次号", Visible = true, FieldName = "waveOrder" };
|
|
GridColumn myCol16 = new GridColumn() { Caption = "任务编号", Visible = true, FieldName = "jobNo" };
|
|
GridColumn myCol17 = new GridColumn() { Caption = "相关容器", Visible = true, FieldName = "flowNo" };
|
|
GridColumn myCol18 = new GridColumn() { Caption = "负责人", Visible = true, FieldName = "em_name" };
|
|
GridColumn myCol19 = new GridColumn() { Caption = "分配人", Visible = true, FieldName = "分配人" };
|
|
GridColumn myCol20 = new GridColumn() { Caption = "件数", Visible = true, FieldName = "boxcnt" };
|
|
GridColumn myCol21 = new GridColumn() { Caption = "客户名称", Visible = true, FieldName = "customerName" };
|
|
GridColumn myCol211 = new GridColumn() { Caption = "客户编号", Visible = true, FieldName = "customerId" };
|
|
GridColumn myCol22 = new GridColumn() { Caption = "线路", Visible = true, FieldName = "lineName" };
|
|
GridColumn myCol23 = new GridColumn() { Caption = "规格", Visible = true, FieldName = "spec" };
|
|
//GridColumn myCol24 = new GridColumn() { Caption = "打印次数", Visible = true, FieldName = "printcnt" };
|
|
GridColumn myCol25 = new GridColumn() { Caption = "亮灯波次", Visible = true, FieldName = "dpsOrder" };
|
|
|
|
GridColumn myCol26 = new GridColumn() { Caption = "分拣员", Visible = true, FieldName = "pickByName" };
|
|
GridColumn myCol27 = new GridColumn() { Caption = "拣货时间", Visible = true, FieldName = "pickTime"};
|
|
GridColumn myCol28 = new GridColumn() { Caption = "复核员", Visible = true, FieldName = "checkByName" };
|
|
GridColumn myCol29 = new GridColumn() { Caption = "复核时间", Visible = true, FieldName = "checkTime", MinWidth = 150 };
|
|
GridColumn myCol30 = new GridColumn() { Caption = "复核员2", Visible = true, FieldName = "checkByName2" };
|
|
GridColumn myCol31 = new GridColumn() { Caption = "复核时间2", Visible = true, FieldName = "checkByTime2", MinWidth = 150 };
|
|
GridColumn myCol32 = new GridColumn() { Caption = "创建时间", Visible = true, FieldName = "createtime" };
|
|
GridColumn myCol33 = new GridColumn() { Caption = "销售订单", Visible = true, FieldName = "saleOrder" };
|
|
GridColumn myCol34 = new GridColumn() { Caption = "零整比率 ", Visible = true, FieldName = "minOperateCount" };
|
|
GridColumn myCol35 = new GridColumn() { Caption = "件数 ", Visible = true, FieldName = "pcs" };
|
|
gridview.Columns.Add(myCol1);
|
|
|
|
gridview.Columns.Add(myCol222);
|
|
gridview.Columns.Add(myCol21); gridview.Columns.Add(myCol211);
|
|
gridview.Columns.Add(myCol33);
|
|
gridview.Columns.Add(myCol20);
|
|
gridview.Columns.Add(myCol2);
|
|
gridview.Columns.Add(myCol19);
|
|
gridview.Columns.Add(myCol3);
|
|
|
|
gridview.Columns.Add(myCol17);
|
|
gridview.Columns.Add(myCol27);
|
|
gridview.Columns.Add(myCol4);
|
|
gridview.Columns.Add(myCol5);
|
|
gridview.Columns.Add(myCol6);
|
|
gridview.Columns.Add(myCol23);
|
|
|
|
gridview.Columns.Add(myCol22);
|
|
gridview.Columns.Add(myCol35);
|
|
gridview.Columns.Add(myCol34);
|
|
|
|
gridview.Columns.Add(myCol32);
|
|
gridview.Columns.Add(myCol16);
|
|
gridview.Columns.Add(myCol9);
|
|
|
|
gridview.Columns.Add(myCol8);
|
|
|
|
|
|
|
|
|
|
gridview.Columns.Add(myCol10);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gridview.Columns.Add(myCol28);
|
|
gridview.Columns.Add(myCol29);
|
|
|
|
gridview.Columns.Add(myCol11);
|
|
|
|
|
|
// gridview.Columns.Add(myCol12);
|
|
// gridview.Columns.Add(myCol13);
|
|
|
|
gridview.Columns.Add(myCol15);
|
|
gridview.Columns.Add(myCol21);
|
|
// gridview.Columns.Add(myCol24);
|
|
gridview.Columns.Add(myCol25);
|
|
|
|
gridview.Columns.Add(myCol26);
|
|
gridview.Columns.Add(myCol27);
|
|
gridview.Columns.Add(myCol28);
|
|
gridview.Columns.Add(myCol29);
|
|
gridview.Columns.Add(myCol30);
|
|
gridview.Columns.Add(myCol31);
|
|
gridview.Columns.Add(myCol18);
|
|
|
|
//to show bottom scroll bar
|
|
gridview.OptionsView.ColumnAutoWidth = false;
|
|
gridview.BestFitColumns();
|
|
// gridView2.Focus();
|
|
}
|
|
|
|
#endregion
|
|
|
|
int lastState = 0, state = 0;
|
|
/// <summary>
|
|
/// loading data
|
|
/// </summary>
|
|
private int loadData()
|
|
{
|
|
showWaitForm();
|
|
string query ="";
|
|
try
|
|
{
|
|
|
|
query += (this.dateEditFrom.Text.Trim().Length == 0 ? "" : string.Format("{0} >= # '{1}';", "createtime", dateEditFrom.DateTime))
|
|
+ (this.dateEditTo.Text.Trim().Length == 0 ? "" : string.Format("{0} <= # '{1}';", "createtime", dateEditTo.DateTime));
|
|
|
|
query += (this.comboState.SelectedIndex <= 0 ? "" : string.Format("{0} = #{1};", "state", ((Colitem)this.comboState.SelectedItem).key))
|
|
+ (this.comRecType.SelectedIndex <= 0 ? "" : string.Format("{0} = #{1};", "recType", ((Colitem)this.comRecType.SelectedItem).key))
|
|
+ (this.comWarehouse.SelectedIndex <= 0 ? "" : string.Format("{0} = #{1};", "warehouse", ((Node)this.comWarehouse.SelectedItem).ID))
|
|
+ (this.txtTaskBy.Text.Trim().Length == 0 ? "" : string.Format("{0} like # '%{1}%';", "pickByName", filtRiskChar(txtTaskBy.Text.Trim())))
|
|
+ (this.comLine.SelectedIndex <= 0 ? "" : string.Format("{0} = #{1};", "lineId", ((Node)this.comLine.SelectedItem).ID ))
|
|
+ (this.txtGoodsName.Text.Trim().Length == 0 ? "" : string.Format("{0} like # '%{1}%';", "goodsName", filtRiskChar(txtGoodsName.Text.Trim())))
|
|
+ (this.txtcustname.Text.Trim().Length == 0 ? "" : string.Format("{0} like # '%{1}%';", "customerName", filtRiskChar(txtcustname.Text.Trim())))
|
|
+ (this.comPartion.SelectedIndex <= 0 ? "" : string.Format("{0} = #{1};", "part", ((Node)this.comPartion.SelectedItem).ID))
|
|
+ (this.comAssigned.SelectedIndex <= 0 ? "" : this.comAssigned.SelectedIndex == 1 ? "takeBy >0;" : "isnull(takeBy,0) =0;")
|
|
+ (this.txtBatch.Text.Trim().Length == 0 ? "" : string.Format("{0} = # '{1}';", "batch", filtRiskChar(txtBatch.Text.Trim())))
|
|
+ (this.txtSaleNo.Text.Trim().Length == 0 ? "" : string.Format("{0} = # '{1}';", "saleOrder", filtRiskChar(txtSaleNo.Text.Trim())))
|
|
+ (this.txtSkuId.Text.Trim().Length == 0 ? "" : string.Format("{0} =#{1};", "SKUID", filtRiskChar(txtSkuId.Text.Trim())))
|
|
+ (this.txtgoodsId.Text.Trim().Length == 0 ? "" : string.Format("{0} = # '{1}';", WmsGoods.fields.goodsId.ToString(), filtRiskChar(txtgoodsId.Text.Trim())))
|
|
+ (this.txtPickorder.Text.Trim().Length == 0 ? "" : string.Format("{0} = # '{1}';", "pickOrderNo", filtRiskChar(txtPickorder.Text.Trim())))
|
|
+ (this.txtJobNo.Text.Trim().Length == 0 ? "" : string.Format("{0} = # '{1}';", "jobNo", filtRiskChar(txtJobNo.Text.Trim())))
|
|
+ (this.txtPortId.Text.Trim().Length == 0 ? "" : string.Format("{0} = # {1};", "ID", filtRiskChar(txtPortId.Text.Trim())))
|
|
+ (this.chkDiff.Checked ? string.Format("{0} <> #{1};", "count","pickCount" ):"" )
|
|
;
|
|
|
|
bool isQueryNotChanged = lastQuery.Equals(query);
|
|
|
|
|
|
this.pager1.PageCurrent = lastState == state ? 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);
|
|
|
|
DataSet ds = pickClient.getTasks(query, start, end);
|
|
lastState = state ;
|
|
closeClient();
|
|
|
|
|
|
closeClient();
|
|
DtGv = ds.Tables[0];
|
|
addCheckField(DtGv,false);//add checkbox
|
|
|
|
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;
|
|
|
|
// DtGv.PrimaryKey = new DataColumn[] { DtGv.Columns["ID"] };
|
|
|
|
this.gridControl3.DataSource = DtGv.DefaultView;
|
|
gridView3.BestFitColumns();
|
|
// this.gridControl3.DataSource = ds.Tables[0];
|
|
|
|
// initialGridView2Columns(gridView3);
|
|
|
|
closeWaitForm();
|
|
return Convert.ToInt32(ds.Tables[1].Rows[0][0].ToString());
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
showErrorMsg(e,e.Message);
|
|
}
|
|
|
|
closeWaitForm();
|
|
return 0;// lgt.getRowCount(query);
|
|
// return lgt.GetGoodType.QueryCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void bindDetail()
|
|
{
|
|
pager1.Bind();
|
|
}
|
|
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;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void clearInputs()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
bool isDataSourceChanged = false;
|
|
|
|
|
|
private void btnDelete_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
protected void query()
|
|
{
|
|
pager1.Bind(); //loadData();
|
|
}
|
|
|
|
|
|
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,e.Message);
|
|
}
|
|
finally
|
|
{
|
|
// WaitFormService.Close();
|
|
closeWaitForm();
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
private bool getCurrentObject()
|
|
{
|
|
if (selectedRowIndex <0 || selectedRowIndex >= DtGv.Rows.Count)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
// DataRow currentRow = dt.Rows[selectedRowIndex];
|
|
DataRowView dr = (DataRowView)(GetGridViewFilteredAndSortedData(gridView3)[selectedRowIndex]);
|
|
waveNo = dr.Row[1].ToString();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void btnQuery_Click(object sender, EventArgs e)
|
|
{
|
|
queryGoods();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void gridView2_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
|
{
|
|
|
|
|
|
|
|
|
|
if (e.Column.FieldName == WmsOutPickDetail.fields.batchPickState.ToString())
|
|
{
|
|
if (!pickStatus.ContainsValue(e.DisplayText))
|
|
{
|
|
|
|
int display = -100;
|
|
string disTxt = e.DisplayText;
|
|
|
|
try
|
|
{
|
|
display = Convert.ToInt16(e.DisplayText);
|
|
|
|
e.DisplayText = pickStatus[display];
|
|
|
|
}
|
|
catch
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
// e.DisplayText = pickStatus.ContainsKey(display) ? pickStatus[display] : display+"";
|
|
|
|
}else if(e.Column.FieldName == WmsWave.fields.state.ToString()){
|
|
if (!pickOrNot.ContainsValue(e.DisplayText))
|
|
{
|
|
|
|
int display = -100;
|
|
string disTxt = e.DisplayText;
|
|
|
|
try
|
|
{
|
|
display = Convert.ToInt16(e.DisplayText);
|
|
|
|
e.DisplayText = pickOrNot[display];
|
|
|
|
}
|
|
catch
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
// e.DisplayText = pickOrNot.ContainsKey(display) ? pickOrNot[display] : display+"";
|
|
}
|
|
else if (e.Column.FieldName == WmsWave.fields.type.ToString())
|
|
{
|
|
if (!enumStockRecordtype.ContainsValue(e.DisplayText))
|
|
{
|
|
|
|
int display = -100;
|
|
string disTxt = e.DisplayText;
|
|
|
|
try
|
|
{
|
|
display = Convert.ToInt16(e.DisplayText);
|
|
|
|
e.DisplayText = enumStockRecordtype[display];
|
|
|
|
}
|
|
catch
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
// e.DisplayText = pickOrNot.ContainsKey(display) ? pickOrNot[display] : display+"";
|
|
}
|
|
else if (e.Column.FieldName.ToLower().Contains("time"))
|
|
{
|
|
e.Column.DisplayFormat.FormatString = "yyyy-MM-dd HH:mm:ss";
|
|
}
|
|
else if (e.Column.FieldName == "productDate" || e.Column.FieldName == "validDate")
|
|
{
|
|
e.Column.DisplayFormat.FormatString = "yyyy-MM-dd HH:mm:ss";
|
|
}
|
|
else if (e.Column.FieldName == "createtime")
|
|
{
|
|
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 == "state")
|
|
{
|
|
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;}
|
|
string state = "";
|
|
bool isGray = false;
|
|
bool isAlert = false;
|
|
|
|
if (currentView == gridView3)
|
|
{
|
|
state = currentView.GetDataRow(e.RowHandle)["state"].ToString().Trim();
|
|
|
|
|
|
isGray = Convert.ToInt16(state) == (int)enumPickState.已拣;
|
|
|
|
// isAlert = Convert.ToInt16(state) == (int)enumLabelPickState.notPicked;
|
|
}
|
|
else
|
|
{
|
|
state = currentView.GetDataRow(e.RowHandle)["batchPickState"].ToString().Trim();
|
|
isGray = Convert.ToInt16(state) == (int)enumOutStockPickStatus.正在分拣;
|
|
isAlert = Convert.ToInt16(state) == (int)enumOutStockPickStatus.复核异常;
|
|
}
|
|
/*
|
|
state = currentView.GetDataRow(e.RowHandle)["batchPickState"].ToString().Trim();
|
|
isGray = Convert.ToInt16(state) == (int)enumOutStockPickStatus.正在分拣;
|
|
isAlert = Convert.ToInt16(state) == (int)enumOutStockPickStatus.复核异常;
|
|
*/
|
|
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 (isGray)
|
|
{
|
|
rowStyle = isFocused ? passedFocus : passed;
|
|
}
|
|
else if (isAlert)
|
|
{
|
|
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 int setCurrentRequestDetail()
|
|
{
|
|
|
|
if (!getCurrentObject() || String.IsNullOrEmpty(waveNo))
|
|
{
|
|
this.gridControl3.DataSource = null;
|
|
return 0;
|
|
}
|
|
/// gridView1.FocusedRowHandle = selectedRowIndex;//
|
|
// gridView1.SelectRow(selectedRowIndex);
|
|
showWaitForm();
|
|
|
|
try
|
|
{
|
|
this.pager1.PageCurrent = lastWaveNo == waveNo ? 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);
|
|
lastWaveNo = waveNo;
|
|
DataSet ds = pickClient.getTasks(waveNo, start, end);
|
|
closeClient();
|
|
this.gridControl3.DataSource = ds.Tables[0];
|
|
initialGridView2Columns(gridView3);
|
|
// gridView1.Focus();
|
|
// this.selectedInvalidIndex = -1;
|
|
closeWaitForm();
|
|
return Convert.ToInt16( ds.Tables[1].Rows[0][0].ToString());
|
|
|
|
}
|
|
catch (Exception e)
|
|
{ closeWaitForm();
|
|
showErrorMsg(e.Message);
|
|
}
|
|
|
|
return 1;
|
|
}
|
|
|
|
private void btnOut_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
showWaitForm();
|
|
try
|
|
{
|
|
|
|
if (String.IsNullOrEmpty(waveNo))//&& selectedRequest.batchPickState == (int)enumOutStockPickStatus.待处理)
|
|
{
|
|
pickClient.startBatchPick(waveNo); //startPickBatchPickOrder(selectedRequest.pickOrderNo);
|
|
closeClient();
|
|
}
|
|
else
|
|
{
|
|
// showErrorMsg(string.Format("出库异常,当前出库单状态是{0}",
|
|
// Enum.GetName(typeof(enumOutStockPickStatus), selectedRequest.batchPickState) ));
|
|
}
|
|
|
|
|
|
// reqportPrint.printStockOutCode(pickClient.getPickOrderTmsInfo(selectedRequest.pickOrderNo));
|
|
|
|
// reqportPrint.printStockOutA4(pickClient.getBatchOutPickOrderPickDetails(selectedRequest.pickOrderNo));
|
|
closeClient();
|
|
|
|
query();
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
bindDetail();// setCurrentRequestDetail();
|
|
showErrorMsg(er,er.Message);
|
|
closeClient();
|
|
}
|
|
|
|
|
|
|
|
|
|
closeWaitForm();
|
|
}
|
|
|
|
private void btnPrint_Click(object sender, EventArgs e)
|
|
{
|
|
if (string.IsNullOrEmpty(waveNo))
|
|
{
|
|
showErrorMsg("请选择波次记录");
|
|
return;
|
|
}
|
|
try
|
|
{
|
|
// reqportPrint.printStockOutCode(pickClient.getPickOrderTmsInfo("PICK060000026285"));
|
|
reqportPrint.printStockOutCode(pickClient.getPickVolInfo(waveNo, (int)enumWhLocVol.小整),false); closeClient();
|
|
reqportPrint.printStockOutCode(pickClient.getPickVolInfo(waveNo, (int)enumWhLocVol.中整),false); closeClient();
|
|
reqportPrint.printStockOutCode(pickClient.getPickVolInfo(waveNo, (int)enumWhLocVol.大整),false); closeClient();
|
|
|
|
reqportPrint.printStockOutCode(pickClient.getPickSummary(waveNo, (int)enumWhLocVol.零库),false); closeClient();
|
|
|
|
|
|
|
|
closeClient();
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
showErrorMsg(er, er.Message);
|
|
closeClient();
|
|
}
|
|
|
|
}
|
|
|
|
private void btnPrintReport_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
// reqportPrint.printStockOutA4(pickClient.getBatchOutPickOrderPickDetails(selectedRequest.pickOrderNo));
|
|
// closeClient();
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
showErrorMsg(er, er.Message);
|
|
closeClient();
|
|
}
|
|
}
|
|
|
|
private void btnOutStockAll_Click(object sender, EventArgs e)
|
|
{
|
|
showWaitForm();
|
|
foreach (DataRow dr in DtGv.Rows)
|
|
{
|
|
WmsInRequest wi = new WmsInRequest(dr);
|
|
|
|
try
|
|
{
|
|
//lgt.requestInStock(wi);
|
|
// pickClient.requestInStock(wi.orderNo);
|
|
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
|
|
showErrorMsg(er.Message);
|
|
}
|
|
|
|
}
|
|
|
|
query();
|
|
|
|
|
|
}
|
|
|
|
private void GoodsInForm_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
|
|
closeClient();
|
|
closeChannelLight();
|
|
lightControl.exit_wms_sys();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void btnForceClose_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
// if (pickClient.completeBatchOut(this.selectedRequest.pickOrderNo))
|
|
{
|
|
// MessageBox.Show("出库成功");
|
|
}
|
|
// else
|
|
{
|
|
// showErrorMsg("出库失败");
|
|
}
|
|
// closeClient();
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
showErrorMsg(er.Message);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void btnPickOrders_Click(object sender, EventArgs e)
|
|
{
|
|
loadData();
|
|
}
|
|
|
|
|
|
|
|
|
|
dnwms lightControl = new dnwms();
|
|
private void initialChannelLight()
|
|
{
|
|
lightControl.check_state = true;
|
|
lightControl.on_config_channel += new dnwms.config_channel(aa_on_config_channel);
|
|
lightControl.on_close_channel += new dnwms.close_channel(aa_on_close_channel);
|
|
lightControl.on_open_channel += new dnwms.open_channel(openChannelLightResult);
|
|
lightControl.on_dis_event += new dnwms.receive_dis_data(aa_on_receidata_channel);
|
|
// getLightId();
|
|
}
|
|
|
|
private void openChannelLight()
|
|
{
|
|
Model.open_channel_led id;
|
|
id.channel_id = lightId;
|
|
//id.config_word = led_rgb;
|
|
id.state = 1;
|
|
lightControl.write_open_channel_led(id);//write_config_channel_led
|
|
}
|
|
|
|
private void closeChannelLight()
|
|
{
|
|
Model.close_channel_led id;
|
|
id.channel_id =lightId;
|
|
//id.config_word = led_rgb;
|
|
|
|
id.state = 1;
|
|
lightControl.write_close_channel_led(id);//write_config_channel_led
|
|
}
|
|
|
|
private void openChannelLightResult( Model.open_channel_led data)
|
|
{
|
|
// MessageBox.Show("打开通道灯 成功");
|
|
}
|
|
void aa_on_close_channel(Model.close_channel_led data)
|
|
{
|
|
// MessageBox.Show("关闭通道灯 成功");
|
|
//throw new NotImplementedException();
|
|
}
|
|
void aa_on_config_channel(Model.config_channel_led data)
|
|
{
|
|
// MessageBox.Show("配置 id = " + data.channel_id.ToString() + "配置字 = " + data.config_word.ToString() + " 成功 ");
|
|
//throw new NotImplementedException();
|
|
}
|
|
void aa_on_receidata_channel(Model.uart_dis_data[] dis_data)
|
|
{
|
|
// MessageBox.Show("配置 id = " + data.channel_id.ToString() + "配置字 = " + data.config_word.ToString() + " 成功 ");
|
|
//throw new NotImplementedException();
|
|
}
|
|
|
|
List<int> lights = new List<int>();
|
|
void searchLight()
|
|
{
|
|
Model.modify_id id;
|
|
|
|
System.Threading.Thread.Sleep(50);
|
|
for (int i = 5000; i <= 5100; i++)
|
|
{
|
|
id.order = 0;
|
|
id.new_ele_id = 0;
|
|
id.old_ele_id = i;
|
|
id.state = 1;
|
|
bool ret = lightControl.search_light_id(id);
|
|
if (ret)
|
|
{
|
|
//textBox6.Text = textBox6.Text + "搜索到通道灯:" + i.ToString() + "\r\n";
|
|
//this.textBox6.Focus();//获取焦点
|
|
//this.textBox6.Select(this.textBox6.TextLength, 0);//光标定位到文本最后
|
|
//this.textBox6.ScrollToCaret();//滚动到光标处
|
|
lights.Add(i);
|
|
break;
|
|
// System.Threading.Thread.Sleep(50);
|
|
}
|
|
}
|
|
}
|
|
void getLightId()
|
|
{
|
|
for (int i = 0; i < 10; i++)//init com0-10
|
|
{
|
|
comId = Convert.ToByte(i);
|
|
|
|
if (lightControl.init_wms_sys(comId))
|
|
{
|
|
lights.Clear();
|
|
searchLight();
|
|
if (lights.Count > 0)
|
|
{
|
|
lightId = lights[0];
|
|
break;
|
|
}
|
|
}
|
|
System.Threading.Thread.Sleep(10);
|
|
}
|
|
// lbLightsInfo.Text = "";
|
|
if (lightId == 0)
|
|
{
|
|
// lbLightsInfo.Text = "没找到出库指示灯,请确认出库灯正确连接并工作正常";
|
|
// MessageBox.Show("没找到出库指示灯,请确认出库灯正确连接并工作正常");
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private void updateLightColor(bool isAlert)
|
|
{
|
|
Model.config_channel_led id;
|
|
// byte led_rgb = 0;
|
|
|
|
byte blue = 2;
|
|
byte red = 0;
|
|
|
|
id.channel_id = Convert.ToInt16(5000);
|
|
id.config_word = isAlert ? red : blue;// led_rgb;
|
|
id.state = 1;
|
|
this.lightControl .write_config_channel_led(id);//write_config_channel_led
|
|
}
|
|
|
|
|
|
void setRule()
|
|
{
|
|
|
|
// waveRule.lineId = comboLines.SelectedIndex <= 0 ? -1 : ((Node)comboLines.SelectedItem).ID;
|
|
// waveRule.sales = comboSales.SelectedIndex <= 0 ? "" : comboSales.Text;
|
|
|
|
try
|
|
{
|
|
// pickClient.updateWaveRule(waveRule);
|
|
// closeClient();
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
showErrorMsg(e, "出错了");
|
|
|
|
}
|
|
finally
|
|
{
|
|
closeClient();
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
private void comboLines_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
setRule();
|
|
}
|
|
|
|
private void comboSales_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
setRule();
|
|
}
|
|
|
|
private void simpleButton2_Click(object sender, EventArgs e)
|
|
{
|
|
// showWaitForm();
|
|
// pickClient.createPDATasks();
|
|
// bool res= pickClient.createPickWaves();
|
|
// MessageBox.Show(" create wave "+res);
|
|
// closeClient();
|
|
// closeWaitForm();
|
|
// loadData();
|
|
}
|
|
|
|
|
|
private void btnDel_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void barButtonItem1_ItemClick(object sender, ItemClickEventArgs e)
|
|
{
|
|
this.exportExcel(this.gridView3);
|
|
}
|
|
|
|
private void simpleButton1_Click(object sender, EventArgs e)
|
|
{
|
|
//
|
|
|
|
if (!checkPermission(WmsConstants.SPECIAL_VALID_REASSIN_TASK_BY_ID))
|
|
{
|
|
showErrorMsg("权限不足");
|
|
return;
|
|
}
|
|
|
|
if (em.ID == 0)
|
|
{
|
|
getUserInfo();
|
|
|
|
if(em.ID == 0)
|
|
{
|
|
showErrorMsg("请输入正确的员工名称。");
|
|
return;
|
|
}
|
|
|
|
}
|
|
|
|
if (getCurrentObjects())
|
|
{
|
|
showWaitForm();
|
|
try
|
|
{
|
|
string empId = em.ID +"";// txtEmpId.Text;
|
|
|
|
MessageBox.Show(pickClient.assignTasks(selectedIds.ToArray(), Convert.ToInt32(empId)));
|
|
query();
|
|
|
|
|
|
//closeClient();;
|
|
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
closeWaitForm();
|
|
showErrorMsg(er.Message);
|
|
}
|
|
finally
|
|
{
|
|
closeClient(); ;
|
|
closeWaitForm();
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
private List<int> selectedIds;
|
|
private bool getSelectedLocations()
|
|
{
|
|
selectedIds = new List<int>();
|
|
foreach (DataRow dr in DtGv.Rows)
|
|
{
|
|
string v = dr[CheckBoxField].ToString();
|
|
bool b = String.IsNullOrEmpty(v) ? false : Convert.ToBoolean(v);
|
|
if (b)
|
|
{
|
|
selectedIds.Add(Convert.ToInt32(dr["ID"].ToString()));
|
|
}
|
|
}
|
|
if (selectedIds.Count == 0)
|
|
{
|
|
showErrorMsg("请至少选择一条数据");
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
private bool getCurrentObjects()
|
|
{
|
|
|
|
if (!getSelectedLocations())
|
|
{
|
|
return false;
|
|
}
|
|
|
|
|
|
DialogResult r = MessageBox.Show(string.Format("确定要分配选中的{0}条任务信息吗?", selectedIds.Count), "确认分配", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
|
|
|
return r == DialogResult.Yes;
|
|
|
|
|
|
}
|
|
|
|
Employee em = new Employee();
|
|
private void txtEmpId_KeyUp(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
|
|
|
|
getUserInfo();
|
|
|
|
}
|
|
}
|
|
|
|
void getUserInfo()
|
|
{
|
|
|
|
if (txtEmpId.Text.Trim().Length <1)
|
|
{
|
|
return;
|
|
}
|
|
showWaitForm();
|
|
|
|
em = new Employee();
|
|
|
|
try
|
|
{
|
|
using (ServiceLogin.LoginClient client = new ServiceLogin.LoginClient("BasicHttpBinding_ILogin",
|
|
string.Format("http://{0}/{1}", Park.svrUrl, "Login.svc")))
|
|
{
|
|
DataTable dt = client.getUserInfo(filtRiskChar(txtEmpId.Text.Trim()));
|
|
if (dt.Rows.Count > 0)
|
|
{
|
|
|
|
em.ID = Convert.ToInt32(dt.Rows[0]["id"].ToString());
|
|
em.em_account = dt.Rows[0]["em_account"].ToString();
|
|
em.em_name = dt.Rows[0]["em_name"].ToString();
|
|
}
|
|
}
|
|
|
|
}
|
|
catch (Exception er)
|
|
{
|
|
closeWaitForm();
|
|
showErrorMsg(er);
|
|
}
|
|
closeWaitForm();
|
|
lbemp.Text = em.em_account;
|
|
}
|
|
|
|
private void btnQ_Click(object sender, EventArgs e)
|
|
{
|
|
query();
|
|
}
|
|
|
|
private void btnWaveStart_Click(object sender, EventArgs e)
|
|
{
|
|
WcfWaveRule waveRule = new WcfWaveRule();
|
|
|
|
waveRule.ID= ((Colitem) comWaveRule.SelectedItem).key;
|
|
|
|
waveRule.type = (int)enumWaveRuleType.普通波次;
|
|
waveRule.interval =(int) spinWave.Value;
|
|
|
|
if (waveRule.ID > 0)
|
|
{
|
|
|
|
bool rs = wrClient.setRule(waveRule);
|
|
bool a = rs;
|
|
}
|
|
else
|
|
{
|
|
showErrorMsg("请选择波次规则");
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
} |