858 lines
29 KiB
C#
858 lines
29 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Drawing;
|
||
using System.Windows.Forms;
|
||
using WMS.Frm.Base;
|
||
using WMS.Common;
|
||
|
||
using WMS.Model.Base;
|
||
using WMS.Model.CK;
|
||
using WMS.Model.Stock;
|
||
|
||
using DevExpress.XtraEditors.Repository;
|
||
using DevExpress.XtraReports.UI;
|
||
using WMS.Ctrl;
|
||
using WMS.FrmBaseData;
|
||
using System.Threading;
|
||
using WMS.Model.SystemManage;
|
||
using WMS.Business;
|
||
using WMS.Business.Common;
|
||
using WMS.Business.CK;
|
||
using WMS.Business.Stock;
|
||
using WMS.Business.Base;
|
||
|
||
namespace WMS.FrmCK
|
||
{
|
||
public partial class FrmPickingWave : FormBase
|
||
{
|
||
#region 变量
|
||
|
||
public string OPERATOR_MAN = string.Empty;
|
||
public List<OrdersModel> listOrders = new List<OrdersModel>();//勾选的出库通知单编号集合
|
||
|
||
private PickingWaveModel pickingWaveModel = new PickingWaveModel();//当前选择的拣货单
|
||
private PickingWaveGoodsModel pickingWaveGoodsModel = new PickingWaveGoodsModel();//当前选择的拣货单
|
||
private List<PickingWaveModel> listPicking = new List<PickingWaveModel>();//拣货单集合
|
||
private List<PickingWaveGoodsModel> listPickingGoods = new List<PickingWaveGoodsModel>();//拣货商
|
||
|
||
private List<MIStockModel> listMIStock = new List<MIStockModel>();//某库区库存集合
|
||
private DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit lueUnits = new RepositoryItemLookUpEdit();
|
||
private int flag = -1;//0:增加;1:修改
|
||
#endregion
|
||
|
||
#region 初始化
|
||
|
||
/// <summary>
|
||
/// 无参构造
|
||
/// </summary>
|
||
public FrmPickingWave()
|
||
{
|
||
InitializeComponent();
|
||
|
||
lueArea.LoadData();//库区
|
||
|
||
lueStorage.LoadData();//仓库
|
||
|
||
//库位下拉框
|
||
lueLoc.NullText = "";
|
||
lueLoc.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("LOCATION_ID", "库位"));
|
||
lueLoc.ValueMember = "LOCATION_ID";
|
||
lueLoc.DisplayMember = "LOCATION_ID";
|
||
|
||
|
||
|
||
//单位下拉框
|
||
lueUnit.NullText = "";
|
||
lueUnit.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("VC_DICTIONARY_NAME", "单位"));
|
||
lueUnit.ValueMember = "VC_CHAR_VALUE";
|
||
lueUnit.DisplayMember = "VC_DICTIONARY_NAME";
|
||
DataTable strResult = new DataTable();
|
||
try
|
||
{
|
||
strResult = IBussFactory<BussCommon>.Instance().GetCustomCtrlData("t_sys_dictionary_tab", "VC_CHAR_VALUE", "VC_DICTIONARY_NAME", " VC_DICTIONARY_TYPE = 'vc_uom' and c_flag = '1'", "");
|
||
}
|
||
catch (Exception)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
||
}
|
||
lueUnit.DataSource = strResult;
|
||
|
||
//lueUnits.NullText = "";
|
||
//lueUnits.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("UNIT_NAME", "单位"));
|
||
//lueUnits.Properties.ValueMember = "UNIT";
|
||
//lueUnits.Properties.DisplayMember = "UNIT_NAME";
|
||
|
||
// dicMove.selSql = string.Format(@"select a.TEAM_NAME,t.USER_ID,b.NAME
|
||
// from T_SYS_TEAMUSER t
|
||
// LEFT JOIN T_SYS_TEAM a ON t.TEAM_ID = a.TEAM_ID
|
||
// LEFT JOIN T_BASE_USERINFO b ON b.USER_ID = t.USER_ID
|
||
// order by t.TEAM_ID");
|
||
}
|
||
|
||
|
||
public void FrmPickingWave_Load(object sender, EventArgs e)
|
||
{
|
||
|
||
if (listOrders.Count == 0)
|
||
{
|
||
bindGrid(null);//显示拣货单
|
||
bsScan.DataSource = listScanInfo;
|
||
}
|
||
FrmSelectModle = new PickingWaveModel();//通用查询
|
||
|
||
}
|
||
#endregion
|
||
|
||
#region 绑定数据
|
||
|
||
/// <summary>
|
||
/// 绑定库存
|
||
/// </summary>
|
||
private void bindMIStock() {
|
||
string errText = string.Empty;
|
||
MIStockModel queryMI = new MIStockModel();
|
||
queryMI.STORAGE_ID = pickingWaveModel.STORAGE_ID;
|
||
queryMI.AREA_ID = pickingWaveModel.AREA_ID;
|
||
string strResult = string.Empty;
|
||
try
|
||
{
|
||
listMIStock = IBussFactory<BussMIStock>.Instance().GetMIStockList(queryMI);
|
||
}
|
||
catch (Exception)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
||
}
|
||
if (errText == string.Empty)
|
||
{
|
||
if (strResult != null)
|
||
{
|
||
listMIStock.RemoveAll(p=>p.SHELVES_NUM == 0);
|
||
}
|
||
else
|
||
{
|
||
listMIStock = new List<MIStockModel>();
|
||
}
|
||
////根据库位 商品 汇总库存
|
||
//List<MIStockModel> newList = new List<MIStockModel>();
|
||
//foreach (var item in listMIStock)
|
||
//{
|
||
// if (newList.Exists(p => p.LOCATION_ID == item.LOCATION_ID && p.GOODS_ID == item.GOODS_ID))
|
||
// {
|
||
// MIStockModel tempModel = newList.Find(p => p.LOCATION_ID == item.LOCATION_ID && p.GOODS_ID == item.GOODS_ID);
|
||
// tempModel.ABLE_NUM += item.ABLE_NUM;
|
||
// }
|
||
// else
|
||
// {
|
||
// newList.Add(item);
|
||
// }
|
||
//}
|
||
//listMIStock.Clear();
|
||
//listMIStock.AddRange(newList);
|
||
}
|
||
else
|
||
{
|
||
SystemCommon.ShowInfoMessageBox(errText);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// 绑定数据
|
||
/// </summary>
|
||
private void bindGrid(List<PickingWaveModel> list)
|
||
{
|
||
|
||
|
||
if (frmButtonItem.ContainsKey("Save")) { frmButtonItem["Save"].Enabled = false; }
|
||
|
||
if (frmButtonItem.ContainsKey("Del")) { frmButtonItem["Del"].Enabled = false; }
|
||
|
||
if (list == null)
|
||
{
|
||
string errText = string.Empty;
|
||
listPicking = IBussFactory<BussPickingWave>.Instance().GetPickingWaveList(pickingWaveModel);
|
||
if(listPicking!=null)
|
||
{
|
||
bsPickingWave.DataSource = listPicking;
|
||
if(listPicking.Count>0)
|
||
{
|
||
string pickId = listPicking[0].PICKINGID;
|
||
BindPickData(pickId);
|
||
}
|
||
|
||
}
|
||
|
||
}
|
||
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// 单位、重量单位的显示
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void GVPickingWaveGoods_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
||
{
|
||
if (e.Column.FieldName == "UNIT")
|
||
{
|
||
if (e.Value != null)
|
||
{
|
||
switch (e.Value.ToString().Trim())
|
||
{
|
||
case "a":
|
||
e.DisplayText = "盒";
|
||
break;
|
||
case "b":
|
||
e.DisplayText = "罐";
|
||
break;
|
||
case "c":
|
||
e.DisplayText = "袋";
|
||
break;
|
||
case "d":
|
||
e.DisplayText = "瓶";
|
||
break;
|
||
case "e":
|
||
e.DisplayText = "个";
|
||
break;
|
||
case "f":
|
||
e.DisplayText = "包";
|
||
break;
|
||
case "g":
|
||
e.DisplayText = "把";
|
||
break;
|
||
case "h":
|
||
e.DisplayText = "筒";
|
||
break;
|
||
case "i":
|
||
e.DisplayText = "张";
|
||
break;
|
||
case "j":
|
||
e.DisplayText = "套";
|
||
break;
|
||
case "k":
|
||
e.DisplayText = "克";
|
||
break;
|
||
case "l":
|
||
e.DisplayText = "泡";
|
||
break;
|
||
case "m":
|
||
e.DisplayText = "片";
|
||
break;
|
||
case "z":
|
||
e.DisplayText = "箱";
|
||
break;
|
||
default:
|
||
e.DisplayText = "";
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
if (e.Column.FieldName == "SCALE_UNIT")
|
||
{
|
||
if (e.Value != null)
|
||
{
|
||
switch (e.Value.ToString().Trim())
|
||
{
|
||
case "0":
|
||
e.DisplayText = "克";
|
||
break;
|
||
case "1":
|
||
e.DisplayText = "斤";
|
||
break;
|
||
case "2":
|
||
e.DisplayText = "吨";
|
||
break;
|
||
default:
|
||
e.DisplayText = "";
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 条件查询
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
public override void Search()
|
||
{
|
||
|
||
|
||
bindGrid(null);
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// Tab页改,改通用查询Model
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void xtraTabControl1_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e)
|
||
{
|
||
if (flag == 0 || flag == 1)
|
||
{
|
||
if (frmButtonItem.ContainsKey("Del")) { frmButtonItem["Del"].Enabled = false; }
|
||
|
||
}
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// 通用查询
|
||
/// </summary>
|
||
/// <param name="table"></param>
|
||
public override void LoadListData(DataTable table)
|
||
{
|
||
|
||
listPicking = ConvertHelper<PickingWaveModel>.ConvertToList(table);
|
||
bsPickingWave.DataSource = listPicking;
|
||
GVPickingWave.RefreshData();
|
||
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region 按钮事件
|
||
|
||
/// <summary>
|
||
/// 编辑按钮
|
||
/// </summary>
|
||
public override void Edit()
|
||
{
|
||
if (!frmButtonItem.ContainsKey("Edit"))
|
||
{
|
||
return;
|
||
}
|
||
else if (frmButtonItem["Edit"].Enabled == false)
|
||
{
|
||
return;
|
||
}
|
||
|
||
|
||
|
||
flag = 1;//标识修改
|
||
//GVPickingWaveGoods.OptionsBehavior.Editable = true;//明细可编辑
|
||
//colLOC_ID1.OptionsColumn.AllowEdit = true;
|
||
colGOODS_NUM1.OptionsColumn.AllowEdit = true;
|
||
|
||
|
||
lueStorage.Enabled = false;
|
||
lueArea.Enabled = false;
|
||
|
||
if (frmButtonItem.ContainsKey("Search")) { frmButtonItem["Search"].Enabled = false; }
|
||
|
||
if (frmButtonItem.ContainsKey("Print")) { frmButtonItem["Print"].Enabled = false; }
|
||
if (frmButtonItem.ContainsKey("Edit")) { frmButtonItem["Edit"].Enabled = false; }
|
||
if (frmButtonItem.ContainsKey("Finish")) { frmButtonItem["Finish"].Enabled = false; }
|
||
if (frmButtonItem.ContainsKey("Close")) { frmButtonItem["Close"].Enabled = false; }
|
||
if (frmButtonItem.ContainsKey("Confirm")) { frmButtonItem["Confirm"].Enabled = false; }
|
||
if (frmButtonItem.ContainsKey("Clear")) { frmButtonItem["Clear"].Enabled = false; }
|
||
if (frmButtonItem.ContainsKey("Save")) { frmButtonItem["Save"].Enabled = true; }
|
||
if (frmButtonItem.ContainsKey("Remark")) { frmButtonItem["Remark"].Enabled = true; }
|
||
if (frmButtonItem.ContainsKey("ChooseGoods")) { frmButtonItem["ChooseGoods"].Enabled = true; }
|
||
|
||
xtraTabControl1_SelectedPageChanged(null,null);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 刷新按钮
|
||
/// </summary>
|
||
public override void Refresh()
|
||
{
|
||
if (frmButtonItem.ContainsKey("Save") && frmButtonItem["Save"].Enabled == true && DialogResult.Yes != SystemCommon.ShowMessageBoxResult("确定放弃正在编辑的数据?"))
|
||
{
|
||
return;
|
||
}
|
||
flag = -1;//标识为非增加非修改
|
||
|
||
//ctrlDicGoods.SqlStr = "where 0 = 1";
|
||
|
||
string ID = string.Empty;
|
||
ID = pickingWaveModel.PICKINGID;
|
||
|
||
|
||
|
||
pickingWaveModel = new PickingWaveModel();
|
||
bindGrid(null);//刷新数据
|
||
|
||
foreach (Control item in panelControl1.Controls)
|
||
{
|
||
item.Enabled = true;
|
||
}
|
||
|
||
colGOODS_NUM1.OptionsColumn.AllowEdit = false;
|
||
colGOODS_NUM1.OptionsColumn.AllowEdit = true;
|
||
|
||
if (frmButtonItem.ContainsKey("Search")) { frmButtonItem["Search"].Enabled = true; }
|
||
|
||
if (frmButtonItem.ContainsKey("Print")) { frmButtonItem["Print"].Enabled = true; }
|
||
if (frmButtonItem.ContainsKey("Edit")) { frmButtonItem["Edit"].Enabled = true; }
|
||
if (frmButtonItem.ContainsKey("ChooseGoods")) { frmButtonItem["ChooseGoods"].Enabled = false; }
|
||
if (frmButtonItem.ContainsKey("Finish")) { frmButtonItem["Finish"].Enabled = true; }
|
||
if (frmButtonItem.ContainsKey("Close")) { frmButtonItem["Close"].Enabled = true; }
|
||
if (frmButtonItem.ContainsKey("Confirm")) { frmButtonItem["Confirm"].Enabled = true; }
|
||
if (frmButtonItem.ContainsKey("Clear")) { frmButtonItem["Clear"].Enabled = true; }
|
||
|
||
GVPickingWave.Appearance.Row.BackColor = Color.White;
|
||
GVPickingWave.Appearance.EvenRow.BackColor = Color.White;
|
||
|
||
GVPickingWave.FocusedRowHandle = listPicking.FindIndex(p => p.PICKINGID == ID);
|
||
|
||
}
|
||
|
||
|
||
|
||
/// <summary>
|
||
/// 保存
|
||
/// </summary>
|
||
public override void Save()
|
||
{
|
||
|
||
|
||
/*验证*/
|
||
if (string.IsNullOrEmpty(lueStorage.Text))
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("请选择仓库");
|
||
|
||
lueStorage.Focus();
|
||
return;
|
||
}
|
||
if (string.IsNullOrEmpty(lueArea.Text))
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("请选择库区");
|
||
|
||
lueArea.Focus();
|
||
return;
|
||
}
|
||
|
||
|
||
string errText = string.Empty;
|
||
try
|
||
{
|
||
|
||
IBussFactory<BussPickingWave>.Instance().UpdatePickEnd(pickingWaveModel.PICKINGID, listPickingGoods, "3");
|
||
}
|
||
catch (Exception)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
||
|
||
}
|
||
|
||
if (string.IsNullOrEmpty(errText))//如果修改成功
|
||
{
|
||
|
||
colGOODS_NUM1.OptionsColumn.AllowEdit = false;
|
||
if (frmButtonItem.ContainsKey("Save")) { frmButtonItem["Save"].Enabled = false; }
|
||
Refresh();
|
||
SystemCommon.ShowInfoMessageBox("修改成功");
|
||
}
|
||
else
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("修改失败" + errText);
|
||
|
||
}
|
||
|
||
}
|
||
|
||
/// <summary>
|
||
/// 关闭按钮,关闭一条拣货单
|
||
/// </summary>
|
||
public void Close()
|
||
{
|
||
if (GVPickingWave.SelectedRowsCount > 0)
|
||
{
|
||
if (DialogResult.Yes == SystemCommon.ShowMessageBoxResult("确定关闭"))
|
||
{
|
||
//pickingWaveModel.STATE = "3";
|
||
//string strPickingWaveModel = Newtonsoft.Json.JsonConvert.SerializeObject(pickingWaveModel);//model转string
|
||
string errText = string.Empty;
|
||
|
||
try
|
||
{
|
||
//errText = WebLockConfig.Instance.WebPickingWave.MovePickingWaveAndTabIntoBack(pickingWaveModel.PICKINGID);
|
||
}
|
||
catch (Exception)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
||
return;
|
||
}
|
||
if (!string.IsNullOrEmpty(errText))
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("关闭失败" + errText);
|
||
return;
|
||
}
|
||
else
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("关闭成功" + errText);
|
||
Refresh();//刷新
|
||
}
|
||
|
||
}
|
||
}
|
||
else
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("您未选择拣货单");
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除按钮,删除一条拣货单明细
|
||
/// </summary>
|
||
public override void Del()
|
||
{
|
||
if (GVPickingWaveGoods.SelectedRowsCount > 0)
|
||
{
|
||
if (DialogResult.Yes == SystemCommon.ShowMessageBoxResult("确定删除"))
|
||
{
|
||
PickingWaveGoodsModel model = new PickingWaveGoodsModel();
|
||
model = GVPickingWaveGoods.GetFocusedRow() as PickingWaveGoodsModel;
|
||
listPickingGoods.Remove(model);
|
||
|
||
bsPickingWaveGoods.DataSource = listPickingGoods;
|
||
GVPickingWaveGoods.RefreshData();
|
||
}
|
||
}
|
||
else
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("您未选择拣货单明细");
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 清空按钮
|
||
/// </summary>
|
||
public override void Clear()
|
||
{
|
||
|
||
|
||
dicMove.TextBoxFlag = null;
|
||
dicMove.TextBoxValue = null;
|
||
|
||
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
#endregion
|
||
|
||
#region 改变仓库 库区变 库区变后 商品列表变、 新库位变
|
||
/// <summary>
|
||
/// 改变仓库后 库区只显示该仓库的所有库区
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void lueStorage_EditValueChanged(object sender, EventArgs e)
|
||
{
|
||
if (lueStorage.Text != null && !string.IsNullOrEmpty(lueStorage.Text.ToString()))
|
||
{
|
||
//绑定库区数据
|
||
string errText = string.Empty;
|
||
|
||
StorageAreaModel storageAreaModel = new StorageAreaModel();
|
||
storageAreaModel.STORAGE_ID = lueStorage.Text.ToString();
|
||
|
||
|
||
|
||
|
||
try
|
||
{
|
||
List<StorageAreaModel> strResult = IBussFactory<BussStorageArea>.Instance().GetAreaInfoDS(storageAreaModel);
|
||
lueArea.Properties.DataSource = strResult;
|
||
}
|
||
catch (Exception)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
||
}
|
||
|
||
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
#endregion
|
||
|
||
private decimal miStockNum = 0;//记录原拣货数量
|
||
private string loc = string.Empty;//记录原库位
|
||
//private string unit = string.Empty;//记录原单位
|
||
/// <summary>
|
||
/// 库位或拣货数量改变 判断拣货数量是否超出
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void GVPickingWaveGoods_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
|
||
{
|
||
if (e.RowHandle < 0)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if (e.Column.Name == "colGOODS_NUM1")
|
||
{
|
||
decimal mistock_num = Convert.ToDecimal(GVPickingWaveGoods.GetFocusedRowCellValue("MISTOCK_NUM"));
|
||
if (Convert.ToDecimal(GVPickingWaveGoods.GetFocusedRowCellValue("GOODS_NUM")) > mistock_num)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("当前库位本批次库存数不满足");
|
||
GVPickingWaveGoods.SetFocusedRowCellValue("GOODS_NUM", miStockNum);
|
||
}
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 拣货数量改变前
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
private void GVPickingWaveGoods_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
|
||
{
|
||
if (GVPickingWaveGoods.GetFocusedRowCellValue("GOODS_NUM") != null) {
|
||
miStockNum = Convert.ToDecimal(GVPickingWaveGoods.GetFocusedRowCellValue("GOODS_NUM"));
|
||
}
|
||
if (GVPickingWaveGoods.GetFocusedRowCellValue("LOC_ID") != null)
|
||
{
|
||
loc = GVPickingWaveGoods.GetFocusedRowCellValue("LOC_ID").ToString();
|
||
}
|
||
|
||
}
|
||
/// <summary>
|
||
/// 打印拣货单
|
||
/// </summary>
|
||
public void PrintJH()
|
||
{
|
||
if (GVPickingWave.RowCount == 0)
|
||
{
|
||
return;
|
||
}
|
||
if (GVPickingWave.FocusedRowHandle < 0)
|
||
{
|
||
return;
|
||
}
|
||
try
|
||
{
|
||
IBussFactory<BussPickingWave>.Instance().UpdatePickingWave(pickingWaveModel.PICKINGID, "1");
|
||
}
|
||
catch (Exception)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 打印出库单
|
||
/// </summary>
|
||
public override void Print() {
|
||
|
||
if(GVPickingWave.RowCount==0)
|
||
{
|
||
return;
|
||
}
|
||
if(GVPickingWave.FocusedRowHandle<0)
|
||
{
|
||
return;
|
||
}
|
||
if(pickingWaveModel.STATUS!="3")
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("单据状态不正常,请先保存");
|
||
return;
|
||
}
|
||
|
||
try
|
||
{
|
||
IBussFactory<BussPickingWave>.Instance().UpdatePickingWave(pickingWaveModel.PICKINGID, "2");
|
||
}
|
||
catch (Exception)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
||
}
|
||
|
||
|
||
|
||
}
|
||
|
||
void BindPickData(string PickId)
|
||
{
|
||
PickingWaveGoodsModel goodsModel = new PickingWaveGoodsModel();
|
||
|
||
goodsModel.PICKINGID = PickId;
|
||
listPickingGoods = IBussFactory<BussPickingWaveGoods>.Instance().GetPickingWaveGoodsDT(goodsModel);
|
||
if(listPickingGoods != null)
|
||
{
|
||
bsPickingWaveGoods.DataSource = listPickingGoods;
|
||
if(listPickingGoods.Count>0)
|
||
{
|
||
BindMistock(listPickingGoods[0].GOOD_ID);
|
||
}
|
||
GVPickingWaveGoods.RefreshData();
|
||
|
||
}
|
||
|
||
|
||
}
|
||
private void GVPickingWave_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
|
||
{
|
||
if(GVPickingWave.RowCount==0)
|
||
{
|
||
return;
|
||
}
|
||
string pickId = GVPickingWave.GetFocusedRowCellValue("PICKINGID").ToString();
|
||
BindPickData(pickId);
|
||
pickingWaveModel = GVPickingWave.GetFocusedRow() as PickingWaveModel;
|
||
|
||
}
|
||
|
||
private void GVPickingWaveGoods_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
|
||
{
|
||
if(GVPickingWaveGoods.RowCount==0)
|
||
{
|
||
return;
|
||
}
|
||
string goodsId = GVPickingWaveGoods.GetFocusedRowCellValue("GOOD_ID").ToString();
|
||
pickingWaveGoodsModel = GVPickingWaveGoods.GetFocusedRow() as PickingWaveGoodsModel;
|
||
if(pickingWaveGoodsModel!=null)
|
||
{
|
||
bsmx.DataSource = pickingWaveGoodsModel;
|
||
}
|
||
BindMistock(goodsId);
|
||
BindPickInfo(pickingWaveGoodsModel.PICKINGID, pickingWaveGoodsModel.GOOD_ID);
|
||
|
||
}
|
||
void BindPickInfo(string pick,string goodsid)
|
||
{
|
||
|
||
List<PickngWaveInfo> listPickingGoods = IBussFactory<BussPickingWaveGoods>.Instance().GetPickInfo(pick, goodsid);
|
||
if (listPickingGoods != null)
|
||
{
|
||
bsScan.DataSource = listPickingGoods;
|
||
|
||
|
||
|
||
}
|
||
|
||
}
|
||
void BindMistock(string goodsId)
|
||
{
|
||
MIStockModel stockModel = new MIStockModel();
|
||
stockModel.GOODS_ID = goodsId;
|
||
List<MIStockModel> listStock = IBussFactory<BussMIStock>.Instance().GetMIStockList(stockModel);
|
||
if (listStock != null)
|
||
{
|
||
bsMistock.DataSource = listStock;
|
||
|
||
}
|
||
|
||
}
|
||
private void gdv_Loc_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
|
||
{
|
||
|
||
if(gdv_Loc.RowCount==0)
|
||
{
|
||
return;
|
||
}
|
||
|
||
if(pickingWaveGoodsModel!=null)
|
||
{
|
||
pickingWaveGoodsModel.LOC_ID = gdv_Loc.GetFocusedRowCellValue("LOCATION_ID").ToString();
|
||
pickingWaveGoodsModel.GOODS_MEASURE_ID = gdv_Loc.GetFocusedRowCellValue("GOODS_MEASURE_ID").ToString();
|
||
pickingWaveGoodsModel.PACKING_NUM = decimal.Parse(gdv_Loc.GetFocusedRowCellValue("PACKING_NUM").ToString());
|
||
t_sl.Text = pickingWaveGoodsModel.PACKING_NUM.ToString();
|
||
|
||
//if (pickingWaveGoodsModel.PACKING_NUM>0)
|
||
//{
|
||
// pickingWaveGoodsModel.GOODS_NUM = pickingWaveGoodsModel.PICKING_NUM / pickingWaveGoodsModel.PACKING_NUM;
|
||
//}
|
||
//else
|
||
//{
|
||
// pickingWaveGoodsModel.GOODS_NUM = 0;
|
||
//}
|
||
GVPickingWaveGoods.RefreshData();
|
||
|
||
t_mx.Text = pickingWaveGoodsModel.LOC_ID;
|
||
t_zxs.Text = pickingWaveGoodsModel.GOODS_MEASURE_NAME;
|
||
t_zxs.Text = pickingWaveGoodsModel.PACKING_NUM.ToString();
|
||
bsmx.DataSource = pickingWaveGoodsModel;
|
||
|
||
|
||
}
|
||
}
|
||
|
||
private void panelControl1_Paint(object sender, PaintEventArgs e)
|
||
{
|
||
|
||
}
|
||
|
||
private void xtraTabControl1_Click(object sender, EventArgs e)
|
||
{
|
||
|
||
}
|
||
List<PickngWaveInfo> listScanInfo = new List<PickngWaveInfo>();
|
||
private void ctrlButtons1_Click(object sender, EventArgs e)
|
||
{
|
||
if(gdv_Loc.RowCount==0)
|
||
{
|
||
return;
|
||
}
|
||
if(t_goodsId.Text.Trim().Length==0)
|
||
{
|
||
return;
|
||
}
|
||
if(t_sl.Text.Trim().Length==0)
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("请输入数量");
|
||
return;
|
||
}
|
||
if(t_sl.Text.Trim()=="0")
|
||
{
|
||
SystemCommon.ShowInfoMessageBox("数量不能为零");
|
||
return;
|
||
}
|
||
if(pickingWaveGoodsModel==null)
|
||
{
|
||
return;
|
||
}
|
||
PickngWaveInfo infoScan = new PickngWaveInfo();
|
||
infoScan.GOOD_ID = pickingWaveGoodsModel.GOOD_ID;
|
||
infoScan.PICKINGID = pickingWaveGoodsModel.PICKINGID;
|
||
infoScan.PICKING_NUM = decimal.Parse(t_sl.Text) ;
|
||
infoScan.LOCATION_ID = t_mx.Text;
|
||
infoScan.GOODS_MEASURE_ID = t_xx.Text;
|
||
infoScan.GOODSVOLUME =decimal.Parse( t_zxs.Text);
|
||
infoScan.BARCODE = t_barcode.Text;
|
||
listScanInfo.Add(infoScan);
|
||
IBussFactory<BussPickingWaveGoods>.Instance().InsertPickingInfo(infoScan);
|
||
if (listScanInfo!=null)
|
||
{
|
||
bsScan.DataSource = listScanInfo;
|
||
|
||
}
|
||
}
|
||
|
||
private void ctrlButtons2_Click(object sender, EventArgs e)
|
||
{
|
||
if(listScanInfo.Count==0)
|
||
{
|
||
return;
|
||
}
|
||
if(gdv_info.FocusedRowHandle<0)
|
||
{
|
||
return;
|
||
}
|
||
PickngWaveInfo infoScan = gdv_info.GetFocusedRow() as PickngWaveInfo;
|
||
string locid = infoScan.LOCATION_ID;
|
||
string pickId = infoScan.PICKINGID;
|
||
listScanInfo.Remove(infoScan);
|
||
gdv_info.RefreshData();
|
||
IBussFactory<BussPickingWaveGoods>.Instance().DelePickingInfo(pickId, locid);
|
||
}
|
||
}
|
||
}
|