SVN-Revision: r767
This commit is contained in:
cyf
2025-06-20 06:00:11 +00:00
parent c7d45b9a02
commit b98ea63d10
+229 -16
View File
@@ -219,7 +219,10 @@ namespace Lskj.PubBill
/// 是否已经添加了多行汇总
/// </summary>
public bool MultiLineSummary;
/// <summary>
/// 扫码框
/// </summary>
public TextEdit ScanCodeTextEdit = null;
public BillModule()
{
@@ -280,6 +283,10 @@ namespace Lskj.PubBill
this.rdRed.Text = Business.Impl.LanguageTranslation.GetTranslatedText(this.rdRed.Text);
this.labelControl1.Text = Business.Impl.LanguageTranslation.GetTranslatedText(this.labelControl1.Text);
}
}
catch (Exception ex)
{
@@ -297,6 +304,7 @@ namespace Lskj.PubBill
this.pl_main_center_master.VerticalScroll.Visible = this.BillModel.MainVerticalScroll;//隐藏纵向滚动条
this.pl_main_center_master.HorizontalScroll.Visible = this.BillModel.MainHorizontalScrolling;//隐藏横向滚动条
}
}
}
@@ -1643,6 +1651,10 @@ namespace Lskj.PubBill
this.tb_buttom.Model = this.SysModel;
this.tb_buttom.ParentControlEx = this.ControlObj;
this.tb_buttom.ParentGridEx = this.gcMain;
if (this.BillModel.AttachmentRefreshMain)
{
this.tb_buttom.OnDetailSaveGridCallBack += Tab_OnDetailSaveGridCallBack;
}
this.tb_buttom.InitTabPages(attachModels);
this.tb_buttom.OnRightCallback += new EventHandler(OnButtomRightCallBack);
}
@@ -1670,7 +1682,7 @@ namespace Lskj.PubBill
XtraTabPage tabPage = new XtraTabPage();
tabPage.Text = model.UserName;
#region
#region
if (!string.IsNullOrWhiteSpace(model.CodeInputSql) && !string.IsNullOrWhiteSpace(model.CodeInputCaption))
{
ComboBoxEditModel editModel = new ComboBoxEditModel()
@@ -4559,6 +4571,8 @@ namespace Lskj.PubBill
model.FieldType == ControlType.LabPicEx)
continue;
if (string.IsNullOrWhiteSpace(model.FieldName)) continue;
string fieldValue = this.ControlObj.GetControlValue(model);
if (SystemInfo.Instance.TrimWhiteSpace)
fieldValue = fieldValue.Trim();
@@ -4612,6 +4626,8 @@ namespace Lskj.PubBill
model.FieldType == ControlType.LabPicEx)
continue;
if (string.IsNullOrWhiteSpace(model.FieldName)) continue;
BaseUserControl userControl = this.ControlObj.FindControl(model);
if (userControl != null)
{
@@ -6463,26 +6479,28 @@ namespace Lskj.PubBill
if (unionModel.ModelObj.CadDragDetail)
{
this.AddMultiRowToGridView(details, unionModel);
}
if (BillModel.drgFinishHide == "1" && unionModel.GridDetailControlObj != null)
{
var detailRows = details.AsEnumerable().ToList();
foreach (var detailRow in detailRows)
if (BillModel.drgFinishHide == "1" && unionModel.GridDetailControlObj != null)
{
if (unionModel.GridDetailControlObj.GridControl.DataSourceTable().Rows.IndexOf(detailRow) >= 0)
var detailRows = details.AsEnumerable().ToList();
foreach (var detailRow in detailRows)
{
unionModel.GridDetailControlObj.GridControl.DataSourceTable().Rows.Remove(detailRow);
//RemoveRowitem.Add(rowItem);
}
if (unionModel.GridDetailDetailControlObj != null && unionModel.GridDetailDetailControlObj.GridControl.DataSourceTable().Rows.IndexOf(detailRow) >= 0)
{
unionModel.GridDetailDetailControlObj.GridControl.DataSourceTable().Rows.Remove(detailRow);
//RemoveRowitem.Add(rowItem);
if (unionModel.GridDetailControlObj.GridControl.DataSourceTable().Rows.IndexOf(detailRow) >= 0)
{
unionModel.GridDetailControlObj.GridControl.DataSourceTable().Rows.Remove(detailRow);
//RemoveRowitem.Add(rowItem);
}
if (unionModel.GridDetailDetailControlObj != null && unionModel.GridDetailDetailControlObj.GridControl.DataSourceTable().Rows.IndexOf(detailRow) >= 0)
{
unionModel.GridDetailDetailControlObj.GridControl.DataSourceTable().Rows.Remove(detailRow);
//RemoveRowitem.Add(rowItem);
}
}
}
}
//单据为新增状态,根据最后一行的内容设置红蓝单据
if (!this.BillModel.SaveState && rows.Length - 1 == i && rowItem.Table.Columns.Contains(this.BillModel.RtagidKey) && this.BillModel.BillFlag != 0 && this.BillModel.BillFlag != 1)
{
@@ -7344,6 +7362,7 @@ namespace Lskj.PubBill
}
if (editObj != null)
{
DataTable table = BaseImpl.GetDataTableResult(this.ControlObj.ReplaceControlValue(ReplaceHelper.ReplaceSearchControlCond(editObj.SourceModel.CodeInputSql, inputText)));
if (table.Rows.Count == 0)
{
@@ -7357,8 +7376,10 @@ namespace Lskj.PubBill
{
this.AddRowToGridView(rowItem);
this.AddRowToGridViewByBom(rowItem, editObj.UnionModel, ref onlyPopup);
}
}
}
}
catch (Exception ex)
@@ -7747,6 +7768,23 @@ namespace Lskj.PubBill
}
}
//设置扫码控件
if (!string.IsNullOrWhiteSpace(this.BillModel.CodeExecuteSql) && !string.IsNullOrWhiteSpace(this.BillModel.CodeExecuteParameter))
{
this.pl_input.Controls.Clear();
this.pl_input.Visible = false;
this.ScanCodeTextEdit = new TextEdit();
ScanCodeTextEdit.Height = this.pl_input.Height;
ScanCodeTextEdit.Width = this.pl_input.Width;
ScanCodeTextEdit.Properties.Appearance.Font = new Font("宋体", 10.5F);
ScanCodeTextEdit.Left = 10;
ScanCodeTextEdit.Top = (pl_main_bottom.Height - ScanCodeTextEdit.Height) / 2;
ScanCodeTextEdit.BackColor = ColorTranslator.FromHtml("#FFC0CB");
ScanCodeTextEdit.KeyDown += Text_KeyDown;
ScanCodeTextEdit.Parent = pl_main_bottom;
}
}
@@ -8502,4 +8540,179 @@ namespace Lskj.PubBill
/// </summary>
/// <param name="cond">The cond.</param>
/// <param name="dataRow">The data row.</param>
/// <returns><c>true</c> if X
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
private bool ValidateCond(string cond, DataRow dataRow)
{
bool result = false;
string condition = cond;
try
{
if (string.IsNullOrWhiteSpace(cond)) return true;//如果值是空格或者空行,默认正确
cond = ReplaceHelper.ReplaceRowParam(dataRow, cond);
if (cond.StartsWith("@") || cond.StartsWith("!"))
{
result = "1".Equals(BaseImpl.GetDefaultValue(cond));
}
else if (dataRow == null)
{
result = ReplaceHelper.EvalCond(cond);
}
else
{
result = ReplaceHelper.ReplaceRowParamCond(dataRow, cond);
}
return result;
}
catch (Exception ex)
{
}
return result;
}
/// <summary>
/// 页签里数据修改后刷新主表和主表明细
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Tab_OnDetailSaveGridCallBack(object sender, EventArgs e)
{
try
{
this.SetBillStatus(BillImpl.GetDataRowResult(string.Format("select * from {0} where {1}='{2}'", BillModel.MasterTable, BillModel.PrimaryKey, this.lblOrderNo.Text)));
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
/// <summary>
/// 扫码回车事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Text_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
TextEdit textEdit = sender as TextEdit;
string inputText = textEdit.Text;
if (!string.IsNullOrWhiteSpace(this.BillModel.CodeExecuteSql) && !string.IsNullOrWhiteSpace(this.BillModel.CodeExecuteParameter))
{
if (inputText.Length > 50)
{
MessageUtil.Show("扫码长度过长,请重新扫码");
return;
}
//获取选中行
DataRow MainRowItem = gcMain.GridView.GetFocusedDataRow();
if (MainRowItem == null)
{
MainRowItem = gcMain.GridControl.DataSourceTable().NewRow();
}
List<string> Parameter = this.BillModel.CodeExecuteParameter.Split(',').ToList();
for (int i = 0; i < Parameter.Count; i++)
{
string item = Parameter[i];
if (item.Contains("{DocumentColor}"))
{
string DocumentColor = this.rdBlue.Checked ? "0" : this.rdRed.Checked ? "1" : "";
item = ReplaceHelper.ReplaceParamToValue(item, "{DocumentColor}", DocumentColor);
}
//替换单据号
item = ReplaceHelper.ReplaceParamToValue(item, "{" + this.BillModel.PrimaryDetailKey + "}", this.lblOrderNo.Text);
//替换选中行(没有就传空)
item = ReplaceHelper.ReplaceRowParam(MainRowItem, item);
//替换扫码内容
item = ReplaceHelper.ReplaceParamToValue(item, "{value}", inputText);
Parameter[i] = item;
}
List<string> procParams = ReplaceHelper.GetParamFields(this.BillModel.CodeExecuteSql);
List<SqlParameter> sqlParamList = new List<SqlParameter>();
string[] paramStr = procParams[0].Replace("{", "").Replace("}", "").Split(',');
SqlParameter pMsg = new SqlParameter("@msg", SqlDbType.VarChar, 2000);
for (int i = 0; i < paramStr.Length; i++)
{
string item = paramStr[i];
if (paramStr[i].Equals("@msg", StringComparison.OrdinalIgnoreCase))
{
pMsg.Direction = ParameterDirection.InputOutput;
pMsg.Value = Parameter.Count > i ? string.IsNullOrEmpty(Parameter[i]) ? "" : Parameter[i] : "";
sqlParamList.Add(pMsg);
}
else
{
string paramStr1 = paramStr[i];
SqlParameter param = new SqlParameter(string.Format("{0}", paramStr1), SqlDbType.VarChar);
param.Value = Parameter[i];
sqlParamList.Add(param);
}
}
SqlParameter returnValue = new SqlParameter("@return", SqlDbType.Int, 4);
returnValue.Direction = ParameterDirection.ReturnValue;
int result;
sqlParamList.Add(returnValue);
try
{
result = MainImpl.ExecProcedure(this.BillModel.CodeExecuteSql.Replace(procParams[0], "").Trim(), sqlParamList.ToArray());
}
catch (SqlException sex)
{
string Message = ErrorMessage.PromptErrorMessage(sex);
MessageUtil.Show(Message, sex.Message);
return;
}
catch (Exception ex)
{
result = 0;
}
int rValue = Convert.ToInt32(returnValue.Value);
string varchar = pMsg.Value + "";
switch (rValue)
{
case 1:
if (string.IsNullOrWhiteSpace(varchar))
{
//刷新当前单据
this.SetBillStatus(BillImpl.GetDataRowResult(string.Format("select * from {0} where {1}='{2}'", BillModel.MasterTable, BillModel.PrimaryKey, this.lblOrderNo.Text)));
}
else
{
//刷新返回的单据号
this.lblOrderNo.Text = varchar;
this.SetBillStatus(BillImpl.GetDataRowResult(string.Format("select * from {0} where {1}='{2}'", BillModel.MasterTable, BillModel.PrimaryKey, varchar)));
}
break;
case -1:
MessageUtil.Show(ResourceKeys.OperFault + "\n" + pMsg.Value);
break;
}
}
//刷新单据管理(sourceType=2
foreach (XtraTabPage tabPage in this.xtc_left_container.TabPages)
{
BillSourceUnionModel model = tabPage.Tag as BillSourceUnionModel;
if (model != null && model.GridControlObj != null && model.ModelObj.SourceType == 2)
{
this.RefreshSource(model);
}
}
//刷新下方配置的附件模块
this.OngcMainRowCellClick(null, null);
textEdit.EditValue = "";
textEdit.Focus();
}
}
}
}