| | |
| | | Status = StockStatusEmun.组盘暂存.GetHashCode(), |
| | | }).ToList(); |
| | | |
| | | //var bindRequest = new BindContainerRequest |
| | | //{ |
| | | // ContainerCode = stock?.TargetPalletNo, |
| | | // EquipmentCode = StockConstants.MES_EQUIPMENT_CODE, |
| | | // ResourceCode = StockConstants.MES_RESOURCE_CODE, |
| | | // LocalTime = now, |
| | | // OperationType = StockConstants.MES_BIND_OPERATION_TYPE, |
| | | // 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); |
| | |
| | | result = StockInfoService.Repository.AddData(entity, x => x.Details); |
| | | if (!result) return content.Error("组盘失败"); |
| | | |
| | | //var mesResult = _mesService.BindContainer(bindRequest); |
| | | //if (mesResult == null || mesResult.Data == null || !mesResult.Data.IsSuccess) |
| | | //{ |
| | | // return content.Error($"组盘成功,但MES绑定失败: {mesResult?.Data?.Msg ?? mesResult?.ErrorMessage ?? "未知错误"}"); |
| | | //} |
| | | return content.OK("组盘成功"); |
| | | }); |
| | | } |
| | |
| | | if (await StockInfo_HtyService.Repository.AddDataAsync(CreateStockHistory(new[] { sourceStock, targetStock }, "换盘")) <= 0) |
| | | return content.Error("换盘历史记录保存失败"); |
| | | |
| | | // 调用MES解绑源托盘电芯 |
| | | //var unbindRequest = new UnBindContainerRequest |
| | | //{ |
| | | // EquipmentCode = StockConstants.MES_EQUIPMENT_CODE, |
| | | // ResourceCode = StockConstants.MES_RESOURCE_CODE, |
| | | // LocalTime = DateTime.Now, |
| | | // ContainCode = stock.SourcePalletNo, |
| | | // SfcList = detailEntities.Select(d => d.SerialNumber).ToList() |
| | | //}; |
| | | //var unbindResult = _mesService.UnBindContainer(unbindRequest); |
| | | //if (unbindResult == null || unbindResult.Data == null || !unbindResult.Data.IsSuccess) |
| | | //{ |
| | | // return content.Error($"换盘成功,但MES解绑失败: {unbindResult?.Data?.Msg ?? unbindResult?.ErrorMessage ?? "未知错误"}"); |
| | | //} |
| | | |
| | | detailEntities.ForEach(d => d.StockId = targetStock.Id); |
| | | var result = await StockInfoDetailService.Repository.UpdateDataAsync(detailEntities); |
| | | if (!result) return content.Error("换盘失败"); |
| | | |
| | | // 调用MES绑定目标托盘电芯 |
| | | //var bindRequest = new BindContainerRequest |
| | | //{ |
| | | // ContainerCode = stock.TargetPalletNo, |
| | | // EquipmentCode = StockConstants.MES_EQUIPMENT_CODE, |
| | | // ResourceCode = StockConstants.MES_RESOURCE_CODE, |
| | | // LocalTime = DateTime.Now, |
| | | // OperationType = StockConstants.MES_BIND_OPERATION_TYPE, |
| | | // ContainerSfcList = detailEntities.Select(d => new ContainerSfcItem |
| | | // { |
| | | // Sfc = d.SerialNumber, |
| | | // Location = d.InboundOrderRowNo.ToString() |
| | | // }).ToList() |
| | | //}; |
| | | //var bindResult = _mesService.BindContainer(bindRequest); |
| | | //if (bindResult == null || bindResult.Data == null || !bindResult.Data.IsSuccess) |
| | | //{ |
| | | // return content.Error($"换盘成功,但MES绑定失败: {bindResult?.Data?.Msg ?? bindResult?.ErrorMessage ?? "未知错误"}"); |
| | | //} |
| | | |
| | | return content.OK("换盘成功"); |
| | | }); |
| | |
| | | if (await StockInfo_HtyService.Repository.AddDataAsync(CreateStockHistory(new[] { sourceStock }, "拆盘")) <= 0) |
| | | return content.Error("拆盘历史记录保存失败"); |
| | | |
| | | // 调用MES解绑电芯 |
| | | //var unbindRequest = new UnBindContainerRequest |
| | | //{ |
| | | // EquipmentCode = StockConstants.MES_EQUIPMENT_CODE, |
| | | // ResourceCode = StockConstants.MES_RESOURCE_CODE, |
| | | // LocalTime = DateTime.Now, |
| | | // ContainCode = stock.SourcePalletNo, |
| | | // SfcList = detailEntities.Select(d => d.SerialNumber).ToList() |
| | | //}; |
| | | //var unbindResult = _mesService.UnBindContainer(unbindRequest); |
| | | //if (unbindResult == null || unbindResult.Data == null || !unbindResult.Data.IsSuccess) |
| | | //{ |
| | | // return content.Error($"拆盘成功,但MES解绑失败: {unbindResult?.Data?.Msg ?? unbindResult?.ErrorMessage ?? "未知错误"}"); |
| | | //} |
| | | |
| | | //var result = await StockInfoDetailService.Repository.DeleteDataAsync(detailEntities); |
| | | //if (!result) return content.Error("拆盘失败"); |
| | | return content.OK("拆盘成功"); |
| | | }); |
| | | } |