DESKTOP-9BNTV8O
2024-12-13 e867f048e92c830af97ddb346a618e08eb1ff662
修改问题
1个文件已添加
4个文件已修改
544 ■■■■ 已修改文件
HTML/js/public.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HTML/web.config 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/Wms/Controllers/DownApiController.cs 267 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/Wms/Controllers/UpApiController.cs 260 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/Wms/appsettings.json 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HTML/js/public.js
@@ -1,7 +1,8 @@
//var IP = "http://47.104.149.73:1991";//接口IP
// var IP = "http://172.16.71.101:8082/";//接口IP
//var IP = "http://localhost:13243/api";
var IP = "http://localhost:50515/api";  //本地
//var IP = "http://localhost:50515/api";  //本地
var IP = "http://172.16.105.10:8086/api";
// var IP = "http://localhost:44318/api";
//var IP = "http://192.168.1.6:8017";
//var IP = "http://192.168.1.226:8086";  
HTML/web.config
New file
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <defaultDocument>
            <files>
                <add value="Login.html" />
            </files>
        </defaultDocument>
        <httpRedirect enabled="true" destination="/views" childOnly="true" />
    </system.webServer>
</configuration>
Wms/Wms/Controllers/DownApiController.cs
@@ -16,6 +16,8 @@
using WMS.Entity.BllTaskEntity;
using WMS.IBLL.IBllTaskServer;
using Model.ModelVm.BllTaskVm;
using static Model.InterFaceModel.RCSModel;
using WMS.IBLL.IBllTransServer;
namespace Wms.Controllers
{
@@ -33,7 +35,9 @@
        private readonly ITaskServer _taskSvc;//任务Svc
        private readonly IBllTaskSyncServer _taskSyncSvc;//任务同步Svc
        private readonly IWaveMageServer _waveSvc;//任务同步Svc
        public DownApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IPalletBindServer asnPalletBindSvc, IStockCheckServer crCheckSvc, ITaskServer taskSvc, IBllTaskSyncServer taskSyncSvc, IWaveMageServer waveSvc)
        private readonly IRcsServer _rcsserver;//RCS相关任务
        private readonly INoticeServer _noticeSvc;//二楼单据相关
        public DownApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IPalletBindServer asnPalletBindSvc, IStockCheckServer crCheckSvc, ITaskServer taskSvc, IBllTaskSyncServer taskSyncSvc, IWaveMageServer waveSvc, IRcsServer rcsserver, INoticeServer noticeSvc)
        {
            _config = setting.Value;
            _exNoticeSvc = exNoticeSvc;
@@ -42,6 +46,8 @@
            _taskSvc = taskSvc;
            _taskSyncSvc = taskSyncSvc;
            _waveSvc = waveSvc;
            _rcsserver = rcsserver;
            _noticeSvc = noticeSvc;
        }
        #region WMS接口 调用下游系统接口 
@@ -641,5 +647,264 @@
        #endregion
        #region 二楼业务
        /// <summary>
        /// RCS叫桶
        /// </summary>
        /// <param name="pallmsg"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetPalletNo(Pallnetmsg pallmsg)
        {
            var logStr = $@".\log\AGV\AGV申请叫桶" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
            var result = new ErpModel { Success = -1, Message = "", };
            try
            {
                var jsonData = JsonConvert.SerializeObject(pallmsg);
                LogFile.SaveLogToFile($"AGV申请叫桶:( {jsonData} ),", logStr);
                if (string.IsNullOrWhiteSpace(pallmsg.Location))
                {
                    result.Message = "叫料位置为空!";
                    return Ok(result);
                }
                if (string.IsNullOrWhiteSpace(pallmsg.Type))
                {
                    result.Message = "任务类型为空!";
                    return Ok(result);
                }
                _rcsserver.GetPalletNo(pallmsg, _config.AgvHost + _config.GenAgvSchedulingTask);
                result.Success = 0;
                result.Message = "叫桶成功!";
                return Ok(result);
            }
            catch (Exception e)
            {
                LogFile.SaveLogToFile($"AGV申请叫桶异常:( {e.Message} ),", logStr);
                result.Message = e.Message;
                return Ok(result);
            }
        }
        /// <summary>
        /// 将净桶改为脏桶并拉到脏桶区
        /// </summary>
        /// <param name="pallmsg"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult ChangePalletStatus(Pallnetmsg pallmsg)
        {
            var result = new ErpModel { Success = -1, Message = "", };
            try
            {
                if (string.IsNullOrWhiteSpace(pallmsg.PalletNo))
                {
                    result.Message = "桶编号不能为空!";
                    return Ok(result);
                }
                _rcsserver.ChangePalletStatus(pallmsg.PalletNo, _config.AgvHost + _config.GenAgvSchedulingTask);
                result.Success = 0;
                result.Message = "操作成功!";
                return Ok(result);
            }
            catch (Exception e)
            {
                result.Message = e.Message;
                return Ok(result);
            }
        }
        /// <summary>
        /// MES下发清洗锁定脏桶
        /// </summary>
        /// <param name="pallmsg"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult CleanPallet(Pallnetmsg pallmsg)
        {
            var result = new ErpModel { Success = -1, Message = "", };
            try
            {
                if (string.IsNullOrWhiteSpace(pallmsg.Location))
                {
                    result.Message = "叫料位置为空!";
                    return Ok(result);
                }
                if (string.IsNullOrWhiteSpace(pallmsg.PalletNo))
                {
                    result.Message = "桶号为空!";
                    return Ok(result);
                }
                _rcsserver.CleanPallet(pallmsg, _config.AgvHost + _config.GenAgvSchedulingTask);
                result.Success = 0;
                result.Message = "叫桶成功!";
                return Ok(result);
            }
            catch (Exception e)
            {
                result.Message = e.Message;
                return Ok(result);
            }
        }
        /// <summary>
        /// RCS申请储位
        /// </summary>
        /// <param name="pallmsg"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult ApplyLocatNo(Pallnetmsg pallmsg)
        {
            var logStr = $@".\log\AGV\AGV申请储位" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
            var result = new ErpModel { Success = -1, Message = "" };
            try
            {
                var jsonData = JsonConvert.SerializeObject(pallmsg);
                LogFile.SaveLogToFile($"AGV申请储位:( {jsonData} ),", logStr);
                if (string.IsNullOrWhiteSpace(pallmsg.Location))
                {
                    result.Message = "申请位置为空!";
                    return Ok(result);
                }
                if (string.IsNullOrWhiteSpace(pallmsg.Type))
                {
                    result.Message = "任务类型为空!";
                    return Ok(result);
                }
                if (string.IsNullOrWhiteSpace(pallmsg.PalletNo))
                {
                    result.Message = "申请托盘号为空!";
                    return Ok(result);
                }
                _rcsserver.ApplyLocatNo(pallmsg, _config.AgvHost + _config.GenAgvSchedulingTask);
                result.Success = 0;
                result.Message = "申请储位成功!";
                return Ok(result);
            }
            catch (Exception e)
            {
                LogFile.SaveLogToFile($"AGV申请储位异常:( {e.Message} ),", logStr);
                result.Message = e.Message;
                return Ok(result);
            }
        }
        /// <summary>
        /// 入库单据下发
        /// </summary>
        /// <param name="model">入库单信息</param>
        /// <returns></returns>
        //[Authorize]
        [HttpPost]
        public IActionResult CreateAsnWork(AsnInfo model)
        {
            var result = new ErpModel { Success = -1, Message = "" };
            try
            {
                /*var claimsIdentity = this.User.Identity as ClaimsIdentity;
                if (claimsIdentity == null)
                {
                    throw new Exception("未获取到用户信息");
                }
                string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
                if (string.IsNullOrWhiteSpace(UserId))
                {
                    throw new Exception("未获取到用户信息");
                }*/
                result = _noticeSvc.CreateAsnWork(model);
                return Ok(result);
            }
            catch (Exception e)
            {
                result.Message = e.Message;
                return Ok(result);
            }
        }
        /// <summary>
        /// Agv任务完成反馈
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult agvCallBack(AgvTaskDto model)
        {
            var result = new ErpModel { Success = -1, Message = "" };
            try
            {
                //记录log
                var logStr = $@".\log\AGV\任务执行通知" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
                var jsonData = JsonConvert.SerializeObject(model);
                LogFile.SaveLogToFile($"任务执行通知:( {jsonData} ),", logStr);
                if (string.IsNullOrEmpty(model.reqCode))
                {
                    return Ok(new AgvResultModel { code = "-1", message = "请求失败,reqCode参数异常", reqCode = model.reqCode });
                }
                switch (model.method)
                {
                    case "start"://任务开始
                        return Ok(new AgvResultModel { code = "0", message = "成功", reqCode = model.reqCode });
                    case "outbin"://走出储位
                        return Ok(new AgvResultModel { code = "0", message = "成功", reqCode = model.reqCode });
                    case "end"://任务结束
                        result = _noticeSvc.RCSFinishTask(model.reqCode, "1");
                        return Ok(result);
                    case "cancel"://任务单取消
                        return Ok(new AgvResultModel { code = "0", message = "成功", reqCode = model.reqCode });
                    case "apply"://CTU料箱取放申请
                        return Ok(new AgvResultModel { code = "0", message = "成功", reqCode = model.reqCode });
                    default:
                        return Ok(new AgvResultModel { code = "-1", message = "请求失败,method任务类型错误", reqCode = model.reqCode });
                }
            }
            catch (Exception ex)
            {
                return Ok(new AgvResultModel { code = "-1", message = ex.Message, reqCode = model.reqCode });
            }
        }
        /// <summary>
        /// 出库单据下发
        /// </summary>
        /// <param name="model">出库单信息</param>
        /// <returns></returns>
        //[Authorize]
        [HttpPost]
        public IActionResult CreateSoWork(SoInfo model)
        {
            try
            {
                /*var claimsIdentity = this.User.Identity as ClaimsIdentity;
                if (claimsIdentity == null)
                {
                    throw new Exception("未获取到用户信息");
                }
                string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
                if (string.IsNullOrWhiteSpace(UserId))
                {
                    throw new Exception("未获取到用户信息");
                }*/
                SoResInfo result = _noticeSvc.CreateSoWork(model);
                return Ok(result);
            }
            catch (Exception e)
            {
                return Ok(new ErpModel { Success = -1, Message = e.Message });
            }
        }
        #endregion
    }
}
Wms/Wms/Controllers/UpApiController.cs
@@ -403,266 +403,6 @@
                return Ok(result);
            }
        }
        #region 二楼业务
        /// <summary>
        /// RCS叫桶
        /// </summary>
        /// <param name="pallmsg"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult GetPalletNo(Pallnetmsg pallmsg)
        {
            var logStr = $@".\log\AGV\AGV申请叫桶" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
            var result = new ErpModel { Success = -1, Message = "", };
            try
            {
                var jsonData = JsonConvert.SerializeObject(pallmsg);
                LogFile.SaveLogToFile($"AGV申请叫桶:( {jsonData} ),", logStr);
                if (string.IsNullOrWhiteSpace(pallmsg.Location))
                {
                    result.Message = "叫料位置为空!";
                    return Ok(result);
                }
                if (string.IsNullOrWhiteSpace(pallmsg.Type))
                {
                    result.Message = "任务类型为空!";
                    return Ok(result);
                }
                _rcsserver.GetPalletNo(pallmsg ,_config.AgvHost + _config.GenAgvSchedulingTask);
                result.Success = 0;
                result.Message = "叫桶成功!";
                return Ok(result);
            }
            catch (Exception e)
            {
                LogFile.SaveLogToFile($"AGV申请叫桶异常:( {e.Message} ),", logStr);
                result.Message = e.Message;
                return Ok(result);
            }
        }
        /// <summary>
        /// 将净桶改为脏桶并拉到脏桶区
        /// </summary>
        /// <param name="pallmsg"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult ChangePalletStatus(Pallnetmsg pallmsg)
        {
            var result = new ErpModel { Success = -1, Message = "", };
            try
            {
                if (string.IsNullOrWhiteSpace(pallmsg.PalletNo))
                {
                    result.Message = "桶编号不能为空!";
                    return Ok(result);
                }
                _rcsserver.ChangePalletStatus(pallmsg.PalletNo, _config.AgvHost + _config.GenAgvSchedulingTask);
                result.Success = 0;
                result.Message = "操作成功!";
                return Ok(result);
            }
            catch (Exception e)
            {
                result.Message = e.Message;
                return Ok(result);
            }
        }
        /// <summary>
        /// MES下发清洗锁定脏桶
        /// </summary>
        /// <param name="pallmsg"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult CleanPallet(Pallnetmsg pallmsg)
        {
            var result = new ErpModel { Success = -1, Message = "", };
            try
            {
                if (string.IsNullOrWhiteSpace(pallmsg.Location))
                {
                    result.Message = "叫料位置为空!";
                    return Ok(result);
                }
                if (string.IsNullOrWhiteSpace(pallmsg.PalletNo))
                {
                    result.Message = "桶号为空!";
                    return Ok(result);
                }
                _rcsserver.CleanPallet(pallmsg, _config.AgvHost + _config.GenAgvSchedulingTask);
                result.Success = 0;
                result.Message = "叫桶成功!";
                return Ok(result);
            }
            catch (Exception e)
            {
                result.Message = e.Message;
                return Ok(result);
            }
        }
        /// <summary>
        /// RCS申请储位
        /// </summary>
        /// <param name="pallmsg"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult ApplyLocatNo(Pallnetmsg pallmsg)
        {
            var logStr = $@".\log\AGV\AGV申请储位" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
            var result = new ErpModel { Success = -1, Message = "" };
            try
            {
                var jsonData = JsonConvert.SerializeObject(pallmsg);
                LogFile.SaveLogToFile($"AGV申请储位:( {jsonData} ),", logStr);
                if (string.IsNullOrWhiteSpace(pallmsg.Location))
                {
                    result.Message = "申请位置为空!";
                    return Ok(result);
                }
                if (string.IsNullOrWhiteSpace(pallmsg.Type))
                {
                    result.Message = "任务类型为空!";
                    return Ok(result);
                }
                if (string.IsNullOrWhiteSpace(pallmsg.PalletNo))
                {
                    result.Message = "申请托盘号为空!";
                    return Ok(result);
                }
                _rcsserver.ApplyLocatNo(pallmsg, _config.AgvHost + _config.GenAgvSchedulingTask);
                result.Success = 0;
                result.Message = "申请储位成功!";
                return Ok(result);
            }
            catch (Exception e)
            {
                LogFile.SaveLogToFile($"AGV申请储位异常:( {e.Message} ),", logStr);
                result.Message = e.Message;
                return Ok(result);
            }
        }
        /// <summary>
        /// 入库单据下发
        /// </summary>
        /// <param name="model">入库单信息</param>
        /// <returns></returns>
        //[Authorize]
        [HttpPost]
        public IActionResult CreateAsnWork(AsnInfo model)
        {
            var result = new ErpModel { Success = -1, Message = "" };
            try
            {
                /*var claimsIdentity = this.User.Identity as ClaimsIdentity;
                if (claimsIdentity == null)
                {
                    throw new Exception("未获取到用户信息");
                }
                string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
                if (string.IsNullOrWhiteSpace(UserId))
                {
                    throw new Exception("未获取到用户信息");
                }*/
                result = _noticeSvc.CreateAsnWork(model);
                return Ok(result);
            }
            catch (Exception e)
            {
                result.Message = e.Message;
                return Ok(result);
            }
        }
        /// <summary>
        /// Agv任务完成反馈
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        [HttpPost]
        public IActionResult agvCallBack(AgvTaskDto model)
        {
            var result = new ErpModel { Success = -1, Message = "" };
            try
            {
                //记录log
                var logStr = $@".\log\AGV\任务执行通知" + DateTime.Now.ToString("yyyyMMdd") + ".txt";
                var jsonData = JsonConvert.SerializeObject(model);
                LogFile.SaveLogToFile($"任务执行通知:( {jsonData} ),", logStr);
                if (string.IsNullOrEmpty(model.reqCode))
                {
                    return Ok(new AgvResultModel { code = "-1", message = "请求失败,reqCode参数异常", reqCode = model.reqCode });
                }
                switch (model.method)
                {
                    case "start"://任务开始
                        return Ok(new AgvResultModel { code = "0", message = "成功", reqCode = model.reqCode });
                    case "outbin"://走出储位
                        return Ok(new AgvResultModel { code = "0", message = "成功", reqCode = model.reqCode });
                    case "end"://任务结束
                        result = _noticeSvc.RCSFinishTask(model.reqCode, "1");
                        return Ok(result);
                    case "cancel"://任务单取消
                        return Ok(new AgvResultModel { code = "0", message = "成功", reqCode = model.reqCode });
                    case "apply"://CTU料箱取放申请
                        return Ok(new AgvResultModel { code = "0", message = "成功", reqCode = model.reqCode });
                    default:
                        return Ok(new AgvResultModel { code = "-1", message = "请求失败,method任务类型错误", reqCode = model.reqCode });
                }
            }
            catch (Exception ex)
            {
                return Ok(new AgvResultModel { code = "-1", message = ex.Message, reqCode = model.reqCode });
            }
        }
        /// <summary>
        /// 出库单据下发
        /// </summary>
        /// <param name="model">出库单信息</param>
        /// <returns></returns>
        //[Authorize]
        [HttpPost]
        public IActionResult CreateSoWork(SoInfo model)
        {
            try
            {
                /*var claimsIdentity = this.User.Identity as ClaimsIdentity;
                if (claimsIdentity == null)
                {
                    throw new Exception("未获取到用户信息");
                }
                string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value;
                if (string.IsNullOrWhiteSpace(UserId))
                {
                    throw new Exception("未获取到用户信息");
                }*/
                SoResInfo result = _noticeSvc.CreateSoWork(model);
                return Ok(result);
            }
            catch (Exception e)
            {
                return Ok(new ErpModel { Success = -1, Message = e.Message });
            }
        }
        #endregion
        //箱码信息 手持组托用 (赋码或追溯下发到wms)
        //质检结果下发接口 
Wms/Wms/appsettings.json
@@ -14,7 +14,8 @@
    //"ConnectionString": "Server=192.168.62.200;Database=WMS_JC23-2;User ID=sa;Password=sql2019;Integrated Security=False;"
    //"ConnectionString": "Server=.;Database=WMS_JC09;User ID=sa;Password=sql2019;Integrated Security=False;"
    //"ConnectionString": "Data Source=DESKTOP-0EJDG95\\MSSQLSERVER1;Initial Catalog=WMS_V01;Integrated Security=True;"
    "ConnectionString": "Server=.\\MSSQLSERVER2019;Database=WMS_JC23-2;User Id=sa;Password=admin2023@;" // SqlServer 库连接字符串
    //"ConnectionString": "Server=.\\MSSQLSERVER2019;Database=WMS_JC23-2;User Id=sa;Password=admin2023@;" // SqlServer 库连接字符串
    "ConnectionString": "Server=172.16.105.10;Database=WMS_JC23-2;User ID=sa;Password=sql2019;Integrated Security=False;"
  },
  "JWTConfig": {
    "Issuer": "WYY", //Token������