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 WMS.Frm; using DevExpress.XtraGrid.Columns; using DevExpress.XtraEditors.Repository; using DevExpress.XtraReports.UI; using WMS.Business; using WMS.Business.Base; using WMS.Business.Common; using WMS.Business.RK; namespace WMS.FrmRK { public partial class FrmStorageLot : FormBase { /// /// 入库批次MODEL /// StorageLotModel stoLotModel = new StorageLotModel(); /// /// 入库批次MODEL /// List lotList = new List(); /// /// 入库批次明细Model /// StorageLotInfoModel infomodel = new StorageLotInfoModel(); /// /// 入库批次明细集合 /// List infoList = new List(); /// /// 收货单Model /// public ReceivingModel receModel = new ReceivingModel(); /// /// 收货单数据源 /// public List receListModel = new List(); /// /// 收货明细数据源 /// public List receInfoList = new List(); /// /// 通知单MODEL /// WareNoticeModel noticeMessModel = new WareNoticeModel(); /// /// 通知单集合 /// List noticeListModel = new List(); /// /// 通知单明细集合 /// List noticeTabListModel = new List(); /// /// 库区集合 /// List stoAreaList = new List(); List stoCopyList = new List(); List stoAddList = new List(); List stoUpList = new List(); List stoDelList = new List(); List goodsList = new List(); GoodsInfoModel gmodel = new GoodsInfoModel(); /// /// LEP菜单对象 /// private DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit lueUnits = new RepositoryItemLookUpEdit(); private string unit = string.Empty;//记录原单位 /// /// 业务类型 /// int workflag = 3;//0 增加 1 修改 2 删除 ; bool receflag = true; public string sto_id = string.Empty; string errText = ""; public FrmStorageLot() { InitializeComponent(); } /// /// 刷新 /// public override void Refresh() { BindLEP(); Search(); // Selsto(); } /// /// 页面加载 /// /// /// public void FrmStorage_Load(object sender, EventArgs e) { ///直接进入功能 //if (sto_id.Trim().Length > 0) //{ // DicNotice.TextBoxValue = sto_id; // Add(); //} new System.Threading.Thread(delegate() { try { this.Invoke(new MethodInvoker(delegate() { LoadForm load = new LoadForm(); DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(load, load.GetType(), false, true, false, 70); DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormDescription("数据加载中..."); BindLEP(); DicReceMan.TextBoxFlag = userData.USER_ID; DicReceMan.TextBoxValue = userData.NAME; Search(); LEPStoID.EditValue = userData.STORAGE_ID; DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm(); })); } catch (Exception ex) { errText = ex.Message.ToString(); } }).Start(); FrmSelectModle = new StorageLotModel(); if (frmButtonItem.Count > 0) { frmButtonItem["Save"].Enabled = false; frmButtonItem["Rebreak"].Enabled = false; frmButtonItem["Clear"].Enabled = false; frmButtonItem["Audit"].Enabled = false; } DicReceMan.selSql = string.Format(@"select user_id,name from t_base_userinfo where com_id = '" + userData.COM_ID + "'"); DicPrintMan.selSql = string.Format(@"select user_id,name from t_base_userinfo where com_id = '" + userData.COM_ID + "'"); xtcGroup.SelectedTabPage = PageSto; DateSelEnd.EditValue = DateTime.Now; LEPStoID.LoadData(); LEPStoPro.LoadData(); LEPStoType.LoadData(); LEPSelPro.LoadData(); LEPStoID.LoadData(); DateSelStar.EditValue = DateTime.Now.AddMonths(-1); // Selsto(); } /// /// private void BindLEP() { try { List proList = IBussFactory.Instance().GetProviderList(new ProviderModel()); if (proList != null) { repositoryItemLookUpEdit1.DataSource = proList; repositoryItemLookUpEdit1.DisplayMember = "PROVIDER_NAME"; repositoryItemLookUpEdit1.ValueMember = "PROVIDER_ID"; } List cusList = IBussFactory.Instance().GetCustomer(new CustomerModel()); if (cusList != null) { LEPCustomer.Properties.DataSource = cusList; LEPCustomer.Properties.DisplayMember = "CUSTOMER_NAME"; LEPCustomer.Properties.ValueMember = "CUSTOMER_ID"; } List stoList = IBussFactory.Instance().GetStorageInfoDS(new StorageInfoModel()); if (stoList != null) { repositoryItemLookUpEdit2.DataSource = stoList; repositoryItemLookUpEdit2.DisplayMember = "STORAGE_NAME"; repositoryItemLookUpEdit2.ValueMember = "STORAGE_ID"; } stoAreaList = IBussFactory.Instance().GetAreaInfoDS(new StorageAreaModel(), ""); if (stoAreaList != null) { repositoryItemLookUpEdit6.DataSource = stoAreaList; repositoryItemLookUpEdit6.DisplayMember = "STORAGE_AREA_NAME"; repositoryItemLookUpEdit6.ValueMember = "STORAGE_AREA_ID"; repositoryItemLookUpEdit7.DataSource = stoAreaList; repositoryItemLookUpEdit7.DisplayMember = "STORAGE_AREA_NAME"; repositoryItemLookUpEdit7.ValueMember = "STORAGE_AREA_ID"; } //goodsList = IBussFactory.Instance().GetGoodsList("", "", "", ""); //goodsList.OrderBy(r => r.GOODS_ID); //repositoryItemLookUpEdit3.DataSource = goodsList; //repositoryItemLookUpEdit3.DisplayMember = "GOODS_ID"; //repositoryItemLookUpEdit3.ValueMember = "GOODS_ID"; //LEPSelGoods.Properties.DataSource = goodsList; //LEPSelGoods.Properties.DisplayMember = "GOODS_NAME"; //LEPSelGoods.Properties.ValueMember = "GOODS_ID"; List palletModelList = IBussFactory.Instance().GetPalletList(new PalletModel()); if (palletModelList != null) { repositoryItemLookUpEdit4.DataSource = palletModelList; repositoryItemLookUpEdit4.DisplayMember = "PALLET_NAME"; repositoryItemLookUpEdit4.ValueMember = "PALLET_ID"; } repositoryItemLookUpEdit5.NullText = ""; repositoryItemLookUpEdit5.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("VC_DICTIONARY_NAME", "单位")); repositoryItemLookUpEdit5.ValueMember = "VC_CHAR_VALUE"; repositoryItemLookUpEdit5.DisplayMember = "VC_DICTIONARY_NAME"; DataTable strResult = IBussFactory.Instance().GetCustomCtrlData("t_sys_dictionary_tab", "VC_CHAR_VALUE", "VC_DICTIONARY_NAME", " VC_DICTIONARY_TYPE = 'vc_uom' and c_flag = '1'", ""); if (strResult != null) { repositoryItemLookUpEdit5.DataSource = strResult; } lueUnits.NullText = ""; lueUnits.Columns.Add(new DevExpress.XtraEditors.Controls.LookUpColumnInfo("UNIT_NAME", "单位")); lueUnits.ValueMember = "UNIT"; lueUnits.DisplayMember = "UNIT_NAME"; } catch (Exception) { SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!"); } } /// /// 通用查询 /// /// public override void LoadListData(DataTable table) { lotList = ConvertHelper.ConvertToList(table); GCSto.DataSource = lotList; GVSto.RefreshData(); if (lotList.Count > 0) { stoLotModel = lotList[0]; BindStoInfoGrid(); } } ///// ///// 查找入库通知单 ///// private void Selsto() { noticeMessModel = new WareNoticeModel(); noticeMessModel.WAREHOUSING_ID = sto_id; noticeMessModel.STORAGE_ID = userData.STORAGE_ID; string errstr = string.Empty; try { noticeListModel = IBussFactory.Instance().GetWareNoticeList(noticeMessModel); if(noticeListModel!=null) { bsWareNotice.DataSource = noticeListModel; if(noticeListModel.Count>0) { xtra_rk.SelectedTabPage = tabrkd; tabtzd.PageEnabled = true; string wareId = noticeListModel[0].WAREHOUSING_ID; GetDetailDoc(wareId); } else { tabtzd.PageEnabled = false; FrmReceiveDet frm = new FrmReceiveDet(userData.STORAGE_ID,userData.STORAGE_NAME); frm.ShowDialog(); Refresh(); xtcGroup.SelectedTabPage = PageSto; PageStoInfo.PageEnabled = false; frmButtonItem["Save"].Enabled = false; frmButtonItem["Rebreak"].Enabled = false; frmButtonItem["Clear"].Enabled = false; frmButtonItem["Audit"].Enabled = false; } } } catch (Exception) { SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!"); } //if (noticeListModel.Count > 0) //{ // LEPStoPro.EditValue = noticeListModel[0].PROVIDER_ID; // LEPStoType.EditValue = noticeListModel[0].STORAGE_MODE; //} } /// /// 绑定入库批次 /// private void BindStoGrid() { lotList = IBussFactory.Instance().StorageLotGetList(stoLotModel); if(lotList!=null) { GCSto.DataSource = lotList; GVSto.RefreshData(); if (lotList.Count > 0) { stoLotModel = lotList[0]; } } } /// /// 绑定入库批次明细 /// private void BindStoInfoGrid() { //if (!string.IsNullOrEmpty(stoLotModel.LOT_ID)) //{ // try // { // infoList = IBussFactory.Instance().GetInfoList(stoLotModel.LOT_ID); // if(infoList==null) // { // bingInfoView.DataSource = infoList; // gridView2.RefreshData(); // } // } // catch (Exception) // { // SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!"); // } //} } /// /// 入库批次点击 /// /// /// private void GVSto_Click(object sender, EventArgs e) { if (GVSto.FocusedRowHandle < 0) { return; } stoLotModel = GVSto.GetFocusedRow() as StorageLotModel; BindStoInfoGrid(); BindStoInfoCodeDisk(stoLotModel.LOT_ID); } void BindStoInfoCodeDisk(string lotid) { CodeDiskModel ctlData = new CodeDiskModel(); ctlData.STORAGE_ID = this.userData.STORAGE_ID; ctlData.LOT_ID = lotid; List listCtlData = IBussFactory.Instance().GetCodeDisk(ctlData); if (listCtlData != null) { bs_CodeDisk.DataSource = listCtlData; } } /// /// 入库批次双击 /// /// /// private void GCSto_DoubleClick(object sender, EventArgs e) { if (GVSto.FocusedRowHandle < 0) { return; } stoLotModel = GVSto.GetFocusedRow() as StorageLotModel; BindStoInfoGrid(); xtcGroup.SelectedTabPage = PageStoInfo; } private void changevalue(int kind) { stoLotModel = new StorageLotModel(); stoLotModel.ACC_NUM_SUM = 0; stoLotModel.ARR_NUM_SUM = receModel.ARR_NUM_SUM; stoLotModel.BUY_NUM_SUM = receModel.BUY_NUM_SUM; stoLotModel.NOTICE_ID = receModel.NOTICE_ID; stoLotModel.PROVIDER_ID = receModel.PROVIDER_ID; stoLotModel.RECE_DATE = DateTime.Now; stoLotModel.RECE_ID = receModel.RECE_ID; stoLotModel.SHELVE_NUM_SUM = 0; infoList.Clear(); if (kind == 0)//有收获单 { if (receInfoList.Count > 0) { foreach (ReceivingInfoModel model in receInfoList) { StorageLotInfoModel sto = new StorageLotInfoModel(); sto.ACC_NUM = 0; sto.ARR_NUM = model.ARR_NUM; sto.BUY_NUM = model.BUY_NUM; sto.GOODS_ID = model.GOODS_ID; sto.STORAGE_ID= stoLotModel.STO_ID; sto.GRO_WEIGHT = model.GRO_WEIGHT; sto.LOT_MONEY = model.RECE_MONEY; sto.LOT_VOLUME = 0; sto.MADE_DATE = model.MADE_DATE; sto.NET_WEIGHT = model.NET_WEIGHT; sto.STO_NUM = 0; sto.TRAY_ID = model.STO_TRAY; sto.VOLUME_UNIT = model.VOLUME_UNIT; sto.UNIT = model.UNIT; sto.SCALE_UNIT = model.SCALE_UNIT; sto.PRICE = model.PRICE; infoList.Add(sto); } } } else if (kind == 1)//无收获单,有通知单 { if (noticeTabListModel.Count > 0) { foreach (WareNoticeTabModel model in noticeTabListModel) { StorageLotInfoModel sto = new StorageLotInfoModel(); sto.ACC_NUM = 0; sto.ARR_NUM = 0; sto.BUY_NUM = model.AMOUNT; sto.GOODS_ID = model.GOODS_ID; sto.GRO_WEIGHT = model.TOTAL_ROUGH_WEIGHT; sto.LOT_MONEY = model.TOTAL_MONEY; sto.LOT_VOLUME = model.TOTAL_VOLUME; sto.MADE_DATE = model.PRODUCTION_DATE; sto.NET_WEIGHT = model.TOTAL_NET_WEIGH; sto.STO_NUM = 0; sto.TRAY_ID = model.PACKAGE_ID; sto.VOLUME_UNIT = model.GVOLUME; sto.UNIT = model.UNIT; sto.SCALE_UNIT = model.SCALE_UNIT; sto.PRICE = model.PRICE; infoList.Add(sto); } } } } #region 以下是继承的按钮事件 /// /// 新增按钮 /// public override void Add() { PageStoInfo.PageEnabled = true; xtcGroup.SelectedTabPage = PageStoInfo; workflag = 0; BSStoTab.DataSource = stoLotModel; stoLotModel.STO_ID = userData.STORAGE_ID; LEPStoID.EditValue = userData.STORAGE_ID; LEPStoPro.EditValue = receModel.PROVIDER_ID; frmButtonItem["Save"].Enabled = true; frmButtonItem["Audit"].Enabled = false; frmButtonItem["Rebreak"].Enabled = true; frmButtonItem["Clear"].Enabled = true; receflag = true; LEPStoType.ItemIndex = 0; Selsto(); } /// /// 盲收 /// public void Confirm() { GCStoInfo.Enabled = true; stoLotModel = new StorageLotModel(); infoList.Clear(); panelControl1.Visible = false; // panelControl2.Visible = true; // DicRece.Enabled = false; DicPrintMan.TextBoxFlag = userData.USER_ID; DicPrintMan.TextBoxValue = userData.NAME; DicReceMan.TextBoxFlag = userData.USER_ID; DicReceMan.TextBoxValue = userData.NAME; LEPStoID.EditValue = userData.STORAGE_ID; LEPStoPro.EditValue = receModel.PROVIDER_ID; workflag = 0; BSStoTab.DataSource = stoLotModel; BSReceTab.ResetBindings(true); GVStoInfo.RefreshData(); xtcGroup.SelectedTabPage = PageSto; frmButtonItem["Save"].Enabled = true; frmButtonItem["Audit"].Enabled = false; frmButtonItem["Rebreak"].Enabled = true; frmButtonItem["Clear"].Enabled = true; frmButtonItem["Audit"].Enabled = true; receflag = false; infoList.Clear(); lotList.Clear(); GVSto.RefreshData(); // DateRece.EditValue = DateTime.Now; } /// /// 保存按钮 /// public override void Save() { if (workflag == 3) { return; } FrmOperator(workflag); } /// /// 删除按钮 /// public override void Del() { //if (infoList.Count == 0) //{ // return; //} // frmButtonItem["save"].Enabled = true; workflag = 2; FrmOperator(workflag); } /// /// 修改按钮 /// public override void Edit() { //if (stoLotModel.PRINT_NUM > 0) //{ // SystemCommon.ShowErrorMessageBox("该收货单的入库记录已打印,不能再修改!"); // return; //} if (stoLotModel.STATUS=="4") { SystemCommon.ShowErrorMessageBox("任务已经派发,不能修改!"); return; } if (stoLotModel.STATUS == "2") { SystemCommon.ShowErrorMessageBox("任务已经完成,不能修改!"); return; } if (string.IsNullOrEmpty(stoLotModel.LOT_ID)) { xtcGroup.SelectedTabPage = PageSto; stoLotModel = new StorageLotModel() { RECE_ID = receModel.RECE_ID }; BindStoGrid(); SystemCommon.ShowInfoMessageBox("请选择需要修改的入库单据!"); return; } GCStoInfo.Enabled = true; panelControl1.Visible = false; // panelControl2.Visible = true; workflag = 1; BSStoTab.DataSource = stoLotModel; lotList.Clear(); lotList.Add(stoLotModel); //BSStorage.DataSource = stoLotModel; // GCSto.DataSource = stoLotModel; // GVSto.FocusedRowHandle= lotList.IndexOf(stoLotModel); GVSto.RefreshData(); xtcGroup.SelectedTabPage = PageSto; DicPrintMan.TextBoxFlag = stoLotModel.PRINT_MAN; DicPrintMan.TextBoxValue = stoLotModel.PRINT_MAN_NAME; DicReceMan.TextBoxFlag = stoLotModel.RECE_MAN; DicReceMan.TextBoxValue = stoLotModel.RECE_MAN_NAME; GVStoInfo.OptionsBehavior.Editable = true; GVStoInfo.RefreshData(); frmButtonItem["Save"].Enabled = true; frmButtonItem["Rebreak"].Enabled = true; frmButtonItem["Clear"].Enabled = true; frmButtonItem["Audit"].Enabled = false; frmButtonItem["Rebreak"].Enabled = true; frmButtonItem["Clear"].Enabled = true; } /// /// 明细增加 /// public void Rebreak() { // xtcGroup.SelectedTabPage = PageStoInfo; if (tabrkd.PageEnabled) { if (gdvView.RowCount == 0) { return; } // infoList.Clear(); for (int i = 0; i < gdvView.RowCount; i++) { WareNoticeTabModel model = (WareNoticeTabModel)gdvView.GetRow(i); StorageLotInfoModel sto = new StorageLotInfoModel(); sto.ACC_NUM = 0; sto.ARR_NUM = 0; sto.BUY_NUM = model.AMOUNT; sto.GOODS_ID = model.GOODS_ID; sto.GOODS_NAME = model.GOODS_NAME; sto.GRO_WEIGHT = model.TOTAL_ROUGH_WEIGHT; sto.LOT_MONEY = model.TOTAL_MONEY; sto.LOT_VOLUME = model.TOTAL_VOLUME; sto.MADE_DATE = model.PRODUCTION_DATE; sto.NET_WEIGHT = model.TOTAL_NET_WEIGH; sto.STO_NUM = 0; sto.TRAY_ID = model.PACKAGE_ID; sto.VOLUME_UNIT = model.GVOLUME; sto.UNIT = model.UNIT; sto.SCALE_UNIT = model.SCALE_UNIT; sto.PRICE = model.PRICE; sto.ARR_NUM = model.AMOUNT; sto.ACC_NUM = model.AMOUNT; infoList.Add(sto); } if (infoList != null) BSStorageInfo.DataSource = infoList; GVStoInfo.RefreshData(); //stoLotModel = BSStoTab.DataSource as StorageLotModel; //stoLotModel.NOTICE_ID = DicNotice.TextBoxValue; //stoLotModel.PROVIDER_ID = noticeMessModel.PROVIDER_ID; //stoLotModel.PROVIDER_NAME = noticeMessModel.PROVIDER_NAME; //stoLotModel.ORI_BILL = noticeMessModel.PURCHASE_ID; //stoLotModel.RECE_DATE = DateTime.Now; } GVSto.RefreshData(); frmButtonItem["Audit"].Enabled = true; frmButtonItem["Save"].Enabled = false; xtra_rk.SelectedTabPageIndex = 1; } /// /// 明细删除 /// public override void Clear() { if (stoLotModel.STATUS=="4" ) { SystemCommon.ShowInfoMessageBox("入库已派发,不能修改!"); return; } if (stoLotModel.STATUS == "2") { SystemCommon.ShowInfoMessageBox("入库已完成,不能修改!"); return; } if (GVSto.FocusedRowHandle < 0 || infoList.Count == 0) { return; } xtcGroup.SelectedTabPage = PageStoInfo; StorageLotInfoModel mod = infoList[GVStoInfo.FocusedRowHandle]; infoList.Remove(mod); if (stoAddList.Contains(mod)) { stoAddList.Remove(mod); } if (stoUpList.Contains(mod)) { stoUpList.Remove(mod); } if (!string.IsNullOrEmpty(mod.GOODS_ID)) { stoDelList.Add(mod); } GCStoInfo.DataSource = infoList; GVStoInfo.RefreshData(); stoLotModel.BUY_NUM_SUM = infoList.Sum(r => r.BUY_NUM); stoLotModel.STO_NUM_SUM = infoList.Sum(r => r.STO_NUM); GVSto.RefreshData(); frmButtonItem["Audit"].Enabled = true; frmButtonItem["Save"].Enabled = false; } /// /// 单据明细是否保存 /// bool saveflag = false; /// /// 明细保存 /// public void Audit() { // if (workflag != 1) // { // return; // } if (infoList.Count(r => r.STO_NUM == 0) > 0) { SystemCommon.ShowInfoMessageBox("入库数量不能为零"); return; } if (stoUpList.Count > 0 || stoAddList.Count > 0 || stoDelList.Count > 0) { GVStoInfo.CloseEditor(); decimal num = stoLotModel.STO_NUM_SUM; foreach (StorageLotInfoModel smodel in stoAddList) { stoLotModel.STO_NUM_SUM += smodel.STO_NUM; } foreach (StorageLotInfoModel smodel in stoDelList) { stoLotModel.STO_NUM_SUM -= smodel.STO_NUM; } string err = IBussFactory.Instance().newStorageLotInfoFuc(stoUpList, stoAddList, stoDelList, stoLotModel); if (!string.IsNullOrEmpty(err)) { SystemCommon.ShowErrorMessageBox(err); } else { SystemCommon.ShowInfoMessageBox("入库明细修改成功!"); saveflag = true; stoUpList.Clear(); stoAddList.Clear(); stoDelList.Clear(); } GVSto.RefreshData(); frmButtonItem["Save"].Enabled = true; } } /// /// 查询按钮 /// public override void Search() { stoLotModel = new StorageLotModel(); // stoLotModel.STO_ID = userData.STORAGE_ID; //if (!string.IsNullOrEmpty(txtSelLotID.Text)) //{ // stoLotModel.LOT_ID = txtSelLotID.Text; //} if (DateSelStar.EditValue != null && DateSelStar.EditValue != DBNull.Value) { if (DateSelStar.EditValue.ToString().Trim().Length > 0) stoLotModel.TIMESTART = DateSelStar.DateTime; } if (DateSelEnd.EditValue != null && DateSelEnd.EditValue != DBNull.Value) { if (DateSelEnd.EditValue.ToString().Trim().Length > 0) stoLotModel.TIMEEND = DateSelEnd.DateTime; } if (LEPSelPro.EditValue != null && LEPSelPro.EditValue != DBNull.Value) { if (LEPSelPro.EditValue.ToString().Trim().Length > 0) stoLotModel.PROVIDER_ID = LEPSelPro.EditValue.ToString(); } try { //LoadForm load = new LoadForm(); //DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(load, load.GetType(), false, true, false, 50); //DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormDescription("正在加载数据,请等待...."); lotList = IBussFactory.Instance().StorageLotGetList(stoLotModel); if (lotList != null) { GCSto.DataSource = lotList; if (lotList.Count > 0) { stoLotModel = lotList[0]; BindStoInfoGrid(); BindStoInfoCodeDisk(stoLotModel.LOT_ID); } // GCSto.RefreshData(); // DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm(); } } catch (Exception e) { SystemCommon.ShowInfoMessageBox("连接数据库异常!" + e.Message); } } /// /// 导出按钮 /// public void ExportDataButton() { } /// /// 打印按钮 /// public void Print() { if (string.IsNullOrEmpty(stoLotModel.LOT_ID)) { SystemCommon.ShowInfoMessageBox("请选择要打印的单据!"); return; } if (!string.IsNullOrEmpty(DicPrintMan.TextBoxFlag)) { stoLotModel.PRINT_MAN = DicPrintMan.TextBoxFlag; } else { stoLotModel.PRINT_MAN = userData.USER_ID; } string strstoLotModel = Newtonsoft.Json.JsonConvert.SerializeObject(stoLotModel); //ReportStoIN report = new ReportStoIN(stoLotModel.LOT_ID); ////if (report.PrintDialog() == System.Windows.Forms.DialogResult.Yes) ////{ //report.ShowPreviewDialog(); //stoLotModel.PRINT_DATE = DateTime.Now; //stoLotModel.PRINT_NUM += 1; //stoLotModel.STATUS = "1"; //PrintInfoModel printinfo = new PrintInfoModel(); //printinfo.Print_count = 1; //printinfo.PRINT_DATE = DateTime.Now; //printinfo.Order_id = stoLotModel.LOT_ID; //printinfo.PRINT_PER = userData.USER_ID; //printinfo.PRINT_TYPE = "0"; try { //string strPrintInfo = Newtonsoft.Json.JsonConvert.SerializeObject(printinfo); //string err = WebLockConfig.Instance.WebStorageLot.execStorageLotPrint(strstoLotModel, strPrintInfo); //if (!string.IsNullOrEmpty(err)) //{ // SystemCommon.ShowErrorMessageBox(err); //} //else //{ // SystemCommon.ShowInfoMessageBox("打印成功!"); //} } catch (Exception) { SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!"); } //} } /// /// 备注 /// protected new void NoteDataButton(FormBase fBase) { } /// /// 审核 /// public void AuditDataButton() { } /// /// 反审核 /// public void ReturnAuditDataButton() { } #endregion #region 操作(增、改、删) /// /// 操作(增、改、删) /// /// 0 新增 1修改 2删除/param> private void FrmOperator(int flag) { try { // GVStoInfo.OptionsBehavior.Editable = true; string err = ""; GVStoInfo.CloseEditor(); GVStoInfo.UpdateCurrentRow(); BSStoTab.EndEdit(); List loadList = new List(); if (flag == 0) { if (string.IsNullOrEmpty(stoLotModel.STO_ID)) { SystemCommon.ShowInfoMessageBox("请选择入库仓库!"); xtcGroup.SelectedTabPageIndex = 0; return; } stoLotModel.ARR_NUM_SUM = stoLotModel.STO_NUM_SUM; //if (receflag && stoLotModel.ARR_NUM_SUM < stoLotModel.STO_NUM_SUM) //{ // DialogResult dia = SystemCommon.ShowMessageBoxResultCancel("您输入的入库数量大于接收数量!"); // if (dia == System.Windows.Forms.DialogResult.Cancel) // { // stoLotModel.STO_NUM_SUM = 0; // xtraTabControl1.SelectedTabPageIndex = 1; // return; // } //} //if (LEPStoType.Text.Contains("退货")) //{ // stoLotModel.PROVIDER_ID = LEPStoType.EditValue.ToString(); //} foreach (StorageLotInfoModel model in infoList) { if (model.STO_NUM == 0) { SystemCommon.ShowInfoMessageBox("商品的入库数量不能为0!"); xtcGroup.SelectedTabPageIndex = 1; return; } } if (infoList.Count > 0) { stoLotModel.ACC_NUM_SUM = infoList.Sum(r => r.ACC_NUM); stoLotModel.BUY_NUM_SUM = infoList.Sum(r => r.BUY_NUM); stoLotModel.STO_NUM_SUM = infoList.Sum(r => r.STO_NUM); stoLotModel.ARR_NUM_SUM = infoList.Sum(r => r.ARR_NUM); } stoLotModel.PRINT_MAN = DicPrintMan.TextBoxFlag; // stoLotModel.RECE_DATE = Convert.ToDateTime(DateRece.EditValue); stoLotModel.RECE_MAN = DicReceMan.TextBoxFlag; stoLotModel.OPERATEDATE = DateTime.Now; stoLotModel.OPERATORID = userData.USER_ID; stoLotModel.OPERATORNAME = userData.NAME; foreach (StorageLotInfoModel model in infoList) { if (string.IsNullOrEmpty(model.AREA_ID)) { SystemCommon.ShowInfoMessageBox("请选择入库库区!"); xtcGroup.SelectedTabPageIndex = 0; return; } model.LOT_ID = stoLotModel.LOT_ID; model.OPERATEDATE = DateTime.Now; model.OPERATORID = userData.USER_ID; model.OPERATORNAME = userData.NAME; model.ACC_NUM = model.STO_NUM; model.STORAGE_ID = stoLotModel.STO_ID; } err = IBussFactory.Instance().AddLotData(stoLotModel, infoList); frmButtonItem["Save"].Enabled = false; if (infoList.Count == 0) { xtcGroup.SelectedTabPageIndex = 1; frmButtonItem["Audit"].Enabled = true; frmButtonItem["Rebreak"].Enabled = true; frmButtonItem["Clear"].Enabled = true; } else { xtcGroup.SelectedTabPageIndex = 0; frmButtonItem["Audit"].Enabled = false; frmButtonItem["Rebreak"].Enabled = false; frmButtonItem["Clear"].Enabled = false; } } else if (flag == 1) { if (string.IsNullOrEmpty(stoLotModel.LOT_ID) || infoList.Count == 0) { return; } if (stoLotModel.PRINT_NUM > 0) { SystemCommon.ShowInfoMessageBox("此入库批次已打印,不能修改!"); return; } stoLotModel.PRINT_MAN = DicPrintMan.TextBoxFlag; // stoLotModel.RECE_DATE = Convert.ToDateTime(DateRece.EditValue); stoLotModel.RECE_MAN = DicReceMan.TextBoxFlag; stoLotModel.TYPE = "0"; stoLotModel.OPERATEDATE = DateTime.Now; stoLotModel.OPERATORID = userData.USER_ID; stoLotModel.OPERATORNAME = userData.NAME; stoLotModel.ARR_NUM_SUM = stoLotModel.STO_NUM_SUM; stoLotModel.STO_ID = stoLotModel.STO_ID; stoLotModel.STO_NAME = stoLotModel.STO_NAME; stoLotModel.OPERATEDATE = System.DateTime.Now; if (stoLotModel.ARR_NUM_SUM < stoLotModel.STO_NUM_SUM) { stoLotModel.STO_NUM_SUM = 0; SystemCommon.ShowInfoMessageBox("您输入的入库数量大于接收数量!"); return; } foreach (StorageLotInfoModel model in infoList) { model.OPERATEDATE = DateTime.Now; model.OPERATORID = userData.USER_ID; model.OPERATORNAME = userData.NAME; model.STORAGE_ID = stoLotModel.STO_ID; if (model.STO_NUM == 0) { SystemCommon.ShowInfoMessageBox("商品的入库数量不能为0!"); return; } } err = IBussFactory.Instance().Update(stoLotModel, infoList); } else if (flag == 2) { //if (string.IsNullOrEmpty(stoLotModel.LOT_ID) || infoList.Count == 0) //{ // return; //} //if (stoLotModel.PRINT_NUM > 0) //{ // SystemCommon.ShowInfoMessageBox("此入库批次已派发,不能作废!"); // return; //} //if (stoLotModel.STATUS == "4") //{ // SystemCommon.ShowErrorMessageBox("任务已经派发,不能作废!"); // return; //} if (SystemCommon.ShowMessageBoxResult("您确定要作废入库批次:" + stoLotModel.LOT_ID) == System.Windows.Forms.DialogResult.OK) { err = IBussFactory.Instance().Cancel(stoLotModel); } else { return; } } if (!string.IsNullOrEmpty(err)) { SystemCommon.ShowErrorMessageBox(err); } SystemCommon.ShowInfoMessageBox("操作成功!"); frmButtonItem["Save"].Enabled = false; frmButtonItem["Rebreak"].Enabled = false; frmButtonItem["Clear"].Enabled = false; frmButtonItem["Audit"].Enabled = false; BindStoGrid(); BindStoInfoGrid(); stoAddList.Clear(); stoDelList.Clear(); panelControl1.Visible = true; } catch (Exception e) { SystemCommon.ShowInfoMessageBox("您的操作出错:" + Environment.NewLine + e.Message); } } #endregion private void GVSto_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e) { if (e.Value == null || e.Value == DBNull.Value) { return; } if (e.Column.FieldName == "TYPE") { 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; } } else if (e.Column.FieldName == "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; default: e.DisplayText = "其它"; break; } } } private decimal isnullnum(object num) { if (num == null || null == DBNull.Value) { return 0; } else { return Convert.ToDecimal(num); } } /// /// GV 值改变时 /// /// /// private void GVStoInfo_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { StorageLotInfoModel focModel = infoList[e.RowHandle]; string eff = ""; if (stoCopyList.Contains(focModel)) { if (e.Column.FieldName == "UNIT") { unit = GVStoInfo.GetFocusedRowCellValue("UNIT").ToString(); } } } private void xtraTabControl1_SelectedPageChanged(object sender, DevExpress.XtraTab.TabPageChangedEventArgs e) { } /// /// 下拉框内容变换 /// /// /// private void GVStoInfo_CustomRowCellEditForEditing(object sender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs e) { if (e.RowHandle < 0) { return; } if (e.Column.FieldName == "UNIT") { ReceivingInfoModel info = GVStoInfo.GetFocusedRow() as ReceivingInfoModel; if (info != null && info.GOODS_ID != null) { try { DataTable strResult = IBussFactory.Instance().GetGoodsUnit(info.GOODS_ID); if(strResult!=null) { lueUnits.DataSource = strResult; } } catch (Exception) { //SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!"); } } e.RepositoryItem = lueUnits;//当前单元格绑定控件 } } /// /// 收货单选择 /// /// /// private void DicRece_Button_Click(object sender, EventArgs e) { //if (string.IsNullOrEmpty(DicRece.TextBoxValue)) //{ // return; //} receModel = new ReceivingModel(); // receModel.RECE_ID = DicRece.TextBoxValue; LoadForm load = new LoadForm(); DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(load, load.GetType(), false, true, false, 50); DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormDescription("正在加载数据,请等待...."); try { receListModel = IBussFactory.Instance().GetList(receModel); if (receListModel.Count > 0) { receModel = receListModel[0]; // receInfoList = IBussFactory.Instance().GetInfoList(DicRece.TextBoxValue); } changevalue(0); GCStoInfo.DataSource = infoList; GVStoInfo.RefreshData(); stoLotModel.RECE_ID = receModel.RECE_ID; stoLotModel.NOTICE_ID = receModel.NOTICE_ID; stoLotModel.PROVIDER_ID = receModel.PROVIDER_ID; stoLotModel.PROVIDER_NAME = receModel.PROVIDER_NAME; stoLotModel.RECE_DATE = receModel.RECE_DATE; BSStoTab.DataSource = stoLotModel; BSStoTab.ResetBindings(true); } catch { SystemCommon.ShowErrorMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!"); } DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm(); } private void LEPStoID_EditValueChanged(object sender, EventArgs e) { if (LEPStoID.EditValue == null || LEPStoID.EditValue == DBNull.Value) { return; } if (stoAreaList.Count > 0) { List list = stoAreaList.FindAll(r => r.STORAGE_ID == LEPStoID.EditValue.ToString()); repositoryItemLookUpEdit6.DataSource = list; repositoryItemLookUpEdit6.DisplayMember = "STORAGE_AREA_NAME"; repositoryItemLookUpEdit6.ValueMember = "STORAGE_AREA_ID"; repositoryItemLookUpEdit7.DataSource = list; repositoryItemLookUpEdit7.DisplayMember = "STORAGE_AREA_NAME"; repositoryItemLookUpEdit7.ValueMember = "STORAGE_AREA_ID"; } } private void LEPStoType_EditValueChanged(object sender, EventArgs e) { if (LEPStoType.EditValue != null && LEPStoType.EditValue != DBNull.Value) { if (LEPStoType.Text.Contains("退货")) { labCus.Visible = true; LEPCustomer.Visible = true; labPro.Visible = false; LEPStoPro.Visible = false; } else { labCus.Visible = false; LEPCustomer.Visible = false; labPro.Visible = true; LEPStoPro.Visible = true; } } } private void gVWareNotice_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { if(gVWareNotice.RowCount==0) { return; } string wareId = gVWareNotice.GetFocusedRowCellValue(colWAREHOUSING_ID).ToString(); noticeMessModel = gVWareNotice.GetFocusedRow() as WareNoticeModel; GetDetailDoc(wareId); } private void GetDetailDoc(string docId) { try { List list_wn_TabModel = IBussFactory.Instance().GetWareNoticeTabByList(docId); if (list_wn_TabModel != null) BSReceInfo.DataSource = list_wn_TabModel; } catch (Exception ex) { SystemCommon.ShowInfoMessageBox("网络连接错误!"); return; } } private void ctrlDictonary3_Button_Click(object sender, EventArgs e) { if(ctrlDictonary3.TextBoxValue.Trim().Length==0) { return; } string val = ctrlDictonary3.TextBoxValue; if(val.Trim().Length>0) { } } private void ctrlButtons1_Click(object sender, EventArgs e) { FrmReceiveDet frm = new FrmReceiveDet(userData.STORAGE_ID,userData.STORAGE_NAME); if(DialogResult.OK == frm.ShowDialog()) { Refresh(); xtcGroup.SelectedTabPage = PageSto; PageStoInfo.PageEnabled = false; frmButtonItem["Save"].Enabled = false; frmButtonItem["Rebreak"].Enabled = false; frmButtonItem["Clear"].Enabled = false; frmButtonItem["Audit"].Enabled = false; } } } }