| | |
| | | using PadApplication.DB; |
| | | using PadApplication.Entites.DbModels; |
| | | using PadApplication.Entites.Dto; |
| | | using SqlSugar; |
| | | |
| | | namespace PadApplication.Services; |
| | | |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®å·¥åIDè·åæå°ä¿¡æ¯ |
| | | /// æ ¹æ®å·¥åIDè·åæ¥å·¥ä¿¡æ¯ |
| | | /// </summary> |
| | | /// <param name="query">å
å«å·¥åIDçæ¥è¯¢æ¡ä»¶</param> |
| | | /// <returns>å·¥åæå°ä¿¡æ¯</returns> |
| | | /// <returns>å·¥åæ¥å·¥ä¿¡æ¯</returns> |
| | | public VPrint GetWomdaaPrintById(OrderMachineDto query) |
| | | { |
| | | var vPrint = Db.Queryable<VPrint>() |
| | | .Where(s => s.Id == query.OrderId).First(); |
| | | vPrint.RmiPrQty = |
| | | (int)Math.Ceiling( |
| | | (double)((vPrint.Bqty - vPrint.SQuantity) / vPrint.Qqty)); |
| | | .Where(s => s.Id == query.OrderId) |
| | | .First(); |
| | | |
| | | if (vPrint == null) |
| | | return null; |
| | | |
| | | // 鲿¢é¤é¶å空å¼å¼å¸¸ |
| | | var bqty = vPrint.Bqty ?? 0; |
| | | var sQuantity = vPrint.SQuantity ?? 0; |
| | | var qqty = vPrint.Qqty ?? 0; |
| | | |
| | | if (qqty == 0) |
| | | { |
| | | vPrint.RmiPrQty = 0; |
| | | } |
| | | else |
| | | { |
| | | // å©ä½å¯æå°å¼ æ° = (坿尿»æ°é - å·²æå°æ°é) / æ åå
è£
æ°ï¼åä¸åæ´ |
| | | var remain = bqty - sQuantity; |
| | | vPrint.RmiPrQty = remain > 0 ? (int)Math.Ceiling((double)remain / (double)qqty) : 0; |
| | | } |
| | | |
| | | return vPrint; |
| | | } |
| | | |
| | | public (List<MesReportingBgDto> tbBillList, int totalCount) GetByBillNoBG( |
| | | string billNo, string machineNo, DateTime? from, DateTime? to, int pageIndex, int pageSize) |
| | | { |
| | | var query = Db.Queryable<MesReporting>() |
| | | .Where(x => x.BillNo == billNo); |
| | | |
| | | if (!string.IsNullOrWhiteSpace(machineNo)) |
| | | query = query.Where(x => x.MachineNo == machineNo); |
| | | |
| | | if (from.HasValue) |
| | | query = query.Where(x => x.BgDate >= from.Value); |
| | | |
| | | if (to.HasValue) |
| | | query = query.Where(x => x.BgDate < to.Value.AddDays(1)); |
| | | |
| | | var totalCount = query.Count(); |
| | | |
| | | var tbBillList = query.OrderBy(x => x.BgDate, OrderByType.Desc) |
| | | .Select(x => new MesReportingBgDto |
| | | { |
| | | Id = (long)x.Id, |
| | | BillNo = x.BillNo, |
| | | ItemNo = x.ItemNo, |
| | | MachineNo = x.MachineNo, |
| | | StaffNo = x.BgPerson, |
| | | StaffName = x.BgPerson, // 妿ç¬ç«å§ååæ®µå¯æ¿æ¢ |
| | | BgDate = x.BgDate, |
| | | KgQty = SqlFunc.ToInt32(x.CjQty), |
| | | InitialValue = SqlFunc.ToInt32(x.CsQty), |
| | | ProductionCount = SqlFunc.ToInt32(x.CjQty), |
| | | SQuantity = SqlFunc.ToInt32(x.OkQty), |
| | | OkQty = SqlFunc.ToInt32(x.OkQty), |
| | | NgQty = SqlFunc.ToInt32(x.BfQty) |
| | | }) |
| | | .ToPageList((pageIndex < 1 ? 1 : pageIndex), (pageSize < 1 ? 200 : (pageSize > 1000 ? 1000 : pageSize)), ref totalCount); |
| | | |
| | | return (tbBillList, totalCount); |
| | | } |
| | | } |