diff --git a/DOAN.Model/MES/base/BaseMaterialList.cs b/DOAN.Model/MES/base/BaseMaterialList.cs
index a48c1e2..42304f2 100644
--- a/DOAN.Model/MES/base/BaseMaterialList.cs
+++ b/DOAN.Model/MES/base/BaseMaterialList.cs
@@ -43,7 +43,7 @@ namespace DOAN.Model.MES.base_
public string ADDCode { get; set; }
///
- /// 客户编码
+ /// 客户编码 customer_ code
///
[SugarColumn(ColumnName = "customer_code")]
diff --git a/DOAN.Service/MES/ERP/InteractERPService.cs b/DOAN.Service/MES/ERP/InteractERPService.cs
index 0e882e6..2f9f367 100644
--- a/DOAN.Service/MES/ERP/InteractERPService.cs
+++ b/DOAN.Service/MES/ERP/InteractERPService.cs
@@ -20,7 +20,7 @@ namespace DOAN.Service.MES.ERP
///
/// 工位Service业务层处理
///
- [AppService(ServiceType = typeof(IBaseWorkStationService), ServiceLifetime = LifeTime.Transient)]
+ [AppService(ServiceType = typeof(IInteractERPService), ServiceLifetime = LifeTime.Transient)]
public class InteractERPService : BaseService, IInteractERPService
{
diff --git a/DOAN.Service/MES/base/BaseMaterialBOMService.cs b/DOAN.Service/MES/base/BaseMaterialBOMService.cs
index bbfbace..cd7dfb3 100644
--- a/DOAN.Service/MES/base/BaseMaterialBOMService.cs
+++ b/DOAN.Service/MES/base/BaseMaterialBOMService.cs
@@ -23,219 +23,220 @@ namespace DOAN.Service.MES.base_
///
/// 物料清单Service业务层处理
///
- [AppService(ServiceType = typeof(IBaseMaterialBOMService), ServiceLifetime = LifeTime.Transient)]
- public class BaseMaterialBOMService : BaseService, IBaseMaterialBOMService
- {
- ///
- /// 查询物料清单列表
- ///
- ///
- ///
- public PagedInfo GetList(BaseMaterialListQueryDto2 parm)
- {
- int[] nodes = null;
+ //[AppService(ServiceType = typeof(IBaseMaterialBOMService), ServiceLifetime = LifeTime.Transient)]
+ //public class BaseMaterialBOMService : BaseService, IBaseMaterialBOMService
+ //{
+ // ///
+ // /// 查询物料清单列表
+ // ///
+ // ///
+ // ///
+ // public PagedInfo GetList(BaseMaterialListQueryDto2 parm)
+ // {
+ // int[] nodes = null;
- if (parm.Type == 1)
- {
- nodes = FindLeafNodes(Context.Queryable().ToList(), 6).Select(it => it.Id).ToArray();
- }
- else if (parm.Type == 2)
- {
+ // if (parm.Type == 1)
+ // {
+ // nodes = FindLeafNodes(Context.Queryable().ToList(), 6).Select(it => it.Id).ToArray();
+ // }
+ // else if (parm.Type == 2)
+ // {
- nodes = FindLeafNodes(Context.Queryable().ToList(), 5).Select(it => it.Id).ToArray();
+ // nodes = FindLeafNodes(Context.Queryable().ToList(), 5).Select(it => it.Id).ToArray();
- }
- var predicate = Expressionable.Create();
+ // }
+ // var predicate = Expressionable.Create();
- var response = Queryable()
- .Where(it => nodes.Contains(it.FkTypeId.Value))
- .Where(predicate.ToExpression())
- .ToPage(parm);
+ // var response = Queryable()
+ // .Where(it => nodes.Contains(it.FkTypeId.Value))
+ // .Where(predicate.ToExpression())
+ // .ToPage(parm);
- return response;
- }
+ // return response;
+ // }
- ///
- /// 获取详情
- ///
- ///
- ///
- public BaseMaterialList GetInfo(string Id)
- {
- var response = Queryable()
- .Where(x => x.Id == Id)
- .First();
+ // ///
+ // /// 获取详情
+ // ///
+ // ///
+ // ///
+ // public BaseMaterialList GetInfo(string Id)
+ // {
+ // var response = Queryable()
+ // .Where(x => x.Id == Id)
+ // .First();
- return response;
- }
+ // return response;
+ // }
- ///
- /// 添加物料清单
- ///
- ///
- ///
- public BaseMaterialList AddBaseMaterialList(BaseMaterialList model)
- {
- return Context.Insertable(model).ExecuteReturnEntity();
- }
+ // ///
+ // /// 添加物料清单
+ // ///
+ // ///
+ // ///
+ // public BaseMaterialList AddBaseMaterialList(BaseMaterialList model)
+ // {
+ // return Context.Insertable(model).ExecuteReturnEntity();
+ // }
- ///
- /// 修改物料清单
- ///
- ///
- ///
- public int UpdateBaseMaterialList(BaseMaterialList model)
- {
- //var response = Update(w => w.Id == model.Id, it => new BaseMaterialList()
- //{
- // Name = model.Name,
- // Code = model.Code,
- // Customer code = model.Customer code,
- // Color = model.Color,
- // Specification = model.Specification,
- // Unit = model.Unit,
- // Description = model.Description,
- // ExpirationUnit = model.ExpirationUnit,
- // ExpirationDate = model.ExpirationDate,
- // ShelfLifeWarningDays = model.ShelfLifeWarningDays,
- // IsShelfLife = model.IsShelfLife,
- // StartTime = model.StartTime,
- // StopTime = model.StopTime,
- // BarCode = model.BarCode,
- // IsBatch = model.IsBatch,
- // CreatedBy = model.CreatedBy,
- // CreatedTime = model.CreatedTime,
- // UpdatedBy = model.UpdatedBy,
- // UpdatedTime = model.UpdatedTime,
- //});
- //return response;
- return Update(model, true);
- }
+ // ///
+ // /// 修改物料清单
+ // ///
+ // ///
+ // ///
+ // public int UpdateBaseMaterialList(BaseMaterialList model)
+ // {
+ // //var response = Update(w => w.Id == model.Id, it => new BaseMaterialList()
+ // //{
+ // // Name = model.Name,
+ // // Code = model.Code,
+ // // Customer code = model.Customer code,
+ // // Color = model.Color,
+ // // Specification = model.Specification,
+ // // Unit = model.Unit,
+ // // Description = model.Description,
+ // // ExpirationUnit = model.ExpirationUnit,
+ // // ExpirationDate = model.ExpirationDate,
+ // // ShelfLifeWarningDays = model.ShelfLifeWarningDays,
+ // // IsShelfLife = model.IsShelfLife,
+ // // StartTime = model.StartTime,
+ // // StopTime = model.StopTime,
+ // // BarCode = model.BarCode,
+ // // IsBatch = model.IsBatch,
+ // // CreatedBy = model.CreatedBy,
+ // // CreatedTime = model.CreatedTime,
+ // // UpdatedBy = model.UpdatedBy,
+ // // UpdatedTime = model.UpdatedTime,
+ // //});
+ // //return response;
+ // return Update(model, true);
+ // }
- ///
- /// 获取bom结构
- ///
- ///
- ///
- public List Achieve_BOM(string id)
- {
- var query1 = Context.Queryable().Where(it => it.FkParentId == id);
- return Context.Queryable(query1).LeftJoin((q, m) => q.FkId == m.Id)
- .InnerJoin((q, m,t)=>m.FkTypeId==t.Id)
- .Select((q, m,t) => new BaseMaterialListDto2() {
- Type_Name = t.Name,
- Type_Code = t.Code,
- },true)
- .ToList()
- .Adapt>()
- ;
+ // ///
+ // /// 获取bom结构
+ // ///
+ // ///
+ // ///
+ // public List Achieve_BOM(string id)
+ // {
+ // var query1 = Context.Queryable().Where(it => it.FkParentId == id);
+ // return Context.Queryable(query1).LeftJoin((q, m) => q.FkId == m.Id)
+ // .InnerJoin((q, m, t) => m.FkTypeId == t.Id)
+ // .Select((q, m, t) => new BaseMaterialListDto2()
+ // {
+ // Type_Name = t.Name,
+ // Type_Code = t.Code,
+ // }, true)
+ // .ToList()
+ // .Adapt>()
+ // ;
- }
+ // }
- ///
- /// 删除绑定关系
- ///
- ///
- ///
- public int DeleteBOMBind(string id, string parent_id)
- {
- return Context.Deleteable().Where(it => it.FkId == id)
- .Where(it => it.FkParentId == parent_id)
- .ExecuteCommand();
- }
- ///
- /// 增加绑定关系
- ///
- ///
- ///
- public int ADDBOMBind(string id, string parent_id)
- {
- BaseMaterialBom bom = new BaseMaterialBom();
- bom.FkId = id;
- bom.FkParentId = parent_id;
- bom.CreatedTime = DateTime.Now;
- return Context.Insertable(bom).ExecuteCommand();
- }
+ // ///
+ // /// 删除绑定关系
+ // ///
+ // ///
+ // ///
+ // public int DeleteBOMBind(string id, string parent_id)
+ // {
+ // return Context.Deleteable().Where(it => it.FkId == id)
+ // .Where(it => it.FkParentId == parent_id)
+ // .ExecuteCommand();
+ // }
+ // ///
+ // /// 增加绑定关系
+ // ///
+ // ///
+ // ///
+ // public int ADDBOMBind(string id, string parent_id)
+ // {
+ // BaseMaterialBom bom = new BaseMaterialBom();
+ // bom.FkId = id;
+ // bom.FkParentId = parent_id;
+ // bom.CreatedTime = DateTime.Now;
+ // return Context.Insertable(bom).ExecuteCommand();
+ // }
- ///
- /// 获取未绑定的BOM结构
- ///
- ///
- ///
- public PagedInfo Achieve_BOM_no_bind(BaseMaterialListQueryDto3 query)
- {
- // 成品id 的Bom结构
- string[] binded_array = Context.Queryable().Where(it => it.FkParentId == query.Id).Select(it => it.FkId).ToArray();
-
- //在原材料和半成品中 选择
- List typeList = Context.Queryable().ToList();
- int[] leaf = FindLeafNodes(typeList, 1).Select(it => it.Id).ToArray();
- int[] leaf2 = FindLeafNodes(typeList, 5).Select(it => it.Id).ToArray();
- int[] leaf3 = leaf.Concat(leaf2).ToArray();
- var predicate = Expressionable.Create()
- .AndIF(!string.IsNullOrEmpty(query.Name), it => it.Name.Contains(query.Name))
- .AndIF(!string.IsNullOrEmpty(query.Code), it => it.Name.Contains(query.Code))
- .AndIF(!string.IsNullOrEmpty(query.CustomerCode), it => it.Name.Contains(query.CustomerCode))
- ;
+ // ///
+ // /// 获取未绑定的BOM结构
+ // ///
+ // ///
+ // ///
+ // public PagedInfo Achieve_BOM_no_bind(BaseMaterialListQueryDto3 query)
+ // {
+ // // 成品id 的Bom结构
+ // string[] binded_array = Context.Queryable().Where(it => it.FkParentId == query.Id).Select(it => it.FkId).ToArray();
- var qua = Context.Queryable().Where(it => !binded_array.Contains(it.Id))
- .Where(predicate.ToExpression())
- .Where(it => leaf3.Contains(it.FkTypeId.Value));
- return Context.Queryable(qua).InnerJoin((q, t) => q.FkTypeId == t.Id)
- .Select((q, t) => new BaseMaterialListDto2()
- {
- Type_Name = t.Name,
- Type_Code = t.Code,
- }, true).ToPage(query);
+ // //在原材料和半成品中 选择
+ // List typeList = Context.Queryable().ToList();
+ // int[] leaf = FindLeafNodes(typeList, 1).Select(it => it.Id).ToArray();
+ // int[] leaf2 = FindLeafNodes(typeList, 5).Select(it => it.Id).ToArray();
+ // int[] leaf3 = leaf.Concat(leaf2).ToArray();
+ // var predicate = Expressionable.Create()
+ // .AndIF(!string.IsNullOrEmpty(query.Name), it => it.Name.Contains(query.Name))
+ // .AndIF(!string.IsNullOrEmpty(query.Code), it => it.Name.Contains(query.Code))
+ // .AndIF(!string.IsNullOrEmpty(query.CustomerCode), it => it.Name.Contains(query.CustomerCode))
+ // ;
+
+ // var qua = Context.Queryable().Where(it => !binded_array.Contains(it.Id))
+ // .Where(predicate.ToExpression())
+ // .Where(it => leaf3.Contains(it.FkTypeId.Value));
+ // return Context.Queryable(qua).InnerJoin((q, t) => q.FkTypeId == t.Id)
+ // .Select((q, t) => new BaseMaterialListDto2()
+ // {
+ // Type_Name = t.Name,
+ // Type_Code = t.Code,
+ // }, true).ToPage(query);
- }
+ // }
- public static List FindLeafNodes( List nodes,int ancestorId)
- {
- List leafNodes = new List();
+ // public static List FindLeafNodes(List nodes, int ancestorId)
+ // {
+ // List leafNodes = new List();
- void FindLeaves(int currentId)
- {
- // 查找当前ID的直接子节点
- var children = nodes.Where(n => n.ParentId == currentId).ToList();
+ // void FindLeaves(int currentId)
+ // {
+ // // 查找当前ID的直接子节点
+ // var children = nodes.Where(n => n.ParentId == currentId).ToList();
- // 如果没有子节点,说明是叶子节点
- if (!children.Any())
- {
- leafNodes.Add(nodes.FirstOrDefault(n => n.Id == currentId));
- }
- else
- {
- // 对每个子节点递归调用FindLeaves
- foreach (var child in children)
- {
- FindLeaves(child.Id);
- }
- }
- }
+ // // 如果没有子节点,说明是叶子节点
+ // if (!children.Any())
+ // {
+ // leafNodes.Add(nodes.FirstOrDefault(n => n.Id == currentId));
+ // }
+ // else
+ // {
+ // // 对每个子节点递归调用FindLeaves
+ // foreach (var child in children)
+ // {
+ // FindLeaves(child.Id);
+ // }
+ // }
+ // }
- // 从指定的祖先节点开始查找
- FindLeaves(ancestorId);
+ // // 从指定的祖先节点开始查找
+ // FindLeaves(ancestorId);
- return leafNodes;
- }
+ // return leafNodes;
+ // }
- ///
- /// bom视图
- ///
- ///
- ///
- public BaseParseNode ShowBOMView(string id)
- {
- //TODO 获取成品id的一级子集 bom
+ // ///
+ // /// bom视图
+ // ///
+ // ///
+ // ///
+ // public BaseParseNode ShowBOMView(string id)
+ // {
+ // //TODO 获取成品id的一级子集 bom
- return null;
- }
+ // return null;
+ // }
- }
+ //}
}
diff --git a/DOAN.Service/MES/base/BaseMaterialListService.cs b/DOAN.Service/MES/base/BaseMaterialListService.cs
index d66ddc1..d8534a3 100644
--- a/DOAN.Service/MES/base/BaseMaterialListService.cs
+++ b/DOAN.Service/MES/base/BaseMaterialListService.cs
@@ -28,23 +28,23 @@ namespace DOAN.Service.MES.base_
///
public PagedInfo GetList(BaseMaterialListQueryDto parm)
{
-
-
+
+
var predicate = Expressionable.Create()
.AndIF(!string.IsNullOrEmpty(parm.Name), it => it.Name == parm.Name)
.AndIF(!string.IsNullOrEmpty(parm.Code), it => it.Code == parm.Code)
.AndIF(!string.IsNullOrEmpty(parm.CustomerCode), it => it.CustomerCode == parm.CustomerCode)
.AndIF(!string.IsNullOrEmpty(parm.Description), it => it.Description == parm.Description)
- .AndIF(parm.FkTypeId >= 0, it => it.FkTypeId == parm.FkTypeId)
-
+ .AndIF(!string.IsNullOrEmpty(parm.FkMaterialTypeCode) , it => it.FkMaterialTypeCode == parm.FkMaterialTypeCode)
+
.AndIF(parm.TimeRange != null && parm.TimeRange.Length == 2 && parm.TimeRange[0] > DateTime.MinValue, it => it.CreatedTime >= parm.TimeRange[0])
.AndIF(parm.TimeRange != null && parm.TimeRange.Length == 2 && parm.TimeRange[1] > DateTime.MinValue, it => it.CreatedTime <= parm.TimeRange[1]);
var query01 = Queryable()
-
+
.Where(predicate.ToExpression());
- var response = Context.Queryable(query01).LeftJoin((q, t) => q.FkTypeId == t.Id)
+ var response = Context.Queryable(query01).LeftJoin((q, t) => q.FkMaterialTypeCode == t.Code)
.LeftJoin((q, t, s) => q.FkSupplierId == s.Id)
.Select((q, t, s) => new BaseMaterialListDto2
{