1288 lines
43 KiB
C#
1288 lines
43 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.ComponentModel;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Drawing;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Windows.Forms;
|
|||
|
|
using WMS.Frm.Base;
|
|||
|
|
using WMS.Model.Base;
|
|||
|
|
using WMS.Model.SystemManage;
|
|||
|
|
|
|||
|
|
using WMS.Common;
|
|||
|
|
using WMS.Model.Strategy;
|
|||
|
|
using DevExpress.XtraTreeList.Columns;
|
|||
|
|
using DevExpress.XtraEditors;
|
|||
|
|
using DevExpress.XtraTreeList.Nodes;
|
|||
|
|
|
|||
|
|
namespace WMS.FrmStrategy
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
public partial class FrmUpStrategyDet : FormBase
|
|||
|
|
{
|
|||
|
|
#region 变量
|
|||
|
|
/// <summary>
|
|||
|
|
/// 上架策略编号
|
|||
|
|
/// </summary>
|
|||
|
|
private string strategyID = string.Empty;
|
|||
|
|
|
|||
|
|
public string StrategyID
|
|||
|
|
{
|
|||
|
|
get { return strategyID; }
|
|||
|
|
set { strategyID = value; }
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 仓库实体集合
|
|||
|
|
/// </summary>
|
|||
|
|
List<StorageInfoModel> listStorageInfoModel = new List<StorageInfoModel>();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 地区实体集合
|
|||
|
|
/// </summary>
|
|||
|
|
List<StorageAreaModel> listStorageAreaModel = new List<StorageAreaModel>();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 字典信息
|
|||
|
|
/// </summary>
|
|||
|
|
List<DictionaryTabModel> listDictionaryTabModel = new List<DictionaryTabModel>();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 上架策略明细集合
|
|||
|
|
/// </summary>
|
|||
|
|
List<UpStrateyCtsModel> list_upCtsModel = new List<UpStrateyCtsModel>();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 上架策略明细
|
|||
|
|
/// </summary>
|
|||
|
|
UpStrateyCtsModel upCtsModel = new UpStrateyCtsModel();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 库位编号
|
|||
|
|
/// </summary>
|
|||
|
|
List<StorageAreaLocationModel> storageLocation = new List<StorageAreaLocationModel>();
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 窗体标记 0 查看 1新增 2修改
|
|||
|
|
/// </summary>
|
|||
|
|
string frmFlag = "0";
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 新增策略时 判断是否新增成功
|
|||
|
|
/// </summary>
|
|||
|
|
bool bol = false;
|
|||
|
|
|
|||
|
|
#region 构造方法
|
|||
|
|
public FrmUpStrategyDet(string flag)
|
|||
|
|
{
|
|||
|
|
InitializeComponent();
|
|||
|
|
frmFlag = flag;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
#region 窗体加载
|
|||
|
|
/// <summary>
|
|||
|
|
/// 明细条件
|
|||
|
|
/// </summary>
|
|||
|
|
DataTable StatusStyType = new DataTable();
|
|||
|
|
/// <summary>
|
|||
|
|
/// 库位条件
|
|||
|
|
/// </summary>
|
|||
|
|
DataTable StatusSty = new DataTable();
|
|||
|
|
/// <summary>
|
|||
|
|
/// 窗体加载
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void FrmUpStrategyDet_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (frmFlag == "0")
|
|||
|
|
{
|
|||
|
|
foreach (Control ctr in this.splitContainerControl1.Panel1.Controls)
|
|||
|
|
{
|
|||
|
|
if (!ctr.Name.GetType().ToString().ToLower().Contains("label"))
|
|||
|
|
{
|
|||
|
|
ctr.Enabled = false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
//foreach (Control ctr in this.splitContainerControl1.Panel2.Controls)
|
|||
|
|
//{
|
|||
|
|
// if (!ctr.Name.ToLower().Contains("traTabControl") && !ctr.Name.GetType().ToString().ToLower().Contains("label") && !ctr.Name.ToLower().Contains("splitcontainer"))
|
|||
|
|
// {
|
|||
|
|
// ctr.Enabled = false;
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
ryIltModeStorage.Enabled = false;
|
|||
|
|
rgtLookLogic.Enabled = false;
|
|||
|
|
kqTreeList.Enabled = false;
|
|||
|
|
treeListLookUpEditGoodsType.Enabled = false;
|
|||
|
|
colLOCATION_BEGIN.OptionsColumn.AllowEdit = false;
|
|||
|
|
colLOCATION_END.OptionsColumn.AllowEdit = false;
|
|||
|
|
}
|
|||
|
|
if (frmFlag == "1")
|
|||
|
|
{
|
|||
|
|
//addButton.Enabled = false;
|
|||
|
|
//editButton.Enabled = false;
|
|||
|
|
saveStyButton.Enabled = false;
|
|||
|
|
rfButtons.Enabled = false;
|
|||
|
|
//delButton.Enabled = false;
|
|||
|
|
}
|
|||
|
|
StatusStyType.Columns.Clear();
|
|||
|
|
StatusSty.Columns.Clear();
|
|||
|
|
//DataColumn clm = new DataColumn("STATUS", typeof(string));
|
|||
|
|
//DataColumn clmFile = new DataColumn("VALUE", typeof(string));
|
|||
|
|
//StatusStyType.Columns.Add(clm);
|
|||
|
|
//StatusStyType.Columns.Add(clmFile);
|
|||
|
|
//DataColumn clms = new DataColumn("STATUS", typeof(string));
|
|||
|
|
//DataColumn clmFiles = new DataColumn("VALUE", typeof(string));
|
|||
|
|
//StatusSty.Columns.Add(clmFiles);
|
|||
|
|
//StatusSty.Columns.Add(clms);
|
|||
|
|
// DataLoad();
|
|||
|
|
|
|||
|
|
//DataRow rowClm = StatusStyType.NewRow();
|
|||
|
|
//rowClm["STATUS"] = "1";
|
|||
|
|
//rowClm["VALUE"] = "包含";
|
|||
|
|
//DataRow rowClms = StatusStyType.NewRow();
|
|||
|
|
//rowClms["STATUS"] = "0";
|
|||
|
|
//rowClms["VALUE"] = "不包含";
|
|||
|
|
//StatusStyType.Rows.Add(rowClm);
|
|||
|
|
//StatusStyType.Rows.Add(rowClms);
|
|||
|
|
//StatusStyType.AcceptChanges();
|
|||
|
|
//DataRow rowClmSty = StatusSty.NewRow();
|
|||
|
|
//rowClmSty["STATUS"] = "1";
|
|||
|
|
//rowClmSty["VALUE"] = "包含";
|
|||
|
|
//DataRow rowClmStys = StatusSty.NewRow();
|
|||
|
|
//rowClmStys["STATUS"] = "0";
|
|||
|
|
//rowClmStys["VALUE"] = "不包含";
|
|||
|
|
//StatusSty.Rows.Add(rowClmSty);
|
|||
|
|
//StatusSty.Rows.Add(rowClmStys);
|
|||
|
|
//StatusSty.AcceptChanges();
|
|||
|
|
// ryTLStatus.DataSource = StatusStyType;
|
|||
|
|
DataLoad();
|
|||
|
|
// 1新增 2修改
|
|||
|
|
if (frmFlag == "2" || frmFlag == "0")
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
GetUpStrategy();
|
|||
|
|
|
|||
|
|
if (frmFlag == "2")
|
|||
|
|
{
|
|||
|
|
saveButton.Enabled = false;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bdgCtsStgy.DataSource = strateyModel;
|
|||
|
|
ChangeButton();
|
|||
|
|
// bgsStysTage.DataSource = WebLockConfig.Instance.WebUpStrategy.
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
private void SetCheckedChildNodes(TreeListNode node, CheckState check)
|
|||
|
|
{
|
|||
|
|
for (int i = 0; i < node.Nodes.Count; i++)
|
|||
|
|
{
|
|||
|
|
node.Nodes[i].CheckState = check;
|
|||
|
|
SetCheckedChildNodes(node.Nodes[i], check);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
void treeList3_AfterCheckNode(object sender, DevExpress.XtraTreeList.NodeEventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
/// <summary>
|
|||
|
|
/// 商品类型
|
|||
|
|
/// </summary>
|
|||
|
|
List<GoodsTypeModel> goodsType = new List<GoodsTypeModel>();
|
|||
|
|
/// <summary>
|
|||
|
|
/// 供应商类型
|
|||
|
|
/// </summary>
|
|||
|
|
List<DictionaryTabModel> provideType = new List<DictionaryTabModel>();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 数据加载
|
|||
|
|
/// </summary>
|
|||
|
|
private void DataLoad()
|
|||
|
|
{
|
|||
|
|
string errText = "";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
//#region 加载仓库信息
|
|||
|
|
|
|||
|
|
|
|||
|
|
//string strDictionaryTabModel = WebLockConfig.Instance.DictionaryTab.GetDictionaryTab("STORAGE_MODE", ref errText);
|
|||
|
|
//if (errText.Trim().Length > 0)
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowInfoMessageBox(errText);
|
|||
|
|
// return;
|
|||
|
|
//}
|
|||
|
|
//List<DictionaryTabModel> listDictionaryTabModel =
|
|||
|
|
// Newtonsoft.Json.JsonConvert.DeserializeObject<List<DictionaryTabModel>>(strDictionaryTabModel);
|
|||
|
|
|
|||
|
|
//int i = treeListLookUpEditGoodsType.Properties.TreeList.Nodes.Count;
|
|||
|
|
|
|||
|
|
//string typeGoodsData = WebLockConfig.Instance.GoodsType.GetGoodsTypeList("");
|
|||
|
|
//if (errText.Trim().Length > 0)
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowInfoMessageBox(errText);
|
|||
|
|
// return;
|
|||
|
|
//}
|
|||
|
|
//goodsType = Newtonsoft.Json.JsonConvert.DeserializeObject<List<GoodsTypeModel>>(typeGoodsData);
|
|||
|
|
//GoodsTypeModel typeParentModel = goodsType.Find(r => r.GOODS_TYPE_ID == "-1");
|
|||
|
|
//TreeListNode node = treeListLookUpEditGoodsType.Properties.TreeList.AppendNode(new object[] { typeParentModel.GOODS_TYPE_ID,
|
|||
|
|
// typeParentModel.GOODS_TYPE_NAME }, -1);
|
|||
|
|
//CreateNodesParent(goodsType, typeParentModel.GOODS_TYPE_ID, node);
|
|||
|
|
//treeListLookUpEditGoodsType.Properties.TreeList.ExpandAll();
|
|||
|
|
//treeListLookUpEditGoodsType.Properties.TreeList.BeforeCheckNode += (r, e) =>
|
|||
|
|
//{
|
|||
|
|
// e.State = (e.PrevState == CheckState.Checked ? CheckState.Unchecked : CheckState.Checked);
|
|||
|
|
//};
|
|||
|
|
//treeListLookUpEditGoodsType.Properties.TreeList.AfterCheckNode += (r, a) =>
|
|||
|
|
//{
|
|||
|
|
// SelectNods(a.Node);
|
|||
|
|
// SetChilde(a.Node);
|
|||
|
|
|
|||
|
|
|
|||
|
|
//};
|
|||
|
|
bgsDctGoodsType.DataSource = goodsType;
|
|||
|
|
|
|||
|
|
//#region 加载入库类型
|
|||
|
|
///加载供应商类型
|
|||
|
|
//string strDataSet = WebLockConfig.Instance.DictionaryTab.GetDictionaryTab("STORAGE_MODE", ref errText);
|
|||
|
|
|
|||
|
|
//if (errText.Trim().Length > 0)
|
|||
|
|
//{
|
|||
|
|
|
|||
|
|
// SystemCommon.ShowInfoMessageBox(errText);
|
|||
|
|
// return;
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
//provideType = Newtonsoft.Json.JsonConvert.DeserializeObject<List<DictionaryTabModel>>(strDataSet);
|
|||
|
|
//bgsDctProvider.DataSource = provideType;
|
|||
|
|
|
|||
|
|
// #endregion
|
|||
|
|
|
|||
|
|
//GoodsTypeModel typeParentModel = goodsType.Find(r => r.GOODS_TYPE_ID == "-1");
|
|||
|
|
//TreeListNode node = treeListLookUpEdit4.Properties.TreeList.AppendNode(new object[] { typeParentModel.GOODS_TYPE_ID,
|
|||
|
|
// typeParentModel.GOODS_TYPE_NAME }, -1);
|
|||
|
|
//repositoryItemLookUpEdit6.ValueMember = "VC_DICTIONARY_ID";
|
|||
|
|
//repositoryItemLookUpEdit6.DisplayMember = "VC_DICTIONARY_MAME";
|
|||
|
|
// repositoryItemLookUpEdit6.DataSource = provideType;
|
|||
|
|
|
|||
|
|
gdvStgy.RefreshData();
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox(ex.Message.ToString());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
#region 设置父节点
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设置父节点
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="node"></param>
|
|||
|
|
private void SelectNods(TreeListNode node)
|
|||
|
|
{
|
|||
|
|
if (node.ParentNode != null)
|
|||
|
|
{
|
|||
|
|
if (node.Checked)
|
|||
|
|
{
|
|||
|
|
node.ParentNode.Checked = true;
|
|||
|
|
if (node.ParentNode.ParentNode != null)
|
|||
|
|
{
|
|||
|
|
SelectNods(node.ParentNode);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
for (int m = 0; m < node.ParentNode.Nodes.Count; m++)
|
|||
|
|
{
|
|||
|
|
if (node.ParentNode.Nodes[m].Checked)
|
|||
|
|
{
|
|||
|
|
node.ParentNode.Checked = true;
|
|||
|
|
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
node.ParentNode.Checked = false;
|
|||
|
|
if (node.ParentNode.ParentNode != null)
|
|||
|
|
{
|
|||
|
|
SelectNods(node.ParentNode);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 设置子节点
|
|||
|
|
public void SetChilde(TreeListNode node)
|
|||
|
|
{
|
|||
|
|
if (node.Nodes.Count > 0)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
for (int m = 0; m < node.Nodes.Count; m++)
|
|||
|
|
{
|
|||
|
|
node.Nodes[m].Checked = node.Checked;
|
|||
|
|
if (node.Nodes[m].Nodes.Count > 0)
|
|||
|
|
{
|
|||
|
|
SetChilde(node.Nodes[m]);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
private void CreateNodesParent(List<GoodsTypeModel> typeParentModel, string parentId, TreeListNode node)
|
|||
|
|
{
|
|||
|
|
if (typeParentModel.Count(r => r.PARENT_ID == parentId) > 0)
|
|||
|
|
{
|
|||
|
|
List<GoodsTypeModel> typeGoods = typeParentModel.FindAll(r => r.PARENT_ID == parentId && r.GOODS_TYPE_ID != "-1");
|
|||
|
|
foreach (GoodsTypeModel model in typeGoods)
|
|||
|
|
{
|
|||
|
|
TreeListNode nodeChilde = treeListLookUpEditGoodsType.Properties.TreeList.AppendNode(new object[] { model.GOODS_TYPE_ID, model.GOODS_TYPE_NAME }, node);
|
|||
|
|
if (model.IsCheckRec)
|
|||
|
|
{
|
|||
|
|
node.Checked = true;
|
|||
|
|
nodeChilde.Checked = true;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
nodeChilde.Checked = false;
|
|||
|
|
}
|
|||
|
|
if (typeParentModel.Count(r => r.PARENT_ID == model.GOODS_TYPE_ID) > 0)
|
|||
|
|
{
|
|||
|
|
List<GoodsTypeModel> type = typeParentModel.FindAll(r => r.PARENT_ID == model.GOODS_TYPE_ID);
|
|||
|
|
CreateNodesParent(type, model.GOODS_TYPE_ID, nodeChilde);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
// #endregion
|
|||
|
|
|
|||
|
|
#region 获取上架策略信息
|
|||
|
|
/// <summary>
|
|||
|
|
/// 获取上架策略信息
|
|||
|
|
/// </summary>
|
|||
|
|
private void GetUpStrategy()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 按钮事件
|
|||
|
|
/// <summary>
|
|||
|
|
/// 确定
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void ctrlButtons1_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (Validation())
|
|||
|
|
{
|
|||
|
|
AddOrUpdateUpStrategy();
|
|||
|
|
//addButton.Enabled = true;
|
|||
|
|
//editButton.Enabled = true;
|
|||
|
|
saveStyButton.Enabled = true;
|
|||
|
|
rfButtons.Enabled = true;
|
|||
|
|
//delButton.Enabled = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 增加明细
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void ctrlButtons2_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
//FrmClose();
|
|||
|
|
if (rgtLookLogic.EditValue == "")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("选择仓库!");
|
|||
|
|
rgtLookLogic.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
selectGoodsType.Clear();
|
|||
|
|
SelectNodesValue(treeListLookUpEditGoodsType.Properties.TreeList.Nodes[0]);
|
|||
|
|
if (selectGoodsType.Count == 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("商品类型!");
|
|||
|
|
treeListLookUpEditGoodsType.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (kqTreeList.EditValue.ToString() == "")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("选择库区!");
|
|||
|
|
kqTreeList.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (string.IsNullOrEmpty(ryIltModeStorage.Text))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("选择入库类型!");
|
|||
|
|
kqTreeList.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//if (strateyModel.Count(r => r.STORAGE_ID == rgtLookLogic.EditValue.ToString()
|
|||
|
|
// && r.STORAGE_AREA_ID == kqTreeList.EditValue.ToString() && r.VC_DICTIONARY_ID == ryIltModeStorage.EditValue) > 0)
|
|||
|
|
//{
|
|||
|
|
// foreach (UpStrateyCtsModel styeAll in strateyModel.FindAll(r => r.STORAGE_ID == rgtLookLogic.EditValue.ToString()
|
|||
|
|
// && r.STORAGE_AREA_ID == kqTreeList.EditValue.ToString() && r.VC_DICTIONARY_ID == ryIltModeStorage.EditValue))
|
|||
|
|
// {
|
|||
|
|
|
|||
|
|
// strateyModel.Remove(styeAll);
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
//}
|
|||
|
|
//WMS.Model.Strategy.UpStrateyStgModel
|
|||
|
|
|
|||
|
|
strateyModel = bdgCtsStgy.DataSource as List<UpStrateyCtsModel>;
|
|||
|
|
foreach (string goodsType in selectGoodsType)
|
|||
|
|
{
|
|||
|
|
if (strateyModel.Count(r => r.GOODS_TYPE_ID == goodsType && r.STORAGE_AREA_ID == kqTreeList.EditValue.ToString() && r.STORAGE_ID == rgtLookLogic.EditValue.ToString() && r.UPSTRATEGY_ID == strategyID) <= 0)
|
|||
|
|
{
|
|||
|
|
WMS.Model.Strategy.UpStrateyCtsModel styModel = new UpStrateyCtsModel();
|
|||
|
|
// styModel.GOODS_TYPE_ID = ryIltModeStorage.EditValue.ToString();
|
|||
|
|
styModel.STORAGE_AREA_ID = kqTreeList.EditValue.ToString();
|
|||
|
|
styModel.STORAGE_ID = rgtLookLogic.EditValue.ToString();
|
|||
|
|
styModel.UPSTRATEGY_ID = strategyID;
|
|||
|
|
styModel.VC_DICTIONARY_ID = ryIltModeStorage.EditValue.ToString();
|
|||
|
|
styModel.GOODS_TYPE_ID = goodsType;
|
|||
|
|
|
|||
|
|
strateyModel.Add(styModel);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 验证
|
|||
|
|
/// <summary>
|
|||
|
|
/// 验证
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
private bool Validation()
|
|||
|
|
{
|
|||
|
|
if (txtStartegyName.Text.Trim() == "")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox("请输入上架策略名称!");
|
|||
|
|
txtStartegyName.Focus();
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//if (LueState.Text == "")
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowErrorMessageBox("请选择上架策略状态!");
|
|||
|
|
// LueState.Focus();
|
|||
|
|
// return false;
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
//if (LueStorage.Text == "")
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowErrorMessageBox("请选择仓库!");
|
|||
|
|
// LueStorage.Focus();
|
|||
|
|
// return false;
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
//if (LueArea.Text == "")
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowErrorMessageBox("请选择库区!");
|
|||
|
|
// LueArea.Focus();
|
|||
|
|
// return false;
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 新增修改上架策略
|
|||
|
|
/// <summary>
|
|||
|
|
/// 新增修改上架策略
|
|||
|
|
/// </summary>
|
|||
|
|
private void AddOrUpdateUpStrategy()
|
|||
|
|
{
|
|||
|
|
UpStrategyModel model = SetUpStrategyModel();
|
|||
|
|
string strUpStrategyModel = Newtonsoft.Json.JsonConvert.SerializeObject(model);
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("网络连接出现错误!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 设置实体
|
|||
|
|
/// <summary>
|
|||
|
|
/// 设置实体
|
|||
|
|
/// </summary>
|
|||
|
|
/// <returns></returns>
|
|||
|
|
private UpStrategyModel SetUpStrategyModel()
|
|||
|
|
{
|
|||
|
|
UpStrategyModel model = new UpStrategyModel();
|
|||
|
|
//上架策略编号
|
|||
|
|
if (frmFlag == "2")
|
|||
|
|
{
|
|||
|
|
model.UPSTRATEGY_ID = StrategyID;
|
|||
|
|
model.UPDATE_MAN = userData.NAME;
|
|||
|
|
model.UPDATE_DATE = DateTime.Now;
|
|||
|
|
}
|
|||
|
|
//上架策略名称
|
|||
|
|
model.UPSTRATEGY_NAME = txtStartegyName.Text;
|
|||
|
|
if (rbCZTrue.Checked)
|
|||
|
|
{
|
|||
|
|
model.WEIGHT_FLAG = "1";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
model.WEIGHT_FLAG = "0";
|
|||
|
|
}
|
|||
|
|
if (rbtStatus.Checked)
|
|||
|
|
{
|
|||
|
|
model.UPSTRATEGY_STATE = "1";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
model.UPSTRATEGY_STATE = "0";
|
|||
|
|
}
|
|||
|
|
if (batchManger.Checked)
|
|||
|
|
{
|
|||
|
|
model.BATCHMANGERFLAG = "1";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
model.BATCHMANGERFLAG = "0";
|
|||
|
|
}
|
|||
|
|
//上架策略状态
|
|||
|
|
// model.UPSTRATEGY_STATE = LueState.ToString();
|
|||
|
|
//model.STORAGE_ID = LueStorage.EditValue.ToString();
|
|||
|
|
//model.STORAGE_AREA_ID = LueArea.EditValue.ToString();
|
|||
|
|
//承重
|
|||
|
|
if (rbCZTrue.Checked)
|
|||
|
|
{
|
|||
|
|
model.WEIGHT_FLAG = "1";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
model.WEIGHT_FLAG = "0";
|
|||
|
|
}
|
|||
|
|
//库位
|
|||
|
|
if (rbKWTrue.Checked)
|
|||
|
|
{
|
|||
|
|
model.LOCATION_FLAG = "1";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
model.LOCATION_FLAG = "0";
|
|||
|
|
}
|
|||
|
|
//容积
|
|||
|
|
if (rbRJTrue.Checked)
|
|||
|
|
{
|
|||
|
|
model.VOLUME_FLAG = "1";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
model.VOLUME_FLAG = "0";
|
|||
|
|
}
|
|||
|
|
//种类
|
|||
|
|
if (rbZLTrue.Checked)
|
|||
|
|
{
|
|||
|
|
model.KINDS_FLAG = "1";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
model.KINDS_FLAG = "0";
|
|||
|
|
}
|
|||
|
|
//批次
|
|||
|
|
if (rbPCTrue.Checked)
|
|||
|
|
{
|
|||
|
|
model.BATCH_FLAG = "1";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
model.BATCH_FLAG = "0";
|
|||
|
|
}
|
|||
|
|
model.REMARK = txtRemark.Text;
|
|||
|
|
|
|||
|
|
if (frmFlag == "1")
|
|||
|
|
{
|
|||
|
|
model.CREATE_MAN = userData.NAME;
|
|||
|
|
model.CREATE_DATE = DateTime.Now;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return model;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 选择仓库事件
|
|||
|
|
/// <summary>
|
|||
|
|
/// 仓库变化后关联库区
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void LueStorage_EditValueChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
// GetStorageArea(LueStorage.EditValue.ToString());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 根据仓库编号获取库区
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="strStorageId"></param>
|
|||
|
|
private void GetStorageArea(string strStorageId)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
//if (add == "1")
|
|||
|
|
//{
|
|||
|
|
// if (strateyModel.Count > 0)
|
|||
|
|
// {
|
|||
|
|
// foreach (UpStrateyCtsModel smodel in strateyModel)
|
|||
|
|
// {
|
|||
|
|
// if (smodel.STORAGE_AREA_ID.Trim().Length > 0)
|
|||
|
|
// listStorageAreaModel.RemoveAll(r => r.STORAGE_AREA_ID == smodel.STORAGE_AREA_ID);
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
storageAreaModelBindingSource.DataSource = listStorageAreaModel;
|
|||
|
|
//storageInfoModelBindingSource.ValueMember = "STORAGE_AREA_ID";
|
|||
|
|
//storageInfoModelBindingSource.DisplayMember = "STORAGE_AREA_NAME";
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 关闭
|
|||
|
|
/// <summary>
|
|||
|
|
/// 关闭
|
|||
|
|
/// </summary>
|
|||
|
|
private void FrmClose()
|
|||
|
|
{
|
|||
|
|
this.Close();
|
|||
|
|
this.Dispose();
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
private void gridControlCustom1_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
List<WMS.Model.Strategy.UpStrateyCtsModel> strateyModel = new List<Model.Strategy.UpStrateyCtsModel>();
|
|||
|
|
List<WMS.Model.Strategy.UpStrateyCtsModel> strateyAddModel = new List<Model.Strategy.UpStrateyCtsModel>();
|
|||
|
|
List<WMS.Model.Strategy.UpStrateyCtsModel> strateyDelModel = new List<Model.Strategy.UpStrateyCtsModel>();
|
|||
|
|
List<WMS.Model.Strategy.UpStrateyCtsModel> strateyUPTEModel = new List<Model.Strategy.UpStrateyCtsModel>();
|
|||
|
|
/// <summary>
|
|||
|
|
/// 明细增加
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void ctrlButtons3_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
// DataLoad();
|
|||
|
|
saveStyButton.Enabled = true;
|
|||
|
|
|
|||
|
|
gdvStgy.OptionsBehavior.Editable = true;
|
|||
|
|
UpStrateyCtsModel stratey = new UpStrateyCtsModel();
|
|||
|
|
stratey.STATUS = "1";
|
|||
|
|
stratey.UPSTRATEGY_ID = strategyID;
|
|||
|
|
strateyModel.Add(stratey);
|
|||
|
|
strateyAddModel.Add(stratey);
|
|||
|
|
if (gdvStgy.RowCount > 0)
|
|||
|
|
{
|
|||
|
|
gdvStgy.FocusedRowHandle = gdvStgy.RowCount - 1;
|
|||
|
|
}
|
|||
|
|
gdvStgy.RefreshData();
|
|||
|
|
//editButton.Enabled = true;
|
|||
|
|
saveButton.Enabled = true;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void repositoryItemLookUpEdit3_EditValueChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
LookUpEdit lookUpEdit = sender as LookUpEdit;
|
|||
|
|
string strStorageId = lookUpEdit.EditValue.ToString();
|
|||
|
|
// strateyModel= strateyModel;
|
|||
|
|
// string strStorageId =gdvStgy.GetFocusedRowCellValue(colSTORAGE_AREA_ID).ToString();
|
|||
|
|
GetStorageArea(strStorageId);
|
|||
|
|
gdvStgy.RefreshData();
|
|||
|
|
|
|||
|
|
if (strateyModel.Count > 0)
|
|||
|
|
{
|
|||
|
|
strateyModel[strateyModel.Count - 1].STORAGE_ID = strStorageId;
|
|||
|
|
}
|
|||
|
|
kqTreeList.Focus();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 明细删除
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void ctrlButtons4_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (gdvStgy.FocusedRowHandle > -1)
|
|||
|
|
{
|
|||
|
|
strateyAddModel.Remove(gdvStgy.GetFocusedRow() as UpStrateyCtsModel);
|
|||
|
|
strateyModel.Remove(gdvStgy.GetFocusedRow() as UpStrateyCtsModel);
|
|||
|
|
}
|
|||
|
|
gdvStgy.RefreshData();
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 保存上架策略信息
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void ctrlButtons5_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
#region ##
|
|||
|
|
//gdvStgy.OptionsBehavior.Editable = false;
|
|||
|
|
////if (addButton.Enabled)
|
|||
|
|
////{
|
|||
|
|
|
|||
|
|
//try
|
|||
|
|
//{
|
|||
|
|
// string errText = string.Empty;
|
|||
|
|
// string addModel = Newtonsoft.Json.JsonConvert.SerializeObject(strateyModel);
|
|||
|
|
|
|||
|
|
// WebLockConfig.Instance.WebUpStrategy.AddStrategyCdtion(addModel, ref errText);
|
|||
|
|
// if (errText.Trim().Length > 0)
|
|||
|
|
// {
|
|||
|
|
// SystemCommon.ShowInfoMessageBox(errText);
|
|||
|
|
// return;
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
//catch (Exception ex)
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowInfoMessageBox(ex.Message.ToString());
|
|||
|
|
|
|||
|
|
//}
|
|||
|
|
//saveStyButton.Enabled = false;
|
|||
|
|
////addButton.Enabled = true;
|
|||
|
|
////editButton.Enabled = true;
|
|||
|
|
//SystemCommon.ShowInfoMessageBox("保存成功");
|
|||
|
|
////}
|
|||
|
|
#endregion
|
|||
|
|
//UpdateUpStrategy
|
|||
|
|
if (string.IsNullOrEmpty(strategyID))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("策略编号为空!");
|
|||
|
|
return;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
UpStrategyModel upStgModel = new UpStrategyModel();
|
|||
|
|
upStgModel.UPSTRATEGY_ID = this.strategyID;
|
|||
|
|
if (string.IsNullOrEmpty(txtStartegyName.Text.Trim()))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("策略名称不能为空!");
|
|||
|
|
txtStartegyName.Focus();
|
|||
|
|
}
|
|||
|
|
upStgModel.UPSTRATEGY_NAME = txtStartegyName.Text;
|
|||
|
|
//状态
|
|||
|
|
if (rbPCTrue.Checked)
|
|||
|
|
{
|
|||
|
|
upStgModel.UPSTRATEGY_STATE = "1";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
upStgModel.UPSTRATEGY_STATE = "0";
|
|||
|
|
}
|
|||
|
|
//种类
|
|||
|
|
if (rbZLTrue.Checked)
|
|||
|
|
{
|
|||
|
|
upStgModel.KINDS_FLAG = "1";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
upStgModel.KINDS_FLAG = "0";
|
|||
|
|
}
|
|||
|
|
//批次
|
|||
|
|
if (rbPCTrue.Checked)
|
|||
|
|
{
|
|||
|
|
upStgModel.BATCH_FLAG = "1";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
upStgModel.BATCH_FLAG = "0";
|
|||
|
|
}
|
|||
|
|
//容积
|
|||
|
|
if (rbRJTrue.Checked)
|
|||
|
|
{
|
|||
|
|
upStgModel.VOLUME_FLAG = "1";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
upStgModel.VOLUME_FLAG = "0";
|
|||
|
|
}
|
|||
|
|
//承重
|
|||
|
|
if (rbCZTrue.Checked)
|
|||
|
|
{
|
|||
|
|
upStgModel.WEIGHT_FLAG = "1";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
upStgModel.WEIGHT_FLAG = "0";
|
|||
|
|
}
|
|||
|
|
//库位
|
|||
|
|
if (rbKWTrue.Checked)
|
|||
|
|
{
|
|||
|
|
upStgModel.LOCATION_FLAG = "1";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
upStgModel.LOCATION_FLAG = "0";
|
|||
|
|
}
|
|||
|
|
//批次管理的标记
|
|||
|
|
if (batchManger.Checked)
|
|||
|
|
{
|
|||
|
|
upStgModel.BATCH_FLAG = "1";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
upStgModel.BATCH_FLAG = "0";
|
|||
|
|
}
|
|||
|
|
upStgModel.REMARK = txtRemark.Text.Trim();
|
|||
|
|
string str_upStgModel = Newtonsoft.Json.JsonConvert.SerializeObject(upStgModel);
|
|||
|
|
string errText = "";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 明细编辑
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void ctrlButtons6_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (gdvStgy.RowCount < 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
saveStyButton.Enabled = true;
|
|||
|
|
gdvStgy.OptionsBehavior.Editable = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 删除明细
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void ctrlButtons7_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
//if (strateyAddModel.Count > 0 || strateyUPTEModel.Count > 0 || strateyDelModel.Count > 0)
|
|||
|
|
//{
|
|||
|
|
// DialogResult dia = SystemCommon.ShowMessageBoxResultCancel("有修改未保存的数据,是否放弃");
|
|||
|
|
// if (dia == System.Windows.Forms.DialogResult.Cancel)
|
|||
|
|
// {
|
|||
|
|
// return;
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
//foreach (UpStrateyCtsModel model in strateyAddModel)
|
|||
|
|
//{
|
|||
|
|
// strateyModel.Remove(model);
|
|||
|
|
//}
|
|||
|
|
//strateyAddModel.Clear();
|
|||
|
|
//strateyUPTEModel.Clear();
|
|||
|
|
//strateyDelModel.Clear();
|
|||
|
|
//gdvStgy.RefreshData();
|
|||
|
|
|
|||
|
|
//判断当前是否选择明细
|
|||
|
|
if (gdvStgy.FocusedRowHandle < 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请选择要删除的明细!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (SystemCommon.ShowMessageBoxResult("确认删除所选中的明细?") == DialogResult.OK)
|
|||
|
|
{
|
|||
|
|
//upCtsModel = gdvStgy.GetFocusedRow() as UpStrateyCtsModel;
|
|||
|
|
if (upCtsModel.UPSTRATEGY_ID != "" && upCtsModel.STORAGE_ID != "" && upCtsModel.STORAGE_AREA_ID != "" && upCtsModel.VC_DICTIONARY_ID != "" && upCtsModel.GOODS_TYPE_ID != "")
|
|||
|
|
{
|
|||
|
|
//string str_upCtsModel = Newtonsoft.Json.JsonConvert.SerializeObject(upCtsModel);
|
|||
|
|
//string errText = WebLockConfig.Instance.WebUpStrategy.DelUpStrategy(str_upCtsModel);
|
|||
|
|
//if (errText == "")
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("删除成功!");
|
|||
|
|
|
|||
|
|
// //刷新数据
|
|||
|
|
// string strStrategy = WebLockConfig.Instance.WebUpStrategy.GetStrategy(StrategyID, ref errText);
|
|||
|
|
// strateyModel = Newtonsoft.Json.JsonConvert.DeserializeObject<List<WMS.Model.Strategy.UpStrateyCtsModel>>(strStrategy);
|
|||
|
|
// bdgCtsStgy.DataSource = strateyModel;
|
|||
|
|
// gdvStgy.RefreshData();
|
|||
|
|
//}
|
|||
|
|
//else
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("删除失败!");
|
|||
|
|
//}
|
|||
|
|
strateyModel.Remove(upCtsModel);
|
|||
|
|
bdgCtsStgy.DataSource = strateyModel;
|
|||
|
|
gdvStgy.RefreshData();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("明细含有空信息!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void riTLoop_EditValueChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void treeListGoodsType_EditValueChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
// treeListGoodsType.TreeList.FocusedNode["GOODS_TYPE_ID"].ToString();
|
|||
|
|
// UpStrateyCtsModel straTeyModel= gdvStgy.GetFocusedRow() as UpStrateyCtsModel;
|
|||
|
|
//string type= straTeyModel.GOODS_TYPE_ID;
|
|||
|
|
}
|
|||
|
|
List<string> selectGoodsType = new List<string>();
|
|||
|
|
private void SelectNodesValue(TreeListNode node)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (node.Nodes.Count > 0)
|
|||
|
|
{
|
|||
|
|
for (int i = 0; i < node.Nodes.Count; i++)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
SelectNodesValue(node.Nodes[i]);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (node.Checked)
|
|||
|
|
{
|
|||
|
|
selectGoodsType.Add(node["GOODS_TYPE_ID"].ToString());
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 库位条件
|
|||
|
|
/// </summary>
|
|||
|
|
List<UpStrateyStgModel> LocationStratey = new List<UpStrateyStgModel>();
|
|||
|
|
/// <summary>
|
|||
|
|
/// 保存明细
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void ctrlButtons1_Click_1(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
#region ##
|
|||
|
|
//if (rgtLookLogic.EditValue == "")
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("选择仓库!");
|
|||
|
|
// rgtLookLogic.Focus();
|
|||
|
|
// return;
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
//selectGoodsType.Clear();
|
|||
|
|
//SelectNodesValue(treeListLookUpEditGoodsType.Properties.TreeList.Nodes[0]);
|
|||
|
|
//if (selectGoodsType.Count == 0)
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("商品类型!");
|
|||
|
|
// treeListLookUpEditGoodsType.Focus();
|
|||
|
|
// return;
|
|||
|
|
//}
|
|||
|
|
//if (kqTreeList.EditValue.ToString() == "")
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("选择库区!");
|
|||
|
|
// kqTreeList.Focus();
|
|||
|
|
// return;
|
|||
|
|
//}
|
|||
|
|
//if (string.IsNullOrEmpty(ryIltModeStorage.EditValue.ToString()))
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("选择入库类型!");
|
|||
|
|
// kqTreeList.Focus();
|
|||
|
|
// return;
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
//if (strateyModel.Count(r => r.STORAGE_ID == rgtLookLogic.EditValue.ToString()
|
|||
|
|
// && r.STORAGE_AREA_ID == kqTreeList.EditValue.ToString() && r.VC_DICTIONARY_ID == ryIltModeStorage.EditValue) > 0)
|
|||
|
|
//{
|
|||
|
|
// foreach (UpStrateyCtsModel styeAll in strateyModel.FindAll(r => r.STORAGE_ID == rgtLookLogic.EditValue.ToString()
|
|||
|
|
// && r.STORAGE_AREA_ID == kqTreeList.EditValue.ToString() && r.VC_DICTIONARY_ID == ryIltModeStorage.EditValue))
|
|||
|
|
// {
|
|||
|
|
|
|||
|
|
// strateyModel.Remove(styeAll);
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
//}
|
|||
|
|
////WMS.Model.Strategy.UpStrateyStgModel
|
|||
|
|
|
|||
|
|
|
|||
|
|
//foreach (string goodsType in selectGoodsType)
|
|||
|
|
//{
|
|||
|
|
// WMS.Model.Strategy.UpStrateyCtsModel styModel = new UpStrateyCtsModel();
|
|||
|
|
// // styModel.GOODS_TYPE_ID = ryIltModeStorage.EditValue.ToString();
|
|||
|
|
// styModel.STORAGE_AREA_ID = kqTreeList.EditValue.ToString();
|
|||
|
|
// styModel.STORAGE_ID = rgtLookLogic.EditValue.ToString();
|
|||
|
|
// styModel.UPSTRATEGY_ID = strategyID;
|
|||
|
|
// styModel.VC_DICTIONARY_ID = ryIltModeStorage.EditValue.ToString();
|
|||
|
|
// styModel.GOODS_TYPE_ID = goodsType;
|
|||
|
|
// strateyModel.Add(styModel);
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
//string location = WebLockConfig.Instance.StorageAreaLocation.
|
|||
|
|
// GetLocationInfoBeginEnd(rgtLookLogic.EditValue.ToString(), kqTreeList.EditValue.ToString());
|
|||
|
|
//gdvStgy.RefreshData();
|
|||
|
|
|
|||
|
|
|
|||
|
|
//// WMS.Model.Base.StorageInfoModel
|
|||
|
|
//storageLocation =
|
|||
|
|
// Newtonsoft.Json.JsonConvert.DeserializeObject<List<StorageAreaLocationModel>>(location);
|
|||
|
|
//bgsLocation.DataSource = storageLocation;
|
|||
|
|
|
|||
|
|
//if (LocationStratey.Count(r => r.STORAGE_ID == rgtLookLogic.EditValue.ToString() && r.STORAGE_AREA_ID == kqTreeList.EditValue.ToString()
|
|||
|
|
|
|||
|
|
// && r.LOCATION_BEGIN == storageLocation[0].LOCATION_ID && r.LOCATION_END == storageLocation[storageLocation.Count - 1].LOCATION_ID) > 0)
|
|||
|
|
//{
|
|||
|
|
// List<UpStrateyStgModel> modeLocation = LocationStratey.FindAll(r => r.STORAGE_ID == rgtLookLogic.EditValue.ToString()
|
|||
|
|
// && r.STORAGE_AREA_ID == kqTreeList.EditValue.ToString()
|
|||
|
|
// && r.LOCATION_BEGIN == storageLocation[0].LOCATION_ID
|
|||
|
|
// && r.LOCATION_END == storageLocation[storageLocation.Count - 1].LOCATION_ID);
|
|||
|
|
|
|||
|
|
// foreach (UpStrateyStgModel staModel in modeLocation)
|
|||
|
|
// {
|
|||
|
|
// LocationStratey.Remove(staModel);
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
//}
|
|||
|
|
//WMS.Model.Strategy.UpStrateyStgModel modeBegEnd = new UpStrateyStgModel();
|
|||
|
|
//modeBegEnd.LOCATION_BEGIN = storageLocation[0].LOCATION_ID;
|
|||
|
|
//modeBegEnd.LOCATION_END = storageLocation[storageLocation.Count - 1].LOCATION_ID;
|
|||
|
|
//modeBegEnd.STORAGE_ID = rgtLookLogic.EditValue.ToString();
|
|||
|
|
//modeBegEnd.STORAGE_AREA_ID = kqTreeList.EditValue.ToString();
|
|||
|
|
|
|||
|
|
//LocationStratey.Add(modeBegEnd);
|
|||
|
|
//bgsStysTage.DataSource = LocationStratey;
|
|||
|
|
//gdwLocation.RefreshData();
|
|||
|
|
////List<string> goodsTypeModel = new List<string>();
|
|||
|
|
////for(int i=0;i<treeListLookUpEditGoodsType.Properties.TreeList.Nodes.Count;i++)
|
|||
|
|
////{
|
|||
|
|
//// if(treeListLookUpEditGoodsType.Properties.TreeList.Nodes[i].Checked)
|
|||
|
|
//// {
|
|||
|
|
//// string goodsTypeId= treeListLookUpEditGoodsType.Properties.TreeList.Nodes[i]["GOODS_TYPE_ID"].ToString();
|
|||
|
|
//// goodsTypeModel.Add(goodsTypeId);
|
|||
|
|
//// }
|
|||
|
|
////}
|
|||
|
|
|
|||
|
|
////if (goodsType.Count(r => r. =="")==0)
|
|||
|
|
////{
|
|||
|
|
//// SystemCommon.ShowInfoMessageBox("选择商品的类型!");
|
|||
|
|
//// treeListLookUpEditGoodsType.Focus();
|
|||
|
|
//// return;
|
|||
|
|
////}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
if (frmFlag == "1")
|
|||
|
|
{
|
|||
|
|
if (!bol)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请先确定增加策略!");
|
|||
|
|
saveButton.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (strateyModel.Count == 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("明细条件为空!");
|
|||
|
|
rgtLookLogic.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
//写入数据库
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
string addModel = Newtonsoft.Json.JsonConvert.SerializeObject(strateyModel);
|
|||
|
|
|
|||
|
|
if (string.IsNullOrEmpty(frmFlag))
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox(ex.Message.ToString());
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
saveStyButton.Enabled = false;
|
|||
|
|
//addButton.Enabled = true;
|
|||
|
|
//editButton.Enabled = true;
|
|||
|
|
SystemCommon.ShowInfoMessageBox("保存成功");
|
|||
|
|
//}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 增加库位
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void ctrlButtons3_Click_1(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (gdwLocation.FocusedRowHandle < 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("选择一条记录!");
|
|||
|
|
gdwLocation.FocusedRowHandle = 0;
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
//ctrlButtons3.Focus();
|
|||
|
|
//bgsStysTage.EndEdit();
|
|||
|
|
//LocationStratey.Clear();
|
|||
|
|
LocationStratey = bgsStysTage.DataSource as List<UpStrateyStgModel>;
|
|||
|
|
|
|||
|
|
//UpStrateyStgModel stgModel = gdwLocation.GetFocusedRow() as UpStrateyStgModel;
|
|||
|
|
if (LocationStratey.Count <= 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
//foreach (UpStrateyStgModel model in LocationStratey)
|
|||
|
|
//{
|
|||
|
|
// if (LocationStratey[gdwLocation.FocusedRowHandle].LOCATION_BEGIN == model.LOCATION_BEGIN && LocationStratey[gdwLocation.FocusedRowHandle].LOCATION_END == model.LOCATION_END)
|
|||
|
|
// {
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("当前库位区间已经存在!");
|
|||
|
|
// return;
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
UpStrateyStgModel modelLocation = new UpStrateyStgModel();
|
|||
|
|
if (gdwLocation.FocusedRowHandle < LocationStratey.Count)
|
|||
|
|
{
|
|||
|
|
modelLocation = LocationStratey[gdwLocation.FocusedRowHandle];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
LocationStratey.Add(modelLocation);
|
|||
|
|
bdgCtsStgy.DataSource = LocationStratey;
|
|||
|
|
gdwLocation.RefreshData();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 删除库位
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void ctrlButtons4_Click_1(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (gdwLocation.FocusedRowHandle < 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("选择一条记录!");
|
|||
|
|
gdwLocation.FocusedRowHandle = 0;
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
LocationStratey = bgsStysTage.DataSource as List<UpStrateyStgModel>;
|
|||
|
|
|
|||
|
|
UpStrateyStgModel stgModel = gdwLocation.GetFocusedRow() as UpStrateyStgModel;
|
|||
|
|
LocationStratey.Remove(stgModel);
|
|||
|
|
bgsStysTage.DataSource = LocationStratey;
|
|||
|
|
gdwLocation.RefreshData();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 保存库位
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void ctrlButtons5_Click_1(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 双击
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void gdvStgy_DoubleClick(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (gdvStgy.RowCount < 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 根据所选择标签处理按钮可用状态
|
|||
|
|
/// </summary>
|
|||
|
|
private void ChangeButton()
|
|||
|
|
{
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 上架策略明细实体赋值
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void gdvStgy_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (gdvStgy.FocusedRowHandle >= 0)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 标签切换事件
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void xtraTabControl1_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e)
|
|||
|
|
{
|
|||
|
|
ChangeButton();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|