SVN-Revision: r510
This commit is contained in:
wyf
2025-04-29 03:45:31 +00:00
parent 7708c7ef48
commit a0697b4b95
3 changed files with 812 additions and 95 deletions
@@ -194,6 +194,75 @@ namespace Lskj.PubBomImport
}
return saveResult;
}
public bool BillSaveSql(ref string guid, int comfirm = 0, bool canTipMsg = true)
{
guid = Guid.NewGuid() + "";
bool saveResult = false;
if (ControlObj.VerifyNull())
{
// 保存之前先进行表格更新
if (billModel.DetailTreeTable)
{
(this.gcMain as TreeGridControlEx).TreeListObj.PostEditor();
}
else
{
this.gcMain.GridView.PostEditor();
this.gcMain.GridView.UpdateCurrentRow();
}
try
{
if (this.gcMain.VerifyNull())
{
if (this.gcMain.RepeatedVerificationNames.Count > 0 && this.gcMain.VerifyDuplicateColumns())
{
//MessageUtil.Show("表格中数据内容重复,保存失败!");
return saveResult;
}
string billNo = this.lblOrderNo.Text.Trim();
string detailGuid = Guid.NewGuid().ToString();
string masterSql = billModel.SaveState ? GetUpdateRecord(billNo) : GetAddRecord(ref billNo);
string detailSql = GetDetailRecord(detailGuid, billNo).ToString();
// 检查单据头数据合法性
if (string.IsNullOrEmpty(masterSql)) return false;
// 验证明细合法性
if (string.IsNullOrEmpty(detailSql) && !billModel.SaveNullDetail)
{
MessageUtil.Show(ResourceKeys.BillDetailIsNotNull);
return false;
}
string tipMsg = string.Empty;
//param[0].Value = masterSql;
//param[1].Value = billNo;
//param[2].Value = detailGuid;
//param[3].Value = ERPInfo.Instance.UserId;
//param[4].Value = billWay;// --1新增,2为修改,3为删除
//param[5].Value = billSeq;
//param[6].Value = "";
//param[7].Value = auditFlag;
//param[8].Value = comfirm;
BaseImpl.ExecSqlValue($"insert into p_bomImportExecTab (guid,detailTable,masterSql,detailSql,billNo,detailGuid,UserId,billWay,billSeq,auditFlag,comfirm,newVer) " +
$"values ('{guid}','{billModel.DetailTable}','{masterSql.Replace("'", "''")}','{detailSql.Replace("'", "''")}','{billNo}','{detailGuid.Replace("'", "''")}','{ERPInfo.Instance.UserId}','{(billModel.SaveState ? 2 : 1)}','{billModel.BillSeq}','0','{comfirm}','{billModel.NewVer}')");
//int result = BillImpl.BillSave(masterSql, detailSql, billModel.DetailTable, ref billNo, detailGuid, billModel.BillSeq, billModel.SaveState ? 2 : 1, comfirm, out tipMsg, 0, billModel.NewVer);
//if (result == 1)
//{
// saveResult = true;
//}
//else
//{
// throw new Exception($"保存Bom失败\r\n{tipMsg}");
//}
}
}
catch (Exception ex)
{
throw new Exception($"保存Bom失败\r\n{ex.Message}");
}
}
return saveResult;
}
private string GetUpdateRecord(string parmaryValue)
{
StringBuilder updateBuilder = new StringBuilder();