2427 lines
99 KiB
C#
2427 lines
99 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Drawing;
|
|||
|
|
using System.Windows.Forms;
|
|||
|
|
using WMS.Frm.Base;
|
|||
|
|
using WMS.Model.Stock;
|
|||
|
|
|
|||
|
|
using WMS.Common;
|
|||
|
|
using DevExpress.XtraGrid.Columns;
|
|||
|
|
using DevExpress.XtraEditors.Repository;
|
|||
|
|
using WMS.Model.Base;
|
|||
|
|
|
|||
|
|
using DevExpress.XtraReports.UI;
|
|||
|
|
using WMS.Ctrl;
|
|||
|
|
using WMS.FrmBaseData;
|
|||
|
|
using System.Threading;
|
|||
|
|
using WMS.Model.SystemManage;
|
|||
|
|
using WMS.Business;
|
|||
|
|
using WMS.Business.Stock;
|
|||
|
|
using WMS.Business.Base;
|
|||
|
|
using WMS.Business.Common;
|
|||
|
|
using WMS.Business.SystemManage;
|
|||
|
|
|
|||
|
|
namespace WMS.FrmStock
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 窗体:移位单
|
|||
|
|
/// </summary>
|
|||
|
|
public partial class FrmMoveLoc : FormBase
|
|||
|
|
{
|
|||
|
|
#region 变量
|
|||
|
|
public static FrmMoveLoc frmMoveLoc;
|
|||
|
|
private MoveLocModel moveLocModel = new MoveLocModel();//当前选择的移位单
|
|||
|
|
private List<MoveLocModel> listmoveLocModel = new List<MoveLocModel>();//移位单集合
|
|||
|
|
private List<MoveLocTabModel> listMoveLocTabModel = new List<MoveLocTabModel>();//移位商品明细集合
|
|||
|
|
private List<MIStockModel> MIStockList = new List<MIStockModel>();//某库区库存集合
|
|||
|
|
private List<SKUTabModel> listSKU = new List<SKUTabModel>();//规格集合
|
|||
|
|
private bool isSKU = false;//默认未开启SKU
|
|||
|
|
//private List<JWGoodsInfoModel> listJWGoodsInfoModel = new List<JWGoodsInfoModel>();//商品集合
|
|||
|
|
private int flag = -1;//0:增加;1:修改
|
|||
|
|
private DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit lueUnits = new RepositoryItemLookUpEdit();
|
|||
|
|
private DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit lueLocs = new RepositoryItemLookUpEdit();
|
|||
|
|
//全选判断
|
|||
|
|
bool m_status = false;
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 初始化
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 无参构造
|
|||
|
|
/// </summary>
|
|||
|
|
public FrmMoveLoc()
|
|||
|
|
{
|
|||
|
|
InitializeComponent();
|
|||
|
|
|
|||
|
|
//dicCreate.LoadData();//创建人
|
|||
|
|
//dicConfirm.LoadData();//审核人
|
|||
|
|
//dicMove.LoadData();//移位人
|
|||
|
|
lueArea.LoadData();//库区
|
|||
|
|
lueState.LoadData();//状态
|
|||
|
|
lueType.LoadData();//移位类型
|
|||
|
|
|
|||
|
|
lueStorage.LoadData();//仓库
|
|||
|
|
RoleStorageModel roles = new RoleStorageModel();
|
|||
|
|
roles.ROLE_ID = userData.ROLE_ID;
|
|||
|
|
|
|||
|
|
List<RoleStorageModel> lists = IBussFactory<BussRoleStorage>.Instance().GetList(roles);
|
|||
|
|
|
|||
|
|
if (lists!=null)
|
|||
|
|
lueStorage.Properties.DataSource = lists;
|
|||
|
|
//lueStorage.Properties.DisplayMember = "STORAGE_NAME";
|
|||
|
|
//lueStorage.Properties.ValueMember = "STORAGE_ID";
|
|||
|
|
//lueStorage.Properties.NullText = string.Empty;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 本窗体加载的时候
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
public void FrmMoveLoc_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
//检测是否开启SKU
|
|||
|
|
// if (WebLockConfig.Instance.WebSysParams.GetParamValue("IsSKU") == "0") {
|
|||
|
|
// isSKU = true;
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
//审核人
|
|||
|
|
//dicConfirm.Properties.DataSource = getSameDepUserList();
|
|||
|
|
//dicConfirm.TextBoxFlag = userData.USER_ID;
|
|||
|
|
//dicConfirm.TextBoxValue = userData.NAME;
|
|||
|
|
|
|||
|
|
//移位人
|
|||
|
|
//dicMove.Properties.DataSource = getSameDepUserList();
|
|||
|
|
//DataTable dt = dicMove.Properties.DataSource as DataTable;
|
|||
|
|
//DataRow dr = dt.NewRow();
|
|||
|
|
//dt.Rows.Add(dr);
|
|||
|
|
//dicMove.Properties.DataSource = dt;
|
|||
|
|
|
|||
|
|
//创建人
|
|||
|
|
//dicCreate.Properties.DataSource = getSameDepUserList();
|
|||
|
|
//dicCreate.TextBoxFlag = userData.USER_ID;
|
|||
|
|
//dicCreate.TextBoxValue = userData.NAME;
|
|||
|
|
|
|||
|
|
////原库位下拉框
|
|||
|
|
//lueOldLoc.NullText = "";
|
|||
|
|
//lueOldLoc.Properties.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("LOCATION_NAME", "原库位"));
|
|||
|
|
//lueOldLoc.Properties.ValueMember = "LOCATION_ID";
|
|||
|
|
//lueOldLoc.Properties.DisplayMember = "LOCATION_NAME";
|
|||
|
|
//string strResult = string.Empty;
|
|||
|
|
//try
|
|||
|
|
//{
|
|||
|
|
// strResult = WebLockConfig.Instance.Common.GetCustomCtrlData("T_BASE_STORAGE_AREA_LOCATION", "LOCATION_ID", "LOCATION_NAME", " STORAGE_AREA_ID = '' and STATUS = '0'");
|
|||
|
|
//}
|
|||
|
|
//catch (Exception)
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
//}
|
|||
|
|
//lueOldLoc.Properties.DataSource = Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(strResult);
|
|||
|
|
//库位下拉框
|
|||
|
|
lueLoc.NullText = "";
|
|||
|
|
lueLoc.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("LOCATION_ID", "库位"));
|
|||
|
|
lueLoc.ValueMember = "LOCATION_ID";
|
|||
|
|
lueLoc.DisplayMember = "LOCATION_ID";
|
|||
|
|
|
|||
|
|
lueLocs.NullText = "";
|
|||
|
|
lueLocs.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("LOCATION_ID", "库位"));
|
|||
|
|
lueLocs.ValueMember = "LOCATION_ID";
|
|||
|
|
lueLocs.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'", "");
|
|||
|
|
if (strResult != null)
|
|||
|
|
{
|
|||
|
|
lueUnits.NullText = "";
|
|||
|
|
lueUnits.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("UNIT_NAME", "单位"));
|
|||
|
|
lueUnits.ValueMember = "UNIT";
|
|||
|
|
lueUnits.DisplayMember = "UNIT_NAME";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
//新库位下拉框
|
|||
|
|
lueNewLoc.NullText = "";
|
|||
|
|
lueNewLoc.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("LOCATION_ID", "新库位"));
|
|||
|
|
lueNewLoc.ValueMember = "LOCATION_ID";
|
|||
|
|
lueNewLoc.DisplayMember = "LOCATION_ID";
|
|||
|
|
|
|||
|
|
|
|||
|
|
bindGrid(moveLocModel);//绑定数据
|
|||
|
|
//ClearGoodsGrid();//绑定商品列表数据
|
|||
|
|
bsMoveLocEdit.DataSource = moveLocModel;//绑定选中的通知单
|
|||
|
|
|
|||
|
|
FrmSelectModle = new MoveLocModel();//通用查询
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 得到与登录用户同部门的所有用户
|
|||
|
|
/// </summary>
|
|||
|
|
public DataTable getSameDepUserList() {
|
|||
|
|
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
DataTable strResult = new DataTable();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
strResult = IBussFactory<BussSystemUser>.Instance().GetSameDepUserInfo(userData.USER_ID);
|
|||
|
|
return strResult;
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
return null;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public static FrmMoveLoc getInstance()
|
|||
|
|
{
|
|||
|
|
if (frmMoveLoc == null || frmMoveLoc.IsDisposed)
|
|||
|
|
{
|
|||
|
|
frmMoveLoc = new FrmMoveLoc();
|
|||
|
|
}
|
|||
|
|
return frmMoveLoc;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 绑定数据
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 整体绑定数据
|
|||
|
|
/// </summary>
|
|||
|
|
private void bindGrid(MoveLocModel model)
|
|||
|
|
{
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//整体绑定数据
|
|||
|
|
string strResult = string.Empty;
|
|||
|
|
|
|||
|
|
new Thread(delegate()
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
listmoveLocModel = IBussFactory<BussMoveLoc>.Instance().GetMoveLocList(model);
|
|||
|
|
if (errText != string.Empty)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
SystemCommon.ShowInfoMessageBox(errText);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
this.Invoke(new MethodInvoker(delegate()
|
|||
|
|
{
|
|||
|
|
if (errText == string.Empty)
|
|||
|
|
{
|
|||
|
|
if (listmoveLocModel.Count > 0)
|
|||
|
|
{
|
|||
|
|
if (string.IsNullOrEmpty(moveLocModel.MOVELOC_ID))
|
|||
|
|
{
|
|||
|
|
moveLocModel = listmoveLocModel[0];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//lueStorage.Properties.KeyValue = moveLocModel.STORAGE_ID;
|
|||
|
|
//lueStorage_EditValueChanged(null, null);
|
|||
|
|
bsMoveLocEdit.DataSource = moveLocModel;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
moveLocModel = new MoveLocModel();
|
|||
|
|
//SystemCommon.ShowInfoMessageBox("未找到移位单");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bindMoveLocTab(moveLocModel);
|
|||
|
|
bsMoveLoc.DataSource = listmoveLocModel;
|
|||
|
|
GVMoveLoc.RefreshData();
|
|||
|
|
|
|||
|
|
if (frmButtonItem.ContainsKey("Save")) { frmButtonItem["Save"].Enabled = false; }
|
|||
|
|
if (frmButtonItem.ContainsKey("Remark")) { frmButtonItem["Remark"].Enabled = false; }
|
|||
|
|
if (frmButtonItem.ContainsKey("Del")) { frmButtonItem["Del"].Enabled = false; }
|
|||
|
|
if (frmButtonItem.ContainsKey("AddTab")) { frmButtonItem["AddTab"].Enabled = false; }
|
|||
|
|
if (frmButtonItem.ContainsKey("ChooseGoods")) { frmButtonItem["ChooseGoods"].Enabled = false; }
|
|||
|
|
//frmButtonItem["choose"].Enabled = false;
|
|||
|
|
}
|
|||
|
|
}));
|
|||
|
|
|
|||
|
|
}).Start();
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 绑定明细
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="moveLocModel"></param>
|
|||
|
|
public void bindMoveLocTab(MoveLocModel moveLocModel)
|
|||
|
|
{
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
listMoveLocTabModel = new List<MoveLocTabModel>();
|
|||
|
|
MoveLocTabModel queryTab = new MoveLocTabModel();
|
|||
|
|
queryTab.MOVELOC_ID = moveLocModel.MOVELOC_ID;
|
|||
|
|
if (moveLocModel.STATE == "2" || moveLocModel.STATE == "3")
|
|||
|
|
{
|
|||
|
|
queryTab.SORT = 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
string strMoveLocTabList = string.Empty;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
// listMoveLocTabModel = IBussFactory<BussMoveLoc>.Instance().GetMoveLocList(queryTab);
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
if (errText == string.Empty)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
#region 校正库存数量
|
|||
|
|
BindMIStock();
|
|||
|
|
foreach (var item in listMoveLocTabModel)
|
|||
|
|
{
|
|||
|
|
if (string.IsNullOrEmpty(item.GOODS_ID) || string.IsNullOrEmpty(item.OLD_LOC_ID) || string.IsNullOrEmpty(item.PUTIN_ID) || string.IsNullOrEmpty(moveLocModel.AREA_ID))
|
|||
|
|
{
|
|||
|
|
continue;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
MIStockModel mi = MIStockList.Find(p => p.GOODS_ID == item.GOODS_ID && p.LOCATION_ID == item.OLD_LOC_ID && p.PUTIN_ID == item.PUTIN_ID && p.AREA_ID == moveLocModel.AREA_ID);
|
|||
|
|
if (mi != null) {
|
|||
|
|
item.LOC_NUM = mi.ABLE_NUM + item.PLAN_NUM;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
List<MIStockModel> listM = MIStockList.FindAll(p => p.GOODS_ID == item.GOODS_ID && p.AREA_ID == moveLocModel.AREA_ID);
|
|||
|
|
decimal sum = 0;
|
|||
|
|
foreach (var m in listM)
|
|||
|
|
{
|
|||
|
|
sum += m.ABLE_NUM;
|
|||
|
|
}
|
|||
|
|
item.MISTOCK_NUM = sum + item.PLAN_NUM;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
bsMoveLocTab.DataSource = listMoveLocTabModel;
|
|||
|
|
GVMoveLocTab.RefreshData();
|
|||
|
|
|
|||
|
|
//xtraTabControl1.SelectedTabPageIndex = 0;
|
|||
|
|
//if (frmButtonItem.ContainsKey("Search")) { frmButtonItem["Search"].Enabled = true;}
|
|||
|
|
//if (frmButtonItem.ContainsKey("Add")) { frmButtonItem["Add"].Enabled = true;}
|
|||
|
|
//if (frmButtonItem.ContainsKey("Edit")) { frmButtonItem["Edit"].Enabled = true; }
|
|||
|
|
|
|||
|
|
//if (frmButtonItem.ContainsKey("Finish")) { frmButtonItem["Finish"].Enabled = true;}
|
|||
|
|
//if (frmButtonItem.ContainsKey("Close")) { frmButtonItem["Close"].Enabled = true;}
|
|||
|
|
//if (frmButtonItem.ContainsKey("Confirm")) { frmButtonItem["Confirm"].Enabled = true;}
|
|||
|
|
|
|||
|
|
xtraTabPage2.Text = "移位商品明细-" + moveLocModel.MOVELOC_ID;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox(errText);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 条件查询
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
public override void Search()
|
|||
|
|
{
|
|||
|
|
xtraTabControl1.Focus();
|
|||
|
|
|
|||
|
|
if (!string.IsNullOrEmpty(moveLocModel.STATE) && decimal.Parse(moveLocModel.STATE) >= 2)//如果已完成、关闭 变背景色、禁止修改
|
|||
|
|
{
|
|||
|
|
if (frmButtonItem.ContainsKey("Add")) { frmButtonItem["Add"].Enabled = false; }
|
|||
|
|
if (frmButtonItem.ContainsKey("Print")) { frmButtonItem["Print"].Enabled = false; }
|
|||
|
|
if (frmButtonItem.ContainsKey("Edit")) { frmButtonItem["Edit"].Enabled = false; }
|
|||
|
|
|
|||
|
|
if (frmButtonItem.ContainsKey("Close")) { frmButtonItem["Close"].Enabled = false;}
|
|||
|
|
if (frmButtonItem.ContainsKey("Confirm")) { frmButtonItem["Confirm"].Enabled = false;}
|
|||
|
|
if (frmButtonItem.ContainsKey("Finish")) { frmButtonItem["Finish"].Enabled = false;}
|
|||
|
|
|
|||
|
|
GVMoveLoc.Appearance.Row.BackColor = Color.FromArgb(190, 180, 160);
|
|||
|
|
GVMoveLoc.Appearance.EvenRow.BackColor = Color.FromArgb(190, 180, 160);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (frmButtonItem.ContainsKey("Add")) { frmButtonItem["Add"].Enabled = true;}
|
|||
|
|
if (frmButtonItem.ContainsKey("Edit")) { frmButtonItem["Edit"].Enabled = true; }
|
|||
|
|
if (frmButtonItem.ContainsKey("Print")) { frmButtonItem["Print"].Enabled = true; }
|
|||
|
|
if (frmButtonItem.ContainsKey("Close")) { frmButtonItem["Close"].Enabled = true;}
|
|||
|
|
if (frmButtonItem.ContainsKey("Confirm")) { frmButtonItem["Confirm"].Enabled = true;}
|
|||
|
|
if (frmButtonItem.ContainsKey("Finish")) { frmButtonItem["Finish"].Enabled = true;}
|
|||
|
|
|
|||
|
|
GVMoveLoc.Appearance.Row.BackColor = Color.White;
|
|||
|
|
GVMoveLoc.Appearance.EvenRow.BackColor = Color.White;
|
|||
|
|
}
|
|||
|
|
bindGrid(moveLocModel);
|
|||
|
|
GVMoveLoc_FocusedRowChanged(null, null);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// Tab页改,改通用查询Model
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void xtraTabControl1_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (xtraTabControl1.SelectedTabPageIndex == 0)
|
|||
|
|
{
|
|||
|
|
FrmSelectModle = new MoveLocModel();
|
|||
|
|
if (flag == 0 || flag == 1) {
|
|||
|
|
//frmButtonItem["choose"].Enabled = true;
|
|||
|
|
if (frmButtonItem.ContainsKey("Del")) { frmButtonItem["Del"].Enabled =false;}
|
|||
|
|
if (frmButtonItem.ContainsKey("AddTab")) { frmButtonItem["AddTab"].Enabled = false;}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (xtraTabControl1.SelectedTabPageIndex == 1)
|
|||
|
|
{
|
|||
|
|
FrmSelectModle = new MoveLocTabModel();
|
|||
|
|
if (flag == 0 || flag == 1)
|
|||
|
|
{
|
|||
|
|
//frmButtonItem["choose"].Enabled = false;
|
|||
|
|
if (frmButtonItem.ContainsKey("Del")) { frmButtonItem["Del"].Enabled = true;}
|
|||
|
|
if (frmButtonItem.ContainsKey("AddTab")) { frmButtonItem["AddTab"].Enabled = true;}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
if (flag == 0 || flag == 1)
|
|||
|
|
{
|
|||
|
|
//frmButtonItem["choose"].Enabled = true;
|
|||
|
|
if (frmButtonItem.ContainsKey("Del")) { frmButtonItem["Del"].Enabled =false;}
|
|||
|
|
if (frmButtonItem.ContainsKey("AddTab")) { frmButtonItem["AddTab"].Enabled = false;}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 通用查询
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="table"></param>
|
|||
|
|
public override void LoadListData(DataTable table)
|
|||
|
|
{
|
|||
|
|
if (xtraTabControl1.SelectedTabPageIndex == 0)
|
|||
|
|
{
|
|||
|
|
listmoveLocModel = ConvertHelper<MoveLocModel>.ConvertToList(table);
|
|||
|
|
bsMoveLoc.DataSource = listmoveLocModel;
|
|||
|
|
GVMoveLoc.RefreshData();
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
listMoveLocTabModel = ConvertHelper<MoveLocTabModel>.ConvertToList(table);
|
|||
|
|
bsMoveLocTab.DataSource = listMoveLocTabModel;
|
|||
|
|
GVMoveLocTab.RefreshData();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private decimal oldPlan = 0;//改变前的值
|
|||
|
|
private string oldLoc = string.Empty;//改变前的值
|
|||
|
|
private string unit = string.Empty;//记录原单位
|
|||
|
|
/// <summary>
|
|||
|
|
/// 计划数量改变 若未超出该库区现有数量 生成原库位 ; 新库位改变 判断是否有原库位存在,若存在 报错
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void GVMoveLocTab_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (e.RowHandle < 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
MoveLocTabModel model = GVMoveLocTab.GetFocusedRow() as MoveLocTabModel;// listMoveLocTabModel[e.RowHandle];
|
|||
|
|
|
|||
|
|
if (e.Column.Name == "colPLAN_NUM")//计划数量改变 若未超出该库区现有数量 生成原库位
|
|||
|
|
{
|
|||
|
|
decimal plan = Convert.ToDecimal(GVMoveLocTab.GetFocusedRowCellValue("PLAN_NUM"));
|
|||
|
|
string goodsID = GVMoveLocTab.GetFocusedRowCellValue("GOODS_ID").ToString();
|
|||
|
|
//decimal max = 0;
|
|||
|
|
//string maxLoc = string.Empty;
|
|||
|
|
//MIStockModel maxMIStock = new MIStockModel();
|
|||
|
|
|
|||
|
|
if (plan > decimal.Parse(GVMoveLocTab.GetFocusedRowCellValue("LOC_NUM").ToString()))
|
|||
|
|
{
|
|||
|
|
model.PLAN_NUM = oldPlan;
|
|||
|
|
oldPlan = 0;
|
|||
|
|
SystemCommon.ShowInfoMessageBox("当前库位本批次库存数不满足");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (oldPlan > 0)
|
|||
|
|
{//若修改计划数
|
|||
|
|
|
|||
|
|
//string oldLocID = GVMoveLocTab.GetFocusedRowCellValue("OLD_LOC_ID").ToString();
|
|||
|
|
//foreach (MIStockModel item in MIStockList)
|
|||
|
|
//{
|
|||
|
|
// if (item.LOCATION_ID == oldLocID && item.GOODS_ID == goodsID)
|
|||
|
|
// {
|
|||
|
|
// //p转为标准单位的数量
|
|||
|
|
// decimal p = oldPlan - plan;
|
|||
|
|
// BindUnit();
|
|||
|
|
// DataTable unitTable = lueUnits.Properties.DataSource as DataTable;
|
|||
|
|
// foreach (DataRow row in unitTable.Rows)
|
|||
|
|
// {
|
|||
|
|
// if (row[0].ToString() == model.UNIT)
|
|||
|
|
// {
|
|||
|
|
// decimal temp = decimal.Parse(row[2].ToString());
|
|||
|
|
// if (p != 0 && temp > 0)
|
|||
|
|
// {
|
|||
|
|
// p = p / temp;
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// decimal t = item.ABLE_NUM + p;
|
|||
|
|
// if (t < 0)
|
|||
|
|
// {
|
|||
|
|
// model.PLAN_NUM = oldPlan;
|
|||
|
|
// oldPlan = 0;
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("当前库位本批次库存数不满足");
|
|||
|
|
// return;
|
|||
|
|
// }
|
|||
|
|
// item.ABLE_NUM = t;
|
|||
|
|
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
}
|
|||
|
|
else if (oldPlan == 0)
|
|||
|
|
{//若原本为0
|
|||
|
|
//foreach (MIStockModel item in MIStockList)
|
|||
|
|
//{
|
|||
|
|
// if (item.GOODS_ID == goodsID)
|
|||
|
|
// {
|
|||
|
|
// //total += Convert.ToDecimal(item.ABLE_NUM);
|
|||
|
|
// if (item.ABLE_NUM > max)
|
|||
|
|
// {
|
|||
|
|
// max = Convert.ToDecimal(item.ABLE_NUM);
|
|||
|
|
// maxLoc = item.LOCATION_ID;
|
|||
|
|
// maxMIStock = item;
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (plan > model.MISTOCK_NUM)
|
|||
|
|
{//若超出该库区现有数量
|
|||
|
|
model.PLAN_NUM = oldPlan;
|
|||
|
|
oldPlan = 0;
|
|||
|
|
SystemCommon.ShowInfoMessageBox("计划数量超出该库区现有数量,请重新输入");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
////plan转为标准单位的数量
|
|||
|
|
//BindUnit();
|
|||
|
|
//DataTable unitTable = lueUnits.Properties.DataSource as DataTable;
|
|||
|
|
//decimal truePlan = plan;
|
|||
|
|
//foreach (DataRow row in unitTable.Rows)
|
|||
|
|
//{
|
|||
|
|
// if (row[0].ToString() == model.UNIT)
|
|||
|
|
// {
|
|||
|
|
// decimal temp = decimal.Parse(row[2].ToString());
|
|||
|
|
// if (plan > 0 && temp > 0)
|
|||
|
|
// {
|
|||
|
|
// plan = plan / temp;
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
//if (plan > max)//需从多个库位移动 一个原库位不够
|
|||
|
|
//{
|
|||
|
|
// MoveLocTabModel m = new MoveLocTabModel();
|
|||
|
|
// m.GOODS_ID = model.GOODS_ID;
|
|||
|
|
// m.GOODS_NAME = model.GOODS_NAME;
|
|||
|
|
// m.MOVELOC_ID = model.MOVELOC_ID;
|
|||
|
|
// //m.MOVELOC_TAB_ID = model.MOVELOC_TAB_ID;
|
|||
|
|
// m.NEW_LOC_ID = model.NEW_LOC_ID;
|
|||
|
|
// m.MISTOCK_NUM = model.MISTOCK_NUM;
|
|||
|
|
// m.UNIT = model.UNIT;
|
|||
|
|
// m.PRICE = model.PRICE;
|
|||
|
|
// m.SCALE_UNIT = model.SCALE_UNIT;
|
|||
|
|
|
|||
|
|
// //max转为所选单位的数量
|
|||
|
|
// foreach (DataRow row in unitTable.Rows)
|
|||
|
|
// {
|
|||
|
|
// if (row[0].ToString() == model.UNIT)
|
|||
|
|
// {
|
|||
|
|
// decimal temp = decimal.Parse(row[2].ToString());
|
|||
|
|
// if (max > 0 && temp > 0)
|
|||
|
|
// {
|
|||
|
|
// max = max * temp;
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// model.PLAN_NUM = max;
|
|||
|
|
// model.OLD_LOC_ID = maxLoc;
|
|||
|
|
// maxMIStock.ABLE_NUM -= max;
|
|||
|
|
|
|||
|
|
// decimal t = 0;
|
|||
|
|
// foreach (MIStockModel i in MIStockList)
|
|||
|
|
// {
|
|||
|
|
// if (i.GOODS_ID == model.GOODS_ID)
|
|||
|
|
// {
|
|||
|
|
// t += Convert.ToDecimal(i.ABLE_NUM);
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// if (t > 0) {
|
|||
|
|
// listMoveLocTabModel.Insert(e.RowHandle + 1, m);
|
|||
|
|
// bsMoveLocTab.DataSource = listMoveLocTabModel;
|
|||
|
|
// GVMoveLocTab.RefreshData();
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("要移动" + truePlan + "个商品,一个批次的库位无法满足要求");
|
|||
|
|
// }
|
|||
|
|
// ////新加的一个原库位
|
|||
|
|
// //m.PLAN_NUM = plan - max;
|
|||
|
|
//}
|
|||
|
|
//else
|
|||
|
|
//{
|
|||
|
|
// foreach (MIStockModel item in MIStockList)
|
|||
|
|
// {
|
|||
|
|
// if (item.GOODS_ID == goodsID)
|
|||
|
|
// {
|
|||
|
|
// if (plan <= item.ABLE_NUM)
|
|||
|
|
// {
|
|||
|
|
// model.OLD_LOC_ID = item.LOCATION_ID;//从该库位移动
|
|||
|
|
// item.ABLE_NUM -= plan;
|
|||
|
|
// break;
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
}
|
|||
|
|
if (!string.IsNullOrEmpty(model.NEW_LOC_ID)) {
|
|||
|
|
//判断库位容积是否充足
|
|||
|
|
bool planNum = false;
|
|||
|
|
planNum = ChargeLoc(model);
|
|||
|
|
if (planNum)
|
|||
|
|
{
|
|||
|
|
if (DialogResult.No == SystemCommon.ShowMessageBoxResult("所选新库位剩余容积不足,确定放" + model.PLAN_NUM + "个吗"))
|
|||
|
|
{
|
|||
|
|
model.PLAN_NUM = oldPlan;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
if (e.Column.Name == "colNEW_LOC_ID")
|
|||
|
|
{
|
|||
|
|
if (model.PLAN_NUM != 0) {
|
|||
|
|
//判断库位容积是否充足
|
|||
|
|
bool planNum = false;
|
|||
|
|
planNum = ChargeLoc(model);
|
|||
|
|
if (planNum)
|
|||
|
|
{
|
|||
|
|
if (DialogResult.No == SystemCommon.ShowMessageBoxResult("所选新库位剩余容积不足,确定放到该库位吗"))
|
|||
|
|
{
|
|||
|
|
model.NEW_LOC_ID = oldLoc;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
if (e.Column.Name == "colUNIT")
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
DataTable dt = lueUnits.DataSource as DataTable;
|
|||
|
|
decimal oldUnit = 0;
|
|||
|
|
decimal newUnit = 0;
|
|||
|
|
foreach (DataRow row in dt.Rows)
|
|||
|
|
{
|
|||
|
|
if (row[0].ToString() == unit)
|
|||
|
|
{
|
|||
|
|
oldUnit = decimal.Parse(row[2].ToString());
|
|||
|
|
}
|
|||
|
|
if (row[0].ToString() == GVMoveLocTab.GetFocusedRowCellValue("UNIT").ToString())
|
|||
|
|
{
|
|||
|
|
newUnit = decimal.Parse(row[2].ToString());
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
foreach (MoveLocTabModel item in listMoveLocTabModel)
|
|||
|
|
{
|
|||
|
|
if (item.GOODS_ID == model.GOODS_ID)
|
|||
|
|
{
|
|||
|
|
if (item.MISTOCK_NUM != 0 && oldUnit != 0)
|
|||
|
|
{
|
|||
|
|
item.MISTOCK_NUM = item.MISTOCK_NUM / oldUnit * newUnit;
|
|||
|
|
}
|
|||
|
|
if (item.LOC_NUM != 0 && oldUnit != 0)
|
|||
|
|
{
|
|||
|
|
item.LOC_NUM = item.LOC_NUM / oldUnit * newUnit;
|
|||
|
|
}
|
|||
|
|
if (item.PLAN_NUM != 0 && oldUnit != 0)
|
|||
|
|
{
|
|||
|
|
item.PLAN_NUM = item.PLAN_NUM / oldUnit * newUnit;
|
|||
|
|
}
|
|||
|
|
if (item.REAL_NUM != 0 && oldUnit != 0)
|
|||
|
|
{
|
|||
|
|
item.REAL_NUM = item.REAL_NUM / oldUnit * newUnit;
|
|||
|
|
}
|
|||
|
|
item.UNIT = GVMoveLocTab.GetFocusedRowCellValue("UNIT").ToString();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
GVMoveLocTab.RefreshData();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 计划数量将要改变 将改变前的值记录
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void GVMoveLocTab_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (e.RowHandle < 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (e.Column.Name == "colPLAN_NUM")//计划数量改变
|
|||
|
|
{
|
|||
|
|
oldPlan = Convert.ToDecimal(GVMoveLocTab.GetFocusedRowCellValue("PLAN_NUM"));
|
|||
|
|
}
|
|||
|
|
if (e.Column.Name == "colNEW_LOC_ID")//新库位改变
|
|||
|
|
{
|
|||
|
|
if (GVMoveLocTab.GetFocusedRowCellValue("NEW_LOC_ID") == null)
|
|||
|
|
{
|
|||
|
|
oldLoc = string.Empty;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
oldLoc = GVMoveLocTab.GetFocusedRowCellValue("NEW_LOC_ID").ToString();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (GVMoveLocTab.GetFocusedRowCellValue("UNIT") != null)
|
|||
|
|
{
|
|||
|
|
unit = GVMoveLocTab.GetFocusedRowCellValue("UNIT").ToString();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#region 改变仓库 库区变 库区变后 商品列表变、 新库位变
|
|||
|
|
/// <summary>
|
|||
|
|
/// 改变仓库后 库区只显示该仓库的所有库区
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void lueStorage_EditValueChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
//!string.IsNullOrEmpty(lueStorage.Properties.ValueMember) &&
|
|||
|
|
if (lueStorage.Properties.KeyMember != null && !string.IsNullOrEmpty(lueStorage.Properties.KeyMember.ToString()))
|
|||
|
|
{
|
|||
|
|
//绑定库区数据
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
|
|||
|
|
StorageAreaModel storageAreaModel = new StorageAreaModel();
|
|||
|
|
storageAreaModel.STORAGE_ID = lueStorage.Properties.KeyMember.ToString();
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
List<StorageAreaModel> dctModel = new List<StorageAreaModel>();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
dctModel = IBussFactory<BussStorageArea>.Instance().GetAreaInfoDS(storageAreaModel);
|
|||
|
|
if(dctModel!=null)
|
|||
|
|
{
|
|||
|
|
lueArea.Properties.DataSource = dctModel;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void BindMIStock() {
|
|||
|
|
/*获取某一库区的所有商品*/
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
string strResult = string.Empty;
|
|||
|
|
string strResult2 = string.Empty;
|
|||
|
|
MIStockModel MIStockModel = new MIStockModel();
|
|||
|
|
MIStockModel.AREA_ID = moveLocModel.AREA_ID;// lueArea.Properties.KeyValue.ToString();
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
MIStockList = IBussFactory<BussMIStock>.Instance().GetMIStockList(MIStockModel);
|
|||
|
|
//strResult2 = WebLockConfig.Instance.WebMIStock.GetGoodsListByMIStock(strParameter, ref errText);
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
if (errText == string.Empty)
|
|||
|
|
{
|
|||
|
|
if (strResult != null)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
MIStockList.RemoveAll(p => p.SHELVES_NUM == 0);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
MIStockList = new List<MIStockModel>();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//listJWGoodsInfoModel = Newtonsoft.Json.JsonConvert.DeserializeObject<List<JWGoodsInfoModel>>(strResult2);//绑定商品数据
|
|||
|
|
//bsGoodsInfo.DataSource = listJWGoodsInfoModel;
|
|||
|
|
//GVGoodsInfo.RefreshData();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox(errText);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
string area = string.Empty;
|
|||
|
|
/// <summary>
|
|||
|
|
/// 库区改变后,改变商品列表 改变新库位
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void lueArea_EditValueChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (lueArea.Properties.KeyMember != null && !string.IsNullOrEmpty(lueArea.Properties.KeyMember.ToString()) && (area != lueArea.Properties.KeyMember.ToString()))
|
|||
|
|
{
|
|||
|
|
moveLocModel.AREA_ID = lueArea.Properties.KeyMember.ToString();
|
|||
|
|
BindMIStock();
|
|||
|
|
|
|||
|
|
/*改变商品选择条件*/
|
|||
|
|
ctrlDicGoods.SqlStr = "where goods_id in (select goods_id from t_mi_stock where AREA_ID = '" + moveLocModel.AREA_ID + "' and SHELVES_NUM-OCCUPY_NUM != '0')";
|
|||
|
|
|
|||
|
|
dicMove.SqlStr = " left join T_BASE_USERAREA on t_Base_UserInfo.user_id = T_BASE_USERAREA.user_id where T_BASE_USERAREA.WORKKIND_ID = 3 and AREA_ID = '" + moveLocModel.AREA_ID + "'";
|
|||
|
|
|
|||
|
|
/*改变新库位*/
|
|||
|
|
//ctrlDicLoc.SqlStr = "where STORAGE_AREA_ID = '" + lueArea.Properties.KeyValue.ToString() + "'";
|
|||
|
|
////status ='0' and
|
|||
|
|
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
List<LocAreaModel> locAreaList = new List<LocAreaModel>();
|
|||
|
|
List<StorageAreaLocationModel> listStorageAreaLocationModel = new List<StorageAreaLocationModel>();
|
|||
|
|
StorageAreaLocationModel storageAreaLocationModel = new StorageAreaLocationModel();
|
|||
|
|
storageAreaLocationModel.STORAGE_AREA_ID = lueArea.Properties.KeyMember.ToString();
|
|||
|
|
storageAreaLocationModel.STATUS = "0";
|
|||
|
|
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
List<StorageAreaLocationModel> strResult = IBussFactory<BussStorageAreaLocation>.Instance().GetLocationInfoDS(storageAreaLocationModel, ref locAreaList);//查询
|
|||
|
|
if(strResult!=null)
|
|||
|
|
{
|
|||
|
|
lueLoc.DataSource = strResult;// Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(strResult);
|
|||
|
|
lueNewLoc.DataSource = strResult;// Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(strResult);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
listMoveLocTabModel = new List<MoveLocTabModel>();
|
|||
|
|
bsMoveLocTab.DataSource = listMoveLocTabModel;
|
|||
|
|
GVMoveLocTab.RefreshData();
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 库区将改变 记录值
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void lueArea_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
|
|||
|
|
{
|
|||
|
|
area = lueArea.Properties.KeyMember.ToString();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 按钮事件
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 增加按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public override void Add()
|
|||
|
|
{
|
|||
|
|
flag = 0;//标识增加
|
|||
|
|
//GVMoveLocTab.OptionsBehavior.Editable = true;//明细可编辑
|
|||
|
|
colNEW_LOC_ID.OptionsColumn.AllowEdit = true;
|
|||
|
|
colPLAN_NUM.OptionsColumn.AllowEdit = true;
|
|||
|
|
colREAL_NUM.OptionsColumn.AllowEdit = true;
|
|||
|
|
colUNIT.OptionsColumn.AllowEdit = true;
|
|||
|
|
//ctrlDicLoc.Enabled = true;
|
|||
|
|
|
|||
|
|
xtraTabPage2.Text = "移位单明细";
|
|||
|
|
xtraTabControl1.SelectedTabPageIndex = 0;//先填写通知单
|
|||
|
|
|
|||
|
|
txtID.Enabled = false;//编号不可用
|
|||
|
|
lueState.Enabled = false;//状态不可用
|
|||
|
|
dicConfirm.Enabled = false;//审核人不可用
|
|||
|
|
deConfirmDate.Enabled = false;
|
|||
|
|
|
|||
|
|
moveLocModel = new MoveLocModel();//清空通知单
|
|||
|
|
moveLocModel.CREATE_TIME = System.DateTime.Now;
|
|||
|
|
bsMoveLocEdit.DataSource = moveLocModel;
|
|||
|
|
dicCreate.TextBoxFlag = null;
|
|||
|
|
dicCreate.TextBoxValue = null;
|
|||
|
|
dicConfirm.TextBoxFlag = null;
|
|||
|
|
dicConfirm.TextBoxValue = null;
|
|||
|
|
dicMove.TextBoxFlag = null;
|
|||
|
|
dicMove.TextBoxValue = null;
|
|||
|
|
|
|||
|
|
listMoveLocTabModel = new List<MoveLocTabModel>();//清空明细
|
|||
|
|
bsMoveLocTab.DataSource = listMoveLocTabModel;
|
|||
|
|
GVMoveLocTab.RefreshData();
|
|||
|
|
|
|||
|
|
//GVGoodsInfo.OptionsBehavior.Editable = true;
|
|||
|
|
//ctrlDicGoods.Enabled = true;
|
|||
|
|
if (frmButtonItem.ContainsKey("ChooseGoods")) { frmButtonItem["ChooseGoods"].Enabled = true; }
|
|||
|
|
ctrlDicGoods.SqlStr = "where 0 = 1";
|
|||
|
|
//ctrlDicLoc.SqlStr = "where 0 = 1";
|
|||
|
|
lueArea.Properties.DataSource = new DataTable();
|
|||
|
|
|
|||
|
|
//状态默认未审核
|
|||
|
|
moveLocModel.STATE = "0";
|
|||
|
|
lueState.Properties.KeyMember = "0";
|
|||
|
|
|
|||
|
|
//创建人默认当前用户
|
|||
|
|
moveLocModel.CREATE_PERSON = userData.USER_ID;
|
|||
|
|
dicCreate.TextBoxFlag = userData.USER_ID;
|
|||
|
|
dicCreate.TextBoxValue = userData.NAME;
|
|||
|
|
|
|||
|
|
//时间默认当前时间
|
|||
|
|
moveLocModel.CREATE_TIME = DateTime.Now;
|
|||
|
|
deCreateDate.DateTime = DateTime.Now;
|
|||
|
|
moveLocModel.CONFIRM_TIME = DateTime.Now;
|
|||
|
|
deConfirmDate.DateTime = DateTime.Now;
|
|||
|
|
moveLocModel.MOVE_TIME = DateTime.Now;
|
|||
|
|
deMoveDate.DateTime = DateTime.Now;
|
|||
|
|
|
|||
|
|
//仓库默认登录人所在仓库
|
|||
|
|
moveLocModel.STORAGE_ID = (lueStorage.Properties.DataSource as List<RoleStorageModel>)[0].STORAGE_ID;
|
|||
|
|
lueStorage.EditValue = moveLocModel.STORAGE_ID;
|
|||
|
|
|
|||
|
|
if (frmButtonItem.ContainsKey("Search")) { frmButtonItem["Search"].Enabled = false;}
|
|||
|
|
if (frmButtonItem.ContainsKey("Add")) { frmButtonItem["Add"].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; }
|
|||
|
|
//frmButtonItem["choose"].Enabled = true;
|
|||
|
|
|
|||
|
|
listSKU = new List<SKUTabModel>();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 编辑按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public override void Edit()
|
|||
|
|
{
|
|||
|
|
if (!frmButtonItem.ContainsKey("Edit"))
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
else if (frmButtonItem["Edit"].Enabled == false)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (isSKU)
|
|||
|
|
{
|
|||
|
|
//SKUTabModel querySKUTab = new SKUTabModel();
|
|||
|
|
//querySKUTab.DOCCTNUMBER = moveLocModel.MOVELOC_ID;
|
|||
|
|
//string strResult = string.Empty;
|
|||
|
|
//string strParameter = Newtonsoft.Json.JsonConvert.SerializeObject(querySKUTab);
|
|||
|
|
//try
|
|||
|
|
//{
|
|||
|
|
// strResult = WebLockConfig.Instance.WebSKUTab.GetSKUTab(strParameter);
|
|||
|
|
|
|||
|
|
// listSKU = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SKUTabModel>>(strResult);
|
|||
|
|
//}
|
|||
|
|
//catch (Exception)
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
//}
|
|||
|
|
}
|
|||
|
|
flag = 1;//标识修改
|
|||
|
|
|
|||
|
|
//GVMoveLocTab.OptionsBehavior.Editable = true;//明细可编辑
|
|||
|
|
//ctrlDicLoc.Enabled = true;
|
|||
|
|
//GVGoodsInfo.OptionsBehavior.Editable = true;
|
|||
|
|
//ctrlDicGoods.Enabled = true;
|
|||
|
|
//ctrlDicLoc.SqlStr = "where 0 = 1";
|
|||
|
|
//lueArea.Properties.DataSource = new DataTable();
|
|||
|
|
|
|||
|
|
if (moveLocModel.STATE == "1")
|
|||
|
|
{
|
|||
|
|
foreach (Control item in panelControl1.Controls)
|
|||
|
|
{
|
|||
|
|
item.Enabled = false;
|
|||
|
|
}
|
|||
|
|
txtRemark.Enabled = true;
|
|||
|
|
dicMove.Enabled = true;
|
|||
|
|
deMoveDate.Enabled = true;
|
|||
|
|
lueType.Enabled = true;
|
|||
|
|
colNEW_LOC_ID.OptionsColumn.AllowEdit = false;
|
|||
|
|
colPLAN_NUM.OptionsColumn.AllowEdit = false;
|
|||
|
|
colREAL_NUM.OptionsColumn.AllowEdit = false;
|
|||
|
|
colUNIT.OptionsColumn.AllowEdit = false;
|
|||
|
|
if (frmButtonItem.ContainsKey("ChooseGoods")) { frmButtonItem["ChooseGoods"].Enabled = false; }
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
txtID.Enabled = false;//编号不可用
|
|||
|
|
lueState.Enabled = false;//状态不可用
|
|||
|
|
dicConfirm.Enabled = false;//审核人不可用
|
|||
|
|
deConfirmDate.Enabled = false;
|
|||
|
|
dicCreate.Enabled = false;
|
|||
|
|
deCreateDate.Enabled = false;
|
|||
|
|
colNEW_LOC_ID.OptionsColumn.AllowEdit = true;
|
|||
|
|
colPLAN_NUM.OptionsColumn.AllowEdit = true;
|
|||
|
|
colREAL_NUM.OptionsColumn.AllowEdit = true;
|
|||
|
|
colUNIT.OptionsColumn.AllowEdit = true;
|
|||
|
|
if (frmButtonItem.ContainsKey("ChooseGoods")) { frmButtonItem["ChooseGoods"].Enabled = true; }
|
|||
|
|
ctrlDicGoods.SqlStr = "where 0 = 1";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (frmButtonItem.ContainsKey("Search")) { frmButtonItem["Search"].Enabled = false;}
|
|||
|
|
if (frmButtonItem.ContainsKey("Add")) { frmButtonItem["Add"].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; }
|
|||
|
|
//frmButtonItem["choose"].Enabled = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 完成按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Finish()
|
|||
|
|
{
|
|||
|
|
if (moveLocModel.STATE != "1") {
|
|||
|
|
SystemCommon.ShowInfoMessageBox("只有状态为已审核的移位单才可以被完成");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
flag = 2;//标识完成
|
|||
|
|
|
|||
|
|
foreach (Control item in panelControl1.Controls)
|
|||
|
|
{
|
|||
|
|
item.Enabled = false;
|
|||
|
|
}
|
|||
|
|
txtRemark.Enabled = true;
|
|||
|
|
//dicMove.Enabled = true;
|
|||
|
|
deMoveDate.Enabled = true;
|
|||
|
|
lueType.Enabled = true;
|
|||
|
|
|
|||
|
|
moveLocModel.STATE = "2";
|
|||
|
|
lueState.Properties.KeyMember = "2";
|
|||
|
|
moveLocModel.MOVE_PERSON = userData.USER_ID;
|
|||
|
|
dicMove.TextBoxFlag = userData.USER_ID;
|
|||
|
|
dicMove.TextBoxValue = userData.NAME;
|
|||
|
|
moveLocModel.MOVE_TIME = System.DateTime.Now;
|
|||
|
|
deMoveDate.DateTime = System.DateTime.Now;
|
|||
|
|
|
|||
|
|
//GVMoveLocTab.OptionsBehavior.Editable = true;//明细可编辑
|
|||
|
|
colNEW_LOC_ID.OptionsColumn.AllowEdit = true;
|
|||
|
|
//colPLAN_NUM.OptionsColumn.AllowEdit = true;
|
|||
|
|
colREAL_NUM.OptionsColumn.AllowEdit = true;
|
|||
|
|
colUNIT.OptionsColumn.AllowEdit = true;
|
|||
|
|
//ctrlDicLoc.Enabled = true;
|
|||
|
|
colPLAN_NUM.OptionsColumn.AllowEdit = false;
|
|||
|
|
//colNEW_LOC_ID.OptionsColumn.AllowEdit = false;
|
|||
|
|
|
|||
|
|
if (frmButtonItem.ContainsKey("Search")) { frmButtonItem["Search"].Enabled = false;}
|
|||
|
|
if (frmButtonItem.ContainsKey("Add")) { frmButtonItem["Add"].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; }
|
|||
|
|
//frmButtonItem["choose"].Enabled = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 刷新按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public override void Refresh()
|
|||
|
|
{
|
|||
|
|
if (frmButtonItem.ContainsKey("Save") && frmButtonItem["Save"].Enabled == true && DialogResult.OK != SystemCommon.ShowMessageBoxResult("确定放弃正在编辑的数据?"))
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
flag = -1;//标识为非增加非修改
|
|||
|
|
|
|||
|
|
ctrlDicGoods.SqlStr = "where 0 = 1";
|
|||
|
|
//ctrlDicLoc.SqlStr = "where 0 = 1";
|
|||
|
|
|
|||
|
|
string ID = string.Empty;
|
|||
|
|
ID = moveLocModel.MOVELOC_ID;
|
|||
|
|
|
|||
|
|
moveLocModel = new MoveLocModel();
|
|||
|
|
bindGrid(moveLocModel);//刷新数据
|
|||
|
|
xtraTabControl1.SelectedTabPageIndex = 0;//到移位单页
|
|||
|
|
|
|||
|
|
foreach (Control item in panelControl1.Controls)
|
|||
|
|
{
|
|||
|
|
item.Enabled = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//GVMoveLocTab.OptionsBehavior.Editable = false;//明细可编辑
|
|||
|
|
colNEW_LOC_ID.OptionsColumn.AllowEdit = false;
|
|||
|
|
colPLAN_NUM.OptionsColumn.AllowEdit = false;
|
|||
|
|
colREAL_NUM.OptionsColumn.AllowEdit = false;
|
|||
|
|
colUNIT.OptionsColumn.AllowEdit = false;
|
|||
|
|
//ctrlDicLoc.Enabled = false;
|
|||
|
|
//ctrlDicLoc.TextBoxValue = null;
|
|||
|
|
//GVGoodsInfo.OptionsBehavior.Editable = false;
|
|||
|
|
//ctrlDicGoods.Enabled = false;
|
|||
|
|
if (frmButtonItem.ContainsKey("ChooseGoods")) { frmButtonItem["ChooseGoods"].Enabled = false; }
|
|||
|
|
ctrlDicGoods.TextBoxValue = null;
|
|||
|
|
colPLAN_NUM.OptionsColumn.AllowEdit = true;
|
|||
|
|
//colNEW_LOC_ID.OptionsColumn.AllowEdit = true;
|
|||
|
|
|
|||
|
|
//lueStorage_EditValueChanged(null, null);
|
|||
|
|
//ClearGoodsGrid();
|
|||
|
|
|
|||
|
|
if (frmButtonItem.ContainsKey("Search")) { frmButtonItem["Search"].Enabled = true;}
|
|||
|
|
if (frmButtonItem.ContainsKey("Add")) { frmButtonItem["Add"].Enabled = true; }
|
|||
|
|
if (frmButtonItem.ContainsKey("Print")) { frmButtonItem["Print"].Enabled = true; }
|
|||
|
|
if (frmButtonItem.ContainsKey("Edit")) { frmButtonItem["Edit"].Enabled = true; }
|
|||
|
|
|
|||
|
|
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;}
|
|||
|
|
|
|||
|
|
GVMoveLoc.Appearance.Row.BackColor = Color.White;
|
|||
|
|
GVMoveLoc.Appearance.EvenRow.BackColor = Color.White;
|
|||
|
|
|
|||
|
|
//GVMoveLoc.FocusedRowHandle = 0;//选中行变为第一行(一般刷新GridView后调用)
|
|||
|
|
GVMoveLoc.FocusedRowHandle = listmoveLocModel.FindIndex(p => p.MOVELOC_ID == ID);
|
|||
|
|
GVMoveLoc_FocusedRowChanged(null, null);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 增加移位明细
|
|||
|
|
/// </summary>
|
|||
|
|
public override void AddTab()
|
|||
|
|
{
|
|||
|
|
if (GVMoveLocTab.FocusedRowHandle < 0) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
MoveLocTabModel mltM = listMoveLocTabModel[GVMoveLocTab.FocusedRowHandle];
|
|||
|
|
MoveLocTabModel m = new MoveLocTabModel();
|
|||
|
|
m.GOODS_ID = mltM.GOODS_ID;
|
|||
|
|
m.GOODS_NAME = mltM.GOODS_NAME;
|
|||
|
|
m.MISTOCK_NUM = mltM.MISTOCK_NUM;
|
|||
|
|
m.MOVELOC_ID = mltM.MOVELOC_ID;
|
|||
|
|
m.PRICE = mltM.PRICE;
|
|||
|
|
m.SCALE_UNIT = mltM.SCALE_UNIT;
|
|||
|
|
m.UNIT = mltM.UNIT;
|
|||
|
|
|
|||
|
|
listMoveLocTabModel.Insert(GVMoveLocTab.FocusedRowHandle + 1, m);
|
|||
|
|
|
|||
|
|
bsMoveLocTab.DataSource = listMoveLocTabModel;
|
|||
|
|
GVMoveLocTab.RefreshData();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 保存
|
|||
|
|
/// </summary>
|
|||
|
|
public override void Save() {
|
|||
|
|
xtraTabControl1.Focus();
|
|||
|
|
|
|||
|
|
/*验证*/
|
|||
|
|
|
|||
|
|
if (string.IsNullOrEmpty(lueState.Text))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请选择状态");
|
|||
|
|
xtraTabControl1.SelectedTabPageIndex = 0;
|
|||
|
|
lueState.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (string.IsNullOrEmpty(lueStorage.Text))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请选择仓库");
|
|||
|
|
xtraTabControl1.SelectedTabPageIndex = 0;
|
|||
|
|
lueStorage.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (string.IsNullOrEmpty(lueArea.Text))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请选择库区");
|
|||
|
|
xtraTabControl1.SelectedTabPageIndex = 0;
|
|||
|
|
lueArea.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (listMoveLocTabModel.Count > 0)
|
|||
|
|
{
|
|||
|
|
//验证数量
|
|||
|
|
decimal totalPlanAmount = 0;
|
|||
|
|
decimal totalRealAmount = 0;
|
|||
|
|
|
|||
|
|
foreach (MoveLocTabModel item in listMoveLocTabModel)
|
|||
|
|
{
|
|||
|
|
decimal plan_amount = -1;
|
|||
|
|
plan_amount = Convert.ToDecimal(item.PLAN_NUM);
|
|||
|
|
decimal real_amount = -1;
|
|||
|
|
real_amount = Convert.ToDecimal(item.REAL_NUM);
|
|||
|
|
|
|||
|
|
if (plan_amount > 0)//如果大于0
|
|||
|
|
{
|
|||
|
|
totalPlanAmount += plan_amount;//统计数量
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("计划移位数量必须大于0");
|
|||
|
|
xtraTabControl1.SelectedTabPageIndex = 1;
|
|||
|
|
GVMoveLocTab.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//if (flag == 2) {
|
|||
|
|
// if (real_amount <= 0){
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("实际移位数量必须大于0");
|
|||
|
|
// xtraTabControl1.SelectedTabPageIndex = 1;
|
|||
|
|
// GVMoveLocTab.Focus();
|
|||
|
|
// return;
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
totalRealAmount += real_amount;//统计数量
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
moveLocModel.TOTAL_PLAN_NUM = totalPlanAmount;//总计划数量
|
|||
|
|
moveLocModel.TOTAL_REAL_NUM = totalRealAmount;//总实际数量
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请选择移位商品");
|
|||
|
|
//xtraTabControl1.SelectedTabPageIndex = 2;
|
|||
|
|
//GVGoodsInfo.Focus();
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
moveLocModel.MOVE_PERSON = dicMove.TextBoxFlag;
|
|||
|
|
|
|||
|
|
foreach (MoveLocTabModel item in listMoveLocTabModel)
|
|||
|
|
{
|
|||
|
|
if (string.IsNullOrEmpty(item.NEW_LOC_ID)) {
|
|||
|
|
SystemCommon.ShowInfoMessageBox("新库位不能为空");
|
|||
|
|
xtraTabControl1.SelectedTabPageIndex = 1;
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (item.NEW_LOC_ID == item.OLD_LOC_ID) {
|
|||
|
|
SystemCommon.ShowInfoMessageBox("新库位不能与原库位相同");
|
|||
|
|
xtraTabControl1.SelectedTabPageIndex = 1;
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (item.REAL_NUM > item.PLAN_NUM)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("实际移位数不能大于计划");
|
|||
|
|
xtraTabControl1.SelectedTabPageIndex = 1;
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
//if (flag == 2) { //完成状态 实际数必须大于0
|
|||
|
|
// if (item.REAL_NUM <= 0)
|
|||
|
|
// {
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("实际移位数必须大于0");
|
|||
|
|
// xtraTabControl1.SelectedTabPageIndex = 1;
|
|||
|
|
// return;
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
if (item.NEW_LOC_ID != null && listMoveLocTabModel.FindAll(i => i.GOODS_ID == item.GOODS_ID && i.NEW_LOC_ID == item.NEW_LOC_ID).Count > 1)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("同一商品新库位不能相同");
|
|||
|
|
xtraTabControl1.SelectedTabPageIndex = 1;
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (isSKU)
|
|||
|
|
{
|
|||
|
|
//判断是否都选了商品规格 数量是否相同
|
|||
|
|
foreach (var item in listMoveLocTabModel)
|
|||
|
|
{
|
|||
|
|
decimal i = 0;
|
|||
|
|
List<SKUTabModel> listSKUTab = listSKU.FindAll(p => p.GOODS_ID == item.GOODS_ID);
|
|||
|
|
foreach (var ite in listSKUTab)
|
|||
|
|
{
|
|||
|
|
i += ite.SKU_NUM;
|
|||
|
|
}
|
|||
|
|
if (item.PLAN_NUM != i)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请为"+item.GOODS_NAME+"选择规格");
|
|||
|
|
xtraTabControl1.SelectedTabPageIndex = 1;
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (flag == 0)
|
|||
|
|
{ //增加
|
|||
|
|
|
|||
|
|
/*增加*/
|
|||
|
|
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
errText = IBussFactory<BussMoveLoc>.Instance().InsertMoveLocAndTab(moveLocModel, listMoveLocTabModel, listSKU);
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
if (string.IsNullOrEmpty(errText))//如果增加成功
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("增加成功" + errText);
|
|||
|
|
//GVMoveLocTab.OptionsBehavior.Editable = false;//明细可编辑
|
|||
|
|
colNEW_LOC_ID.OptionsColumn.AllowEdit = false;
|
|||
|
|
colPLAN_NUM.OptionsColumn.AllowEdit = false;
|
|||
|
|
colREAL_NUM.OptionsColumn.AllowEdit = false;
|
|||
|
|
colUNIT.OptionsColumn.AllowEdit = false;
|
|||
|
|
//ctrlDicLoc.Enabled = false;
|
|||
|
|
if (frmButtonItem.ContainsKey("Save")) { frmButtonItem["Save"].Enabled = false; }
|
|||
|
|
Refresh();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("增加失败" + errText);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (flag == 1)//修改
|
|||
|
|
{
|
|||
|
|
/*修改*/
|
|||
|
|
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
errText = IBussFactory<BussMoveLoc>.Instance().UpdateMoveLocAndTab(moveLocModel, listMoveLocTabModel, listSKU);
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
if (string.IsNullOrEmpty(errText))//如果修改成功
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("修改成功");
|
|||
|
|
//GVMoveLocTab.OptionsBehavior.Editable = false;//明细可编辑
|
|||
|
|
colNEW_LOC_ID.OptionsColumn.AllowEdit = false;
|
|||
|
|
colPLAN_NUM.OptionsColumn.AllowEdit = false;
|
|||
|
|
colREAL_NUM.OptionsColumn.AllowEdit = false;
|
|||
|
|
colUNIT.OptionsColumn.AllowEdit = false;
|
|||
|
|
//ctrlDicLoc.Enabled = false;
|
|||
|
|
if (frmButtonItem.ContainsKey("Save")) { frmButtonItem["Save"].Enabled = false; }
|
|||
|
|
Refresh();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("修改失败" + errText);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (flag == 2)//完成
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
errText =IBussFactory<BussMoveLoc>.Instance().UpdateMoveLocAndTab(moveLocModel, listMoveLocTabModel, listSKU);
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (string.IsNullOrEmpty(errText))//如果修改成功
|
|||
|
|
{
|
|||
|
|
foreach (Control item in panelControl1.Controls)
|
|||
|
|
{
|
|||
|
|
item.Enabled = true;
|
|||
|
|
}
|
|||
|
|
//放到备份表
|
|||
|
|
errText = string.Empty;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
// errText =IBussFactory<BussMoveLoc>.Instance().MoveMoveLocAndTabIntoBack(strModel);
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (!string.IsNullOrEmpty(errText))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("放到备份表失败" + errText);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//GVMoveLocTab.OptionsBehavior.Editable = false;//明细可编辑
|
|||
|
|
colNEW_LOC_ID.OptionsColumn.AllowEdit = false;
|
|||
|
|
colPLAN_NUM.OptionsColumn.AllowEdit = false;
|
|||
|
|
colREAL_NUM.OptionsColumn.AllowEdit = false;
|
|||
|
|
colUNIT.OptionsColumn.AllowEdit = false;
|
|||
|
|
//ctrlDicLoc.Enabled = false;
|
|||
|
|
if (frmButtonItem.ContainsKey("Save")) { frmButtonItem["Save"].Enabled = false; }
|
|||
|
|
Refresh();
|
|||
|
|
SystemCommon.ShowInfoMessageBox("完成成功");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("完成失败" + errText);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 关闭按钮,关闭一条移位单
|
|||
|
|
/// </summary>
|
|||
|
|
public void Close()
|
|||
|
|
{
|
|||
|
|
if (GVMoveLoc.SelectedRowsCount > 0)
|
|||
|
|
{
|
|||
|
|
if (DialogResult.OK == SystemCommon.ShowMessageBoxResult("确定关闭"))
|
|||
|
|
{
|
|||
|
|
moveLocModel.STATE = "3";
|
|||
|
|
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
errText = IBussFactory<BussMoveLoc>.Instance().MoveMoveLocAndTabIntoBack(moveLocModel);
|
|||
|
|
}
|
|||
|
|
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 (GVMoveLocTab.SelectedRowsCount > 0)
|
|||
|
|
{
|
|||
|
|
if (DialogResult.OK == SystemCommon.ShowMessageBoxResult("确定删除"))
|
|||
|
|
{
|
|||
|
|
MoveLocTabModel model = new MoveLocTabModel();
|
|||
|
|
model = GVMoveLocTab.GetFocusedRow() as MoveLocTabModel;
|
|||
|
|
listMoveLocTabModel.Remove(model);
|
|||
|
|
GVMoveLocTab.RefreshData();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
SystemCommon.ShowInfoMessageBox("您未选择移位单明细");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 清空按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public override void Clear()
|
|||
|
|
{
|
|||
|
|
moveLocModel = new MoveLocModel();
|
|||
|
|
bsMoveLocEdit.DataSource = moveLocModel;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#region 批量审核 取消审核
|
|||
|
|
/// <summary>
|
|||
|
|
/// 批量审核
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
public void Confirm()
|
|||
|
|
{
|
|||
|
|
xtraTabControl1.Focus();
|
|||
|
|
|
|||
|
|
List<MoveLocModel> listMoveLoc = new List<MoveLocModel>();//将被审核的MoveLoc集合
|
|||
|
|
|
|||
|
|
foreach (MoveLocModel item in listmoveLocModel)
|
|||
|
|
{
|
|||
|
|
//如果被选中且状态为未审核,则将其状态改为已审核
|
|||
|
|
if (item.IsCheck && item.STATE == "0")
|
|||
|
|
{
|
|||
|
|
item.STATE = "1";
|
|||
|
|
item.CONFIRM_PERSON = dicConfirm.TextBoxFlag;
|
|||
|
|
item.CONFIRM_TIME = System.DateTime.Now;
|
|||
|
|
listMoveLoc.Add(item);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (listMoveLoc.Count > 0)
|
|||
|
|
{//批量审核
|
|||
|
|
if (DialogResult.OK == SystemCommon.ShowMessageBoxResult("审核?"))
|
|||
|
|
{
|
|||
|
|
foreach (MoveLocModel item in listMoveLoc)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
errText= IBussFactory<BussMoveLoc>.Instance().UpdateMoveLocState(item);//审核
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
if (!string.IsNullOrEmpty(errText))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox(item.MOVELOC_ID + "审核失败" + errText);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
Refresh();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("您未勾选任何状态为未审核的移位单");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 双击明细编辑
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void GVMoveLocTab_DoubleClick(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (flag == -1)
|
|||
|
|
{
|
|||
|
|
Edit();
|
|||
|
|
}
|
|||
|
|
else if (isSKU)//判断是否开启了SKU
|
|||
|
|
{
|
|||
|
|
// MoveLocTabModel tab = new MoveLocTabModel();
|
|||
|
|
// tab = GVMoveLocTab.GetFocusedRow() as MoveLocTabModel;
|
|||
|
|
// FrmSKU frmSKU = new FrmSKU(tab.GOODS_ID, tab.GOODS_NAME, tab.MOVELOC_ID, tab.PLAN_NUM, listSKU.FindAll(p => p.GOODS_ID == tab.GOODS_ID));
|
|||
|
|
|
|||
|
|
// if (frmSKU.ShowDialog() == DialogResult.OK)
|
|||
|
|
// {
|
|||
|
|
// listSKU.RemoveAll(p=>p.GOODS_ID == tab.GOODS_ID);
|
|||
|
|
// listSKU.AddRange(frmSKU.list_SKUTab);
|
|||
|
|
// }
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 双击移位单
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void GVMoveLoc_DoubleClick(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
xtraTabControl1.SelectedTabPageIndex = 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 选择商品
|
|||
|
|
/// </summary>
|
|||
|
|
public override void ChooseGoods()
|
|||
|
|
{
|
|||
|
|
if (string.IsNullOrEmpty(lueArea.Text))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请先选择仓库、库区");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
ctrlDicGoods.t_dictonary_ButtonClick(null, null);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 备注
|
|||
|
|
/// </summary>
|
|||
|
|
public void Remark()
|
|||
|
|
{
|
|||
|
|
// FrmSelectRemark frmSelectRemark = new FrmSelectRemark();
|
|||
|
|
// frmSelectRemark.remarkType = "库存管理";
|
|||
|
|
// frmSelectRemark.ShowDialog();if (frmSelectRemark.remarkType != "selected") { return; }
|
|||
|
|
// txtRemark.Text = frmSelectRemark.baseRemarkDictionaryModel.CONTENT;
|
|||
|
|
// txtRemark.ForeColor = System.Drawing.ColorTranslator.FromHtml(frmSelectRemark.baseRemarkDictionaryModel.COLOR_ID);
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region CheckBox全选的实现:3事件
|
|||
|
|
private void GVMoveLoc_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (DevControlHelper.ClickGridCheckBox(this.GVMoveLoc, "IsCheck", m_status))
|
|||
|
|
{
|
|||
|
|
m_status = !m_status;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void GVMoveLoc_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (e.Column != null && e.Column.FieldName == "IsCheck")
|
|||
|
|
{
|
|||
|
|
e.Info.InnerElements.Clear();
|
|||
|
|
e.Painter.DrawObject(e.Info);
|
|||
|
|
DevControlHelper.DrawCheckBox(e, m_status);
|
|||
|
|
e.Handled = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void GVMoveLoc_DataSourceChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
GridColumn column = this.GVMoveLoc.Columns.ColumnByFieldName("IsCheck");
|
|||
|
|
if (column != null)
|
|||
|
|
{
|
|||
|
|
column.Width = 20;
|
|||
|
|
column.OptionsColumn.ShowCaption = m_status;
|
|||
|
|
column.ColumnEdit = new RepositoryItemCheckEdit();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 自定义列显示事件
|
|||
|
|
/// <summary>
|
|||
|
|
/// 自定义列显示事件
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void GVMoveLoc_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (e.Column.FieldName == "STATE")
|
|||
|
|
{
|
|||
|
|
switch (e.Value.ToString().Trim())
|
|||
|
|
{
|
|||
|
|
case "0":
|
|||
|
|
e.DisplayText = "未审核";
|
|||
|
|
break;
|
|||
|
|
case "1":
|
|||
|
|
e.DisplayText = "已审核";
|
|||
|
|
break;
|
|||
|
|
case "2":
|
|||
|
|
e.DisplayText = "已完成";
|
|||
|
|
break;
|
|||
|
|
case "3":
|
|||
|
|
e.DisplayText = "已关闭";
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
e.DisplayText = "";
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 判断库位容积是否充足
|
|||
|
|
/// <summary>
|
|||
|
|
///
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="model"></param>
|
|||
|
|
/// <returns>true:不充足 false:充足</returns>
|
|||
|
|
public bool ChargeLoc(MoveLocTabModel mode)
|
|||
|
|
{
|
|||
|
|
//plan转为标准单位的数量
|
|||
|
|
BindUnit();
|
|||
|
|
decimal plan = mode.PLAN_NUM;
|
|||
|
|
DataTable unitTable = lueUnits.DataSource as DataTable;
|
|||
|
|
foreach (DataRow row in unitTable.Rows)
|
|||
|
|
{
|
|||
|
|
if (row[0].ToString() == mode.UNIT)
|
|||
|
|
{
|
|||
|
|
decimal temp = decimal.Parse(row[2].ToString());
|
|||
|
|
if (plan > 0 && temp > 0)
|
|||
|
|
{
|
|||
|
|
plan = plan / temp;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//查询该明细商品的单位体积
|
|||
|
|
|
|||
|
|
decimal perVolu = 0;
|
|||
|
|
decimal planVolu = 0;
|
|||
|
|
decimal locVolu = 0;
|
|||
|
|
|
|||
|
|
JWGoodsInfoModel goods = new JWGoodsInfoModel();
|
|||
|
|
goods = IBussFactory<BussGoods>.Instance().GetGoodsList(mode.GOODS_ID, "", "", "")[0];
|
|||
|
|
if (goods != null)
|
|||
|
|
{
|
|||
|
|
//perVolu = goods.GVOLUME;
|
|||
|
|
|
|||
|
|
//计算调整后的占用体积
|
|||
|
|
|
|||
|
|
planVolu = mode.PLAN_NUM * perVolu;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//查询该明细库位的容积
|
|||
|
|
|
|||
|
|
StorageAreaLocationModel loc = new StorageAreaLocationModel();
|
|||
|
|
loc.LOCATION_ID = mode.NEW_LOC_ID;
|
|||
|
|
loc.STORAGE_ID = moveLocModel.STORAGE_ID;
|
|||
|
|
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
List<StorageAreaLocationModel> lis = IBussFactory<BussStorageAreaLocation>.Instance().GetLocationInfoDS(loc );
|
|||
|
|
|
|||
|
|
if (lis != null)
|
|||
|
|
{
|
|||
|
|
if (lis.Count > 0)
|
|||
|
|
{
|
|||
|
|
loc = lis[0];
|
|||
|
|
locVolu = loc.VOLUME - loc.HASVOLUME;
|
|||
|
|
|
|||
|
|
//比较
|
|||
|
|
if (locVolu >= planVolu)
|
|||
|
|
{
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return false;
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
private void BindUnit()
|
|||
|
|
{
|
|||
|
|
MoveLocTabModel moveLocTabModel = new MoveLocTabModel();
|
|||
|
|
moveLocTabModel = GVMoveLocTab.GetFocusedRow() as MoveLocTabModel;
|
|||
|
|
|
|||
|
|
if (moveLocTabModel != null && moveLocTabModel.GOODS_ID != null)
|
|||
|
|
{
|
|||
|
|
DataTable strResult = new DataTable();
|
|||
|
|
|
|||
|
|
strResult = IBussFactory<BussGoods>.Instance().GetGoodsUnit(moveLocTabModel.GOODS_ID);
|
|||
|
|
if(strResult!=null)
|
|||
|
|
{
|
|||
|
|
lueUnits.DataSource = strResult;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#region 商品选择
|
|||
|
|
/// <summary>
|
|||
|
|
/// 商品选择
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void ctrlDicGoods_Button_Click_1(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (ctrlDicGoods.SelectTable.Rows.Count == 0)
|
|||
|
|
{
|
|||
|
|
//SystemCommon.ShowInfoMessageBox("您未选择商品!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
//商品集合
|
|||
|
|
List<JWGoodsInfoModel> listJWGoodsInfoModel = ConvertHelper<JWGoodsInfoModel>.ConvertToList(ctrlDicGoods.SelectTable);
|
|||
|
|
|
|||
|
|
/*将选择的商品加入移位商品明细*/
|
|||
|
|
foreach (JWGoodsInfoModel item in listJWGoodsInfoModel)
|
|||
|
|
{
|
|||
|
|
MoveLocTabModel model = new MoveLocTabModel();
|
|||
|
|
//model.GOODS_ID = item.GOODS_ID;
|
|||
|
|
//model.GOODS_NAME = item.GOODS_NAME;
|
|||
|
|
//model.UNIT = item.UNIT;
|
|||
|
|
//model.PRICE = item.PRICE;
|
|||
|
|
//model.SCALE_UNIT = item.SCALE_UNIT;
|
|||
|
|
|
|||
|
|
//decimal total = 0;
|
|||
|
|
//foreach (MIStockModel i in MIStockList)
|
|||
|
|
//{
|
|||
|
|
// if (i.GOODS_ID == item.GOODS_ID)
|
|||
|
|
// {
|
|||
|
|
// total += Convert.ToDecimal(i.ABLE_NUM);
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
//model.MISTOCK_NUM = total;
|
|||
|
|
|
|||
|
|
if (flag == 1)
|
|||
|
|
{ //修改:给移位单编号赋值
|
|||
|
|
model.MOVELOC_ID = moveLocModel.MOVELOC_ID;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//判断该商品是否已经在移位商品明细中后添加
|
|||
|
|
bool had = false;
|
|||
|
|
foreach (MoveLocTabModel wntModel in listMoveLocTabModel)
|
|||
|
|
{
|
|||
|
|
if (wntModel.GOODS_ID == model.GOODS_ID)
|
|||
|
|
{
|
|||
|
|
had = true;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (!had)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
listMoveLocTabModel.Add(model);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (listMoveLocTabModel.Count > 0)
|
|||
|
|
{
|
|||
|
|
xtraTabControl1.SelectedTabPageIndex = 1;
|
|||
|
|
bsMoveLocTab.DataSource = listMoveLocTabModel;
|
|||
|
|
GVMoveLocTab.RefreshData();
|
|||
|
|
|
|||
|
|
//焦点置于新库位
|
|||
|
|
GVMoveLocTab.FocusedColumn = GVMoveLocTab.Columns[3];
|
|||
|
|
GVMoveLocTab.FocusedRowHandle = 0;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未选择任何商品或所选择的商品已在明细中,请重新选择");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 移位单改变,显示属于它的移位商品明细、编辑区域显示它的信息改变 根据状态 判断改行是否可选中
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void GVMoveLoc_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (listmoveLocModel.Count == 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (flag == -1) {
|
|||
|
|
moveLocModel = new MoveLocModel();
|
|||
|
|
moveLocModel = GVMoveLoc.GetFocusedRow() as MoveLocModel;
|
|||
|
|
|
|||
|
|
|
|||
|
|
bsMoveLocEdit.DataSource = moveLocModel;
|
|||
|
|
|
|||
|
|
if (string.IsNullOrEmpty(moveLocModel.CONFIRM_PERSON))
|
|||
|
|
{//审核人
|
|||
|
|
moveLocModel.CONFIRM_PERSON = userData.USER_ID;
|
|||
|
|
dicConfirm.TextBoxFlag = userData.USER_ID;
|
|||
|
|
dicConfirm.TextBoxValue = userData.NAME;
|
|||
|
|
}
|
|||
|
|
else {
|
|||
|
|
dicConfirm.TextBoxFlag = moveLocModel.CONFIRM_PERSON;
|
|||
|
|
dicConfirm.TextBoxValue = moveLocModel.CONFIRM_PERSON_NAME;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
dicCreate.TextBoxFlag = moveLocModel.CREATE_PERSON;
|
|||
|
|
dicCreate.TextBoxValue = moveLocModel.CREATE_PERSON_NAME;
|
|||
|
|
dicMove.TextBoxFlag = moveLocModel.MOVE_PERSON;
|
|||
|
|
dicMove.TextBoxValue = moveLocModel.MOVE_PERSON_NAME;
|
|||
|
|
|
|||
|
|
bindMoveLocTab(moveLocModel);
|
|||
|
|
|
|||
|
|
if (moveLocModel.STATE == "0")//未审核
|
|||
|
|
{
|
|||
|
|
GVMoveLoc.OptionsBehavior.Editable = true;//整个
|
|||
|
|
if (frmButtonItem.ContainsKey("Edit")) { frmButtonItem["Edit"].Enabled = true; }
|
|||
|
|
if (frmButtonItem.ContainsKey("Print")) { frmButtonItem["Print"].Enabled = false; }
|
|||
|
|
}
|
|||
|
|
else if (moveLocModel.STATE == "1")
|
|||
|
|
{
|
|||
|
|
GVMoveLoc.OptionsBehavior.Editable = false;//整个
|
|||
|
|
if (frmButtonItem.ContainsKey("Edit")) { frmButtonItem["Edit"].Enabled = true; }
|
|||
|
|
if (!string.IsNullOrEmpty(moveLocModel.MOVE_PERSON))
|
|||
|
|
{
|
|||
|
|
if (frmButtonItem.ContainsKey("Print")) { frmButtonItem["Print"].Enabled = true; }
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
if (frmButtonItem.ContainsKey("Print")) { frmButtonItem["Print"].Enabled = false; }
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (moveLocModel.PRINT_COUNT > 0)
|
|||
|
|
{
|
|||
|
|
if (frmButtonItem.ContainsKey("Edit")) { frmButtonItem["Edit"].Enabled = false; }
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 改单位下拉框数据源
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void issueBinGridView_CustomRowCellEditForEditing(object sender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (e.RowHandle < 0 || flag == -1)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (e.Column.Name == "colUNIT")
|
|||
|
|
{
|
|||
|
|
BindUnit();
|
|||
|
|
|
|||
|
|
e.RepositoryItem = lueUnits;//当前单元格绑定控件
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (e.Column.Name == "colOlD_LOC_ID")
|
|||
|
|
{
|
|||
|
|
string goodsID = string.Empty;
|
|||
|
|
|
|||
|
|
if (GVMoveLocTab.GetFocusedRowCellValue("GOODS_ID") != null)
|
|||
|
|
{
|
|||
|
|
goodsID = GVMoveLocTab.GetFocusedRowCellValue("GOODS_ID").ToString();
|
|||
|
|
|
|||
|
|
List<StorageAreaLocationModel> listLoc = new List<StorageAreaLocationModel>();
|
|||
|
|
|
|||
|
|
foreach (MIStockModel item in MIStockList)
|
|||
|
|
{
|
|||
|
|
if (item.GOODS_ID == goodsID)
|
|||
|
|
{
|
|||
|
|
StorageAreaLocationModel loc = new StorageAreaLocationModel();
|
|||
|
|
loc.LOCATION_ID = item.LOCATION_ID;
|
|||
|
|
listLoc.Add(loc);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
lueLocs.DataSource = listLoc;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
e.RepositoryItem = lueLocs;//当前单元格绑定控件
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 单位、重量单位的显示
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void GVMoveLocTab_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
|||
|
|
{
|
|||
|
|
///*查询单位、重量单位集合*/
|
|||
|
|
//List<DictionaryTabModel> kg_unitList = new List<DictionaryTabModel>();
|
|||
|
|
//List<DictionaryTabModel> vc_uomList = new List<DictionaryTabModel>();
|
|||
|
|
//string errText = string.Empty;
|
|||
|
|
//string strDataSet1 = string.Empty;
|
|||
|
|
//string strDataSet2 = string.Empty;
|
|||
|
|
//try
|
|||
|
|
//{
|
|||
|
|
// strDataSet1 = WebLockConfig.Instance.DictionaryTab.GetDictionaryTab("kg_unit", ref errText);//调用Web服务读取字典明细信息
|
|||
|
|
// strDataSet2 = WebLockConfig.Instance.DictionaryTab.GetDictionaryTab("vc_uom", ref errText);//调用Web服务读取字典明细信息
|
|||
|
|
//}
|
|||
|
|
//catch (Exception)
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
//}
|
|||
|
|
//if (errText == string.Empty)
|
|||
|
|
//{
|
|||
|
|
// kg_unitList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<DictionaryTabModel>>(strDataSet1);
|
|||
|
|
// vc_uomList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<DictionaryTabModel>>(strDataSet2);
|
|||
|
|
//}
|
|||
|
|
//else
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowInfoMessageBox(errText);
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
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;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//#region 选择采购商品
|
|||
|
|
//private bool m_status2 = false;//全选判断
|
|||
|
|
//private JWGoodsInfoModel choseModel = new JWGoodsInfoModel();//当前选择的商品
|
|||
|
|
|
|||
|
|
///// <summary>
|
|||
|
|
///// 清空商品列表数据
|
|||
|
|
///// </summary>
|
|||
|
|
//private void ClearGoodsGrid()
|
|||
|
|
//{
|
|||
|
|
// //string errText = string.Empty;
|
|||
|
|
// //// 绑定商品列表数据
|
|||
|
|
// //string strResult = string.Empty;
|
|||
|
|
// //try
|
|||
|
|
// //{
|
|||
|
|
// // strResult = WebLockConfig.Instance.Goods.GetGoodsList("", "", "", "");
|
|||
|
|
// //}
|
|||
|
|
// //catch (Exception)
|
|||
|
|
// //{
|
|||
|
|
// // SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
// //}
|
|||
|
|
|
|||
|
|
// //listJWGoodsInfoModel = Newtonsoft.Json.JsonConvert.DeserializeObject<List<JWGoodsInfoModel>>(strResult);
|
|||
|
|
// //if (listJWGoodsInfoModel.Count > 0)
|
|||
|
|
// //{
|
|||
|
|
// // bsGoodsInfo.DataSource = listJWGoodsInfoModel;
|
|||
|
|
// // GVGoodsInfo.RefreshData();
|
|||
|
|
// //}
|
|||
|
|
// //else
|
|||
|
|
// //{
|
|||
|
|
// // SystemCommon.ShowInfoMessageBox("未找到商品");
|
|||
|
|
// //}
|
|||
|
|
// listJWGoodsInfoModel = new List<JWGoodsInfoModel>();
|
|||
|
|
// bsGoodsInfo.DataSource = listJWGoodsInfoModel;
|
|||
|
|
// //GVGoodsInfo.RefreshData();
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
//#region CheckBox全选的实现:3事件
|
|||
|
|
|
|||
|
|
//private void GVGoodsInfo_Click(object sender, EventArgs e)
|
|||
|
|
//{
|
|||
|
|
// if (DevControlHelper.ClickGridCheckBox(this.GVGoodsInfo, "IsCheck", m_status2))
|
|||
|
|
// {
|
|||
|
|
// m_status2 = !m_status2;
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
//private void GVGoodsInfo_DataSourceChanged(object sender, EventArgs e)
|
|||
|
|
//{
|
|||
|
|
// GridColumn column = this.GVGoodsInfo.Columns.ColumnByFieldName("IsCheck");
|
|||
|
|
// if (column != null)
|
|||
|
|
// {
|
|||
|
|
// column.Width = 20;
|
|||
|
|
// column.OptionsColumn.ShowCaption = m_status2;
|
|||
|
|
// column.ColumnEdit = new RepositoryItemCheckEdit();
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
//private void GVGoodsInfo_CustomDrawColumnHeader(object sender, DevExpress.XtraGrid.Views.Grid.ColumnHeaderCustomDrawEventArgs e)
|
|||
|
|
//{
|
|||
|
|
// if (e.Column != null && e.Column.FieldName == "IsCheck")
|
|||
|
|
// {
|
|||
|
|
// e.Info.InnerElements.Clear();
|
|||
|
|
// e.Painter.DrawObject(e.Info);
|
|||
|
|
// DevControlHelper.DrawCheckBox(e, m_status2);
|
|||
|
|
// e.Handled = true;
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
//#endregion
|
|||
|
|
|
|||
|
|
////选择按钮
|
|||
|
|
//public void choose()
|
|||
|
|
//{
|
|||
|
|
// xtraTabControl1.Focus();
|
|||
|
|
|
|||
|
|
// if (listJWGoodsInfoModel.Count == 0)
|
|||
|
|
// {
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("没有可移动的商品,请注意审核库区");
|
|||
|
|
// return;
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// if (flag == 2) {//如果状态为完成
|
|||
|
|
// xtraTabControl1.SelectedTabPageIndex = 1;
|
|||
|
|
// return;
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// if (xtraTabControl1.SelectedTabPageIndex != 2)//如果当前不是选择商品页面
|
|||
|
|
// {
|
|||
|
|
// xtraTabControl1.SelectedTabPageIndex = 2;
|
|||
|
|
// }
|
|||
|
|
// else {
|
|||
|
|
|
|||
|
|
// /*将选择的商品加入移位商品明细*/
|
|||
|
|
// foreach (JWGoodsInfoModel item in listJWGoodsInfoModel)
|
|||
|
|
// {
|
|||
|
|
// //如果被选中
|
|||
|
|
// if (item.IsCheck)
|
|||
|
|
// {
|
|||
|
|
// MoveLocTabModel model = new MoveLocTabModel();
|
|||
|
|
// model.GOODS_ID = item.GOODS_ID;
|
|||
|
|
// model.GOODS_NAME = item.GOODS_NAME;
|
|||
|
|
|
|||
|
|
// int total = 0;
|
|||
|
|
// foreach (MIStockModel i in MIStockList)
|
|||
|
|
// {
|
|||
|
|
// if (i.GOODS_ID == item.GOODS_ID)
|
|||
|
|
// {
|
|||
|
|
// total += Convert.ToDecimal(i.ABLE_NUM);
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// model.MISTOCK_NUM = total;
|
|||
|
|
|
|||
|
|
// if (flag == 1)
|
|||
|
|
// { //修改:给移位单编号赋值
|
|||
|
|
// model.MOVELOC_ID = moveLocModel.MOVELOC_ID;
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// //判断该商品是否已经在移位商品明细中后添加
|
|||
|
|
// bool had = false;
|
|||
|
|
// foreach (MoveLocTabModel wntModel in listMoveLocTabModel)
|
|||
|
|
// {
|
|||
|
|
// if (wntModel.GOODS_ID == model.GOODS_ID)
|
|||
|
|
// {
|
|||
|
|
// had = true;
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// if (!had)
|
|||
|
|
// {
|
|||
|
|
|
|||
|
|
// listMoveLocTabModel.Add(model);
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// if (listMoveLocTabModel.Count > 0)
|
|||
|
|
// {
|
|||
|
|
// xtraTabControl1.SelectedTabPageIndex = 1;
|
|||
|
|
// GVMoveLocTab.RefreshData();
|
|||
|
|
// }
|
|||
|
|
// else
|
|||
|
|
// {
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("未选择任何商品或所选择的商品已在明细中,请重新选择");
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// //ClearGoodsGrid();
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
//#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
//#region 库位选择
|
|||
|
|
///// <summary>
|
|||
|
|
///// 库位选择
|
|||
|
|
///// </summary>
|
|||
|
|
///// <param name="sender"></param>
|
|||
|
|
///// <param name="e"></param>
|
|||
|
|
//private void ctrlDicLoc_Button_Click_1(object sender, EventArgs e)
|
|||
|
|
//{
|
|||
|
|
// DataTable dt = ctrlDicLoc.SelectTable;
|
|||
|
|
// if (dt.Rows.Count == 0)
|
|||
|
|
// {
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("您未选择库位!");
|
|||
|
|
// return;
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
// //库位集合
|
|||
|
|
// List<StorageAreaLocationModel> list = ConvertHelper<StorageAreaLocationModel>.ConvertToList(ctrlDicLoc.SelectTable);
|
|||
|
|
|
|||
|
|
// MoveLocTabModel model = listMoveLocTabModel[GVMoveLocTab.FocusedRowHandle];
|
|||
|
|
// model.NEW_LOC_ID = list[0].LOCATION_ID;
|
|||
|
|
// GVMoveLocTab.RefreshData();
|
|||
|
|
|
|||
|
|
// //bsMoveLocTab.DataSource = listMoveLocTabModel;
|
|||
|
|
//}
|
|||
|
|
//#endregion
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 打印
|
|||
|
|
/// </summary>
|
|||
|
|
public override void Print()
|
|||
|
|
{
|
|||
|
|
string message = "是否打印移位单" + moveLocModel.MOVELOC_ID;
|
|||
|
|
|
|||
|
|
if (moveLocModel.PRINT_COUNT > 0)
|
|||
|
|
{
|
|||
|
|
message += ",该移位单已被打印" + Convert.ToInt32(moveLocModel.PRINT_COUNT) + "次";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (DialogResult.No == SystemCommon.ShowMessageBoxResult(message))
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//打印时给单位名称赋值
|
|||
|
|
string errText = string.Empty;
|
|||
|
|
|
|||
|
|
List<DictionaryTabModel> listDictionaryTab = new List<DictionaryTabModel>();
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
listDictionaryTab = IBussFactory<BussDictionaryTab>.Instance().GetDictionaryTab("vc_uom");//调用Web服务读取字典明细信息
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
foreach (MoveLocTabModel item in listMoveLocTabModel)
|
|||
|
|
{
|
|||
|
|
if (item.UNIT != null)
|
|||
|
|
{
|
|||
|
|
item.UNIT_NAME = listDictionaryTab.Find(p => p.VC_CHAR_VALUE == item.UNIT).VC_DICTIONARY_NAME;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
moveLocModel.DOCUMENT_PERSON_ID = userData.USER_ID;
|
|||
|
|
moveLocModel.DOCUMENT_PERSON = userData.NAME;
|
|||
|
|
moveLocModel.DOCUMENT_TIME = DateTime.Now;
|
|||
|
|
//ReportMoveLoc.GetInstance(moveLocModel, listMoveLocTabModel).ShowPreview();
|
|||
|
|
//LoadForm load = new LoadForm();
|
|||
|
|
//DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(load, load.GetType(), false, true, false, 0);
|
|||
|
|
//DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormDescription("正在加载窗体,请等待....");
|
|||
|
|
//DialogResult printResult = ReportMoveLoc.GetInstance(moveLocModel, listMoveLocTabModel).PrintDialog();
|
|||
|
|
//if (printResult == DialogResult.OK)
|
|||
|
|
//{
|
|||
|
|
LoadForm load = new LoadForm();
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(load, load.GetType(), false, true, false, 0);
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormDescription("正在打印移位单请稍候....");
|
|||
|
|
if (isSKU)
|
|||
|
|
{
|
|||
|
|
ReportMoveLocSKU.GetInstance(moveLocModel, listMoveLocTabModel).Print();
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
ReportMoveLoc.GetInstance(moveLocModel, listMoveLocTabModel).Print();
|
|||
|
|
}
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
|
|||
|
|
errText = string.Empty;
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
errText = IBussFactory<BussMoveLoc>.Instance().PrintOK(moveLocModel);
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
if (string.IsNullOrEmpty(errText))//如果成功
|
|||
|
|
{
|
|||
|
|
moveLocModel.PRINT_COUNT += 1;
|
|||
|
|
GVMoveLoc.RefreshData();
|
|||
|
|
SystemCommon.ShowInfoMessageBox("打印成功");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("修改打印记录失败,请重新打印。" + errText);
|
|||
|
|
}
|
|||
|
|
//}
|
|||
|
|
//else
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("打印失败");
|
|||
|
|
//}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//private void GVMoveLocTab_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
|
|||
|
|
//{
|
|||
|
|
// if (e.Column.Name == "colGOODS_NAME")
|
|||
|
|
// {
|
|||
|
|
// MoveLocTabModel model = GVMoveLocTab.GetFocusedRow() as MoveLocTabModel;
|
|||
|
|
// if (model != null && !string.IsNullOrEmpty(model.GOODS_ID))
|
|||
|
|
// {
|
|||
|
|
// FrmGoodsInfoDet.IFlag = 2;
|
|||
|
|
// FrmGoodsInfoDet.StrGoodsID = model.GOODS_ID;
|
|||
|
|
// LoadForm load = new LoadForm();
|
|||
|
|
// DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(load, load.GetType(), false, true, false, 0);
|
|||
|
|
// DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormDescription("正在读取商品信息....");
|
|||
|
|
// FrmGoodsInfoDet.GetInstance().Show();
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
|
|||
|
|
private void repositoryItemHyperLinkEdit1_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
MoveLocTabModel model = GVMoveLocTab.GetFocusedRow() as MoveLocTabModel;
|
|||
|
|
if (model != null && !string.IsNullOrEmpty(model.GOODS_ID))
|
|||
|
|
{
|
|||
|
|
FrmGoodsInfoDet.IFlag = 2;
|
|||
|
|
FrmGoodsInfoDet.StrGoodsID = model.GOODS_ID;
|
|||
|
|
LoadForm load = new LoadForm();
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(load, load.GetType(), false, true, false, 0);
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormDescription("正在读取商品信息....");
|
|||
|
|
FrmGoodsInfoDet.GetInstance().Show();
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void GVMoveLocTab_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (e.Column.Name == "colOLD_LOC_ID" && (flag == 0 || flag == 1) && moveLocModel.STATE == "0")
|
|||
|
|
{
|
|||
|
|
MoveLocTabModel model = listMoveLocTabModel[GVMoveLocTab.GetFocusedDataSourceRowIndex()]; //GVAreaRepOut.GetFocusedRow() as AreaRepOutModel;
|
|||
|
|
if (model != null && !string.IsNullOrEmpty(model.GOODS_ID))
|
|||
|
|
{
|
|||
|
|
MIStockModel miStock = new MIStockModel();
|
|||
|
|
miStock.GOODS_ID = model.GOODS_ID;
|
|||
|
|
miStock.GOODS_NAME = model.GOODS_NAME;
|
|||
|
|
miStock.LOCATION_ID = model.OLD_LOC_ID;
|
|||
|
|
miStock.PUTIN_ID = model.PUTIN_ID;
|
|||
|
|
miStock.DOCCTNUMBER = model.DOCCTNUMBER;
|
|||
|
|
miStock.ABLE_NUM = model.LOC_NUM;
|
|||
|
|
miStock.PROVIDER_ID = model.PROVIDER_ID;
|
|||
|
|
miStock.PROVIDER_NAME = model.PROVIDER_NAME;
|
|||
|
|
miStock.PRODUCTION_DATE = model.PRODUCTION_DATE;
|
|||
|
|
miStock.WARE_DATE = model.WARE_DATE;
|
|||
|
|
FrmSelectLocAndPutInID.GetInstance().Dispose();
|
|||
|
|
LoadForm load = new LoadForm();
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(load, load.GetType(), false, true, false, 0);
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormDescription("正在获取库存信息请稍候....");
|
|||
|
|
DialogResult var = FrmSelectLocAndPutInID.GetInstance(miStock, moveLocModel.STORAGE_ID, moveLocModel.AREA_ID, moveLocModel.STORAGE_NAME, moveLocModel.AREA_NAME).ShowDialog();
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
|
|||
|
|
if (var == DialogResult.OK)
|
|||
|
|
{
|
|||
|
|
miStock = FrmSelectLocAndPutInID.GetInstance().stock;
|
|||
|
|
if (listMoveLocTabModel.FindAll(p => p.GOODS_ID == miStock.GOODS_ID && p.OLD_LOC_ID == miStock.LOCATION_ID && p.PUTIN_ID == miStock.PUTIN_ID).Count > 1)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("同种商品同一批次库位不能相同");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (miStock.ABLE_NUM < model.LOC_NUM)
|
|||
|
|
{
|
|||
|
|
if (DialogResult.OK == SystemCommon.ShowMessageBoxResult("当前库位本批次库存数不满足,是否清空计划数量(点【是】清空计划数量,点【否】不更改出库库位)"))
|
|||
|
|
{
|
|||
|
|
GVMoveLocTab.SetFocusedRowCellValue("PLAN_NUM", 0);
|
|||
|
|
//GVAreaRepOut.SetFocusedRowCellValue("REAL_COUNT", 0);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
model.OLD_LOC_ID = miStock.LOCATION_ID;
|
|||
|
|
model.PUTIN_ID = miStock.PUTIN_ID;
|
|||
|
|
model.DOCCTNUMBER = miStock.DOCCTNUMBER;
|
|||
|
|
model.PROVIDER_ID = miStock.PROVIDER_ID;
|
|||
|
|
model.PROVIDER_NAME = miStock.PROVIDER_NAME;
|
|||
|
|
model.PRODUCTION_DATE = miStock.PRODUCTION_DATE;
|
|||
|
|
model.WARE_DATE = miStock.WARE_DATE;
|
|||
|
|
|
|||
|
|
BindUnit();
|
|||
|
|
DataTable dt = lueUnits.DataSource as DataTable;
|
|||
|
|
decimal newUnit = 0;
|
|||
|
|
foreach (DataRow row in dt.Rows)
|
|||
|
|
{
|
|||
|
|
if (row[0].ToString() == GVMoveLocTab.GetFocusedRowCellValue("UNIT").ToString())
|
|||
|
|
{
|
|||
|
|
newUnit = decimal.Parse(row[2].ToString());
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
model.LOC_NUM = miStock.ABLE_NUM * newUnit;
|
|||
|
|
listMoveLocTabModel[GVMoveLocTab.GetFocusedDataSourceRowIndex()] = model;
|
|||
|
|
//bsAreaRepOut.DataSource = listAreaRepOutModel;
|
|||
|
|
//GVAreaRepOut.RefreshData();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|