| | |
| | | public async Task<string> outBoundWorkPiece([FromBody] OutBoundInput input) |
| | | { |
| | | |
| | | if (input.Password == null || !input.Password.Equals("123456")) |
| | | { |
| | | throw Oops.Oh("修改工件质量状态失败:密码输入错误!"); |
| | | } |
| | | //if (input.Password == null || !input.Password.Equals("123456")) |
| | | //{ |
| | | // throw Oops.Oh("修改工件质量状态失败:密码输入错误!"); |
| | | //} |
| | | if (input.WorkPieceInfoLst.Count < 1) |
| | | { |
| | | throw Oops.Oh("工件出库失败:数据不能为空!"); |
| | | throw Oops.Oh("工件入库失败:数据不能为空!"); |
| | | } |
| | | |
| | | List<OutBoundDetailsInput> WorkPieceInfoLst = input.WorkPieceInfoLst; |
| | |
| | | |
| | | List<WorkPieceInfo> db_WorkPieceInfoList = await _workPieceInfoRep.Where(w => queryOP80NewCodeList.Contains(w.OP80NewCode) && w.IsDeleted == false).ToListAsync(); |
| | | |
| | | var addOutBoundLogList = new List<WorkPieceOutboundRecord>(); |
| | | |
| | | foreach (var item in WorkPieceInfoLst) |
| | | { |
| | | var itemModel = db_itemModelList.FirstOrDefault(w => w.OP80NewCode == item.OP80NewCode); |
| | | var itemModel = db_itemModelList.FirstOrDefault(w => w.OP80NewCode == item.OP80NewCode && w.IsDeleted == false); |
| | | if (itemModel != null) |
| | | { |
| | | //itemModel.IsDeleted = true; |
| | | //itemModel.Remark = itemModel.Remark ?? "" + "二次发货自动撤销发货"; |
| | | //await _workPieceOutboundRep.UpdateAsync(itemModel); |
| | | |
| | | /* |
| | | var createitme = itemModel.CreatedTime == null ? "" : (((DateTimeOffset)itemModel.CreatedTime).UtcDateTime.ToString("yyyy-MM-dd HH:mm:ss")); |
| | | throw Oops.Oh($"成品码{itemModel.OP80NewCode}已出库,出库时间:{createitme}"); |
| | | |
| | | //*/ |
| | | |
| | | //不再提示出来,自动忽略 【Editby shaocx,2024-09-04】 |
| | | continue; |
| | | } |
| | | var workPiece = db_WorkPieceInfoList.FirstOrDefault(w => w.OP80NewCode == item.OP80NewCode); |
| | | if (workPiece != null) |
| | | { |
| | | workPiece.OutPerson = CurrentUserInfo.Name; |
| | | workPiece.OutRemark = "撤销工件出库"; |
| | | workPiece.OutRemark = "撤销工件入库"; |
| | | workPiece.OutTime = DateTime.Now; |
| | | workPiece.IsOut = false; |
| | | |
| | |
| | | }; |
| | | addOutBoundList.Add(outBoundLog); |
| | | |
| | | var outBoundLogRecord = new WorkPieceOutboundRecord |
| | | { |
| | | OperationType = OutboundOperationType.入库.ToString(), |
| | | WorkPieceID = workPiece?.WorkPieceID, |
| | | OP80NewCode = item.OP80NewCode, |
| | | |
| | | CreatedUserId = CurrentUserInfo.UserId, |
| | | CreatedUserName = CurrentUserInfo.Name, |
| | | |
| | | |
| | | //CarNo = input.CarNo, |
| | | Remark = "工件入库", |
| | | |
| | | }; |
| | | addOutBoundLogList.Add(outBoundLogRecord); |
| | | |
| | | |
| | | } |
| | | await _workPieceOutboundRep.InsertAsync(addOutBoundList); |
| | | |
| | | await _workPieceOutboundRecordRep.InsertAsync(addOutBoundLogList); |
| | | |
| | | return "出库成功"; |
| | | } |
| | | |
| | |
| | | return "下线成功"; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | w.CarNo == input.CarNo |
| | | && w.UnLineStage == PieceUnLineStage.已下线 |
| | | && w.IsDeleted == false).ToListAsync(); |
| | | |
| | | if (db_WorkPieceOutboundList?.Count == 0) |
| | | { |
| | | throw Oops.Oh("没有可出库的数据!"); |
| | | } |
| | | |
| | | |
| | | var queryOP80NewCodeList = db_WorkPieceOutboundList.Select(x => x.OP80NewCode).ToList(); |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 出库统计 |
| | | /// </summary> |
| | | /// <param name="input"></param> |
| | | /// <returns></returns> |
| | | [HttpPost("getOutBoundWorkPieceInfoCountList")] |
| | | [DisableOpLog] |
| | | public async Task<List<OutBoundWorkPieceInfoCountOutput>> GetOutBoundWorkPieceInfoCountList([FromBody] OutBoundWorkPieceInfoCountInput input) |
| | | { |
| | | /* |
| | | //测试 |
| | | List<OutBoundWorkPieceInfoCountOutput> outBoundWorkPieceInfoCountOutputs = new List<OutBoundWorkPieceInfoCountOutput>(); |
| | | outBoundWorkPieceInfoCountOutputs.Add(new OutBoundWorkPieceInfoCountOutput() |
| | | { |
| | | Count = 10, |
| | | WorkPieceOutboundUserName = "AAA" |
| | | }); |
| | | outBoundWorkPieceInfoCountOutputs.Add(new OutBoundWorkPieceInfoCountOutput() |
| | | { |
| | | Count = 99, |
| | | WorkPieceOutboundUserName = "BBb" |
| | | }); |
| | | return outBoundWorkPieceInfoCountOutputs; |
| | | //*/ |
| | | |
| | | |
| | | //DateTimeOffset now = DateTimeOffset.Now; // 获取当前时间,包括时区偏移量 |
| | | DateTimeOffset now = input.Date; // 获取当前时间,包括时区偏移量 |
| | | DateTimeOffset startOfDay = new DateTimeOffset(now.Year, now.Month, now.Day, 0, 0, 0, now.Offset); // 当天开始时间 |
| | | DateTimeOffset endOfDay = new DateTimeOffset(now.Year, now.Month, now.Day, 23, 59, 59, now.Offset); // 当天结束时间 |
| | | List<WorkPieceOutbound> db_itemModelList = await _workPieceOutboundRep.Where(w => w.CreatedTime >= startOfDay |
| | | && w.CreatedTime <= endOfDay && w.IsDeleted == false).ToListAsync(); |
| | | //汇总分组 |
| | | var groupList = db_itemModelList.GroupBy(g => g.WorkPieceOutboundUserName).Select(s => new OutBoundWorkPieceInfoCountOutput() |
| | | { |
| | | WorkPieceOutboundUserName = s.Key, |
| | | Count = s.ToList().Count |
| | | }).ToList(); |
| | | return groupList; |
| | | //*/ |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | } |