using SqlSugar;
|
using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using WMS.BLL.LogServer;
|
using WMS.Entity.Context;
|
using WMS.Entity.DataEntity;
|
using WMS.Entity.LogEntity;
|
using WMS.Entity.SysEntity;
|
using WMS.IBLL;
|
|
namespace WMS.BLL
|
{
|
public class HttpServer:IHttpServer
|
{
|
private static readonly SqlSugarScope Db = DataContext.Db;
|
public HttpServer() { }
|
|
public void UpLocateByAgvOut(string taskNo, int userId)
|
{
|
try
|
{
|
|
var task = Db.Queryable<LogTask>().First(m => m.IsDel == "0" && m.TaskNo == taskNo);
|
if (task == null)
|
{
|
throw new Exception("未查询到任务信息");
|
}
|
if (task.Status != "1")
|
{
|
throw new Exception("当前任务已完成");
|
}
|
if (userId != 0)
|
{
|
//添加操作日志记录
|
var k = new OperationASNServer().AddLogOperationAsn("入库作业", "入库日志", taskNo, "完成", $"点击完成按钮、完成任务号为:{taskNo}的任务", userId);
|
}
|
|
var locate = Db.Queryable<SysStorageLocat>().First(m => m.LocatNo == task.StartLocat);
|
if (locate == null)
|
{
|
throw new Exception($"未查询到任务中的储位信息");
|
}
|
var pingAreaStr = Db.Queryable<SysStorageArea>().Where(m => m.IsDel == "0" && m.WareHouseNo == "W04" && m.AreaNo != "B06" && m.AreaNo != "B07").Select(m => m.AreaNo).ToList();
|
var pingLocateInfo = Db.Queryable<SysStorageLocat>().First(m => m.LocatNo == locate.LocatNo && pingAreaStr.Contains(m.AreaNo) && m.IsDel == "0");
|
if (pingLocateInfo == null)
|
{
|
throw new Exception("当前任务起始储位不在平库储位");
|
}
|
locate.Status = "0";
|
Db.Updateable(locate).ExecuteCommand();
|
}
|
catch (Exception e)
|
{
|
throw new Exception(e.Message);
|
}
|
}
|
}
|
}
|