SVN r441
SVN-Revision: r441
This commit is contained in:
@@ -433,7 +433,7 @@ namespace Lskj.PubBomImport
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 开始导入
|
/// 开始导入3
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dirPaths"></param>
|
/// <param name="dirPaths"></param>
|
||||||
public void StartImportInQDFile(string dirPath)
|
public void StartImportInQDFile(string dirPath)
|
||||||
@@ -443,7 +443,7 @@ namespace Lskj.PubBomImport
|
|||||||
Model = frmMain.Model;
|
Model = frmMain.Model;
|
||||||
string pattern = @"([A-Za-z]+)(\d*)$";
|
string pattern = @"([A-Za-z]+)(\d*)$";
|
||||||
//原物料名称
|
//原物料名称
|
||||||
string productCode = Model.MaintabFocusedRow != null && Model.MaintabFocusedRow.Table.Columns.Contains("productid") ? Model.MaintabFocusedRow["productid"] + "" : "";
|
string productCode = Model.MaintabFocusedRow != null && Model.MaintabFocusedRow.Table.Columns.Contains("qms_laddf_productid") ? Model.MaintabFocusedRow["qms_laddf_productid"] + "" : "";
|
||||||
Match match = Regex.Match(productCode, pattern);
|
Match match = Regex.Match(productCode, pattern);
|
||||||
if (match.Success)
|
if (match.Success)
|
||||||
{
|
{
|
||||||
@@ -451,20 +451,28 @@ namespace Lskj.PubBomImport
|
|||||||
string sourceVersion = match.Groups[2].Value;
|
string sourceVersion = match.Groups[2].Value;
|
||||||
sourceVersion = string.IsNullOrEmpty(sourceVersion) ? "0" : sourceVersion;
|
sourceVersion = string.IsNullOrEmpty(sourceVersion) ? "0" : sourceVersion;
|
||||||
//修改后的文件名
|
//修改后的文件名
|
||||||
string newProductCode = Model.MaintabFocusedRow != null && Model.MaintabFocusedRow.Table.Columns.Contains("model_info") ? Model.MaintabFocusedRow["model_info"] + "" : "";
|
string newProductCode = Model.MaintabFocusedRow != null && Model.MaintabFocusedRow.Table.Columns.Contains("qms_laddf_appellationV123") ? Model.MaintabFocusedRow["qms_laddf_appellationV123"] + "" : "";
|
||||||
FileInfo parentInfo = new FileInfo(dirPath);
|
FileInfo parentInfo = new FileInfo(dirPath);
|
||||||
if (parentInfo != null && (parentInfo.Name.Trim().StartsWith("QD") || parentInfo.Name.Trim().StartsWith("ZZQD")))
|
if (parentInfo != null && (parentInfo.Name.Trim().StartsWith("QD") || parentInfo.Name.Trim().StartsWith("ZZQD")))
|
||||||
{
|
{
|
||||||
string code = "";
|
string code = "";
|
||||||
string name = "";
|
string name = "";
|
||||||
|
string newcode = newProductCode.Trim();
|
||||||
|
string newname = "";
|
||||||
string namepattern = @"^(.+?)\s+(.+)$";
|
string namepattern = @"^(.+?)\s+(.+)$";
|
||||||
|
Match newProductCodematch = Regex.Match(Path.GetFileNameWithoutExtension(newProductCode).Trim(), namepattern);
|
||||||
Match namematch = Regex.Match(Path.GetFileNameWithoutExtension(parentInfo.Name).Trim(), namepattern);
|
Match namematch = Regex.Match(Path.GetFileNameWithoutExtension(parentInfo.Name).Trim(), namepattern);
|
||||||
if (namematch.Success)
|
if (namematch.Success)
|
||||||
{
|
{
|
||||||
code = namematch.Groups[1].Value;
|
code = namematch.Groups[1].Value;
|
||||||
name = namematch.Groups[2].Value;
|
name = namematch.Groups[2].Value;
|
||||||
}
|
}
|
||||||
if (!newProductCode.Equals(code))//选择的文件和版本文件名不匹配
|
if (newProductCodematch.Success)
|
||||||
|
{
|
||||||
|
newcode = newProductCodematch.Groups[1].Value;
|
||||||
|
newname = newProductCodematch.Groups[2].Value;
|
||||||
|
}
|
||||||
|
if (!newcode.Equals(code))//选择的文件和版本文件名不匹配
|
||||||
{
|
{
|
||||||
throw new Exception($"修改的文件名{newProductCode}和选择的文件名{code}不匹配");
|
throw new Exception($"修改的文件名{newProductCode}和选择的文件名{code}不匹配");
|
||||||
}
|
}
|
||||||
@@ -485,6 +493,17 @@ namespace Lskj.PubBomImport
|
|||||||
{
|
{
|
||||||
if (sourceModel.Equals(newModel))
|
if (sourceModel.Equals(newModel))
|
||||||
{
|
{
|
||||||
|
//新建清单
|
||||||
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
|
if (code.StartsWith("QD") || code.StartsWith("ZZQD"))
|
||||||
|
{
|
||||||
|
stringBuilder.AppendLine($"if not exists (select productid from p_ProductTab where productid = '{code}')");
|
||||||
|
stringBuilder.AppendLine($"begin insert into p_ProductTab (productid,appellation,bak,SpeciesNo) values ('{code.Replace("'", "''")}','{name.Replace("'", "''")}','','0199') end;");
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(stringBuilder.ToString()))
|
||||||
|
{
|
||||||
|
SqlHelper.ExecuteNonQuery(stringBuilder.ToString());
|
||||||
|
}
|
||||||
//更新并备份清单
|
//更新并备份清单
|
||||||
FrmBillInfo frmBillInfo = new FrmBillInfo();
|
FrmBillInfo frmBillInfo = new FrmBillInfo();
|
||||||
frmBillInfo.OnControlSourceBind += (s, args) =>
|
frmBillInfo.OnControlSourceBind += (s, args) =>
|
||||||
@@ -1085,6 +1104,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 speciesno = " 010102";
|
||||||
|
// 检查扩展名是否为 .xlsx 或 .xls
|
||||||
|
if (suffix.Equals(".xlsx", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
suffix.Equals(".xls", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
speciesno = "010101";
|
||||||
|
}
|
||||||
//上传文件到服务器目录
|
//上传文件到服务器目录
|
||||||
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))
|
||||||
@@ -1113,7 +1139,7 @@ namespace Lskj.PubBomImport
|
|||||||
}
|
}
|
||||||
if (!string.IsNullOrEmpty(token))
|
if (!string.IsNullOrEmpty(token))
|
||||||
{
|
{
|
||||||
postUrl = string.Format(postUrl, SystemInfo.Instance.OAUrl, Model.ModuleCode, idValue, "file", fileBytes.Length, 0, name, "DoWebUpload", "010105");
|
postUrl = string.Format(postUrl, SystemInfo.Instance.OAUrl, Model.ModuleCode, idValue, "file", fileBytes.Length, 0, name, "DoWebUpload", speciesno);
|
||||||
HttpTools.setting("application/x-www-form-urlencoded", null, null);
|
HttpTools.setting("application/x-www-form-urlencoded", null, null);
|
||||||
string result = "";
|
string result = "";
|
||||||
CookieCollection cookieCollection = null;
|
CookieCollection cookieCollection = null;
|
||||||
|
|||||||
Reference in New Issue
Block a user