| | |
| | | using System.Text.RegularExpressions; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Core.CodeConfigEnum; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; |
| | | |
| | | namespace WIDESEA_TaskInfoService |
| | | { |
| | |
| | | { |
| | | return content.Error(inProRespone.Message); |
| | | } |
| | | _proInStatisticsService.SaveStatic(bagInfoModel); |
| | | return content.OK(inProRespone.Message); |
| | | } |
| | | else if (isValid) |
| | | { |
| | | |
| | | } |
| | | |
| | | foreach (var item in bagInfoModel.BagDetails) |
| | | { |
| | | if (proDetailsExists.Contains(item.BagNo)) |
| | |
| | | TaskType = TaskTypeEnum.InProduct.ObjToInt(), |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | WarehouseId = warehouse.WarehouseId, |
| | | PalletType = proStockInfo.PalletType |
| | | PalletType = proStockInfo.PalletType, |
| | | MaterielCode = proStockInfo.proStockInfoDetails.Where(x => x.ProStockId == proStockInfo.Id).FirstOrDefault()?.ProductCode, |
| | | Quantity = (float)proStockInfo.proStockInfoDetails.Where(x => x.ProStockId == proStockInfo.Id).Sum(x => x.StockPcsQty) |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | newTask.TaskId = taskId; |
| | | Db.InsertNav(proStockInfo).Include(x => x.proStockInfoDetails).ExecuteCommand(); |
| | | |
| | | //ä¸ä¼ ERP |
| | | WebResponseContent responseContent = _inboundOrderService.FeedbackProIn(mesProInOrder); |
| | | _proInStatisticsService.SaveStatic(bagInfoModel); |
| | | if (!responseContent.Status) |
| | | { |
| | | mesProInOrder.UpErpStatus = WhetherEnum.False.ObjToInt(); |
| | | mesProInOrder.Remark = responseContent.Message; |
| | | //mesProInOrder.UpErpStatus = WhetherEnum.False.ObjToInt(); |
| | | //mesProInOrder.Remark = responseContent.Message; |
| | | throw new Exception(responseContent.Message); |
| | | } |
| | | else |
| | | { |
| | |
| | | }; |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | Db.InsertNav(proStockInfo).Include(x => x.proStockInfoDetails).ExecuteCommand(); |
| | | //ä¸ä¼ ERP |
| | | WebResponseContent responseContent = _inboundOrderService.FeedbackProIn(mesProInOrder); |
| | | if (!responseContent.Status) |
| | | { |
| | | mesProInOrder.UpErpStatus = WhetherEnum.False.ObjToInt(); |
| | | mesProInOrder.Remark = responseContent.Message; |
| | | //mesProInOrder.UpErpStatus = WhetherEnum.False.ObjToInt(); |
| | | //mesProInOrder.Remark = responseContent.Message; |
| | | return WebResponseContent.Instance.Error($"{responseContent.Message}"); |
| | | } |
| | | else |
| | | { |
| | | mesProInOrder.UpErpStatus = WhetherEnum.True.ObjToInt(); |
| | | } |
| | | Db.InsertNav(proStockInfo).Include(x => x.proStockInfoDetails).ExecuteCommand(); |
| | | Db.InsertNav(mesProInOrder).Include(x => x.Details).ExecuteCommand(); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK("æ¥æ¶æå"); |
| | |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// WMS忥æååºåºè³MESå¤å
è£
æº |
| | | /// </summary> |
| | | public WebResponseContent ShipmentOrderMESSync(MesShipmentOrderSync model) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.AnhuaitcShipmentOrderSync.ToString()); |
| | | MESRoot<MesShipmentOrderSync> root = new MESRoot<MesShipmentOrderSync>() |
| | | { |
| | | From = "WMS", |
| | | DateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | Content = model |
| | | }; |
| | | JsonSerializerSettings settings = new JsonSerializerSettings |
| | | { |
| | | ContractResolver = new CamelCasePropertyNamesContractResolver() |
| | | }; |
| | | string request = JsonConvert.SerializeObject(root, settings); |
| | | string response = HttpMesHelper.Post(apiInfo.ApiAddress, request); |
| | | MesResponseContent mesResponseContent = response.DeserializeObject<MesResponseContent>(); |
| | | //è°ç¨æ¥å£ |
| | | if (mesResponseContent.BSucc == true) |
| | | { |
| | | content.OK(mesResponseContent.StrMsg); |
| | | } |
| | | else |
| | | { |
| | | content.Error(mesResponseContent.StrMsg); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// MESæåè¿å·¥æåº |
| | | /// </summary> |
| | |
| | | MesResponseContent content = new MesResponseContent(); |
| | | try |
| | | { |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA72.ToString()); |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == model.WarehouseCode); |
| | | if (warehouse == null) |
| | | { |
| | | return content.Error($"å°¾æ°ä»ä¿¡æ¯æªé
ç½®"); |
| | |
| | | { |
| | | return content.Error($"æåºä»»å¡å{model.TaskNo}å·²åå¨"); |
| | | } |
| | | //çææåºå |
| | | Dt_MesRworkOutboundOrder mesRworkOutboundOrder = new Dt_MesRworkOutboundOrder() |
| | | { |
| | | WarehouseId = warehouse.WarehouseId, |
| | | TaskNo = model.TaskNo, |
| | | OrderStatus = OutOrderStatusEnum.æªå¼å§.ObjToInt(), |
| | | OrderStatus = OutOrderStatusEnum.åºåºä¸.ObjToInt(), |
| | | CreateType = OrderCreateTypeEnum.UpperSystemPush.ObjToInt(), |
| | | ProductCode = model.ProductCode, |
| | | ProductName = model.ProductName, |
| | | ProductName = model.ProductCode, |
| | | ProductVersion = model.ProductVersion, |
| | | DateCode = model.DateCode, |
| | | RequiredQuantity = model.RequiredQuantity, |
| | | RequiredSetCount=model.RequiredSetCount, |
| | | FactoryCode = model.FactoryCode, |
| | | SaleOrder = model.SaleOrder, |
| | | SaleOrder = model.SaleOrder ?? "", |
| | | OrderType = model.InventoryType |
| | | }; |
| | | if (model.DateCode.IndexOf("å¹³åº")>0 || warehouse.WarehouseCode==WarehouseEnum.HA101.ToString()) |
| | | { |
| | | Dt_Warehouse warehousePing = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA101.ToString()); |
| | | mesRworkOutboundOrder.WarehouseId = warehousePing.WarehouseId; |
| | | mesRworkOutboundOrder.OrderStatus = OutOrderStatusEnum.åºåºå®æ.ObjToInt(); |
| | | _unitOfWorkManage.BeginTran(); |
| | | _outboundService.RworkOutboundOrderService.Repository.AddData(mesRworkOutboundOrder); |
| | | MesInventoryInfo mesInventoryInfo = new MesInventoryInfo() |
| | | { |
| | | Warhouseno = warehousePing.WarehouseCode, |
| | | InternalPackageNumber = model.ProductCode, |
| | | SetCount = (int)model.RequiredSetCount, |
| | | EligiblePcsCount = (int)model.RequiredQuantity |
| | | }; |
| | | |
| | | MesProductOutBound mesProductOutBound = new MesProductOutBound() |
| | | { |
| | | TaskNo = mesRworkOutboundOrder.TaskNo, |
| | | ProductCode = mesRworkOutboundOrder.ProductCode, |
| | | ProductVersion = mesRworkOutboundOrder.ProductVersion, |
| | | DateCode = mesRworkOutboundOrder.DateCode, |
| | | SaleOrder = mesRworkOutboundOrder.SaleOrder, |
| | | InventoryInfo = new List<MesInventoryInfo> { mesInventoryInfo } |
| | | }; |
| | | if (model.ReceiveDown==EnableEnum.Enable.ObjToInt()) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | } |
| | | else |
| | | { |
| | | //MESæååºåæ¿åºåºåæ¥ |
| | | WebResponseContent responseContentPing = _outboundService.RworkOutboundOrderService.ProductOutBoundSync(mesProductOutBound); |
| | | if (!responseContentPing.Status) |
| | | { |
| | | throw new Exception("忥MESåºåæ¿åºåºå¤±è´¥,é误:" + responseContentPing.Message); |
| | | } |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | | return content.OK($"æä¾è¿åºåæ¥æ¶æå,ReceiveDown:{model.ReceiveDown}"); |
| | | } |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | List<Dt_ProStockInfo>? proStockInfos = null; |
| | | List<Dt_OutProStockInfo>? outProStockInfos = null; |
| | | List<Dt_LocationInfo>? locationInfos = null; |
| | | List<Dt_ProStockInfoDetail> proStockInfoDetails = new List<Dt_ProStockInfoDetail>(); |
| | | //åé
åºåçææåºä»»å¡ |
| | | (List<Dt_ProStockInfo>?, Dt_MesRworkOutboundOrder?, List<Dt_OutProStockInfo>?, List<Dt_LocationInfo>) result = _outboundService.RworkOutboundOrderService.AssignMesStocks(mesRworkOutboundOrder); |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | |
| | | x.TargetAddress = "5236"; |
| | | x.OrderNo = mesRworkOutboundOrder.TaskNo; |
| | | }); |
| | | proStockInfos.ForEach(x => |
| | | { |
| | | proStockInfoDetails.AddRange(x.proStockInfoDetails); |
| | | }); |
| | | _unitOfWorkManage.BeginTran(); |
| | | |
| | | int id = BaseDal.AddData(tasks); |
| | |
| | | |
| | | if (!updateContent.Status) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return content.Error(updateContent.Message); |
| | | throw new Exception(updateContent.Message); |
| | | } |
| | | } |
| | | _outboundService.RworkOutboundOrderService.Repository.AddData(mesRworkOutboundOrder); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return content.OK("æä¾è¿åºåæ¥æ¶æå"); |
| | | if (model.ReceiveDown == EnableEnum.Enable.ObjToInt()) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | } |
| | | else |
| | | { |
| | | //MESæååºåæ¿åºåºåæ¥ |
| | | WebResponseContent responseContent = _outboundService.RworkOutboundOrderService.ProductOutBoundSync(_outboundService.RworkOutboundOrderService.MesProOutBound(mesRworkOutboundOrder, proStockInfoDetails)); |
| | | if (!responseContent.Status) |
| | | { |
| | | throw new Exception("忥MESåºåæ¿åºåºå¤±è´¥,é误:" + responseContent.Message); |
| | | } |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | | return content.OK($"æä¾è¿åºåæ¥æ¶æå,ReceiveDown:{model.ReceiveDown}"); |
| | | } |
| | | catch (Exception ex) |
| | | { |