| | |
| | | { |
| | | static object lock_out = new object(); |
| | | |
| | | static object solderMask_out = new object(); |
| | | |
| | | /// <summary> |
| | | /// æµè¯æ¶åºä» |
| | | /// </summary> |
| | |
| | | (x.EnableStatus == (int)EnableStatusEnum.Normal || x.EnableStatus == (int)EnableStatusEnum.OnlyOut)); |
| | | if (locationInfo == null) |
| | | { |
| | | return responseContent.Error($"æµè¯æ¶è´§ä½ããããããããã:{stockInfo.LocationCode}åºåºæ¡ä»¶ä¸æ»¡è¶³"); |
| | | return responseContent.Error($"æµè¯æ¶è´§ä½:{stockInfo.LocationCode}åºåºæ¡ä»¶ä¸æ»¡è¶³"); |
| | | } |
| | | //çææµè¯æ¶åºåºä»»å¡ éå®åºå æ´æ¹è´§ä½ç¶æ |
| | | Dt_Task taskOut = new() |
| | |
| | | _unitOfWorkManage.CommitTran(); |
| | | //å°ä»»å¡æ¨éå°WCS |
| | | PushTasksToWCS(new List<Dt_Task>() { taskOut }, "AGV_CSJ"); |
| | | responseContent.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | responseContent.Error(ex.Message); |
| | | } |
| | | return responseContent; |
| | | } |
| | | } |
| | | public MesResponseContent SolderMaskOutNotice(SolderMaskOutNotice model) |
| | | { |
| | | lock (solderMask_out) |
| | | { |
| | | MesResponseContent responseContent = new MesResponseContent(); |
| | | try |
| | | { |
| | | Dt_Task exsit = Repository.QueryFirst(x => x.TargetAddress == model.TargetAddressCode); |
| | | if (exsit != null) |
| | | { |
| | | return responseContent.Error($"ç®æ å°åéå¤"); |
| | | } |
| | | |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA154.ToString()); |
| | | //è·ååºåè®°å½ |
| | | List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => |
| | | x.WarehouseId == warehouse.WarehouseId && |
| | | x.StockStatus == (int)StockStatusEmun.å
¥åºå®æ).Includes(x => x.Details).ToList(); |
| | | Dt_StockInfo? stockInfo = stockInfos.FirstOrDefault(x => x.Details.Any(x => x.BatchNo == model.LotNo)); |
| | | if (stockInfo == null) |
| | | { |
| | | return responseContent.Error($"é²çåº:æ {model.LotNo}å¯ç¨åºå"); |
| | | } |
| | | Dt_Task exsit2 = Repository.QueryFirst(x => x.PalletCode == stockInfo.PalletCode); |
| | | if (exsit2 != null) |
| | | { |
| | | return responseContent.Error($"é²çä»»å¡{stockInfo.PalletCode}å·²åå¨"); |
| | | } |
| | | |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode && |
| | | x.WarehouseId == stockInfo.WarehouseId && |
| | | x.LocationStatus == (int)LocationStatusEnum.InStock && |
| | | (x.EnableStatus == (int)EnableStatusEnum.Normal || x.EnableStatus == (int)EnableStatusEnum.OnlyOut)); |
| | | if (locationInfo == null) |
| | | { |
| | | return responseContent.Error($"é²çè´§ä½:{stockInfo.LocationCode}åºåºæ¡ä»¶ä¸æ»¡è¶³"); |
| | | } |
| | | //çæé²çåºåºä»»å¡ éå®åºå æ´æ¹è´§ä½ç¶æ |
| | | Dt_Task taskOut = new() |
| | | { |
| | | CurrentAddress = stockInfo.LocationCode, |
| | | Grade = 0, |
| | | PalletCode = stockInfo.PalletCode, |
| | | NextAddress = "", |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = stockInfo.LocationCode, |
| | | TargetAddress = model.TargetAddressCode, |
| | | TaskStatus = (int)TaskStatusEnum.New, |
| | | TaskType = stockInfo.PalletType<2 ? (int)TaskTypeEnum.MaskOutNoticeSmall : (int)TaskTypeEnum.MaskOutNoticeLarge, |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | PalletType = stockInfo.PalletType, |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | }; |
| | | stockInfo.StockStatus = (int)StockStatusEmun.åºåºéå®; |
| | | LocationStatusEnum locationStatus = (LocationStatusEnum)locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = (int)LocationStatusEnum.Lock; |
| | | //夿æ¯å¦æåºåºåä¿¡æ¯ |
| | | _unitOfWorkManage.BeginTran(); |
| | | //æ´æ°åºåç¶æ |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | | //æ´æ°è´§ä½ç¶æ |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, stockInfo.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId); |
| | | //æ°å»ºä»»å¡ |
| | | BaseDal.AddData(taskOut); |
| | | //å å
¥è´§ä½åå¨è®°å½ |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, locationStatus, LocationStatusEnum.Lock, LocationChangeType.OutboundAssignLocation, stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", taskOut.TaskNum); |
| | | _unitOfWorkManage.CommitTran(); |
| | | //å°ä»»å¡æ¨éå°WCS |
| | | PushTasksToWCS(new List<Dt_Task>() { taskOut }, "AGV_ZH"); |
| | | responseContent.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | responseContent.Error(ex.Message); |
| | | } |
| | | return responseContent; |
| | | } |
| | | } |
| | | |
| | | public MesResponseContent SolderMaskOut(SolderMaskOut model) |
| | | { |
| | | lock (solderMask_out) |
| | | { |
| | | MesResponseContent responseContent = new MesResponseContent(); |
| | | try |
| | | { |
| | | Dt_Task exsit = Repository.QueryFirst(x => x.TargetAddress == model.TargetAddressCode); |
| | | if (exsit != null) |
| | | { |
| | | return responseContent.Error($"ç®æ å°åéå¤"); |
| | | } |
| | | |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA154.ToString()); |
| | | //è·ååºåè®°å½ |
| | | List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => |
| | | x.WarehouseId == warehouse.WarehouseId && |
| | | x.StockStatus == (int)StockStatusEmun.å
¥åºå®æ).Includes(x => x.Details).ToList(); |
| | | Dt_StockInfo? stockInfo = stockInfos.FirstOrDefault(x => x.Details.Any(x => x.BatchNo == model.LotNo)); |
| | | if (stockInfo == null) |
| | | { |
| | | return responseContent.Error($"é²çåº:æ {model.LotNo}å¯ç¨åºå"); |
| | | } |
| | | Dt_Task exsit2 = Repository.QueryFirst(x => x.PalletCode == stockInfo.PalletCode); |
| | | if (exsit2 != null) |
| | | { |
| | | return responseContent.Error($"é²çä»»å¡{stockInfo.PalletCode}å·²åå¨"); |
| | | } |
| | | |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode && |
| | | x.WarehouseId == stockInfo.WarehouseId && |
| | | x.LocationStatus == (int)LocationStatusEnum.InStock && |
| | | (x.EnableStatus == (int)EnableStatusEnum.Normal || x.EnableStatus == (int)EnableStatusEnum.OnlyOut)); |
| | | if (locationInfo == null) |
| | | { |
| | | return responseContent.Error($"é²çè´§ä½:{stockInfo.LocationCode}åºåºæ¡ä»¶ä¸æ»¡è¶³"); |
| | | } |
| | | //çæé²çåºåºä»»å¡ éå®åºå æ´æ¹è´§ä½ç¶æ |
| | | Dt_Task taskOut = new() |
| | | { |
| | | CurrentAddress = stockInfo.LocationCode, |
| | | Grade = 0, |
| | | PalletCode = stockInfo.PalletCode, |
| | | NextAddress = "", |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = stockInfo.LocationCode, |
| | | TargetAddress = model.TargetAddressCode, |
| | | TaskStatus = (int)TaskStatusEnum.New, |
| | | TaskType = stockInfo.PalletType < 2 ? (int)TaskTypeEnum.MaskOutSmall : (int)TaskTypeEnum.MaskOutLarge, |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | PalletType = stockInfo.PalletType, |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | }; |
| | | stockInfo.StockStatus = (int)StockStatusEmun.åºåºéå®; |
| | | LocationStatusEnum locationStatus = (LocationStatusEnum)locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = (int)LocationStatusEnum.Lock; |
| | | //夿æ¯å¦æåºåºåä¿¡æ¯ |
| | | _unitOfWorkManage.BeginTran(); |
| | | //æ´æ°åºåç¶æ |
| | | _stockRepository.StockInfoRepository.UpdateData(stockInfo); |
| | | //æ´æ°è´§ä½ç¶æ |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, stockInfo.PalletType, LocationStatusEnum.Lock, stockInfo.WarehouseId); |
| | | //æ°å»ºä»»å¡ |
| | | BaseDal.AddData(taskOut); |
| | | //å å
¥è´§ä½åå¨è®°å½ |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, locationStatus, LocationStatusEnum.Lock, LocationChangeType.OutboundAssignLocation, stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", taskOut.TaskNum); |
| | | _unitOfWorkManage.CommitTran(); |
| | | //å°ä»»å¡æ¨éå°WCS |
| | | PushTasksToWCS(new List<Dt_Task>() { taskOut }, "AGV_ZH"); |
| | | responseContent.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// WMS忥æååºåºè³MES |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent ShipmentOrderSync(MesShipmentOrderSync model) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.WMS_MES_ShipmentOrderSync.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> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="stockInfo"></param> |
| | |
| | | tasks.ForEach(x => |
| | | { |
| | | x.TargetAddress = model.Line; |
| | | x.OrderNo = mesOutboundOrder.TaskNo; |
| | | }); |
| | | _unitOfWorkManage.BeginTran(); |
| | | |
| | |
| | | } |
| | | |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == palletTypeInfo.WarehouseId); |
| | | |
| | | //夿æ¯å¦æçåºåæ¯å¦å·²åå¨ |
| | | Dt_StockInfo stockInfoOld = _stockRepository.StockInfo_HtyRepository.QueryData(x => x.PalletCode == model.CarrierCode).First(); |
| | | if (stockInfoOld!=null) |
| | | { |
| | | return MesResponseContent.Instance.Error($"æçå·åºå{model.CarrierCode}å·²åå¨"); |
| | | } |
| | | |
| | | Dt_StockInfo_Hty stockInfo_Hty = _stockRepository.StockInfo_HtyRepository.QueryData(x => x.PalletCode == model.CarrierCode).OrderByDescending(x => x.SourceId).First(); |
| | | Dt_StockInfoDetail_Hty stockInfoDetail_Hty = _stockRepository.StockInfoDetail_HtyRepository.QueryFirst(x => x.StockId == stockInfo_Hty.SourceId); |
| | | |
| | | |
| | | Dt_StockInfoDetail stockInfoDetail = new Dt_StockInfoDetail() |
| | | { |
| | | MaterielSpec = stockInfoDetail_Hty.MaterielSpec, |
| | | BatchNo = stockInfoDetail_Hty?.BatchNo ?? "", |
| | | EffectiveDate = model.ExpirationDate, |
| | | MaterielCode = model.MaterialCode, |
| | | InboundOrderRowNo = stockInfoDetail_Hty?.InboundOrderRowNo ?? 0, |
| | | MaterielName = model.MaterialCode, |
| | | MaterielName = stockInfoDetail_Hty.MaterielName, |
| | | ProductionDate = model.ProductionDate, |
| | | OrderNo = stockInfoDetail_Hty?.OrderNo ?? "", |
| | | OutboundQuantity = 0, |
| | |
| | | TaskType = TaskTypeEnum.Inbound.ObjToInt(), |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | PalletType = stockInfo.PalletType |
| | | PalletType = stockInfo.PalletType, |
| | | MaterielCode = stockInfo.Details.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.MaterielCode, |
| | | Quantity = (float)stockInfo.Details.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.StockQuantity, |
| | | }; |
| | | LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; |
| | | _unitOfWorkManage.BeginTran(); |
| | |
| | | return MesResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// MESæåå
¥åºåæ¥æ¶ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public MesResponseContent BagInfoSync(MesBagInfoModel bagInfoModel) |
| | | { |
| | | MesResponseContent content = new MesResponseContent(); |
| | | try |
| | | { |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == bagInfoModel.WarehouseCode); |
| | | if (warehouse == null) |
| | | { |
| | | return content.Error("æªæ¾å°ä»åºä¿¡æ¯"); |
| | | } |
| | | Dt_LocationInfo locationInfo = _basicRepository.LocationInfoRepository.QueryFirst(x => x.WarehouseId == warehouse.WarehouseId); |
| | | if (locationInfo==null) |
| | | { |
| | | return content.Error($"æªæ¾å°{warehouse.WarehouseCode}è´§ä½ä¿¡æ¯"); |
| | | } |
| | | //å
å
ä¿¡æ¯ç»ç |
| | | List<Dt_MesProInOrderDetail> mesProInOrderDetails = new List<Dt_MesProInOrderDetail>(); |
| | | foreach (var item in bagInfoModel.BagDetails) |
| | | { |
| | | foreach (var child in item.BagItems) |
| | | { |
| | | Dt_MesProInOrderDetail mesProInOrderDetail = new Dt_MesProInOrderDetail() |
| | | { |
| | | BagNo = item.BagNo, |
| | | ProductCode = item.ProductCode, |
| | | ProductVersion = item.ProductVersion, |
| | | SETQty = child.SETQty, |
| | | OKPCSQTY = child.OKPCSQTY, |
| | | DateCode = item.DateCode, |
| | | XQty = child.XQty, |
| | | XSite = child.XSite, |
| | | Weight = item.Weight, |
| | | PackingDate = item.PackingDate, |
| | | LotNumber = child.LotNumber, |
| | | ERPOrder = child.ERPOrder, |
| | | SaleOrder = child.SaleOrder, |
| | | MoNumber = child.MoNumber, |
| | | }; |
| | | mesProInOrderDetails.Add(mesProInOrderDetail); |
| | | } |
| | | } |
| | | List<Dt_ProStockInfoDetail> proStockInfoDetails = new List<Dt_ProStockInfoDetail>(); |
| | | foreach (var item in mesProInOrderDetails) |
| | | { |
| | | proStockInfoDetails.Add(_mapper.Map<Dt_ProStockInfoDetail>(item)); |
| | | } |
| | | Dt_MesProInOrder mesProInOrder = new Dt_MesProInOrder() |
| | | { |
| | | WarehouseId = warehouse.WarehouseId, |
| | | BatchNo = bagInfoModel.BatchNo, |
| | | WorkCenter = bagInfoModel.WorkCenter, |
| | | MesProStatus = InOrderStatusEnum.æªå¼å§.ObjToInt(), |
| | | UnPackStock = bagInfoModel.UnPackStock, |
| | | Details = mesProInOrderDetails |
| | | }; |
| | | Dt_ProStockInfo proStockInfo = new Dt_ProStockInfo() |
| | | { |
| | | PalletCode = bagInfoModel.BatchNo, |
| | | PalletType = 1, |
| | | WarehouseId = warehouse.WarehouseId, |
| | | StockStatus = StockStatusEmun.å
¥åºç¡®è®¤.ObjToInt(), |
| | | proStockInfoDetails = proStockInfoDetails |
| | | }; |
| | | //åé
è´§ä½ |
| | | locationInfo = _basicService.LocationInfoService.AssignLocation(locationInfo.RoadwayNo, ((PalletTypeEnum)proStockInfo.PalletType).ObjToInt(), proStockInfo.WarehouseId); |
| | | Dt_Task newTask = new Dt_Task() |
| | | { |
| | | CurrentAddress = bagInfoModel.WorkCenter, |
| | | Grade = 0, |
| | | NextAddress = locationInfo.LocationCode, |
| | | PalletCode = proStockInfo.PalletCode, |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = bagInfoModel.WorkCenter, |
| | | TargetAddress = locationInfo.LocationCode, |
| | | TaskType = TaskTypeEnum.InProduct.ObjToInt(), |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | WarehouseId = warehouse.WarehouseId, |
| | | PalletType = proStockInfo.PalletType |
| | | }; |
| | | locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt(); |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | int taskId = BaseDal.AddData(newTask); |
| | | newTask.TaskId = taskId; |
| | | _basicRepository.LocationInfoRepository.UpdateData(locationInfo); |
| | | Db.InsertNav(mesProInOrder).Include(x => x.Details).ExecuteCommand(); |
| | | Db.InsertNav(proStockInfo).Include(x => x.proStockInfoDetails).ExecuteCommand(); |
| | | _unitOfWorkManage.CommitTran(); |
| | | //æ¨éä»»å¡ |
| | | PushTasksToWCS(new List<Dt_Task> { newTask }); |
| | | return content.OK("æ¥æ¶æå"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | public MesResponseContent BoxStockin(MesBoxInfoModel boxInfoModel) |
| | | { |
| | | MesResponseContent content = new MesResponseContent(); |
| | | try |
| | | { |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA101.ToString()); |
| | | //è·åMESå
å
ä¿¡æ¯ |
| | | List<Dt_MesProInOrderDetail> mesProInOrderDetails = new List<Dt_MesProInOrderDetail>(); |
| | | foreach (var item in boxInfoModel.Bags) |
| | | { |
| | | foreach (var child in item.BagItems) |
| | | { |
| | | Dt_MesProInOrderDetail mesProInOrderDetail = new Dt_MesProInOrderDetail() |
| | | { |
| | | BagNo = item.BagNo, |
| | | ProductCode = item.ProductCode, |
| | | ProductVersion = item.ProductVersion, |
| | | SETQty = child.SETQty, |
| | | OKPCSQTY = child.OKPCSQTY, |
| | | DateCode = item.DateCode, |
| | | XQty = child.XQty, |
| | | XSite = child.XSite, |
| | | Weight = item.Weight, |
| | | PackingDate = item.PackingDate, |
| | | LotNumber = child.LotNumber, |
| | | ERPOrder = child.ERPOrder, |
| | | SaleOrder = child.SaleOrder, |
| | | MoNumber = child.MoNumber, |
| | | }; |
| | | mesProInOrderDetails.Add(mesProInOrderDetail); |
| | | } |
| | | } |
| | | List<Dt_ProStockInfoDetail> proStockInfoDetails = new List<Dt_ProStockInfoDetail>(); |
| | | foreach (var item in mesProInOrderDetails) |
| | | { |
| | | proStockInfoDetails.Add(_mapper.Map<Dt_ProStockInfoDetail>(item)); |
| | | } |
| | | Dt_ProStockInfo proStockInfo = new Dt_ProStockInfo() |
| | | { |
| | | PalletCode = boxInfoModel.BoxNo, |
| | | PalletType = 0, |
| | | WarehouseId = warehouse.WarehouseId, |
| | | ShipmentOrder = boxInfoModel.ShipmentOrder, |
| | | StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(), |
| | | proStockInfoDetails = proStockInfoDetails |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | Db.InsertNav(proStockInfo).Include(x => x.proStockInfoDetails).ExecuteCommand(); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return content.OK("å¤å
æ¥æ¶æå"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// æåè¿å·¥æåº |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public MesResponseContent RworkTask(RworkTaskModel model) |
| | | { |
| | | MesResponseContent content = new MesResponseContent(); |
| | | try |
| | | { |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA72.ToString()); |
| | | if (warehouse==null) |
| | | { |
| | | return MesResponseContent.Instance.Error("æªæ¾å°æ¤ä»åº"); |
| | | } |
| | | Dt_MesRworkOutboundOrder mesRworkOutboundOrder = new Dt_MesRworkOutboundOrder() |
| | | { |
| | | WarehouseId=warehouse.WarehouseId, |
| | | TaskNo=model.TaskNo, |
| | | OrderStatus = InOrderStatusEnum.æªå¼å§.ObjToInt(), |
| | | CreateType = OrderCreateTypeEnum.UpperSystemPush.ObjToInt(), |
| | | ProductCode=model.ProductCode, |
| | | ProductName=model.ProductName, |
| | | ProductVersion=model.ProductVersion, |
| | | DateCode=model.DateCode, |
| | | RequiredQuantity=model.RequiredQuantity, |
| | | FactoryCode= model.FactoryCode, |
| | | SaleOrder=model.SaleOrder, |
| | | InventoryType=model.InventoryType, |
| | | }; |
| | | _unitOfWorkManage.BeginTran(); |
| | | _outboundService.RworkOutboundOrderService.AddData(mesRworkOutboundOrder); |
| | | _unitOfWorkManage.CommitTran(); |
| | | return content.OK("æä¾è¿åºåæ¥æ¶æå"); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// çæPP大å·åºåºä»»å¡ |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// è·åMESé»çæ¹æ¬¡ä¿¡æ¯ |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent GetZHMesMaterialLot(string materialLot) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.WMS_MES_GetProductByLot.ToString()); |
| | | object obj = new { LotNo = materialLot }; |
| | | MESRoot<object> root = new MESRoot<object>() |
| | | { |
| | | From = "WMS", |
| | | DateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | Content = obj |
| | | }; |
| | | 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, mesResponseContent.Content); |
| | | } |
| | | else |
| | | { |
| | | content.Error(mesResponseContent.StrMsg); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | } |
| | | } |