| | |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | public List<MesItems> GetWomdab(string daa001) |
| | | { |
| | | //if (string.IsNullOrEmpty(ItemNo)) |
| | | //{ |
| | | // throw new ArgumentException("检验单号不能为空"); |
| | | //} |
| | | |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | try |
| | | { |
| | | return db.Queryable<Womdab>() |
| | | .LeftJoin<MesItems>((w, m) => w.Dab003 == m.ItemId.ToString()) // 需要替换为实际的关联字段 |
| | | .Where((w, m) => w.Dab001 == daa001) |
| | | .OrderBy((w, m) => w.Dab003, OrderByType.Desc) |
| | | // .ThenBy((w, m) => w.CreateDate, OrderByType.Desc) |
| | | .Select((w, m) => new MesItems |
| | | { |
| | | ItemNo = m.ItemNo, |
| | | ItemName = m.ItemName, |
| | | ItemModel = m.ItemModel |
| | | }).ToList(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw new Exception($"查询附件信息失败: {ex.Message}"); |
| | | } |
| | | |
| | | } |
| | | |
| | | public List<MesItems> GetWomdabById(string daa001,string ItemNo) |
| | | { |
| | | //if (string.IsNullOrEmpty(ItemNo)) |
| | | //{ |
| | | // throw new ArgumentException("检验单号不能为空"); |
| | | //} |
| | | |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | try |
| | | { |
| | | return db.Queryable<Womdab>() |
| | | .LeftJoin<MesItems>((w, m) => w.Dab003 == m.ItemId.ToString()) // 需要替换为实际的关联字段 |
| | | .Where((w, m) => w.Dab001 == daa001 && m.ItemNo.Contains(ItemNo)) |
| | | .OrderBy((w, m) => w.Dab003, OrderByType.Desc) |
| | | // .ThenBy((w, m) => w.CreateDate, OrderByType.Desc) |
| | | .Select((w, m) => new MesItems |
| | | { |
| | | ItemNo = m.ItemNo, |
| | | ItemName = m.ItemName, |
| | | ItemModel = m.ItemModel |
| | | }).ToList(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw new Exception($"查询附件信息失败: {ex.Message}"); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | return Ok(); |
| | | } |
| | | |
| | | [HttpPost("getWomdab")] |
| | | public ResponseResult getWomdab([FromBody] JObject data) |
| | | { |
| | | var daa001 = data["daa001"]?.ToString(); |
| | | try |
| | | { |
| | | dynamic resultInfos = new System.Dynamic.ExpandoObject(); |
| | | var tbBillList = new LljService().GetWomdab(daa001); |
| | | if (tbBillList == null || tbBillList.Count == 0) |
| | | { |
| | | return new ResponseResult |
| | | { |
| | | status = 1, |
| | | message = "该检验单未上传附件信息!", |
| | | data = null |
| | | }; |
| | | } |
| | | resultInfos.tbBillList = tbBillList; |
| | | return new ResponseResult |
| | | { |
| | | status = 0, |
| | | message = "OK", |
| | | data = resultInfos |
| | | }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return ResponseResult.ResponseError(ex); |
| | | } |
| | | } |
| | | |
| | | [HttpPost("GetWomdabById")] |
| | | public ResponseResult GetWomdabById([FromBody] JObject data) |
| | | { |
| | | var daa001 = data["daa001"]?.ToString(); |
| | | var ItemNo = data["ItemNo"]?.ToString(); |
| | | try |
| | | { |
| | | dynamic resultInfos = new System.Dynamic.ExpandoObject(); |
| | | var tbBillList = new LljService().GetWomdabById(daa001,ItemNo); |
| | | if (tbBillList == null || tbBillList.Count == 0) |
| | | { |
| | | return new ResponseResult |
| | | { |
| | | status = 1, |
| | | message = "该检验单未上传附件信息!", |
| | | data = null |
| | | }; |
| | | } |
| | | resultInfos.tbBillList = tbBillList; |
| | | return new ResponseResult |
| | | { |
| | | status = 0, |
| | | message = "OK", |
| | | data = resultInfos |
| | | }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return ResponseResult.ResponseError(ex); |
| | | } |
| | | } |
| | | |
| | | } |