1147 lines
44 KiB
C#
1147 lines
44 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.Stock;
|
|||
|
|
using WMS.Common;
|
|||
|
|
|
|||
|
|
using WMS.Ctrl;
|
|||
|
|
using WMS.Model.Base;
|
|||
|
|
using WMS.Frm;
|
|||
|
|
using DevExpress.XtraGrid.Columns;
|
|||
|
|
using DevExpress.XtraEditors.Repository;
|
|||
|
|
using DevExpress.XtraReports.UI;
|
|||
|
|
using WMS.FrmBaseData;
|
|||
|
|
using WMS.Business;
|
|||
|
|
using WMS.Business.Base;
|
|||
|
|
using WMS.Business.Stock;
|
|||
|
|
|
|||
|
|
namespace WMS.FrmStock
|
|||
|
|
{
|
|||
|
|
public partial class FrmCounting : FormBase
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 盘点任务查询MODEL
|
|||
|
|
/// </summary>
|
|||
|
|
CountingModel countingSelModel = new CountingModel();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 盘点任务工作MODEL
|
|||
|
|
/// </summary>
|
|||
|
|
CountingModel countingWorkModel = new CountingModel();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 盘点任务明细查询MODEL
|
|||
|
|
/// </summary>
|
|||
|
|
CountingInfoModel countingInfoSelModel = new CountingInfoModel();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 盘点任务明细工作MODEL
|
|||
|
|
/// </summary>
|
|||
|
|
CountingInfoModel countingInfoWorkModel = new CountingInfoModel();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 盘点任务集合
|
|||
|
|
/// </summary>
|
|||
|
|
List<CountingModel> countingModelList = new List<CountingModel>();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 通知单明细集合
|
|||
|
|
/// </summary>
|
|||
|
|
List<CountingInfoModel> infoList = new List<CountingInfoModel>();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 通知单明细集合
|
|||
|
|
/// </summary>
|
|||
|
|
List<CountingInfoModel> selList = new List<CountingInfoModel>();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 库存MODEL
|
|||
|
|
/// </summary>
|
|||
|
|
MIStockModel miModel = new MIStockModel();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 库存集合
|
|||
|
|
/// </summary>
|
|||
|
|
List<MIStockModel> miList = new List<MIStockModel>();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 库存集合筛选
|
|||
|
|
/// </summary>
|
|||
|
|
List<MIStockModel> miCkList = new List<MIStockModel>();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 业务类型
|
|||
|
|
/// </summary>
|
|||
|
|
int workflag = 3;//0 增加 1 修改 2 删除 ;
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 全选判断
|
|||
|
|
/// </summary>
|
|||
|
|
bool m_status = false;
|
|||
|
|
|
|||
|
|
public FrmCounting()
|
|||
|
|
{
|
|||
|
|
InitializeComponent();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 页面加载
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void FrmCounting_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
LEPCountType.LoadData();
|
|||
|
|
LEPCreateType.LoadData();
|
|||
|
|
LEPStoWork.LoadData();
|
|||
|
|
FrmSelectModle = new CountingModel();
|
|||
|
|
|
|||
|
|
DicConfirmMan.selSql = string.Format(@"select user_id,name from t_base_userinfo
|
|||
|
|
where COM_ID = '" + userData.COM_ID + "'");
|
|||
|
|
DicPlanMan.selSql = string.Format(@"select user_id,name from t_base_userinfo
|
|||
|
|
where COM_ID = '" + userData.COM_ID + "'");
|
|||
|
|
DicPlanMan.selSql = string.Format(@"select user_id,name from t_base_userinfo
|
|||
|
|
where COM_ID = '" + userData.COM_ID + "'");
|
|||
|
|
|
|||
|
|
LEPCreateType.Enabled = false;
|
|||
|
|
DateTime dt = DateTime.Now;
|
|||
|
|
BSCountingTab.DataSource = new CountingModel() { PLAN_DATE_STAR = dt.AddDays(1 - dt.Day), PLAN_DATE_END = dt.AddDays(1 - dt.Day).AddMonths(1).AddDays(-1) };
|
|||
|
|
bindCountGrid(BSCountingTab.DataSource as CountingModel);
|
|||
|
|
PageWork.PageEnabled = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 通用查询
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="table"></param>
|
|||
|
|
public override void LoadListData(DataTable table)
|
|||
|
|
{
|
|||
|
|
countingModelList = ConvertHelper<CountingModel>.ConvertToList(table);
|
|||
|
|
GCCounting.DataSource = countingModelList;
|
|||
|
|
GVCounting.RefreshData();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 绑定下拉框
|
|||
|
|
/// </summary>
|
|||
|
|
private void bindLEP()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
List<JWGoodsInfoModel> goodsListModel = IBussFactory<BussGoods>.Instance().GetGoodsList("", "", "", "");
|
|||
|
|
repositoryItemLookUpEdit1.DataSource = goodsListModel;
|
|||
|
|
repositoryItemLookUpEdit1.DisplayMember = "GOODS_NAME";
|
|||
|
|
repositoryItemLookUpEdit1.ValueMember = "GOODS_ID";
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 绑定Grid
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="model"></param>
|
|||
|
|
private void bindCountGrid(CountingModel model)
|
|||
|
|
{
|
|||
|
|
BSCountingTab.EndEdit();
|
|||
|
|
CountingModel smodel = BSCountingTab.DataSource as CountingModel;
|
|||
|
|
smodel.PLAN_DATE_END = smodel.PLAN_DATE_END.AddDays(1);
|
|||
|
|
|
|||
|
|
string strlist = "";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
countingModelList = IBussFactory<BussCounting>.Instance().GetCountingList(smodel);
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (countingModelList.Count > 0)
|
|||
|
|
{
|
|||
|
|
GCCounting.DataSource = countingModelList.OrderByDescending(r => r.PLAN_DATE);
|
|||
|
|
GVCounting.RefreshData();
|
|||
|
|
GVCounting.FocusedRowHandle = 0;
|
|||
|
|
countingSelModel = GVCounting.GetFocusedRow() as CountingModel;
|
|||
|
|
CountingInfoModel imodel = new CountingInfoModel();
|
|||
|
|
imodel.COUNT_ID = countingSelModel.COUNT_ID;
|
|||
|
|
GCCounting_Click(null, null);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
GCCounting.DataSource = countingModelList;
|
|||
|
|
GVCounting.RefreshData();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 绑定明细Grid
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="model"></param>
|
|||
|
|
private void bindInfoGrid(CountingInfoModel model)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
selList = IBussFactory<BussCountingInfo>.Instance().GetList(model);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
GCCountingInfo.DataSource = selList;
|
|||
|
|
GVCountingInfo.RefreshData();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 盘点单点击
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void GCCounting_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (GVCounting.FocusedRowHandle < 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
countingSelModel = GVCounting.GetFocusedRow() as CountingModel;
|
|||
|
|
CountingInfoModel model = new CountingInfoModel();
|
|||
|
|
model.COUNT_ID = countingSelModel.COUNT_ID;
|
|||
|
|
bindInfoGrid(model);
|
|||
|
|
|
|||
|
|
switch (countingSelModel.COUNT_STATUS)
|
|||
|
|
{
|
|||
|
|
case "0":
|
|||
|
|
frmButtonItem["Confirm"].Enabled = true;
|
|||
|
|
frmButtonItem["Audit"].Enabled = false;
|
|||
|
|
frmButtonItem["Adjust"].Enabled = false;
|
|||
|
|
frmButtonItem["Count"].Enabled = false;
|
|||
|
|
break;
|
|||
|
|
case "2":
|
|||
|
|
frmButtonItem["Audit"].Enabled = true;
|
|||
|
|
frmButtonItem["Adjust"].Enabled = true;
|
|||
|
|
frmButtonItem["Count"].Enabled = false;
|
|||
|
|
frmButtonItem["Confirm"].Enabled = false;
|
|||
|
|
break;
|
|||
|
|
case "1":
|
|||
|
|
frmButtonItem["Count"].Enabled = true;
|
|||
|
|
frmButtonItem["Audit"].Enabled = false;
|
|||
|
|
frmButtonItem["Adjust"].Enabled = false;
|
|||
|
|
frmButtonItem["Confirm"].Enabled = false;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 盘点单据显示改变
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void GVCounting_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (e.Value == null || e.Value == DBNull.Value)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (e.Column.FieldName == "COUNT_TYPE")
|
|||
|
|
{
|
|||
|
|
switch (e.Value.ToString().Trim())
|
|||
|
|
{
|
|||
|
|
case "0":
|
|||
|
|
e.DisplayText = "全盘";
|
|||
|
|
break;
|
|||
|
|
case "1":
|
|||
|
|
e.DisplayText = "动盘";
|
|||
|
|
break;
|
|||
|
|
case "2":
|
|||
|
|
e.DisplayText = "自定义";
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
e.DisplayText = "其它";
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (e.Column.FieldName == "COUNT_STATUS")
|
|||
|
|
{
|
|||
|
|
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;
|
|||
|
|
case "4":
|
|||
|
|
e.DisplayText = "已审核";
|
|||
|
|
break;
|
|||
|
|
case "5":
|
|||
|
|
e.DisplayText = "已调整";
|
|||
|
|
break;
|
|||
|
|
case "6":
|
|||
|
|
e.DisplayText = "已作废";
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
e.DisplayText = "其它";
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 盘点明细显示改变
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void GVCountingInfo_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (e.Value == null)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (e.Column.FieldName == "STATUS")
|
|||
|
|
{
|
|||
|
|
if (e.Value == null || e.Value == DBNull.Value)
|
|||
|
|
{
|
|||
|
|
e.DisplayText = "未盘点";
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
switch (e.Value.ToString().Trim())
|
|||
|
|
{
|
|||
|
|
case "0":
|
|||
|
|
e.DisplayText = "正常";
|
|||
|
|
break;
|
|||
|
|
case "1":
|
|||
|
|
e.DisplayText = "盈";
|
|||
|
|
break;
|
|||
|
|
case "2":
|
|||
|
|
e.DisplayText = "亏";
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
e.DisplayText = "未盘点";
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (e.Column.FieldName == "COUNT_STATUS")
|
|||
|
|
{
|
|||
|
|
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 以下是继承的按钮事件
|
|||
|
|
/// <summary>
|
|||
|
|
/// 新增按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Add()
|
|||
|
|
{
|
|||
|
|
PageWork.PageEnabled = true;
|
|||
|
|
xtraTabCounting.SelectedTabPage = PageWork;
|
|||
|
|
BSCountingWork.DataSource = new CountingModel()
|
|||
|
|
{
|
|||
|
|
PLAN_DATE = DateTime.Now,
|
|||
|
|
CONFIRM_DATE = DateTime.Now,
|
|||
|
|
COUNT_DATE = DateTime.Now,
|
|||
|
|
STO_ID = userData.STORAGE_ID,
|
|||
|
|
PLAN_MAN = userData.USER_ID,
|
|||
|
|
COUNT_MAN = userData.USER_ID,
|
|||
|
|
CREATE_TYPE = "0",
|
|||
|
|
};
|
|||
|
|
DicPlanMan.TextBoxFlag = userData.USER_ID;
|
|||
|
|
DicPlanMan.TextBoxValue = userData.NAME;
|
|||
|
|
DicCount.TextBoxFlag = userData.USER_ID;
|
|||
|
|
DicCount.TextBoxValue = userData.NAME;
|
|||
|
|
workflag = 0;
|
|||
|
|
frmButtonItem["Save"].Enabled = true;
|
|||
|
|
frmButtonItem["Refresh"].Enabled = true;
|
|||
|
|
frmButtonItem["Edit"].Enabled = false;
|
|||
|
|
frmButtonItem["Del"].Enabled = false;
|
|||
|
|
frmButtonItem["Confirm"].Enabled = false;
|
|||
|
|
frmButtonItem["Count"].Enabled = false;
|
|||
|
|
frmButtonItem["Adjust"].Enabled = false;
|
|||
|
|
frmButtonItem["Audit"].Enabled = false;
|
|||
|
|
DateConfirm.Enabled = false;
|
|||
|
|
DicConfirmMan.Enabled = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 保存按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Save()
|
|||
|
|
{
|
|||
|
|
FrmOperator(workflag);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 删除按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Del()
|
|||
|
|
{
|
|||
|
|
if (countingSelModel.COUNT_STATUS == "2")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("该单据已盘点无法删除!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
else if (countingSelModel.COUNT_STATUS == "3")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("该单据已复核无法删除!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
xtraTabCounting.SelectedTabPage = PageWork;
|
|||
|
|
BSCountingWork.DataSource = countingSelModel;
|
|||
|
|
GCCountInfoWork.DataSource = infoList;
|
|||
|
|
GVCountInfoWork.RefreshData();
|
|||
|
|
|
|||
|
|
workflag = 2;
|
|||
|
|
frmButtonItem["Save"].Enabled = true;
|
|||
|
|
frmButtonItem["Refresh"].Enabled = true;
|
|||
|
|
frmButtonItem["Edit"].Enabled = false;
|
|||
|
|
frmButtonItem["Del"].Enabled = false;
|
|||
|
|
frmButtonItem["Confirm"].Enabled = false;
|
|||
|
|
frmButtonItem["Count"].Enabled = false;
|
|||
|
|
frmButtonItem["Adjust"].Enabled = false;
|
|||
|
|
frmButtonItem["Audit"].Enabled = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 修改按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Edit()
|
|||
|
|
{
|
|||
|
|
if (countingSelModel.COUNT_STATUS == "2")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("该单据已盘点无法修改!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
else if (countingSelModel.COUNT_STATUS == "3")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("该单据已复核无法修改!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
PageWork.PageEnabled = true;
|
|||
|
|
xtraTabCounting.SelectedTabPage = PageWork;
|
|||
|
|
BSCountingWork.DataSource = countingSelModel;
|
|||
|
|
|
|||
|
|
GCCountInfoWork.DataSource = infoList;
|
|||
|
|
GVCountInfoWork.RefreshData();
|
|||
|
|
|
|||
|
|
workflag = 1;
|
|||
|
|
frmButtonItem["Save"].Enabled = true;
|
|||
|
|
frmButtonItem["Refresh"].Enabled = true;
|
|||
|
|
frmButtonItem["Edit"].Enabled = false;
|
|||
|
|
frmButtonItem["Del"].Enabled = false;
|
|||
|
|
frmButtonItem["Confirm"].Enabled = false;
|
|||
|
|
frmButtonItem["Count"].Enabled = false;
|
|||
|
|
frmButtonItem["Adjust"].Enabled = false;
|
|||
|
|
frmButtonItem["Audit"].Enabled = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 刷新按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Refresh()
|
|||
|
|
{
|
|||
|
|
if (SystemCommon.ShowMessageBoxResult("是否确定刷新数据?") == System.Windows.Forms.DialogResult.OK)
|
|||
|
|
{
|
|||
|
|
DateTime dt = DateTime.Now;
|
|||
|
|
BSCountingTab.DataSource = new CountingModel() { PLAN_DATE_STAR = dt.AddDays(1 - dt.Day), PLAN_DATE_END = dt.AddDays(1 - dt.Day).AddMonths(1).AddDays(-1) };
|
|||
|
|
bindCountGrid(BSCountingTab.DataSource as CountingModel);
|
|||
|
|
BSCountingWork.DataSource = new CountingModel() { PLAN_DATE = DateTime.Now };
|
|||
|
|
DicPlanMan.TextBoxFlag = userData.USER_ID;
|
|||
|
|
DicPlanMan.TextBoxValue = userData.NAME;
|
|||
|
|
frmButtonItem["Save"].Enabled = false;
|
|||
|
|
frmButtonItem["Refresh"].Enabled = false;
|
|||
|
|
frmButtonItem["Add"].Enabled = true;
|
|||
|
|
frmButtonItem["Edit"].Enabled = true;
|
|||
|
|
frmButtonItem["Del"].Enabled = true;
|
|||
|
|
frmButtonItem["Confirm"].Enabled = true;
|
|||
|
|
infoList.Clear();
|
|||
|
|
GVCountInfoWork.RefreshData();
|
|||
|
|
workflag = 3;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 确认按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Confirm()
|
|||
|
|
{
|
|||
|
|
if (countingSelModel.COUNT_STATUS != "0")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("该单据不需要确认!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
countingSelModel.CONFIRM_DATE = DateTime.Now;
|
|||
|
|
countingSelModel.CONFIRM_MAN = userData.USER_ID;
|
|||
|
|
countingSelModel.COUNT_STATUS = "1";
|
|||
|
|
BSCountingWork.DataSource = countingSelModel;
|
|||
|
|
|
|||
|
|
DicConfirmMan.TextBoxFlag = userData.USER_ID;
|
|||
|
|
DicConfirmMan.TextBoxValue = userData.NAME;
|
|||
|
|
|
|||
|
|
workflag = 1;
|
|||
|
|
FrmOperator(workflag);
|
|||
|
|
frmButtonItem["Confirm"].Enabled = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 查询按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Search()
|
|||
|
|
{
|
|||
|
|
FrmSelect frm = new FrmSelect(FrmSelectModle);
|
|||
|
|
if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|||
|
|
{
|
|||
|
|
this.LoadListData(frm.SelectData);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 导出按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void ExportDataButton()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 打印按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Print()
|
|||
|
|
{
|
|||
|
|
LoadForm load = new LoadForm();
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(load, load.GetType(), false, true, false, 50);
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormDescription("正在加载打印数据,请稍等....");
|
|||
|
|
string count = Newtonsoft.Json.JsonConvert.SerializeObject(countingSelModel);
|
|||
|
|
string info = Newtonsoft.Json.JsonConvert.SerializeObject(infoList);
|
|||
|
|
ReportCount countPrint = new ReportCount(count, info);
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
|
|||
|
|
|
|||
|
|
countPrint.ShowPreviewDialog();
|
|||
|
|
|
|||
|
|
PrintInfoModel printinfo = new PrintInfoModel();
|
|||
|
|
printinfo.Print_count = 1;
|
|||
|
|
printinfo.PRINT_DATE = DateTime.Now;
|
|||
|
|
printinfo.Order_id = countingSelModel.COUNT_ID;
|
|||
|
|
printinfo.PRINT_PER = userData.USER_ID;
|
|||
|
|
printinfo.PRINT_TYPE = "4";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
string err =IBussFactory<BussPrintInfo>.Instance().InsOrUpdPrint(printinfo, 0);
|
|||
|
|
if (!string.IsNullOrEmpty(err))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox(err);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("打印成功!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 备注
|
|||
|
|
/// </summary>
|
|||
|
|
protected new void NoteDataButton(FormBase fBase)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 盘点
|
|||
|
|
/// </summary>
|
|||
|
|
public void Count()
|
|||
|
|
{
|
|||
|
|
if (countingSelModel.COUNT_STATUS == "0")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("该单据还未确认!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (countingSelModel.COUNT_STATUS == "2")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("该单据已完成盘点!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
FormBase formBase = OpenFrmTable("WMS.FrmStock", "FrmCountingDet");//创建窗体
|
|||
|
|
if (formBase != null)
|
|||
|
|
{
|
|||
|
|
FrmCountingDet frmCountingDet = formBase as FrmCountingDet;
|
|||
|
|
frmCountingDet.pdsheet = countingSelModel.COUNT_ID;
|
|||
|
|
if (!OpenTabAddFrm("1001", "FrmCountingDet", "库存盘点-" + countingSelModel.COUNT_ID))
|
|||
|
|
{
|
|||
|
|
frmCountingDet.FrmCountingDet_Load(null, null);//如果已经被打开,执行一下窗体加载方法
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
frmButtonItem["Count"].Enabled = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 复盘
|
|||
|
|
/// </summary>
|
|||
|
|
public void Audit()
|
|||
|
|
{
|
|||
|
|
if (countingSelModel == null || string.IsNullOrEmpty(countingSelModel.COUNT_ID))
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (countingSelModel.COUNT_BACK != "1")
|
|||
|
|
{
|
|||
|
|
if (SystemCommon.ShowMessageBoxResult("该单据无差异,是否还要申请复盘?") == System.Windows.Forms.DialogResult.No)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
CountingModel model = new CountingModel();
|
|||
|
|
model.CONFIRM_DATE = DateTime.Now;
|
|||
|
|
model.CONFIRM_MAN = userData.USER_ID;
|
|||
|
|
model.COUNT_ID = "FP" + DateTime.Now.ToString("yyyyMMdd") +
|
|||
|
|
IBussFactory<BussCounting>.Instance().GetSerialNum();
|
|||
|
|
model.COUNT_STATUS = "1";
|
|||
|
|
model.COUNT_TYPE = countingSelModel.COUNT_TYPE;
|
|||
|
|
model.CREATE_TYPE = "1";
|
|||
|
|
model.PLAN_DATE = DateTime.Now;
|
|||
|
|
model.PLAN_MAN = userData.USER_ID;
|
|||
|
|
model.REMARK = "自动生成复盘单";
|
|||
|
|
model.STO_ID = countingSelModel.STO_ID;
|
|||
|
|
model.ORI_ID = countingSelModel.COUNT_ID;
|
|||
|
|
|
|||
|
|
|
|||
|
|
List<CountingInfoModel> lint = new List<CountingInfoModel>();
|
|||
|
|
foreach (CountingInfoModel infoModel in selList)
|
|||
|
|
{
|
|||
|
|
CountingInfoModel imodel = new CountingInfoModel();
|
|||
|
|
imodel.BOOK_NUM = infoModel.BOOK_NUM;
|
|||
|
|
imodel.COUNT_ID = model.COUNT_ID;
|
|||
|
|
imodel.DIFF_NUM = 0;
|
|||
|
|
imodel.GOODS_ID = infoModel.GOODS_ID;
|
|||
|
|
imodel.STO_AREA = infoModel.STO_AREA;
|
|||
|
|
imodel.STO_SEAT = infoModel.STO_SEAT;
|
|||
|
|
lint.Add(imodel);
|
|||
|
|
}
|
|||
|
|
countingSelModel.COUNT_STATUS = "3";
|
|||
|
|
|
|||
|
|
string err = IBussFactory<BussCounting>.Instance().ReCount(countingSelModel, model, lint);
|
|||
|
|
|
|||
|
|
if (!string.IsNullOrEmpty(err.Trim()))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("申请复盘失败:" + err);
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
frmButtonItem["Audit"].Enabled = false;
|
|||
|
|
SystemCommon.ShowInfoMessageBox("申请复盘成功!" + Environment.NewLine + "新盘点单号为:" + model.COUNT_ID);
|
|||
|
|
FormBase formBase = OpenFrmTable("WMS.FrmStock", "FrmCountingDet");//创建窗体
|
|||
|
|
if (formBase != null)
|
|||
|
|
{
|
|||
|
|
FrmCountingDet frmCountingDet = formBase as FrmCountingDet;
|
|||
|
|
frmCountingDet.pdsheet = countingWorkModel.COUNT_ID;
|
|||
|
|
if (!OpenTabAddFrm("1001", "FrmCountingDet", "盘点确认-" + model.COUNT_ID))
|
|||
|
|
{
|
|||
|
|
frmCountingDet.FrmCountingDet_Load(null, null);//如果已经被打开,执行一下窗体加载方法
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 库存调整
|
|||
|
|
/// </summary>
|
|||
|
|
public void Adjust()
|
|||
|
|
{
|
|||
|
|
if (countingSelModel == null || string.IsNullOrEmpty(countingSelModel.COUNT_ID))
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (countingSelModel.COUNT_BACK != "1")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("该单据无差异不需库存调整!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (countingSelModel.COUNT_STATUS != "3")
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("该单据已生成复盘单,请根据复盘单调整库存!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
frmButtonItem["Adjust"].Enabled = false;
|
|||
|
|
FormBase formBase = OpenFrmTable("WMS.FrmStock", "FrmStockAdjust");//创建窗体
|
|||
|
|
FrmStockAdjust frmStockAdjust = formBase as FrmStockAdjust;
|
|||
|
|
frmStockAdjust.pdsheet = countingWorkModel.COUNT_ID;
|
|||
|
|
if (!OpenTabAddFrm("1002", "FrmStockAdjust", "库存调整-" + countingWorkModel.COUNT_ID))
|
|||
|
|
{
|
|||
|
|
frmStockAdjust.FrmStockAdjust_Load(null, null);//如果已经被打开,执行一下窗体加载方法
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 查询商品
|
|||
|
|
/// </summary>
|
|||
|
|
public void Goods()
|
|||
|
|
{
|
|||
|
|
if (LEPStoWork.EditValue == DBNull.Value || LEPCountType.EditValue == DBNull.Value)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (LEPStoWork.EditValue == null || LEPCountType.EditValue == null)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
bindgoods();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
#region 操作(增、改、删)
|
|||
|
|
/// <summary>
|
|||
|
|
/// 操作(增、改、删)
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="flag">0 新增 1修改 2删除 3停用 4启用/param>
|
|||
|
|
private void FrmOperator(int flag)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
string err = "";
|
|||
|
|
BSCountingWork.EndEdit();
|
|||
|
|
GVCountInfoWork.CloseEditor();
|
|||
|
|
GVCountInfoWork.UpdateCurrentRow();
|
|||
|
|
countingWorkModel = BSCountingWork.DataSource as CountingModel;
|
|||
|
|
LoadForm load = new LoadForm();
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(load, load.GetType(), false, true, false, 50);
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormDescription("正在处理数据,请稍等....");
|
|||
|
|
if (flag == 0)
|
|||
|
|
{
|
|||
|
|
if (infoList.Count == 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请指定需要盘点的库存!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
string num = IBussFactory<BussCounting>.Instance().GetSerialNum();
|
|||
|
|
countingWorkModel.COUNT_ID = "PD" + DateTime.Now.ToString("yyyyMMdd") + num;
|
|||
|
|
countingWorkModel.COUNT_STATUS = "0";
|
|||
|
|
foreach (CountingInfoModel cim in infoList)
|
|||
|
|
{
|
|||
|
|
cim.COUNT_ID = countingWorkModel.COUNT_ID;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
err = IBussFactory<BussCounting>.Instance().AddAndInfo(countingWorkModel, infoList);
|
|||
|
|
}
|
|||
|
|
else if (flag == 1)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
err = IBussFactory<BussCounting>.Instance().UpdateAndInfo(countingWorkModel, infoList);
|
|||
|
|
}
|
|||
|
|
else if (flag == 2)
|
|||
|
|
{
|
|||
|
|
if (!string.IsNullOrEmpty(countingWorkModel.COUNT_ID))
|
|||
|
|
{
|
|||
|
|
if (SystemCommon.ShowMessageBoxResult("确定要删除盘点任务:" + countingWorkModel.COUNT_ID)
|
|||
|
|
== System.Windows.Forms.DialogResult.OK)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
err = IBussFactory<BussCounting>.Instance().DeleteAndInfo(countingWorkModel);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
|
|||
|
|
if (!string.IsNullOrEmpty(err))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox(err);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("操作成功!");
|
|||
|
|
//if (flag == 0)
|
|||
|
|
//{
|
|||
|
|
// MessageModel messModel = new MessageModel();
|
|||
|
|
// messModel.ID = "PD" + DateTime.Now.ToString("yyyyMMddHHmmss") + IBussFactory<BussCounting>.Instance().GetSerialNum();
|
|||
|
|
// messModel.MENU_FORM = "FrmStorageLot";
|
|||
|
|
// messModel.MESS_CONTENT = DateTime.Now.ToShortDateString() + "新增盘点单,盘点类型:" + LEPCountType.Text + ",单据编号:" + countingWorkModel.COUNT_ID;
|
|||
|
|
// messModel.MESS_DATE = DateTime.Now;
|
|||
|
|
// messModel.MESS_DEP = countingWorkModel.STO_ID;
|
|||
|
|
// messModel.MESS_FLAG = "0";
|
|||
|
|
// messModel.MESS_STAR = userData.USER_ID;
|
|||
|
|
// messModel.WORK_KIND = "";
|
|||
|
|
// messModel.WORK_TYPE = "worktype003";
|
|||
|
|
// messModel.MESS_STATUS = "0";
|
|||
|
|
// messModel.STO_ID = countingWorkModel.STO_ID;
|
|||
|
|
// string strmessModel = Newtonsoft.Json.JsonConvert.SerializeObject(messModel);
|
|||
|
|
// err = IBussFactory<BussMessage>.Instance().Add(strmessModel);
|
|||
|
|
// if (!string.IsNullOrEmpty(err))
|
|||
|
|
// {
|
|||
|
|
// SystemCommon.ShowInfoMessageBox(err);
|
|||
|
|
// }
|
|||
|
|
// DateConfirm.EditValue = DateTime.Now;
|
|||
|
|
// DicConfirmMan.TextBoxFlag = userData.USER_ID;
|
|||
|
|
// DicConfirmMan.TextBoxValue = userData.NAME;
|
|||
|
|
// countingSelModel = countingWorkModel;
|
|||
|
|
//}
|
|||
|
|
frmButtonItem["Save"].Enabled = false;
|
|||
|
|
frmButtonItem["Refresh"].Enabled = false;
|
|||
|
|
frmButtonItem["Add"].Enabled = true;
|
|||
|
|
frmButtonItem["Edit"].Enabled = true;
|
|||
|
|
frmButtonItem["Del"].Enabled = true;
|
|||
|
|
DateConfirm.Enabled = true;
|
|||
|
|
DicConfirmMan.Enabled = true;
|
|||
|
|
PageWork.PageEnabled = false;
|
|||
|
|
xtraTabCounting.SelectedTabPage = PageSelect;
|
|||
|
|
bindCountGrid(new CountingModel());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("您的操作出错:" + Environment.NewLine + e.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 盘点类型值改变
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void LEPCountType_EditValueChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (LEPStoWork.EditValue == DBNull.Value || LEPCountType.EditValue == DBNull.Value)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (LEPStoWork.EditValue == null || LEPCountType.EditValue == null)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (LEPCountType.EditValue.ToString() == "2")
|
|||
|
|
{
|
|||
|
|
frmButtonItem["Goods"].Enabled = true;
|
|||
|
|
// return;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
frmButtonItem["Goods"].Enabled = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
bindgoods();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 仓库变化
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void LEPStoWork_EditValueChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (LEPStoWork.EditValue == DBNull.Value || LEPCountType.EditValue == DBNull.Value)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (LEPStoWork.EditValue == null || LEPCountType.EditValue == null)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
bindgoods();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 根据选择查询库存
|
|||
|
|
/// </summary>
|
|||
|
|
private void bindgoods()
|
|||
|
|
{
|
|||
|
|
string err = "";
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
infoList.Clear();
|
|||
|
|
GVCountInfoWork.RefreshData();
|
|||
|
|
if (LEPCountType.EditValue.ToString() == "0")
|
|||
|
|
{
|
|||
|
|
MIStockModel model = new MIStockModel() { STORAGE_ID = LEPStoWork.EditValue.ToString() };
|
|||
|
|
|
|||
|
|
List<MIStockModel> miList= IBussFactory<BussMIStock>.Instance().GetMIStockList(model);
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (miList != null && miList.Count > 0)
|
|||
|
|
{
|
|||
|
|
foreach (MIStockModel mi in miList)
|
|||
|
|
{
|
|||
|
|
if (infoList.Count(r => r.GOODS_ID == mi.GOODS_ID && r.STO_AREA == mi.AREA_ID && r.STO_SEAT == mi.LOCATION_ID) > 0)
|
|||
|
|
{
|
|||
|
|
infoList.Find(r => r.GOODS_ID == mi.GOODS_ID && r.STO_AREA == mi.AREA_ID && r.STO_SEAT == mi.LOCATION_ID).BOOK_NUM += mi.SHELVES_NUM;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
CountingInfoModel cim = new CountingInfoModel();
|
|||
|
|
cim.BOOK_NUM = mi.SHELVES_NUM;
|
|||
|
|
cim.GOODS_ID = mi.GOODS_ID;
|
|||
|
|
cim.GOODS_NAME = mi.GOODS_NAME;
|
|||
|
|
cim.STO_AREA = mi.AREA_ID;
|
|||
|
|
cim.STO_AREA_NAME = mi.AREA_NAME;
|
|||
|
|
cim.STO_SEAT = mi.LOCATION_ID;
|
|||
|
|
|
|||
|
|
infoList.Add(cim);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (infoList.Count > 0)
|
|||
|
|
{
|
|||
|
|
GCCountInfoWork.DataSource = infoList.OrderBy(r => r.STO_AREA);
|
|||
|
|
GVCountInfoWork.RefreshData();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (LEPCountType.EditValue.ToString() == "1")
|
|||
|
|
{
|
|||
|
|
MIStockBackModel model = new MIStockBackModel() { STORAGE_ID = LEPStoWork.EditValue.ToString() };
|
|||
|
|
|
|||
|
|
List<MIStockBackModel> miList = IBussFactory<BussMIStockBack>.Instance().GetList(model);
|
|||
|
|
|
|||
|
|
if (miList != null && miList.Count > 0)
|
|||
|
|
{
|
|||
|
|
miList = miList.FindAll(r => r.OPERATOR_DATE.ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd"));
|
|||
|
|
|
|||
|
|
foreach (MIStockBackModel mi in miList)
|
|||
|
|
{
|
|||
|
|
if (infoList.Count(r => r.GOODS_ID == mi.GOODS_ID && r.STO_AREA == mi.AREA_ID && r.STO_SEAT == mi.LOCATION_ID) > 0)
|
|||
|
|
{
|
|||
|
|
infoList.Find(r => r.GOODS_ID == mi.GOODS_ID && r.STO_AREA == mi.AREA_ID && r.STO_SEAT == mi.LOCATION_ID).BOOK_NUM += mi.GOODS_NUM;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
CountingInfoModel cim = new CountingInfoModel();
|
|||
|
|
|
|||
|
|
cim.BOOK_NUM = mi.GOODS_NUM;
|
|||
|
|
cim.GOODS_ID = mi.GOODS_ID;
|
|||
|
|
cim.GOODS_NAME = mi.GOODS_NAME;
|
|||
|
|
cim.STO_AREA = mi.AREA_ID;
|
|||
|
|
cim.STO_AREA_NAME = mi.AREA_NAME;
|
|||
|
|
cim.STO_SEAT = mi.LOCATION_ID;
|
|||
|
|
|
|||
|
|
infoList.Add(cim);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (infoList.Count > 0)
|
|||
|
|
{
|
|||
|
|
GCCountInfoWork.DataSource = infoList.OrderBy(r => r.STO_AREA);
|
|||
|
|
GVCountInfoWork.RefreshData();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (LEPCountType.EditValue.ToString() == "2")
|
|||
|
|
{
|
|||
|
|
FrmGoodsSelect frm = new FrmGoodsSelect(LEPStoWork.EditValue.ToString());
|
|||
|
|
frm.ShowDialog();
|
|||
|
|
|
|||
|
|
if (frm.miStockModelList.Count > 0)
|
|||
|
|
{
|
|||
|
|
foreach (MIStockModel mmodel in frm.miStockModelList)
|
|||
|
|
{
|
|||
|
|
if (infoList.Count(r => r.GOODS_ID == mmodel.GOODS_ID && r.STO_AREA == mmodel.AREA_ID && r.STO_SEAT == mmodel.LOCATION_ID) > 0)
|
|||
|
|
{
|
|||
|
|
infoList.Find(r => r.GOODS_ID == mmodel.GOODS_ID && r.STO_AREA == mmodel.AREA_ID && r.STO_SEAT == mmodel.LOCATION_ID).BOOK_NUM += mmodel.SHELVES_NUM;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
CountingInfoModel cim = new CountingInfoModel();
|
|||
|
|
cim.BOOK_NUM = mmodel.SHELVES_NUM;
|
|||
|
|
cim.GOODS_ID = mmodel.GOODS_ID;
|
|||
|
|
cim.STO_AREA = mmodel.AREA_ID;
|
|||
|
|
cim.STO_SEAT = mmodel.LOCATION_ID;
|
|||
|
|
cim.STO_AREA_NAME = mmodel.AREA_NAME;
|
|||
|
|
cim.GOODS_NAME = mmodel.GOODS_NAME;
|
|||
|
|
infoList.Add(cim);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (infoList.Count > 0)
|
|||
|
|
{
|
|||
|
|
GCCountInfoWork.DataSource = infoList.OrderBy(r => r.STO_AREA);
|
|||
|
|
GVCountInfoWork.RefreshData();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox("库存查询失败!" + e.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 列值显示转换
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void GVCountInfoWork_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (e.Column.FieldName == "BOOK_NUM")
|
|||
|
|
{
|
|||
|
|
e.DisplayText = "**";
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 盘点单双击
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void GCCounting_DoubleClick(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
xtraTabCounting.SelectedTabPage = PageWork;
|
|||
|
|
BSCountingWork.DataSource = countingSelModel;
|
|||
|
|
|
|||
|
|
DicPlanMan.TextBoxFlag = countingSelModel.PLAN_MAN;
|
|||
|
|
DicPlanMan.TextBoxValue = countingSelModel.PLAN_MAN_NAME;
|
|||
|
|
DicConfirmMan.TextBoxFlag = countingSelModel.CONFIRM_MAN;
|
|||
|
|
DicConfirmMan.TextBoxValue = countingSelModel.CONFIRM_MAN_NAME;
|
|||
|
|
DicCount.TextBoxFlag = countingSelModel.COUNT_MAN;
|
|||
|
|
DicCount.TextBoxValue = countingSelModel.COUNT_MAN_NAME;
|
|||
|
|
|
|||
|
|
GCCountInfoWork.DataSource = infoList;
|
|||
|
|
GVCountInfoWork.RefreshData();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 盘点明细双击
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void GCCountingInfo_DoubleClick(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
xtraTabCounting.SelectedTabPage = PageWork;
|
|||
|
|
BSCountingWork.DataSource = countingSelModel;
|
|||
|
|
DicPlanMan.TextBoxFlag = countingSelModel.PLAN_MAN;
|
|||
|
|
DicPlanMan.TextBoxValue = countingSelModel.PLAN_MAN_NAME;
|
|||
|
|
DicConfirmMan.TextBoxFlag = countingSelModel.CONFIRM_MAN;
|
|||
|
|
DicConfirmMan.TextBoxValue = countingSelModel.CONFIRM_MAN_NAME;
|
|||
|
|
DicCount.TextBoxFlag = countingSelModel.COUNT_MAN;
|
|||
|
|
DicCount.TextBoxValue = countingSelModel.COUNT_MAN_NAME;
|
|||
|
|
|
|||
|
|
GCCountInfoWork.DataSource = infoList;
|
|||
|
|
GVCountInfoWork.RefreshData();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 超链接点击
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void repositoryItemHyperLinkEdit1_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
CountingInfoModel model = GVCountingInfo.GetFocusedRow() as CountingInfoModel;
|
|||
|
|
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();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 超链接点击
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void repositoryItemHyperLinkEdit2_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
CountingInfoModel model = GVCountInfoWork.GetFocusedRow() as CountingInfoModel;
|
|||
|
|
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();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 超链接点击
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void repositoryItemHyperLinkEdit3_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
CountingInfoModel model = GVCountInfoWork.GetFocusedRow() as CountingInfoModel;
|
|||
|
|
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();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 超链接点击
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void repositoryItemHyperLinkEdit4_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
CountingInfoModel model = GVCountingInfo.GetFocusedRow() as CountingInfoModel;
|
|||
|
|
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();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|