| | |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | | return db |
| | | .Queryable<QsItemOqcReq, Womdaa, MesItems, MesInvItemIns, Womdab, |
| | | MesInvTransaction, RKJDaa001>( |
| | | (a, da, b, c, d, ca, m) => new JoinQueryInfos( |
| | | JoinType.Left, da.Daa001 == a.BillNo, |
| | | JoinType.Left, a.ItemId == b.Id, |
| | | JoinType.Left, a.BillNo == c.BillNo, |
| | | JoinType.Left, c.CbillNo == d.Dab001, |
| | | JoinType.Left, |
| | | c.TransctionNo == ca.TransactionNo.ToString() && |
| | | c.Company == ca.Company && c.Factory == ca.Factory, |
| | | JoinType.Left, c.Id == m.ItemInId && a.ItemNo == m.ItemNo |
| | | )) |
| | | .Select((a, da, b, c, d, ca, m) => new QsItemOqcReq |
| | | { |
| | | BillNo = a.BillNo, |
| | | Remarks = a.Remarks, |
| | | Id = a.Id, |
| | | CreateDate = a.CreateDate, |
| | | CreateBy = a.CreateBy, |
| | | FcheckResu = a.FcheckResu, |
| | | ItemNo = a.ItemNo, |
| | | FcheckBy = a.FcheckBy, |
| | | FcheckDate = a.FcheckDate, |
| | | ReleaseNo = a.ReleaseNo, |
| | | // 添加其他字段 |
| | | // 如果在 QsItemOqcReq 中定义了额外字段,则需要将它们赋值 |
| | | // 例如: |
| | | ItemName = b.ItemName, |
| | | ItemModel = b.ItemModel, |
| | | TaskNo = c.TaskNo, |
| | | CbillNo = c.CbillNo, |
| | | Dab001 = d.Dab001, |
| | | Daa015 = da.Daa015, |
| | | LineNo = c.LineNo, |
| | | Quantity = m.Quantity |
| | | }).OrderBy(a => a.CreateDate, OrderByType.Desc) |
| | | .ToPageList(queryObj.PageIndex, queryObj.Limit); |
| | | .Queryable<QsItemOqcReq, MesItems, MesInvItemIns, Womdaa, MesInvTransaction, RKJDaa001, MesLine>( |
| | | (a, b, c, da, ca, m, l) => new JoinQueryInfos( |
| | | JoinType.Left, a.ItemNo == b.Id.ToString(), |
| | | JoinType.Left, a.BillNo == c.BillNo, |
| | | JoinType.Left, da.Daa001 == c.RbillNo, |
| | | JoinType.Left, c.TransctionNo == ca.TransactionNo.ToString() |
| | | && c.Company == ca.Company |
| | | && c.Factory == ca.Factory, |
| | | JoinType.Left, m.ItemInId == c.Id, |
| | | JoinType.Left, l.LineNo == da.Daa015 |
| | | )) |
| | | //.WhereIF(!"PL017".Equals(queryObj.createUser), |
| | | // (a, b, c, da, ca, m) => lineNo.Contains(da.Daa015)) |
| | | .WhereIF(!string.IsNullOrEmpty(queryObj.id), (a, b, c, da, ca, m, l) => a.Id.ToString() == queryObj.id) |
| | | .WhereIF( |
| | | StringUtil.IsNotNullOrEmpty(queryObj.result) && "未完成".Equals(queryObj.result), |
| | | (a, b, c, da, ca, m, l) => a.FcheckResu == null) |
| | | .WhereIF( |
| | | StringUtil.IsNotNullOrEmpty(queryObj.result) && !"未完成".Equals(queryObj.result), |
| | | (a, b, c, da, ca, m, l) => a.FcheckResu != null) |
| | | .Select((a, b, c, da, ca, m, l) => new QsItemOqcReq |
| | | { |
| | | BillNo = a.BillNo, |
| | | Remarks = a.Remarks, |
| | | Id = a.Id, |
| | | CreateDate = a.CreateDate, |
| | | CreateBy = a.CreateBy, |
| | | FcheckResu = a.FcheckResu, |
| | | ItemNo = b.ItemNo, |
| | | FcheckBy = a.FcheckBy, |
| | | FcheckDate = a.FcheckDate, |
| | | ReleaseNo = a.ReleaseNo, |
| | | ItemName = b.ItemName, |
| | | ItemModel = b.ItemModel, |
| | | TaskNo = c.RbillNo, |
| | | //CbillNo = c.CbillNo, |
| | | //LineNo = da.Daa015, |
| | | LineNo = l.LineName, |
| | | Quantity = m.Quantity |
| | | }) |
| | | .OrderBy(a => a.CreateDate, OrderByType.Desc) |
| | | .ToPageList(queryObj.PageIndex, queryObj.Limit); |
| | | } |
| | | |
| | | //删除主表并且连级删除子表和孙表 |