using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using WIDESEA_Core.EFDbContext;
|
using WIDESEA_Core.Utilities;
|
using WIDESEA_Entity.DomainModels;
|
using WIDESEA_WMS.IRepositories;
|
using WIDESEA_WMS.Repositories;
|
|
namespace WIDESEA_WMS
|
{
|
public partial class ToMesServer
|
{
|
/// <summary>
|
/// 通过SN号获取货位
|
/// </summary>
|
/// <param name="saveModel"></param>
|
/// <returns></returns>
|
public WebResponseContent GetStation(SaveModel saveModel)
|
{
|
WebResponseContent content = new WebResponseContent();
|
VOLContext context = new VOLContext();
|
Idt_stationinfoRepository stationinfoRepository = new dt_stationinfoRepository(context);
|
Idt_agvtaskRepository agvtaskRepository = new dt_agvtaskRepository(context);
|
Idt_inventoryRepository inventoryRepository = new dt_inventoryRepository(context);
|
try
|
{
|
string sn = saveModel.MainData["from_address"].ToString();
|
dt_inventory inventory = inventoryRepository.Find(x => x.SN.Contains(sn)).FirstOrDefault();
|
if (inventory == null)
|
{
|
return content.Error($"未找到{sn}库存信息,请核查库存记录!");
|
}
|
var station = stationinfoRepository.Find(x => x.stationCode == inventory.stationCode).FirstOrDefault();
|
if (agvtaskRepository.Find(x => x.agv_fromaddress == station.stationCode || x.agv_toaddress == station.stationCode).Any())
|
return content.Error($"库位{station.stationCode}存在AGV任务,请核实!");
|
content.Code = station.stationCode;
|
content.OK();
|
}
|
catch (Exception ex)
|
{
|
|
}
|
return content;
|
}
|
}
|
}
|