/// <summary> /// 生成质检单 /// </summary> /// <param name="ICMODispBillID">任务单号ID</param> /// <param name="FAuxQty">汇报数</param> public bool Create(string ICMODispBillID, decimal FAuxQty, string BatchNum) { try { var result = JIT_VW_MODispBillList.GetAll().Where(w => w.FID == ICMODispBillID).FirstOrDefault() ?? new VW_MODispBillList(); ICMOInspectBill icm = new ICMOInspectBill() { FID = Guid.NewGuid().ToString(), FMOInterID = 0, FBillNo = "ICM" + DateTime.Now.ToString("yyyyMMddHHmmss") + new Random().Next(1, 10).ToString(), FTranType = 0, FStatus = 0, FOperID = result.FOperID, FWorkcenterID = result.FWorkcenterID, FMachineID = 0, FAuxQty = FAuxQty, FCheckAuxQty = 0, FPassAuxQty = 0, FFailAuxQty = 0, FFailAuxQtyP = 0, FFailAuxQtyM = 0, FPassAuxQtyP = 0, FPassAuxQtyM = 0, FWorker = AbpSession.UserId.ToString(), FBiller = AbpSession.UserId.ToString(), FBillTime = DateTime.Now, ICMODispBillID = ICMODispBillID, FYSQty = 0, BatchNum = BatchNum }; JIT_ICMOInspectBill.InsertOrUpdate(icm); // 所有汇报 var ICMODispBillList = JIT_ICMOInspectBill.GetAll().Where(w => w.ICMODispBillID == ICMODispBillID).ToList(); // var query1 = JIT_ICMODispBill.GetAll().Where(w => w.FID == ICMODispBillID).SingleOrDefault(); query1.FFInspectAuxQty = ICMODispBillList.Sum(s => s.FFailAuxQty) + icm.FCheckAuxQty; query1.FFinishAuxQty = ICMODispBillList.Sum(s => s.FAuxQty) + icm.FAuxQty; query1.FFailAuxQty = ICMODispBillList.Sum(s => s.FFailAuxQty) + icm.FFailAuxQty; query1.FPassAuxQty = ICMODispBillList.Sum(s => s.FPassAuxQty) + icm.FPassAuxQty; JIT_ICMODispBill.UpdateAsync(query1); return(true); } catch (Exception e) { Console.WriteLine(e); return(false); } }
public PagedResultDto <DIME2Barcode.Entities.VW_MODispBillList> GetAll(VW_MODispBillListGetAllInput input) { var query = JIT_VW_MODispBillList.GetAll().Where(w => w.操作者 == AbpSession.UserId && w.FStatus == input.FStatus); query = input.FStatus == 0 ? query.Where(p => p.FStatus == input.FStatus) : query.Where(p => p.FStatus > 0); query = input.FClosed.HasValue ? query.Where(p => p.FClosed == input.FClosed) : query; var data = query.OrderByDescending(p => p.FStartTime).OrderByDescending(p => p.FBillTime).PageBy(input).ToList(); var count = query.Count(); var list = data.MapTo <List <DIME2Barcode.Entities.VW_MODispBillList> >(); return(new PagedResultDto <DIME2Barcode.Entities.VW_MODispBillList>(count, list)); }
/// <summary> /// 查询任务数量 /// </summary> public async Task <List <TaskQty> > GetTaskQty(string StrKey) { string isAll = StrKey; StrKey = "," + StrKey + ","; List <TaskQty> listTaskQty = new List <TaskQty>(); // 开始形成数据 if (isAll == "*" || StrKey.Contains(TaskType.派工任务.ToDescription())) { TaskQty tmpTaskQty = new TaskQty() { StrKey = TaskType.派工任务.ToDescription().Replace(",", ""), Total = await JIT_VW_MODispBillList.GetAll() .Where(w => w.操作者 == AbpSession.UserId && w.FStatus == 0).CountAsync(), BZ = "待开工任务数量" }; listTaskQty.Add(tmpTaskQty); } if (isAll == "*" || StrKey.Contains(TaskType.质量检验.ToDescription())) { TaskQty tmpTaskQty = new TaskQty() { StrKey = TaskType.质量检验.ToDescription().Replace(",", ""), Total = await JIT_VW_MODispBillList.GetAll().Where(w => w.FStatus == 1).CountAsync(), BZ = "质量检验待检验数量" }; listTaskQty.Add(tmpTaskQty); } if (isAll == "*" || StrKey.Contains(TaskType.库存查询.ToDescription())) { TaskQty tmpTaskQty = new TaskQty() { StrKey = TaskType.库存查询.ToDescription().Replace(",", ""), Total = await JIT_VM_Inventory.GetAll().CountAsync(), BZ = "库存查询数量" }; listTaskQty.Add(tmpTaskQty); } if (isAll == "*" || StrKey.Contains(TaskType.条码打印.ToDescription())) { TaskQty tmpTaskQty = new TaskQty() { StrKey = TaskType.条码打印.ToDescription().Replace(",", ""), Total = 0, BZ = "" }; listTaskQty.Add(tmpTaskQty); } if (isAll == "*" || StrKey.Contains(TaskType.派工任务待开工.ToDescription())) { TaskQty tmpTaskQty = new TaskQty() { StrKey = TaskType.派工任务待开工.ToDescription().Replace(",", ""), Total = await JIT_VW_MODispBillList.GetAll() .Where(w => w.操作者 == AbpSession.UserId && w.FStatus == 0).CountAsync(), BZ = "派工任务待开工" }; listTaskQty.Add(tmpTaskQty); } if (isAll == "*" || StrKey.Contains(TaskType.派工任务待汇报.ToDescription())) { TaskQty tmpTaskQty = new TaskQty() { StrKey = TaskType.派工任务待汇报.ToDescription().Replace(",", ""), Total = await JIT_VW_MODispBillList.GetAll() .Where(w => w.操作者 == AbpSession.UserId && w.FStatus == 1).CountAsync(), BZ = "派工任务待汇报" }; listTaskQty.Add(tmpTaskQty); } if (isAll == "*" || StrKey.Contains(TaskType.质量检验待检验.ToDescription())) { TaskQty tmpTaskQty = new TaskQty() { StrKey = TaskType.质量检验待检验.ToDescription().Replace(",", ""), Total = await JIT_VW_MODispBillList.GetAll().Where(w => w.FStatus == 1).CountAsync(), BZ = "质量检验待检验" }; listTaskQty.Add(tmpTaskQty); } if (isAll == "*" || StrKey.Contains(TaskType.质量检验已检验.ToDescription())) { TaskQty tmpTaskQty = new TaskQty() { StrKey = TaskType.质量检验已检验.ToDescription().Replace(",", ""), Total = await JIT_VW_MODispBillList.GetAll().Where(w => w.FStatus == 2).CountAsync(), BZ = "质量检验已检验" }; listTaskQty.Add(tmpTaskQty); } if (isAll == "*" || StrKey.Contains(TaskType.包装余数.ToDescription())) { TaskQty tmpTaskQty = new TaskQty() { StrKey = TaskType.包装余数.ToDescription().Replace(",", ""), Total = await JIT_ICMODispBill.GetAll().Join(JIT_ICMOInspectBill.GetAll(), A => A.FID, B => B.ICMODispBillID, (A, B) => new { A.FBillNo, A.FBiller, A.FDate, FBillNo2 = B.FBillNo, B.BatchNum, B.FYSQty, B.FInspector, B.FInspectTime, A.employee.FName, // A.FStatus }).Where(A => A.FStatus >= PublicEnum.ICMODispBillState.已检验.EnumToInt() && A.FYSQty > 0) .CountAsync(), BZ = "包装余数" }; listTaskQty.Add(tmpTaskQty); } if (isAll == "*" || StrKey.Contains(TaskType.拼箱记录.ToDescription())) { TaskQty tmpTaskQty = new TaskQty() { StrKey = TaskType.拼箱记录.ToDescription().Replace(",", ""), Total = await JIT_RemainderLCL.GetAll().CountAsync(), BZ = "拼箱记录" }; listTaskQty.Add(tmpTaskQty); } // 所有枚举信息 string[] listTaskType = new string[Enum.GetValues(typeof(TaskType)).Length]; int i = 0; foreach (TaskType ty in Enum.GetValues(typeof(TaskType))) { listTaskType[i] = ty.ToDescription(); i++; } if (isAll != "*" && !listTaskType.Contains(StrKey)) { TaskQty tmpTaskQty = new TaskQty() { StrKey = StrKey.Replace(",", ""), Total = 0, BZ = StrKey.Replace(",", "") + ",未定义,所以数量为0" }; listTaskQty.Add(tmpTaskQty); } return(listTaskQty); }