| | |
| | | using MES.Service.DB; |
| | | using System.Net.NetworkInformation; |
| | | using Masuit.Tools.Models; |
| | | using MES.Service.DB; |
| | | using MES.Service.Dto.service; |
| | | using MES.Service.Modes; |
| | | using MES.Service.util; |
| | |
| | | |
| | | |
| | | //获取工单号 |
| | | public List<RKJDaa001> GetDaa001s(string lineNo) |
| | | public List<RkDaa002> GetDaa001s(string lineNo) |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | return db.Queryable<RKJDaa001>() |
| | | .Where(t => t.LineNo == lineNo) |
| | | .OrderBy(t => t.BillNo, OrderByType.Desc) |
| | | .ToList(); |
| | | return null; |
| | | } |
| | | |
| | | //根据检验标准来计算检验个数 |
| | |
| | | { |
| | | var commit = 0; |
| | | |
| | | xj.CreateBy = userNo; |
| | | xj.CreateDate = DateTime.Now; |
| | | // xj.CreateBy = userNo; |
| | | // xj.CreateDate = DateTime.Now; |
| | | |
| | | var pid = db.Insertable(xj).ExecuteReturnIdentity(); |
| | | var qsItemOqcReq = db.Queryable<QsItemOqcReq>() |
| | | .Where(s => s.Id == xj.Id) |
| | | .First(); |
| | | |
| | | decimal? pid = 0; |
| | | pid = qsItemOqcReq == null ? db.Insertable(xj).ExecuteReturnIdentity() : qsItemOqcReq.Id; |
| | | |
| | | xj.Id = pid; |
| | | |
| | |
| | | .ExecuteCommand(); |
| | | }); |
| | | |
| | | if (FcheckResu.Equals("不合格")) |
| | | //自动生成入库检异常对策 |
| | | saveDetect02(detail.Gid, detail.CreateBy); |
| | | //if (FcheckResu.Equals("不合格")) |
| | | // //自动生成入库检异常对策 |
| | | // saveDetect02(detail.Gid, detail.CreateBy); |
| | | |
| | | |
| | | var oqcReq = db.Queryable<QsItemOqcReq>() |
| | | .Where(s => s.Id == detail.Gid) |
| | | .Select<string?>(s=>s.BillNo) |
| | | .First(); |
| | | |
| | | if (oqcReq != null) |
| | | { |
| | | //FSTATUS |
| | | //CHECK_RES |
| | | db.Updateable<MesInvItemIns>() |
| | | .SetColumns(s => s.Fstatus == 1) |
| | | .SetColumns(s=>s.CheckRes == FcheckResu) |
| | | .Where(s => s.BillNo == oqcReq) |
| | | .ExecuteCommand(); |
| | | } |
| | | |
| | | return useTransactionWithOracle; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | public List<QsItemOqcReq> getPage(XJPageResult queryObj) |
| | | public (List<QsItemOqcReq> items, int TotalCount) getPage(XJPageResult queryObj) |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | | var id = Convert.ToDecimal(queryObj.id); |
| | | var totalCount = 0; |
| | | |
| | | string[]? lineNo = null; |
| | | var qsItemOqcReqs = db.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) |
| | | .WhereIF( |
| | | StringUtil.IsNotNullOrEmpty(queryObj.SearchValue), |
| | | (a, b, c, da, ca, m, l) => a.ReleaseNo.Contains(queryObj.SearchValue) |
| | | || b.ItemNo.Contains(queryObj.SearchValue) |
| | | ) |
| | | .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, ref totalCount); |
| | | |
| | | if (StringUtil.IsNotNullOrEmpty(queryObj.createUser)) |
| | | lineNo = _baseService.getUserLineNo(queryObj.createUser); |
| | | |
| | | return db.Queryable<QsItemOqcReq, RKJDaa001>((a, b) => |
| | | new JoinQueryInfos(JoinType.Left, a.BillNo == b.BillNo)) |
| | | .WhereIF(lineNo != null && lineNo.Length > 0, |
| | | (a, b) => lineNo.Contains(b.LineNo)) |
| | | .WhereIF( |
| | | StringUtil.IsNotNullOrEmpty(queryObj.result) && |
| | | "未完成".Equals(queryObj.result), |
| | | (a, b) => a.FcheckResu == null) |
| | | .WhereIF( |
| | | StringUtil.IsNotNullOrEmpty(queryObj.result) && |
| | | !"未完成".Equals(queryObj.result), |
| | | (a, b) => a.FcheckResu != null) |
| | | .WhereIF(id > 0, (a, b) => a.Id == id) |
| | | .Select((a, b) => new QsItemOqcReq |
| | | { |
| | | Id = a.Id, |
| | | ReleaseNo = a.ReleaseNo, |
| | | BillNo = a.BillNo, |
| | | LineName = b.LineNo, |
| | | Quantity = b.Quantity, |
| | | CreateBy = a.CreateBy, |
| | | CreateDate = a.CreateDate, |
| | | ItemNo = a.ItemNo, |
| | | Mocode = b.Mocode, |
| | | BoardModel = b.BoardModel, |
| | | TaskNo = b.TaskNo, |
| | | FcheckResu = a.FcheckResu, |
| | | FcheckBy = a.FcheckBy, |
| | | FcheckDate = a.FcheckDate, |
| | | MoidNum = a.MoidNum, |
| | | BoardName = b.BoardName, |
| | | ColorName = b.ColorName, |
| | | Remarks = a.Remarks |
| | | }).OrderBy(a => a.CreateDate, OrderByType.Desc) |
| | | .ToPageList(queryObj.PageIndex, queryObj.Limit); |
| | | return (qsItemOqcReqs, totalCount); |
| | | } |
| | | |
| | | //删除主表并且连级删除子表和孙表 |
| | |
| | | |
| | | return Convert.ToInt32(rkjDto.gid); |
| | | } |
| | | |
| | | public List<MesInvItemInCDetails2> GetRKDetail(RKJDto rkjDto) |
| | | { |
| | | //物料条码和物料编码,数量 MES_INV_ITEM_IN_C_DETAILS2 |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | | var oqcReq = db.Queryable<QsItemOqcReq>() |
| | | .Where(s => s.Id == rkjDto.gid) |
| | | .Select<string?>(s => s.BillNo) |
| | | .First(); |
| | | |
| | | if (oqcReq != null) |
| | | { |
| | | //FSTATUS |
| | | //CHECK_RES |
| | | var mesInvItemIns = db.Queryable<MesInvItemIns>() |
| | | .Where(s => s.BillNo == oqcReq).First(); |
| | | |
| | | return db.Queryable<MesInvItemInCDetails2>() |
| | | .Where(a=>a.ItemInId == mesInvItemIns.Id).ToList(); |
| | | } |
| | | |
| | | return new List<MesInvItemInCDetails2>(); |
| | | } |
| | | } |