/// <summary> /// 添加和更改 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <bool> CreateAndUpdate(ICExceptionDto input) { try { var entity = await JIT_ICException.GetAll() .SingleOrDefaultAsync(p => p.FID == input.FID && p.FSrcID == input.FSrcID); var emp = await JIT_Employee.SingleAsync(p => p.FUserId == AbpSession.UserId); if (entity == null) { entity = new DIME2Barcode.Entities.ICException() { FID = Guid.NewGuid().ToString(), FSrcID = input.FSrcID, FBiller = emp.FName, FNote = input.FNote, FTime = input.FTime, FRemark = input.FRemark, FRecoverTime = input.FRecoverTime }; await JIT_ICException.InsertAsync(entity); } else { entity.FBiller = emp.FName; entity.FNote = input.FNote; entity.FTime = input.FTime; entity.FRemark = input.FRemark; entity.FRecoverTime = input.FRecoverTime; await JIT_ICException.UpdateAsync(entity); } return(true); } catch (Exception e) { Console.WriteLine(e); return(false); } }
/// <summary> /// 返回余数 /// </summary> public async Task <PagedResultDto <DIME2Barcode.Entities.VW_YSQty> > GetAllYSQty( PagedAndSortedResultRequestDto input) { var query = JIT_ICMODispBill.GetAll().Join(JIT_ICMOSchedule.GetAll(), Z => Z.FMOInterID, Y => Y.FMOInterID, (Z, Y) => new { Z.FID, Z.FBillNo, Z.FBiller, Z.FDate, Z.FStatus, Z.employee, Y.FItemName, Y.FItemID }).Join(JIT_t_ICItem.GetAll(), Y => Y.FItemID, X => X.FItemID, (X, Y) => new { X.FID, X.FBillNo, X.FBiller, X.FDate, X.FStatus, X.employee, X.FItemName, Y.F_102 }) .Join(JIT_ICMOInspectBill.GetAll(), A => A.FID, B => B.ICMODispBillID, (A, B) => new { A.FID, A.FBillNo, A.FBiller, A.FDate, FBillNo2 = B.FBillNo, B.BatchNum, B.FYSQty, B.FInspector, B.FInspectTime, A.employee.FName, // A.FStatus, A.FItemName, A.F_102 }) .Join(JIT_Employee.GetAll(), B => B.FInspector.ToInt(), C => C.FUserId, (B, C) => new { B.FID, B.FBillNo, B.FBiller, B.FDate, B.FBillNo2, B.BatchNum, FYSQty = B.FYSQty - JIT_RemainderLCLMx.GetAll().Where(w => w.ICMOInspectBillId == B.FID).Sum(s => s.SpelledQty), FInspector = C.FName, B.FInspectTime, B.FName, B.FStatus, B.FItemName, B.F_102 }) .Where(A => A.FStatus >= PublicEnum.ICMODispBillState.已检验.EnumToInt() && A.FYSQty > 0); var data = await query.PageBy(input).ToListAsync(); var list = data.MapTo <List <DIME2Barcode.Entities.VW_YSQty> >(); return(new PagedResultDto <DIME2Barcode.Entities.VW_YSQty>(query.Count(), list)); }