已删除6个文件
已修改65个文件
已添加11个文件
| | |
| | | /// AGVå¨ä½ç»å®æ¥è¯¢ |
| | | /// </summary> |
| | | [Description("AGVå¨ä½ç»å®æ¥è¯¢")] |
| | | Agv_CSJPodBerthAndMat |
| | | Agv_CSJPodBerthAndMat, |
| | | /// <summary> |
| | | /// æåæç®±åæ¾è´§éç¥åè° |
| | | /// </summary> |
| | | [Description("æåæç®±åæ¾è´§éç¥åè°")] |
| | | AGV_CPBoxApplyPass |
| | | } |
| | | } |
| | |
| | | [Description("æååºåº")] |
| | | OutProduct = 230, |
| | | /// <summary> |
| | | /// æåå¯å®è½¬ä» |
| | | /// </summary> |
| | | [Description("æåå¯å®è½¬ä»")] |
| | | OutSendProduct = 240, |
| | | /// <summary> |
| | | /// éè´å
¥åº |
| | | /// </summary> |
| | | [Description("éè´å
¥åº")] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEAWCS_DTO.Agv |
| | | { |
| | | /// <summary> |
| | | /// æç®±åè° |
| | | /// </summary> |
| | | public class AGVBoxApplyPassDTO |
| | | { |
| | | /// <summary> |
| | | /// 请æ±ç¼å· |
| | | /// </summary> |
| | | public string ReqCode { get; set; } |
| | | /// <summary> |
| | | /// è¯·æ±æ¶é´ |
| | | /// </summary> |
| | | public string ReqTime { get; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string? ClientCode { get; set; } |
| | | /// <summary> |
| | | /// 令çå· |
| | | /// </summary> |
| | | public string? TokenCode { get; set; } |
| | | /// <summary> |
| | | /// ä»»å¡åå· |
| | | /// </summary> |
| | | public string TaskCode { get; set; } |
| | | /// <summary> |
| | | /// 1.åç³è¯·éè¿<br/> |
| | | /// 2.æ¾ç³è¯·éè¿<br/> |
| | | /// </summary> |
| | | public string Type { get; set; } |
| | | } |
| | | } |
| | |
| | | /// //å¤æç§»åºè´§ä½ä»»å¡æ¯å¦å·²åå¨ï¼å¦åå¨å
æ§è¡ |
| | | /// </summary> |
| | | Dt_Task QueryStackerExistTask(string PalletCode,string locationCode); |
| | | /// <summary> |
| | | /// AGVæååæ¾è´§éç¥ |
| | | /// </summary> |
| | | WebResponseContent AgvBoxApplyPass(AGVBoxApplyPassDTO applyPassDTO, APIEnum SecureReply = APIEnum.AGV_CPBoxApplyPass); |
| | | } |
| | | } |
| | |
| | | var task = _taskRepository.QueryFirst(x => agvUpdateModel.TaskCode == x.AgvTaskNum); |
| | | if (task == null) throw new Exception($"æªæ¾å°ä»»å¡,ä»»å¡å·ã{agvUpdateModel.TaskCode}ã"); |
| | | |
| | | if (agvUpdateModel.Method == "end") |
| | | switch (agvUpdateModel.Method) |
| | | { |
| | | if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt() || task.TaskType == TaskTypeEnum.OutEmpty.ObjToInt() || task.TaskType == TaskTypeEnum.OutAllocate.ObjToInt()) PutFinish(task.NextAddress); |
| | | _taskService.TaskCompleted(task.TaskNum); |
| | | case "end": |
| | | if (task.TaskType == TaskTypeEnum.Outbound.ObjToInt() || task.TaskType == TaskTypeEnum.OutEmpty.ObjToInt() || task.TaskType == TaskTypeEnum.OutAllocate.ObjToInt() || task.TaskType == TaskTypeEnum.OutProduct.ObjToInt()) |
| | | PutFinish(task.NextAddress); |
| | | _taskService.TaskCompleted(task.TaskNum); |
| | | break; |
| | | case "applyToAgv": |
| | | //æ´æ¹æåå
¥åºAGVåè´§ä»»å¡ç¶æ |
| | | if (task.TaskType == TaskTypeEnum.InProduct.ObjToInt()) |
| | | { |
| | | _taskService.UpdateTask(task,TaskStatusEnum.AGV_WaitToExecute); |
| | | } |
| | | break; |
| | | case "applyFromAgv": |
| | | //æ´æ¹æååºAGVæ¾è´§ä»»å¡ç¶æ |
| | | if (task.TaskType == TaskTypeEnum.OutProduct.ObjToInt()) |
| | | { |
| | | _taskService.UpdateTask(task, TaskStatusEnum.AGV_WaitToExecute); |
| | | } |
| | | break; |
| | | case "outbin": |
| | | if (task.TaskType == TaskTypeEnum.OutProduct.ObjToInt()) |
| | | { |
| | | TakeFinish(task.CurrentAddress); |
| | | } |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | agvResponseContent.Code = "0"; |
| | | agvResponseContent.Message = "æå"; |
| | |
| | | //"ConnectionString": "HTI6FB1H05Krd07mNm9yBCNhofW6edA5zLs9TY~MNthRYW3kn0qKbMIsGp~3yyPDF1YZUCPBQx8U0Jfk4PH~ajNFXVIwlH85M3F~v_qKYQ3CeAz3q1mLVDn8O5uWt1~3Ut2V3KRkEwYHvW2oMDN~QIDXPxDgXN0R2oTIhc9dNu7QNaLEknblqmHhjaNSSpERdDVZIgHnMKejU_SL49tralBkZmDNi0hmkbL~837j1NWe37u9fJKmv91QPb~16JsuI9uu0EvNZ06g6PuZfOSAeFH9GMMIZiketdcJG3tHelo=", |
| | | "ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWCS_HUAIAN;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | //"ConnectionString": "Data Source=10.30.4.92;Initial Catalog=TestWCS_TC;User ID=sa;Password=duo123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | //"ConnectionString": "Data Source=10.30.4.92;Initial Catalog=TESTWCSCP_WCS;User ID=sa;Password=duo123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | "WMSConnectionStrings": "Data Source=.;Initial Catalog=WIDESEAWMS_HUAIAN;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | //"WMSConnectionStrings": "Data Source=10.30.4.92;Initial Catalog=TESTWMSCP_WMS;User ID=sa;Password=duo123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | //è·¨å |
| | | "Cors": { |
| | | "PolicyName": "CorsIpAccess", //çç¥åç§° |
| | |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// AGVæååæ¾è´§éç¥ |
| | | /// </summary> |
| | | public WebResponseContent AgvBoxApplyPass(AGVBoxApplyPassDTO applyPassDTO, APIEnum SecureReply = APIEnum.AGV_CPBoxApplyPass) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | string? apiAddress = apiInfos.FirstOrDefault(x => x.ApiCode == SecureReply.ToString())?.ApiAddress; |
| | | if (string.IsNullOrEmpty(apiAddress)) |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°åéAGV任塿¥å£,è¯·æ£æ¥æ¥å£é
ç½®"); |
| | | string response = HttpHelper.Post(apiAddress, applyPassDTO.Serialize()); |
| | | AgvResponseContent agvContent = response.DeserializeObject<AgvResponseContent>(); |
| | | if (agvContent.Code == "0") |
| | | { |
| | | content.OK(agvContent.Message); |
| | | } |
| | | else |
| | | { |
| | | content.Error(agvContent.Message); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// AGVä»»å¡ç¶æå·æ°/AGVä»»å¡å®æ |
| | | /// </summary> |
| | | /// <param name="agvUpdateModel"></param> |
| | |
| | | } |
| | | else |
| | | { |
| | | stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneCode == item.RoadWay); |
| | | stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneCode == item.RoadWay || x.Remark==item.RoadWay); |
| | | } |
| | | if (stationManger == null) |
| | | { |
| | |
| | | else |
| | | { |
| | | task.NextAddress = taskTypeGroup == TaskTypeGroup.InboundGroup ? task.TargetAddress : router.NextPosi; |
| | | if (item.RoadWay.Contains("AGV_FL")) |
| | | if (item.RoadWay.Contains("AGV_FL")|| (item.RoadWay.Contains("AGV_CP") && taskTypeGroup == TaskTypeGroup.OutbondGroup)) |
| | | { |
| | | task.DeviceCode = item.RoadWay; |
| | | task.AgvTaskNum = task.DeviceCode + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; |
| | | task.AgvTaskNum = item.RoadWay + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; |
| | | } |
| | | else if(item.RoadWay.Contains("AGV_FL")) |
| | | else if(item.RoadWay.Contains("AGV_CP") && taskTypeGroup == TaskTypeGroup.InboundGroup) |
| | | { |
| | | task.DeviceCode = stationManger.StationDeviceCode; |
| | | task.AgvTaskNum = task.DeviceCode + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum; |
| | |
| | | /// </summary> |
| | | public Dt_Task QueryStackerExistTask(string PalletCode, string locationCode) |
| | | { |
| | | return BaseDal.QueryFirst(x => x.PalletCode == PalletCode && x.SourceAddress == locationCode && x.TaskState == (int)TaskStatusEnum.SC_Execute); |
| | | return BaseDal.QueryFirst(x => x.PalletCode == PalletCode && x.SourceAddress == locationCode && (x.TaskState == (int)TaskStatusEnum.SC_Execute || x.TaskState == (int)TaskStatusEnum.SC_Executing)); |
| | | } |
| | | } |
| | | } |
| | |
| | | task.Dispatchertime = DateTime.Now; |
| | | task.ExceptionMessage = ""; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Executing); |
| | | |
| | | commonStackerCrane.Communicator.Write("DB105.54", (short)1); |
| | | //å»¶æ¶1s |
| | | Thread.Sleep(1000); |
| | | } |
| | | } |
| | | } |
| | |
| | | using Quartz; |
| | | using Newtonsoft.Json; |
| | | using Quartz; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | |
| | | using WIDESEAWCS_Common.Helper; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Caches; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_IBasicInfoRepository; |
| | | using WIDESEAWCS_ITaskInfoRepository; |
| | |
| | | [DisallowConcurrentExecution] |
| | | public class ConveyorLineJob_GM : JobBase, IJob |
| | | { |
| | | |
| | | private readonly ICacheService _cacheService; |
| | | private readonly ITaskService _taskService; |
| | | private readonly ITaskExecuteDetailService _taskExecuteDetailService; |
| | | private readonly ITaskRepository _taskRepository; |
| | | private readonly IStationMangerRepository _stationMangerRepository; |
| | | private readonly IRouterRepository _routerRepository; |
| | | private readonly List<Dt_WarehouseDevice> warehouseDevices; |
| | | |
| | | public ConveyorLineJob_GM(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository) |
| | | public ConveyorLineJob_GM(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, ICacheService |
| | | cacheService) |
| | | { |
| | | _cacheService = cacheService; |
| | | _taskService = taskService; |
| | | _taskExecuteDetailService = taskExecuteDetailService; |
| | | _taskRepository = taskRepository; |
| | | _stationMangerRepository = stationMangerRepository; |
| | | _routerRepository = routerRepository; |
| | | |
| | | string? warehouseDevicesStr = _cacheService.Get<string>(nameof(Dt_WarehouseDevice)); |
| | | if (!string.IsNullOrEmpty(warehouseDevicesStr)) |
| | | { |
| | | warehouseDevices = JsonConvert.DeserializeObject<List<Dt_WarehouseDevice>>(warehouseDevicesStr) ?? new List<Dt_WarehouseDevice>(); |
| | | } |
| | | else |
| | | { |
| | | warehouseDevices = new List<Dt_WarehouseDevice>(); |
| | | } |
| | | } |
| | | |
| | | public Task Execute(IJobExecutionContext context) |
| | |
| | | if (flag && value != null) |
| | | { |
| | | OtherDevice device = (OtherDevice)value; |
| | | Dt_WarehouseDevice? warehouseDevice = warehouseDevices.FirstOrDefault(x => x.DeviceCode == device.DeviceCode); |
| | | if (warehouseDevice == null) |
| | | { |
| | | WriteError(device.DeviceName, $"请é
ç½®ä»åºè®¾å¤ä¿¡æ¯"); |
| | | return Task.CompletedTask; |
| | | } |
| | | List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).ToList(); |
| | | List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode); |
| | | foreach (var item in stationMangers.Where(x => deviceStations.Contains(x.StationCode))) |
| | |
| | | { |
| | | if (!string.IsNullOrEmpty(conveyorLineInfoRead.Barcode)) |
| | | { |
| | | //å
¥åºç³è¯·ä»»å¡ |
| | | WebResponseContent content = _taskService.RequestWMSTask(conveyorLineInfoRead.Barcode, item.StationCode); |
| | | if (content.Status) |
| | | { |
| | |
| | | { |
| | | if (!conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Online && !conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.STB && !conveyorLineSignalWrite.ACK) |
| | | { |
| | | Dt_Task task = _taskRepository.QueryFirst(x => _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && !string.IsNullOrEmpty(x.NextAddress)); |
| | | Dt_Task task = _taskRepository.QueryFirst(x => x.WarehouseId== warehouseDevice.WarehouseId && _taskService.TaskOutboundTypes.Contains(x.TaskType) && x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && !string.IsNullOrEmpty(x.NextAddress)); |
| | | if (task != null) |
| | | { |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, nextAddress: item.StationCode, deviceCode: item.StackerCraneCode, targetAddress: item.StationCode); |
| | |
| | | WriteError(item.StationName, $"æªæ¾å°å¯¹åºç«å°ä¿¡æ¯,设å¤ç¼å·:{item.StationCode},ä»»å¡å·:{task.TaskNum}"); |
| | | continue; |
| | | } |
| | | //å
¥åºç³è¯·åé
è´§ä½ |
| | | string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, stationManger.StackerCraneCode); |
| | | if (string.IsNullOrEmpty(locationCode)) |
| | | { |
| | |
| | | task.Dispatchertime = DateTime.Now; |
| | | task.ExceptionMessage = ""; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Executing); |
| | | |
| | | commonStackerCrane.Communicator.Write("DB105.54", (short)1); |
| | | //å»¶æ¶1s |
| | | Thread.Sleep(1000); |
| | | } |
| | | } |
| | | } |
| | |
| | | using System; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_DTO.Agv; |
| | | using WIDESEAWCS_Model.Models; |
| | | using WIDESEAWCS_QuartzJob; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt() && nameof(AGV_CPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode)).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); |
| | | var newTasks = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState == TaskStatusEnum.AGV_Execute.ObjToInt()|| x.TaskState == TaskStatusEnum.New.ObjToInt()) && nameof(AGV_CPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode)).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).ToList(); |
| | | foreach (var task in newTasks) |
| | | { |
| | | try |
| | |
| | | } |
| | | }, |
| | | }; |
| | | //åéAGVä»»å¡ |
| | | WebResponseContent content = _taskService.AgvSendTask(taskDTO, APIEnum.Agv_CPSendTask); |
| | | if (!content.Status) throw new Exception(content.Message); |
| | | |
| | | if (!content.Status) |
| | | throw new Exception(content.Message); |
| | | task.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt(); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | if (newTasks.Count>0) |
| | | { |
| | | _taskService.UpdateData(newTasks); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | WriteError(nameof(AGV_CPJob), ex.Message, ex); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// AGVåæ¾è´§åè° |
| | | /// </summary> |
| | | public void ContinueAGVTask() |
| | | { |
| | | try |
| | | { |
| | | //è·åæ¯å¦æå®å
¨ç³è¯·ä¸çä»»å¡ |
| | | var continueTask = _taskService.Db.Queryable<Dt_Task>().Where(x => (x.TaskState == TaskStatusEnum.AGV_WaitToExecute.ObjToInt()) && nameof(AGV_CPJob).Contains(x.DeviceCode) && !string.IsNullOrEmpty(x.DeviceCode)).ToList().OrderBy(x => x.Grade).ThenBy(x => x.CreateDate).FirstOrDefault(); |
| | | if (continueTask!=null) |
| | | { |
| | | //åè´§åè° |
| | | if (continueTask.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == continueTask.CurrentAddress); |
| | | if (stationManger == null) |
| | | { |
| | | throw new Exception($"æªæ¾å°ç«å°{continueTask.CurrentAddress}ä¿¡æ¯"); |
| | | } |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | | if (device == null) |
| | | { |
| | | throw new Exception($"æªæ¾å°è®¾å¤{stationManger.StationDeviceCode}ä¿¡æ¯"); |
| | | } |
| | | OtherDevice otherDevice = (OtherDevice)device; |
| | | short canTake = otherDevice.GetValue<GroundStationDBName, short>(GroundStationDBName.R_IsCanTake, stationManger.StationCode); |
| | | if (canTake != 1) |
| | | { |
| | | return; |
| | | } |
| | | } |
| | | else//æ¾è´§åè° |
| | | { |
| | | Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.AGVStationCode == continueTask.NextAddress); |
| | | if (stationManger == null) |
| | | { |
| | | throw new Exception($"æªæ¾å°ç«å°{continueTask.NextAddress}ä¿¡æ¯"); |
| | | } |
| | | IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger.StationDeviceCode); |
| | | if (device == null) |
| | | { |
| | | throw new Exception($"æªæ¾å°è®¾å¤{stationManger.StationDeviceCode}ä¿¡æ¯"); |
| | | } |
| | | OtherDevice otherDevice = (OtherDevice)device; |
| | | short canPut = otherDevice.GetValue<GroundStationDBName, short>(GroundStationDBName.R_IsCanPut, stationManger.StationCode); |
| | | if (canPut != 1) |
| | | { |
| | | return; |
| | | } |
| | | } |
| | | //è·åè°å
¥åæ° |
| | | AGVBoxApplyPassDTO boxApplyPassDTO = new AGVBoxApplyPassDTO() |
| | | { |
| | | ReqCode = Guid.NewGuid().ToString().Replace("-", ""), |
| | | ReqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | TaskCode = continueTask.AgvTaskNum |
| | | }; |
| | | if (continueTask.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | boxApplyPassDTO.Type = "1"; |
| | | } |
| | | else |
| | | { |
| | | boxApplyPassDTO.Type = "2"; |
| | | } |
| | | //è¯·æ±æç®±åè°æ¥å£ |
| | | WebResponseContent content = _taskService.AgvBoxApplyPass(boxApplyPassDTO); |
| | | if (content.Status && continueTask.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) |
| | | { |
| | | continueTask.TaskState = TaskStatusEnum.AGV_Executing.ObjToInt(); |
| | | _taskService.UpdateTask(continueTask, TaskStatusEnum.AGV_Executing); |
| | | } |
| | | else if (content.Status && continueTask.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | | continueTask.TaskState = TaskStatusEnum.AGV_Puting.ObjToInt(); |
| | | _taskService.UpdateTask(continueTask, TaskStatusEnum.AGV_Puting); |
| | | } |
| | | else |
| | | { |
| | | continueTask.TaskState = TaskStatusEnum.Exception.ObjToInt(); |
| | | continueTask.ExceptionMessage = content.Message; |
| | | _taskService.UpdateTask(continueTask, TaskStatusEnum.Exception); |
| | | } |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | |
| | | var Layer = Convert.ToInt16(targetCodes[3]); |
| | | var a = Row switch |
| | | { |
| | | 1 => "A1", |
| | | 2 => "B1", |
| | | 3 => "C1", |
| | | 4 => "D1", |
| | | 5 => "E1", |
| | | 1 => "A", |
| | | 2 => "B", |
| | | 3 => "C", |
| | | 4 => "D", |
| | | 5 => "E", |
| | | _ => throw new Exception($"æªå®ä¹çæ,å°å:ã{Address}ã"), |
| | | }; |
| | | var b = Layer > 9 ? "" + Layer : "0" + Layer; |
| | |
| | | { |
| | | try |
| | | { |
| | | //ä»»å¡åé |
| | | SendAGVTask(); |
| | | //ç»§ç»æ§è¡ |
| | | ContinueAGVTask(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | deviceCode = item.StackerCraneCode; |
| | | roadwayNo = responseContent.Data.ToString(); |
| | | device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode); |
| | | } |
| | | else |
| | | { |
| | |
| | | else |
| | | { |
| | | //task.NextAddresså¯è½æ¯router.NextPosi |
| | | device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode); |
| | | roadwayNo = responseContent.Data.ToString(); |
| | | deviceCode = router.ChildPosiDeviceCode; |
| | | currentAddress = router.StartPosi; |
| | | nextAddress= router.NextPosi; |
| | | device.SetValue(W_ConveyorLineDB.EndPos, router.NextPosi, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.StartPos, router.StartPosi, item.StationCode); |
| | | } |
| | | device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Outbound.ObjToInt(), item.StationCode); |
| | | device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); |
| | | _taskService.UpdateTask(task, taskState, currentAddress: currentAddress, nextAddress: nextAddress, targetAddress: targetAddress, deviceCode: deviceCode, roadwayNo: roadwayNo,heightType: conveyorLineInfoRead.Spare2); |
| | |
| | | task.Dispatchertime = DateTime.Now; |
| | | task.ExceptionMessage = ""; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Executing); |
| | | //å»¶æ¶1s |
| | | Thread.Sleep(1000); |
| | | } |
| | | } |
| | | } |
| | |
| | | task.NextAddress = locationCode; |
| | | task.DeviceCode = stationManger.StackerCraneCode; |
| | | task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, deviceCode: task.DeviceCode, targetAddress: task.TargetAddress, currentAddress: task.CurrentAddress, nextAddress: task.NextAddress); |
| | | bool isWrite = hoister.SetValue(HoisterDBName.RequestIn, false, deviceChildCode); |
| | | if (isWrite) |
| | | { |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, deviceCode: task.DeviceCode, targetAddress: task.TargetAddress, currentAddress: task.CurrentAddress, nextAddress: task.NextAddress); |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | if (task != null) |
| | | { |
| | | task.TaskState=TaskStatusEnum.HT_Executing.ObjToInt(); |
| | | _taskService.UpdateTask(task, TaskStatusEnum.HT_Executing); |
| | | bool isWrite = hoister.SetValue(HoisterDBName.RequestOut, true, deviceChildCode); |
| | | if (isWrite) |
| | | { |
| | | _taskService.UpdateTask(task, TaskStatusEnum.HT_Executing); |
| | | } |
| | | WriteError(hoister.DeviceName, $"请æ±åºåº,设å¤ç¼å·:{deviceChildCode},ä»»å¡å·:{task.TaskNum}"); |
| | | } |
| | | } |
| | |
| | | task.NextAddress = stationManger.StackerCraneStationCode; ; |
| | | task.DeviceCode = stationManger.StackerCraneCode; |
| | | task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt(); |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, deviceCode: task.DeviceCode, targetAddress: task.TargetAddress, nextAddress: task.NextAddress); |
| | | bool isWrite = hoister.SetValue(HoisterDBName.RequestOut, false, deviceChildCode); |
| | | if (isWrite) |
| | | { |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Execute, deviceCode: task.DeviceCode, targetAddress: task.TargetAddress, nextAddress: task.NextAddress); |
| | | } |
| | | } |
| | | else |
| | | { |
| | |
| | | task.Dispatchertime = DateTime.Now; |
| | | task.ExceptionMessage = ""; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Executing); |
| | | //å»¶æ¶1s |
| | | Thread.Sleep(1000); |
| | | } |
| | | } |
| | | } |
| | |
| | | task.Dispatchertime = DateTime.Now; |
| | | task.ExceptionMessage = ""; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Executing); |
| | | //å»¶æ¶1s |
| | | Thread.Sleep(1000); |
| | | } |
| | | } |
| | | } |
| | |
| | | task.Dispatchertime = DateTime.Now; |
| | | task.ExceptionMessage = ""; |
| | | _taskService.UpdateTask(task, TaskStatusEnum.SC_Executing); |
| | | //å»¶æ¶1s |
| | | Thread.Sleep(1000); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div> |
| | | <vol-box |
| | | v-model="showDetialBox" |
| | | :lazy="true" |
| | | width="75%" |
| | | :padding="15" |
| | | title="åºåºè¯¦æ
" |
| | | > |
| | | <div class="box-head"> |
| | | <el-alert :closable="false" style="width: 100%"> |
| | | <el-row> |
| | | <el-col :span="24"> |
| | | <span class="less-style">ç©æåç§°ï¼ {{ row.materialName }} </span> |
| | | <el-divider direction="vertical"></el-divider> |
| | | <span class="less-style">ç©æç¼å·ï¼ {{ row.materialCode }} </span> |
| | | <el-divider direction="vertical"></el-divider> |
| | | <span class="less-style" |
| | | >éæ±æ°éï¼ {{ row.orderQuantity }} |
| | | </span> |
| | | <el-divider direction="vertical"></el-divider> |
| | | <span class="less-style" |
| | | >å·²åé
æ°éï¼ {{ row.lockQuantity }} |
| | | </span> |
| | | </el-col> |
| | | </el-row> |
| | | </el-alert> |
| | | </div> |
| | | <div class="box-table" style="margin-top: 1%"> |
| | | <el-table |
| | | ref="singleTable" |
| | | :data="tableData" |
| | | style="width: 100%; height: 100%" |
| | | highlight-current-row |
| | | height="500px" |
| | | > |
| | | > |
| | | <el-table-column |
| | | label="åºå·" |
| | | type="index" |
| | | fixed="left" |
| | | width="55" |
| | | align="center" |
| | | ></el-table-column> |
| | | <el-table-column |
| | | v-for="(item, index) in tableColumns.filter((x) => !x.hidden)" |
| | | :key="index" |
| | | :prop="item.prop" |
| | | :label="item.title" |
| | | :width="item.width" |
| | | align="center" |
| | | > |
| | | <template #default="scoped" v-if="item.type == 'icon'"> |
| | | <el-tooltip |
| | | class="item" |
| | | effect="dark" |
| | | :content="item.title" |
| | | placement="bottom" |
| | | ><el-button |
| | | type="text" |
| | | @click="tableButtonClick(scoped.row, item)" |
| | | ><i :class="item.icon" style="font-size: 22px"></i></el-button |
| | | ></el-tooltip> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </div> |
| | | <template #footer> |
| | | <!-- <el-button type="primary" size="small" @click="submit">确认</el-button> --> |
| | | <el-button type="danger" size="small" @click="showDetialBox = false" |
| | | >å
³é</el-button |
| | | > |
| | | </template> |
| | | </vol-box> |
| | | </div> |
| | | </template> |
| | | <script> |
| | | import VolBox from "@/components/basic/VolBox.vue"; |
| | | export default { |
| | | components: { VolBox }, |
| | | data() { |
| | | return { |
| | | row: null, |
| | | showDetialBox: false, |
| | | tableData: [], |
| | | tableColumns: [ |
| | | { |
| | | prop: "id", |
| | | title: "主é®", |
| | | type: "string", |
| | | width: 150, |
| | | hidden: true, |
| | | }, |
| | | { |
| | | prop: "orderNo", |
| | | title: "åæ®ç¼å·", |
| | | type: "string", |
| | | width: 150, |
| | | }, |
| | | { |
| | | prop: "orderDetailId", |
| | | title: "åæ®æç»ä¸»é®", |
| | | type: "string", |
| | | width: 150, |
| | | hidden: true, |
| | | }, |
| | | { |
| | | prop: "orderType", |
| | | title: "åæ®ç±»å", |
| | | type: "string", |
| | | width: 90, |
| | | }, |
| | | { |
| | | prop: "batchNo", |
| | | title: "æ¹æ¬¡å·", |
| | | type: "string", |
| | | width: 120, |
| | | }, |
| | | { |
| | | prop: "materielCode", |
| | | title: "ç©æç¼å·", |
| | | type: "string", |
| | | width: 150, |
| | | }, |
| | | { |
| | | prop: "materielName", |
| | | title: "ç©æåç§°", |
| | | type: "string", |
| | | width: 150, |
| | | }, |
| | | { |
| | | prop: "stockId", |
| | | title: "åºå主é®", |
| | | type: "string", |
| | | width: 150, |
| | | hidden: true, |
| | | }, |
| | | { |
| | | prop: "originalQuantity", |
| | | title: "åå§åºåé", |
| | | type: "string", |
| | | width: 100, |
| | | }, |
| | | // { |
| | | // prop: "assignQuantity", |
| | | // title: "åé
åºåºé", |
| | | // type: "string", |
| | | // width: 100, |
| | | // }, |
| | | { |
| | | prop: "taskNum", |
| | | title: "åºåºä»»å¡å·", |
| | | type: "string", |
| | | width: 100, |
| | | }, |
| | | { |
| | | prop: "palletCode", |
| | | title: "æçç¼å·", |
| | | type: "string", |
| | | width: 150, |
| | | }, |
| | | { |
| | | prop: "locationCode", |
| | | title: "è´§ä½ç¼å·", |
| | | type: "string", |
| | | width: 180, |
| | | }, |
| | | { |
| | | prop: "status", |
| | | title: "ç¶æ", |
| | | type: "string", |
| | | }, |
| | | ], |
| | | }; |
| | | }, |
| | | methods: { |
| | | open(row) { |
| | | this.row = row; |
| | | this.showDetialBox = true; |
| | | this.getData(); |
| | | }, |
| | | getData() { |
| | | this.http |
| | | .post( |
| | | "api/OutStockLockInfo/GetByMesOrderDetail?taskNo=" + |
| | | this.row.taskNo, |
| | | null, |
| | | "æ¥è¯¢ä¸" |
| | | ) |
| | | .then((x) => { |
| | | |
| | | var label=[ |
| | | { label: 'å·²åé
', value: 0 }, |
| | | { label: 'åºåºä¸', value: 1 }, |
| | | { label: 'åºåºå®æ', value: 2 }, |
| | | { label: 'æ£é宿', value: 3 }, |
| | | { label: 'æ¤é', value: 99 } |
| | | ] |
| | | this.tableData=x.map((i) => ({ |
| | | ...i, |
| | | status:label.find((j) => j.value === i.status).label |
| | | })) |
| | | }); |
| | | }, |
| | | }, |
| | | }; |
| | | </script> |
| | | <style scoped> |
| | | .less-style { |
| | | color: black; |
| | | } |
| | | .equle-style { |
| | | color: green; |
| | | } |
| | | .more-style { |
| | | color: red; |
| | | } |
| | | </style> |
| | | |
| | | <style> |
| | | .text-button:hover { |
| | | background-color: #f0f9eb !important; |
| | | } |
| | | .el-table .warning-row { |
| | | background: oldlace; |
| | | } |
| | | .box-table .el-table tbody tr:hover > td { |
| | | background-color: #d8e0d4 !important; |
| | | /* color: #ffffff; */ |
| | | } |
| | | |
| | | .box-table .el-table tbody tr.current-row > td { |
| | | background-color: #f0f9eb !important; |
| | | /* color: #ffffff; */ |
| | | } |
| | | |
| | | .el-table .success-row { |
| | | background: #f0f9eb; |
| | | } |
| | | |
| | | .box-table .el-table { |
| | | border: 1px solid #ebeef5; |
| | | } |
| | | .box-head .el-alert__content { |
| | | width: 100%; |
| | | } |
| | | </style> |
| | |
| | | width: 100, |
| | | }, |
| | | { |
| | | prop: "taskNum", |
| | | title: "åºåºä»»å¡å·", |
| | | type: "string", |
| | | width: 100, |
| | | }, |
| | | { |
| | | prop: "palletCode", |
| | | title: "æçç¼å·", |
| | | type: "string", |
| | |
| | | |
| | | //æ¤jsæä»¶æ¯ç¨æ¥èªå®ä¹æ©å±ä¸å¡ä»£ç ï¼å¯ä»¥æ©å±ä¸äºèªå®ä¹é¡µé¢æè
éæ°é
ç½®çæç代ç |
| | | import gridBody from './extend/addMesOutOrder.vue' |
| | | import gridBody from './extend/MesOutOrderDetail.vue' |
| | | import gridHeader from './extend/addMesOutOrder.vue' |
| | | let extension = { |
| | | components: { |
| | | //æ¥è¯¢ç颿©å±ç»ä»¶ |
| | | gridHeader: '', |
| | | gridHeader: gridHeader, |
| | | gridBody: gridBody, |
| | | gridFooter: '', |
| | | //æ°å»ºãç¼è¾å¼¹åºæ¡æ©å±ç»ä»¶ |
| | |
| | | let addButton = this.buttons.find(item => item.value == 'Add'); |
| | | if (addButton) { |
| | | addButton.onClick = () => { |
| | | this.$refs.gridBody.open(); |
| | | this.$refs.gridHeader.open(); |
| | | } |
| | | } |
| | | |
| | |
| | | }, |
| | | { title: "å建è
", field: "creater", type: "like" }, |
| | | { title: "å建æ¶é´", field: "createDate", type: "datetime" }, |
| | | { title: "æå±ä»åº", field: "warehouseId",type: "selectList",dataKey: "warehouses",data: [],} |
| | | ], |
| | | ]); |
| | | const columns = ref([ |
| | |
| | | ], |
| | | [ |
| | | { title: "ä¾åºå", field: "suppliersId", type: "select",dataKey:"suppliers",data:[]}, |
| | | { title: "å建è
", field: "creater", type: "like" } |
| | | { title: "å建è
", field: "creater", type: "like" }, |
| | | { title: "æå±ä»åº", field: "warehouseId",type: "selectList",dataKey: "warehouses",data: [],} |
| | | ], |
| | | ]); |
| | | |
| | |
| | | }, |
| | | { title: "å建è
", field: "creater", type: "like" }, |
| | | { title: "å建æ¶é´", field: "createDate", type: "datetime" }, |
| | | { title: "æå±ä»åº", field: "warehouseId",type: "selectList",dataKey: "warehouses",data: [],} |
| | | ], |
| | | ]); |
| | | const columns = ref([ |
| | |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "materielSpec", |
| | | title: "è§æ ¼åå·", |
| | | type: "string", |
| | | width: 180, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "serialNumber", |
| | | title: "åºåå·", |
| | | type: "int", |
| | |
| | | width: 220, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "orderNo", |
| | | title: "åæ®ç¼å·", |
| | | type: "string", |
| | | width: 150, |
| | | align: "left", |
| | | }, |
| | | // { |
| | | // field: "currentAddress", |
| | | // title: "å½åä½ç½®", |
| | |
| | | width: 220, |
| | | align: "left", |
| | | }, |
| | | { |
| | | field: "orderNo", |
| | | title: "åæ®ç¼å·", |
| | | type: "string", |
| | | width: 150, |
| | | align: "left", |
| | | }, |
| | | // { |
| | | // field: "currentAddress", |
| | | // title: "å½åä½ç½®", |
| | |
| | | Code = checkOrder.CheckOrderNo, |
| | | CompanyId = "HATC", |
| | | Result = checkOrder.Result, |
| | | CreatorCode = "TC20082",//æµè¯ |
| | | CreatorCode = checkOrder.Creater,//æµè¯ |
| | | DefectedNote = checkOrder.DefectedNote, |
| | | MaterialsCode = checkOrder.MaterielCode, |
| | | PlantsId = "HA02", |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.ComponentModel; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace WIDESEA_Common.OrderEnum |
| | | { |
| | | public enum OutProTypeEnum |
| | | { |
| | | /// <summary> |
| | | /// æååºåºå |
| | | /// </summary> |
| | | [Description("æååºåºå")] |
| | | ProOut=1, |
| | | /// <summary> |
| | | /// å¯å®è®¢åè½¬ä» |
| | | /// </summary> |
| | | [Description("å¯å®è®¢å转ä»")] |
| | | SendProOut=2 |
| | | } |
| | | } |
| | |
| | | /// æ¶è´§å®æ |
| | | /// </summary> |
| | | [Description("æ¶è´§å®æ")] |
| | | Received = 2 |
| | | Received = 2, |
| | | /// <summary> |
| | | /// 订åå
³é |
| | | /// </summary> |
| | | [Description("订åå
³é")] |
| | | Closed = 3 |
| | | } |
| | | |
| | | public enum PurchaseOrderDetailStatusEnum |
| | |
| | | /// æ¶è´§å®æ |
| | | /// </summary> |
| | | [Description("æ¶è´§å®æ")] |
| | | Received = 2 |
| | | Received = 2, |
| | | /// <summary> |
| | | /// 订åå
³é |
| | | /// </summary> |
| | | [Description("订åå
³é")] |
| | | Closed = 3 |
| | | } |
| | | |
| | | public enum PurchaseOrderTypeEnum |
| | |
| | | /// æ¶è´§å®æ |
| | | /// </summary> |
| | | [Description("æ¶è´§å®æ")] |
| | | Completed |
| | | Completed, |
| | | /// <summary> |
| | | /// å
³é |
| | | /// </summary> |
| | | [Description("å
³é")] |
| | | å
³é = 99, |
| | | |
| | | /// <summary> |
| | | /// åæ¶ |
| | | /// </summary> |
| | | [Description("åæ¶")] |
| | | åæ¶ = 98 |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | [Description("æååºåº")] |
| | | OutProduct = 230, |
| | | |
| | | /// <summary> |
| | | /// æåå¯å®è½¬ä» |
| | | /// </summary> |
| | | [Description("æåå¯å®è½¬ä»")] |
| | | OutSendProduct = 240, |
| | | /// <summary> |
| | | /// éè´å
¥åº |
| | | /// </summary> |
| | |
| | | |
| | | using HttpClient httpClient = new HttpClient(); |
| | | httpClient.Timeout = new TimeSpan(0, 0, 60); |
| | | //string authorization = "AppKey 1830415116987195392"; |
| | | string authorization = "AppKey 1773317109539201024"; |
| | | //æ£å¼ |
| | | string authorization = "AppKey 1830415116987195392"; |
| | | //æµè¯ |
| | | //string authorization = "AppKey 1773317109539201024"; |
| | | |
| | | |
| | | |
| | | headers = new Dictionary<string, string> |
| | | { |
| | | { "Authorization", authorization }, |
| | | //{ "Site_tenant_id", "0dc2d164-8a62-417e-8a00-808007464feb" } |
| | | { "Site_tenant_id", "ced19269-2b83-4577-be43-8cc2f700251e" } |
| | | //æ£å¼ |
| | | { "Site_tenant_id", "0dc2d164-8a62-417e-8a00-808007464feb" } |
| | | //æµè¯ |
| | | //{ "Site_tenant_id", "ced19269-2b83-4577-be43-8cc2f700251e" } |
| | | }; |
| | | if (headers != null) |
| | | { |
| | |
| | | |
| | | namespace WIDESEA_DTO.ERP |
| | | { |
| | | /// <summary> |
| | | /// è°ç¨ERPæ¥å£è¿ååæ° |
| | | /// </summary> |
| | | public class ErpRequestContent |
| | | { |
| | | /// <summary> |
| | | /// è§£é |
| | | /// </summary> |
| | | public string Data { get ; set; } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public string Rdata { get; set; } |
| | | /// <summary> |
| | | /// ååºç¶æ |
| | | /// </summary> |
| | | public int res { get ; set; } |
| | | } |
| | | } |
| | |
| | | ERPBaseModel<ERPReceiveModel> model = new ERPBaseModel<ERPReceiveModel>() |
| | | { |
| | | Data = receiveModel, |
| | | Desc = "æ¶è´§å", |
| | | Desc = "WMSæ¶è´§åæ¨é", |
| | | Type = "toTCWMSReceive", |
| | | SecurityCode = "TeChuang" |
| | | }; |
| | |
| | | /// å
¥åºå®æä¸æ¥ |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | WebResponseContent FeedbackInboundOrder(Dt_InboundOrder inboundOrder); |
| | | WebResponseContent FeedbackInboundOrder(int inboundOrderId); |
| | | /// <summary> |
| | | /// éæå®æä¸æ¥è³ERP |
| | | /// </summary> |
| | | public WebResponseContent FeedbackReturnOrder(Dt_InboundOrder inboundOrder,Dt_ReturnOrder returnOrder); |
| | | WebResponseContent FeedbackReturnOrder(Dt_InboundOrder inboundOrder,Dt_ReturnOrder returnOrder); |
| | | /// <summary> |
| | | /// æ ¹æ®ä»åºåæçå·è·åæçç±»å |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | WebResponseContent ReceiveWarehousingOrder(ErpInOrderDTO model); |
| | | /// <summary> |
| | | /// æåå
¥åºä¸ä¼ ERP |
| | | /// </summary> |
| | | WebResponseContent FeedbackProIn(Dt_MesProInOrder mesProInOrder); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_IOutboundRepository |
| | | { |
| | | public interface IOutProStockInfoRepository : IRepository<Dt_OutProStockInfo> |
| | | { |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_IOutboundRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_IOutboundService |
| | | { |
| | | public interface IOutProStockInfoService : IService<Dt_OutProStockInfo> |
| | | { |
| | | IOutProStockInfoRepository Repository { get; } |
| | | Dt_OutProStockInfo GetOutStockLockInfo(Dt_ProOutOrder proOutOrder, Dt_ProOutOrderDetail proOutOrderDetail, Dt_ProStockInfo proStockInfo, float assignQty, int? taskNum = null); |
| | | } |
| | | } |
| | |
| | | /// <param name="palletCode">æçå·</param> |
| | | /// <returns></returns> |
| | | WebResponseContent MaterialPick(string palletCode); |
| | | /// <summary> |
| | | /// è·åMesåºåºè¯¦æ
|
| | | /// </summary> |
| | | /// <param name="taskNo">Mesä»»å¡åå·</param> |
| | | /// <returns></returns> |
| | | List<Dt_OutStockLockInfo> GetByMesOrderDetail(string taskNo); |
| | | } |
| | | } |
| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_IOutboundRepository; |
| | | using WIDESEA_Model.Models; |
| | |
| | | public interface IProOutOrderDetailService : IService<Dt_ProOutOrderDetail> |
| | | { |
| | | IProOutOrderDetailRepository Repository { get; } |
| | | /// <summary> |
| | | /// åé
åºåå¤çè´§ä½æ°æ® |
| | | /// </summary> |
| | | (List<Dt_ProStockInfo>, List<Dt_ProOutOrderDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) AssignProStockOut(int warehouseId,Dt_ProOutOrder proOutOrder); |
| | | /// <summary> |
| | | /// åºåºä»»å¡æ°æ®å¤ç |
| | | /// </summary> |
| | | WebResponseContent LockOutboundStockDataUpdate(List<Dt_ProStockInfo> proStockInfos, List<Dt_ProOutOrderDetail> proOutOrderDetails, List<Dt_OutProStockInfo> outProStockInfos, List<Dt_LocationInfo> locationInfos, LocationStatusEnum locationStatus = LocationStatusEnum.Lock, List<Dt_Task>? tasks = null); |
| | | } |
| | | } |
| | |
| | | { |
| | | public interface IProStockInfoRepository : IRepository<Dt_ProStockInfo> |
| | | { |
| | | /// <summary> |
| | | /// æ¥æ¾å¯ç¨åºå |
| | | /// </summary> |
| | | List<Dt_ProStockInfo> GetProStocks(Dt_ProOutOrderDetail proOutOrderDetail,List<string> locationInfos); |
| | | } |
| | | } |
| | |
| | | public interface IProStockInfoService : IService<Dt_ProStockInfo> |
| | | { |
| | | IProStockInfoRepository Repository { get; } |
| | | /// <summary> |
| | | /// æ¥æ¾å¯ç¨åºå |
| | | /// </summary> |
| | | List<Dt_ProStockInfo> GetUseableStocks(int warehoseId, Dt_ProOutOrderDetail proOutOrderDetail); |
| | | /// <summary> |
| | | /// è·ååºåºåºå |
| | | /// </summary> |
| | | List<Dt_ProStockInfo> GetOutboundStocks(List<Dt_ProStockInfo> stockInfos, Dt_ProOutOrderDetail outOrderDetail, float needQuantity, out float residueQuantity); |
| | | } |
| | | } |
| | |
| | | IStockInfoDetail_HtyService StockInfoDetail_HtyService { get; } |
| | | |
| | | IStockInfo_HtyService StockInfo_HtyService { get; } |
| | | IProStockInfoService ProStockInfoService { get; } |
| | | IProStockInfoDetailService ProStockInfoDetailService { get; } |
| | | IProStockInfo_HtyService ProStockInfo_HtyService { get; } |
| | | IProStockInfoDetail_HtyService ProStockInfoDetail_HtyService { get; } |
| | | } |
| | | } |
| | |
| | | WebResponseContent PPCutOutGenerateOutboundTasks(int orderDetailId, List<PPStockSelectViewDTO> stockSelectViews); |
| | | |
| | | WebResponseContent PPGeneratePKOutboundTask(int orderDetailId, List<PPStockSelectViewDTO> stockSelectViews); |
| | | |
| | | /// <summary> |
| | | /// çææååºåºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="ProOutNo">åºåºè®¢åå·</param> |
| | | /// <param name="StationCode">ç«å°å°å</param> |
| | | /// <returns></returns> |
| | | WebResponseContent OutProductTask(string ProOutNo, string StationCode); |
| | | } |
| | | } |
| | |
| | | using HslCommunication.WebSocket; |
| | | using Microsoft.AspNetCore.Mvc.RazorPages; |
| | | using Newtonsoft.Json; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Linq.Expressions; |
| | |
| | | using WIDESEA_ITaskInfoService; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_StockRepository; |
| | | using static Org.BouncyCastle.Pqc.Crypto.Utilities.PqcOtherInfoGenerator; |
| | | |
| | | namespace WIDESEA_InboundService |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | FeedbackInboundOrder(inboundOrder); |
| | | FeedbackInboundOrder(inboundOrder.Id); |
| | | } |
| | | } |
| | | #endregion |
| | |
| | | /// å
¥åºå®æä¸æ¥ERP |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public WebResponseContent FeedbackInboundOrder(Dt_InboundOrder inboundOrder) |
| | | public WebResponseContent FeedbackInboundOrder(int inboundOrderId) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | Dt_InboundOrder inboundOrder = BaseDal.Db.Queryable<Dt_InboundOrder>().Where(x => x.Id == inboundOrderId).Includes(x => x.Details).First(); |
| | | if (inboundOrder.Details.Count == 0) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°å
¥åºåæç»ä¿¡æ¯"); |
| | |
| | | .Select(mg => new ReturnPickItem |
| | | { |
| | | Material = mg.Key, |
| | | Qty = mg.Sum(x => x.Qty), |
| | | Qty = mg.Sum(x => x.ReturnQty), |
| | | Dataitem = mg.Select(d => new ReturnDataItem |
| | | { |
| | | Lotno = d.BatchNo, |
| | | Qty = d.Qty, |
| | | Qty = d.ReturnQty, |
| | | Location = warehouse.WarehouseCode, |
| | | Msfpart = d.Code |
| | | }).ToList() |
| | |
| | | } |
| | | return content; |
| | | } |
| | | /// <summary> |
| | | /// æåå
¥åºä¸ä¼ ERP |
| | | /// </summary> |
| | | public WebResponseContent FeedbackProIn(Dt_MesProInOrder mesProInOrder) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | List<ERPProItemsItem> proItemsItems = new List<ERPProItemsItem>(); |
| | | foreach (var item in mesProInOrder.Details) |
| | | { |
| | | ERPProItemsItem proItemsItem = new ERPProItemsItem() |
| | | { |
| | | PartNum = item.ProductCode, |
| | | Rev=item.ProductVersion, |
| | | DateCode=item.DateCode, |
| | | BatchNumber= item.BagNo, |
| | | XLocation=item.XSite, |
| | | Xqty=item.XQty, |
| | | QtySet=item.SETQty, |
| | | QtyPcs=item.OKPCSQTY, |
| | | WoList=new List<ERPProListItem>() |
| | | { |
| | | new ERPProListItem() |
| | | { |
| | | moNumber=item.MoNumber, |
| | | WoNumber=item.ERPOrder, |
| | | QtyPcs=item.OKPCSQTY, |
| | | QtySet=item.SETQty |
| | | } |
| | | } |
| | | }; |
| | | proItemsItems.Add(proItemsItem); |
| | | } |
| | | ERPProInboundModel proInboundModel = new ERPProInboundModel() |
| | | { |
| | | Way = 1, |
| | | Code = mesProInOrder.ProInOrderNo, |
| | | CreatorCode = "GSWMS", |
| | | CompanyCode = "HATC", |
| | | FactoryCode = "HA02", |
| | | WarehouseCode = "HA71", |
| | | LocationCode = "HA71", |
| | | StockDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), |
| | | StockFormType= "Production", |
| | | StockFormItems= proItemsItems |
| | | }; |
| | | _invokeERPService.InvokeProInApi(proInboundModel); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | static object lock_code = new object(); |
| | | public string CreateCodeByRule(string ruleCode) |
| | | { |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°éè´åæç»ä¿¡æ¯"); |
| | | } |
| | | |
| | | purchaseOrder.PurchaseOrderStatus = PurchaseOrderStatusEnum.Closed.ObjToInt(); |
| | | _unitOfWorkManage.BeginTran(); |
| | | BaseDal.DeleteAndMoveIntoHty(purchaseOrder, OperateTypeEnum.å
³é); |
| | | BaseDal.UpdateData(purchaseOrder); |
| | | //BaseDal.DeleteAndMoveIntoHty(purchaseOrder, OperateTypeEnum.å
³é); |
| | | foreach (var item in purchaseOrder.Details) |
| | | { |
| | | _purchaseOrderDetailRepository.DeleteAndMoveIntoHty(item, OperateTypeEnum.å
³é); |
| | | item.PurchaseDetailStatus = PurchaseOrderDetailStatusEnum.Closed.ObjToInt(); |
| | | //_purchaseOrderDetailRepository.DeleteAndMoveIntoHty(item, OperateTypeEnum.å
³é); |
| | | _purchaseOrderDetailRepository.UpdateData(item); |
| | | } |
| | | _unitOfWorkManage.CommitTran(); |
| | | return WebResponseContent.Instance.OK(); |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"è¯¥ç©æä¸å±äºè¯¥ä»åº"); |
| | | } |
| | | //æ éè´åè¿è¡æ¶è´§ |
| | | if (receiveOrder.ReceiveOrderType != ReceiveOrderTypeEnum.PO.ObjToInt()) |
| | | { |
| | | //è·åå
·ä½æ¹æ¬¡åç©æ |
| | | Dt_ReceiveOrderDetail? detailNoPo = receiveOrder.Details.FirstOrDefault(x => x.LotNo == model.LotNo && x.MaterielCode == model.MaterielCode); |
| | | lock (_rowNoLocker) |
| | | { |
| | | if (detailNoPo != null) |
| | | { |
| | | //åææ¶è´§æç»å¢å æ¶è´§æ°é |
| | | detailNoPo.ReceivedQuantity += model.Quantity; |
| | | _unitOfWorkManage.BeginTran(); |
| | | BaseDal.UpdateData(detailNoPo); |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | | else |
| | | { |
| | | int rowNo = 0; |
| | | if (receiveOrder.Details.Count > 0) |
| | | { |
| | | rowNo = receiveOrder.Details.Max(x => x.RowNo); |
| | | } |
| | | Dt_ReceiveOrderDetail receiveOrderDetail = new Dt_ReceiveOrderDetail() |
| | | { |
| | | PurchaseOrderNo = model.PurchaseOrderNo, |
| | | ReceivedQuantity = model.Quantity, |
| | | MaterielCode = model.MaterielCode, |
| | | LotNo = model.LotNo, |
| | | MaterielName = materielInfo.MaterielName, |
| | | MaterielSpec = materielInfo.MaterielSpec, |
| | | ReceiveOrderId = receiveOrder.ReceiveOrderId, |
| | | PurchaseOrderDetailRowNo = rowNo + 1, |
| | | IfInspection = materielInfo.IsCheck.ObjToInt(), |
| | | CurrCode = "", |
| | | PriceInTax = 0, |
| | | TaxRate = "", |
| | | RowNo = rowNo + 1, |
| | | Unit = materielInfo.MaterielUnit |
| | | }; |
| | | if (receiveOrder.ReceiveOrderStatus == ReceiveOrderStatusEnum.NotStarted.ObjToInt()) |
| | | { |
| | | receiveOrder.ReceiveOrderStatus = ReceiveOrderStatusEnum.Receiving.ObjToInt(); |
| | | } |
| | | _unitOfWorkManage.BeginTran(); |
| | | _inboundRepository.ReceiveOrderDetailRepository.AddData(receiveOrderDetail); |
| | | _inboundRepository.ReceiveOrderRepository.UpdateData(receiveOrder); |
| | | #region 注é |
| | | if (materielInfo.IsCheck == WhetherEnum.True) |
| | | { |
| | | Dt_CheckOrder checkOrder = _mapper.Map<Dt_CheckOrder>(receiveOrderDetail); |
| | | checkOrder.ReceiveOrderNo = receiveOrder.ReceiveOrderNo; |
| | | checkOrder.QualifiedQuantity = receiveOrderDetail.ReceivedQuantity; |
| | | checkOrder.ReceiveDetailRowNo = receiveOrderDetail.RowNo; |
| | | checkOrder.ScrappedQuantity = 0; |
| | | checkOrder.ReturnQuantity = 0; |
| | | checkOrder.DefectedQuantity = 0; |
| | | _checkOrderRepository.AddData(checkOrder); |
| | | } |
| | | #endregion |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | } |
| | | Dt_PurchaseOrder purchaseOrder = _inboundRepository.PurchaseOrderRepository.Db.Queryable<Dt_PurchaseOrder>().Where(x => x.PurchaseOrderNo == model.PurchaseOrderNo).Includes(x => x.Details).First(); |
| | | if (purchaseOrder == null) |
| | | { |
| | |
| | | _inboundRepository.ReceiveOrderRepository.UpdateData(receiveOrder); |
| | | _inboundRepository.PurchaseOrderDetailRepository.UpdateData(purchaseOrderDetail); |
| | | #region 注é |
| | | //if (materielInfo.IsCheck == WhetherEnum.True) |
| | | //{ |
| | | // Dt_CheckOrder checkOrder = _mapper.Map<Dt_CheckOrder>(receiveOrderDetail); |
| | | // checkOrder.ReceiveOrderNo = receiveOrder.ReceiveOrderNo; |
| | | // checkOrder.QualifiedQuantity = receiveOrderDetail.ReceivedQuantity; |
| | | // checkOrder.ScrappedQuantity = 0; |
| | | // checkOrder.ReturnQuantity = 0; |
| | | // checkOrder.DefectedQuantity = 0; |
| | | // _checkOrderRepository.AddData(checkOrder); |
| | | //} |
| | | ////if (materielInfo.IsCheck == WhetherEnum.True) |
| | | ////{ |
| | | //// Dt_CheckOrder checkOrder = _mapper.Map<Dt_CheckOrder>(receiveOrderDetail); |
| | | //// checkOrder.ReceiveOrderNo = receiveOrder.ReceiveOrderNo; |
| | | //// checkOrder.QualifiedQuantity = receiveOrderDetail.ReceivedQuantity; |
| | | //// checkOrder.ReceiveDetailRowNo = receiveOrderDetail.RowNo; |
| | | //// checkOrder.ScrappedQuantity = 0; |
| | | //// checkOrder.ReturnQuantity = 0; |
| | | //// checkOrder.DefectedQuantity = 0; |
| | | //// _checkOrderRepository.AddData(checkOrder); |
| | | ////} |
| | | #endregion |
| | | _unitOfWorkManage.CommitTran(); |
| | | } |
| | |
| | | PriceInTax = 0, |
| | | PurchaseOrderCode = item.PurchaseOrderNo, |
| | | PurchaseOrderSerno = item.PurchaseOrderDetailRowNo, |
| | | QtyRecieved = item.ReceivedQuantity.ObjToInt(), |
| | | QtyRecieved = item.ReceivedQuantity, |
| | | Serno = item.RowNo, |
| | | Supplotno = "", |
| | | Supplotno = item.LotNo, |
| | | Taxrate = "", |
| | | |
| | | }; |
| | | if (receiveOrder.ReceiveOrderType!=ReceiveOrderTypeEnum.PO.ObjToInt()) |
| | | { |
| | | recevieOrderDetail.Taxrate = "ZZ11"; |
| | | recevieOrderDetail.Currcode = "RMB"; |
| | | } |
| | | recevieOrderDetails.Add(recevieOrderDetail); |
| | | } |
| | | |
| | |
| | | |
| | | //æ´æ°æ¶è´§åä¿¡æ¯ |
| | | receiveOrder.ReceiveOrderStatus = ReceiveOrderStatusEnum.Completed.ObjToInt(); |
| | | receiveOrder.UploadStatus = WhetherEnum.True.ObjToInt(); |
| | | //æ¶è´§æ¨éè³ER |
| | | string response = _invokeERPService.InvokeMatReceiveApi(receiveModel); |
| | | ErpRequestContent requestContent = response.DeserializeObject<ErpRequestContent>(); |
| | | if (requestContent.res == 1) |
| | | { |
| | | receiveOrder.UploadStatus = WhetherEnum.True.ObjToInt(); |
| | | } |
| | | BaseDal.UpdateData(receiveOrder); |
| | | //å建å
¥åºå |
| | | CreateInboundOrder(orderId); |
| | | //æ¶è´§æ¨éè³ERP æµè¯æ³¨é |
| | | _invokeERPService.InvokeMatReceiveApi(receiveModel); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | try |
| | | { |
| | | Dt_ReceiveOrder receiveOrder = Db.Queryable<Dt_ReceiveOrder>().Where(x => x.ReceiveOrderId == receiveOrderId).Includes(x => x.Details).First(); |
| | | if (receiveOrder.UploadStatus!= WhetherEnum.True.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æ¶è´§åæ¥æä¸ä¼ ERPå¤±è´¥æ æ³å建å
¥åºåæ®"); |
| | | } |
| | | if (receiveOrder == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°è¯¥æ¶è´§åä¿¡æ¯"); |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æ¶è´§åæªå®æ"); |
| | | } |
| | | Dt_InboundOrder OldCreateOrder = _inboundRepository.InboundOrderRepository.QueryFirst(x => x.UpperOrderNo == receiveOrder.ReceiveOrderNo); |
| | | if (receiveOrder.CreateInOrderStatus==WhetherEnum.True.ObjToInt() || OldCreateOrder!=null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"该æ¶è´§å对åºçå
¥åºåå·²åå¨"); |
| | | } |
| | | #region 注é |
| | | //List<Dt_CheckOrder> checkOrders = _checkOrderRepository.QueryData(x => x.ReceiveOrderNo == receiveOrder.ReceiveOrderNo); |
| | | //if (checkOrders.FirstOrDefault(x => x.CheckOrderStatus == CheckOrderStatusEnum.NotCheck.ObjToInt()) != null) |
| | | //{ |
| | | // return WebResponseContent.Instance.Error($"该æ¶è´§åæªè´¨æ£å®æ"); |
| | | //} |
| | | ////List<Dt_CheckOrder> checkOrders = _checkOrderRepository.QueryData(x => x.ReceiveOrderNo == receiveOrder.ReceiveOrderNo); |
| | | ////if (checkOrders.FirstOrDefault(x => x.CheckOrderStatus == CheckOrderStatusEnum.NotCheck.ObjToInt()) != null) |
| | | ////{ |
| | | //// return WebResponseContent.Instance.Error($"该æ¶è´§åæªè´¨æ£å®æ"); |
| | | ////} |
| | | |
| | | //if (checkOrders.FirstOrDefault(x => x.AuditStatus != AuditStatusEnum.Agree.ObjToInt()) != null) |
| | | //{ |
| | | // return WebResponseContent.Instance.Error($"该æ¶è´§åè´¨æ£ç»æå®¡æ¹æªå®æ"); |
| | | //} |
| | | ////if (checkOrders.FirstOrDefault(x => x.AuditStatus != AuditStatusEnum.Agree.ObjToInt()) != null) |
| | | ////{ |
| | | //// return WebResponseContent.Instance.Error($"该æ¶è´§åè´¨æ£ç»æå®¡æ¹æªå®æ"); |
| | | ////} |
| | | #endregion |
| | | |
| | | Dt_InboundOrder inboundOrder = new Dt_InboundOrder() |
| | |
| | | { |
| | | float quantity = item.ReceivedQuantity; |
| | | #region 注é |
| | | //if (item.IfInspection == WhetherEnum.True.ObjToInt()) |
| | | //{ |
| | | // Dt_CheckOrder? checkOrder = checkOrders.FirstOrDefault(x => x.ReceiveOrderNo == receiveOrder.ReceiveOrderNo && x.ReceiveDetailRowNo == item.RowNo); |
| | | // if (checkOrder == null) |
| | | // { |
| | | // return WebResponseContent.Instance.Error($"è´¨æ£åæ°æ®é误"); |
| | | // } |
| | | // quantity = checkOrder.QualifiedQuantity.GetValueOrDefault() + checkOrder.DefectedQuantity.GetValueOrDefault(); |
| | | //} |
| | | ////if (item.IfInspection == WhetherEnum.True.ObjToInt()) |
| | | ////{ |
| | | //// Dt_CheckOrder? checkOrder = checkOrders.FirstOrDefault(x => x.ReceiveOrderNo == receiveOrder.ReceiveOrderNo && x.ReceiveDetailRowNo == item.RowNo); |
| | | //// if (checkOrder == null) |
| | | //// { |
| | | //// return WebResponseContent.Instance.Error($"è´¨æ£åæ°æ®é误"); |
| | | //// } |
| | | //// quantity = checkOrder.QualifiedQuantity.GetValueOrDefault() + checkOrder.DefectedQuantity.GetValueOrDefault(); |
| | | ////} |
| | | #endregion |
| | | Dt_InboundOrderDetail detail = new Dt_InboundOrderDetail() |
| | | { |
| | |
| | | rowNo += 1; |
| | | receiveOrderDetails.Add(receiveOrderDetail); |
| | | #region 注é |
| | | //if (materielInfo.IsCheck == WhetherEnum.True) |
| | | //{ |
| | | // Dt_CheckOrder checkOrder = _mapper.Map<Dt_CheckOrder>(receiveOrderDetail); |
| | | // checkOrder.CheckOrderNo = "TestCheckNo21";//æµè¯ |
| | | // checkOrder.ReceiveOrderNo = ""; |
| | | // checkOrder.QualifiedQuantity = receiveOrderDetail.ReceivedQuantity; |
| | | // checkOrder.ScrappedQuantity = 0; |
| | | // checkOrder.ReturnQuantity = 0; |
| | | // checkOrder.DefectedQuantity = 0; |
| | | // checkOrder.ReceiveDetailRowNo = rowNo; |
| | | // checkOrder.UploadStatus = CheckUploadEnum.UploadNo.ObjToInt(); |
| | | // checkOrders.Add(checkOrder); |
| | | //} |
| | | if (materielInfo.IsCheck == WhetherEnum.True) |
| | | { |
| | | Dt_CheckOrder checkOrder = _mapper.Map<Dt_CheckOrder>(receiveOrderDetail); |
| | | checkOrder.CheckOrderNo = "TestCheckNo21";//æµè¯ |
| | | checkOrder.ReceiveOrderNo = ""; |
| | | checkOrder.QualifiedQuantity = receiveOrderDetail.ReceivedQuantity; |
| | | checkOrder.ScrappedQuantity = 0; |
| | | checkOrder.ReturnQuantity = 0; |
| | | checkOrder.DefectedQuantity = 0; |
| | | checkOrder.ReceiveDetailRowNo = rowNo; |
| | | checkOrder.UploadStatus = CheckUploadEnum.UploadNo.ObjToInt(); |
| | | checkOrders.Add(checkOrder); |
| | | } |
| | | #endregion |
| | | } |
| | | receiveOrder = new Dt_ReceiveOrder() |
| | |
| | | rowNo += 1; |
| | | receiveOrderDetails.Add(receiveOrderDetail); |
| | | |
| | | //if (materielInfo.IsCheck == WhetherEnum.True) |
| | | //{ |
| | | // Dt_CheckOrder checkOrder = _mapper.Map<Dt_CheckOrder>(receiveOrderDetail); |
| | | // checkOrder.CheckOrderNo = "Test-CheckNo1";//æµè¯ |
| | | // checkOrder.QualifiedQuantity = receiveOrderDetail.ReceivedQuantity; |
| | | // checkOrder.ScrappedQuantity = 0; |
| | | // checkOrder.ReceiveOrderNo = receiveOrder.ReceiveOrderNo; |
| | | // checkOrder.ReturnQuantity = 0; |
| | | // checkOrder.DefectedQuantity = 0; |
| | | // checkOrder.ReceiveDetailRowNo = rowNo; |
| | | // checkOrder.UploadStatus = CheckUploadEnum.UploadNo.ObjToInt(); |
| | | // checkOrders.Add(checkOrder); |
| | | //} |
| | | if (materielInfo.IsCheck == WhetherEnum.True) |
| | | { |
| | | Dt_CheckOrder checkOrder = _mapper.Map<Dt_CheckOrder>(receiveOrderDetail); |
| | | checkOrder.CheckOrderNo = "Test-CheckNo1";//æµè¯ |
| | | checkOrder.QualifiedQuantity = receiveOrderDetail.ReceivedQuantity; |
| | | checkOrder.ScrappedQuantity = 0; |
| | | checkOrder.ReceiveOrderNo = receiveOrder.ReceiveOrderNo; |
| | | checkOrder.ReturnQuantity = 0; |
| | | checkOrder.DefectedQuantity = 0; |
| | | checkOrder.ReceiveDetailRowNo = rowNo; |
| | | checkOrder.UploadStatus = CheckUploadEnum.UploadNo.ObjToInt(); |
| | | checkOrders.Add(checkOrder); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | Db.InsertNav(receiveOrder).Include(x => x.Details).ExecuteCommand(); |
| | | checkOrders.ForEach(x => x.ReceiveOrderNo = receiveOrder.ReceiveOrderNo); |
| | | } |
| | | //if (checkOrders.Count > 0) |
| | | //{ |
| | | // _checkOrderRepository.AddData(checkOrders); |
| | | //} |
| | | if (checkOrders.Count > 0) |
| | | { |
| | | _checkOrderRepository.AddData(checkOrders); |
| | | } |
| | | _inboundRepository.PurchaseOrderRepository.UpdateData(purchaseOrder); |
| | | _inboundRepository.PurchaseOrderDetailRepository.UpdateData(purchaseOrder.Details); |
| | | _unitOfWorkManage.CommitTran(); |
| | |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | private readonly IBasicRepository _basicRepository; |
| | | private readonly IOutboundService _outboundService; |
| | | private readonly IInboundRepository _inboundRepository; |
| | | public ReturnOrderService(IReturnOrderRepository BaseDal,IUnitOfWorkManage unitOfWorkManage,IBasicRepository basicRepository, |
| | | IOutboundService outboundService) : base(BaseDal) |
| | | IOutboundService outboundService,IInboundRepository inboundRepository) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _basicRepository = basicRepository; |
| | | _outboundService = outboundService; |
| | | _inboundRepository = inboundRepository; |
| | | } |
| | | /// <summary> |
| | | /// è·åéæå |
| | |
| | | { |
| | | return content.Error("该éæå已宿æéæä¸"); |
| | | } |
| | | //夿æ¯å¦å建å
¥åºå |
| | | Dt_InboundOrder InboundOld = _inboundRepository.InboundOrderRepository.QueryFirst(x=>x.UpperOrderNo== returnOrder.OrderNo); |
| | | if (InboundOld!=null) |
| | | { |
| | | return content.Error($"该éæå{returnOrder.OrderNo}å·²çæå
¥åºåå·{InboundOld.InboundOrderNo}"); |
| | | } |
| | | List<Dt_InboundOrderDetail> inboundOrderDetails = new List<Dt_InboundOrderDetail>(); |
| | | foreach (var item in returnOrder.Details) |
| | | { |
| | |
| | | /// <summary> |
| | | /// åç¼å符串 |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 2, ColumnDescription = "åç¼å符串")] |
| | | [SugarColumn(IsNullable = true, Length = 5, ColumnDescription = "åç¼å符串")] |
| | | public string StartStr { get; set; } |
| | | |
| | | /// <summary> |
| | |
| | | public int UploadStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// æ¯å¦å建å
¥åºå |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "æ¯å¦å建å
¥åºå")] |
| | | public int CreateInOrderStatus { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 客æ·ä»£å· |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "客æ·ä»£å·")] |
| | |
| | | [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "产åçæ¬")] |
| | | public string PVer { get; set; } |
| | | /// <summary> |
| | | /// äº§åæ¹æ¬¡ |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "äº§åæ¹æ¬¡")] |
| | | public string PLot { get; set; } |
| | | /// <summary> |
| | | /// 产å卿 |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "产å卿")] |
| | |
| | | public string DateCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// åæ ¼PCSæ° |
| | | /// åºåºåæ ¼PCSæ° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åæ ¼PCSæ°")] |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åºåºåæ ¼PCSæ°")] |
| | | public float QtyPcs { get; set; } |
| | | |
| | | /// <summary> |
| | |
| | | public float OverQtyPcs { get; set; } |
| | | |
| | | /// <summary> |
| | | /// é宿°é |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "é宿°é")] |
| | | public float LockQtyPcs { get; set; } |
| | | |
| | | /// <summary> |
| | | /// Xæ¿æ° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, ColumnDescription = "Xæ¿æ°")] |
| | |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "å
è£
SETæ°é")] |
| | | public float SETQty { get; set; } |
| | | /// <summary> |
| | | /// åæ ¼PCSæ° |
| | | /// åºåPCSæ° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = false, ColumnDescription = "åæ ¼PCSæ°")] |
| | | public float OKPCSQTY { get; set; } |
| | | public float StockPcsQty { get; set; } |
| | | /// <summary> |
| | | /// 卿 |
| | | /// </summary> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_IOutboundRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_OutboundRepository |
| | | { |
| | | public class OutProStockInfoRepository : RepositoryBase<Dt_OutProStockInfo>, IOutProStockInfoRepository |
| | | { |
| | | public OutProStockInfoRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage) |
| | | { |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | using SqlSugar.Extensions; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_IOutboundRepository; |
| | | using WIDESEA_IOutboundService; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_OutboundService |
| | | { |
| | | public partial class OutProStockInfoService : ServiceBase<Dt_OutProStockInfo, IOutProStockInfoRepository>, IOutProStockInfoService |
| | | { |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | |
| | | public IOutProStockInfoRepository Repository => BaseDal; |
| | | |
| | | public OutProStockInfoService(IOutProStockInfoRepository BaseDal,IUnitOfWorkManage unitOfWorkManage) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | } |
| | | public Dt_OutProStockInfo GetOutStockLockInfo(Dt_ProOutOrder proOutOrder, Dt_ProOutOrderDetail proOutOrderDetail, Dt_ProStockInfo proStockInfo, float assignQty, int? taskNum = null) |
| | | { |
| | | Dt_OutProStockInfo outProStockInfo = new Dt_OutProStockInfo() |
| | | { |
| | | OrderNo = proOutOrder.ProOutOrderNo, |
| | | OrderDetailId = proOutOrderDetail.Id, |
| | | OrderType = proOutOrder.ProOrderType, |
| | | BatchNo = proOutOrderDetail.PLot, |
| | | SaleOrder = proOutOrderDetail.SaleOrder, |
| | | Customer = proOutOrderDetail.Customer, |
| | | PCode = proOutOrderDetail.PCode, |
| | | PVer = proOutOrderDetail.PVer, |
| | | PLot = proOutOrderDetail.PLot, |
| | | DateCode = proOutOrderDetail.DateCode, |
| | | StockId = proStockInfo.Id, |
| | | OrderQuantity = proOutOrderDetail.QtyPcs, |
| | | OriginalQuantity = proStockInfo.proStockInfoDetails.Sum(x => x.StockPcsQty), |
| | | AssignQuantity = assignQty, |
| | | LocationCode = proStockInfo.LocationCode, |
| | | PalletCode = proStockInfo.PalletCode, |
| | | Unit = proOutOrderDetail.Unit, |
| | | TaskNum = taskNum, |
| | | Status = taskNum == null ? OutLockStockStatusEnum.å·²åé
.ObjToInt() : OutLockStockStatusEnum.åºåºä¸.ObjToInt() |
| | | }; |
| | | return outProStockInfo; |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | return BaseDal.QueryData(x => x.OrderDetailId == orderDetailId && outStockStatus == null ? true : x.Status == outStockStatus.ObjToInt()); |
| | | } |
| | | public List<Dt_OutStockLockInfo> GetByMesOrderDetail(string taskNo) |
| | | { |
| | | return BaseDal.QueryData(x => x.OrderNo == taskNo); |
| | | } |
| | | |
| | | public List<Dt_OutStockLockInfo> GetStockOutboundOrder(SaveModel saveModel) |
| | | { |
| | |
| | | ERPPickItemModel pickItemModel = new ERPPickItemModel() |
| | | { |
| | | Lotno = item.BatchNo, |
| | | Qty = item.AssignQuantity.ObjToInt().ToString(), |
| | | Qty = item.AssignQuantity.ToString(), |
| | | Location = WarehouseCode |
| | | }; |
| | | //è·ååºåºåæç» |
| | |
| | | issueModel = new ERPIssueModel() |
| | | { |
| | | UniqueTag = id.ToString(), |
| | | Code = CreateCodeByRule(nameof(RuleCodeEnum.FLCodeRule)),//æµè¯ |
| | | Code = CreateCodeByRule(nameof(RuleCodeEnum.FLCodeRule)), |
| | | WarehouseCode = warehouse.WarehouseCode, |
| | | Docremark = "", |
| | | Deptno = outboundOrder.DepartmentCode, |
| | |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_IBasicService; |
| | | using WIDESEA_IOutboundRepository; |
| | | using WIDESEA_IOutboundService; |
| | | using WIDESEA_IRecordService; |
| | | using WIDESEA_IStockService; |
| | | using WIDESEA_Model.Models; |
| | | |
| | | namespace WIDESEA_OutboundService |
| | |
| | | private readonly IUnitOfWorkManage _unitOfWorkManage; |
| | | |
| | | public IProOutOrderDetailRepository Repository => BaseDal; |
| | | |
| | | public ProOutOrderDetailService(IProOutOrderDetailRepository BaseDal, IUnitOfWorkManage unitOfWorkManage) : base(BaseDal) |
| | | private readonly IStockService _stockInfoService; |
| | | private readonly IBasicService _basicService; |
| | | private readonly IOutProStockInfoService _outProStockInfoService; |
| | | private readonly IRecordService _recordService; |
| | | public ProOutOrderDetailService(IProOutOrderDetailRepository BaseDal, IUnitOfWorkManage unitOfWorkManage, IStockService stockInfoService, IBasicService basicService,IOutProStockInfoService outProStockInfoService, IRecordService recordService) : base(BaseDal) |
| | | { |
| | | _unitOfWorkManage = unitOfWorkManage; |
| | | _stockInfoService = stockInfoService; |
| | | _basicService = basicService; |
| | | _outProStockInfoService = outProStockInfoService; |
| | | _recordService = recordService; |
| | | } |
| | | /// <summary> |
| | | /// åºåºåºååé
åï¼æ´æ°æ°æ®åºæ°æ® |
| | | /// </summary> |
| | | public WebResponseContent LockOutboundStockDataUpdate(List<Dt_ProStockInfo> proStockInfos, List<Dt_ProOutOrderDetail> proOutOrderDetails, List<Dt_OutProStockInfo> outProStockInfos, List<Dt_LocationInfo> locationInfos, LocationStatusEnum locationStatus = LocationStatusEnum.Lock, List<Dt_Task>? tasks = null) |
| | | { |
| | | try |
| | | { |
| | | _stockInfoService.ProStockInfoService.Repository.UpdateData(proStockInfos); |
| | | List<Dt_ProStockInfoDetail> proStockInfoDetails = new List<Dt_ProStockInfoDetail>(); |
| | | foreach (var item in proStockInfos) |
| | | { |
| | | proStockInfoDetails.AddRange(item.proStockInfoDetails); |
| | | } |
| | | _stockInfoService.ProStockInfoDetailService.Repository.UpdateData(proStockInfoDetails); |
| | | BaseDal.UpdateData(proOutOrderDetails); |
| | | |
| | | List<Dt_OutProStockInfo> addOutStockLockInfos = outProStockInfos.Where(x => x.Id == 0).ToList(); |
| | | if (addOutStockLockInfos != null && addOutStockLockInfos.Any()) |
| | | { |
| | | if (tasks != null) |
| | | { |
| | | addOutStockLockInfos.ForEach(x => |
| | | { |
| | | x.TaskNum = tasks.FirstOrDefault(v => v.PalletCode == x.PalletCode)?.TaskNum; |
| | | }); |
| | | } |
| | | |
| | | _outProStockInfoService.Repository.AddData(addOutStockLockInfos); |
| | | } |
| | | List<Dt_OutProStockInfo> updateOutStockLockInfos = outProStockInfos.Where(x => x.Id > 0).ToList(); |
| | | if (updateOutStockLockInfos != null && updateOutStockLockInfos.Any()) |
| | | { |
| | | _outProStockInfoService.Repository.UpdateData(updateOutStockLockInfos); |
| | | } |
| | | |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfos, locationStatus, LocationChangeType.OutboundAssignLocation, "", tasks?.Select(x => x.TaskNum).ToList()); |
| | | _basicService.LocationInfoService.Repository.UpdateLocationStatus(locationInfos, locationStatus); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// åé
åºåå¤çè´§ä½æ°æ® |
| | | /// </summary> |
| | | public (List<Dt_ProStockInfo>, List<Dt_ProOutOrderDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) AssignProStockOut(int warehouseId, Dt_ProOutOrder proOutOrder) |
| | | { |
| | | List<Dt_ProOutOrderDetail> OutOrderDetails = proOutOrder.Details; |
| | | if (!OutOrderDetails.Any()) |
| | | { |
| | | throw new Exception($"æªæ¾å°åºåºåæç»ä¿¡æ¯"); |
| | | } |
| | | List<Dt_ProStockInfo> outStocks = new List<Dt_ProStockInfo>(); |
| | | List<Dt_OutProStockInfo> outProStockInfos = new List<Dt_OutProStockInfo>(); |
| | | List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); |
| | | List<Dt_ProOutOrderDetail> groupDetails = OutOrderDetails.GroupBy(x => new { x.SaleOrder, x.PCode, x.PVer, x.PLot, x.DateCode }).Select(x => new Dt_ProOutOrderDetail() |
| | | { |
| | | QtyPcs = x.Sum(x => x.QtyPcs) - x.Sum(x => x.OverQtyPcs), |
| | | SaleOrder = x.Key.SaleOrder, |
| | | PCode = x.Key.PCode, |
| | | PVer = x.Key.PVer, |
| | | PLot = x.Key.PLot, |
| | | DateCode = x.Key.DateCode, |
| | | }).ToList(); |
| | | foreach (var item in groupDetails) |
| | | { |
| | | float needQty = item.QtyPcs; |
| | | //æ¥æ¾å¯ç¨åºå |
| | | List<Dt_ProStockInfo> stockInfoss = _stockInfoService.ProStockInfoService.GetUseableStocks(warehouseId, item); |
| | | if (!stockInfoss.Any()) |
| | | { |
| | | throw new Exception("æªæ¾å°å¯åé
åºå"); |
| | | } |
| | | //è·ååºåºåºå |
| | | List<Dt_ProStockInfo> assignOutStocks = _stockInfoService.ProStockInfoService.GetOutboundStocks(stockInfoss, item, needQty, out float residueQuantity); |
| | | item.LockQtyPcs += needQty - residueQuantity; |
| | | outStocks.AddRange(assignOutStocks); |
| | | float assignQuantity = needQty - residueQuantity; |
| | | bool isCanLot = !string.IsNullOrEmpty(item.PLot); |
| | | bool isCanDate = !string.IsNullOrEmpty(item.DateCode); |
| | | List<Dt_ProOutOrderDetail> details = OutOrderDetails |
| | | .Where(x => x.SaleOrder == item.SaleOrder && x.PCode == item.PCode && x.PVer == item.PVer |
| | | && (isCanLot ? x.PLot == item.PLot : true) |
| | | && (isCanDate ? x.DateCode == item.DateCode : true)) |
| | | .ToList(); |
| | | |
| | | for (int i = 0; i < details.Count; i++) |
| | | { |
| | | float orderQuantity = details[i].QtyPcs; |
| | | for (int j = 0; j < assignOutStocks.Count; j++) |
| | | { |
| | | float detailAssignQuantity = outProStockInfos.Where(x => x.SaleOrder == item.SaleOrder && x.PCode == item.PCode && x.PVer == item.PVer |
| | | && (item.PLot.IsNotEmptyOrNull() ? x.PLot == item.PLot : false) |
| | | && (item.DateCode.IsNotEmptyOrNull() ? x.DateCode == item.PLot : false) |
| | | && x.OrderDetailId == details[i].Id).Sum(x => x.AssignQuantity);//åºåºè®¢åæç»å·²åé
æ°é |
| | | |
| | | float palletAssignQuantity = outProStockInfos.Where(x => x.SaleOrder == item.SaleOrder && x.PCode == item.PCode && x.PVer == item.PVer |
| | | && (item.PLot.IsNotEmptyOrNull() ? x.PLot == item.PLot : false) |
| | | && (item.DateCode.IsNotEmptyOrNull() ? x.DateCode == item.PLot : false |
| | | && x.PalletCode == assignOutStocks[j].PalletCode)).Sum(x => x.AssignQuantity); |
| | | //åºåºè¯¦æ
å·²åé
æ°é |
| | | palletAssignQuantity = outProStockInfos.Where(x => x.SaleOrder == item.SaleOrder && x.PCode == item.PCode && x.PVer == item.PVer |
| | | && (item.PLot.IsNotEmptyOrNull() ? x.PLot == item.PLot : false) |
| | | && (item.DateCode.IsNotEmptyOrNull() ? x.DateCode == item.PLot : false && x.PalletCode == assignOutStocks[j].PalletCode)).Sum(x => x.AssignQuantity);//åºåºè¯¦æ
å·²åé
æ°é |
| | | float palletOutboundQuantity = assignOutStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity); |
| | | if (palletAssignQuantity < palletOutboundQuantity)//妿åºåºè¯¦æ
å·²åé
æ°éå°äºæçå·²åé
æ°éï¼åå¯ä»¥ç»§ç»æ·»å 该æçåºåºä¿¡æ¯ |
| | | { |
| | | float orderDetailNeedQuantity = details[i].QtyPcs - detailAssignQuantity; |
| | | if (orderDetailNeedQuantity > assignOutStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity) - palletAssignQuantity) |
| | | { |
| | | details[i].LockQtyPcs += assignOutStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity) - palletAssignQuantity; |
| | | Dt_OutProStockInfo outStockLockInfo = _outProStockInfoService.GetOutStockLockInfo(proOutOrder, details[i], assignOutStocks[j], assignOutStocks[j].proStockInfoDetails.Sum(x => x.OutboundQuantity) - palletAssignQuantity); |
| | | outProStockInfos.Add(outStockLockInfo); |
| | | } |
| | | else |
| | | { |
| | | Dt_OutProStockInfo outStockLockInfo = _outProStockInfoService.GetOutStockLockInfo(proOutOrder, details[i], assignOutStocks[j], details[i].QtyPcs - details[i].LockQtyPcs); |
| | | outProStockInfos.Add(outStockLockInfo); |
| | | details[i].LockQtyPcs = details[i].QtyPcs; |
| | | break; |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | List<string> locationArr = outStocks.Select(x => x.LocationCode).ToList(); |
| | | |
| | | locationInfos.AddRange(_basicService.LocationInfoService.Repository.GetLocationInfos(locationArr)); |
| | | |
| | | } |
| | | return (outStocks, OutOrderDetails, outProStockInfos, locationInfos); |
| | | } |
| | | } |
| | | } |
| | |
| | | using System; |
| | | using Microsoft.IdentityModel.Tokens; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_IStockRepository; |
| | | using WIDESEA_Model.Models; |
| | | |
| | |
| | | public ProStockInfoRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage) |
| | | { |
| | | } |
| | | //æ ¹æ®æç»æ°æ®æ¥æ¾å¯ç¨åºååºå |
| | | public List<Dt_ProStockInfo> GetProStocks(Dt_ProOutOrderDetail proOutOrderDetail,List<string> locationInfos) |
| | | { |
| | | List<Dt_ProStockInfo>? proStockInfos = null; |
| | | bool isCanLot= !string.IsNullOrEmpty(proOutOrderDetail.PLot); |
| | | bool isCanDate = !string.IsNullOrEmpty(proOutOrderDetail.DateCode); |
| | | proStockInfos = Db.Queryable<Dt_ProStockInfo>().Where(x => locationInfos.Contains(x.LocationCode)) |
| | | .Includes(x => x.proStockInfoDetails) |
| | | .Where(x => x.proStockInfoDetails |
| | | .Any(x => x.SaleOrder == proOutOrderDetail.SaleOrder |
| | | && x.ProductCode == proOutOrderDetail.PCode |
| | | && x.ProductVersion == proOutOrderDetail.PVer |
| | | && (isCanLot ? x.LotNumber == proOutOrderDetail.PLot : true) |
| | | && (isCanDate ? x.DateCode == proOutOrderDetail.DateCode : true) |
| | | )) |
| | | .ToList(); |
| | | proStockInfos = proStockInfos.OrderBy(x => x.proStockInfoDetails.FirstOrDefault().DateCode).ToList(); |
| | | return proStockInfos; |
| | | } |
| | | } |
| | | } |
| | |
| | | using System.Threading.Tasks; |
| | | using WIDESEA_Core; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_IBasicRepository; |
| | | using WIDESEA_IStockRepository; |
| | | using WIDESEA_IStockService; |
| | | using WIDESEA_Model.Models; |
| | |
| | | public partial class ProStockInfoService : ServiceBase<Dt_ProStockInfo, IProStockInfoRepository>, IProStockInfoService |
| | | { |
| | | public IProStockInfoRepository Repository => BaseDal; |
| | | public IStockRepository _stockRepository; |
| | | public ProStockInfoService(IProStockInfoRepository BaseDal,IStockRepository stockRepository) : base(BaseDal) |
| | | private readonly IStockRepository _stockRepository; |
| | | private readonly IBasicRepository _basicRepository; |
| | | public ProStockInfoService(IProStockInfoRepository BaseDal,IStockRepository stockRepository, IBasicRepository basicRepository) : base(BaseDal) |
| | | { |
| | | _stockRepository = stockRepository; |
| | | _basicRepository = basicRepository; |
| | | } |
| | | /// <summary> |
| | | /// æ ¹æ®å¤å
ä¿¡æ¯è§£ç»å
å
ä¿¡æ¯ |
| | | /// </summary> |
| | | public WebResponseContent UnBindStock(List<Dt_ProStockInfoDetail> proStockInfoDetails) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | |
| | | } |
| | | return content; |
| | | } |
| | | //æ¥æ¾å¯ç¨åºå |
| | | public List<Dt_ProStockInfo> GetUseableStocks(int warehoseId,Dt_ProOutOrderDetail proOutOrderDetail) |
| | | { |
| | | List<string> locationCodes = _basicRepository.LocationInfoRepository.GetCanOutLocationCodes(warehoseId); |
| | | return BaseDal.GetProStocks(proOutOrderDetail,locationCodes); |
| | | } |
| | | /// <summary> |
| | | /// è·ååºåºåºå |
| | | /// </summary> |
| | | public List<Dt_ProStockInfo> GetOutboundStocks(List<Dt_ProStockInfo> stockInfos, Dt_ProOutOrderDetail outOrderDetail, float needQuantity, out float residueQuantity) |
| | | { |
| | | List<Dt_ProStockInfo> assignOutStocks =new List<Dt_ProStockInfo>(); |
| | | float stockTotalQuantity = stockInfos.Select(x => x.proStockInfoDetails.Sum(v => v.StockPcsQty - v.OutboundQuantity)).Sum(x => x); |
| | | //stockInfos = stockInfos.OrderBy(x => x.Id).ToList(); |
| | | if (stockTotalQuantity >= needQuantity)//åºåå¤ |
| | | { |
| | | int index = 0; |
| | | while (needQuantity > 0) |
| | | { |
| | | Dt_ProStockInfo stockInfo = stockInfos[index]; |
| | | float useableStockQuantity = stockInfo.proStockInfoDetails |
| | | .Where(x => x.SaleOrder == outOrderDetail.SaleOrder && x.ProductCode==outOrderDetail.PCode && x.ProductVersion==outOrderDetail.PVer) |
| | | .Sum(x => x.StockPcsQty - x.OutboundQuantity); |
| | | if (useableStockQuantity < needQuantity) |
| | | { |
| | | stockInfo.proStockInfoDetails.ForEach(x => x.OutboundQuantity = x.StockPcsQty); |
| | | needQuantity -= useableStockQuantity; |
| | | } |
| | | else |
| | | { |
| | | stockInfo.proStockInfoDetails.ForEach(x => |
| | | { |
| | | if ((x.StockPcsQty > x.OutboundQuantity) && x.SaleOrder == outOrderDetail.SaleOrder && x.ProductCode == outOrderDetail.PCode && x.ProductVersion == outOrderDetail.PVer) |
| | | { |
| | | if (x.StockPcsQty - x.OutboundQuantity >= needQuantity) |
| | | { |
| | | x.OutboundQuantity += needQuantity; |
| | | needQuantity = 0; |
| | | } |
| | | else |
| | | { |
| | | needQuantity -= (x.StockPcsQty - x.OutboundQuantity); |
| | | x.OutboundQuantity = x.StockPcsQty; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | assignOutStocks.Add(stockInfo); |
| | | index++; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | for (int i = 0; i < stockInfos.Count; i++) |
| | | { |
| | | Dt_ProStockInfo stockInfo = stockInfos[i]; |
| | | float useableStockQuantity = stockInfo.proStockInfoDetails |
| | | .Where(x => x.SaleOrder == outOrderDetail.SaleOrder && x.ProductCode == outOrderDetail.PCode && x.ProductVersion == outOrderDetail.PVer) |
| | | .Sum(x => x.StockPcsQty - x.OutboundQuantity); |
| | | if (useableStockQuantity < needQuantity) |
| | | { |
| | | stockInfo.proStockInfoDetails.ForEach(x => x.OutboundQuantity = x.StockPcsQty); |
| | | needQuantity -= useableStockQuantity; |
| | | } |
| | | else |
| | | { |
| | | stockInfo.proStockInfoDetails.ForEach(x => |
| | | { |
| | | if (x.StockPcsQty > x.OutboundQuantity && x.SaleOrder == outOrderDetail.SaleOrder && x.ProductCode == outOrderDetail.PCode && x.ProductVersion == outOrderDetail.PVer) |
| | | { |
| | | if (x.StockPcsQty - x.OutboundQuantity >= needQuantity) |
| | | { |
| | | x.OutboundQuantity += needQuantity; |
| | | needQuantity = 0; |
| | | } |
| | | else |
| | | { |
| | | needQuantity -= (x.StockPcsQty - x.OutboundQuantity); |
| | | x.OutboundQuantity = x.StockPcsQty; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | assignOutStocks.Add(stockInfo); |
| | | } |
| | | } |
| | | residueQuantity = needQuantity; |
| | | return assignOutStocks; |
| | | } |
| | | } |
| | | } |
| | |
| | | public IStockInfoDetail_HtyService StockInfoDetail_HtyService { get; } |
| | | |
| | | public IStockInfo_HtyService StockInfo_HtyService { get; } |
| | | public IProStockInfoService ProStockInfoService { get; } |
| | | public IProStockInfoDetailService ProStockInfoDetailService { get; } |
| | | public IProStockInfo_HtyService ProStockInfo_HtyService { get; } |
| | | public IProStockInfoDetail_HtyService ProStockInfoDetail_HtyService { get; } |
| | | |
| | | public StockSerivce(IStockInfoDetailService stockInfoDetailService, IStockInfoService stockInfoService, IStockInfoDetail_HtyService stockInfoDetail_HtyService, IStockInfo_HtyService stockInfo_HtyService) |
| | | public StockSerivce(IStockInfoDetailService stockInfoDetailService, IStockInfoService stockInfoService, IStockInfoDetail_HtyService stockInfoDetail_HtyService, IStockInfo_HtyService stockInfo_HtyService, IProStockInfoService proStockInfoService,IProStockInfoDetailService proStockInfoDetailService,IProStockInfo_HtyService proStockInfo_HtyService,IProStockInfoDetail_HtyService proStockInfoDetail_HtyService) |
| | | { |
| | | StockInfoDetailService = stockInfoDetailService; |
| | | StockInfoService = stockInfoService; |
| | | StockInfoDetail_HtyService = stockInfoDetail_HtyService; |
| | | StockInfo_HtyService = stockInfo_HtyService; |
| | | ProStockInfoService= proStockInfoService; |
| | | ProStockInfoDetailService= proStockInfoDetailService; |
| | | ProStockInfo_HtyService = proStockInfo_HtyService; |
| | | ProStockInfoDetail_HtyService = proStockInfoDetail_HtyService; |
| | | } |
| | | } |
| | | } |
| | |
| | | tasks.ForEach(x => |
| | | { |
| | | x.TargetAddress = model.Line; |
| | | x.OrderNo = mesOutboundOrder.TaskNo; |
| | | }); |
| | | _unitOfWorkManage.BeginTran(); |
| | | |
| | |
| | | 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, |
| | |
| | | } |
| | | return content; |
| | | } |
| | | //å¤å
ä¿¡æ¯æ¥æ¶ |
| | | public MesResponseContent BoxStockin(MesBoxInfoModel boxInfoModel) |
| | | { |
| | | MesResponseContent content = new MesResponseContent(); |
| | |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°è¯¥ä»»å¡ä¿¡æ¯"); |
| | | } |
| | | |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == task.WarehouseId); |
| | | if (warehouse.WarehouseCode==WarehouseEnum.HA71.ToString()) |
| | | { |
| | | return InProductCompleted(task); |
| | | } |
| | | Dt_StockInfo stockInfo = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == task.PalletCode && x.WarehouseId == task.WarehouseId).Includes(x => x.Details).First(); |
| | | if (stockInfo == null) |
| | | { |
| | |
| | | |
| | | LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt(); |
| | | Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseId == task.WarehouseId); |
| | | |
| | | |
| | | stockInfo.LocationCode = locationInfo.LocationCode; |
| | | |
| | | #region 空箱å
¥åº/æ£éååº/çäº§éæ |
| | | if (task.TaskType == TaskTypeEnum.InEmpty.ObjToInt() || task.TaskType == TaskTypeEnum.InPick.ObjToInt() || (task.TaskType == TaskTypeEnum.ProductionReturn.ObjToInt() && warehouse.WarehouseCode == WarehouseEnum.HA64.ToString())) |
| | | { |
| | |
| | | _stockRepository.StockInfoDetailRepository.UpdateData(stockInfo.Details); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.InStock, LocationChangeType.InboundCompleted); |
| | | _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, stockInfo.Details.Sum(x => x.StockQuantity), stockInfo.Details.Sum(x => x.StockQuantity), StockChangeTypeEnum.Inbound, taskNum); |
| | | if (inboundOrder != null) |
| | | if (inboundOrder != null && inboundOrderDetail != null) |
| | | { |
| | | _inboundRepository.InboundOrderRepository.UpdateData(inboundOrder); |
| | | _inboundRepository.InboundOrderDetailRepository.UpdateData(inboundOrderDetail); |
| | |
| | | } |
| | | else |
| | | { |
| | | _inboundOrderService.FeedbackInboundOrder(inboundOrder); |
| | | _inboundOrderService.FeedbackInboundOrder(inboundOrder.Id); |
| | | } |
| | | } |
| | | return WebResponseContent.Instance.OK(); |
| | |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æåä»ä»»å¡å®æ |
| | | /// </summary> |
| | | public WebResponseContent InProductCompleted(Dt_Task task) |
| | | { |
| | | WebResponseContent content=new WebResponseContent(); |
| | | try |
| | | { |
| | | //è·åç»çä¿¡æ¯ |
| | | Dt_ProStockInfo proStockInfo = _stockRepository.ProStockInfoRepository.Db.Queryable<Dt_ProStockInfo>().Where(x => x.PalletCode == task.PalletCode).Includes(x => x.proStockInfoDetails).First(); |
| | | if (proStockInfo == null) |
| | | { |
| | | return content.Error($"æªæ¾å°è¶æ¡ä¸º{task.PalletCode}ç»çä¿¡æ¯"); |
| | | } |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress); |
| | | if (locationInfo == null) |
| | | { |
| | | return WebResponseContent.Instance.Error($"æªæ¾å°ç®æ è´§ä½ä¿¡æ¯"); |
| | | } |
| | | if (locationInfo.LocationStatus == LocationStatusEnum.InStock.ObjToInt()) |
| | | { |
| | | return WebResponseContent.Instance.Error($"è´§ä½ç¶æä¸æ£ç¡®"); |
| | | } |
| | | LocationStatusEnum lastStatus = (LocationStatusEnum)locationInfo.LocationStatus; |
| | | locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt(); |
| | | proStockInfo.LocationCode = locationInfo.LocationCode; |
| | | //è·åMESå
¥åºåæ® |
| | | Dt_MesProInOrder mesProInOrder = _inboundRepository.MesProInOrderRepository.Db.Queryable<Dt_MesProInOrder>().Where(x => x.BatchNo == task.PalletCode).Includes(x => x.Details).First(); |
| | | if (mesProInOrder == null || mesProInOrder.Details == null || mesProInOrder.Details.Count <= 0) |
| | | { |
| | | return content.Error("æªæ¾å°MESå
å
åæ®ä¿¡æ¯"); |
| | | } |
| | | //è¿è¡åæ®å¤ç |
| | | mesProInOrder.MesProStatus = InOrderStatusEnum.å
¥åºå®æ.ObjToInt(); |
| | | mesProInOrder.Details.ForEach(x => |
| | | { |
| | | x.OverInQuantity = x.OKPCSQTY; |
| | | }); |
| | | proStockInfo.StockStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | proStockInfo.proStockInfoDetails.ForEach(x => |
| | | { |
| | | x.ProOutDetailStatus = StockStatusEmun.å
¥åºå®æ.ObjToInt(); |
| | | }); |
| | | //æ´æ°å
¥åºç¶æ |
| | | task.TaskStatus = TaskStatusEnum.Finish.ObjToInt(); |
| | | _unitOfWorkManage.BeginTran(); |
| | | BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId > 0 ? OperateTypeEnum.äººå·¥å®æ : OperateTypeEnum.èªå¨å®æ); |
| | | _basicService.LocationInfoService.UpdateLocationStatus(locationInfo, proStockInfo.PalletType, LocationStatusEnum.InStock, proStockInfo.WarehouseId); |
| | | _stockRepository.ProStockInfoRepository.UpdateData(proStockInfo); |
| | | _stockRepository.ProStockInfoDetailRepository.UpdateData(proStockInfo.proStockInfoDetails); |
| | | _inboundRepository.MesProInOrderRepository.UpdateData(mesProInOrder); |
| | | _inboundRepository.MesProInOrderDetailRepository.UpdateData(mesProInOrder.Details); |
| | | _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, lastStatus, LocationStatusEnum.InStock, LocationChangeType.InboundCompleted); |
| | | _unitOfWorkManage.CommitTran(); |
| | | //ä¸ä¼ ERP |
| | | _inboundOrderService.FeedbackProIn(mesProInOrder); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content.OK(); |
| | | } |
| | | /// <summary> |
| | | /// åºåºä»»å¡å®æ |
| | | /// </summary> |
| | |
| | | { |
| | | string? orderNo = stockInfo.Details.FirstOrDefault()?.OrderNo ?? ""; |
| | | inboundOrder =_inboundOrderService.Repository.QueryFirst(x => x.InboundOrderNo == orderNo && x.OrderStatus < InOrderStatusEnum.å
¥åºå®æ.ObjToInt()); |
| | | if (inboundOrder!=null) |
| | | { |
| | | newTask.OrderNo = inboundOrder.InboundOrderNo; |
| | | } |
| | | } |
| | | |
| | | if (inboundOrder != null) |
| | |
| | | if (inboundOrder.OrderType == InOrderTypeEnum.Allocat.ObjToInt()) |
| | | { |
| | | newTask.TaskType = TaskTypeEnum.InAllocate.ObjToInt(); |
| | | newTask.OrderNo = inboundOrder.InboundOrderNo; |
| | | } |
| | | else if (inboundOrder.OrderType == InOrderTypeEnum.Return.ObjToInt()) |
| | | { |
| | | newTask.TaskType = TaskTypeEnum.ProductionReturn.ObjToInt(); |
| | | newTask.OrderNo = inboundOrder.InboundOrderNo; |
| | | } |
| | | } |
| | | if (stockInfo.StockStatus == StockStatusEmun.æå¨ç»çæå.ObjToInt()) |
| | |
| | | /// <summary> |
| | | /// çææååºåºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="Id">åºåºè®¢åID</param> |
| | | /// <param name="ProOutNo">åºåºè®¢åå·</param> |
| | | /// <param name="StationCode">ç«å°å°å</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent OutProductTask(int Id,string StationCode) |
| | | public WebResponseContent OutProductTask(string ProOutNo, string StationCode) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | try |
| | | { |
| | | //è·åæååºåºè®¢å |
| | | Dt_ProOutOrder proOutOrder = _outboundService.ProOutOrderService.Repository.Db.Queryable<Dt_ProOutOrder>().Where(x => x.ProOutOrderNo == ProOutNo).Includes(x => x.Details).First(); |
| | | if (proOutOrder==null) |
| | | { |
| | | return content.Error("åºåºè®¢åä¸åå¨"); |
| | | } |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | List<StockSelectViewDTO> stockSelectViews = new List<StockSelectViewDTO>(); |
| | | List<Dt_ProStockInfo> proStockInfos = new List<Dt_ProStockInfo>(); |
| | | List<Dt_ProOutOrderDetail> proOutOrderDetails = new List<Dt_ProOutOrderDetail>(); |
| | | List<Dt_OutProStockInfo> outProStockInfos = new List<Dt_OutProStockInfo>(); |
| | | List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); |
| | | (List<Dt_Task>, List<Dt_ProStockInfo>?, List<Dt_ProOutOrderDetail>?, List<Dt_OutProStockInfo>?, List<Dt_LocationInfo>?) result = |
| | | OutProductTaskDataHandle(Id, StationCode); |
| | | OutProductTaskDataHandle(proOutOrder); |
| | | if (result.Item2 != null && result.Item2.Count > 0) |
| | | { |
| | | proStockInfos.AddRange(result.Item2); |
| | | } |
| | | if (result.Item3 != null && result.Item3.Count > 0) |
| | | { |
| | | proOutOrderDetails.AddRange(result.Item3); |
| | | } |
| | | if (result.Item4 != null && result.Item4.Count > 0) |
| | | { |
| | | outProStockInfos.AddRange(result.Item4); |
| | | } |
| | | if (result.Item5 != null && result.Item5.Count > 0) |
| | | { |
| | | locationInfos.AddRange(result.Item5); |
| | | } |
| | | if (result.Item1 != null && result.Item1.Count > 0) |
| | | { |
| | | //æ´æ°åºåºç®çä½ç½® |
| | | result.Item1.ForEach(x => |
| | | { |
| | | x.TargetAddress = StationCode; |
| | | }); |
| | | tasks.AddRange(result.Item1); |
| | | } |
| | | //å¤çåºåºæ°æ® |
| | | content = GenerateOutboundTaskDataUpdate(tasks, proStockInfos, proOutOrderDetails, outProStockInfos, locationInfos); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | content.Error(ex.Message); |
| | | } |
| | | return content; |
| | | } |
| | | public WebResponseContent GenerateOutboundTaskDataUpdate(List<Dt_Task> tasks, List<Dt_ProStockInfo>? proStockInfos = null, List<Dt_ProOutOrderDetail>? proOutOrderDetails = null, List<Dt_OutProStockInfo>? outProStockInfos = null, List<Dt_LocationInfo>? locationInfos = null) |
| | | { |
| | | try |
| | | { |
| | | _unitOfWorkManage.BeginTran(); |
| | | |
| | | BaseDal.AddData(tasks); |
| | | if (proStockInfos != null && proStockInfos.Count > 0 && proOutOrderDetails != null && proOutOrderDetails.Count > 0 && outProStockInfos != null && outProStockInfos.Count > 0 && locationInfos != null && locationInfos.Count > 0) |
| | | { |
| | | proStockInfos.ForEach(x => |
| | | { |
| | | x.StockStatus = StockStatusEmun.åºåºéå®.ObjToInt(); |
| | | }); |
| | | WebResponseContent content = _outboundService.ProOutOrderDetailService.LockOutboundStockDataUpdate(proStockInfos, proOutOrderDetails, outProStockInfos, locationInfos, tasks: tasks); |
| | | |
| | | if (!content.Status) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return content; |
| | | } |
| | | } |
| | | else if (proOutOrderDetails != null && proOutOrderDetails.Count > 0) |
| | | { |
| | | proOutOrderDetails.ForEach(x => |
| | | { |
| | | x.ProOrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt(); |
| | | }); |
| | | |
| | | _outboundService.ProOutOrderDetailService.Repository.UpdateData(proOutOrderDetails); |
| | | } |
| | | _unitOfWorkManage.CommitTran(); |
| | | PushTasksToWCS(tasks); |
| | | return WebResponseContent.Instance.OK(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | _unitOfWorkManage.RollbackTran(); |
| | | return WebResponseContent.Instance.Error(ex.Message); |
| | | } |
| | | |
| | | } |
| | | /// <summary> |
| | | /// å¤çæååºåºæ°æ® |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public (List<Dt_Task>, List<Dt_ProStockInfo>?, List<Dt_ProOutOrderDetail>?, List<Dt_OutProStockInfo>?, List<Dt_LocationInfo>?) OutProductTaskDataHandle(int Id, string StationCode) |
| | | public (List<Dt_Task>, List<Dt_ProStockInfo>?, List<Dt_ProOutOrderDetail>?, List<Dt_OutProStockInfo>?, List<Dt_LocationInfo>?) OutProductTaskDataHandle(Dt_ProOutOrder proOutOrder) |
| | | { |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | List<Dt_ProStockInfo> proStockInfos = new List<Dt_ProStockInfo>(); |
| | | List<Dt_ProOutOrderDetail> proOutOrderDetails = new List<Dt_ProOutOrderDetail>(); |
| | | List<Dt_OutProStockInfo> outProStockInfos=new List<Dt_OutProStockInfo>(); |
| | | List<Dt_LocationInfo> locationInfos = new List<Dt_LocationInfo>(); |
| | | //åé
åºå |
| | | (List<Dt_ProStockInfo>, List<Dt_ProOutOrderDetail>, List<Dt_OutProStockInfo>, List<Dt_LocationInfo>) result = _outboundService.ProOutOrderDetailService.AssignProStockOut(proOutOrder.WarehouseId, proOutOrder); |
| | | if (result.Item1!=null&&result.Item1.Count>0) |
| | | { |
| | | TaskTypeEnum typeEnum = proOutOrder.ProOrderType switch |
| | | { |
| | | (int)OutProTypeEnum.ProOut => TaskTypeEnum.OutProduct, |
| | | (int)OutProTypeEnum.SendProOut => TaskTypeEnum.OutSendProduct, |
| | | _ => new TaskTypeEnum() |
| | | }; |
| | | tasks = GetTasks(result.Item1, typeEnum); |
| | | result.Item2.ForEach(x => |
| | | { |
| | | x.ProOrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt(); |
| | | }); |
| | | result.Item3.ForEach(x => |
| | | { |
| | | x.Status = OutLockStockStatusEnum.åºåºä¸.ObjToInt(); |
| | | }); |
| | | |
| | | proStockInfos = result.Item1; |
| | | proOutOrderDetails = result.Item2; |
| | | outProStockInfos = result.Item3; |
| | | locationInfos = result.Item4; |
| | | } |
| | | else |
| | | { |
| | | throw new Exception("æ å¯åé
åºå"); |
| | | } |
| | | return (tasks, proStockInfos, proOutOrderDetails, outProStockInfos, locationInfos); |
| | | } |
| | | /// <summary> |
| | | /// çæä»»å¡ |
| | | /// </summary> |
| | | /// <param name="stockInfos"></param> |
| | | /// <param name="taskType"></param> |
| | | /// <returns></returns> |
| | | public List<Dt_Task> GetTasks(List<Dt_ProStockInfo> stockInfos, TaskTypeEnum taskType) |
| | | { |
| | | List<Dt_Task> tasks = new List<Dt_Task>(); |
| | | for (int i = 0; i < stockInfos.Count; i++) |
| | | { |
| | | Dt_ProStockInfo stockInfo = stockInfos[i]; |
| | | |
| | | if (stockInfo != null) |
| | | { |
| | | Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == stockInfo.LocationCode); |
| | | if (!tasks.Exists(x => x.PalletCode == stockInfo.PalletCode)) |
| | | { |
| | | Dt_Task task = new() |
| | | { |
| | | CurrentAddress = stockInfo.LocationCode, |
| | | Grade = 0, |
| | | PalletCode = stockInfo.PalletCode, |
| | | NextAddress = "", |
| | | Roadway = locationInfo.RoadwayNo, |
| | | SourceAddress = stockInfo.LocationCode, |
| | | TargetAddress = "", |
| | | TaskStatus = TaskStatusEnum.New.ObjToInt(), |
| | | TaskType = taskType.ObjToInt(), |
| | | TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)), |
| | | PalletType = stockInfo.PalletType, |
| | | WarehouseId = stockInfo.WarehouseId, |
| | | }; |
| | | tasks.Add(task); |
| | | } |
| | | } |
| | | } |
| | | return tasks; |
| | | } |
| | | /// <summary> |
| | | /// åºåæ°æ®è½¬åºåºä»»å¡ |
| | |
| | | _ =>new TaskTypeEnum() |
| | | }; |
| | | tasks = GetTasks(result.Item1, typeEnum); |
| | | tasks.ForEach(x => |
| | | { |
| | | x.OrderNo = outboundOrder.UpperOrderNo; |
| | | }); |
| | | result.Item2.ForEach(x => |
| | | { |
| | | x.OrderDetailStatus = OrderDetailStatusEnum.Outbound.ObjToInt(); |
| | |
| | | { |
| | | return Service.MaterielGroup(saveModel); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ´æ®å
¥åºåå·IDä¸ä¼ ERP |
| | | /// </summary> |
| | | /// <param name="inboundOrderId">å
¥åºåå·Id</param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("FeedbackInboundOrder")] |
| | | public WebResponseContent FeedbackInboundOrder(int inboundOrderId) |
| | | { |
| | | return Service.FeedbackInboundOrder(inboundOrderId); |
| | | } |
| | | ///// <summary> |
| | | ///// å
¥åºå®æååä¼ ERP |
| | | ///// </summary> |
| | |
| | | [HttpPost, HttpGet, Route("GetByOrderDetailId"), AllowAnonymous] |
| | | public List<Dt_OutStockLockInfo> GetByOrderDetailId(int orderDetailId) |
| | | { |
| | | return Service.GetByOrderDetailId(orderDetailId,null); |
| | | return Service.GetByOrderDetailId(orderDetailId, null); |
| | | } |
| | | /// <summary> |
| | | /// è·åMesåºåºè¯¦æ
|
| | | /// </summary> |
| | | /// <param name="taskNo">Mesä»»å¡åå·</param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("GetByMesOrderDetail"), AllowAnonymous] |
| | | public List<Dt_OutStockLockInfo> GetByMesOrderDetail(string taskNo) |
| | | { |
| | | return Service.GetByMesOrderDetail(taskNo); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | return Service.GenerateOutboundTasks(keys); |
| | | } |
| | | /// <summary> |
| | | /// çææååºåºä»»å¡ |
| | | /// </summary> |
| | | /// <param name="ProOutNo">åºåºè®¢åå·</param> |
| | | /// <param name="StationCode">ç«å°å°å</param> |
| | | /// <returns></returns> |
| | | [HttpPost, HttpGet, Route("OutProductTask"), AllowAnonymous] |
| | | public WebResponseContent OutProductTask(string ProOutNo, string StationCode) |
| | | { |
| | | return Service.OutProductTask(ProOutNo, StationCode); |
| | | } |
| | | ///// <summary> |
| | | ///// çæMESPPä»å¤§å·åºåºä»»å¡ |
| | | ///// </summary> |
| | |
| | | CreateMap<Dt_Task, WMSTaskDTO>(); |
| | | CreateMap<MESBagDetail, Dt_MesProInOrderDetail>().ForMember(x => x.OverInQuantity, b => b.MapFrom(b => 0)); |
| | | CreateMap<ErpProOutOrderDetailds, Dt_ProOutOrderDetail>().ForMember(x => x.ProOrderDetailStatus, b => b.MapFrom(b => 0)).ForMember(x => x.OverQtyPcs, b => b.MapFrom(b => 0)); |
| | | CreateMap<Dt_MesProInOrderDetail, Dt_ProStockInfoDetail>().ForMember(x => x.ProOutDetailStatus, b => b.MapFrom(b => StockStatusEmun.ç»çæå.ObjToInt())).ForMember(x => x.OutboundQuantity, b => b.MapFrom(b => 0)); |
| | | CreateMap<Dt_MesProInOrderDetail, Dt_ProStockInfoDetail>().ForMember(x => x.ProOutDetailStatus, b => b.MapFrom(b => StockStatusEmun.ç»çæå.ObjToInt())).ForMember(x => x.OutboundQuantity, b => b.MapFrom(b => 0)).ForMember(x => x.StockPcsQty, b => b.MapFrom(b => b.OKPCSQTY)); |
| | | } |
| | | } |
| | | } |
| | |
| | | //"ConnectionString": "HTI6FB1H05Krd07mNm9yBCNhofW6edA5zLs9TY~MNthRYW3kn0qKbMIsGp~3yyPDF1YZUCPBQx8U0Jfk4PH~ajNFXVIwlH85M3F~v_qKYQ3CeAz3q1mLVDn8O5uWt1~3Ut2V3KRkEwYHvW2oMDN~QIDXPxDgXN0R2oTIhc9dNu7QNaLEknblqmHhjaNSSpERdDVZIgHnMKejU_SL49tralBkZmDNi0hmkbL~837j1NWe37u9fJKmv91QPb~16JsuI9uu0EvNZ06g6PuZfOSAeFH9GMMIZiketdcJG3tHelo=", |
| | | //"ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWMS_HUAIAN;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | "ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWMS_HUAIAN;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | // "ConnectionString": "Data Source=10.30.4.92;Initial Catalog=TESTWMSCP_WMS;User ID=sa;Password=duo123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | //æ§WMSæ°æ®åºè¿æ¥ |
| | | //"TeConnectionString": "Data Source=10.30.4.92;Initial Catalog=TeChuang;User ID=sa;Password=duo123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False", |
| | | //è·¨å |