| | |
| | | using SqlSugar; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_DTO.MES; |
| | | using WIDESEA_DTO.Stock; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_IStockService; |
| | | using WIDESEA_Model.Models; |
| | | |
| | |
| | | public IStockInfo_HtyService StockInfo_HtyService { get; } |
| | | |
| | | /// <summary> |
| | | /// Mes接口服务 |
| | | /// </summary> |
| | | public IMesService _mesService { get; } |
| | | |
| | | /// <summary> |
| | | /// 构造函数 |
| | | /// </summary> |
| | | /// <param name="stockInfoDetailService">库存明细服务</param> |
| | |
| | | IStockInfoDetailService stockInfoDetailService, |
| | | IStockInfoService stockInfoService, |
| | | IStockInfoDetail_HtyService stockInfoDetail_HtyService, |
| | | IStockInfo_HtyService stockInfo_HtyService) |
| | | IStockInfo_HtyService stockInfo_HtyService, |
| | | IMesService mesService) |
| | | { |
| | | StockInfoDetailService = stockInfoDetailService; |
| | | StockInfoService = stockInfoService; |
| | | StockInfoDetail_HtyService = stockInfoDetail_HtyService; |
| | | StockInfo_HtyService = stockInfo_HtyService; |
| | | _mesService = mesService; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | Status = StockStatusEmun.组盘暂存.GetHashCode(), |
| | | }).ToList(); |
| | | |
| | | var bindRequest = new BindContainerRequest |
| | | { |
| | | ContainerCode = stock?.TargetPalletNo, |
| | | EquipmentCode = "STK-GROUP-001", |
| | | ResourceCode = "STK-GROUP-001", |
| | | LocalTime = now, |
| | | OperationType = 0, // 0代表组盘 |
| | | ContainerSfcList = details.Select(d => new ContainerSfcItem |
| | | { |
| | | Sfc = d.SerialNumber, |
| | | Location = d.InboundOrderRowNo.ToString(), |
| | | }).ToList() |
| | | }; |
| | | |
| | | return await ExecuteWithinTransactionAsync(async () => |
| | | { |
| | | var existingStock = StockInfoService.Repository.QueryFirst(s => s.PalletCode == stock.TargetPalletNo); |
| | |
| | | Creater = "system", |
| | | Details = details |
| | | }; |
| | | var mesResult = _mesService.BindContainer(bindRequest); |
| | | if (mesResult == null || !mesResult.IsSuccess) |
| | | { |
| | | return content.Error($"组盘成功,但MES绑定失败: {mesResult?.ErrorMessage ?? "未知错误"}"); |
| | | } |
| | | |
| | | result = StockInfoService.Repository.AddData(entity, x => x.Details); |
| | | return result ? content.OK("组盘成功") : content.Error("组盘失败"); |