using System; using System.Collections.Generic; using System.Web.Http; using HH.WCS.Mobox3.DSZSH.Helpers; using HH.WCS.Mobox3.DSZSH.Models; using HH.WCS.Mobox3.DSZSH.Services; using static HH.WCS.Mobox3.DSZSH.Dtos.Request.AgvRequest; using static HH.WCS.Mobox3.DSZSH.Dtos.Request.DebugRequest; using static HH.WCS.Mobox3.DSZSH.Dtos.Response.AgvResponse; using static HH.WCS.Mobox3.DSZSH.Dtos.Response.DebugResponse; namespace HH.WCS.Mobox3.DSZSH.Controllers { /// /// 测试用:如果项目中要和设备对接,前期设备无法测试,用接口模拟 /// [RoutePrefix("api")] public class DebugController : ApiController { /// /// 模拟 AGV 多次回报任务状态 /// /// 容器号 /// [HttpPost] [Route("AgvSeriesReports")] public ReturnResults AgvSeriesReports(UpdateTaskState model) { return DebugService.AgvSeriesReports(model); } /// /// 初始化数据库 /// /// [HttpPost] [Route("CreateDatabase")] public string CreateDatabase() { return DebugService.CreateDatabase(); } [HttpPost] [Route("InsertLocation")] public string InsertLocation(InsertLocationInfo model) { try { var db = DbHelper.GetDbClient(); var locList = new List(); locList.Add(new TN_Location { S_AREA_CODE = model.AreaCode, S_CODE = model.Code}); if (db.Insertable(locList).ExecuteCommand() <= 0) { return "失败"; } } catch (Exception ex) { LogHelper.Info($"发生了异常"); return "添加货位错误" + ex.Message; } //return res ? "成功" : "失败"; return "成功"; } /// /// DEBUG:插入货位、容器、货品信息 /// /// [HttpPost] [Route("InsertLocCntrCg")] public string InsertLocCntrCg() { return DebugService.InsertLocCntrCg(); } } public class CgInfo { public string ItemCode { get; set; } public string CntId { get; set; } public string LocId { get; set; } } public class InsertLocationInfo { public string Code { set; get; } public string AreaCode { set; get; } } public class UpdateTaskWeightInfo { public string TaskID { set; get; } public float Weight { set; get; } } }