| | |
| | | using WIDESEA_ITaskInfoService; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_Common.OrderEnum; |
| | | using WIDESEA_Model.Models.Outbound; |
| | | using System.Diagnostics.Metrics; |
| | | using System.Reflection.Metadata; |
| | | using WIDESEA_Model.Models.Inbound; |
| | | using WIDESEA_DTO.Task; |
| | | |
| | | namespace WIDESEA_TaskInfoService |
| | |
| | | OutboundQuantity = 0, |
| | | SerialNumber = stockInfoDetail_Hty?.SerialNumber ?? "0", |
| | | StockQuantity = model.Quantity, |
| | | Status = StockStatusEmun.MESéåº.ObjToInt(), |
| | | Status = model.Quantity <= 0.0 ? StockStatusEmun.MES空æéåº.ObjToInt() : StockStatusEmun.MESéåº.ObjToInt(), |
| | | Unit = model.Unit |
| | | }; |
| | | Dt_StockInfo stockInfo = new Dt_StockInfo() |
| | |
| | | PalletCode = model.CarrierCode, |
| | | PalletType = palletTypeInfo.PalletType, |
| | | WarehouseId = warehouse.WarehouseId, |
| | | StockStatus = StockStatusEmun.MESéåº.ObjToInt(), |
| | | Details = new List<Dt_StockInfoDetail> { stockInfoDetail } |
| | | StockStatus = stockInfoDetail.StockQuantity <= 0.0 ? StockStatusEmun.MES空æéåº.ObjToInt() : StockStatusEmun.MESéåº.ObjToInt(), |
| | | Details = new List<Dt_StockInfoDetail> { stockInfoDetail }, |
| | | Remark = stockInfoDetail.StockQuantity <= 0.0 ? StockStatusEmun.MES空æéåº.ToString() : StockStatusEmun.MESéåº.ToString() |
| | | }; |
| | | //Dt_Task task = new Dt_Task() |
| | | //{ |
| | |
| | | { |
| | | return MesResponseContent.Instance.Error("ä»åºä¿¡æ¯æªé
ç½®"); |
| | | } |
| | | Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == item.CarrierCode); |
| | | Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.QueryFirst(x => x.PalletCode == item.CarrierCode || x.WarehouseId == warehouse.WarehouseId); |
| | | if (stockInfo == null) |
| | | { |
| | | return MesResponseContent.Instance.Error("æªæ¾å°æ¤è½½å
·ç¼å·åºå"); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// PPåºåæ¥è¯¢ |
| | | /// </summary> |
| | |
| | | MesResponseContent content = new MesResponseContent(); |
| | | try |
| | | { |
| | | |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA58.ToString()); |
| | | List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => |
| | | x.WarehouseId == warehouse.WarehouseId && |
| | |
| | | content.BSucc = true; |
| | | content.StrCode = "0000"; |
| | | content.StrMsg = "æ§è¡æå"; |
| | | content.DataTime = DateTime.Now; |
| | | content.MaterialCode = stock.MaterielCode; |
| | | content.Quantity = stock.StockQuantity; |
| | | content.Unit = stock.Unit; |
| | |
| | | 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("æªæ¾å°ä»åºä¿¡æ¯"); |
| | | } |
| | | List<Dt_MesProInOrderDetail> mesProInOrderDetails = new List<Dt_MesProInOrderDetail>(); |
| | | foreach (var item in bagInfoModel.BagDetails) |
| | | { |
| | | mesProInOrderDetails.Add(_mapper.Map<Dt_MesProInOrderDetail>(item)); |
| | | } |
| | | mesProInOrderDetails.ForEach(x => |
| | | { |
| | | x.OverInQuantity = 0; |
| | | }); |
| | | Dt_MesProInOrder mesProInOrder = new Dt_MesProInOrder() |
| | | { |
| | | WarehouseId = warehouse.WarehouseId, |
| | | BatchNo = bagInfoModel.BatchNo, |
| | | MesProStatus = InOrderStatusEnum.æªå¼å§.ObjToInt(), |
| | | UnPackStock=bagInfoModel.UnPackStock, |
| | | Details= mesProInOrderDetails |
| | | }; |
| | | Db.InsertNav(mesProInOrder).Include(x=>x.Details).ExecuteCommand(); |
| | | 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) |
| | | { |
| | | try |
| | | { |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA72.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.ProductVersion)); |
| | | if (stockInfo == null) |
| | | { |
| | | return MesResponseContent.Instance.Error($"å°¾æ°ä»:{model.ProductVersion}æ å¯ç¨åºå"); |
| | | } |
| | | Dt_Task exsit2 = Repository.QueryFirst(x => x.PalletCode == stockInfo.PalletCode); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | throw; |
| | | } |
| | | return MesResponseContent.Instance.OK(); |
| | | } |
| | | |
| | | } |
| | | } |