diff --git a/插件库/Lskj.PubBomImport/FrmBillInfo.cs b/插件库/Lskj.PubBomImport/FrmBillInfo.cs index a91ae9e..518ff79 100644 --- a/插件库/Lskj.PubBomImport/FrmBillInfo.cs +++ b/插件库/Lskj.PubBomImport/FrmBillInfo.cs @@ -195,9 +195,8 @@ namespace Lskj.PubBomImport } 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; if (ControlObj.VerifyNull()) { diff --git a/插件库/Lskj.PubBomImport/FrmProgress.cs b/插件库/Lskj.PubBomImport/FrmProgress.cs index 3babee8..8ebe112 100644 --- a/插件库/Lskj.PubBomImport/FrmProgress.cs +++ b/插件库/Lskj.PubBomImport/FrmProgress.cs @@ -893,7 +893,7 @@ namespace Lskj.PubBomImport string productId = mxRow["BomMxMainProduct"] + ""; if (string.IsNullOrEmpty(productId)) { - throw new Exception($"未选择物料编码"); + throw new Exception($"保存失败\r\n请重新进行BOM上传后保存"); } FileInfo mxInfo = new FileInfo(mxDirPath); if (mxInfo != null) @@ -1025,13 +1025,12 @@ namespace Lskj.PubBomImport } 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"; - billMasterSql = ReplaceHelper.ReplaceRowParam(Model.MaintabFocusedRow, billMasterSql); // 处理单据表头数据 DataRow masterRow = BillImpl.GetDataRowResult(billMasterSql); SetProcessBar(60, 0); frmBillInfo.AddOrUpdateBill(masterRow, childTable); - string guid = ""; - frmBillInfo.BillSaveSql(ref guid); + string guid = Guid.NewGuid() + ""; + frmBillInfo.BillSaveSql(guid); SetProcessBar(80, 0); //确认不反写子集 //string billdocumentId = Model.MaintabFocusedRow["单据编号"] + ""; @@ -1041,6 +1040,10 @@ namespace Lskj.PubBomImport //SqlHelper.ExecuteNonQuery(string.Format(updateParentVerSql, idValue, billdocumentId)); //上传文件 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(() => { if (mxRow.Table.Columns.Contains("qms_laddf_FileId")) @@ -1124,8 +1127,8 @@ namespace Lskj.PubBomImport DataRow childMasterRow = BillImpl.GetDataRowResult(childBillMasterSql); SetProcessBar(60, allCount); frmBillInfo.AddOrUpdateBill(childMasterRow, detailTable); - string childGuid = ""; - frmBillInfo.BillSaveSql(ref childGuid); + string childGuid = Guid.NewGuid() + ""; + frmBillInfo.BillSaveSql(childGuid); SetProcessBar(80, allCount); //记录历史版本号 //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)); SetProcessBar(80, allCount); 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(() => { if (childInfoRow.Table.Columns.Contains("qms_laddf_FileId")) @@ -1164,6 +1171,10 @@ namespace Lskj.PubBomImport { SetProcessBar(0, allCount); 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(() => { if (childInfoRow.Table.Columns.Contains("qms_laddf_FileId")) @@ -1197,6 +1208,10 @@ namespace Lskj.PubBomImport if (childInfo != null) { 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(() => { if (childInfoRow.Table.Columns.Contains("qms_laddf_FileId")) @@ -1739,6 +1754,13 @@ namespace Lskj.PubBomImport string fileStream = Convert.ToBase64String(fileBytes); string userId = ERPInfo.Instance.UserId; 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}"; if (!string.IsNullOrEmpty(idValue))