| | |
| | | return JsonConvert.DeserializeObject<ResponseModel>(body); |
| | | } |
| | | |
| | | public async Task FeedbackOutbound(FeedbackOutboundRequestModel model) |
| | | public async Task<ResponseModel> FeedbackOutbound(FeedbackOutboundRequestModel model) |
| | | { |
| | | string json = JsonConvert.SerializeObject(model, new JsonSerializerSettings |
| | | { |
| | |
| | | _client.DefaultRequestHeaders.Clear(); |
| | | _client.DefaultRequestHeaders.Add("Accept", "application/json"); |
| | | |
| | | _logger.LogInformation("InvokeMESService FeedbackOutbound : " + json); |
| | | |
| | | var response = await _client.PostAsync("AldMaterialOutbound/MaterialOutbound", content); |
| | | string body = await response.Content.ReadAsStringAsync(); |
| | | |
| | |
| | | throw new HttpRequestException(body); |
| | | } |
| | | |
| | | // JsonConvert.DeserializeObject<ResponseModel>(body); |
| | | |
| | | return JsonConvert.DeserializeObject<ResponseModel>(body); |
| | | } |
| | | |
| | | public async Task<ResponseModel> NewMaterielToMes(MaterielToMesDTO model) |
| | |
| | | |
| | | var content = new StringContent(json, Encoding.UTF8, "application/json"); |
| | | |
| | | using var response = await client.PostAsync("", content); |
| | | _logger.LogInformation("InvokeMESService FeedbackInbound : " + json); |
| | | |
| | | using var response = await client.PostAsync("AldBarcodeInformation/BarcodeInformation", content); |
| | | var responseText = await response.Content.ReadAsStringAsync(); |
| | | if (!response.IsSuccessStatusCode) |
| | | { |
| | |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO.Outbound; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Model.Models.Basic; |
| | |
| | | { |
| | | internal class MaterielToMesService : ServiceBase<Dt_MaterielToMes, IRepository<Dt_MaterielToMes>>, IMaterielToMesService |
| | | { |
| | | private readonly IInvokeMESService _invokeMESService; |
| | | |
| | | public MaterielToMesService(IRepository<Dt_MaterielToMes> BaseDal ) : base(BaseDal) |
| | | public MaterielToMesService(IRepository<Dt_MaterielToMes> BaseDal, IInvokeMESService invokeMESService) : base(BaseDal) |
| | | { |
| | | |
| | | _invokeMESService = invokeMESService; |
| | | } |
| | | // å建ä¸ä¸ªä½¿ç¨å°é©¼å³°å½åæ³çåºåå设置 |
| | | JsonSerializerSettings settings = new JsonSerializerSettings |
| | |
| | | WebResponseContent content = base.AddData(saveModel); |
| | | if (content.Status) |
| | | { |
| | | |
| | | |
| | | string request = JsonConvert.SerializeObject(saveModel, settings); |
| | | var url = AppSettings.GetValue("MESUrl").ObjToString(); |
| | | string response = HttpHelper.Post( url+"", request); |
| | | |
| | | |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | else |
| | |
| | | public string newmaterialCode { get; set; } |
| | | public string unit { get; set; } |
| | | public string factoryArea { get; set; } |
| | | public string qty { get; set; } |
| | | public decimal qty { get; set; } |
| | | public string supplyCode { get; set; } |
| | | public string warehouseCode { get; set; } |
| | | public string batchNo { get; set; } |
| | |
| | | public int status { get; set; } |
| | | |
| | | public string factoryArea { get; set; } |
| | | |
| | | public string Operator { get; set; } |
| | | public List<FeedbackOutboundDetailsModel> details { get; set; } |
| | | |
| | | } |
| | |
| | | { |
| | | Task<ResponseModel> FeedbackInbound(FeedbackInboundRequestModel model); |
| | | |
| | | Task FeedbackOutbound(FeedbackOutboundRequestModel model); |
| | | Task<ResponseModel> FeedbackOutbound(FeedbackOutboundRequestModel model); |
| | | |
| | | Task<string> GetToken(String username, string password); |
| | | |
| | | Task<ResponseModel> NewMaterielToMes(MaterielToMesDTO model); |
| | | |
| | | |
| | | Task<WebResponseContent> BatchOrderFeedbackToMes(List<string> orderNos, int inout); |
| | | } |
| | |
| | | public int? TaskNum { get; set; } |
| | | |
| | | public string SupplyCode { get; set; } |
| | | |
| | | [SugarColumn(ColumnName = "lineNo", ColumnDescription = "è¡å·")] |
| | | public string? lineNo { get; set; } |
| | | |
| | | public string WarehouseCode { get; set; } |
| | | /// <summary> |
| | | /// ç¶æ ç¶æï¼0-å·²åé
1-åºåºä¸ 2-é¨åæ£é 3å·²æ£é |
| | |
| | | |
| | | return new Dt_OutStockLockInfo() |
| | | { |
| | | lineNo= outboundOrderDetail.lineNo, |
| | | |
| | | PalletCode = outStock.PalletCode, |
| | | AssignQuantity = assignQuantity, |
| | |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO.Basic; |
| | | using WIDESEA_DTO.Inbound; |
| | | using WIDESEA_DTO.Outbound; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_IOutboundService; |
| | |
| | | private readonly ISplitPackageService _splitPackageService; |
| | | private readonly IRepository<Dt_Task> _taskRepository; |
| | | private readonly IESSApiService _eSSApiService; |
| | | |
| | | private readonly IInvokeMESService _invokeMESService; |
| | | |
| | | private readonly ILogger<OutboundPickingService> _logger; |
| | | |
| | |
| | | |
| | | }; |
| | | |
| | | public OutboundPickingService(IRepository<Dt_PickingRecord> BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockInfoService stockInfoService, IStockService stockService, IOutStockLockInfoService outStockLockInfoService, IStockInfoDetailService stockInfoDetailService, ILocationInfoService locationInfoService, IOutboundOrderDetailService outboundOrderDetailService, ISplitPackageService splitPackageService, IOutboundOrderService outboundOrderService, IRepository<Dt_Task> taskRepository, IESSApiService eSSApiService, ILogger<OutboundPickingService> logger) : base(BaseDal) |
| | | public OutboundPickingService(IRepository<Dt_PickingRecord> BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockInfoService stockInfoService, IStockService stockService, IOutStockLockInfoService outStockLockInfoService, IStockInfoDetailService stockInfoDetailService, ILocationInfoService locationInfoService, IOutboundOrderDetailService outboundOrderDetailService, ISplitPackageService splitPackageService, IOutboundOrderService outboundOrderService, IRepository<Dt_Task> taskRepository, IESSApiService eSSApiService, ILogger<OutboundPickingService> logger, IInvokeMESService invokeMESService) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _stockInfoService = stockInfoService; |
| | |
| | | _taskRepository = taskRepository; |
| | | _eSSApiService = eSSApiService; |
| | | _logger = logger; |
| | | _invokeMESService = invokeMESService; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | if (allCompleted) |
| | | { |
| | | try |
| | | { |
| | | await _outboundOrderService.Db.Updateable<Dt_OutboundOrder>() |
| | | .SetColumns(x => x.OrderStatus == 2) // 已宿 |
| | | .Where(x => x.OrderNo == orderNo) |
| | | .ExecuteCommandAsync(); |
| | | |
| | | //åä¼ MES |
| | | var outboundOrder = _stockInfoService.Db.Queryable<Dt_OutboundOrder>().First(x => x.OrderNo == orderNo); |
| | | |
| | | |
| | | if (outboundOrder != null && outboundOrder.OrderStatus == InOrderStatusEnum.å
¥åºå®æ.ObjToInt()) |
| | | { |
| | | var feedmodel = new FeedbackOutboundRequestModel |
| | | { |
| | | reqCode = Guid.NewGuid().ToString(), |
| | | reqTime = DateTime.Now.ToString(), |
| | | business_type = outboundOrder.BusinessType, |
| | | factoryArea = outboundOrder.FactoryArea, |
| | | operationType = 1, |
| | | Operator = outboundOrder.Operator, |
| | | orderNo = outboundOrder.UpperOrderNo, |
| | | status = outboundOrder.OrderStatus, |
| | | details = new List<FeedbackOutboundDetailsModel>() |
| | | |
| | | }; |
| | | var lists = _outStockLockInfoService.Db.Queryable<Dt_OutStockLockInfo>().Where(x => x.OrderNo == orderNo).ToList(); |
| | | |
| | | var groupedData = lists.GroupBy(item => new { item.MaterielCode, item.lineNo, item.Unit, item.WarehouseCode }) |
| | | .Select(group => new FeedbackOutboundDetailsModel |
| | | { |
| | | materialCode = group.Key.MaterielCode, |
| | | lineNo = group.Key.lineNo, |
| | | warehouseCode = group.Key.WarehouseCode, |
| | | currentDeliveryQty = group.Sum(x => x.OrderQuantity), |
| | | // warehouseCode= "1072", |
| | | unit = group.Key.Unit, |
| | | barcodes = group.Select(row => new WIDESEA_DTO.Outbound.BarcodesModel |
| | | { |
| | | barcode = row.CurrentBarcode, |
| | | supplyCode = row.SupplyCode, |
| | | batchNo = row.BatchNo, |
| | | unit = row.Unit, |
| | | qty = row.AssignQuantity |
| | | }).ToList() |
| | | }).ToList(); |
| | | feedmodel.details = groupedData; |
| | | |
| | | _invokeMESService.FeedbackOutbound(feedmodel); |
| | | } |
| | | } |
| | | catch (Exception ex) { |
| | | _logger.LogError(" OutboundPickingService FeedbackOutbound : " + ex.Message); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | using Microsoft.AspNetCore.Http; |
| | | using Microsoft.Extensions.Logging; |
| | | using Org.BouncyCastle.Asn1.Ocsp; |
| | | using System; |
| | | using System.Collections.Generic; |
| | |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_DTO.Basic; |
| | | using WIDESEA_DTO.Outbound; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_IOutboundService; |
| | |
| | | private readonly IStockInfoDetailService _stockInfoDetailService; |
| | | private readonly IOutStockLockInfoService _outStockLockInfoService; |
| | | private readonly IDailySequenceService _dailySequenceService; |
| | | private readonly IInvokeMESService _invokeMESService; |
| | | |
| | | public SplitPackageService(IRepository<Dt_SplitPackageRecord> BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockInfoService stockInfoService, IOutStockLockInfoService outStockLockInfoService, IStockInfoDetailService stockInfoDetailService, IDailySequenceService dailySequenceService) : base(BaseDal) |
| | | private readonly ILogger<SplitPackageService> _logger; |
| | | public SplitPackageService(IRepository<Dt_SplitPackageRecord> BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockInfoService stockInfoService, IOutStockLockInfoService outStockLockInfoService, IStockInfoDetailService stockInfoDetailService, IDailySequenceService dailySequenceService, IInvokeMESService invokeMESService, ILogger<SplitPackageService> logger) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _stockInfoService = stockInfoService; |
| | | _outStockLockInfoService = outStockLockInfoService; |
| | | _stockInfoDetailService = stockInfoDetailService; |
| | | _dailySequenceService = dailySequenceService; |
| | | _invokeMESService = invokeMESService; |
| | | _logger = logger; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | |
| | | // 7. åä¼ æ°æ¡ç ç»MES |
| | | // await SendBarcodeToMES(newBarcode, request.MaterielCode, request.SplitQuantity); |
| | | |
| | | try |
| | | { |
| | | MaterielToMesDTO dto = new MaterielToMesDTO |
| | | { |
| | | batchNo = stockDetail.BatchNo, |
| | | factoryArea = stockDetail.FactoryArea, |
| | | materialCode = stockDetail.MaterielCode, |
| | | newmaterialCode = newBarcode, |
| | | oldmaterialCode = request.OriginalBarcode, |
| | | operationType = 1, |
| | | qty = remainingQty, |
| | | supplyCode = stockDetail.SupplyCode, |
| | | unit = stockDetail.BarcodeUnit, |
| | | warehouseCode = stockDetail.WarehouseCode, |
| | | reqCode = Guid.NewGuid().ToString(), |
| | | reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") |
| | | }; |
| | | _invokeMESService.NewMaterielToMes(dto); |
| | | } |
| | | catch(Exception ex) |
| | | { |
| | | _logger.LogError("SplitPackage åä¼ MES: " + ex.Message); |
| | | } |
| | | return WebResponseContent.Instance.OK("æå
æå", new |
| | | { |
| | | NewBarcode = newBarcode, |