SVN r710
SVN-Revision: r710
This commit is contained in:
@@ -81,6 +81,14 @@ namespace Lskj.PubBomImport
|
||||
{
|
||||
throw new Exception($"{sourceCode}的附件已存在\r\n请进行变更");
|
||||
}
|
||||
if (!sourceBB.Equals("SA"))
|
||||
{
|
||||
throw new Exception($"{fileInfo.Name}\r\n版本不为SA不允许新增,请进行修改");
|
||||
}
|
||||
if (sourceBC > 0)
|
||||
{
|
||||
throw new Exception($"{fileInfo.Name}\r\n不为0的版次不允许新增,请进行修改");
|
||||
}
|
||||
if (sourceCode.StartsWith("QD"))
|
||||
{
|
||||
int createCode = ProductSaveUnique(sourceCode.Replace("'", "''"), sourceName.Replace("'", "''"), "", "1000202_1", out string pid, out string msg);
|
||||
@@ -1150,16 +1158,6 @@ namespace Lskj.PubBomImport
|
||||
string primaryValue = StaticControl.RightMenuMyControl.PrimaryValue;
|
||||
try
|
||||
{
|
||||
string productCode = "";
|
||||
ControlModel controlModel = StaticControl.RightMenuMyControl.ControlModels.Where(n => n.LabelText.Equals("物料编码")).FirstOrDefault();
|
||||
if (controlModel != null)
|
||||
{
|
||||
productCode = StaticControl.RightMenuMyControl.GetControlValue(controlModel);
|
||||
}
|
||||
if (string.IsNullOrEmpty(productCode))
|
||||
{
|
||||
throw new Exception($"物料编码不能为空");
|
||||
}
|
||||
string beforeName = "";
|
||||
ControlModel beforeNameModel = StaticControl.RightMenuMyControl.ControlModels.Where(n => n.LabelText.Equals("原文件名")).FirstOrDefault();
|
||||
if (beforeNameModel != null)
|
||||
@@ -1309,7 +1307,6 @@ namespace Lskj.PubBomImport
|
||||
//如果是ZZQD文件
|
||||
else if (parentInfo != null && (parentInfo.Name.Trim().StartsWith("ZZQD")))
|
||||
{
|
||||
productCode = topProductId;
|
||||
GetFileCodeInfo(Path.GetFileNameWithoutExtension(parentInfo.Name).Trim(), out string sourceCode, out string sourceName, out string sourceBB, out int sourceBC);
|
||||
DataTable filetable = BaseImpl.GetDataTableResult($"select sname,fileId,webpath from p_fm_filetab where parentid in (select dirid from P_fm_DirectoryTab where pid = '{sourceCode}' and dllcoid = '1000202') and speciesno = '010106' and sname like '{sourceCode}%'");
|
||||
int childMaxBc = -1;
|
||||
@@ -1368,12 +1365,12 @@ namespace Lskj.PubBomImport
|
||||
detailRow["bombc"] = sourceBC;
|
||||
}
|
||||
SetProcessBar(20, allCount);
|
||||
string billMasterSql = $"select (select top 1 billdocument_id from bom_BillTab where productid = '{productCode}') as billdocument_id,'0' affirmer,'0' rtagid,'{productCode}' as productid";
|
||||
string billMasterSql = $"select (select top 1 billdocument_id from bom_BillTab where productid = '{topProductId}') as billdocument_id,'0' affirmer,'0' rtagid,'{topProductId}' as productid";
|
||||
// 处理单据表头数据
|
||||
DataRow masterRow = BillImpl.GetDataRowResult(billMasterSql);
|
||||
if (masterRow == null)
|
||||
{
|
||||
throw new Exception($"BOM建立单{productCode}不存在");
|
||||
throw new Exception($"BOM建立单{topProductId}不存在");
|
||||
}
|
||||
SetProcessBar(40, allCount);
|
||||
frmBillInfo.AddOrUpdateBillByZZQD(masterRow, detailTable);
|
||||
@@ -1405,7 +1402,6 @@ namespace Lskj.PubBomImport
|
||||
//如果是MX文件
|
||||
else if (parentInfo != null && (parentInfo.Name.Trim().StartsWith("MX")))
|
||||
{
|
||||
productCode = topProductId;
|
||||
GetFileCodeInfo(Path.GetFileNameWithoutExtension(parentInfo.Name).Trim(), out string sourceCode, out string sourceName, out string sourceBB, out int sourceBC);
|
||||
DataTable filetable = BaseImpl.GetDataTableResult($"select sname,fileId,webpath from p_fm_filetab where parentid in (select dirid from P_fm_DirectoryTab where pid = '{topProductId}' and dllcoid = '1000202') and speciesno = '010106' and sname like '{sourceCode}%'");
|
||||
int childMaxBc = -1;
|
||||
@@ -1593,12 +1589,12 @@ namespace Lskj.PubBomImport
|
||||
{
|
||||
throw new Exception($"MX明细数据为空");
|
||||
}
|
||||
string billMasterSql = $"select (select top 1 billdocument_id from bom_BillTab where productid='{productCode}') as billdocument_id,'0' affirmer,'0' rtagid,'{productCode}' as productid,'{sourceCode}' as bak,'{sourceBB}' as bombb,'{sourceBC}' as bombc";
|
||||
string billMasterSql = $"select (select top 1 billdocument_id from bom_BillTab where productid='{topProductId}') as billdocument_id,'0' affirmer,'0' rtagid,'{topProductId}' as productid,'{sourceCode}' as bak,'{sourceBB}' as bombb,'{sourceBC}' as bombc";
|
||||
// 处理单据表头数据
|
||||
DataRow masterRow = BillImpl.GetDataRowResult(billMasterSql);
|
||||
if (masterRow == null)
|
||||
{
|
||||
throw new Exception($"BOM建立单{productCode}不存在");
|
||||
throw new Exception($"BOM建立单{topProductId}不存在");
|
||||
}
|
||||
SetProcessBar(40, allCount);
|
||||
frmBillInfo.AddOrUpdateBill(masterRow, childTable);
|
||||
@@ -1768,53 +1764,20 @@ namespace Lskj.PubBomImport
|
||||
}
|
||||
if (mxInfo != null || mxfiletable.Rows.Count > 0)
|
||||
{
|
||||
if (mxfiletable.Rows.Count > 1)
|
||||
{
|
||||
throw new Exception($"{mxsourceCode}存在多个版次,请进行MX修改");
|
||||
}
|
||||
if (mxfiletable.Rows.Count > 0)
|
||||
{
|
||||
using (WebClient webClient = new WebClient())
|
||||
{
|
||||
try
|
||||
{
|
||||
string webpath = mxfiletable.Rows[0]["webpath"] + "";
|
||||
string sName = mxfiletable.Rows[0]["sName"] + "";
|
||||
webpath = webpath.StartsWith("/") ? webpath : $"/{webpath}";
|
||||
string url = $"{SystemInfo.Instance.OAUrl}/{webpath}";
|
||||
string tempFileName = $"BomImportTemp/{sName}";
|
||||
if (!File.Exists(tempFileName))
|
||||
{
|
||||
webClient.DownloadFile(url, tempFileName);
|
||||
}
|
||||
mxInfo = new FileInfo(tempFileName);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new Exception($"Bom明细附件{mxsourceCode}获取失败\r\nBom导入失败");
|
||||
}
|
||||
}
|
||||
throw new Exception($"{mxsourceCode}已存在附件,请进行MX修改");
|
||||
}
|
||||
if (!mxsourceBB.Equals("SA"))
|
||||
{
|
||||
throw new Exception($"{mxInfo.Name}\r\n版本不为SA不允许新增,请进行修改");
|
||||
}
|
||||
if (mxsourceBC > 0)
|
||||
{
|
||||
throw new Exception($"{mxInfo.Name}\r\n不为0的版次不允许新增,请进行修改");
|
||||
}
|
||||
if (mxInfo != null)
|
||||
{
|
||||
int mxMaxBc = 0;
|
||||
string mxMaxBcFileId = "-1";
|
||||
foreach (DataRow mxfileRow in mxfiletable.Rows)
|
||||
{
|
||||
string fileName = mxfileRow["sname"] + "";
|
||||
string fileId = mxfileRow["fileId"] + "";
|
||||
GetFileCodeInfo(fileName, out string fileCode, out string name, out string fileBB, out int fileBC);
|
||||
if (fileBC >= mxMaxBc)
|
||||
{
|
||||
mxMaxBc = fileBC;
|
||||
mxMaxBcFileId = fileId;
|
||||
}
|
||||
}
|
||||
if (mxsourceBC > mxMaxBc && mxfiletable.Rows.Count > 0)
|
||||
{
|
||||
throw new Exception($"{mxsourceCode}的版次为{mxsourceBC},大于最大版次{mxMaxBc}\r\n请进行变更");
|
||||
}
|
||||
mxsourceBC = mxsourceBC >= mxMaxBc ? mxsourceBC : mxMaxBc;
|
||||
FrmBillInfo frmBillInfo = new FrmBillInfo();
|
||||
DataTable parentTable = ExcelToDatatable(mxInfo.FullName, Model, "", 5);
|
||||
parentTable = parentTable.Rows.Cast<DataRow>().Where(n => int.TryParse(n["序号"] + "", out _) && !string.IsNullOrEmpty(n["图号"] + "") && !string.IsNullOrEmpty(n["名称"] + "")).ToList().CopyToDataTable();
|
||||
@@ -1925,6 +1888,14 @@ namespace Lskj.PubBomImport
|
||||
{
|
||||
throw new Exception($"{childsourceCode}的版次为{childsourceBC},大于最大版次{childMaxBc}\r\n请进行变更");
|
||||
}
|
||||
if (filetable.Rows.Count == 0 && !childsourceBB.Equals("SA"))
|
||||
{
|
||||
throw new Exception($"{childInfo.Name}\r\n版本不为SA不允许新增,请进行修改");
|
||||
}
|
||||
if (filetable.Rows.Count == 0 && childsourceBC > 0)
|
||||
{
|
||||
throw new Exception($"{childsourceCode}的版次为{childsourceBC},不允许新增版次大于0的附件");
|
||||
}
|
||||
childsourceBC = childsourceBC >= childMaxBc ? childsourceBC : childMaxBc;
|
||||
if (code.StartsWith("QD") || code.StartsWith("ZZQD"))
|
||||
{
|
||||
@@ -2005,7 +1976,7 @@ namespace Lskj.PubBomImport
|
||||
BaseImpl.ExecSqlValue($"update p_bomImportExecTab set afterSql = '{insertbulider.ToString().Replace("'", "''")}' where guid = '{guid}'");
|
||||
SetProcessBar(80, 0);
|
||||
//上传文件
|
||||
string uploadMxFileId = mxMaxBcFileId;
|
||||
string uploadMxFileId = "";
|
||||
if (mxfiletable.Rows.Count == 0)
|
||||
{
|
||||
isUpload = UploadFileToAudit(mxInfo.FullName, productId, "010106", out msg, out uploadMxFileId);
|
||||
@@ -2601,53 +2572,20 @@ namespace Lskj.PubBomImport
|
||||
}
|
||||
if (mxInfo != null || mxfiletable.Rows.Count > 0)
|
||||
{
|
||||
if (mxfiletable.Rows.Count > 1)
|
||||
{
|
||||
throw new Exception($"{mxsourceCode}存在多个版次,请进行MX修改");
|
||||
}
|
||||
if (mxfiletable.Rows.Count > 0)
|
||||
{
|
||||
using (WebClient webClient = new WebClient())
|
||||
{
|
||||
try
|
||||
{
|
||||
string webpath = mxfiletable.Rows[0]["webpath"] + "";
|
||||
string sName = mxfiletable.Rows[0]["sName"] + "";
|
||||
webpath = webpath.StartsWith("/") ? webpath : $"/{webpath}";
|
||||
string url = $"{SystemInfo.Instance.OAUrl}/{webpath}";
|
||||
string tempFileName = $"BomImportTemp/{sName}";
|
||||
if (!File.Exists(tempFileName))
|
||||
{
|
||||
webClient.DownloadFile(url, tempFileName);
|
||||
}
|
||||
mxInfo = new FileInfo(tempFileName);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw new Exception($"Bom明细附件{mxsourceCode}获取失败\r\nBom导入失败");
|
||||
}
|
||||
}
|
||||
throw new Exception($"{mxsourceCode}已存在,请进行MX修改");
|
||||
}
|
||||
if (!mxsourceBB.Equals("SA"))
|
||||
{
|
||||
throw new Exception($"{mxInfo.Name}\r\n版本不为SA不允许新增,请进行修改");
|
||||
}
|
||||
if (mxsourceBC > 0)
|
||||
{
|
||||
throw new Exception($"{mxInfo.Name}\r\n不为0的版次不允许新增,请进行修改");
|
||||
}
|
||||
if (mxInfo != null)
|
||||
{
|
||||
int mxMaxBc = 0;
|
||||
string mxMaxBcFileId = "-1";
|
||||
foreach (DataRow mxfileRow in mxfiletable.Rows)
|
||||
{
|
||||
string fileName = mxfileRow["sname"] + "";
|
||||
string fileId = mxfileRow["fileId"] + "";
|
||||
GetFileCodeInfo(fileName, out string fileCode, out string name, out string fileBB, out int fileBC);
|
||||
if (fileBC >= mxMaxBc)
|
||||
{
|
||||
mxMaxBc = fileBC;
|
||||
mxMaxBcFileId = fileId;
|
||||
}
|
||||
}
|
||||
if (mxsourceBC > mxMaxBc && mxfiletable.Rows.Count > 0)
|
||||
{
|
||||
throw new Exception($"{mxsourceCode}的版次为{mxsourceBC},大于最大版次{mxMaxBc}\r\n请进行变更");
|
||||
}
|
||||
mxsourceBC = mxsourceBC >= mxMaxBc ? mxsourceBC : mxMaxBc;
|
||||
FrmBillInfo frmBillInfo = new FrmBillInfo();
|
||||
DataTable parentTable = ExcelToDatatable(mxInfo.FullName, Model, "", 5);
|
||||
parentTable = parentTable.Rows.Cast<DataRow>().Where(n => int.TryParse(n["序号"] + "", out _) && !string.IsNullOrEmpty(n["图号"] + "") && !string.IsNullOrEmpty(n["名称"] + "")).ToList().CopyToDataTable();
|
||||
@@ -2758,6 +2696,14 @@ namespace Lskj.PubBomImport
|
||||
{
|
||||
throw new Exception($"{childsourceCode}的版次为{childsourceBC},大于最大版次{childMaxBc}\r\n请进行变更");
|
||||
}
|
||||
if (filetable.Rows.Count == 0 && !childsourceBB.Equals("SA"))
|
||||
{
|
||||
throw new Exception($"{childInfo.Name}\r\n版本不为SA不允许新增,请进行修改");
|
||||
}
|
||||
if (filetable.Rows.Count == 0 && childsourceBC > 0)
|
||||
{
|
||||
throw new Exception($"{childsourceCode}的版次为{childsourceBC},不允许新增版次大于0的附件");
|
||||
}
|
||||
childsourceBC = childsourceBC >= childMaxBc ? childsourceBC : childMaxBc;
|
||||
if (code.StartsWith("ZZQD"))
|
||||
{
|
||||
@@ -2804,10 +2750,7 @@ namespace Lskj.PubBomImport
|
||||
}
|
||||
else
|
||||
{
|
||||
if (filetable.Rows.Count == 0)
|
||||
{
|
||||
throw new Exception($"{code}的附件不存在,请检查文件");
|
||||
}
|
||||
throw new Exception($"{code}的附件不存在,请检查文件");
|
||||
}
|
||||
}
|
||||
SetProcessBar(20, 0);
|
||||
@@ -2827,7 +2770,7 @@ namespace Lskj.PubBomImport
|
||||
BaseImpl.ExecSqlValue($"update p_bomImportExecTab set userid = '1' where guid = '{guid}'");
|
||||
SetProcessBar(80, 0);
|
||||
//上传文件
|
||||
string uploadMxFileId = mxMaxBcFileId;
|
||||
string uploadMxFileId = "";
|
||||
if (mxfiletable.Rows.Count == 0)
|
||||
{
|
||||
isUpload = UploadFileToAudit(mxInfo.FullName, productId, "010106", out msg, out uploadMxFileId);
|
||||
|
||||
Reference in New Issue
Block a user