/// <summary> /// 出库校验 /// </summary> /// <param name="grid"></param> /// <param name="currentrow"></param> /// <param name="con"></param> /// <param name="inputValue"></param> /// <param name="errorInfo"></param> /// <returns></returns> protected bool DoAfterSelOutCheck(KgmGrid grid, Resco.Controls.SmartGrid.CustomEditEventArgs e, EditControlInterface con, string inputValue, out string errorInfo) { errorInfo = string.Empty; //判断是否是buttonclick将信息带出来 如果是则直接取editvalue string shineValue = e.Cell.Row[QSConstValue.ROWSHINEVALUE].ToString(); string shineText = e.Cell.Row[QSConstValue.ROWSHINETEXT].ToString(); //改用调用API方式 SYS_SingleTableInfo filter = AppUtil.InitFilterModelAPI(e, string.Format(" AND ({0} = '{1}') ", shineValue, inputValue, shineText)); string jsonData = WebAPIUtil.ConvertObjToJson(filter); DataTable dtBasic = WebAPIUtil.PostAPIByJsonToGeneric <DataTable>("api/basicdocument/GetSingleTableInfo", jsonData); if (dtBasic == null || dtBasic.Rows.Count == 0) { errorInfo = "未能获取信息,请输入正确的编码!"; e.Cell.Row[QSConstValue.VALUEMEMBER] = e.Cell.Row[QSConstValue.DISPLAYMEMBER] = string.Empty; return(false); } con.EditValue = dtBasic.Rows[0][QSConstValue.VALUEMEMBER].ToString(); con.EditText = dtBasic.Rows[0][QSConstValue.DISPLAYMEMBER].ToString(); return(true); }
/// <summary> /// 给Grid数据源赋值 /// </summary> /// <param name="grid"></param> /// <param name="dt"></param> /// <param name="dr"></param> /// <returns></returns> public static bool SetValueFromGirdSource(KgmGrid grid, DataRow dr, bool bCheck) { foreach (Resco.Controls.SmartGrid.Row row in grid.Rows) { try { if (dr.Table.Columns.Contains(row[QSConstValue.ROWMAPPINGVALUE].ToString())) { dr[row[QSConstValue.ROWMAPPINGVALUE].ToString()] = row[QSConstValue.VALUEMEMBER]; } if (dr.Table.Columns.Contains(row[QSConstValue.ROWMAPPINGTEXT].ToString())) { dr[row[QSConstValue.ROWMAPPINGTEXT].ToString()] = row[QSConstValue.DISPLAYMEMBER]; } if (bCheck && Convert.ToBoolean(row[QSConstValue.BNOTNULL]) && string.IsNullOrEmpty(row[QSConstValue.VALUEMEMBER].ToString())) { AppUtil.ShowWarning(row[QSConstValue.ROWTITLE].ToString() + "不允许为空"); grid.SetEditCellFocus(row[QSConstValue.ROWMAPPINGVALUE].ToString()); return(false); } } catch { } } return(true); }
/// <summary> /// 新建单据在选择业务单据号后的处理 /// </summary> /// <param name="dtSource">数据源</param> /// <param name=QSConstValue.VALUEMEMBER>实际输入的值</param> /// <param name="errorInfo">错误信息</param> /// <returns>True False</returns> protected bool DoAfterSelVouchType(KgmGrid grid, EditControlInterface con, string inputvalue, out string errorInfo) { errorInfo = string.Empty; ////设置过滤条件 //string rowfilter = string.Format(" AND A.MODULEID = '{0}' AND (CVOUCHID = '{1}' OR CVOUCHNAME = '{1}' OR CSOURCE = '{1}')", QSCommonValue.OP_Module.ModuleId, inputvalue); ////根据过滤条件读取单据信息 ////ADO ////DataTable dtVouchType = bll.GetVouchModel(rowfilter); ////API //VouchModel model = new VouchModel(); //model.Condition = rowfilter; //model.DBNAME = QSCommonValue.BarDbConfigInfo.U8DatabaseName; //string jsonData = WebAPIUtil.ConvertObjToJson(model); //DataTable dtVouchType = WebAPIUtil.PostAPIByJsonToGeneric<DataTable>("api/basic/GetVouchModel", jsonData); //if (dtVouchType == null || dtVouchType.Rows.Count == 0) //{ // errorInfo = "未能获取到业务类型信息,请确认编码是否正确!"; // return false; //} ////循环赋值 //if (!AppUtil.SetValueToGirdSource(grid, dtVouchType.Rows[0], false)) //{ // return false; //} return(true); }
/// <summary> /// 初始化业务类型信息 /// </summary> public static void InitBusInfo(KgmGrid grid, DataTable dtVouchType) { #region 赋默认值 //如果画面为空,则不赋值 DataTable dt = grid.DataSource as DataTable; if (dt == null || dt.Rows.Count == 0) { return; } //判断画面上是否存在下拉框,如果存在则绑定来源类型 EditCombox cmb = grid.GetComboBoxCtrl(); if (cmb != null) { cmb.DataSourceID = QSConstValue.CVOUCHID; AppUtil.BindCombBox(ref cmb, dtVouchType, QSConstValue.CVOUCHID, QSConstValue.CSOURCE, false); } //判断当前模块是否存在默认业务类型,如果存在,则初始化业务类型 DataView dvVouchType = new DataView(dtVouchType); dvVouchType.RowFilter = " ISCREATE = 1 "; if (dvVouchType.Count == 0) { return; } InitVouchInfo(grid, dvVouchType.ToTable()); #endregion }
/// <summary> /// 初始化过滤信息 /// </summary> public SYS_SingleTableInfo InitFilterModel(KgmGrid grid) { string rowMappingValue = grid.SelectedCell.Row[QSConstValue.ROWMAPPINGVALUE].ToString().ToUpper(); string where = string.Empty; return(AppUtil.InitFilterModelAPI(grid, where)); }
/// <summary> /// 扫描条码后处理 /// </summary> /// <param name="dtSource">数据源</param> /// <param name=QSConstValue.VALUEMEMBER>实际输入的值</param> /// <param name="errorInfo">错误信息</param> /// <returns>True False</returns> protected bool DoAfterScanBarcode(KgmGrid grid, Resco.Controls.SmartGrid.CustomEditEventArgs e, EditControlInterface con, string inputValue, out string errorInfo) { errorInfo = string.Empty; con.EditValue = con.EditText = inputValue; return(true); }
/// <summary> /// 初始化grid控件 /// </summary> /// <param name="grid"></param> /// <param name="dtColumn"></param> /// <param name="dtRow"></param> public static void InitKgmGrid(ref KgmGrid grid, DataTable dtColumn, DataTable dtRow) { if (dtColumn.Rows.Count > 0) { grid.KgmGridType = dtColumn.Rows[0][QSConstValue.EDITMODE].ToString() == "1" ? KgmGrid.GridType.RowEdit : KgmGrid.GridType.ColumnEdit; grid.ColumnHeadersVisible = dtColumn.Rows[0][QSConstValue.EDITMODE].ToString() != "1"; grid.RowHeadersVisible = false; grid.initGridData(dtColumn, dtRow); } }
/// <summary> /// 初始化grid控件 /// </summary> /// <param name="grid"></param> /// <param name="dtColumn"></param> /// <param name="dtRow"></param> public static void InitKgmGrid(ref KgmGrid grid, string formName, string orderType, string cVouchID) { //DataTable dtColumn = sysbll.GetGridColumn(formName, grid.Name, orderType, cVouchID); //DataTable dtRow = sysbll.GetGridRow(formName, grid.Name, orderType, cVouchID); //if (dtColumn.Rows.Count > 0) //{ // grid.KgmGridType = dtColumn.Rows[0][QSConstValue.EDITMODE].ToString() == "1" ? KgmGrid.GridType.RowEdit : KgmGrid.GridType.ColumnEdit; // grid.ColumnHeadersVisible = dtColumn.Rows[0][QSConstValue.EDITMODE].ToString() != "1"; // grid.RowHeadersVisible = false; // grid.initGridData(dtColumn, dtRow); //} }
/// <summary> /// 绑定下拉框信息 /// </summary> /// <param name="cVouchName"></param> public static void BindEditCombo(KgmGrid grid, DataTable dtSource) { EditCombox cmb = grid.GetComboBoxCtrl(); if (cmb.DataSourceID != grid.SelectedCell.Row[QSConstValue.ROWMAPPINGVALUE].ToString()) { cmb.DataSourceID = grid.SelectedCell.Row[QSConstValue.ROWMAPPINGVALUE].ToString(); //绑定ComboBox AppUtil.BindCombBox(ref cmb, dtSource, grid.SelectedCell.Row[QSConstValue.ROWMAPPINGVALUE].ToString(), grid.SelectedCell.Row[QSConstValue.ROWMAPPINGTEXT].ToString(), false); } }
/// <summary> /// 扫描条码后处理 /// </summary> /// <param name="dtSource">数据源</param> /// <param name=QSConstValue.VALUEMEMBER>实际输入的值</param> /// <param name="errorInfo">错误信息</param> /// <returns>True False</returns> protected bool DoAfterScanBarcode(KgmGrid grid, Resco.Controls.SmartGrid.CustomEditEventArgs e, EditControlInterface con, string inputValue, out string errorInfo) { errorInfo = string.Empty; ////ADO ////dttray = bll.GetSingleTableInfo("TRAY_INFO", "ID", "TRAYNO", "", string.Format(" AND TRAYNO = '{0}'", inputValue), string.Empty, true, ""); ////API //Kgm_FilterModel model = new Kgm_FilterModel(); //model.tableName = "TRAY_INFO"; //model.valueMember = "ID"; //model.displayMember = "TRAYNO"; //model.filedName = string.Empty; //model.where = string.Format(" AND TRAYNO = '{0}'", inputValue); //model.dbName = string.Empty; //model.bDistinct = true; //model.sortFiled = string.Empty; //string jsonData = WebAPIUtil.ConvertObjToJson(model); //DataTable dttray = WebAPIUtil.PostAPIByJsonToGeneric<DataTable>("api/basic/GetSingleTableInfo", jsonData); //if (dttray == null || dttray.Rows.Count == 0) //{ // errorInfo = "未能获取到对应的信息,请确认条码是否正确!"; // return false; //} //if (!AppUtil.SetValueToGirdSource(grid, dttray.Rows[0], false)) //{ // errorInfo = "未能获取到对应的信息,请确认条码是否正确!"; // return false; //} //else { // DataTable dtbarcode = bll.BarcodeAnalyze(QSCommonValue.TempScanHead["OPERORDER"].ToString(), inputValue, QSCommonValue.BarDbConfigInfo.BarcodeDatabaseName); // if (dtbarcode == null || dtbarcode.Rows.Count == 0) // { // errorInfo = "未能获取到对应的解析信息,请确认条码是否正确!"; // return false; // } // if (dtbarcode.Columns.Count == 1) // { // errorInfo = dtbarcode.Rows[0][0].ToString(); // return false; // } // if (!AppUtil.SetValueToGirdSource(grid, dtbarcode.Rows[0], false)) // { // return false; // } //} //con.EditValue = con.EditText = inputValue; return(true); }
/// <summary> /// 新建单据在选择业务单据号后的处理 /// </summary> /// <param name="dtSource">数据源</param>f /// <param name=QSConstValue.VALUEMEMBER>实际输入的值</param> /// <param name="errorInfo">错误信息</param> /// <returns>True False</returns> protected bool DoAfterSelOrderNo(KgmGrid grid, EditControlInterface con, string inputvalue, out string errorInfo) { errorInfo = string.Empty; string biztype = string.Empty; try { biztype = grid.GetRowCellData("CVOUCHID", QSConstValue.VALUEMEMBER).ToString(); if (string.IsNullOrEmpty(biztype)) { errorInfo = "业务类型不能为空!"; return(false); } } catch { } //设置过滤条件 string rowfilter = string.Format(" AND ORDERNO = '{0}' ", inputvalue); //根据过滤条件读取单据信息 //ADO //DataTable dtorderList = bll.GetSourceList(rowfilter, bU8Sys); //API SYS_SourceList model = new SYS_SourceList(); model.Condition = rowfilter; model.Bu8sys = bU8Sys; string jsonData = WebAPIUtil.ConvertObjToJson(model); DataTable dtorderList = WebAPIUtil.PostAPIByJsonToGeneric <DataTable>("api/basic/GetSourceList", jsonData); if (dtorderList == null || dtorderList.Rows.Count == 0) { errorInfo = "未能获取到单据信息,请确认单据是否正确!"; return(false); } //循环赋值 if (!AppUtil.SetValueToGirdSource(grid, dtorderList.Rows[0], false)) { return(false); } con.EditValue = dtorderList.Rows[0]["ORDERID"].ToString(); con.EditText = dtorderList.Rows[0]["ORDERNO"].ToString(); //列表内的客户设置为不可用 //grid.SetRowCellData("CCUSCODE", new string[] { QSConstValue.BEDIT }, new object[] { false }); return(true); }
/// <summary> /// 初始化来源类型信息 /// </summary> public static void InitVouchInfo(KgmGrid grid, DataTable dtVouch) { ////初始化来源类型对象 //QSCommonValue.KgmVouchType = dtVouch.Rows[0]; ////初始化来源类型默认信息 //foreach (Resco.Controls.SmartGrid.Row row in grid.Rows) //{ // string rowValue = row[QSConstValue.ROWMAPPINGVALUE].ToString(); //映射值 // string rowText = row[QSConstValue.ROWMAPPINGTEXT].ToString();//影射现实信息 // //给画面信息赋值 // if (dtVouch.Columns.Contains(rowValue)) // { // row[QSConstValue.VALUEMEMBER] = dtVouch.Rows[0][rowValue].ToString(); // } // if (dtVouch.Columns.Contains(rowText)) // { // row[QSConstValue.DISPLAYMEMBER] = dtVouch.Rows[0][rowText].ToString(); // } // bool bEdit = false; // //如果来源类型为底层单据rdrecord则所有选项不可编辑 // if (QSCommonValue.KgmVouchType[QSConstValue.CSOURCETABLE].ToString() == QSConstValue.RDRECORD) // { // if (rowValue != QSConstValue.KGM_VOUCHTYPE && rowValue != QSConstValue.KGM_BUSCODE) // { // row[QSConstValue.BNOTNULL] = row[QSConstValue.BEDIT] = bEdit; // } // } // else // { // bEdit = !(QSCommonValue.KgmVouchType[QSConstValue.CSOURCETABLE].ToString() == string.Empty); // //判断当前业务类型信息 // switch (row[QSConstValue.ROWSHINETABLE].ToString().ToUpper()) // { // case QSConstValue.KGM_BUSCODE: //单据号 // //设置单据号是否可编辑 // row[QSConstValue.BNOTNULL] = row[QSConstValue.BEDIT] = bEdit; // break; // case QSConstValue.PURCHASETYPE: //采购类型 // row[QSConstValue.BEDIT] = bEdit; // break; // case QSConstValue.SALETYPE: //销售类型 // row[QSConstValue.BEDIT] = bEdit; // break; // } // } //} }
/// <summary> /// 给Grid数据源赋值 /// </summary> /// <param name="grid"></param> /// <param name="dt"></param> /// <param name="dr"></param> /// <returns></returns> public static bool VlidateGrid(KgmGrid grid) { foreach (Resco.Controls.SmartGrid.Row row in grid.Rows) { if (Convert.ToBoolean(row[QSConstValue.BNOTNULL]) && string.IsNullOrEmpty(row[QSConstValue.VALUEMEMBER].ToString())) { AppUtil.ShowWarning(row[QSConstValue.ROWTITLE].ToString() + "不允许为空"); grid.SetEditCellFocus(row[QSConstValue.ROWMAPPINGVALUE].ToString()); return(false); } } return(true); }
/// <summary> /// 清除grid文本 /// </summary> /// <param name="grid"></param> public static void ClearGrid(KgmGrid grid) { foreach (Resco.Controls.SmartGrid.Row row in grid.Rows) { row[QSConstValue.VALUEMEMBER] = row[QSConstValue.DISPLAYMEMBER] = string.Empty; } EditCombox cmb = grid.GetComboBoxCtrl(); if (grid != null) { cmb.DataSource = null; cmb.DataSourceID = string.Empty; } }
/// <summary> /// 称重后处理 /// </summary> /// <param name="dtSource">数据源</param> /// <param name=QSConstValue.VALUEMEMBER>实际输入的值</param> /// <param name="errorInfo">错误信息</param> /// <returns>True False</returns> protected bool DoAfterWeight(KgmGrid grid, Resco.Controls.SmartGrid.CustomEditEventArgs e, EditControlInterface con, string inputValue, out string errorInfo) { errorInfo = string.Empty; //重量如果是IP地址,则读取SOCKET string patten = @"((?:(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(?:25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d))))"; System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex(patten); if (r.Match(inputValue).Success) { //读取socket OpenWifi(inputValue); } else { con.EditValue = con.EditText = inputValue; } return(true); }
/// <summary> /// 选取基础档案后的处理 /// </summary> /// <param name="grid"></param> /// <param name="currentrow"></param> /// <param name="con"></param> /// <param name="inputValue"></param> /// <param name="errorInfo"></param> /// <returns></returns> protected bool DoAfterSelBasicDoc(KgmGrid grid, Resco.Controls.SmartGrid.CustomEditEventArgs e, EditControlInterface con, string inputValue, out string errorInfo) { errorInfo = string.Empty; ////判断是否是buttonclick将信息带出来 如果是则直接取editvalue //string value = con.EditValue.ToString().ToUpper() == e.Cell.Row[QSConstValue.VALUEMEMBER].ToString().ToUpper() ? value = con.EditText : con.EditValue.ToString(); //string shineValue = e.Cell.Row[QSConstValue.ROWSHINEVALUE].ToString(); //if (e.Cell.Row[QSConstValue.ROWMAPPINGVALUE].ToString().ToUpper() == "CPOSCODE" || e.Cell.Row[QSConstValue.ROWMAPPINGVALUE].ToString().ToUpper() == "CIPOSCODE") //{ // if (value.Length != 6) // { // value = QSCommonValue.TempScanHead["CWHCODE"].ToString() + value; // } //} ////根据填写的信息,读取档案信息带出值 //Kgm_FilterModel filter = AppUtil.InitFilterModel(e, string.Format(" AND {0} = '{1}' ", shineValue, value)); //if (filter.tableName.ToLower() == "list_main") //{ // string ordertype = QSCommonValue.OP_Module.ModuleMenu == "扫描入库" ? "入库通知" : "出库通知"; // filter.where += string.Format(" AND ORDERTYPE = '{0}'", ordertype); //} ////ADO ////DataTable dtBasic = bll.GetSingleTableInfo(filter); ////API //string jsonData = WebAPIUtil.ConvertObjToJson(filter); //DataTable dtBasic = WebAPIUtil.PostAPIByJsonToGeneric<DataTable>("api/basic/GetSingleTableInfo", jsonData); //if (dtBasic == null || dtBasic.Rows.Count == 0) //{ // errorInfo = "未能获取信息,请输入正确的编码!"; // e.Cell.Row[QSConstValue.VALUEMEMBER] = e.Cell.Row[QSConstValue.DISPLAYMEMBER] = string.Empty; // return false; //} //con.EditValue = dtBasic.Rows[0][QSConstValue.VALUEMEMBER].ToString(); //con.EditText = dtBasic.Rows[0][QSConstValue.DISPLAYMEMBER].ToString(); return(true); }
/// <summary> /// 新建单据在选择业务单据号后的处理 /// </summary> /// <param name="dtSource">数据源</param> /// <param name=QSConstValue.VALUEMEMBER>实际输入的值</param> /// <param name="errorInfo">错误信息</param> /// <returns>True False</returns> protected bool DoAfterSelOrderNo(KgmGrid grid, EditControlInterface con, string inputvalue, out string errorInfo) { errorInfo = string.Empty; var biztype = string.Empty; try { biztype = grid.GetRowCellData("CVOUCHID", QSConstValue.VALUEMEMBER).ToString(); if (string.IsNullOrEmpty(biztype)) { errorInfo = "业务类型不能为空!"; return(false); } } catch (Exception ex) { AppUtil.ShowError(ex.ToString()); } //设置过滤条件 string rowfilter = string.Format(" AND ORDERNO = '{0}' ", inputvalue); //根据过滤条件读取单据信息 //DataTable dtorderList = tbll.GetTVInfo(rowfilter); string jsonData = WebAPIUtil.ConvertObjToJson(rowfilter); DataTable dtorderList = WebAPIUtil.PostAPIByJsonToGeneric <DataTable>("api/tray/GetTVInfo", jsonData); if (dtorderList == null || dtorderList.Rows.Count == 0) { errorInfo = "未能获取到单据信息,请确认单据是否正确!"; return(false); } //循环赋值 if (!AppUtil.SetValueToGirdSource(grid, dtorderList.Rows[0], false)) { return(false); } return(true); }
/// <summary> /// 给Grid数据源赋值 /// </summary> /// <param name="grid"></param> /// <param name="dt"></param> /// <param name="dr"></param> /// <returns></returns> public static bool SetValueToGirdSource(KgmGrid grid, DataRow dr, bool bCheck) { foreach (Resco.Controls.SmartGrid.Row row in grid.Rows) { string mappingValue = row[QSConstValue.ROWMAPPINGVALUE].ToString().ToUpper(); string mappingText = row[QSConstValue.ROWMAPPINGTEXT].ToString().ToUpper(); if (dr.Table.Columns.Contains(mappingValue) && !string.IsNullOrEmpty(dr[mappingValue].ToString())) { row[QSConstValue.VALUEMEMBER] = dr[mappingValue]; } if (dr.Table.Columns.Contains(mappingText) && !string.IsNullOrEmpty(dr[mappingText].ToString())) { row[QSConstValue.DISPLAYMEMBER] = dr[mappingText].ToString(); } if (dr.Table.Columns.Contains("CSOURCE") && mappingValue == "CSOURCECODE") { if (dr["CSOURCE"].ToString() == "无来源" || dr["CSOURCE"].ToString() == "无来源") { row[QSConstValue.BEDIT] = false; row[QSConstValue.BNOTNULL] = false; } else { row[QSConstValue.BEDIT] = true; row[QSConstValue.BNOTNULL] = true; } } if (bCheck && Convert.ToBoolean(row[QSConstValue.BNOTNULL]) && string.IsNullOrEmpty(row[QSConstValue.VALUEMEMBER].ToString())) { AppUtil.ShowWarning(row[QSConstValue.ROWTITLE].ToString() + "不允许为空"); grid.SetEditCellFocus(row[QSConstValue.ROWMAPPINGVALUE].ToString()); return(false); } } return(true); }
/// <summary> /// 判断列表Button_Click时,是否需要弹窗体 /// </summary> /// <param name="grid"></param> /// <returns>返回弹窗窗体</returns> public static FrmBaseSelForm KgmGridButtonShowForm(KgmGrid grid) { //判断当前shinetable是否为空,不为空,弹出基础档案选择画面 DataTable dtSource = grid.DataSource as DataTable; if (dtSource == null || !Convert.ToBoolean(grid.SelectedCell.Row[QSConstValue.BDOCUMENT]) || grid.SelectedCell.Row[QSConstValue.ROWSHINETABLE].ToString() == string.Empty) { return(null); } FrmBaseSelForm frm = null; //switch (grid.SelectedCell.Row[QSConstValue.ROWSHINETABLE].ToString()) //{ // case QSConstValue.LIST_HEAD: // frm = new FrmListFilter(); // break; // default: // frm = new FrmDocument(); // break; //} return(frm); }