feat(hjgl):预制组件材料信息导入修改,导入模板增加炉号批号。
This commit is contained in:
Binary file not shown.
@@ -17034,7 +17034,7 @@
|
|||||||
</COMReference>
|
</COMReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v15.0\WebApplications\Microsoft.WebApplication.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v18.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||||
<ProjectExtensions>
|
<ProjectExtensions>
|
||||||
<VisualStudio>
|
<VisualStudio>
|
||||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||||
|
|||||||
@@ -133,207 +133,12 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region 将Dataset的数据导入数据库
|
#region 将Dataset的数据导入数据库
|
||||||
/// <summary>
|
|
||||||
/// 将Dataset的数据导入数据库
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="pds">数据集</param>
|
|
||||||
/// <param name="Cols">数据集行数</param>
|
|
||||||
/// <returns></returns>
|
|
||||||
private Model.ResponeData AddDatasetToSQL(DataTable pds, int Cols)
|
|
||||||
{
|
|
||||||
Model.ResponeData responeData = new Model.ResponeData();
|
|
||||||
List<string> result = new List<string>();
|
|
||||||
|
|
||||||
int ic, ir;
|
|
||||||
ic = pds.Columns.Count;
|
|
||||||
ir = pds.Rows.Count;
|
|
||||||
if (ic < Cols)
|
|
||||||
{
|
|
||||||
responeData.code = 0;
|
|
||||||
responeData.message = "导入Excel格式错误!Excel只有" + ic.ToString().Trim() + "列";
|
|
||||||
return responeData;
|
|
||||||
}
|
|
||||||
// DataRow[] dv = pds.Select("主项编号 <>'' and 管线号 <>'' and 材料编码 <>'' and 数量 <>''and 管线划分<>'' ");
|
|
||||||
DataRow[] dv = pds.Select(" 管线号 <>'' and 材料编码 <>'' and 数量 <>'' ");
|
|
||||||
|
|
||||||
//导入数据库
|
|
||||||
if (dv.Length > 0)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < dv.Length; i++)
|
|
||||||
{
|
|
||||||
HJGL_PipeLineMat item = new HJGL_PipeLineMat();
|
|
||||||
|
|
||||||
#region 数据验证和赋值
|
|
||||||
|
|
||||||
|
|
||||||
string unitworkId = string.Empty;
|
|
||||||
unitworkId = Request.Params["UnitWorkId"];
|
|
||||||
string PipeArea = string.Empty;//管线划分 1工厂预制 2现场施工
|
|
||||||
|
|
||||||
if (dv[i]["管线号"] != null && !string.IsNullOrEmpty(dv[i]["管线号"].ToString()))
|
|
||||||
{
|
|
||||||
var pipeline = from x in Funs.DB.HJGL_Pipeline where x.ProjectId == this.CurrUser.LoginProjectId && x.UnitWorkId == unitworkId && x.PipelineCode == dv[i]["管线号"].ToString().Trim() select x;
|
|
||||||
if (pipeline.Count() > 0)
|
|
||||||
{
|
|
||||||
item.PipelineId = pipeline.First().PipelineId;
|
|
||||||
PipeArea = pipeline.First().PipeArea;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// errorInfos += (i + 2) + "Line,"+ dv[i]["管线号"].ToString() + " [管线号] 不存在</br>";
|
|
||||||
result.Add("不存在此管线号-" + dv[i]["管线号"].ToString());
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//errorInfos += (i + 2) + "Line, [管线号] 不能为空</br>";
|
|
||||||
result.Add((i + 2) + "Line, [管线号] 不能为空</br>");
|
|
||||||
}
|
|
||||||
//if (dv[i]["管线划分"] != null && !string.IsNullOrEmpty(dv[i]["管线划分"].ToString()))
|
|
||||||
//{
|
|
||||||
// string txtPipeArea = "";
|
|
||||||
// switch (PipeArea)
|
|
||||||
// {
|
|
||||||
// case "1":
|
|
||||||
// txtPipeArea = "工厂预制";
|
|
||||||
// break;
|
|
||||||
// case "2":
|
|
||||||
// txtPipeArea = "现场施工";
|
|
||||||
// break;
|
|
||||||
// default:
|
|
||||||
// txtPipeArea = "无";
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// if (!Equals(txtPipeArea, dv[i]["管线划分"].ToString().Trim()))
|
|
||||||
// {
|
|
||||||
// errorInfos += (i + 2) + "Line, [管线划分] 不匹配</br>";
|
|
||||||
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// errorInfos += (i + 2) + "Line, [管线划分] 不能为空</br>";
|
|
||||||
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
if (dv[i]["材料编码"] != null && !string.IsNullOrEmpty(dv[i]["材料编码"].ToString()))
|
|
||||||
{
|
|
||||||
var lib = from x in Funs.DB.HJGL_MaterialCodeLib where x.MaterialCode == dv[i]["材料编码"].ToString() select x;
|
|
||||||
if (lib.Count() > 0)
|
|
||||||
{
|
|
||||||
item.MaterialCode = dv[i]["材料编码"].ToString();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//errorInfos += (i + 2) + "Line," + dv[i]["材料编码"].ToString() + " [材料编码] 不存在</br>";
|
|
||||||
result.Add("不存在此材料编码-" + dv[i]["材料编码"].ToString());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//errorInfos += (i + 2) + "Line, [材料编码] 不能为空</br>";
|
|
||||||
result.Add((i + 2) + "Line, [材料编码] 不能为空</br>");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dv[i]["数量"] != null && !string.IsNullOrEmpty(dv[i]["数量"].ToString()))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var number = Funs.GetNewDecimal(dv[i]["数量"].ToString());
|
|
||||||
item.Number = number;
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
//errorInfos += "第" + (i + 2).ToString() + "行," + "数量格式输入有误</br>";
|
|
||||||
result.Add("第" + (i + 2).ToString() + "行," + "数量格式输入有误</br>");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//errorInfos += (i + 2) + "Line, [数量] 不能为空</br>";
|
|
||||||
result.Add((i + 2) + "Line, [数量] 不能为空</br>");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PipeArea == "1")
|
|
||||||
{
|
|
||||||
if (dv[i]["预制组件"] != null && !string.IsNullOrEmpty(dv[i]["预制组件"].ToString()))
|
|
||||||
{
|
|
||||||
item.PrefabricatedComponents = dv[i]["预制组件"].ToString();
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
result.Add((i + 2) + "Line, [预制组件] 不能为空</br>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var model = matList.Where(x => x.PipelineId == item.PipelineId && x.MaterialCode == item.MaterialCode && x.PrefabricatedComponents == item.PrefabricatedComponents);
|
|
||||||
if (model.Count() == 0)
|
|
||||||
{
|
|
||||||
matList.Add(item);
|
|
||||||
|
|
||||||
}
|
|
||||||
//if (PipeArea == "1")//工厂预制
|
|
||||||
//{
|
|
||||||
|
|
||||||
// var model= matList.Where(x => x.PrefabricatedComponents == item.PrefabricatedComponents && x.MaterialCode == item.MaterialCode);
|
|
||||||
// if (model.Count()==0)
|
|
||||||
// {
|
|
||||||
// matList.Add(item);
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
//} else if (PipeArea == "2")//现场施工
|
|
||||||
//{
|
|
||||||
// var model = matList.Where(x => x.PipelineId == item.PipelineId && x.MaterialCode == item.MaterialCode);
|
|
||||||
// if (model.Count() == 0)
|
|
||||||
// {
|
|
||||||
// matList.Add(item);
|
|
||||||
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//item.PipeLineMatId= SQLHelper.GetNewID(typeof(Model.HJGL_PipeLineMat));
|
|
||||||
//if (!matList.Select(x => x.MaterialCode).Contains(item.MaterialCode))
|
|
||||||
//{
|
|
||||||
// matList.Add(item);
|
|
||||||
//}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
responeData.code = 0;
|
|
||||||
responeData.message = "没有数据";
|
|
||||||
|
|
||||||
}
|
|
||||||
if (result.Count > 0)
|
|
||||||
{
|
|
||||||
// result = result.Substring(0, result.LastIndexOf("|"));
|
|
||||||
errorInfos = string.Join("|", result.Distinct());
|
|
||||||
//Alert alert = new Alert();
|
|
||||||
//alert.Message = result;
|
|
||||||
//alert.Target = Target.Self;
|
|
||||||
//alert.Show();
|
|
||||||
responeData.code = 0;
|
|
||||||
responeData.message = errorInfos;
|
|
||||||
}
|
|
||||||
|
|
||||||
return responeData;
|
|
||||||
}
|
|
||||||
private Model.ResponeData AddDatasetToSQL(List<dynamic> pds, int count)
|
private Model.ResponeData AddDatasetToSQL(List<dynamic> pds, int count)
|
||||||
{
|
{
|
||||||
Model.ResponeData responeData = new Model.ResponeData();
|
Model.ResponeData responeData = new Model.ResponeData();
|
||||||
List<string> result = new List<string>();
|
List<string> result = new List<string>();
|
||||||
|
|
||||||
if (count < 4)
|
if (count < 6)
|
||||||
{
|
{
|
||||||
responeData.code = 0;
|
responeData.code = 0;
|
||||||
responeData.message = "导入Excel格式错误!Excel只有" + count.ToString().Trim() + "列";
|
responeData.message = "导入Excel格式错误!Excel只有" + count.ToString().Trim() + "列";
|
||||||
@@ -377,17 +182,31 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||||||
|
|
||||||
if (pds[i].C != null && !string.IsNullOrEmpty(pds[i].C.ToString()))
|
if (pds[i].C != null && !string.IsNullOrEmpty(pds[i].C.ToString()))
|
||||||
{
|
{
|
||||||
string materialCode = pds[i].C.ToString();
|
string materialCode = pds[i].C.ToString().Trim();
|
||||||
var lib = from x in Funs.DB.HJGL_MaterialCodeLib where x.MaterialCode == materialCode select x;
|
string furnaceNo = pds[i].D == null ? string.Empty : pds[i].D.ToString().Trim();
|
||||||
|
string batchNo = pds[i].E == null ? string.Empty : pds[i].E.ToString().Trim();
|
||||||
|
if (pds[i].D == null || string.IsNullOrEmpty(pds[i].D.ToString()))
|
||||||
|
{
|
||||||
|
result.Add((i + 2) + "Line, [炉号] 不能为空</br>");
|
||||||
|
}
|
||||||
|
if (pds[i].E == null || string.IsNullOrEmpty(pds[i].E.ToString()))
|
||||||
|
{
|
||||||
|
result.Add((i + 2) + "Line, [批号] 不能为空</br>");
|
||||||
|
}
|
||||||
|
if (!string.IsNullOrEmpty(materialCode) && !string.IsNullOrEmpty(furnaceNo) && !string.IsNullOrEmpty(batchNo))
|
||||||
|
{
|
||||||
|
string fullMaterialCode = materialCode + "-" + furnaceNo + "-" + batchNo;
|
||||||
|
var lib = from x in Funs.DB.HJGL_MaterialCodeLib where x.MaterialCode == fullMaterialCode select x;
|
||||||
if (lib.Count() > 0)
|
if (lib.Count() > 0)
|
||||||
{
|
{
|
||||||
item.MaterialCode = pds[i].C.ToString();
|
item.MaterialCode = fullMaterialCode;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
result.Add("不存在此材料编码-" + pds[i].C.ToString());
|
result.Add("不存在此材料:" + fullMaterialCode);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -395,11 +214,11 @@ namespace FineUIPro.Web.HJGL.WeldingManage
|
|||||||
result.Add((i + 2) + "Line, [材料编码] 不能为空</br>");
|
result.Add((i + 2) + "Line, [材料编码] 不能为空</br>");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pds[i].D != null && !string.IsNullOrEmpty(pds[i].D.ToString()))
|
if (pds[i].F != null && !string.IsNullOrEmpty(pds[i].F.ToString()))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var number = Funs.GetNewDecimal(pds[i].D.ToString());
|
var number = Funs.GetNewDecimal(pds[i].F.ToString());
|
||||||
item.Number = number;
|
item.Number = number;
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
|
|||||||
Reference in New Issue
Block a user