123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- using Microsoft.AspNetCore.Mvc;
- using Newtonsoft.Json;
- using WCS.Entity;
- using WMS.BZModels.Dto.PT.WareCellDtos;
- using WMS.BZServices.PT;
- using WMS.Info;
- namespace WMS.BZWeb.Areas.PTManager.Controllers
- {
- [Area("PTManager")]
- public class QueryCellController : MvcControllerBase
- {
- private readonly WareCellService _wareCellService ;
- public QueryCellController(WareCellService wareCellService)
- {
- _wareCellService = wareCellService;
- }
- #region 视图功能
- public IActionResult Index()
- {
- return View();
- }
- public IActionResult Form()
- {
- return View();
- }
- #endregion
- #region 获取数据
- [HttpPost]
- public ActionResult GetMaxLine(string houseNo)
- {
- var data = _wareCellService.GetMaxLine("pthouse");
- return Success("", data);
- }
- [HttpPost]
- public ActionResult GetLocViewList(string query)
- {
- var querydto = JsonConvert.DeserializeObject<WarecellQuery>(query);
- if (querydto == null || string.IsNullOrEmpty(querydto.SCRel))
- {
- return Success("", new StockLocationViewDto());
- }
- var list = _wareCellService.GetLocList(querydto);
- return Success("", list);
- }
- [HttpGet]
- public ActionResult GetSelectSRMNameList()
- {
- var list = _wareCellService.GetSelectSRMNameList();
- return Success(list);
- }
- [HttpPost]
- public ActionResult GetLocList(string houserNo, int line)
- {
- _wareCellService.GetLocList(new WarecellQuery { SCRel = "SRM01" });
- var data = _wareCellService.GetLocList(houserNo, line);
- var json = "[";
- int y = 0;
- int x = 0;
- foreach (WarecellDto entity in data)
- {
- if (entity.Layer > y)
- {
- y = entity.Layer;
- }
- if (entity.Col > x)
- {
- x = entity.Col;
- }
- var color = "";
- if (entity.IsStop == 1)
- {
- color = "#CCC";
- }
- else
- {
- if (entity.StateNum == 1)
- {
- color = "#4EEE94";
- }
- else if (entity.StateNum == 2)
- {
- color = "#191970";
- }
- else if (entity.StateNum == 3)
- {
- color = "#CD69C9";
- }
- else if (entity.StateNum == 4)
- {
- color = "#CD0000";
- }
- }
- double y1 = 0;
- double y2 = 0;
- if (entity.Depth == 2)
- {
- y1 = (entity.Layer + 0.6);
- y2 = (entity.Layer + 0.9);
- }
- else
- {
- y1 = entity.Layer + 0.1;
- y2 = entity.Layer + 0.4;
- }
- int result = 0;
- if (entity.IsStop != 1)
- {
- result = entity.StateNum.HasValue? entity.StateNum.Value:0;
- }
- json += "{";
- //json += @"name:'" + entity.F_WAREHOUSENO + "',fNo:'" + entity.F_NO + "',value:[" + y1 + "," + y2 + ","
- // + (entity.F_COL + 0.1) + "," + (entity.F_COL + 0.9) + "],itemStyle:{normal:{color:'" + color + "'}}},";
- json += @"name:'" + entity.WarehouseCode + "',fNo:'" + entity.Id +
- "',F_ISSTOP:" + entity.IsStop +
- ",F_STATENUM:" + entity.StateNum +
- ",F_COL:" + entity.Col + ",F_LAYER:" + entity.Layer + ",F_DEPTH:" + entity.Depth + ",STATE:'" + StateText(result) + "'" + ",F_CNTRGRPNO:'" + "'" +
- ",value:[" + y1 + "," + y2 + ","
- + (entity.Col + 0.1) + "," + (entity.Col + 0.9) + "],itemStyle:{normal:{color:'" + color + "'}}},";
- }
- json = json.TrimEnd(',') + "]";
- var retData = new
- {
- json,
- x,
- y
- };
- return Success("", retData);
- }
- private string StateText(int state)
- {
- var stateText = "";
- switch (state)
- {
- case 0:
- stateText = "停用";
- break;
- case 1:
- stateText = "空货位";
- break;
- case 2:
- stateText = "已存储";
- break;
- case 3:
- stateText = "入锁";
- break;
- case 4:
- stateText = "出锁";
- break;
- }
- return stateText;
- }
- #endregion
- }
- }
|