1270 lines
48 KiB
C#
1270 lines
48 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.RK;
|
|||
|
|
using WMS.Common;
|
|||
|
|
|
|||
|
|
using WMS.Ctrl;
|
|||
|
|
using WMS.Model.Base;
|
|||
|
|
using DevExpress.XtraEditors.Repository;
|
|||
|
|
using WMS.Business;
|
|||
|
|
using WMS.Business.Base;
|
|||
|
|
using WMS.Business.Common;
|
|||
|
|
using WMS.Business.RK;
|
|||
|
|
|
|||
|
|
namespace WMS.FrmRK
|
|||
|
|
{
|
|||
|
|
public partial class FrmReceive : FormBase
|
|||
|
|
{
|
|||
|
|
#region 参数列表
|
|||
|
|
/// <summary>
|
|||
|
|
/// 收货MODEL
|
|||
|
|
/// </summary>
|
|||
|
|
ReceivingModel receModel = new ReceivingModel();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 通知单MODEL
|
|||
|
|
/// </summary>
|
|||
|
|
WareNoticeModel noticeModel = new WareNoticeModel();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 通知单MODEL
|
|||
|
|
/// </summary>
|
|||
|
|
WareNoticeModel noticeMessModel = new WareNoticeModel();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 通知单集合
|
|||
|
|
/// </summary>
|
|||
|
|
List<WareNoticeModel> noticeListModel = new List<WareNoticeModel>();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 通知单明细集合
|
|||
|
|
/// </summary>
|
|||
|
|
List<WareNoticeTabModel> noticeTabListModel = new List<WareNoticeTabModel>();
|
|||
|
|
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 码盘明细集合
|
|||
|
|
/// </summary>
|
|||
|
|
List<CodeDiskModel> CodeDiskListModel = new List<CodeDiskModel>();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 收货单
|
|||
|
|
/// </summary>
|
|||
|
|
List<ReceivingModel> receListModel = new List<ReceivingModel>();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 收货明细数据源
|
|||
|
|
/// </summary>
|
|||
|
|
List<ReceivingInfoModel> InfoList = new List<ReceivingInfoModel>();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 收货明细数据源Copy
|
|||
|
|
/// </summary>
|
|||
|
|
List<ReceivingInfoModel> CopyList = new List<ReceivingInfoModel>();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 明细增加
|
|||
|
|
/// </summary>
|
|||
|
|
List<ReceivingInfoModel> AddList = new List<ReceivingInfoModel>();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 明细修改
|
|||
|
|
/// </summary>
|
|||
|
|
List<ReceivingInfoModel> UpList = new List<ReceivingInfoModel>();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 明细删除
|
|||
|
|
/// </summary>
|
|||
|
|
List<ReceivingInfoModel> DelList = new List<ReceivingInfoModel>();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 入库批次Model
|
|||
|
|
/// </summary>
|
|||
|
|
StorageLotModel stoModel = new StorageLotModel();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 入库批次MODEL
|
|||
|
|
/// </summary>
|
|||
|
|
List<StorageLotModel> lotList = new List<StorageLotModel>();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 入库批次明细Model
|
|||
|
|
/// </summary>
|
|||
|
|
StorageLotInfoModel stoInfomodel = new StorageLotInfoModel();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 入库批次明细集合
|
|||
|
|
/// </summary>
|
|||
|
|
List<StorageLotInfoModel> stoInfoList = new List<StorageLotInfoModel>();
|
|||
|
|
|
|||
|
|
List<StorageLotInfoModel> stoCopyList = new List<StorageLotInfoModel>();
|
|||
|
|
List<StorageLotInfoModel> stoAddList = new List<StorageLotInfoModel>();
|
|||
|
|
List<StorageLotInfoModel> stoUpList = new List<StorageLotInfoModel>();
|
|||
|
|
List<StorageLotInfoModel> stoDelList = new List<StorageLotInfoModel>();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 商品MODEL集合
|
|||
|
|
/// </summary>
|
|||
|
|
List<JWGoodsInfoModel> goodsListModel = new List<JWGoodsInfoModel>();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 商品MODEL
|
|||
|
|
/// </summary>
|
|||
|
|
JWGoodsInfoModel goodModel = new JWGoodsInfoModel();
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// LEP菜单对象
|
|||
|
|
/// </summary>
|
|||
|
|
private DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit lueUnits = new RepositoryItemLookUpEdit();
|
|||
|
|
|
|||
|
|
private string unit = string.Empty;//记录原单位
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 业务类型
|
|||
|
|
/// </summary>
|
|||
|
|
int workflag = 3;//0 增加 1 修改 2 删除 ;
|
|||
|
|
|
|||
|
|
int gvNoticeFocid = -1;//通知单当前列索引
|
|||
|
|
int gvReveFocid = -1;//收货单单当前列索引
|
|||
|
|
|
|||
|
|
public string wareNoticeID = string.Empty;
|
|||
|
|
bool load = true;
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
public FrmReceive()
|
|||
|
|
{
|
|||
|
|
InitializeComponent();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#region 页面绑定操作
|
|||
|
|
/// <summary>
|
|||
|
|
/// 页面加载
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
public void FrmReceive_Load(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
FrmSelectModle = new ReceivingModel();
|
|||
|
|
bindLEP();
|
|||
|
|
LEPProvater.LoadData();
|
|||
|
|
LEPTeam.LoadData();
|
|||
|
|
DicReceMan.TextBoxFlag = userData.USER_ID;
|
|||
|
|
DicReceMan.TextBoxValue = userData.NAME;
|
|||
|
|
PageRece.PageEnabled = false;
|
|||
|
|
DicNotice.selSql = string.Format(@"select t.WAREHOUSING_ID,d.PROVIDER_NAME
|
|||
|
|
from t_rk_ware_notice t
|
|||
|
|
LEFT JOIN T_BASE_PROVIDER_DICTIONARY d ON t.PROVIDER_ID = d.PROVIDER_ID
|
|||
|
|
where PURCHASE_COUNT>AMOUNT order by WAREHOUSING_ID desc");
|
|||
|
|
if (!string.IsNullOrEmpty(wareNoticeID))
|
|||
|
|
{
|
|||
|
|
PageRece.PageEnabled = true;
|
|||
|
|
xtraTab.SelectedTabPage = PageRece;
|
|||
|
|
bingNotieceGrid();
|
|||
|
|
|
|||
|
|
DicNotice.TextBoxFlag = wareNoticeID;
|
|||
|
|
DicNotice.TextBoxValue = wareNoticeID;
|
|||
|
|
BSReceive.DataSource = receModel;
|
|||
|
|
DicPrintMan.TextBoxFlag = userData.USER_ID;
|
|||
|
|
DicPrintMan.TextBoxValue = userData.NAME;
|
|||
|
|
DicReceMan.TextBoxFlag = userData.USER_ID;
|
|||
|
|
DicReceMan.TextBoxValue = userData.NAME;
|
|||
|
|
DateRece.EditValue = DateTime.Now;
|
|||
|
|
workflag = 0;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
bingReceveGrid(new WareNoticeModel());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 通用查询
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="table"></param>
|
|||
|
|
public override void LoadListData(DataTable table)
|
|||
|
|
{
|
|||
|
|
receListModel = ConvertHelper<ReceivingModel>.ConvertToList(table);
|
|||
|
|
GCReceive.DataSource = receListModel;
|
|||
|
|
GVReceive.RefreshData();
|
|||
|
|
if (receListModel.Count > 0)
|
|||
|
|
{
|
|||
|
|
receModel = receListModel[0];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 绑定下拉框
|
|||
|
|
/// </summary>
|
|||
|
|
private void bindLEP()
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
goodsListModel = IBussFactory<BussGoods>.Instance().GetGoodsList("", "", "", "");
|
|||
|
|
|
|||
|
|
if (goodsListModel != null)
|
|||
|
|
{
|
|||
|
|
repositoryItemLookUpEdit1.DataSource = goodsListModel;
|
|||
|
|
repositoryItemLookUpEdit1.DisplayMember = "GOODS_NAME";
|
|||
|
|
repositoryItemLookUpEdit1.ValueMember = "GOODS_ID";
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
List<PalletModel> palletModelList = IBussFactory<BussPallet>.Instance().GetPalletList(new PalletModel());
|
|||
|
|
if (palletModelList != null)
|
|||
|
|
{
|
|||
|
|
repositoryItemLookUpEdit2.DataSource = palletModelList;
|
|||
|
|
repositoryItemLookUpEdit2.DisplayMember = "PALLET_NAME";
|
|||
|
|
repositoryItemLookUpEdit2.ValueMember = "PALLET_ID";
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
//string errtext = "";
|
|||
|
|
////string dic = Newtonsoft.Json.JsonConvert.SerializeObject(new WMS.Model.SystemManage.DictionaryTabModel() { VC_DICTIONARY_ID = "vc_uom" });
|
|||
|
|
//string diclist = WebLockConfig.Instance.DictionaryTab.GetDictionaryTab("vc_uom", ref errtext);
|
|||
|
|
//List<WMS.Model.SystemManage.DictionaryTabModel> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<WMS.Model.SystemManage.DictionaryTabModel>>(diclist);
|
|||
|
|
|
|||
|
|
//repositoryItemLookUpEdit3.DataSource = list;
|
|||
|
|
//repositoryItemLookUpEdit3.DisplayMember = "VC_DICTIONARY_NAME";
|
|||
|
|
//repositoryItemLookUpEdit3.ValueMember = "VC_CHAR_VALUE";
|
|||
|
|
repositoryItemLookUpEdit3.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("VC_DICTIONARY_NAME", "单位"));
|
|||
|
|
repositoryItemLookUpEdit3.ValueMember = "VC_CHAR_VALUE";
|
|||
|
|
repositoryItemLookUpEdit3.DisplayMember = "VC_DICTIONARY_NAME";
|
|||
|
|
DataTable ds = IBussFactory<BussCommon>.Instance().GetCustomCtrlData("t_sys_dictionary_tab", "VC_CHAR_VALUE", "VC_DICTIONARY_NAME", " VC_DICTIONARY_TYPE = 'vc_uom' and c_flag = '1'", "");
|
|||
|
|
if(ds!=null)
|
|||
|
|
repositoryItemLookUpEdit3.DataSource = ds;
|
|||
|
|
|
|||
|
|
lueUnits.NullText = "";
|
|||
|
|
lueUnits.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("UNIT_NAME", "单位"));
|
|||
|
|
lueUnits.ValueMember = "UNIT";
|
|||
|
|
lueUnits.DisplayMember = "UNIT_NAME";
|
|||
|
|
|
|||
|
|
|
|||
|
|
repositoryItemLookUpEdit4.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("VC_DICTIONARY_NAME", "重量单位"));
|
|||
|
|
repositoryItemLookUpEdit4.ValueMember = "VC_CHAR_VALUE";
|
|||
|
|
repositoryItemLookUpEdit4.DisplayMember = "VC_DICTIONARY_NAME";
|
|||
|
|
DataTable dsResult = IBussFactory<BussCommon>.Instance().GetCustomCtrlData("t_sys_dictionary_tab", "VC_CHAR_VALUE", "VC_DICTIONARY_NAME", " VC_DICTIONARY_TYPE = 'kg_unit' and c_flag = '1'", "");
|
|||
|
|
if (dsResult != null)
|
|||
|
|
repositoryItemLookUpEdit4.DataSource = dsResult;
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 通知单绑定
|
|||
|
|
/// </summary>
|
|||
|
|
private void bingNotieceGrid()
|
|||
|
|
{
|
|||
|
|
string errstr = "";
|
|||
|
|
if (!string.IsNullOrEmpty(DicNotice.TextBoxValue))
|
|||
|
|
{
|
|||
|
|
noticeModel = new WareNoticeModel() { WAREHOUSING_ID = DicNotice.TextBoxValue };
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
noticeModel = new WareNoticeModel() { WAREHOUSING_ID = wareNoticeID };
|
|||
|
|
}
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
noticeListModel= IBussFactory<BussWareNotice>.Instance().GetWareNoticeList(noticeModel);
|
|||
|
|
|
|||
|
|
|
|||
|
|
if (noticeListModel.Count > 0)
|
|||
|
|
{
|
|||
|
|
noticeModel = noticeListModel[0];
|
|||
|
|
bingReceveGrid(noticeModel);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 收货单绑定
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="Notice">通知单</param>
|
|||
|
|
private void bingReceveGrid(WareNoticeModel Notice)
|
|||
|
|
{
|
|||
|
|
receModel = new ReceivingModel();
|
|||
|
|
receModel.NOTICE_ID = Notice.WAREHOUSING_ID;
|
|||
|
|
receModel.CAR_ID = Notice.CARNO;
|
|||
|
|
receModel.DRIVER = Notice.DRIVER;
|
|||
|
|
receModel.PROVIDER_ID = Notice.PROVIDER_ID;
|
|||
|
|
receModel.SHIPPERS = Notice.SHIPPERS;
|
|||
|
|
receModel.BUY_NUM_SUM = Notice.PURCHASE_COUNT;
|
|||
|
|
receModel.RECE_DATE = DateTime.Now;
|
|||
|
|
receModel.ORI_BILL = Notice.PURCHASE_ID;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
receListModel = IBussFactory<BussReceve>.Instance().GetList(receModel);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
GCReceive.DataSource = receListModel;
|
|||
|
|
GVReceive.RefreshData();
|
|||
|
|
|
|||
|
|
if (receListModel.Count > 0)
|
|||
|
|
{
|
|||
|
|
receModel = receListModel[0];
|
|||
|
|
}
|
|||
|
|
bingInfoGrid(Notice, receModel);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 绑定收货明细
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="Notice">通知单</param>
|
|||
|
|
/// <param name="Receve">入库单</param>
|
|||
|
|
private void bingInfoGrid(WareNoticeModel Notice,ReceivingModel Receve)
|
|||
|
|
{
|
|||
|
|
string errtxt = "";
|
|||
|
|
if (!string.IsNullOrEmpty(Receve.RECE_ID))
|
|||
|
|
{
|
|||
|
|
if (!string.IsNullOrEmpty(Receve.RECE_ID))
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
InfoList = IBussFactory<BussReceve>.Instance().GetInfoList(Receve.RECE_ID);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (Notice.TRAY_STATE == "0" || Notice.TRAY_STATE == null)
|
|||
|
|
{
|
|||
|
|
WareNoticeTabModel model = new WareNoticeTabModel();
|
|||
|
|
model.WAREHOUSING_ID = Notice.WAREHOUSING_ID;
|
|||
|
|
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
noticeTabListModel = IBussFactory<BussWareNoticeTab>.Instance().GetWareNoticeTabList(model);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (noticeTabListModel.Count > 0)
|
|||
|
|
{
|
|||
|
|
InfoList.Clear();
|
|||
|
|
foreach (WareNoticeTabModel tabmodel in noticeTabListModel)
|
|||
|
|
{
|
|||
|
|
ReceivingInfoModel imodel = new ReceivingInfoModel();
|
|||
|
|
imodel.BUY_NUM = tabmodel.AMOUNT;
|
|||
|
|
imodel.GOODS_ID = tabmodel.GOODS_ID;
|
|||
|
|
imodel.GOODS_NAME = tabmodel.GOODS_NAME;
|
|||
|
|
imodel.GRO_WEIGHT = tabmodel.TOTAL_ROUGH_WEIGHT;
|
|||
|
|
imodel.MADE_DATE = tabmodel.PRODUCTION_DATE;
|
|||
|
|
imodel.NET_WEIGHT = tabmodel.TOTAL_NET_WEIGH;
|
|||
|
|
imodel.RECE_MONEY = tabmodel.TOTAL_MONEY;
|
|||
|
|
imodel.RECE_VOLUEM = tabmodel.TOTAL_VOLUME;
|
|||
|
|
imodel.STO_TRAY = tabmodel.PACKAGE_ID;
|
|||
|
|
imodel.OPERATORID = userData.USER_ID;
|
|||
|
|
imodel.OPERATORNAME = userData.NAME;
|
|||
|
|
imodel.OPERATEDATE = DateTime.Now;
|
|||
|
|
imodel.VOLUME_UNIT = tabmodel.GVOLUME;
|
|||
|
|
imodel.UNIT = tabmodel.UNIT;
|
|||
|
|
imodel.PRICE = tabmodel.PRICE;
|
|||
|
|
imodel.SCALE_UNIT = tabmodel.SCALE_UNIT;
|
|||
|
|
InfoList.Add(imodel);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
CodeDiskModel model = new CodeDiskModel();
|
|||
|
|
model.Warehousing_id = Notice.WAREHOUSING_ID;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
CodeDiskListModel = IBussFactory<BussCodeDisk>.Instance().GetCodeDisk(model);
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (CodeDiskListModel.Count > 0)
|
|||
|
|
{
|
|||
|
|
InfoList.Clear();
|
|||
|
|
foreach (CodeDiskModel codeDisk in CodeDiskListModel)
|
|||
|
|
{
|
|||
|
|
ReceivingInfoModel imodel = new ReceivingInfoModel();
|
|||
|
|
imodel.BUY_NUM = codeDisk.Goods_Num;
|
|||
|
|
imodel.GOODS_ID = codeDisk.Goods_id;
|
|||
|
|
imodel.GOODS_NAME = codeDisk.Goods_name;
|
|||
|
|
imodel.GRO_WEIGHT = codeDisk.Total_rough_weight;
|
|||
|
|
imodel.MADE_DATE = codeDisk.Production_date;
|
|||
|
|
imodel.NET_WEIGHT = codeDisk.Total_net_weigh;
|
|||
|
|
imodel.RECE_MONEY = codeDisk.Total_money;
|
|||
|
|
imodel.RECE_VOLUEM = codeDisk.Total_volume;
|
|||
|
|
imodel.STO_TRAY = codeDisk.Pallet_id;
|
|||
|
|
imodel.OPERATORID = userData.USER_ID;
|
|||
|
|
imodel.OPERATORNAME = userData.NAME;
|
|||
|
|
imodel.OPERATEDATE = DateTime.Now;
|
|||
|
|
imodel.VOLUME_UNIT = codeDisk.Gvolume;
|
|||
|
|
imodel.UNIT = codeDisk.Unit;
|
|||
|
|
imodel.SCALE_UNIT = codeDisk.Scale_unit;
|
|||
|
|
imodel.PRICE = codeDisk.Price;
|
|||
|
|
|
|||
|
|
InfoList.Add(imodel);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
GCReceiveInfo.DataSource = InfoList;
|
|||
|
|
GVReceiveInfo.RefreshData();
|
|||
|
|
CopyList = InfoList.ToList();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// GV单击
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void GVReceive_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (GVReceive.FocusedRowHandle < 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
receModel = GVReceive.GetFocusedRow() as ReceivingModel;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// GV双击
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void GCReceive_DoubleClick(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (GVReceive.FocusedRowHandle < 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
LoadForm load = new LoadForm();
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(load, load.GetType(), false, true, false, 50);
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormDescription("正加载窗体....");
|
|||
|
|
receModel = GVReceive.GetFocusedRow() as ReceivingModel;
|
|||
|
|
|
|||
|
|
BSReceive.DataSource = receModel;
|
|||
|
|
if (!string.IsNullOrEmpty(receModel.RECE_MAN))
|
|||
|
|
{
|
|||
|
|
DicReceMan.TextBoxValue = receModel.RECE_MAN_NAME;
|
|||
|
|
DicReceMan.TextBoxFlag = receModel.RECE_MAN;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
DicReceMan.TextBoxValue = userData.NAME;
|
|||
|
|
DicReceMan.TextBoxFlag = userData.USER_ID;
|
|||
|
|
}
|
|||
|
|
if (!string.IsNullOrEmpty(receModel.PRINT_MAN))
|
|||
|
|
{
|
|||
|
|
DicPrintMan.TextBoxValue = receModel.PRINT_MAN_NAME;
|
|||
|
|
DicPrintMan.TextBoxFlag = receModel.PRINT_MAN;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
DicPrintMan.TextBoxValue = userData.NAME;
|
|||
|
|
DicPrintMan.TextBoxFlag = userData.USER_ID;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
DicCar.TextBoxFlag = receModel.CAR_ID;
|
|||
|
|
DicCar.TextBoxValue = receModel.CAR_ID;
|
|||
|
|
DicNotice.TextBoxFlag = receModel.NOTICE_ID;
|
|||
|
|
DicNotice.TextBoxValue = receModel.NOTICE_ID;
|
|||
|
|
bingInfoGrid(noticeMessModel, receModel);
|
|||
|
|
|
|||
|
|
|
|||
|
|
PageRece.PageEnabled = true;
|
|||
|
|
xtraTab.SelectedTabPage = PageRece;
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 以下是继承的按钮事件
|
|||
|
|
/// <summary>
|
|||
|
|
/// 新增按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Add()
|
|||
|
|
{
|
|||
|
|
PageRece.PageEnabled = true;
|
|||
|
|
xtraTab.SelectedTabPage = PageRece;
|
|||
|
|
DicNotice.Enabled = true;
|
|||
|
|
workflag = 0;
|
|||
|
|
frmButtonItem["Save"].Enabled = true;
|
|||
|
|
frmButtonItem["Rebreak"].Enabled = true;
|
|||
|
|
frmButtonItem["Clear"].Enabled = true;
|
|||
|
|
frmButtonItem["Audit"].Enabled = true;
|
|||
|
|
|
|||
|
|
receModel = new ReceivingModel();
|
|||
|
|
BSReceive.DataSource = receModel;
|
|||
|
|
|
|||
|
|
DicCar.TextBoxFlag = null;
|
|||
|
|
DicCar.TextBoxValue = null;
|
|||
|
|
DicNotice.TextBoxValue = null;
|
|||
|
|
DicNotice.TextBoxFlag = null;
|
|||
|
|
DicPrintMan.TextBoxFlag = userData.USER_ID;
|
|||
|
|
DicPrintMan.TextBoxValue = userData.NAME;
|
|||
|
|
DicReceMan.TextBoxFlag = userData.USER_ID;
|
|||
|
|
DicReceMan.TextBoxValue = userData.NAME;
|
|||
|
|
|
|||
|
|
if (string.IsNullOrEmpty(DicNotice.TextBoxValue))
|
|||
|
|
{
|
|||
|
|
InfoList.Clear();
|
|||
|
|
CopyList.Clear();
|
|||
|
|
GVReceiveInfo.RefreshData();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 保存按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Save()
|
|||
|
|
{
|
|||
|
|
if (workflag == 3)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
FrmOperator(workflag);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 删除按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Del()
|
|||
|
|
{
|
|||
|
|
if (GVReceive.FocusedRowHandle < 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
receModel = GVReceive.GetFocusedRow() as ReceivingModel;
|
|||
|
|
if (receModel.PRINT_NUM > 0 || receModel.STO_NUM_SUM > 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("该单据已不能作废!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
workflag = 2;
|
|||
|
|
frmButtonItem["Save"].Enabled = true;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 修改按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Edit()
|
|||
|
|
{
|
|||
|
|
if (GVReceive.FocusedRowHandle < 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
receModel = GVReceive.GetFocusedRow() as ReceivingModel;
|
|||
|
|
if (receModel.STO_NUM_SUM > 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox("该单据已做过入库,不能再修改!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (receModel.PRINT_NUM > 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox("该单据已经派发,不能再修改!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
GCReceive_DoubleClick(null, null);
|
|||
|
|
workflag = 1;
|
|||
|
|
frmButtonItem["Rebreak"].Enabled = true;
|
|||
|
|
frmButtonItem["Clear"].Enabled = true;
|
|||
|
|
frmButtonItem["Audit"].Enabled = true;
|
|||
|
|
frmButtonItem["Save"].Enabled = true;
|
|||
|
|
frmButtonItem["Confirm"].Enabled = false;
|
|||
|
|
PageRece.PageEnabled = true;
|
|||
|
|
xtraTab.SelectedTabPage = PageRece;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 确定按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Confirm()
|
|||
|
|
{
|
|||
|
|
if (receModel.NOTICE_ID == null || InfoList.Count <= 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (receModel.ARR_NUM_SUM != 0)
|
|||
|
|
{
|
|||
|
|
if (receModel.STO_NUM_SUM == receModel.ARR_NUM_SUM)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("该单据已完成入库!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("该单据还未到货!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
FormBase formBase = OpenFrmTable("WMS.FrmRK", "FrmStorage");//创建窗体
|
|||
|
|
if (formBase != null)
|
|||
|
|
{
|
|||
|
|
FrmStorageLot frmStorage = formBase as FrmStorageLot;
|
|||
|
|
frmStorage.receModel = receModel;
|
|||
|
|
frmStorage.receInfoList = InfoList;
|
|||
|
|
if (!OpenTabAddFrm("0306", "FrmStorage", "确认入库-" + receModel.NOTICE_ID))
|
|||
|
|
{
|
|||
|
|
frmStorage.FrmStorage_Load (null, null);//如果已经被打开,执行一下窗体加载方法
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 查询按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Search()
|
|||
|
|
{
|
|||
|
|
bingNotieceGrid();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 忙收
|
|||
|
|
/// </summary>
|
|||
|
|
public void Refresh()
|
|||
|
|
{
|
|||
|
|
receModel = new ReceivingModel() { RECE_DATE = DateTime.Now };
|
|||
|
|
InfoList.Clear();
|
|||
|
|
CopyList.Clear();
|
|||
|
|
BSReceive.DataSource = receModel;
|
|||
|
|
DicNotice.TextBoxFlag = string.Empty;
|
|||
|
|
DicNotice.TextBoxValue = string.Empty;
|
|||
|
|
BSReceive.ResetBindings(true);
|
|||
|
|
GVReceiveInfo.RefreshData();
|
|||
|
|
|
|||
|
|
DicPrintMan.TextBoxFlag = userData.USER_ID;
|
|||
|
|
DicPrintMan.TextBoxValue = userData.NAME;
|
|||
|
|
DicReceMan.TextBoxFlag = userData.USER_ID;
|
|||
|
|
DicReceMan.TextBoxValue = userData.NAME;
|
|||
|
|
DateRece.EditValue = DateTime.Now;
|
|||
|
|
PageRece.PageEnabled = true;
|
|||
|
|
xtraTab.SelectedTabPage = PageRece;
|
|||
|
|
|
|||
|
|
workflag = 0;
|
|||
|
|
frmButtonItem["Save"].Enabled = true;
|
|||
|
|
frmButtonItem["Audit"].Enabled = false;
|
|||
|
|
frmButtonItem["Rebreak"].Enabled = true;
|
|||
|
|
frmButtonItem["Clear"].Enabled = true;
|
|||
|
|
DicNotice.Enabled = false;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 明细增加
|
|||
|
|
/// </summary>
|
|||
|
|
public void Rebreak()
|
|||
|
|
{
|
|||
|
|
if (workflag == 3)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
ReceivingInfoModel infomodel = new ReceivingInfoModel() { RECE_ID = receModel.RECE_ID };
|
|||
|
|
InfoList.Add(infomodel);
|
|||
|
|
|
|||
|
|
GCReceiveInfo.DataSource = InfoList;
|
|||
|
|
GVReceiveInfo.RefreshData();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 明细删除
|
|||
|
|
/// </summary>
|
|||
|
|
public void Clear()
|
|||
|
|
{
|
|||
|
|
if (GVReceiveInfo.FocusedRowHandle < 0 || InfoList.Count == 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
ReceivingInfoModel mod = InfoList[GVReceiveInfo.FocusedRowHandle];
|
|||
|
|
InfoList.Remove(mod);
|
|||
|
|
if (AddList.Contains(mod))
|
|||
|
|
{
|
|||
|
|
AddList.Remove(mod);
|
|||
|
|
}
|
|||
|
|
if (!string.IsNullOrEmpty(mod.GOODS_ID))
|
|||
|
|
{
|
|||
|
|
DelList.Add(mod);
|
|||
|
|
}
|
|||
|
|
GCReceiveInfo.DataSource = InfoList;
|
|||
|
|
GVReceiveInfo.RefreshData();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 明细保存
|
|||
|
|
/// </summary>
|
|||
|
|
public void Audit()
|
|||
|
|
{
|
|||
|
|
if (AddList.Count > 0 || DelList.Count > 0)
|
|||
|
|
{
|
|||
|
|
decimal num = receModel.ARR_NUM_SUM;
|
|||
|
|
receModel.ARR_NUM_SUM = 0;
|
|||
|
|
foreach (ReceivingInfoModel model in AddList)
|
|||
|
|
{
|
|||
|
|
receModel.ARR_NUM_SUM += model.ARR_NUM;
|
|||
|
|
}
|
|||
|
|
foreach (ReceivingInfoModel model in DelList)
|
|||
|
|
{
|
|||
|
|
receModel.ARR_NUM_SUM -= model.ARR_NUM;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
string err = IBussFactory<BussReceve>.Instance().newReceivingInfoFuc(UpList, AddList, DelList, receModel);
|
|||
|
|
|
|||
|
|
if (!string.IsNullOrEmpty(err))
|
|||
|
|
{
|
|||
|
|
receModel.ARR_NUM_SUM = num;
|
|||
|
|
SystemCommon.ShowErrorMessageBox(err);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("明细修改成功!");
|
|||
|
|
receModel.ARR_NUM_SUM = num;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 打印按钮
|
|||
|
|
/// </summary>
|
|||
|
|
public void Print()
|
|||
|
|
{
|
|||
|
|
if (!string.IsNullOrEmpty(DicPrintMan.TextBoxFlag))
|
|||
|
|
{
|
|||
|
|
receModel.PRINT_MAN = DicPrintMan.TextBoxFlag;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
receModel.PRINT_MAN = userData.USER_ID;
|
|||
|
|
}
|
|||
|
|
receModel.PRINT_DATE = DateTime.Now;
|
|||
|
|
receModel.PRINT_NUM += 1;
|
|||
|
|
string err = IBussFactory<BussReceve>.Instance().Update(receModel);
|
|||
|
|
if (!string.IsNullOrEmpty(err))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox(err);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("打印成功!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// 审核
|
|||
|
|
/// </summary>
|
|||
|
|
public void AuditDataButton()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 反审核
|
|||
|
|
/// </summary>
|
|||
|
|
public void ReturnAuditDataButton()
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
#region 操作(增、改、删)
|
|||
|
|
/// <summary>
|
|||
|
|
/// 操作(增、改、删)
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="flag">0 新增 1修改 2删除 3停用 4启用/param>
|
|||
|
|
private void FrmOperator(int flag)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
GVReceiveInfo.CloseEditor();
|
|||
|
|
GVReceiveInfo.UpdateCurrentRow();
|
|||
|
|
string err = "";
|
|||
|
|
if (flag == 0)
|
|||
|
|
{
|
|||
|
|
if (InfoList.Count == 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
foreach (ReceivingInfoModel infomodel in InfoList)
|
|||
|
|
{
|
|||
|
|
if (infomodel.ARR_NUM == 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("商品的到货数量不能为0!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
receModel = BSReceive.DataSource as ReceivingModel;
|
|||
|
|
//string num = WebLockConfig.Instance.WebReceve.execGetSerialNum();
|
|||
|
|
//receModel.RECE_ID = "SH" + DateTime.Now.ToString("yyyyMMdd") + num;
|
|||
|
|
receModel.STATIC = "0";
|
|||
|
|
receModel.BUY_NUM_SUM = Convert.ToDecimal(colBUY_NUM.SummaryText);
|
|||
|
|
receModel.ARR_NUM_SUM = Convert.ToDecimal(colARR_NUM.SummaryText);
|
|||
|
|
receModel.STO_NUM_SUM = Convert.ToDecimal(colSTO_NUM.SummaryText);
|
|||
|
|
receModel.SHELVE_NUM_SUM = Convert.ToDecimal(colSHELVE_NUM.SummaryText);
|
|||
|
|
receModel.RECE_MAN = DicReceMan.TextBoxFlag;
|
|||
|
|
receModel.PRINT_MAN = DicPrintMan.TextBoxFlag;
|
|||
|
|
receModel.NOTICE_ID = DicNotice.TextBoxValue;
|
|||
|
|
receModel.CAR_ID = DicNotice.TextBoxValue;
|
|||
|
|
receModel.ENTRY_MAN = userData.USER_ID;
|
|||
|
|
receModel.ENTRY_MAN_NAME = userData.NAME;
|
|||
|
|
receModel.ENTRY_DATE = DateTime.Now;
|
|||
|
|
|
|||
|
|
//foreach (ReceivingInfoModel infomodel in InfoList)
|
|||
|
|
//{
|
|||
|
|
// infomodel.RECE_ID = receModel.RECE_ID;
|
|||
|
|
//}
|
|||
|
|
|
|||
|
|
string receveModel = Newtonsoft.Json.JsonConvert.SerializeObject(receModel);
|
|||
|
|
string receveInfoList = Newtonsoft.Json.JsonConvert.SerializeObject(InfoList);
|
|||
|
|
//try
|
|||
|
|
//{
|
|||
|
|
// err = WebLockConfig.Instance.WebReceve.execReceveAdd(receveModel, receveInfoList);
|
|||
|
|
//}
|
|||
|
|
//catch
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowErrorMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
//}
|
|||
|
|
}
|
|||
|
|
else if (flag == 1)
|
|||
|
|
{
|
|||
|
|
if (InfoList.Count == 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
receModel.BUY_NUM_SUM = Convert.ToDecimal(colBUY_NUM.SummaryText);
|
|||
|
|
receModel.ARR_NUM_SUM = Convert.ToDecimal(colARR_NUM.SummaryText) - receModel.ARR_NUM_SUM;
|
|||
|
|
receModel.STO_NUM_SUM = Convert.ToDecimal(colSTO_NUM.SummaryText);
|
|||
|
|
receModel.SHELVE_NUM_SUM = Convert.ToDecimal(colSHELVE_NUM.SummaryText);
|
|||
|
|
receModel.RECE_MAN = DicReceMan.TextBoxFlag;
|
|||
|
|
receModel.PRINT_MAN = DicPrintMan.TextBoxFlag;
|
|||
|
|
receModel.ENTRY_MAN = userData.USER_ID;
|
|||
|
|
receModel.ENTRY_MAN_NAME = userData.NAME;
|
|||
|
|
receModel.ENTRY_DATE = DateTime.Now;
|
|||
|
|
receModel.NOTICE_ID = DicNotice.TextBoxValue;
|
|||
|
|
receModel.CAR_ID = DicNotice.TextBoxValue;
|
|||
|
|
|
|||
|
|
|
|||
|
|
foreach (ReceivingInfoModel infomodel in InfoList)
|
|||
|
|
{
|
|||
|
|
infomodel.RECE_ID = receModel.RECE_ID;
|
|||
|
|
if (infomodel.ARR_NUM == 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("到货数量不能为0!");
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
err = IBussFactory<BussReceve>.Instance().Update(receModel, InfoList);
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (flag == 2)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (string.IsNullOrEmpty(receModel.RECE_ID) || InfoList.Count == 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (SystemCommon.ShowMessageBoxResult("确定要删除收货单:" + receModel.RECE_ID)
|
|||
|
|
== System.Windows.Forms.DialogResult.Yes)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
err = IBussFactory<BussReceve>.Instance().Cancel(receModel);
|
|||
|
|
}
|
|||
|
|
catch
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (!string.IsNullOrEmpty(err))
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox(err);
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("操作成功!");
|
|||
|
|
|
|||
|
|
LoadForm load = new LoadForm();
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(load, load.GetType(), false, true, false, 50);
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormDescription("正加载窗体....");
|
|||
|
|
|
|||
|
|
bingReceveGrid(noticeMessModel);
|
|||
|
|
bingInfoGrid(noticeMessModel,receModel);
|
|||
|
|
frmButtonItem["Save"].Enabled = false;
|
|||
|
|
frmButtonItem["Rebreak"].Enabled = false;
|
|||
|
|
frmButtonItem["Clear"].Enabled = false;
|
|||
|
|
frmButtonItem["Audit"].Enabled = false;
|
|||
|
|
workflag = 3;
|
|||
|
|
PageRece.PageEnabled = true;
|
|||
|
|
xtraTab.SelectedTabPage = PageNotice;
|
|||
|
|
DicNotice.Enabled = true;
|
|||
|
|
AddList.Clear();
|
|||
|
|
DelList.Clear();
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
catch (Exception e)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("您的操作出错:" + Environment.NewLine + e.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// GV 值显示
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void GVReceive_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (e.Column.FieldName == "STATIC")
|
|||
|
|
{
|
|||
|
|
if (e.Value != null && e.Value != DBNull.Value)
|
|||
|
|
{
|
|||
|
|
switch (e.Value.ToString().Trim())
|
|||
|
|
{
|
|||
|
|
case "1":
|
|||
|
|
e.DisplayText = "已确认";
|
|||
|
|
break;
|
|||
|
|
|
|||
|
|
default:
|
|||
|
|
e.DisplayText = "未确认";
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
#endregion
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// gv 值改变后
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void GVReceiveInfo_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (e.RowHandle < 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
ReceivingInfoModel focModel = GVReceiveInfo.GetRow(e.RowHandle) as ReceivingInfoModel;
|
|||
|
|
|
|||
|
|
if (!AddList.Contains(focModel) && !CopyList.Contains(focModel))
|
|||
|
|
{
|
|||
|
|
AddList.Add(focModel);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (e.Column.FieldName == "ARR_NUM")
|
|||
|
|
{
|
|||
|
|
decimal ARR_NUM = Convert.ToDecimal(GVReceiveInfo.GetFocusedRowCellValue("ARR_NUM"));
|
|||
|
|
decimal BUY_NUM = Convert.ToDecimal(GVReceiveInfo.GetFocusedRowCellValue("BUY_NUM"));
|
|||
|
|
|
|||
|
|
if (ARR_NUM > BUY_NUM && BUY_NUM != 0)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("请注意:" + Environment.NewLine + "您输入的接收数量大于采购数量!");
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//goodModel = goodsListModel.Find(r => r.GOODS_ID == focModel.GOODS_ID);
|
|||
|
|
//focModel.RECE_MONEY = goodModel.PRICE * focModel.ARR_NUM;
|
|||
|
|
//focModel.GRO_WEIGHT = goodModel.GROSS_WEIGHT * focModel.ARR_NUM;
|
|||
|
|
//focModel.NET_WEIGHT = goodModel.NET_WEIGHT * focModel.ARR_NUM;
|
|||
|
|
//focModel.RECE_VOLUEM = goodModel.GVOLUME * focModel.ARR_NUM;
|
|||
|
|
//focModel.VOLUME_UNIT = goodModel.GVOLUME;
|
|||
|
|
//if (string.IsNullOrEmpty(focModel.UNIT))
|
|||
|
|
//{
|
|||
|
|
// focModel.UNIT = goodModel.UNIT;
|
|||
|
|
//}
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (e.Column.FieldName == "GOODS_ID")
|
|||
|
|
{
|
|||
|
|
if (InfoList.Count(r => r.GOODS_ID == focModel.GOODS_ID) >1)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowInfoMessageBox("通知单明细中已包含商品:" + focModel.GOODS_ID);
|
|||
|
|
focModel.GOODS_ID = null;
|
|||
|
|
GVReceiveInfo.RefreshData();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (e.Column.FieldName == "GOODS_ID" && !string.IsNullOrEmpty(focModel.GOODS_ID))
|
|||
|
|
{
|
|||
|
|
//goodModel = goodsListModel.Find(r => r.GOODS_ID == focModel.GOODS_ID);
|
|||
|
|
|
|||
|
|
//focModel.PRICE = goodModel.PRICE;
|
|||
|
|
//focModel.SCALE_UNIT = goodModel.SCALE_UNIT;
|
|||
|
|
//focModel.VOLUME_UNIT = goodModel.GVOLUME;
|
|||
|
|
//focModel.UNIT = goodModel.UNIT;
|
|||
|
|
|
|||
|
|
if (focModel.ARR_NUM > 0)
|
|||
|
|
{
|
|||
|
|
//focModel.RECE_MONEY = goodModel.PRICE * focModel.ARR_NUM;
|
|||
|
|
//focModel.GRO_WEIGHT = goodModel.GROSS_WEIGHT * focModel.ARR_NUM;
|
|||
|
|
//focModel.NET_WEIGHT = goodModel.NET_WEIGHT * focModel.ARR_NUM;
|
|||
|
|
//focModel.RECE_VOLUEM = goodModel.GVOLUME * focModel.ARR_NUM;
|
|||
|
|
//focModel.VOLUME_UNIT = goodModel.GVOLUME;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
//focModel.RECE_MONEY = isnullnum(goodModel.PRICE) * focModel.BUY_NUM;
|
|||
|
|
//focModel.GRO_WEIGHT = isnullnum(goodModel.GROSS_WEIGHT)* focModel.BUY_NUM;
|
|||
|
|
//focModel.NET_WEIGHT = isnullnum(goodModel.NET_WEIGHT) * focModel.BUY_NUM;
|
|||
|
|
//focModel.RECE_VOLUEM = isnullnum(goodModel.GVOLUME) * focModel.BUY_NUM;
|
|||
|
|
//focModel.VOLUME_UNIT = isnullnum(goodModel.GVOLUME);
|
|||
|
|
if (string.IsNullOrEmpty(focModel.UNIT))
|
|||
|
|
{
|
|||
|
|
//focModel.UNIT = goodModel.UNIT;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (e.Column.FieldName == "VOLUME_UNIT")
|
|||
|
|
{
|
|||
|
|
DialogResult result = SystemCommon.ShowMessageBoxResultCancel("您修改了商品:" + focModel.GOODS_ID + "的单位体积!" + Environment.NewLine +
|
|||
|
|
"是否修改商品资料内相关信息?");
|
|||
|
|
if (result == DialogResult.Yes)
|
|||
|
|
{
|
|||
|
|
JWGoodsInfoModel goods = goodsListModel.Find(r => r.INVENTORY_ITEM_ID == focModel.GOODS_ID);
|
|||
|
|
//goods.GVOLUME = Convert.ToDecimal(e.Value);
|
|||
|
|
|
|||
|
|
IBussFactory<BussGoods>.Instance().UpdateGoodsInfo(goods);
|
|||
|
|
//if (num <= 0)
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowErrorMessageBox("修改失败,请确定相关信息是否准确!");
|
|||
|
|
//}
|
|||
|
|
//else
|
|||
|
|
//{
|
|||
|
|
// SystemCommon.ShowInfoMessageBox("修改商品信息成功!");
|
|||
|
|
// decimal STO_NUM = Convert.ToDecimal(GVReceiveInfo.GetFocusedRowCellValue("STO_NUM"));
|
|||
|
|
// focModel.RECE_VOLUEM = STO_NUM * focModel.VOLUME_UNIT;
|
|||
|
|
//}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else if (e.Column.FieldName == "UNIT")
|
|||
|
|
{
|
|||
|
|
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() == e.Value.ToString())
|
|||
|
|
{
|
|||
|
|
newUnit = decimal.Parse(row[2].ToString());
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (focModel.BUY_NUM != 0 && oldUnit != 0)
|
|||
|
|
{
|
|||
|
|
focModel.BUY_NUM = focModel.BUY_NUM / oldUnit * newUnit;
|
|||
|
|
}
|
|||
|
|
if (focModel.ARR_NUM != 0 && oldUnit != 0)
|
|||
|
|
{
|
|||
|
|
focModel.ARR_NUM = focModel.ARR_NUM / oldUnit * newUnit;
|
|||
|
|
}
|
|||
|
|
//if (focModel.STO_NUM != 0 && oldUnit != 0)
|
|||
|
|
//{
|
|||
|
|
// focModel.STO_NUM = focModel.STO_NUM / oldUnit * newUnit;
|
|||
|
|
//}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private decimal isnullnum(object num)
|
|||
|
|
{
|
|||
|
|
if (num == null || num == DBNull.Value)
|
|||
|
|
{
|
|||
|
|
return 0;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return Convert.ToDecimal(num);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// GV值改变时
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void GVReceiveInfo_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
|
|||
|
|
{
|
|||
|
|
ReceivingInfoModel focModel = GVReceiveInfo.GetRow(e.RowHandle) as ReceivingInfoModel;
|
|||
|
|
if (CopyList.Contains(focModel))
|
|||
|
|
{
|
|||
|
|
if (e.Column.FieldName != "ARR_NUM")
|
|||
|
|
{
|
|||
|
|
//GVReceiveInfo.SetRowCellValue(e.RowHandle, e.Column, GVReceive.GetFocusedRowCellValue(e.Column.FieldName));
|
|||
|
|
}
|
|||
|
|
else if (e.Column.FieldName == "UNIT")
|
|||
|
|
{
|
|||
|
|
unit = GVReceiveInfo.GetFocusedRowCellValue("UNIT").ToString();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 通知单选择
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void DicNotice_Button_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (!string.IsNullOrEmpty(DicNotice.TextBoxValue))
|
|||
|
|
{
|
|||
|
|
LoadForm load = new LoadForm();
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(load, load.GetType(), false, true, false, 50);
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormDescription("正在加载数据,请等待....");
|
|||
|
|
|
|||
|
|
bingNotieceGrid();
|
|||
|
|
BSReceive.DataSource = receModel;
|
|||
|
|
DicCar.TextBoxFlag = receModel.CAR_ID;
|
|||
|
|
DicCar.TextBoxValue = receModel.CAR_ID;
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
/// <summary>
|
|||
|
|
/// TAB页切换
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void xtraTab_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e)
|
|||
|
|
{
|
|||
|
|
//if (e.Page == PageNotice)
|
|||
|
|
//{
|
|||
|
|
// frmButtonItem["Rebreak"].Enabled = false;
|
|||
|
|
// frmButtonItem["Clear"].Enabled = false;
|
|||
|
|
// frmButtonItem["Audit"].Enabled = false;
|
|||
|
|
//}
|
|||
|
|
//else
|
|||
|
|
//{
|
|||
|
|
// frmButtonItem["Rebreak"].Enabled = true;
|
|||
|
|
// frmButtonItem["Clear"].Enabled = true;
|
|||
|
|
// frmButtonItem["Audit"].Enabled = true;
|
|||
|
|
//}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// <summary>
|
|||
|
|
/// 车辆选择
|
|||
|
|
/// </summary>
|
|||
|
|
/// <param name="sender"></param>
|
|||
|
|
/// <param name="e"></param>
|
|||
|
|
private void DicCar_Button_Click(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
if (!string.IsNullOrEmpty(DicCar.TextBoxValue))
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
LoadForm load = new LoadForm();
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(load, load.GetType(), false, true, false, 50);
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormDescription("正在加载数据,请等待....");
|
|||
|
|
CapacityModel ca = new CapacityModel() { CAR_ID = DicCar.TextBoxValue };
|
|||
|
|
|
|||
|
|
List<CapacityModel> caList = IBussFactory<BussCapacity>.Instance().GetList(ca);
|
|||
|
|
|
|||
|
|
if (caList != null)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
if (caList.Count > 0)
|
|||
|
|
{
|
|||
|
|
receModel.DRIVER = caList[0].CAR_DRIVER;
|
|||
|
|
receModel.CAR_ID = caList[0].CAR_ID;
|
|||
|
|
receModel.SHIPPERS = caList[0].CAR_CARRIER;
|
|||
|
|
BSReceive.DataSource = receModel;
|
|||
|
|
BSReceive.ResetBindings(true);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
|
|||
|
|
}
|
|||
|
|
catch(Exception ex)
|
|||
|
|
{
|
|||
|
|
SystemCommon.ShowErrorMessageBox(ex.Message);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void GVReceiveInfo_CustomRowCellEditForEditing(object sender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs e)
|
|||
|
|
{
|
|||
|
|
if (e.RowHandle < 0)
|
|||
|
|
{
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (e.Column.FieldName == "UNIT")
|
|||
|
|
{
|
|||
|
|
ReceivingInfoModel info = GVReceiveInfo.GetFocusedRow() as ReceivingInfoModel;
|
|||
|
|
|
|||
|
|
if (info != null && info.GOODS_ID != null)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
DataTable strResult =IBussFactory<BussGoods>.Instance().GetGoodsUnit(info.GOODS_ID);
|
|||
|
|
if (strResult != null)
|
|||
|
|
{
|
|||
|
|
lueUnits.DataSource = strResult;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
//SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|||
|
|
}
|
|||
|
|
// Newtonsoft.Json.JsonConvert.DeserializeObject<DataTable>(strResult);
|
|||
|
|
}
|
|||
|
|
e.RepositoryItem = lueUnits;//当前单元格绑定控件
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void repositoryItemLookUpEdit1_EditValueChanged(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|