using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using WIDESEA.Common;
|
using WIDESEA.Core.Utilities;
|
using WIDESEA.Entity.DomainModels;
|
using WIDESEA.Services.Repositories;
|
|
namespace WIDESEA.Services.Services
|
{
|
public partial class CommonFunction
|
{
|
|
public static WebResponseContent SelectContainerList(SaveModel saveModel)
|
{
|
WebResponseContent content = new WebResponseContent();
|
try
|
{
|
//string line = saveModel.MainData["layer"].ToString();
|
Console.Out.WriteLine("开始时间:" + DateTime.Now);
|
List<List<object>> lists = new List<List<object>>();
|
List<Dt_locationinfo> allLocation = Dt_locationinfoRepository.Instance.Find(x => true);
|
List<VV_ContainerInfo> allContainer = VV_ContainerInfoRepository.Instance.Find(x => true);
|
List<VV_ContainerInfo_EmptyPallet> allEmptyContainer = VV_ContainerInfo_EmptyPalletRepository.Instance.Find(x => true);
|
int count = 1;
|
for (int i = 1; i <= 2; i++)
|
{
|
List<object> list = new List<object>();
|
List<Dt_locationinfo> currentLineLocations = allLocation.FindAll(r => r.location_line == i);
|
foreach (var item in currentLineLocations.GroupBy(r => r.location_layer).OrderBy(r => r.Key))
|
{
|
List<object> layerlist = new List<object>();
|
List<Dt_locationinfo> layerLocation = item.OrderBy(r => r.location_column).ToList();
|
foreach (var temp in layerLocation)
|
{
|
VV_ContainerInfo containerInfo = allContainer.Find(x => x.location_id == temp.location_id);
|
VV_ContainerInfo_EmptyPallet emptyPalletContainer = allEmptyContainer.Find(x => x.location_id == temp.location_id);
|
if (containerInfo != null)
|
containerInfo.location_state = locationstate(temp, containerInfo, true);
|
else if (emptyPalletContainer != null)
|
emptyPalletContainer.location_state = locationstate(temp, containerInfo, true);
|
else
|
temp.location_state = locationstate(temp, containerInfo, false);
|
|
if (containerInfo != null)
|
{
|
layerlist.Add(new
|
{
|
color = "success",
|
id = temp.location_id,
|
src = LocationStausImage(containerInfo.location_state),
|
form = containerInfo,
|
form2 = temp
|
});
|
}
|
else if (emptyPalletContainer != null)
|
{
|
layerlist.Add(new
|
{
|
color = "success",
|
id = temp.location_id,
|
src = LocationStausImage(emptyPalletContainer.location_state),
|
form = emptyPalletContainer,
|
form2 = temp
|
});
|
}
|
else
|
{
|
layerlist.Add(new
|
{
|
color = "success",
|
id = temp.location_id,
|
src = LocationStausImage(temp.location_state),
|
form = containerInfo,
|
form2 = temp
|
}); ;
|
}
|
Console.Out.WriteLine($"第{count}次时间:" + DateTime.Now);
|
count++;
|
}
|
list.Add(layerlist);
|
|
}
|
lists.Add(list);
|
}
|
|
content.OK("成功", lists);
|
}
|
catch (Exception ex)
|
{
|
content.Error(ex.Message);
|
}
|
Console.Out.WriteLine("结束时间:" + DateTime.Now);
|
return content;
|
}
|
public static string LocationStausImage(string locationState)
|
{
|
string img = "";
|
switch (locationState)
|
{
|
case "有货被锁定":
|
img = "CountLocked";
|
break;
|
case "空货位被锁定":
|
img = "NewLock";
|
break;
|
case "空货位":
|
img = "NewEmpty";
|
break;
|
case "入库中":
|
img = "NewInbound";
|
break;
|
case "出库中":
|
img = "NewOutbound";
|
break;
|
case "测量中":
|
img = "Measureing";
|
break;
|
case "空托盘":
|
img = "EmptyPallet";
|
break;
|
case "已测量":
|
img = "HadMeasure";
|
break;
|
case "等待测量":
|
img = "WaitMeasure";
|
break;
|
default:
|
img = "NoNormal";
|
break;
|
}
|
return img + ".png";
|
}
|
public static string locationstate(Dt_locationinfo locationinfo, VV_ContainerInfo containerInfo, bool flag)
|
{
|
string state = "";
|
if (locationinfo.location_islocked)
|
{
|
if (flag)
|
return "有货被锁定";
|
else
|
return "空货位被锁定";
|
}
|
if (locationinfo.location_state == LocationState.LocationState_Empty.ToString())
|
return "空货位";
|
else if (locationinfo.location_state.Contains("In"))
|
{
|
state = "入库中";
|
}
|
else if (locationinfo.location_state.Contains("Out"))
|
{
|
state = "出库中";
|
}
|
else if (locationinfo.location_state == LocationState.LocationState_Measureing.ToString())
|
{
|
state = "测量中";
|
}
|
else if (locationinfo.location_state == LocationState.LocationState_Stored.ToString())
|
{
|
if (null != containerInfo && flag)
|
{
|
if (string.IsNullOrEmpty(containerInfo.csize_in_result))
|
state = "等待测量";
|
else
|
state = "已测量";
|
}
|
else
|
return "空托盘";
|
}
|
else
|
state = "异常货位";
|
return state;
|
}
|
|
|
}
|
}
|