| | |
| | | using System.Diagnostics; |
| | | using System.Text.RegularExpressions; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Comm.WCSInterface.Requst; |
| | | using WIDESEA_Core.Const; |
| | | using WIDESEA_DTO.WMS; |
| | | using WIDESEA_IServices; |
| | | using WIDESEA_IStoragIntegrationServices; |
| | | using WIDESEA_StoragIntegrationServices; |
| | | using WIDESEAWCS_BasicInfoRepository; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob.Models; |
| | |
| | | private readonly IDt_StationManagerRepository _stationManagerRepository; |
| | | private readonly ISys_ConfigService _configService; |
| | | private readonly IDt_PalletStockInfoRepository _palletStockInfoRepository; |
| | | private readonly IDt_PalletStockInfoDetailRepository _palletStockInfoDetailRepository; |
| | | private readonly IDt_PalletStockInfo_htyRepository _palletStockInfo_HtyRepository; |
| | | private readonly IBoxingInfoRepository _boxingInfoRepository; |
| | | |
| | | public static string AGV_Interface = "http://192.168.1.195:10200/"; |
| | | |
| | | public Dt_TaskService(IDt_TaskRepository BaseDal, |
| | | IUnitOfWorkManage unitOfWorkManage, |
| | | IDt_OutOrderRepository outOrderRepository, |
| | | IStockInfoRepository stockInfoRepository, |
| | | IDt_Task_HtyRepository task_HtyRepository, |
| | | IMapper mapper, |
| | | ILocationInfoRepository locationRepository, |
| | | ITaskExecuteDetailRepository taskExecuteDetailRepository, |
| | | ILocationStatusChangeRecordRepository locationStatusChangeRecordRepository, |
| | | IStockInfoDetailRepository stockInfoDetailRepository, |
| | | IDt_StationManagerRepository stationManagerRepository, |
| | | ISys_ConfigService configService, IDt_PalletStockInfoRepository palletStockInfoRepository) : base(BaseDal) |
| | | ISys_ConfigService configService, IDt_PalletStockInfoRepository palletStockInfoRepository, IDt_PalletStockInfo_htyRepository palletStockInfo_HtyRepository, IBoxingInfoRepository boxingInfoRepository, IDt_PalletStockInfoDetailRepository palletStockInfoDetailRepository) : base(BaseDal) |
| | | |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | |
| | | _stationManagerRepository = stationManagerRepository; |
| | | _configService = configService; |
| | | _palletStockInfoRepository = palletStockInfoRepository; |
| | | _palletStockInfo_HtyRepository = palletStockInfo_HtyRepository; |
| | | _boxingInfoRepository = boxingInfoRepository; |
| | | _palletStockInfoDetailRepository = palletStockInfoDetailRepository; |
| | | } |
| | | |
| | | #region å¤é¨æ¥å£æ¹æ³ |
| | | |
| | | #region å
¥åºä»»å¡å®æ |
| | | |
| | | /// <summary> |
| | | /// 宿å
¥åºä»»å¡ |
| | | /// </summary> |
| | |
| | | try |
| | | { |
| | | |
| | | // è·åMESä¿¡æ¯åç®æ ä½ç½®ä¿¡æ¯ |
| | | //var mes_Wheels = await _InWheels_MesRepository.QueryFirstNavAsync(x => x.Wheels_Num == task.PalletCode); |
| | | // è·ååºä½ä¿¡æ¯ |
| | | var locationInf = await _locationRepository.QueryFirstAsync(x => x.LocationCode == task.TargetAddress && x.RoadwayNo == task.Roadway); |
| | | |
| | | int lastStatus = locationInf.LocationStatus; |
| | |
| | | // å建åå²ä»»å¡å®ä¾æ¨¡å |
| | | var taskHty = CreateHistoricalTask(task); |
| | | |
| | | //è·åç»çä¿¡æ¯ |
| | | var boxinginfo = await _boxingInfoRepository.QueryFirstNavAsync(x => x.PalletCode == task.PalletCode); |
| | | |
| | | // æ ¹æ®å建åºåå®ä¾æ¨¡å |
| | | var boxDetail = boxinginfo.BoxingInfoDetails.Adapt<List<Dt_PalletStockInfoDetail>>(); |
| | | Dt_PalletStockInfo palletStockInfo = new Dt_PalletStockInfo |
| | | { |
| | | |
| | | CreateDate = DateTime.Now, |
| | | Creater = task.Creater, |
| | | LocationCode = task.TargetAddress, |
| | | StockStatus = 2, |
| | | PalletCode = task.PalletCode, |
| | | AreaCode = task.Roadway, |
| | | StockInfoDetails = boxDetail |
| | | }; |
| | | |
| | | // æ§è¡æ°æ®åºäºå¡ |
| | | bool isResult = await ExecuteTransaction(palletStockInfo, taskHty, locationInf, task.TaskId); |
| | | bool isResult = await ExecuteTransaction(palletStockInfo, taskHty, locationInf, task.TaskId, boxinginfo); |
| | | if (isResult) |
| | | { |
| | | _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(locationInf, lastStatus, (int)StatusChangeTypeEnum.AutomaticStorage, task.TaskNum); |
| | |
| | | #endregion å
¥åºä»»å¡å®æ |
| | | |
| | | #region åºåºä»»å¡å®æ |
| | | public async Task<WebResponseContent> CompleteStackTaskAsync(Dt_Task task, Dt_PalletStockInfo stock) |
| | | public async Task<WebResponseContent> CompleteStackTaskAsync(Dt_Task task) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | // æ´æ°åºä½ç¶æä¸ä»»å¡ç¶æ |
| | | //(var loc, var tas) = UpdateStockAndTaskStatus(stock, task); |
| | | //var taskHty = task.Adapt<Dt_Task_Hty>(); |
| | | //taskHty.FinishTime = DateTime.Now; |
| | | //taskHty.OperateType = (int)OperateTypeEnum.èªå¨å®æ; |
| | | var stock = _palletStockInfoRepository.QueryFirst(x => x.PalletCode == task.PalletCode); |
| | | |
| | | //Dt_WheelsStock_hty stockInfo_Hty = stock.Adapt<Dt_WheelsStock_hty>(); |
| | | //stockInfo_Hty.FinishWheelDate = DateTime.Now; |
| | | //stockInfo_Hty.OperateType = (int)OperateTypeEnum.èªå¨å®æ; |
| | | (var loc, var tas) = UpdateStockAndTaskStatus(stock, task); |
| | | var taskHty = task.Adapt<Dt_Task_Hty>(); |
| | | taskHty.FinishTime = DateTime.Now; |
| | | taskHty.OperateType = (int)OperateTypeEnum.èªå¨å®æ; |
| | | |
| | | //// äºå¡å¤ç |
| | | //await _unitOfWorkManage.UseTranAsync(async () => |
| | | //{ |
| | | // var isLocationUpdate = await _locationRepository.UpdateDataAsync(loc); //æ´æ°åºä½ |
| | | // //var isTaskUpdated = await BaseDal.DeleteDataByIdAsync(task.TaskId); //å é¤ä»»å¡ |
| | | // var isTaskAdd = await _task_HtyRepository.AddDataAsync(taskHty) > 0; //å å
¥åå²ä»»å¡ |
| | | //}); |
| | | Dt_PalletStockInfo_hty stockInfo_Hty = stock.Adapt<Dt_PalletStockInfo_hty>(); |
| | | stockInfo_Hty.FinishTime = DateTime.Now; |
| | | stockInfo_Hty.OperateType = (int)OperateTypeEnum.èªå¨å®æ; |
| | | |
| | | var boxinfo = _boxingInfoRepository.QueryFirst(x => x.PalletCode == task.PalletCode); |
| | | |
| | | // äºå¡å¤ç |
| | | await _unitOfWorkManage.UseTranAsync(async () => |
| | | { |
| | | var isLocationUpdate = await _locationRepository.UpdateDataAsync(loc); //æ´æ°åºä½ |
| | | var isPalletHty = await _palletStockInfo_HtyRepository.AddDataAsync(stockInfo_Hty); //æ·»å åå²åºåè®°å½ |
| | | var isTaskUpdated = await BaseDal.DeleteDataByIdAsync(task.TaskId); //å é¤ä»»å¡ |
| | | var isTaskAdd = await _task_HtyRepository.AddDataAsync(taskHty) > 0; //å å
¥åå²ä»»å¡ |
| | | var isDelete = await _palletStockInfoRepository.DeleteDataAsync(stock); //å é¤åºå |
| | | await DeleteStockInfoDetailsAsync(stock.StockInfoDetails); //å é¤åºåæç» |
| | | //if (boxinfo != null) |
| | | //{ |
| | | // var isDeleteBoxing = await _boxingInfoRepository.Db.DeleteNav<DtBoxingInfo>(x => x.Id == boxinfo.Id) |
| | | // .Include(x => x.BoxingInfoDetails) |
| | | // .ExecuteCommandAsync(); //å é¤ç»ç |
| | | //} |
| | | |
| | | }); |
| | | |
| | | return content.OK("ä»»å¡å®ææå", task.Remark); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | private (DtLocationInfo, Dt_Task) UpdateStockAndTaskStatus(Dt_WheelsStock stock, Dt_Task task) |
| | | private (DtLocationInfo, Dt_Task) UpdateStockAndTaskStatus(Dt_PalletStockInfo stock, Dt_Task task) |
| | | { |
| | | var location = _locationRepository.QueryFirst(x => x.LocationCode == task.SourceAddress && x.RoadwayNo == task.Roadway); |
| | | int lastStatus = location.LocationStatus; |
| | |
| | | |
| | | |
| | | // éªè¯åºåæ¯å¦åå¨ |
| | | var stock = await _palletStockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == task.PalletCode); |
| | | //var stock = await _palletStockInfoRepository.QueryFirstNavAsync(x => x.PalletCode == task.PalletCode); |
| | | |
| | | // æ ¹æ®ä»»å¡ç±»åè°ç¨ç¸åºç宿任塿¹æ³ |
| | | switch (task.TaskType) |
| | | { |
| | | case (int)TaskInboundTypeEnum.Inbound: |
| | | case (int)TaskInboundTypeEnum.InWheels: |
| | | case (int)TaskInboundTypeEnum.InBrake: |
| | | LogFactory.GetLog("ä»»å¡å®æ").InfoFormat(true, "å
¥åºä»»å¡", ""); |
| | | return await CompleteInboundTaskAsync(task); |
| | | |
| | | case (int)TaskOutboundTypeEnum.Outbound: |
| | | case (int)TaskOutboundTypeEnum.OutBrake: |
| | | case (int)TaskOutboundTypeEnum.OutWheels: |
| | | LogFactory.GetLog("ä»»å¡å®æ").InfoFormat(true, "åºåºä»»å¡", ""); |
| | | return await CompleteStackTaskAsync(task, stock); |
| | | return await CompleteStackTaskAsync(task); |
| | | default: |
| | | return content.Error("ä»»å¡ç±»åä¸åå¨"); |
| | | } |
| | |
| | | #endregion ä»»å¡å®æ |
| | | |
| | | #region 请æ±ä»»å¡å
¥åº |
| | | |
| | | #region |
| | | |
| | | #endregion 请æ±ä»»å¡å
¥åº |
| | | |
| | | /// <summary> |
| | | /// æ´æ°ä»»å¡è´§ä½ |
| | | /// </summary> |
| | |
| | | if (task == null) |
| | | return content.Error($"ææªæ¾å°ã{input.PalletCode}ãçä»»å¡"); |
| | | |
| | | return content = await UpdateExistingTask(input, task); |
| | | return content; //= await UpdateExistingTask(input, task); |
| | | } |
| | | catch (Exception err) |
| | | { |
| | |
| | | |
| | | #endregion å¤é¨æ¥å£æ¹æ³ |
| | | |
| | | #region 请æ±åºåºï¼å®çï¼ |
| | | |
| | | |
| | | /// <summary> |
| | | /// å建任å¡DTO |
| | | /// </summary> |
| | | private WMSTaskDTO CreateTaskDTO(Dt_Task task) |
| | | { |
| | | return new WMSTaskDTO |
| | | { |
| | | TaskNum = task.TaskNum.Value, |
| | | Grade = task.Grade.Value, |
| | | PalletCode = task.PalletCode, |
| | | RoadWay = task.Roadway, |
| | | SourceAddress = task.SourceAddress, |
| | | TargetAddress = task.TargetAddress, |
| | | TaskState = task.TaskState.Value, |
| | | Id = 0, |
| | | TaskType = task.TaskType |
| | | }; |
| | | } |
| | | |
| | | #endregion 请æ±åºåºï¼å®ç&空çï¼ |
| | | |
| | | #region ä»»å¡ç¶ææ´æ¹ |
| | | |
| | |
| | | return content.Error("æªæ¥è¯¢å°å¯¹åºçåºåä¿¡æ¯"); |
| | | } |
| | | |
| | | if (stockInfo.StockStatus != 1) return content.Error("æå®å¤±è´¥ï¼å½åç¶æä¸å
许æå®åºåº"); |
| | | if (stockInfo.StockStatus != 2) return content.Error("æå®å¤±è´¥ï¼å½åç¶æä¸å
许æå®åºåº"); |
| | | |
| | | stockInfo.StockStatus = 4; |
| | | stockInfo.StockStatus = 3; |
| | | |
| | | //æ¥è¯¢åºä½æ¯å¦éå®ï¼ |
| | | var location = _locationRepository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode); |
| | |
| | | { |
| | | return content.Error($"ã{palletCode}ãå·²åå¨ä»»å¡"); |
| | | } |
| | | // var stationInfo = _stationManagerRepository.QueryFirst(x => x.stationChildCode == station); |
| | | |
| | | var stationInfo = _stationManagerRepository.QueryFirst(x => x.stationChildCode == station); |
| | | |
| | | |
| | | // å建并添å ä»»å¡å°æ°æ®åº |
| | | string agvId = Guid.NewGuid().ToString().Replace("-", "").Take(16); |
| | | task = new Dt_Task |
| | | { |
| | | Grade = 1, |
| | | Roadway = "SC1", |
| | | TargetAddress = station, |
| | | Roadway = stationInfo.Roadway, |
| | | TargetAddress = stationInfo.stationLocation, |
| | | Dispatchertime = DateTime.Now, |
| | | MaterialNo = "", |
| | | NextAddress = "2010", |
| | | NextAddress = stationInfo.stationLocation, |
| | | OrderNo = null, |
| | | PalletCode = stockInfo.PalletCode, |
| | | SourceAddress = stockInfo.LocationCode, |
| | | CurrentAddress = stockInfo.LocationCode, |
| | | TaskState = (int)TaskOutStatusEnum.OutNew, |
| | | TaskType = (int)TaskOutboundTypeEnum.OutWheels, |
| | | TaskType = (int)TaskOutboundTypeEnum.Outbound, |
| | | TaskNum = BaseDal.GetTaskNo().Result, |
| | | Creater = "System", |
| | | CreateDate = DateTime.Now, |
| | | TaskId = 0, |
| | | //task_bak1 = JsonConvert.SerializeObject(checkInfo) |
| | | AGVtaskId = agvId |
| | | }; |
| | | |
| | | // å建任å¡ä¼ è¾ç¨çDTO对象 |
| | | var taskDTO = CreateTaskDTO(task); |
| | | |
| | | // è·åWMS IPå°åç¨äºåéä»»å¡è¯·æ± |
| | | var wmsIpAddress = GetWCSIpReceiveTask(); |
| | | if (wmsIpAddress == null) |
| | | addtask schedulingTask = new addtask |
| | | { |
| | | throw new InvalidOperationException("WMS IP æªé
ç½®"); |
| | | } |
| | | task_id = task.AGVtaskId, |
| | | task_type = task.TaskType == (int)TaskTypeEnum.Inbound ? "push" : "pop", |
| | | work_begin = task.SourceAddress, |
| | | work_end = task.TargetAddress |
| | | }; |
| | | |
| | | var tasks = new List<WMSTaskDTO>() { taskDTO }; |
| | | // åéä»»å¡è¯·æ±å°WMS |
| | | var result = HttpHelper.Post(wmsIpAddress, tasks.ToJsonString()); |
| | | string address = AGV_Interface + "add_task"; |
| | | |
| | | string result = HttpsClient.PostAsync(address, schedulingTask.ToDictionary()).Result; |
| | | |
| | | content = JsonConvert.DeserializeObject<WebResponseContent>(result); |
| | | if (content.Status) |
| | | |
| | | if (content.ack != 0) |
| | | { |
| | | // æ·»å ä»»å¡å°æ°æ®åº |
| | | BaseDal.AddData(task); |
| | | // æ´æ°åºä½ä½ç½®ç¶æä¸ºä¸å¯ç¨ |
| | | _locationRepository.UpdateData(location); |
| | | _palletStockInfoRepository.UpdateData(stockInfo); |
| | | Console.WriteLine($"请æ±RCSå¼å¸¸ï¼{content.msg}"); |
| | | LogFactory.GetLog("ä¸åAGVä»»å¡").Info(true, $"\r\r--------------------------------------"); |
| | | LogFactory.GetLog("ä¸åAGVä»»å¡").Info(true, $"请æ±åæ°ï¼{schedulingTask.ToJsonString()}"); |
| | | LogFactory.GetLog("ä¸åAGVä»»å¡").Info(true, $"ååºåæ°ï¼{content.ToJsonString()}"); |
| | | throw new Exception(content.msg); |
| | | } |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | // æ·»å ä»»å¡å°æ°æ®åº |
| | | BaseDal.AddData(task); |
| | | // æ´æ°åºä½ä½ç½®ç¶æä¸ºä¸å¯ç¨ |
| | | _locationRepository.UpdateData(location); |
| | | _palletStockInfoRepository.UpdateData(stockInfo); |
| | | |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | Console.WriteLine($"åçå¼å¸¸: {ex.Message}"); |
| | | content.Error(ex.Message); |
| | | } |
| | | |
| | | return content; |
| | | } |
| | | |
| | | private string GetWCSIpReceiveTask() |
| | | private string GetAGVIpReceiveTask() |
| | | { |
| | | //var configs = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); |
| | | //var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.WCSIPAddress)?.ConfigValue; |
| | | //var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.ReceiveTask)?.ConfigValue; |
| | | //if (wmsBase == null || ipAddress == null) |
| | | //{ |
| | | // return null; |
| | | //} |
| | | //return wmsBase + ipAddress; |
| | | return null; |
| | | var configs = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); |
| | | var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.AGVIPAddress)?.ConfigValue; |
| | | var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.addTask)?.ConfigValue; |
| | | if (wmsBase == null || ipAddress == null) |
| | | { |
| | | return null; |
| | | } |
| | | return wmsBase + ipAddress; |
| | | } |
| | | |
| | | #endregion æå®ä»»å¡åºåº |
| | |
| | | |
| | | #region private å
鍿¹æ³ |
| | | |
| | | |
| | | private async Task DeleteStockInfoDetailsAsync(IEnumerable<Dt_PalletStockInfoDetail> details) |
| | | { |
| | | if (details != null) |
| | | { |
| | | var ids = details.Select(x => (object)x.Id).ToArray(); |
| | | var isStockDetailUpdated = await _palletStockInfoDetailRepository.DeleteDataByIdsAsync(ids); |
| | | if (!isStockDetailUpdated) |
| | | { |
| | | throw new Exception("åºå详æ
ä¿¡æ¯æ´æ°å¤±è´¥"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å建åå²ä»»å¡è®°å½ |
| | | /// </summary> |
| | |
| | | return taskHty; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ°åºåä½ç½® |
| | | /// </summary> |
| | | /// <param name="stock">åºå对象</param> |
| | | /// <param name="toLocation">ç®æ ä½ç½®</param> |
| | | // æ´æ°åºååä½ç½®ä¿¡æ¯ |
| | | private (Dt_WheelsStock, DtLocationInfo, DtLocationInfo) UpdateStockLocation(Dt_WheelsStock stock, Dt_Task task) |
| | | { |
| | | //ä¿®æ¹æ¥æºåºä½å ç®æ åºä½ç¶æ |
| | | var fromLocation = _locationRepository.QueryFirst(x => x.LocationCode == task.SourceAddress && x.RoadwayNo == task.Roadway); |
| | | fromLocation.LocationStatus = (int)LocationEnum.Free; |
| | | var toLocation = _locationRepository.QueryFirst(x => x.LocationCode == task.TargetAddress && x.RoadwayNo == task.Roadway); |
| | | toLocation.LocationStatus = (int)LocationEnum.InStock; |
| | | |
| | | // å°åºåä½ç½®è®¾ç½®ä¸ºç®æ ä½ç½® |
| | | stock.Wheels_Location = task.TargetAddress; |
| | | |
| | | // è¿åæ´æ°åçåºååä½ç½®ä¿¡æ¯ |
| | | return (stock, fromLocation, toLocation); |
| | | } |
| | | |
| | | #region æ§è¡æ°æ®åºäºå¡ |
| | | /// <summary> |
| | | /// æ§è¡æ°æ®åºäºå¡ |
| | |
| | | /// <param name="taskHty">åå²ä»»å¡å¯¹è±¡</param> |
| | | /// <param name="taskId">ä»»å¡ID</param> |
| | | /// <returns></returns> |
| | | private async Task<bool> ExecuteTransaction(Dt_PalletStockInfo stock, Dt_Task_Hty taskHty, DtLocationInfo locationInfo, int taskId /*Dt_InWheels_mes inWheels_Mes = null*/) |
| | | private async Task<bool> ExecuteTransaction(Dt_PalletStockInfo stock, Dt_Task_Hty taskHty, DtLocationInfo locationInfo, int taskId, DtBoxingInfo boxingInfo) |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | try |
| | | { |
| | | var isUpdateStock = false; |
| | | var isDeleteWheelsMes = false; |
| | | |
| | | |
| | | var isUpdateStock = true; |
| | | var isDeleteBoxing = true; |
| | | // æ·»å åºå |
| | | isUpdateStock = _palletStockInfoRepository.AddData(stock) > 0; |
| | | //if (inWheels_Mes != null) |
| | | //{ |
| | | // isDeleteWheelsMes = _InWheels_MesRepository.DeleteData(inWheels_Mes); |
| | | isUpdateStock = await _palletStockInfoRepository.AddDataNavAsync(stock); |
| | | |
| | | // //var wheels_Mes_Hty = inWheels_Mes.Adapt<Dt_InWheels_mes_hty>(); |
| | | |
| | | // //wheels_Mes_Hty.Wheels_CurrentStatue = "2"; |
| | | // //wheels_Mes_Hty.FinishDate = DateTime.Now; |
| | | // //wheels_Mes_Hty.OperateType = (int)OperateTypeEnum.èªå¨å®æ; |
| | | |
| | | // //_InWheels_Mes_HtyRepository.AddData(wheels_Mes_Hty); |
| | | //} |
| | | |
| | | //å é¤ç»çæ°æ® |
| | | if (boxingInfo != null) |
| | | { |
| | | boxingInfo.CurrentStatue = 5; |
| | | isDeleteBoxing = await _boxingInfoRepository.Db.DeleteNav<DtBoxingInfo>(x => x.Id == boxingInfo.Id) |
| | | .Include(x => x.BoxingInfoDetails) |
| | | .ExecuteCommandAsync(); |
| | | } |
| | | //var box = _boxingInfoRepository.dele(boxingInfo); |
| | | |
| | | // æ·»å åå²ä»»å¡ |
| | | var isTaskHtyAdd = await _task_HtyRepository.AddDataAsync(taskHty) > 0; |
| | |
| | | var isTaskDelete = await Delete(taskId); |
| | | |
| | | // æäº¤æåæ»äºå¡ |
| | | if (isUpdateStock && isTaskHtyAdd && isTaskDelete && isUpdateLoc && isDeleteWheelsMes) |
| | | if (isUpdateStock && isTaskHtyAdd && isTaskDelete && isUpdateLoc && isDeleteBoxing) |
| | | { |
| | | LogFactory.GetLog("ä»»å¡å®æ").InfoFormat(true, "ä»»å¡å®æ", $"äºå¡å¤ç宿,æäº¤äºå¡ãæ·»å åå²ä»»å¡ï¼{isTaskHtyAdd},å é¤ä»»å¡æ°æ®ï¼{isTaskDelete},æ´æ°ææ·»å åºåï¼{isUpdateStock},ä¿®æ¹å
¥åºåè´§ä½ç¶æï¼{isUpdateLoc}"); |
| | | _unitOfWorkManage.CommitTran(); |
| | |
| | | var content = new WebResponseContent(); |
| | | |
| | | // è·ååºä½ |
| | | var location = RequestLocation(input); |
| | | if (location == null) |
| | | { |
| | | return content.Error("æ æ³è·åè´§ä½ä¿¡æ¯"); |
| | | } |
| | | //var location = RequestLocation(input); |
| | | //if (location == null) |
| | | //{ |
| | | // return content.Error("æ æ³è·åè´§ä½ä¿¡æ¯"); |
| | | //} |
| | | |
| | | string toAddress = location.LocationCode; |
| | | int taskState = (int)TaskInStatusEnum.Line_InFinish; |
| | | int beforeStatus = location.LocationStatus; |
| | | // æ´æ°è´§ä½ä¿¡æ¯ |
| | | location.LocationStatus = (int)LocationEnum.Lock; |
| | | //string toAddress = location.LocationCode; |
| | | //int taskState = (int)TaskInStatusEnum.Line_InFinish; |
| | | //int beforeStatus = location.LocationStatus; |
| | | //// æ´æ°è´§ä½ä¿¡æ¯ |
| | | //location.LocationStatus = (int)LocationEnum.Lock; |
| | | |
| | | // æ´æ°ä»»å¡ä¿¡æ¯ |
| | | MapTaskProperties(task, input, toAddress, taskState); |
| | | //MapTaskProperties(task, input, toAddress, taskState); |
| | | |
| | | _unitOfWorkManage.BeginTran(); |
| | | // å¼å§äºå¡ |
| | | var isResult = await UpdateTaskAsync(task, location, beforeStatus); |
| | | var isResult = false; //await UpdateTaskAsync(task, location, beforeStatus); |
| | | if (!isResult) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |