| | |
| | | using System; |
| | | using OfficeOpenXml.Style; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | |
| | | using WIDESEA_ISerialPortRepository; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseServices; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | | |
| | |
| | | { |
| | | public class ArticleInfomServer : ServiceBase<Dt_ArticleInfom, IArticleInfomRepository>, IArticleInfomServer |
| | | { |
| | | public ArticleInfomServer(IArticleInfomRepository BaseDal) : base(BaseDal) |
| | | private readonly IProcessRepository _processRepository; |
| | | private readonly IPutakeRepository _ptakeRepository; |
| | | public ArticleInfomServer(IArticleInfomRepository BaseDal, IProcessRepository processRepository, IPutakeRepository ptakeRepository) : base(BaseDal) |
| | | { |
| | | |
| | | _processRepository = processRepository; |
| | | _ptakeRepository = ptakeRepository; |
| | | } |
| | | public override PageGridData<Dt_ArticleInfom> GetPageData(PageDataOptions options) |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | //public WebResponseContent PutPossorArticl() |
| | | //{ |
| | | // try |
| | | // { |
| | | // var articl = BaseDal.QueryData(); |
| | | // var process = _processRepository.QueryData(); |
| | | // var putake = _ptakeRepository.QueryData(); |
| | | |
| | | // // å
è·ååºç¡æ¥è¯¢ç»æ |
| | | // var query = from a in articl |
| | | // from p in process |
| | | // from t in putake |
| | | // where (a.ID == p.ArticleTowid || a.ID == p.ArticleOneid) |
| | | // && (t.Pustatus == 0 || t.Pustatus == 2) |
| | | // orderby p.CraftType |
| | | // select new |
| | | // { |
| | | // t.Njtakeid, |
| | | // t.Pustatus, |
| | | // t.Grouptype, |
| | | // a.ArticleName, |
| | | // a.ArticleType |
| | | // }; |
| | | |
| | | // // æ ArticleType å Pustatus ç»åå»é |
| | | // var result = query |
| | | // .GroupBy(x => new { x.ArticleType, x.Pustatus }) // æç±»ååç¶æåç» |
| | | // .Select(g => g.First()) // æ¯ç»åç¬¬ä¸æ¡ |
| | | // .OrderBy(x => x.Grouptype) // å¯ä»¥ä¿æåææåº |
| | | // .ToList(); |
| | | // return new WebResponseContent { Status = true, Data = result }; |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | |
| | | // return new WebResponseContent { Status = false, Message = "é误ï¼" + ex.Message }; |
| | | // } |
| | | |
| | | //} |
| | | public WebResponseContent PutPossorArticl() |
| | | { |
| | | try |
| | | { |
| | | var articl = BaseDal.QueryData(); |
| | | var process = _processRepository.QueryData(); |
| | | var putake = _ptakeRepository.QueryData(); |
| | | |
| | | // å
è·ååºç¡æ¥è¯¢ç»æ |
| | | var query = ( |
| | | from t in putake |
| | | join p in process on t.Grouptype equals p.CraftType |
| | | join a in articl on p.ArticleOneid equals a.ID |
| | | where t.Pustatus == 0 || t.Pustatus == 2 |
| | | select new |
| | | { |
| | | t.Njtakeid, |
| | | t.Pustatus, |
| | | t.Grouptype, |
| | | a.ArticleName, |
| | | a.ArticleType |
| | | }) |
| | | .Union( |
| | | from t in putake |
| | | join p in process on t.Grouptype equals p.CraftType |
| | | join a in articl on p.ArticleTowid equals a.ID |
| | | where t.Pustatus == 0 || t.Pustatus == 2 |
| | | select new |
| | | { |
| | | t.Njtakeid, |
| | | t.Pustatus, |
| | | t.Grouptype, |
| | | a.ArticleName, |
| | | a.ArticleType |
| | | }); |
| | | |
| | | var result = query |
| | | .GroupBy(x => new { x.ArticleType, x.Pustatus, x.Grouptype,x.Njtakeid }) // æ ¹æ®å¥çç±»ååä»»å¡ç¶æï¼ä»¥åç»å«åç» |
| | | .Select(g => g.First()) // æ¯ç»åç¬¬ä¸æ¡ |
| | | .OrderBy(x => x.Grouptype) |
| | | .ToList(); |
| | | |
| | | return new WebResponseContent { Status = true, Data = result }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | return new WebResponseContent { Status = false, Message = "é误ï¼" + ex.Message }; |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |