SVN-Revision: r528
This commit is contained in:
wyf
2025-04-30 08:07:13 +00:00
parent 8889e7ab62
commit e86ec9e1e8
2 changed files with 29 additions and 8 deletions
+1 -2
View File
@@ -195,9 +195,8 @@ namespace Lskj.PubBomImport
} }
return saveResult; return saveResult;
} }
public bool BillSaveSql(ref string guid, int comfirm = 0, bool canTipMsg = true) public bool BillSaveSql(string guid, int comfirm = 0, bool canTipMsg = true)
{ {
guid = Guid.NewGuid() + "";
bool saveResult = false; bool saveResult = false;
if (ControlObj.VerifyNull()) if (ControlObj.VerifyNull())
{ {
+28 -6
View File
@@ -893,7 +893,7 @@ namespace Lskj.PubBomImport
string productId = mxRow["BomMxMainProduct"] + ""; string productId = mxRow["BomMxMainProduct"] + "";
if (string.IsNullOrEmpty(productId)) if (string.IsNullOrEmpty(productId))
{ {
throw new Exception($"未选择物料编码"); throw new Exception($"保存失败\r\n请重新进行BOM上传后保存");
} }
FileInfo mxInfo = new FileInfo(mxDirPath); FileInfo mxInfo = new FileInfo(mxDirPath);
if (mxInfo != null) if (mxInfo != null)
@@ -1025,13 +1025,12 @@ namespace Lskj.PubBomImport
} }
SetProcessBar(40, 0); SetProcessBar(40, 0);
string billMasterSql = $"select (select top 1 billdocument_id from bom_BillTab where productid='{productId}') as billdocument_id,'0' affirmer,'0' rtagid,'{productId}' as productid"; string billMasterSql = $"select (select top 1 billdocument_id from bom_BillTab where productid='{productId}') as billdocument_id,'0' affirmer,'0' rtagid,'{productId}' as productid";
billMasterSql = ReplaceHelper.ReplaceRowParam(Model.MaintabFocusedRow, billMasterSql);
// 处理单据表头数据 // 处理单据表头数据
DataRow masterRow = BillImpl.GetDataRowResult(billMasterSql); DataRow masterRow = BillImpl.GetDataRowResult(billMasterSql);
SetProcessBar(60, 0); SetProcessBar(60, 0);
frmBillInfo.AddOrUpdateBill(masterRow, childTable); frmBillInfo.AddOrUpdateBill(masterRow, childTable);
string guid = ""; string guid = Guid.NewGuid() + "";
frmBillInfo.BillSaveSql(ref guid); frmBillInfo.BillSaveSql(guid);
SetProcessBar(80, 0); SetProcessBar(80, 0);
//确认不反写子集 //确认不反写子集
//string billdocumentId = Model.MaintabFocusedRow["单据编号"] + ""; //string billdocumentId = Model.MaintabFocusedRow["单据编号"] + "";
@@ -1041,6 +1040,10 @@ namespace Lskj.PubBomImport
//SqlHelper.ExecuteNonQuery(string.Format(updateParentVerSql, idValue, billdocumentId)); //SqlHelper.ExecuteNonQuery(string.Format(updateParentVerSql, idValue, billdocumentId));
//上传文件 //上传文件
isUpload = UploadFileToAudit(mxInfo.FullName, productId, "010107", out msg, out string fileId); isUpload = UploadFileToAudit(mxInfo.FullName, productId, "010107", out msg, out string fileId);
if (!isUpload)
{
throw new Exception($"{mxInfo.Name}附件上传失败\r\n{msg}");
}
StaticControl.RightMenuGridView.GridControl.Invoke(new Action(() => StaticControl.RightMenuGridView.GridControl.Invoke(new Action(() =>
{ {
if (mxRow.Table.Columns.Contains("qms_laddf_FileId")) if (mxRow.Table.Columns.Contains("qms_laddf_FileId"))
@@ -1124,8 +1127,8 @@ namespace Lskj.PubBomImport
DataRow childMasterRow = BillImpl.GetDataRowResult(childBillMasterSql); DataRow childMasterRow = BillImpl.GetDataRowResult(childBillMasterSql);
SetProcessBar(60, allCount); SetProcessBar(60, allCount);
frmBillInfo.AddOrUpdateBill(childMasterRow, detailTable); frmBillInfo.AddOrUpdateBill(childMasterRow, detailTable);
string childGuid = ""; string childGuid = Guid.NewGuid() + "";
frmBillInfo.BillSaveSql(ref childGuid); frmBillInfo.BillSaveSql(childGuid);
SetProcessBar(80, allCount); SetProcessBar(80, allCount);
//记录历史版本号 //记录历史版本号
//string updateHistoryVerSql = @"update bom_BillListTab set historyVer = '{0}' where Billdocument_Id='{1}'"; //string updateHistoryVerSql = @"update bom_BillListTab set historyVer = '{0}' where Billdocument_Id='{1}'";
@@ -1139,6 +1142,10 @@ namespace Lskj.PubBomImport
//SqlHelper.ExecuteNonQuery(string.Format(updateChildVerSql, code, productId)); //SqlHelper.ExecuteNonQuery(string.Format(updateChildVerSql, code, productId));
SetProcessBar(80, allCount); SetProcessBar(80, allCount);
isUpload = UploadFileToAudit(childInfo.FullName, code, "010107", out msg, out string childFieldId); isUpload = UploadFileToAudit(childInfo.FullName, code, "010107", out msg, out string childFieldId);
if (!isUpload)
{
throw new Exception($"{childInfo.Name}附件上传失败\r\n{msg}");
}
StaticControl.RightMenuGridView.GridControl.Invoke(new Action(() => StaticControl.RightMenuGridView.GridControl.Invoke(new Action(() =>
{ {
if (childInfoRow.Table.Columns.Contains("qms_laddf_FileId")) if (childInfoRow.Table.Columns.Contains("qms_laddf_FileId"))
@@ -1164,6 +1171,10 @@ namespace Lskj.PubBomImport
{ {
SetProcessBar(0, allCount); SetProcessBar(0, allCount);
isUpload = UploadFileToAudit(childInfo.FullName, code, "010107", out msg, out string existFieldId); isUpload = UploadFileToAudit(childInfo.FullName, code, "010107", out msg, out string existFieldId);
if (!isUpload)
{
throw new Exception($"{childInfo.Name}附件上传失败\r\n{msg}");
}
StaticControl.RightMenuGridView.GridControl.Invoke(new Action(() => StaticControl.RightMenuGridView.GridControl.Invoke(new Action(() =>
{ {
if (childInfoRow.Table.Columns.Contains("qms_laddf_FileId")) if (childInfoRow.Table.Columns.Contains("qms_laddf_FileId"))
@@ -1197,6 +1208,10 @@ namespace Lskj.PubBomImport
if (childInfo != null) if (childInfo != null)
{ {
isUpload = UploadFileToAudit(childInfo.FullName, productId, "010107", out msg, out string otherFieldId); isUpload = UploadFileToAudit(childInfo.FullName, productId, "010107", out msg, out string otherFieldId);
if (!isUpload)
{
throw new Exception($"{childInfo.Name}附件上传失败\r\n{msg}");
}
StaticControl.RightMenuGridView.GridControl.Invoke(new Action(() => StaticControl.RightMenuGridView.GridControl.Invoke(new Action(() =>
{ {
if (childInfoRow.Table.Columns.Contains("qms_laddf_FileId")) if (childInfoRow.Table.Columns.Contains("qms_laddf_FileId"))
@@ -1739,6 +1754,13 @@ namespace Lskj.PubBomImport
string fileStream = Convert.ToBase64String(fileBytes); string fileStream = Convert.ToBase64String(fileBytes);
string userId = ERPInfo.Instance.UserId; string userId = ERPInfo.Instance.UserId;
DateTime uploadTime = DateTime.Now; DateTime uploadTime = DateTime.Now;
string code = "";
string namepattern = @"^(.+?)\s+(.+)$";
Match namematch = Regex.Match(Path.GetFileNameWithoutExtension(fileInfo.Name).Trim(), namepattern);
if (namematch.Success)
{
code = namematch.Groups[1].Value;
}
//上传文件到服务器目录 //上传文件到服务器目录
postUrl = "{0}Api/FileUploadApi.ashx?moduleId={1}&idValue={2}&speciesno={8}&folder={3}&totsize={4}&position={5}&filename={6}&method={7}"; postUrl = "{0}Api/FileUploadApi.ashx?moduleId={1}&idValue={2}&speciesno={8}&folder={3}&totsize={4}&position={5}&filename={6}&method={7}";
if (!string.IsNullOrEmpty(idValue)) if (!string.IsNullOrEmpty(idValue))