1
This commit is contained in:
@@ -26,10 +26,13 @@ namespace BLL
|
||||
var q = from x in Funs.DB.Tw_InputMaster
|
||||
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()
|
||||
join unit in Funs.DB.Base_Unit on x.ReqUnitId equals unit.UnitId into units
|
||||
from unit in units.DefaultIfEmpty()
|
||||
where
|
||||
(string.IsNullOrEmpty(table.Id) || x.Id.Contains(table.Id)) &&
|
||||
(string.IsNullOrEmpty(table.InOutPlanMasterId) || x.InOutPlanMasterId.Contains(table.InOutPlanMasterId)) &&
|
||||
(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)) &&
|
||||
@@ -53,7 +56,11 @@ namespace BLL
|
||||
CreateManName = person.PersonName,
|
||||
CreateDate = x.CreateDate,
|
||||
ReqUnitId = x.ReqUnitId,
|
||||
ReqUnitName = unit.UnitName,
|
||||
ReqUnitName = unit.UnitName,
|
||||
AuditMan = x.AuditMan,
|
||||
AuditManName = auditperson.PersonName,
|
||||
AuditDate = x.AuditDate,
|
||||
Remark = x.Remark
|
||||
};
|
||||
|
||||
return q;
|
||||
@@ -94,7 +101,11 @@ namespace BLL
|
||||
Category = x.Category,
|
||||
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
|
||||
StateString = TwConst.StateMap.FirstOrDefault(y => y.Value == x.State).Key,
|
||||
AuditMan = x.AuditMan,
|
||||
AuditManName = x.AuditManName,
|
||||
AuditDate = x.AuditDate,
|
||||
Remark=x.Remark
|
||||
};
|
||||
}
|
||||
|
||||
@@ -127,7 +138,11 @@ namespace BLL
|
||||
Category = x.Category,
|
||||
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
|
||||
StateString = TwConst.StateMap.FirstOrDefault(y => y.Value == x.State).Key,
|
||||
AuditMan = x.AuditMan,
|
||||
AuditManName = x.AuditManName,
|
||||
AuditDate = x.AuditDate,
|
||||
Remark = x.Remark
|
||||
}).ToList();
|
||||
}
|
||||
#endregion
|
||||
@@ -155,6 +170,9 @@ namespace BLL
|
||||
CreateMan = newtable.CreateMan,
|
||||
CreateDate = newtable.CreateDate,
|
||||
ReqUnitId = newtable.ReqUnitId,
|
||||
AuditMan= newtable.AuditMan,
|
||||
AuditDate = newtable.AuditDate,
|
||||
Remark = newtable.Remark
|
||||
};
|
||||
Funs.DB.Tw_InputMaster.InsertOnSubmit(table);
|
||||
Funs.DB.SubmitChanges();
|
||||
@@ -178,6 +196,9 @@ namespace BLL
|
||||
table.CreateMan = newtable.CreateMan;
|
||||
table.CreateDate = newtable.CreateDate;
|
||||
table.ReqUnitId = newtable.ReqUnitId;
|
||||
table.AuditMan = newtable.AuditMan;
|
||||
table.AuditDate = newtable.AuditDate;
|
||||
table.Remark = newtable.Remark;
|
||||
Funs.DB.SubmitChanges();
|
||||
}
|
||||
|
||||
@@ -197,7 +218,7 @@ namespace BLL
|
||||
/// <summary>
|
||||
/// 根据计划单生成入库单
|
||||
/// </summary>
|
||||
public static void GenInMasterByPlanId(string planId)
|
||||
public static void GenInMasterByPlanId(string planId, List<Model.Tw_InputDetail> detailLists)
|
||||
{
|
||||
//获取计划单
|
||||
var planQueryModel = new Tw_InOutMasterOutput();
|
||||
@@ -231,6 +252,9 @@ namespace BLL
|
||||
CreateMan = plan.CreateMan,
|
||||
CreateDate = DateTime.Now,
|
||||
ReqUnitId = plan.ReqUnitId,
|
||||
AuditMan = plan.CreateMan,
|
||||
AuditDate = plan.AuditDate,
|
||||
Remark=plan.Remark
|
||||
};
|
||||
if ((TwConst.TypeInt)plan.TypeInt!= TwConst.TypeInt.采购入库)
|
||||
{
|
||||
@@ -238,24 +262,25 @@ namespace BLL
|
||||
(BLL.TwConst.Category)plan.Category);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
master.CusBillCode= plan.CusBillCode.Replace("-AP", "");
|
||||
}
|
||||
Add(master);
|
||||
//生成明细
|
||||
Tw_InOutDetailOutput query = new Tw_InOutDetailOutput();
|
||||
query.InOutPlanMasterId= planId;
|
||||
var details = TwInOutplandetailService.GetByModle(query).ToList();
|
||||
foreach (var detail in details)
|
||||
foreach (var detail in detailLists)
|
||||
{
|
||||
var detailTable = new Model.Tw_InputDetail()
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
InputMasterId = master.Id,
|
||||
MaterialCode = detail.MaterialCode,
|
||||
PlanNum = detail.PlanNum,
|
||||
ActNum = detail.PlanNum,
|
||||
PlanNum = detail.PlanNum,
|
||||
ActNum = detail.ActNum,
|
||||
};
|
||||
TwInputdetailService.Add(detailTable);
|
||||
TwMaterialstockService.UpdateStockNum(master.ProjectId, detail.MaterialCode, master.WarehouseCode, TwConst.InOutType.入库, detailTable.ActNum);
|
||||
|
||||
TwInputdetailService.Add(detailTable);
|
||||
TwMaterialstockService.UpdateStockNum(master.ProjectId, detail.MaterialCode, master.WarehouseCode, TwConst.InOutType.入库, detailTable.ActNum);
|
||||
|
||||
}
|
||||
plan.State= (int)TwConst.State.已完成;
|
||||
TwInOutplanmasterService.Update(plan);
|
||||
|
||||
Reference in New Issue
Block a user