zhaowc
2025-01-16 26088bd271800618ea1551f50108e1f54b10f425
Wms/Wms/Controllers/UpApiController.cs
@@ -13,6 +13,7 @@
using WMS.IBLL.IBllCheckServer;
using Model.ModelVm.BllCheckVm;
using Microsoft.Extensions.Logging;
using WMS.IBLL.IPdaServer;
namespace Wms.Controllers
{
@@ -28,12 +29,14 @@
        private readonly IExportNoticeServer _exNoticeSvc;//出库单Svc 
        private readonly IArrivalNoticeServer _arrivalNoticeSvc;
        private readonly IStockCheckServer _stockCheckSvc;//盘点单Svc 
        public UpApiController(IOptions<ApiUrlConfig> setting,IExportNoticeServer exNoticeSvc,IArrivalNoticeServer arrivalNoticeServer,IStockCheckServer stockCheckSvc)
        private readonly IPdaCrServer _daCrSvc;//PDA
        public UpApiController(IOptions<ApiUrlConfig> setting,IExportNoticeServer exNoticeSvc,IArrivalNoticeServer arrivalNoticeServer,IStockCheckServer stockCheckSvc,IPdaCrServer daCrSvc)
        {
            _config = setting.Value;
            _exNoticeSvc = exNoticeSvc;
            _arrivalNoticeSvc = arrivalNoticeServer;
            _stockCheckSvc = stockCheckSvc;
            _daCrSvc = daCrSvc;
        }
        #endregion
@@ -74,7 +77,7 @@
        /// <param name="model">入库单号</param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult FinishAsn(IdVm model)
        public IActionResult FinishAsn(FinshVm model)
        {
            try
            {
@@ -89,7 +92,7 @@
                {
                    return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
                }
                _arrivalNoticeSvc.FinishAsn(model.Id, _config.ErpHost + _config.AsnFinishUrl, _config.MesHost + _config.MesAsnFinishUrl, _config.MesHost + _config.MesGetTokenUrl, int.Parse(userId));
                _arrivalNoticeSvc.FinishAsn(model.Id, _config.ErpHost + _config.AsnFinishUrl, _config.MesHost + _config.MesAsnFinishUrl, _config.MesHost + _config.MesGetTokenUrl,model.UserNo,model.Password, int.Parse(userId));
                return Ok(new { code = 0, count = 0, msg = "入库单复核并上传成功" });
            }
@@ -134,8 +137,8 @@
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult FinishExportNotice(IdVm model)
        [HttpPost]
        public IActionResult FinishExportNotice(FinshVm model)
        {
            try
            {
@@ -150,7 +153,7 @@
                {
                    return Ok(new { code = 1, msg = "未获取到当前操作人信息" });
                }
                _exNoticeSvc.FinishSo(model.Id, _config.ErpHost + _config.SoFinishUrl, int.Parse(userId));
                _exNoticeSvc.FinishSo(model.Id, _config.ErpHost + _config.SoFinishUrl, model.UserNo, model.Password, int.Parse(userId));
                return Ok(new { code = 0, count = 0, msg = "出库单复核并上传成功" });
            }
            catch (Exception e)
@@ -209,8 +212,56 @@
            }
        }
        //箱码信息 手持组托用 (扫箱码向追溯要信息)
        //箱码信息 手持组托用 (扫箱码向追溯要信息)
        //
        /// <summary>
        /// 下发AGV调度任务
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult AGVTask(string type, string taskno, string positionStart, string positionEnd)
        {
            try
            {
                OutCommanAgvDto agvRequest =  _daCrSvc.AGVTask(type,taskno,positionStart,positionEnd, _config.AgvHost + _config.GenAgvSchedulingTask);
                if (agvRequest.Code != "0")
                {
                    return Ok(new { code = 1, msg = "小车任务执行失败" });
                }
                return Ok(new { code = 1, msg = "AGV任务下发成功" });
            }
            catch (Exception e)
            {
                return Ok(new { code = 1, msg = e.Message });
            }
        }
        /// <summary>
        /// 下发AGV取消任务
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult cancelTask(string taskno)
        {
            try
            {
                _daCrSvc.cancelTask(taskno, _config.AgvHost + _config.CancelTask);
                return Ok(new { code = 1, msg = "AGV任务取消成功" });
            }
            catch (Exception e)
            {
                return Ok(new { code = 1, msg = e.Message });
            }
        }
        #endregion
@@ -224,6 +275,7 @@
        [HttpPost]
        public IActionResult CreateAsn(AsnInfo model)
        {
            // liudl Test
            var result = new HttpReturnModel { Success = "-1", Message = "" };
            var logStr = "";
            if (model.Origin == "MES")
@@ -244,7 +296,7 @@
                    LogFile.SaveLogToFile($"入库单下发:( {jsonData} ),", logStr);
                }
                result = _arrivalNoticeSvc.HttpCreateAsn(model);
                result = _arrivalNoticeSvc.HttpCreateAsn(model, _config.WcsHost + _config.AddOrderTaskUrl);
                if (logStr != "")
                {
                    var jsonData = JsonConvert.SerializeObject(result);