SVN r516
SVN-Revision: r516
This commit is contained in:
@@ -5,6 +5,7 @@ using Lskj.Business;
|
||||
using Lskj.Business.Impl;
|
||||
using Lskj.Control;
|
||||
using Lskj.Control.Model;
|
||||
using Lskj.Core;
|
||||
using Lskj.Data;
|
||||
using Lskj.Model;
|
||||
using Lskj.Util;
|
||||
@@ -243,7 +244,7 @@ namespace Lskj.PubBomImport
|
||||
//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) " +
|
||||
SqlHelper.ExecuteNonQuery($"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)
|
||||
|
||||
@@ -1045,7 +1045,8 @@ namespace Lskj.PubBomImport
|
||||
{
|
||||
if (mxRow.Table.Columns.Contains("qms_laddf_FileId"))
|
||||
{
|
||||
mxRow["qms_laddf_FileId"] = fileId;
|
||||
int.TryParse(fileId, out int qms_laddf_FileId);
|
||||
mxRow["qms_laddf_FileId"] = qms_laddf_FileId;
|
||||
}
|
||||
if (mxRow.Table.Columns.Contains("qms_laddf_Exec"))
|
||||
{
|
||||
@@ -1065,7 +1066,8 @@ namespace Lskj.PubBomImport
|
||||
{
|
||||
if (mxRow.Table.Columns.Contains("qms_laddf_FileId"))
|
||||
{
|
||||
mxRow["qms_laddf_FileId"] = fileId;
|
||||
int.TryParse(fileId, out int qms_laddf_FileId);
|
||||
mxRow["qms_laddf_FileId"] = qms_laddf_FileId;
|
||||
}
|
||||
}));
|
||||
}
|
||||
@@ -1079,7 +1081,7 @@ namespace Lskj.PubBomImport
|
||||
int finishCount = (int)((decimal)(1 + nowCount) / (parentTable.Rows.Count + 1) * 100);
|
||||
int.TryParse(dataRow["套数"] + "", out int tamount);
|
||||
string code = (dataRow["图号"] + "").Trim();
|
||||
if (code.StartsWith("QD") || code.StartsWith("ZZQD"))
|
||||
if (code.StartsWith("QD"))
|
||||
{
|
||||
DataRow childInfoRow = selectRows.Where(n => (n[Model.AfterBomFieldName] + "").StartsWith(code)).FirstOrDefault();
|
||||
if (childInfoRow != null)
|
||||
@@ -1116,15 +1118,15 @@ namespace Lskj.PubBomImport
|
||||
{
|
||||
throw new Exception($"{code}明细数据为空");
|
||||
}
|
||||
SetProcessBar(40, 0);
|
||||
SetProcessBar(40, allCount);
|
||||
string childBillMasterSql = $"select (select top 1 billdocument_id from bom_BillTab where productid='{code}') as billdocument_id,'0' affirmer,'0' rtagid,'{code}' as productid";
|
||||
// 处理单据表头数据
|
||||
DataRow childMasterRow = BillImpl.GetDataRowResult(childBillMasterSql);
|
||||
SetProcessBar(60, 0);
|
||||
SetProcessBar(60, allCount);
|
||||
frmBillInfo.AddOrUpdateBill(childMasterRow, detailTable);
|
||||
string childGuid = "";
|
||||
frmBillInfo.BillSaveSql(ref childGuid);
|
||||
SetProcessBar(80, 0);
|
||||
SetProcessBar(80, allCount);
|
||||
//记录历史版本号
|
||||
//string updateHistoryVerSql = @"update bom_BillListTab set historyVer = '{0}' where Billdocument_Id='{1}'";
|
||||
//SqlHelper.ExecuteNonQuery(string.Format(updateHistoryVerSql, code, childBillNo));
|
||||
@@ -1141,7 +1143,8 @@ namespace Lskj.PubBomImport
|
||||
{
|
||||
if (childInfoRow.Table.Columns.Contains("qms_laddf_FileId"))
|
||||
{
|
||||
childInfoRow["qms_laddf_FileId"] = childFieldId;
|
||||
int.TryParse(childFieldId, out int qms_laddf_FileId);
|
||||
childInfoRow["qms_laddf_FileId"] = qms_laddf_FileId;
|
||||
}
|
||||
if (childInfoRow.Table.Columns.Contains("qms_laddf_Exec"))
|
||||
{
|
||||
@@ -1159,14 +1162,18 @@ namespace Lskj.PubBomImport
|
||||
}
|
||||
else
|
||||
{
|
||||
SetProcessBar(0, allCount);
|
||||
isUpload = UploadFileToAudit(childInfo.FullName, code, "010107", out msg, out string existFieldId);
|
||||
StaticControl.RightMenuGridView.GridControl.Invoke(new Action(() =>
|
||||
{
|
||||
if (childInfoRow.Table.Columns.Contains("qms_laddf_FileId"))
|
||||
{
|
||||
childInfoRow["qms_laddf_FileId"] = existFieldId;
|
||||
int.TryParse(existFieldId, out int qms_laddf_FileId);
|
||||
childInfoRow["qms_laddf_FileId"] = qms_laddf_FileId;
|
||||
}
|
||||
}));
|
||||
SetProcessBar(100, finishCount);
|
||||
SetProcessLabelAllMsg($"总进度:{nowCount + 1}/{parentTable.Rows.Count + 1}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1194,7 +1201,8 @@ namespace Lskj.PubBomImport
|
||||
{
|
||||
if (childInfoRow.Table.Columns.Contains("qms_laddf_FileId"))
|
||||
{
|
||||
childInfoRow["qms_laddf_FileId"] = otherFieldId;
|
||||
int.TryParse(otherFieldId, out int qms_laddf_FileId);
|
||||
childInfoRow["qms_laddf_FileId"] = qms_laddf_FileId;
|
||||
}
|
||||
}));
|
||||
SetProcessBar(100, finishCount);
|
||||
@@ -1638,8 +1646,8 @@ namespace Lskj.PubBomImport
|
||||
HttpTools.setting("application/x-www-form-urlencoded", null, null, HttpTools.Encode.UTF8);
|
||||
Dictionary<string, string> loginPmsDic = new Dictionary<string, string>();
|
||||
loginPmsDic.Add("method", "Login");
|
||||
loginPmsDic.Add("username", ERPInfo.Instance.UserName);
|
||||
loginPmsDic.Add("password", ERPInfo.Instance.InPassWord);
|
||||
loginPmsDic.Add("username", HttpUtility.UrlEncode(ERPInfo.Instance.UserName));
|
||||
loginPmsDic.Add("password", HttpUtility.UrlEncode(ERPInfo.Instance.InPassWord));
|
||||
HttpWebResponse loginResponse = HttpTools.Post(loginUrl, "", loginPmsDic, HttpTools.Method.POST, out CookieCollection loginCookie, out string loginResult);
|
||||
if (loginResponse != null && !string.IsNullOrEmpty(loginResult))
|
||||
{
|
||||
@@ -1657,7 +1665,7 @@ namespace Lskj.PubBomImport
|
||||
}
|
||||
if (!string.IsNullOrEmpty(token))
|
||||
{
|
||||
postUrl = string.Format(postUrl, SystemInfo.Instance.OAUrl, Model.ModuleCode, idValue, "file", fileBytes.Length, 0, name, "DoWebUpload", speciesno);
|
||||
postUrl = string.Format(postUrl, SystemInfo.Instance.OAUrl, Model.ModuleCode, HttpUtility.UrlEncode(idValue), "file", fileBytes.Length, 0, HttpUtility.UrlEncode(name), "DoWebUpload", speciesno);
|
||||
HttpTools.setting("application/x-www-form-urlencoded", null, null);
|
||||
string result = "";
|
||||
CookieCollection cookieCollection = null;
|
||||
@@ -1740,8 +1748,8 @@ namespace Lskj.PubBomImport
|
||||
HttpTools.setting("application/x-www-form-urlencoded", null, null, HttpTools.Encode.UTF8);
|
||||
Dictionary<string, string> loginPmsDic = new Dictionary<string, string>();
|
||||
loginPmsDic.Add("method", "Login");
|
||||
loginPmsDic.Add("username", ERPInfo.Instance.UserName);
|
||||
loginPmsDic.Add("password", ERPInfo.Instance.InPassWord);
|
||||
loginPmsDic.Add("username", HttpUtility.UrlEncode(ERPInfo.Instance.UserName));
|
||||
loginPmsDic.Add("password", HttpUtility.UrlEncode(ERPInfo.Instance.InPassWord));
|
||||
HttpWebResponse loginResponse = HttpTools.Post(loginUrl, "", loginPmsDic, HttpTools.Method.POST, out CookieCollection loginCookie, out string loginResult);
|
||||
if (loginResponse != null && !string.IsNullOrEmpty(loginResult))
|
||||
{
|
||||
@@ -1759,7 +1767,8 @@ namespace Lskj.PubBomImport
|
||||
}
|
||||
if (!string.IsNullOrEmpty(token))
|
||||
{
|
||||
postUrl = string.Format(postUrl, SystemInfo.Instance.OAUrl, Model.ModuleCode, idValue, "file", fileBytes.Length, 0, name, "DoWebUpload", speciesno);
|
||||
//DeleteFileExists(token, name, Model.ModuleCode, idValue, speciesno);
|
||||
postUrl = string.Format(postUrl, SystemInfo.Instance.OAUrl, Model.ModuleCode, HttpUtility.UrlEncode(idValue), "file", fileBytes.Length, 0, HttpUtility.UrlEncode(name), "DoWebUpload", speciesno);
|
||||
HttpTools.setting("application/x-www-form-urlencoded", null, null);
|
||||
string result = "";
|
||||
CookieCollection cookieCollection = null;
|
||||
@@ -1811,4 +1820,39 @@ namespace Lskj.PubBomImport
|
||||
throw new Exception($"文件{Path.GetFileName(filePath)}上传失败\r\n{ex.Message}");
|
||||
isUpload = false;
|
||||
}
|
||||
msg = returnM
|
||||
msg = returnMsg;
|
||||
outFileId = fileId;
|
||||
return isUpload;
|
||||
}
|
||||
/// <summary>
|
||||
/// 删除已经存在的附件
|
||||
/// </summary>
|
||||
private void DeleteFileExists(string token, string filename, string moduleid, string idValue, string speciesno)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrEmpty(token))
|
||||
{
|
||||
DataTable fileTable = BaseImpl.GetDataTableResult($"select * from P_fm_FileTab where parentid in (select dirid from P_fm_DirectoryTab where pid = '{idValue}' and dllcoid = '{moduleid}') and speciesno = '{speciesno}' and sname = '{filename.Replace(" ", "")}'");
|
||||
if (fileTable != null && fileTable.Rows.Count > 0)
|
||||
{
|
||||
foreach (DataRow deleteRow in fileTable.Rows)
|
||||
{
|
||||
string field = HttpUtility.UrlEncode(deleteRow["fileId"] + "");
|
||||
string webpath = HttpUtility.UrlEncode(deleteRow["webpath"] + "");
|
||||
//删除文件
|
||||
string postUrl = "{0}Api/FileUploadApi.ashx?fileId={1}&filename={2}&method={3}";
|
||||
postUrl = string.Format(postUrl, SystemInfo.Instance.OAUrl, field, webpath, "DoDelete");
|
||||
HttpTools.setting("application/x-www-form-urlencoded", null, null);
|
||||
string result = "";
|
||||
CookieCollection cookieCollection = null;
|
||||
HttpWebResponse webResponse = HttpTools.Post(postUrl, "", null, HttpTools.Method.POST, out cookieCollection, out result);
|
||||
if (webResponse != null && !string.IsNullOrEmpty(result))
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
Reference in New Issue
Block a user