大连融科 WMS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

250 lines
8.8 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Data;
using SiaSun.LMS.Common;
using SiaSun.LMS.WPFClient.UC;
namespace SiaSun.LMS.WPFClient.TASK
{
/// <summary>
///
/// </summary>
public partial class ManageMove : AvalonDock.DocumentContent
{
Model.MANAGE_TYPE mMANAGE_TYPE = null;
#region 构造函数
public ManageMove(string MANAGE_TYPE_CODE)
{
InitializeComponent();
this.mMANAGE_TYPE = (Model.MANAGE_TYPE)MainApp._I_BaseService.GetModel("MANAGE_TYPE_SELECT_BY_MANAGE_TYPE_CODE", MANAGE_TYPE_CODE).RequestObject;
this.ucQuery.U_Query += new UC.ucQuickQuery.U_QueryEventHandler
( (QueryWhere)=>
{
//QueryWhere = string.Format("{0} AND {1} {2}",
//this.ucSplitPanel.U_GetSplitPropertyWhere(),
//string.IsNullOrEmpty(QueryWhere) ? "1=1" : QueryWhere,
//string.Format(" AND AREA_TYPE != 'XuNiKu' "));
//QueryWhere = string.Format("{0}",
// this.ucSplitPanel.U_GetSplitPropertyWhere());
QueryWhere = string.Format(" {0}", string.IsNullOrEmpty(QueryWhere) ? "1=1" : QueryWhere);
this.StorageListBind(QueryWhere);
}
);
}
#endregion
#region 系统方法
private void DocumentContent_Loaded(object sender, RoutedEventArgs e)
{
this.InitManagePosotion();
this.ucManagePosition.U_StockBarcodeKeyDown += new UC.ucManagePosition.U_StockBarcodeKeyDownHandler
(() =>
{
this.StorageListBind(string.Format(" STOCK_BARCODE='{0}'", ucManagePosition.U_STOCK_BARCODE.Trim()));
}
);
//属性控件
this.InitSplitPropertyPanel();
//查询控件
this.InitQueryControl();
}
/// <summary>
/// 单击记录,选中
/// </summary>
void gridApp_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
DataGridTemplate grid = e.Source as DataGridTemplate;
if (grid != null && grid.SelectedItem != null)
{
//获得数据绑定行
DataRowView drSelect=grid.SelectedItem as DataRowView;
tbStartPositon.Text = Convert.ToString(drSelect["CELL_NAME"]);
ucManagePosition.U_STOCK_BARCODE = Convert.ToString(drSelect["STOCK_BARCODE"]);
}
}
#endregion
#region 自定义方法
private void Register_DataTable_Event()
{
foreach (TabItem tabItem in ucStorageGroup.tabSplitProperty.Items)
{
//if (tabItem.Content != null)
if (tabItem.HasContent)
{
ucCommonDataGrid grid = tabItem.Content as UC.ucCommonDataGrid;
if (grid != null)
{
grid.gridApp.SelectionChanged -= new SelectionChangedEventHandler(gridApp_SelectionChanged);
grid.gridApp.SelectionChanged+=new SelectionChangedEventHandler(gridApp_SelectionChanged);
}
}
}
}
/// <summary>
/// 初始化输送位置控件
/// </summary>
private void InitManagePosotion()
{
//初始化
this.ucManagePosition.U_InitControl(mMANAGE_TYPE.MANAGE_TYPE_ID);
}
/// <summary>
/// 初始化查询控件
/// </summary>
private void InitQueryControl()
{
this.ucQuery.U_WindowName = this.GetType().Name;
this.ucQuery.U_XmlTableName = "V_STORAGE_LIST";
this.ucQuery.U_InitControl();
}
/// <summary>
/// 初始化属性面板
/// </summary>
private void InitSplitPropertyPanel()
{
this.ucSplitPanel.U_SplitGroupColumn = "GOODS_TYPE_ID";
this.ucSplitPanel.U_SplitGroupHeader = "GOODS_TYPE_NAME";
this.ucSplitPanel.U_SplitPropertyColumn = "GOODS_PROPERTY";
this.ucSplitPanel.U_SplitPropertyType = "GOODS_TYPE";
this.ucSplitPanel.U_InitControl();
}
private void StorageListBind(string QueryWhere)
{
this.ucStorageGroup.U_WindowName = this.GetType().Name;
this.ucStorageGroup.U_TableName = "V_STORAGE_LIST";
this.ucStorageGroup.U_XmlTableName = "V_STORAGE_LIST";
//this.ucStorageGroup.U_AppendFieldStyles = this.GetColumnDescriptionList();
this.ucStorageGroup.U_TotalColumnName = "STORAGE_LIST_QUANTITY";
this.ucStorageGroup.U_OrderField = "STORAGE_LIST_ID";
this.ucStorageGroup.U_Where = string.Format(" AREA_TYPE!= 'XuNiKu' AND CELL_STATUS<>'Exception' and CELL_ID not in ( select start_cell_id from manage_main) and {0} ",
QueryWhere);
this.ucStorageGroup.U_AllowOperatData = false;
this.ucStorageGroup.U_AllowChecked = false;
this.ucStorageGroup.U_AllowShowPage = true;
//拆分列属性
this.ucStorageGroup.U_SplitPropertyType = "GOODS_TYPE";
this.ucStorageGroup.U_SplitGroupColumn = "GOODS_TYPE_ID";
this.ucStorageGroup.U_SplitGroupHeader = "GOODS_TYPE.GOODS_TYPE_NAME";
this.ucStorageGroup.U_SplitPropertyColumn = "GOODS_PROPERTY";
this.ucStorageGroup.U_InitControl();
Register_DataTable_Event();
}
#endregion
#region 按钮事件
private void WrapPanel_Click(object sender, RoutedEventArgs e)
{
Button btn = e.OriginalSource as Button;
if (btn != null)
{
switch (btn.Name)
{
case "btnConfirm":
this.CreateTaskOut();
break;
case "btnRefresh":
this.Refresh();
break;
}
}
}
/// <summary>
/// 创建移库任务
/// </summary>
private void CreateTaskOut()
{
bool bResult = true;
string sResult = string.Empty;
try
{
bResult = this.ucManagePosition.U_CHECK_WAREHOUSE();
if (!bResult)
return;
if (string.IsNullOrEmpty(this.tbStartPositon.Text.Trim()))
{
bResult = false;
MainApp._MessageDialog.Show(bResult, "请选择要移动的库存");
return;
}
if (MainApp._MessageDialog.ShowDialog("确认下达【移库】任务") == Sid.Windows.Controls.TaskDialogResult.Ok)
{
bResult = MainApp._I_BaseService.Invoke(mMANAGE_TYPE.MANAGE_TYPE_CLASS.TrimEnd(),
"ManageCreate",
new object[] { this.ucManagePosition.U_STOCK_BARCODE.Trim(),
this.ucManagePosition.U_END_POSITION_ID,
this.cbControl.IsChecked,
true,
MainApp._USER.USER_NAME},
out sResult);
if (bResult)
{
this.Refresh();
}
}
MainApp._MessageDialog.Show(bResult, sResult);
}
catch (Exception ex)
{
MainApp._MessageDialog.ShowException(ex);
}
}
/// <summary>
/// 刷新
/// </summary>
private void Refresh()
{
this.ucStorageGroup.U_Update();
this.tbStartPositon.Text = string.Empty;
this.ucManagePosition.U_Update();
}
#endregion
}
}