private bool SaveData() { bsTempMaterial.EndEdit(); if (!string.IsNullOrEmpty(_tempmaterial.MaterialNo) || _sapmaterial == null || _tempmaterial.MaterialNo != _tempmaterial.MaterialNo) { GetSAPMaterial(); } if (_sapmaterial == null || string.IsNullOrEmpty(_tempmaterial.MaterialDesc)) { return(false); } if (!CheckInput()) { return(false); } string strErr = string.Empty; if (Warehouse_Func.SaveTempMaterial(ref _tempmaterial, ref strErr)) { Common.Common_Func.ErrorMessage("临时物料替换成功!", "保存成功"); bsTempMaterial.DataSource = _tempmaterial; InitForm(); return(true); } else { Common.Common_Func.ErrorMessage(strErr, "保存失败"); bsTempMaterial.DataSource = _tempmaterial; return(false); } }
private void GetListQueryData() { try { this.Cursor = Cursors.WaitCursor; bool bResult = false; string strErr = string.Empty; bResult = Warehouse_Func.GetAllotData(_lstprod, ref _prod, ref strErr); dgvData.DataSource = _prod.lstDetails; if (!bResult || !string.IsNullOrEmpty(strErr)) { Common.Common_Func.ErrorMessage(strErr, "查询失败"); } } catch (Exception ex) { Common.Common_Func.ErrorMessage(ex.Message, "查询失败"); } finally { this.Cursor = Cursors.Default; } }
private bool SaveData() { bsTempMaterial.EndEdit(); if (!CheckInput()) { return(false); } string strErr = string.Empty; if (Warehouse_Func.SaveTempMaterial(ref _tempmaterial, ref strErr)) { Common.Common_Func.ErrorMessage("临时物料保存成功!" + Environment.NewLine + "临时物料编号为:" + _tempmaterial.TempMaterialNo, "保存成功"); bsTempMaterial.DataSource = _tempmaterial; InitForm(); _back = Common.Common_Func.ConvertToModel <TempMaterialInfo>(_tempmaterial); return(true); } else { Common.Common_Func.ErrorMessage(strErr, "保存失败"); bsTempMaterial.DataSource = _tempmaterial; return(false); } }
private TempMaterialInfo GetListRowModel(int iRowIndex) { string strErr = string.Empty; TempMaterialInfo tempmaterial = new TempMaterialInfo(); tempmaterial.ID = lstMain[iRowIndex].ID; if (!Warehouse_Func.GetTempMaterialByID(ref tempmaterial, ref strErr)) { Common.Common_Func.ErrorMessage(strErr, "读取失败"); GetListQueryData(); return(null); } return(tempmaterial); }
private void GetSAPMaterial() { _sapmaterial = new TempMaterialInfo(); _sapmaterial.MaterialNo = txtMaterialNo.Text.Trim(); string strError = string.Empty; if (Warehouse_Func.GetMaterialInfo(ref _sapmaterial, ref strError)) { _tempmaterial.MaterialNo = _sapmaterial.MaterialNo; _tempmaterial.MaterialDesc = _sapmaterial.MaterialDesc; } else { _sapmaterial = null; _tempmaterial.MaterialDesc = ""; MessageBox.Show(strError, "获取SAP物料失败"); } }
private void GetListQueryData() { bsMain.EndEdit(); bool bResult = false; string strErr = string.Empty; GetQueryMain(); ChensControl.DividPage clientPage = pageList.dDividPage; Common.Common_Func.GetServerPageFromClientPage(ref _serverMainPage, clientPage); bResult = Warehouse_Func.GetTempMaterialListByPage(ref lstMain, queryMain, ref _serverMainPage, ref strErr); Common.Common_Func.GetClientPageFromServerPage(_serverMainPage, ref clientPage); pageList.ShowPage(); dgvList.DataSource = lstMain; if (!bResult || !string.IsNullOrEmpty(strErr)) { Common.Common_Func.ErrorMessage(strErr, "查询失败"); } txtMaterialNo.Focus(); }
private void DeleteListRow(int iRowIndex) { TempMaterialInfo tempmaterial = GetListRowModel(iRowIndex); if (tempmaterial == null) { return; } if (MessageBox.Show(string.Format("是否确认删除临时物料【{0}】?", tempmaterial.TempMaterialDesc), "确认删除", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.No) { return; } try { if (tempmaterial.IsDel != 2) { string strErr = string.Empty; if (!Warehouse_Func.DeleteTempMaterialByID(tempmaterial, ref strErr)) { Common.Common_Func.ErrorMessage(strErr, "删除失败"); return; } } Common.Common_Func.ErrorMessage("删除临时物料成功", "删除成功"); } catch (Exception ex) { Common.Common_Func.ErrorMessage(ex.Message); } finally { GetListQueryData(); } }