| | |
| | | private readonly IDt_AreaInfoRepository _areaInfoRepository; //åºå |
| | | private readonly IDt_StationManagerRepository _stationManagerRepository; |
| | | private readonly ISys_ConfigService _configService; |
| | | private readonly IDt_OutboundOrderRepository _outorderRepository; |
| | | private readonly IDt_OutboundOrderDetailRepository _outorderdetailRepository; |
| | | private readonly IDt_OtherOutboundOrderRepository _OtheroutorderRepository; |
| | | private readonly IDt_OtherOutboundOrderDetailRepository _OtheroutorderdetailRepository; |
| | | |
| | | public Dt_TaskService(IDt_TaskRepository BaseDal, |
| | | IUnitOfWorkManage unitOfWorkManage, |
| | |
| | | IStockInfoDetailRepository stockInfoDetailRepository, |
| | | IDt_StationManagerRepository stationManagerRepository, |
| | | ISys_ConfigService configService, |
| | | IDt_OutboundOrderRepository outorderRepository, |
| | | IDt_OutboundOrderDetailRepository outorderdetailRepository) : base(BaseDal) |
| | | IDt_OtherOutboundOrderRepository OtheroutorderRepository, |
| | | IDt_OtherOutboundOrderDetailRepository OtheroutorderdetailRepository) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _stockInfoRepository = stockInfoRepository; |
| | |
| | | _stockInfoDetailRepository = stockInfoDetailRepository; |
| | | _stationManagerRepository = stationManagerRepository; |
| | | _configService = configService; |
| | | _outorderRepository = outorderRepository; |
| | | _outorderdetailRepository = outorderdetailRepository; |
| | | _OtheroutorderRepository = OtheroutorderRepository; |
| | | _OtheroutorderdetailRepository = OtheroutorderdetailRepository; |
| | | } |
| | | |
| | | #region å¤é¨æ¥å£æ¹æ³ |
| | |
| | | Dt_Task taskNew = new Dt_Task(); |
| | | if (StartAddress.Floor != location.Floor) |
| | | { |
| | | taskNew = RequestAcrossFloorTask(StartAddress, location, (int)TaskInboundTypeEnum.Inbound, taskDto.PalletCode); |
| | | taskNew = RequestAcrossFloorTask(StartAddress, location, (int)TaskInboundTypeEnum.Inbound, taskDto); |
| | | } |
| | | else |
| | | { |
| | | taskNew = RequestAGVCarryTask(StartAddress, location, (int)TaskInboundTypeEnum.Inbound, taskDto.PalletCode); |
| | | taskNew = RequestAGVCarryTask(StartAddress, location, (int)TaskInboundTypeEnum.Inbound, taskDto); |
| | | } |
| | | return taskNew; |
| | | |
| | |
| | | Roadway = "SC1", |
| | | TargetAddress = location.LocationCode, |
| | | Dispatchertime = DateTime.Now, |
| | | MaterialNo = "", |
| | | MaterialNo = taskDto.MaterielCode, |
| | | NextAddress = station.stationChildCode, |
| | | OrderNo = null, |
| | | OrderNo = taskDto.OrderNo, |
| | | PalletCode = taskDto.PalletCode, |
| | | SourceAddress = taskDto.Position, |
| | | CurrentAddress = taskDto.Position, |
| | |
| | | Dt_Task taskNew = new Dt_Task(); |
| | | if (StartAddress.Floor != location.Floor) |
| | | { |
| | | taskNew = RequestAcrossFloorTask(StartAddress, location, taskDto.TaskType, taskDto.PalletCode); |
| | | taskNew = RequestAcrossFloorTask(StartAddress, location, taskDto.TaskType, taskDto); |
| | | } |
| | | else |
| | | { |
| | | taskNew = RequestAGVCarryTask(StartAddress, location, taskDto.TaskType, taskDto.PalletCode); |
| | | taskNew = RequestAGVCarryTask(StartAddress, location, taskDto.TaskType, taskDto); |
| | | } |
| | | return taskNew; |
| | | |
| | |
| | | #endregion |
| | | |
| | | #region 请æ±è·¨æ¥¼å±ä»»å¡ |
| | | public Dt_Task RequestAcrossFloorTask(DtLocationInfo StartAddress, DtLocationInfo EndAddress, int TaskType, string palletCode) |
| | | public Dt_Task RequestAcrossFloorTask(DtLocationInfo StartAddress, DtLocationInfo EndAddress, int TaskType, RequestTaskDto taskDto) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | |
| | |
| | | Roadway = "AGV", |
| | | TargetAddress = EndAddress.LocationCode, |
| | | Dispatchertime = DateTime.Now, |
| | | MaterialNo = "", |
| | | MaterialNo = taskDto.MaterielCode, |
| | | NextAddress = next.stationChildCode, |
| | | OrderNo = null, |
| | | PalletCode = palletCode, |
| | | OrderNo = taskDto.OrderNo, |
| | | PalletCode = taskDto.PalletCode, |
| | | SourceAddress = StartAddress.LocationCode, |
| | | CurrentAddress = StartAddress.LocationCode, |
| | | TaskState = (int)TaskAcrossFloorStatusEnum.CarryNew, |
| | |
| | | #endregion |
| | | |
| | | #region 请æ±AGVæ¬è¿ä»»å¡ |
| | | public Dt_Task RequestAGVCarryTask(DtLocationInfo StartAddress, DtLocationInfo EndAddress, int TaskType, string palletCode) |
| | | public Dt_Task RequestAGVCarryTask(DtLocationInfo StartAddress, DtLocationInfo EndAddress, int TaskType, RequestTaskDto taskDto) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | |
| | |
| | | Roadway = "AGV", |
| | | TargetAddress = EndAddress.LocationCode, |
| | | Dispatchertime = DateTime.Now, |
| | | MaterialNo = "", |
| | | MaterialNo = taskDto.MaterielCode, |
| | | NextAddress = EndAddress.LocationCode, |
| | | OrderNo = null, |
| | | PalletCode = palletCode, |
| | | OrderNo = taskDto.OrderNo, |
| | | PalletCode = taskDto.PalletCode, |
| | | SourceAddress = StartAddress.LocationCode, |
| | | CurrentAddress = StartAddress.LocationCode, |
| | | TaskState = (int)TaskAGVCarryStatusEnum.CarryNew, |
| | |
| | | return wcsBasez + address; |
| | | } |
| | | |
| | | public async Task<WebResponseContent> SendERPTaskCompletion(string palletCode) |
| | | /// <summary> |
| | | /// çäº§é¢æ |
| | | /// </summary> |
| | | /// <param name="palletCode"></param> |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> ERPProduction(string palletCode) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | DtStockInfo stock = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == palletCode); |
| | | Dt_Task task = await BaseDal.QueryFirstAsync(x => x.PalletCode == palletCode); |
| | | MaterialRequisition allocate = new MaterialRequisition |
| | | { |
| | | context = new Context |
| | | { |
| | | CultureName = "zh-CN", |
| | | EntCode = "001", |
| | | OrgCode = "102", |
| | | UserCode = "MH0551" |
| | | }, |
| | | documentTypeCode = "TransIn002", |
| | | businessDate = DateTime.Now.ToString("yyyy-MM-dd"), |
| | | isApproved = true, |
| | | |
| | | issueList = new List<issueList>() |
| | | { |
| | | new issueList |
| | | { |
| | | PickListID = task.OrderNo, |
| | | WhCode = "204", |
| | | IssueQty = task.OrderNo, |
| | | } |
| | | } |
| | | }; |
| | | return content.OK(data: allocate); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// è°æ¨ |
| | | /// </summary> |
| | | /// <param name="palletCode"></param> |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> ERPAllocate(string palletCode) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// æå |
| | | /// </summary> |
| | | /// <param name="palletCode"></param> |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> ERPMixedSend(string palletCode) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | DtStockInfo stock = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == palletCode); |
| | | Allocate allocate = new Allocate |
| | | { |
| | | context = new Context |
| | | { |
| | | CultureName = "zh-CN", |
| | | EntCode = "001", |
| | | OrgCode = "102", |
| | | UserCode = "MH0551" |
| | | }, |
| | | documentTypeCode = "TransIn002", |
| | | businessDate = DateTime.Now.ToString("yyyy-MM-dd"), |
| | | isApproved = true, |
| | | |
| | | transferInList = stock.StockInfoDetails.Select(item => new transferInList |
| | | { |
| | | ItemCode = item.MaterielCode, |
| | | TransInWHCode = item.Warehouse, |
| | | TransInQty = item.Quantity, |
| | | TransOutWHCode = "001", |
| | | }).ToList() |
| | | }; |
| | | return content.OK(data: allocate); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// ææ¶ |
| | | /// </summary> |
| | | /// <param name="palletCode"></param> |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> ERPMixedReceive(string palletCode) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | DtStockInfo stock = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == palletCode); |
| | | Allocate allocate = new Allocate |
| | | { |
| | | context = new Context |
| | | { |
| | | CultureName = "zh-CN", |
| | | EntCode = "001", |
| | | OrgCode = "102", |
| | | UserCode = "MH0551" |
| | | }, |
| | | documentTypeCode = "TransIn002", |
| | | businessDate = DateTime.Now.ToString("yyyy-MM-dd"), |
| | | isApproved = true, |
| | | |
| | | transferInList = stock.StockInfoDetails.Select(item => new transferInList |
| | | { |
| | | ItemCode = item.MaterielCode, |
| | | TransInWHCode = item.Warehouse, |
| | | TransInQty = item.Quantity, |
| | | TransOutWHCode = "001", |
| | | }).ToList() |
| | | }; |
| | | return content.OK(data: allocate); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// éæ |
| | | /// </summary> |
| | | /// <param name="palletCode"></param> |
| | | /// <returns></returns> |
| | | public async Task<WebResponseContent> ERPreturnMaterialList(string palletCode) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | DtStockInfo stock = await _stockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == palletCode); |
| | | Allocate allocate = new Allocate |
| | | { |
| | | context = new Context |
| | | { |
| | | CultureName = "zh-CN", |
| | | EntCode = "001", |
| | | OrgCode = "102", |
| | | UserCode = "MH0551" |
| | | }, |
| | | documentTypeCode = "TransIn002", |
| | | businessDate = DateTime.Now.ToString("yyyy-MM-dd"), |
| | | isApproved = true, |
| | | |
| | | transferInList = stock.StockInfoDetails.Select(item => new transferInList |
| | | { |
| | | ItemCode = item.MaterielCode, |
| | | TransInWHCode = item.Warehouse, |
| | | TransInQty = item.Quantity, |
| | | TransOutWHCode = "001", |
| | | }).ToList() |
| | | }; |
| | | return content.OK(data: allocate); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return content.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |