代码无效引用清理,试压包资料界面看板修改

This commit is contained in:
2025-10-10 14:33:21 +08:00
parent 87fb529521
commit 55b798135c
933 changed files with 5897 additions and 7541 deletions
+124 -129
View File
@@ -1,16 +1,11 @@
using EmitMapper;
using FineUIPro;
using Microsoft.Office.Interop.Word;
using MiniExcelLibs;
using Model;
using NPOI.Util;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Web.UI.WebControls;
namespace BLL
@@ -33,7 +28,7 @@ namespace BLL
var q = from x in Funs.DB.Tw_InOutPlanMaster
join y in Funs.DB.HJGL_WeldTask on x.WeldTaskId equals y.WeldTaskId into yy
from y in yy.DefaultIfEmpty()
join person in Funs.DB.Person_Persons on x.CreateMan equals person.PersonId into persons
join person in Funs.DB.Person_Persons on x.CreateMan equals person.PersonId into persons
from person in persons.DefaultIfEmpty()
join auditperson in Funs.DB.Person_Persons on x.AuditMan equals auditperson.PersonId into auditpersons
from auditperson in auditpersons.DefaultIfEmpty()
@@ -42,22 +37,22 @@ namespace BLL
join warehouseperson in Funs.DB.Person_Persons on x.WarehouseMan equals warehouseperson.PersonId into warehousepersons
from warehouseperson in warehousepersons.DefaultIfEmpty()
join unit in Funs.DB.Base_Unit on x.ReqUnitId equals unit.UnitId into units
from unit in units.DefaultIfEmpty()
orderby x.CreateDate descending
from unit in units.DefaultIfEmpty()
orderby x.CreateDate descending
where
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
(string.IsNullOrEmpty(table.ProjectId) || x.ProjectId.Contains(table.ProjectId)) &&
(string.IsNullOrEmpty(table.CusBillCode) || x.CusBillCode.Contains(table.CusBillCode)) &&
(string.IsNullOrEmpty(table.WarehouseCode) || x.WarehouseCode.Contains(table.WarehouseCode)) &&
(string.IsNullOrEmpty(table.CreateMan) || x.CreateMan.Contains(table.CreateMan)) &&
(string.IsNullOrEmpty(table.OutputMasterId) || x.OutputMasterId.Contains(table.OutputMasterId)) &&
(string.IsNullOrEmpty(table.OutputMasterId) || x.OutputMasterId.Contains(table.OutputMasterId)) &&
(string.IsNullOrEmpty(table.ReqUnitId) || x.ReqUnitId.Contains(table.ReqUnitId)) &&
(string.IsNullOrEmpty(table.UnitWorkId) || x.WeldTaskId.Contains(table.UnitWorkId))&&
(string.IsNullOrEmpty(table.WeldTaskId) || x.WeldTaskId.Contains(table.WeldTaskId))&&
(string.IsNullOrEmpty(table.UnitWorkId) || x.WeldTaskId.Contains(table.UnitWorkId)) &&
(string.IsNullOrEmpty(table.WeldTaskId) || x.WeldTaskId.Contains(table.WeldTaskId)) &&
(table.InOutType == null || x.InOutType == table.InOutType) &&
(table.TypeInt == null || x.TypeInt == table.TypeInt) &&
(table.Category == null || x.Category == table.Category) &&
(table.State == null || x.State == table.State)
(table.State == null || x.State == table.State)
select new Model.Tw_InOutMasterOutput
{
Id = x.Id,
@@ -76,7 +71,7 @@ namespace BLL
WeldTaskId = x.WeldTaskId,
ReqUnitId = x.ReqUnitId,
ReqUnitName = unit.UnitName,
UnitWorkId = y.UnitWorkId,
UnitWorkId = y.UnitWorkId,
WeldTaskCode = y.TaskCode,
AuditMan = x.AuditMan,
AuditManName = auditperson.PersonName,
@@ -87,8 +82,8 @@ namespace BLL
AuditDate2 = x.AuditDate2,
WarehouseMan = x.WarehouseMan,
WarehouseDate = x.WarehouseDate,
WarehouseManName= warehouseperson.PersonName,
PipeLineSortIndex=y.PipeLineSortIndex
WarehouseManName = warehouseperson.PersonName,
PipeLineSortIndex = y.PipeLineSortIndex
}
;
@@ -115,41 +110,41 @@ namespace BLL
var result = q.ToList();
// q = SortConditionHelper.SortingAndPaging(q, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return (from x in result
select new Model.Tw_InOutMasterOutput
{
Id = x.Id,
ProjectId = x.ProjectId,
CusBillCode = x.CusBillCode,
WarehouseCode = x.WarehouseCode,
Source = x.Source,
InOutType = x.InOutType,
TypeInt = x.TypeInt,
Category = x.Category,
State = x.State,
CreateMan = x.CreateMan,
CreateManName = x.CreateManName,
CreateDate = x.CreateDate,
OutputMasterId = x.OutputMasterId,
WeldTaskId = x.WeldTaskId,
ReqUnitId = x.ReqUnitId,
ReqUnitName = x.ReqUnitName,
UnitWorkId = x.UnitWorkId,
WeldTaskCode = x.WeldTaskId != null ? x.WeldTaskId.Contains('|') ? Funs.DB.HJGL_WeldTask.FirstOrDefault(e => e.UnitWorkId == x.WeldTaskId.Split('|')[0].ToString() && e.UnitId == x.WeldTaskId.Split('|')[1].ToString() && e.TaskDate.Value.Date == DateTime.ParseExact(x.WeldTaskId.Split('|')[2].ToString(), "yyyyMMdd", null).Date)?.TaskCode : "" : "",
CategoryString = TwConst.CategoryMap.FirstOrDefault(y => y.Value == x.Category).Key,
TypeString = TwConst.TypeIntMap.FirstOrDefault(y => y.Value == x.TypeInt).Key,
StateString = TwConst.StateMap.FirstOrDefault(y => y.Value == x.State).Key,
AuditMan = x.AuditMan,
AuditManName = x.AuditManName,
AuditDate = x.AuditDate,
Remark = x.Remark,
AuditMan2=x.AuditMan2,
AuditManName2 = x.AuditManName2,
AuditDate2 = x.AuditDate2,
WarehouseMan = x.WarehouseMan,
WarehouseDate = x.WarehouseDate,
WarehouseManName= x.WarehouseManName,
PipeLineSortIndex = x.PipeLineSortIndex,
}).ToList();
select new Model.Tw_InOutMasterOutput
{
Id = x.Id,
ProjectId = x.ProjectId,
CusBillCode = x.CusBillCode,
WarehouseCode = x.WarehouseCode,
Source = x.Source,
InOutType = x.InOutType,
TypeInt = x.TypeInt,
Category = x.Category,
State = x.State,
CreateMan = x.CreateMan,
CreateManName = x.CreateManName,
CreateDate = x.CreateDate,
OutputMasterId = x.OutputMasterId,
WeldTaskId = x.WeldTaskId,
ReqUnitId = x.ReqUnitId,
ReqUnitName = x.ReqUnitName,
UnitWorkId = x.UnitWorkId,
WeldTaskCode = x.WeldTaskId != null ? x.WeldTaskId.Contains('|') ? Funs.DB.HJGL_WeldTask.FirstOrDefault(e => e.UnitWorkId == x.WeldTaskId.Split('|')[0].ToString() && e.UnitId == x.WeldTaskId.Split('|')[1].ToString() && e.TaskDate.Value.Date == DateTime.ParseExact(x.WeldTaskId.Split('|')[2].ToString(), "yyyyMMdd", null).Date)?.TaskCode : "" : "",
CategoryString = TwConst.CategoryMap.FirstOrDefault(y => y.Value == x.Category).Key,
TypeString = TwConst.TypeIntMap.FirstOrDefault(y => y.Value == x.TypeInt).Key,
StateString = TwConst.StateMap.FirstOrDefault(y => y.Value == x.State).Key,
AuditMan = x.AuditMan,
AuditManName = x.AuditManName,
AuditDate = x.AuditDate,
Remark = x.Remark,
AuditMan2 = x.AuditMan2,
AuditManName2 = x.AuditManName2,
AuditDate2 = x.AuditDate2,
WarehouseMan = x.WarehouseMan,
WarehouseDate = x.WarehouseDate,
WarehouseManName = x.WarehouseManName,
PipeLineSortIndex = x.PipeLineSortIndex,
}).ToList();
}
public static IEnumerable GetListData(Model.Tw_InOutMasterOutput table, Grid grid1)
@@ -194,38 +189,38 @@ namespace BLL
Remark = x.Remark,
AuditMan2 = x.AuditMan2,
AuditManName2 = x.AuditManName2,
AuditDate2 = x.AuditDate2,
AuditDate2 = x.AuditDate2,
WarehouseMan = x.WarehouseMan,
WarehouseDate = x.WarehouseDate,
WarehouseManName= x.WarehouseManName
WarehouseDate = x.WarehouseDate,
WarehouseManName = x.WarehouseManName
};
}
public static string GetWeldTaskCode( string WeldTaskId)
public static string GetWeldTaskCode(string WeldTaskId)
{
string result=String.Empty;
string result = String.Empty;
if (string.IsNullOrEmpty(WeldTaskId)) return result;
if (WeldTaskId.Split('|').Length==3) //用于处理历史数据
{
if (WeldTaskId.Split('|').Length == 3) //用于处理历史数据
{
result = (from x in Funs.DB.HJGL_WeldTask
where x.UnitWorkId == WeldTaskId.Split('|')[0].ToString()
&& x.UnitId == WeldTaskId.Split('|')[1].ToString()
&& x.TaskDate.Value.Date ==
DateTime.ParseExact(WeldTaskId.Split('|')[2].ToString(), "yyyyMMdd", null)
select x.TaskCode).FirstOrDefault()
where x.UnitWorkId == WeldTaskId.Split('|')[0].ToString()
&& x.UnitId == WeldTaskId.Split('|')[1].ToString()
&& x.TaskDate.Value.Date ==
DateTime.ParseExact(WeldTaskId.Split('|')[2].ToString(), "yyyyMMdd", null)
select x.TaskCode).FirstOrDefault()
?.ToString();
}
else if (WeldTaskId.Split('|').Length == 4)
{
result = (from x in Funs.DB.HJGL_WeldTask
where x.UnitWorkId == WeldTaskId.Split('|')[0].ToString()
&& x.UnitId == WeldTaskId.Split('|')[1].ToString()
&& x.TaskDate.Value.Date ==
DateTime.ParseExact(WeldTaskId.Split('|')[2].ToString(), "yyyyMMdd", null)
&& x.SerialNumber== WeldTaskId.Split('|')[3]
where x.UnitWorkId == WeldTaskId.Split('|')[0].ToString()
&& x.UnitId == WeldTaskId.Split('|')[1].ToString()
&& x.TaskDate.Value.Date ==
DateTime.ParseExact(WeldTaskId.Split('|')[2].ToString(), "yyyyMMdd", null)
&& x.SerialNumber == WeldTaskId.Split('|')[3]
select x.TaskCode).FirstOrDefault()
?.ToString();
}
@@ -243,7 +238,7 @@ namespace BLL
/// <param name="projectid"></param>
/// <param name="creatUserId"></param>
/// <returns></returns>
public static ResponeData ImportData(string OriFileName,string path, string projectid, string creatUserId)
public static ResponeData ImportData(string OriFileName, string path, string projectid, string creatUserId)
{
var responeData = new ResponeData();
List<Tw_InputDataIn> temeplateDtoIns;
@@ -269,9 +264,9 @@ namespace BLL
string errorWarehouseCode = "";
foreach (var item in warehouseCodeList)
{
if (!DropListService.HJGL_WarehouseCode().Select(x=>x.Value== item).Any())
if (!DropListService.HJGL_WarehouseCode().Select(x => x.Value == item).Any())
{
errorWarehouseCode+=item+",";
errorWarehouseCode += item + ",";
}
}
@@ -280,15 +275,15 @@ namespace BLL
if (temeplateDtoIns.Count == 0)
{
responeData.code = 0;
responeData.message = errorWarehouseCode+"仓库不存在!";
responeData.message = errorWarehouseCode + "仓库不存在!";
return responeData;
}
}
var typeString = temeplateDtoIns.Select(x => x.TypeString).Distinct().ToList(); //获取导入文件的类型
if (typeString.Where(x=>string.IsNullOrEmpty(x)).Count()>0)
if (typeString.Where(x => string.IsNullOrEmpty(x)).Count() > 0)
{
responeData.code = 0;
responeData.message ="导入数据中类型列不能为空!";
responeData.message = "导入数据中类型列不能为空!";
return responeData;
}
if (typeString.Contains("采购入库") && typeString.Contains("其他入库"))
@@ -300,10 +295,10 @@ namespace BLL
var materialCodeList = temeplateDtoIns.Select(x => x.MaterialCode).Distinct().ToList(); //获取导入文件的材料编码
var IsExitMaterialCode=
from x in Funs.DB.HJGL_MaterialCodeLib
where materialCodeList.Contains(x.MaterialCode)
select x.MaterialCode;
var IsExitMaterialCode =
from x in Funs.DB.HJGL_MaterialCodeLib
where materialCodeList.Contains(x.MaterialCode)
select x.MaterialCode;
if (IsExitMaterialCode.Count() < materialCodeList.Count)
{
var errorMaterialCode = materialCodeList.Except(IsExitMaterialCode.ToList());
@@ -314,7 +309,7 @@ namespace BLL
return responeData;
}
}
string cusbilcode = GetDataInCusBillCode(projectid,UnitService.GetUnitCodeByUnitId(Person_PersonsService.GetPerson_PersonsById(creatUserId).UnitId), temeplateDtoIns.FirstOrDefault().TypeString);
string cusbilcode = GetDataInCusBillCode(projectid, UnitService.GetUnitCodeByUnitId(Person_PersonsService.GetPerson_PersonsById(creatUserId).UnitId), temeplateDtoIns.FirstOrDefault().TypeString);
foreach (var item in temeplateDtoIns)
{
item.CusBillCode = cusbilcode;
@@ -348,7 +343,7 @@ namespace BLL
var twInOutPlanDetails = mapperDetail.Map(CusBillCodeDtoIns.Where(x => !string.IsNullOrEmpty(x.MaterialCode) && !string.IsNullOrEmpty(x.PlanNum)).ToList());
twInOutPlanMaster.Id = SQLHelper.GetNewID();
twInOutPlanMaster.InOutType= (int)TwConst.InOutType.;
twInOutPlanMaster.InOutType = (int)TwConst.InOutType.;
twInOutPlanMaster.State = (int)TwConst.State.;
if ("采购入库".Equals(FirstCusBillCodeDtoIns.TypeString))
@@ -365,12 +360,12 @@ namespace BLL
twInOutPlanMaster.TypeInt = (int)TwConst.TypeInt.;
}
twInOutPlanMaster.Category= (int)TwConst.Category.;
twInOutPlanMaster.Category = (int)TwConst.Category.;
twInOutPlanMaster.ProjectId = projectid;
twInOutPlanMaster.CreateMan = creatUserId;
twInOutPlanMaster.CreateDate = DateTime.Now;
twInOutPlanMaster.Remark = OriFileName;
Add(twInOutPlanMaster);
Add(twInOutPlanMaster);
TwInOutplandetailService.AddList(twInOutPlanDetails, twInOutPlanMaster.Id); //插入入库明细
}
@@ -404,8 +399,8 @@ namespace BLL
AuditMan = newtable.AuditMan,
AuditDate = newtable.AuditDate,
Remark = newtable.Remark,
AuditMan2=newtable.AuditMan2,
AuditDate2=newtable.AuditDate2,
AuditMan2 = newtable.AuditMan2,
AuditDate2 = newtable.AuditDate2,
WarehouseMan = newtable.WarehouseMan,
WarehouseDate = newtable.WarehouseDate,
};
@@ -464,16 +459,16 @@ namespace BLL
/// <param name="outputMasterId"></param>
/// <param name="typeInt"></param>
/// <returns></returns>
public static string GenPlanMasterByOutputMasterId(string outputMasterId,TwConst.TypeInt typeInt)
public static string GenPlanMasterByOutputMasterId(string outputMasterId, TwConst.TypeInt typeInt)
{
string message = "";
#region
//获取出库单
var outMasterQuery = new Tw_InOutMasterOutput();
outMasterQuery.Id = outputMasterId;
var outMaster = TwOutputmasterService.GetListData(outMasterQuery) .FirstOrDefault() ;
var outMaster = TwOutputmasterService.GetListData(outMasterQuery).FirstOrDefault();
if (outMaster == null || outMaster.State != (int)TwConst.State.)
{
message = "出库单状态错误,无法生成计划单!";
@@ -482,7 +477,7 @@ namespace BLL
//判断是否已经生成过计划单
var queryIsExitInMaster = new Tw_InOutMasterOutput();
queryIsExitInMaster.OutputMasterId = outMaster.Id;
queryIsExitInMaster.TypeInt= (int)typeInt;
queryIsExitInMaster.TypeInt = (int)typeInt;
var IsExitInMaster = GetModle(queryIsExitInMaster).FirstOrDefault();
if (IsExitInMaster != null)
{
@@ -497,11 +492,11 @@ namespace BLL
{
case TwConst.TypeInt.:
details = details.Where(x => x.PlanNum > x.ActNum).ToList();
foreach (var item in details)
foreach (var item in details)
{
item.PlanNum = (item.PlanNum - item.ActNum);
}
if (details.Count==0)
if (details.Count == 0)
{
message = "该出库单无需补料";
return message;
@@ -519,14 +514,14 @@ namespace BLL
return message;
}
break;
}
}
#endregion
//生成计划单
var planMasterModel = new Model.Tw_InOutMasterOutput()
{
Id = Guid.NewGuid().ToString(),
OutputMasterId = outMaster.Id,
ProjectId = outMaster.ProjectId,
ProjectId = outMaster.ProjectId,
WarehouseCode = outMaster.WarehouseCode,
Source = 2,
Category = outMaster.Category,
@@ -541,26 +536,26 @@ namespace BLL
switch (typeInt)
{
case TwConst.TypeInt.:
planMasterModel.CusBillCode = GetCusBillCodeByTaskCode(outMaster.WeldTaskCode,TwConst.TypeInt.,(BLL.TwConst.Category)planMasterModel.Category);
planMasterModel.TypeInt= (int)TwConst.TypeInt.;
planMasterModel.InOutType= (int)TwConst.InOutType.;
planMasterModel.CusBillCode = GetCusBillCodeByTaskCode(outMaster.WeldTaskCode, TwConst.TypeInt., (BLL.TwConst.Category)planMasterModel.Category);
planMasterModel.TypeInt = (int)TwConst.TypeInt.;
planMasterModel.InOutType = (int)TwConst.InOutType.;
break;
case TwConst.TypeInt.退:
string pre = "";
pre += DateTime.Now.ToString("yyyyMMdd");
pre += UnitService.GetUnitCodeByUnitId(outMaster.ReqUnitId);
pre += "-"+ UnitWorkService.getUnitWorkByUnitWorkId(outMaster.UnitWorkId)?.UnitWorkCode;
planMasterModel.CusBillCode = GetCusBillCodeByTaskCode(pre , TwConst.TypeInt.退, (BLL.TwConst.Category)planMasterModel.Category);
pre += "-" + UnitWorkService.getUnitWorkByUnitWorkId(outMaster.UnitWorkId)?.UnitWorkCode;
planMasterModel.CusBillCode = GetCusBillCodeByTaskCode(pre, TwConst.TypeInt.退, (BLL.TwConst.Category)planMasterModel.Category);
planMasterModel.TypeInt = (int)TwConst.TypeInt.退;
planMasterModel.InOutType = (int)TwConst.InOutType.;
;
;
break;
}
Add(planMasterModel);
//生成明细
TwInOutplandetailService.AddList(details, planMasterModel.Id);
return message;
}
}
/// <summary>
/// 获取出库申请单编号
/// </summary>
@@ -568,17 +563,17 @@ namespace BLL
/// <param name="typeInt"></param>
/// <param name="category"></param>
/// <returns></returns>
public static string GetCusBillCodeByTaskCode(string taskCode,TwConst.TypeInt typeInt,TwConst.Category category )
public static string GetCusBillCodeByTaskCode(string taskCode, TwConst.TypeInt typeInt, TwConst.Category category)
{
string cusBillCode = "";
switch (typeInt )
switch (typeInt)
{
case TwConst.TypeInt.:
if (category== TwConst.Category.)
if (category == TwConst.Category.)
{
cusBillCode = taskCode + "-AP-P01";
}
else if (category == TwConst.Category.)
else if (category == TwConst.Category.)
{
cusBillCode = taskCode + "-AP-PF01";
}
@@ -611,12 +606,12 @@ namespace BLL
}
public static string GetDataInCusBillCode(string projectid, string unitcode,string typeString,string unitWorkCode="",string Category = "")
public static string GetDataInCusBillCode(string projectid, string unitcode, string typeString, string unitWorkCode = "", string Category = "")
{
if (typeString == TwConst.TypeInt..ToString())
{
//生成规则是20240919-unitcode-AP-GR01
string cusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) ;
string cusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now);
var queryAll = new Tw_InOutMasterOutput()
{
ProjectId = projectid,
@@ -629,14 +624,14 @@ namespace BLL
else if (typeString == TwConst.TypeInt..ToString())
{
//生成规则是20240919-unitcode-AP-GR01
string cusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + unitcode+"-" + unitWorkCode +"-";
string cusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + unitcode + "-" + unitWorkCode + "-";
var queryAll = new Tw_InOutMasterOutput()
{
ProjectId = projectid,
CusBillCode = cusBillCode,
Category = Category == TwConst.Category..ToString() ? (int)TwConst.Category. : (int)TwConst.Category.
};
};
var queryAllresult = GetModle(queryAll).Count();
if (Category == TwConst.Category..ToString())
{
@@ -660,7 +655,7 @@ namespace BLL
TypeInt = (int)TwConst.TypeInt.,
};
var queryAllresult = GetModle(queryAll).Count();
cusBillCode = cusBillCode +"-AP-"+ (queryAllresult + 1).ToString().PadLeft(2, '0');
cusBillCode = cusBillCode + "-AP-" + (queryAllresult + 1).ToString().PadLeft(2, '0');
return cusBillCode;
}
@@ -686,38 +681,38 @@ namespace BLL
/// <param name="unitid"></param>
/// <param name="date"></param>
/// <param name="Personid"></param>
public static void GenOutPlanmasterByWeldTaskId(string unitworkid,string unitid,DateTime date,string serialNumber, string Personid)
public static void GenOutPlanmasterByWeldTaskId(string unitworkid, string unitid, DateTime date, string serialNumber, string Personid)
{
Model.SGGLDB db = Funs.DB;
Model.View_HJGL_WeldingTask weldTask = db.View_HJGL_WeldingTask.FirstOrDefault(e => e.UnitWorkId==unitworkid && e.UnitId==unitid&& e.TaskDate.Value.Date==date.Date && e.SerialNumber==serialNumber);
if (weldTask==null)
Model.View_HJGL_WeldingTask weldTask = db.View_HJGL_WeldingTask.FirstOrDefault(e => e.UnitWorkId == unitworkid && e.UnitId == unitid && e.TaskDate.Value.Date == date.Date && e.SerialNumber == serialNumber);
if (weldTask == null)
{
return;
}
string WeldTaskId= unitworkid+"|"+unitid+ "|" + string.Format("{0:yyyyMMdd}", date)+"|"+serialNumber;
string WeldTaskId = unitworkid + "|" + unitid + "|" + string.Format("{0:yyyyMMdd}", date) + "|" + serialNumber;
//判断是否已经生成过出库计划单
var queryIsExitInMaster = new Tw_InOutMasterOutput();
queryIsExitInMaster.WeldTaskId = WeldTaskId;
queryIsExitInMaster.InOutType=(int)TwConst.InOutType.;
queryIsExitInMaster.InOutType = (int)TwConst.InOutType.;
queryIsExitInMaster.TypeInt = (int)TwConst.TypeInt.;
var IsExitInMaster = TwInOutplanmasterService.GetModle(queryIsExitInMaster).FirstOrDefault();
if (IsExitInMaster != null)
{
return;
}
var pipelineList = db.View_HJGL_WeldingTask.Where(e => e.UnitWorkId == unitworkid && e.UnitId == unitid && e.TaskDate.Value.Date == date.Date && e.SerialNumber == serialNumber).OrderBy(x=>x.PipeLineSortIndex).Select(x=>x.PipelineId).Distinct().ToList();
}
var pipelineList = db.View_HJGL_WeldingTask.Where(e => e.UnitWorkId == unitworkid && e.UnitId == unitid && e.TaskDate.Value.Date == date.Date && e.SerialNumber == serialNumber).OrderBy(x => x.PipeLineSortIndex).Select(x => x.PipelineId).Distinct().ToList();
//领料出库需要排除散件材料
var MaterDatial= from x in db.HJGL_PipeLineMat
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
where pipelineList.Contains(x.PipelineId) && x.PrefabricatedComponents !=null
select new
{
x.PipelineId,
x.PrefabricatedComponents,
x.MaterialCode,
x.Number,
y.MaterialUnit,
};
var MaterDatial = from x in db.HJGL_PipeLineMat
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
where pipelineList.Contains(x.PipelineId) && x.PrefabricatedComponents != null
select new
{
x.PipelineId,
x.PrefabricatedComponents,
x.MaterialCode,
x.Number,
y.MaterialUnit,
};
//var outMateriaList = from x in db.HJGL_PipeLineMat
// join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
// where pipelineList.Contains(x.PipelineId)
@@ -729,7 +724,7 @@ namespace BLL
// planNum = g.Sum(x => x.Number) ?? 0,
// MaterialName = g.Key.MaterialUnit,
// };
var outMateriaList = from x in MaterDatial
var outMateriaList = from x in MaterDatial
group x by new { x.MaterialCode, x.MaterialUnit }
into g
select new
@@ -749,7 +744,7 @@ namespace BLL
Id = Guid.NewGuid().ToString(),
ProjectId = weldTask.ProjectId,
// CusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + UnitService.GetUnitCodeByUnitId(weldTask.UnitId) + "-" + UnitWorkService.getUnitWorkByUnitWorkId(weldTask.UnitWorkId)?.UnitWorkCode + "AP-PF01",
CusBillCode=TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode,TwConst.TypeInt.,TwConst.Category.),
CusBillCode = TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode, TwConst.TypeInt., TwConst.Category.),
WarehouseCode = PipelineService.GetPipeArea().Where(x => x.Value == PipelineService.GetPipelineByPipelineId(weldTask.PipelineId).PipeArea).Select(x => x.Text).FirstOrDefault(),
Source = 1,
InOutType = (int)TwConst.InOutType.,
@@ -774,7 +769,7 @@ namespace BLL
TwInOutplandetailService.Add(detail);
}
var twinoutplandetailRelationList = MaterDatial.ToList().Select(x => new Tw_InOutPlanDetail_Relation
{
{
PipelineId = x.PipelineId,
MaterialCode = x.MaterialCode,
Number = x.Number,
@@ -788,7 +783,7 @@ namespace BLL
{
Id = Guid.NewGuid().ToString(),
ProjectId = weldTask.ProjectId,
CusBillCode =TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode, TwConst.TypeInt., TwConst.Category.),
CusBillCode = TwInOutplanmasterService.GetCusBillCodeByTaskCode(weldTaskCode, TwConst.TypeInt., TwConst.Category.),
WarehouseCode = PipelineService.GetPipeArea().Where(x => x.Value == PipelineService.GetPipelineByPipelineId(weldTask.PipelineId).PipeArea).Select(x => x.Text).FirstOrDefault(),
Source = 1,
InOutType = (int)TwConst.InOutType.,