feat:增加焊前管理,材料管理条码扫码接口,材料信息导入支持无炉批号/有炉批号 多种导入方式

This commit is contained in:
2026-06-17 14:22:06 +08:00
parent bd1033ee27
commit 2736e8ad89
49 changed files with 3307 additions and 89 deletions
@@ -117,8 +117,8 @@ namespace FineUIPro.Web.HJGL.WeldingManage
if (e.EventArgument == "Confirm_OK")
{
string rootPath = Server.MapPath("~/");
string uploadfilepath = rootPath + Const.PipelineMatTemplateUrl;
string filePath = Const.PipelineMatTemplateUrl;
string filePath = ckIncludeBatch.Checked ? Const.PipelineMatWithBatchTemplateUrl : Const.PipelineMatTemplateUrl;
string uploadfilepath = rootPath + filePath;
string fileName = Path.GetFileName(filePath);
FileInfo info = new FileInfo(uploadfilepath);
long fileSize = info.Length;
@@ -137,8 +137,11 @@ namespace FineUIPro.Web.HJGL.WeldingManage
{
Model.ResponeData responeData = new Model.ResponeData();
List<string> result = new List<string>();
bool includeBatch = ckIncludeBatch.Checked;
int minColumnCount = includeBatch ? 7 : 5;
if (count < 5)
matList.Clear();
if (count < minColumnCount)
{
responeData.code = 0;
responeData.message = "导入Excel格式错误!Excel只有" + count.ToString().Trim() + "列";
@@ -204,14 +207,38 @@ namespace FineUIPro.Web.HJGL.WeldingManage
if (pds[i].D != null && !string.IsNullOrEmpty(pds[i].D.ToString()))
{
string materialCode = pds[i].D.ToString().Trim();
var lib = from x in Funs.DB.HJGL_MaterialCodeLib where x.Code == materialCode select x;
if (lib.Count() > 0)
item.MaterialCode2 = materialCode;
if (includeBatch)
{
item.MaterialCode2 = materialCode;
string heatNo = pds[i].F == null ? string.Empty : pds[i].F.ToString().Trim();
string batchNo = pds[i].G == null ? string.Empty : pds[i].G.ToString().Trim();
if (string.IsNullOrEmpty(heatNo))
{
result.Add((i + 2) + "Line, [炉号] 不能为空</br>");
}
if (string.IsNullOrEmpty(batchNo))
{
result.Add((i + 2) + "Line, [批号] 不能为空</br>");
}
string mainMaterialCode = materialCode + "-" + heatNo + "-" + batchNo;
var lib = from x in Funs.DB.HJGL_MaterialCodeLib where x.MaterialCode == mainMaterialCode select x;
if (lib.Count() > 0)
{
item.MaterialCode = lib.First().MaterialCode;
}
else
{
result.Add("第" + (i + 2).ToString() + "行,材料编码库不存在此材料主编码-" + mainMaterialCode + "</br>");
}
}
else
{
result.Add("第" + (i + 2).ToString() + "行,材料编码库不存在此材料编码-" + materialCode + "</br>");
var lib = from x in Funs.DB.HJGL_MaterialCodeLib where x.Code == materialCode select x;
if (lib.Count() == 0)
{
result.Add("第" + (i + 2).ToString() + "行,材料编码库不存在此材料编码-" + materialCode + "</br>");
}
}
}
else
@@ -252,7 +279,9 @@ namespace FineUIPro.Web.HJGL.WeldingManage
// result.Add((i + 2) + "Line, [预制组件] 不能为空</br>");
}
}
var model = matList.Where(x => x.PipelineId == item.PipelineId && x.MaterialCode2 == item.MaterialCode2 && x.WeldJointId == item.WeldJointId && x.PrefabricatedComponents == item.PrefabricatedComponents);
var model = includeBatch
? matList.Where(x => x.PipelineId == item.PipelineId && x.MaterialCode == item.MaterialCode && x.WeldJointId == item.WeldJointId && x.PrefabricatedComponents == item.PrefabricatedComponents)
: matList.Where(x => x.PipelineId == item.PipelineId && x.MaterialCode2 == item.MaterialCode2 && x.WeldJointId == item.WeldJointId && x.PrefabricatedComponents == item.PrefabricatedComponents);
if (model.Count() == 0)
{
matList.Add(item);
@@ -488,6 +517,7 @@ namespace FineUIPro.Web.HJGL.WeldingManage
&& x.WeldJointId == item.WeldJointId
&& x.PipelineId == item.PipelineId
&& x.PrefabricatedComponents == item.PrefabricatedComponents
&& (string.IsNullOrEmpty(item.MaterialCode) || x.MaterialCode == item.MaterialCode)
select x;
if (pipeLineMat.Count() == 0 || pipeLineMat == null)
{