焊接材料修改
This commit is contained in:
@@ -171,15 +171,29 @@ namespace BLL
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
var results = new List<Tw_PipeMatMatchOutput>();
|
||||
var results = new List<Tw_PipeMatMatchOutput>();
|
||||
string [] taskPipeLineList= null;
|
||||
|
||||
var inoutPlanMasterl = db.Tw_InOutPlanMaster.FirstOrDefault(x => x.Id == outPlanMasterId);
|
||||
if (inoutPlanMasterl!=null)
|
||||
{
|
||||
if (inoutPlanMasterl.WeldTaskId.Split('|').Length==4)
|
||||
{
|
||||
taskPipeLineList = Funs.DB.View_HJGL_WeldingTask.Where(e =>
|
||||
e.UnitWorkId == inoutPlanMasterl.WeldTaskId.Split('|')[0].ToString()
|
||||
&& e.UnitId == inoutPlanMasterl.WeldTaskId.Split('|')[1].ToString()
|
||||
&& e.TaskDate.Value.Date == DateTime
|
||||
.ParseExact(inoutPlanMasterl.WeldTaskId.Split('|')[2].ToString(), "yyyyMMdd", null).Date
|
||||
&& e.SerialNumber == inoutPlanMasterl.WeldTaskId.Split('|')[3].ToString()
|
||||
).Distinct().OrderBy(x => x.PipeLineSortIndex).Select(x => x.PipelineId).ToArray();
|
||||
}
|
||||
}
|
||||
// 获取所需材料列表
|
||||
var requiredMaterials = (from x in db.Tw_InOutPlanDetail_Relation
|
||||
join master in db.Tw_InOutPlanMaster on x.InOutPlanMasterId equals master.Id
|
||||
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
||||
join z in db.HJGL_Pipeline on x.PipelineId equals z.PipelineId
|
||||
join t in db.HJGL_WeldTask on master.WeldTaskId equals t.WeldTaskId
|
||||
where x.InOutPlanMasterId == outPlanMasterId
|
||||
where x.InOutPlanMasterId == outPlanMasterId
|
||||
select new Tw_PipeMatMatchOutput
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
@@ -191,12 +205,17 @@ namespace BLL
|
||||
MaterialSpec = y.MaterialSpec,
|
||||
MaterialUnit = y.MaterialUnit,
|
||||
MaterialDef = y.MaterialDef,
|
||||
NeedNum = x.Number,
|
||||
PipeLineSortIndex=t.PipeLineSortIndex
|
||||
NeedNum = x.Number
|
||||
}
|
||||
).ToList();
|
||||
if (taskPipeLineList != null && taskPipeLineList.Any())
|
||||
{
|
||||
requiredMaterials = requiredMaterials.OrderBy(x => Array.IndexOf(taskPipeLineList, x.PipelineId.ToString())).ToList();
|
||||
|
||||
}
|
||||
|
||||
var masterModle = db.Tw_InOutPlanMaster.FirstOrDefault(x => x.Id == outPlanMasterId);
|
||||
results = GetMatMatchOutput(requiredMaterials.OrderBy(x=>x.PipelineId).ThenBy(x=>x.MaterialCode).ToList(), masterModle.WarehouseCode, masterModle.ProjectId);
|
||||
results = GetMatMatchOutput(requiredMaterials, masterModle.WarehouseCode, masterModle.ProjectId);
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,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()
|
||||
from y in yy.DefaultIfEmpty()
|
||||
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
|
||||
@@ -284,8 +284,14 @@ namespace BLL
|
||||
return responeData;
|
||||
}
|
||||
}
|
||||
var typeString = temeplateDtoIns.Select(x => x.TypeString).Distinct().ToList(); //获取导入文件的材料编码
|
||||
if (typeString.Contains("采购入库") && typeString.Contains("退料入库"))
|
||||
var typeString = temeplateDtoIns.Select(x => x.TypeString).Distinct().ToList(); //获取导入文件的类型
|
||||
if (typeString.Where(x=>string.IsNullOrEmpty(x)).Count()>0)
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message ="导入数据中类型列不能为空!";
|
||||
return responeData;
|
||||
}
|
||||
if (typeString.Contains("采购入库") && typeString.Contains("其他入库"))
|
||||
{
|
||||
responeData.code = 0;
|
||||
responeData.message = errorWarehouseCode + "每次只能导入一种类型!";
|
||||
@@ -350,9 +356,9 @@ namespace BLL
|
||||
twInOutPlanMaster.TypeInt = (int)TwConst.TypeInt.采购入库;
|
||||
|
||||
}
|
||||
else if ("退料入库".Equals(FirstCusBillCodeDtoIns.TypeString))
|
||||
else if ("其他入库".Equals(FirstCusBillCodeDtoIns.TypeString))
|
||||
{
|
||||
twInOutPlanMaster.TypeInt = (int)TwConst.TypeInt.退料入库;
|
||||
twInOutPlanMaster.TypeInt = (int)TwConst.TypeInt.其他入库;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -555,7 +561,13 @@ namespace BLL
|
||||
TwInOutplandetailService.AddList(details, planMasterModel.Id);
|
||||
return message;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取出库申请单编号
|
||||
/// </summary>
|
||||
/// <param name="taskCode"></param>
|
||||
/// <param name="typeInt"></param>
|
||||
/// <param name="category"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetCusBillCodeByTaskCode(string taskCode,TwConst.TypeInt typeInt,TwConst.Category category )
|
||||
{
|
||||
string cusBillCode = "";
|
||||
@@ -601,17 +613,17 @@ namespace BLL
|
||||
|
||||
public static string GetDataInCusBillCode(string projectid, string unitcode,string typeString,string unitWorkCode="",string Category = "")
|
||||
{
|
||||
if (typeString == TwConst.TypeInt.退料入库.ToString())
|
||||
if (typeString == TwConst.TypeInt.其他入库.ToString())
|
||||
{
|
||||
//生成规则是20240919-unitcode-AP-GR01
|
||||
string cusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) + "-" + unitcode + "-AP-GR";
|
||||
string cusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now) ;
|
||||
var queryAll = new Tw_InOutMasterOutput()
|
||||
{
|
||||
ProjectId = projectid,
|
||||
CusBillCode = cusBillCode,
|
||||
};
|
||||
var queryAllresult = GetModle(queryAll).Count();
|
||||
cusBillCode = cusBillCode + (queryAllresult + 1).ToString().PadLeft(2, '0');
|
||||
cusBillCode = cusBillCode + "-AP-" + (queryAllresult + 1).ToString().PadLeft(2, '0');
|
||||
return cusBillCode;
|
||||
}
|
||||
else if (typeString == TwConst.TypeInt.散件出库.ToString())
|
||||
@@ -628,15 +640,30 @@ namespace BLL
|
||||
var queryAllresult = GetModle(queryAll).Count();
|
||||
if (Category == TwConst.Category.管段.ToString())
|
||||
{
|
||||
cusBillCode = cusBillCode + (queryAllresult + 1).ToString().PadLeft(2, '0') + "-GI-P01";
|
||||
cusBillCode = cusBillCode + (queryAllresult + 1).ToString().PadLeft(2, '0') + "-AP-P01";
|
||||
}
|
||||
else
|
||||
{
|
||||
cusBillCode = cusBillCode + (queryAllresult + 1).ToString().PadLeft(2, '0') + "-GI-PF01";
|
||||
cusBillCode = cusBillCode + (queryAllresult + 1).ToString().PadLeft(2, '0') + "-AP-PF01";
|
||||
|
||||
}
|
||||
return cusBillCode;
|
||||
}
|
||||
else if (typeString == TwConst.TypeInt.其他出库.ToString())
|
||||
{
|
||||
//生成规则是20240919-01
|
||||
string cusBillCode = string.Format("{0:yyyyMMdd}", DateTime.Now);
|
||||
var queryAll = new Tw_InOutMasterOutput()
|
||||
{
|
||||
ProjectId = projectid,
|
||||
CusBillCode = cusBillCode,
|
||||
TypeInt = (int)TwConst.TypeInt.其他出库,
|
||||
};
|
||||
var queryAllresult = GetModle(queryAll).Count();
|
||||
cusBillCode = cusBillCode +"-AP-"+ (queryAllresult + 1).ToString().PadLeft(2, '0');
|
||||
return cusBillCode;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
//生成规则是20240919-unitcode-AP-GR01
|
||||
@@ -678,11 +705,11 @@ namespace BLL
|
||||
{
|
||||
return;
|
||||
}
|
||||
var pipelineList = db.View_HJGL_WeldingTask.Where(e => e.UnitWorkId == unitworkid && e.UnitId == unitid && e.TaskDate.Value.Date == date.Date && e.SerialNumber == serialNumber).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)
|
||||
where pipelineList.Contains(x.PipelineId) && x.PrefabricatedComponents !=null
|
||||
select new
|
||||
{
|
||||
x.PipelineId,
|
||||
|
||||
@@ -273,16 +273,8 @@ namespace BLL
|
||||
WarehouseMan = plan.WarehouseMan,
|
||||
WarehouseDate = plan.WarehouseDate
|
||||
};
|
||||
if ((TwConst.TypeInt)plan.TypeInt!= TwConst.TypeInt.采购入库)
|
||||
{
|
||||
master.CusBillCode = GetCusBillCodeByTaskCode(plan.WeldTaskCode, (TwConst.TypeInt)plan.TypeInt,
|
||||
(BLL.TwConst.Category)plan.Category);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
master.CusBillCode= plan.CusBillCode.Replace("-AP", "");
|
||||
}
|
||||
master.CusBillCode = GetCusBillCode(plan.WeldTaskCode, (TwConst.TypeInt)plan.TypeInt,
|
||||
(BLL.TwConst.Category)plan.Category, plan.CusBillCode);
|
||||
Add(master);
|
||||
//生成明细
|
||||
foreach (var detail in detailLists)
|
||||
@@ -338,7 +330,15 @@ namespace BLL
|
||||
TwInOutplanmasterService.Update(plan);
|
||||
|
||||
}
|
||||
public static string GetCusBillCodeByTaskCode(string taskCode, TwConst.TypeInt typeInt, TwConst.Category category)
|
||||
/// <summary>
|
||||
/// 获取入库单编号
|
||||
/// </summary>
|
||||
/// <param name="taskCode"></param>
|
||||
/// <param name="typeInt"></param>
|
||||
/// <param name="category"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="planCusBillCode"></param>
|
||||
public static string GetCusBillCode(string taskCode, TwConst.TypeInt typeInt, TwConst.Category category, string planCusBillCode = "")
|
||||
{
|
||||
string cusBillCode = "";
|
||||
switch (typeInt)
|
||||
@@ -353,6 +353,12 @@ namespace BLL
|
||||
cusBillCode = taskCode + "-GI-PF01-RE01";
|
||||
}
|
||||
|
||||
break;
|
||||
case TwConst.TypeInt.其他入库:
|
||||
cusBillCode = planCusBillCode.Replace("-AP-", "-GI-");
|
||||
break;
|
||||
case TwConst.TypeInt.采购入库:
|
||||
cusBillCode = planCusBillCode.Replace("-AP", ""); ;
|
||||
break;
|
||||
}
|
||||
return cusBillCode;
|
||||
|
||||
@@ -78,7 +78,8 @@ namespace BLL
|
||||
AuditDate2 = x.AuditDate2,
|
||||
WarehouseMan = x.WarehouseMan,
|
||||
WarehouseDate = x.WarehouseDate,
|
||||
WarehouseManName = warehouseperson.PersonName
|
||||
WarehouseManName = warehouseperson.PersonName,
|
||||
Remark=y.Remark
|
||||
};
|
||||
|
||||
return q;
|
||||
@@ -281,7 +282,7 @@ namespace BLL
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
InOutPlanMasterId = plan.Id,
|
||||
ProjectId = plan.ProjectId,
|
||||
CusBillCode = GetCusBillCodeByTaskCode(plan.WeldTaskCode, (TwConst.TypeInt)plan.TypeInt, (BLL.TwConst.Category)plan.Category),
|
||||
CusBillCode = GetCusBillCode(plan.WeldTaskCode, (TwConst.TypeInt)plan.TypeInt, (BLL.TwConst.Category)plan.Category,plan.CusBillCode),
|
||||
WarehouseCode = plan.WarehouseCode,
|
||||
Category = plan.Category,
|
||||
Source = plan.Source,
|
||||
@@ -295,7 +296,8 @@ namespace BLL
|
||||
AuditMan2 = plan.AuditMan2,
|
||||
AuditDate2 = plan.AuditDate2,
|
||||
WarehouseMan = plan.WarehouseMan,
|
||||
WarehouseDate = plan.WarehouseDate
|
||||
WarehouseDate = plan.WarehouseDate,
|
||||
|
||||
};
|
||||
Add(master);
|
||||
//生成出库单明细
|
||||
@@ -350,7 +352,15 @@ namespace BLL
|
||||
return result;
|
||||
}
|
||||
|
||||
public static string GetCusBillCodeByTaskCode(string taskCode, TwConst.TypeInt typeInt, TwConst.Category category)
|
||||
/// <summary>
|
||||
/// 获取出库单编号
|
||||
/// </summary>
|
||||
/// <param name="taskCode"></param>
|
||||
/// <param name="typeInt"></param>
|
||||
/// <param name="category"></param>
|
||||
/// <returns></returns>
|
||||
/// <param name="planCusBillCode"></param>
|
||||
public static string GetCusBillCode(string taskCode, TwConst.TypeInt typeInt, TwConst.Category category, string planCusBillCode = "")
|
||||
{
|
||||
string cusBillCode = "";
|
||||
switch (typeInt)
|
||||
@@ -377,7 +387,13 @@ namespace BLL
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case TwConst.TypeInt.散件出库:
|
||||
cusBillCode = planCusBillCode.Replace("-AP-", "-GI-");
|
||||
break;
|
||||
case TwConst.TypeInt.其他出库:
|
||||
cusBillCode = planCusBillCode.Replace("-AP-", "-GI-");
|
||||
break;
|
||||
|
||||
}
|
||||
return cusBillCode;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user