| | |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_IRecordService; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Common.TaskEnum; |
| | | |
| | | namespace WIDESEA_OutboundService |
| | | { |
| | |
| | | } |
| | | List<Dt_StockInfo> autoAssignStocks = _stockService.StockInfoService.GetOutboundStocks(stockInfos, mesOutboundOrder.MaterialCode, needQuantity, out float residueQuantity); |
| | | mesOutboundOrder.LockQuantity += needQuantity - residueQuantity; |
| | | autoAssignStocks.OrderBy(x => x.Details.FirstOrDefault()?.StockQuantity).ToList(); |
| | | outStocks.AddRange(autoAssignStocks); |
| | | float assignQuantity = needQuantity - residueQuantity; |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | stockInfos.ForEach(x => { |
| | | x.StockStatus = StockStatusEmun.åºåºéå®.ObjToInt(); |
| | | }); |
| | | _stockService.StockInfoService.Repository.UpdateData(stockInfos); |
| | | List<Dt_StockInfoDetail> stockInfoDetails = new List<Dt_StockInfoDetail>(); |
| | | foreach (var item in stockInfos) |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent AddMesOrder(SubstrateOutModel substrateOutModel) |
| | | { |
| | | try |
| | | { |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA57.ToString()); |
| | | if (warehouse == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"ä»åºåºç¡ä¿¡æ¯æªé
ç½®"); |
| | | } |
| | | |
| | | Dt_MaterielInfo materielInfo = _basicRepository.MaterielInfoRepository.QueryFirst(x => x.MaterielCode == substrateOutModel.MaterialCode); |
| | | if (materielInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°è¯¥ç©æä¿¡æ¯"); |
| | | } |
| | | int orderType = 0; |
| | | if(substrateOutModel.Line == "1011") |
| | | { |
| | | orderType = MesOutboundOrderTypeEnum.HandSubstrateOutPick.ObjToInt(); |
| | | } |
| | | else |
| | | { |
| | | orderType = MesOutboundOrderTypeEnum.HandSubstrateOut.ObjToInt(); |
| | | } |
| | | |
| | | Dt_MesOutboundOrder mesOutboundOrder = new Dt_MesOutboundOrder() |
| | | { |
| | | CreateType = OrderCreateTypeEnum.CreateInSystem.ObjToInt(), |
| | | Line = substrateOutModel.Line, |
| | | MaterialCode = substrateOutModel.MaterialCode, |
| | | MaterialName = materielInfo.MaterielName, |
| | | OrderQuantity = substrateOutModel.RequiredQuantity, |
| | | TaskNo = DateTime.Now.ToString("yyyyMMddHHmmss"), |
| | | Unit = substrateOutModel.Unit, |
| | | OrderType = orderType, |
| | | OrderStatus = OutOrderStatusEnum.æªå¼å§.ObjToInt(), |
| | | WarehouseId = warehouse.WarehouseId |
| | | }; |
| | | |
| | | AddData(mesOutboundOrder); |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | } |
| | | } |