| | |
| | | using WIDESEA_Core.CodeConfigEnum; |
| | | using WIDESEA_Core.DB; |
| | | using WIDESEA_Core.Enums; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_Core.Seed; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_IOutboundService; |
| | |
| | | _materialUnitService = materialUnitService; |
| | | } |
| | | |
| | | private int[] OrderTypes = new int[] { (int)InOrderTypeEnum.AllocatOutbound, (int)InOrderTypeEnum.InternalAllocat, (int)InOrderTypeEnum.ReCheck }; |
| | | public async Task<WebResponseContent> ReceiveOutboundOrder(Dt_OutboundOrder model, int operateType) |
| | | { |
| | | try |
| | |
| | | } |
| | | foreach (var item in model.Details) |
| | | { |
| | | var issueoStockResult = await _materialUnitService.ConvertIssueToStockAsync(item.MaterielCode, item.BarcodeQty); |
| | | var issueoStockResult = await _materialUnitService.ConvertFromToStockAsync(item.MaterielCode, item.BarcodeUnit, item.BarcodeQty); |
| | | item.Unit = issueoStockResult.Unit; |
| | | item.OrderQuantity = issueoStockResult.Quantity; |
| | | var moveissueoStockResult = await _materialUnitService.ConvertIssueToStockAsync(item.MaterielCode, item.BarcodeMoveQty); |
| | | var moveissueoStockResult = await _materialUnitService.ConvertFromToStockAsync(item.MaterielCode, item.BarcodeUnit, item.BarcodeMoveQty); |
| | | item.MoveQty = moveissueoStockResult.Quantity; |
| | | } |
| | | if (!OrderTypes.Contains(model.OrderType)) |
| | | { |
| | | model.OrderNo = CreateCodeByRule(nameof(RuleCodeEnum.OutboundOrderRule)); |
| | | } |
| | | |
| | | |
| | | model.OrderNo = CreateCodeByRule(nameof(RuleCodeEnum.OutboundOrderRule)); |
| | | Db.InsertNav(model).Include(x => x.Details).ExecuteCommand(); |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°åºåºåæç»ä¿¡æ¯"); |
| | | } |
| | | if (outboundOrder.OrderStatus != OutOrderStatusEnum.æªå¼å§.ObjToInt()) |
| | | if (outboundOrder.OrderStatus != (int)OutOrderStatusEnum.æªå¼å§) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该订åç¶æä¸å
许修æ¹"); |
| | | } |
| | |
| | | BarcodeQty = item.OrderQuantity, |
| | | BarcodeUnit = item.Unit, |
| | | }; |
| | | var issueoStockResult = await _materialUnitService.ConvertIssueToStockAsync(item.MaterielCode, item.BarcodeQty); |
| | | var issueoStockResult = await _materialUnitService.ConvertFromToStockAsync(item.MaterielCode, item.BarcodeUnit, item.BarcodeQty); |
| | | item.Unit = issueoStockResult.Unit; |
| | | item.OrderQuantity = issueoStockResult.Quantity; |
| | | var moveissueoStockResult = await _materialUnitService.ConvertIssueToStockAsync(item.MaterielCode, item.BarcodeMoveQty); |
| | | var moveissueoStockResult = await _materialUnitService.ConvertFromToStockAsync(item.MaterielCode, item.BarcodeUnit, item.BarcodeMoveQty); |
| | | item.MoveQty = moveissueoStockResult.Quantity; |
| | | |
| | | outboundOrderDetails.Add(outboundOrderDetail); |
| | |
| | | outboundOrderDetail.BarcodeMoveQty = item.MoveQty; |
| | | outboundOrderDetail.BarcodeQty = item.OrderQuantity; |
| | | outboundOrderDetail.BarcodeUnit = item.Unit; |
| | | var issueoStockResult = await _materialUnitService.ConvertIssueToStockAsync(item.MaterielCode, item.BarcodeQty); |
| | | var issueoStockResult = await _materialUnitService.ConvertFromToStockAsync(item.MaterielCode, item.BarcodeUnit, item.BarcodeQty); |
| | | outboundOrderDetail.Unit = issueoStockResult.Unit; |
| | | outboundOrderDetail.OrderQuantity = issueoStockResult.Quantity; |
| | | var moveissueoStockResult = await _materialUnitService.ConvertIssueToStockAsync(item.MaterielCode, item.BarcodeMoveQty); |
| | | var moveissueoStockResult = await _materialUnitService.ConvertFromToStockAsync(item.MaterielCode, item.BarcodeUnit, item.BarcodeMoveQty); |
| | | outboundOrderDetail.MoveQty = moveissueoStockResult.Quantity; |
| | | |
| | | |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°åºåºåæç»ä¿¡æ¯"); |
| | | } |
| | | if (outboundOrder.OrderStatus != OutOrderStatusEnum.æªå¼å§.ObjToInt()) |
| | | if (outboundOrder.OrderStatus != (int)OutOrderStatusEnum.æªå¼å§) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该订åç¶æä¸å
许å é¤"); |
| | | } |
| | |
| | | return code; |
| | | } |
| | | } |
| | | |
| | | |
| | | public override PageGridData<Dt_OutboundOrder> GetPageData(PageDataOptions options) |
| | | { |
| | | string wheres = ValidatePageOptions(options); |
| | | //è·åæåºå段 |
| | | Dictionary<string, SqlSugar.OrderByType> orderbyDic = GetPageDataSort(options, TProperties); |
| | | List<OrderByModel> orderByModels = new List<OrderByModel>(); |
| | | foreach (var item in orderbyDic) |
| | | { |
| | | OrderByModel orderByModel = new() |
| | | { |
| | | FieldName = item.Key, |
| | | OrderByType = item.Value |
| | | }; |
| | | orderByModels.Add(orderByModel); |
| | | } |
| | | |
| | | |
| | | int totalCount = 0; |
| | | List<SearchParameters> searchParametersList = new List<SearchParameters>(); |
| | | if (!string.IsNullOrEmpty(options.Wheres)) |
| | | { |
| | | try |
| | | { |
| | | searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>(); |
| | | options.Filter = searchParametersList; |
| | | } |
| | | catch { } |
| | | } |
| | | var data = BaseDal.Db.Queryable<Dt_OutboundOrder>() |
| | | .WhereIF(!wheres.IsNullOrEmpty(), wheres) |
| | | .Where(x => x.OrderType == 0) |
| | | .OrderBy(orderByModels) |
| | | .ToPageList(options.Page, options.Rows, ref totalCount); |
| | | |
| | | return new PageGridData<Dt_OutboundOrder>(totalCount, data); |
| | | } |
| | | } |
| | | } |