| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.OrderEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.CodeConfigEnum; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO.Basic; |
| | | using WIDESEA_DTO.MES; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_IInboundRepository; |
| | |
| | | { |
| | | public IMesProInOrderRepository Repository => BaseDal; |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | public MesProInOrderService(IMesProInOrderRepository BaseDal, IUnitOfWorkManage unitOfWorkManag) : base(BaseDal) |
| | | private readonly IInboundRepository _inboundRepository; |
| | | public MesProInOrderService(IMesProInOrderRepository BaseDal, IUnitOfWorkManage unitOfWorkManag, IInboundRepository inboundRepository) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManag; |
| | | _inboundRepository = inboundRepository; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æåå
¥åºæ«ç |
| | | /// </summary> |
| | | /// <param name="Id"></param> |
| | | /// <param name="saveModel"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent ProInboundScan(int Id,string serNum) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | //è·å对åºMESæåå
¥åºåæ® |
| | | Dt_MesProInOrder mesProInOrder = BaseDal.Db.Queryable<Dt_MesProInOrder>().Includes(x => x.Details).First(); |
| | | if (mesProInOrder==null) |
| | | { |
| | | return content.Error("å½åMESå
¥åºåæ®ä¸åå¨"); |
| | | } |
| | | if (mesProInOrder.MesProStatus>= InOrderStatusEnum.å
¥åºå®æ.ObjToInt()) |
| | | { |
| | | return content.Error("å½å忮已å
¥åºæå
³éç¶æ"); |
| | | } |
| | | ProSerNumAnalysisModel model = CodeAnalysisHelper.CodeAnalysis<ProSerNumAnalysisModel>(AnalysisCodeEnum.ProSerNumAnalysis, serNum); |
| | | float SumPCSQty = mesProInOrder.Details.Sum(x => x.OKPCSQTY); |
| | | float OverPCSQty = mesProInOrder.Details.Sum(x=>x.OverInQuantity); |
| | | if ((OverPCSQty+model.OKPCSQTY.ObjToInt())>SumPCSQty) |
| | | { |
| | | return content.Error($"å½åå
¥åºè®¢åæ°é溢åº{(OverPCSQty + model.OKPCSQTY.ObjToInt())- SumPCSQty}"); |
| | | } |
| | | //è·å对åºå
å
æç» |
| | | Dt_MesProInOrderDetail? proInOrderDetail = mesProInOrder.Details.FirstOrDefault(x=>x.BagNo==model.BagNO) ?? throw new Exception($"æªæ¾å°"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | } |
| | | } |