using HH.WCS.JiaTong.api;
|
using HH.WCS.JiaTong.models.other;
|
using HH.WCS.JiaTong.util;
|
using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Linq.Expressions;
|
using System.Reflection;
|
using System.Runtime.Remoting.Messaging;
|
using System.Text;
|
using System.Threading.Tasks;
|
using static HH.WCS.JiaTong.api.ApiModel;
|
|
namespace HH.WCS.JiaTong.wms
|
{
|
/// <summary>
|
/// wms管到作业
|
/// </summary>
|
internal class WMSHelper
|
{
|
internal static string GenerateTaskNo()
|
{
|
var id = SYSHelper.GetSerialNumber("作业号", "OP");
|
var date = DateTime.Now.ToString("yyMMdd");
|
return $"OP{date}{id.ToString().PadLeft(4, '0')}";
|
}
|
internal static string GenerateSortingNo()
|
{
|
var id = SYSHelper.GetSerialNumber("分拣单", "SO");
|
var date = DateTime.Now.ToString("yyMMdd");
|
return $"SO{date}{id.ToString().PadLeft(4, '0')}";
|
}
|
internal static List<WMSTask> GetOperationListByState(string state)
|
{
|
var db = new SqlHelper<object>().GetInstance();
|
return db.Queryable<WMSTask>().Where(a => a.S_B_STATE == state).ToList();
|
}
|
internal static List<WMSTask> GetOperationListByState(int state)
|
{
|
var db = new SqlHelper<object>().GetInstance();
|
return db.Queryable<WMSTask>().Where(a => a.N_B_STATE == state).ToList();
|
}
|
internal static List<WMSTask> GetWaitingOperationList()
|
{
|
var db = new SqlHelper<object>().GetInstance();
|
return db.Queryable<WMSTask>().Where(a => a.N_B_STATE == 0 || a.N_B_STATE == 3).ToList();
|
}
|
|
internal static bool CreateWmsTask(WMSTask wmsTask)
|
{
|
try
|
{
|
var db = new SqlHelper<object>().GetInstance();
|
return db.Insertable<WMSTask>(wmsTask).ExecuteCommand() > 0;
|
}
|
catch (Exception ex)
|
{
|
Console.WriteLine(ex.Message);
|
throw;
|
}
|
}
|
|
internal static Location GetEnd(WMSTask a)
|
{
|
|
throw new NotImplementedException();
|
}
|
|
internal static Location GetStart(WMSTask a)
|
{
|
throw new NotImplementedException();
|
}
|
|
internal static void UpdateTaskState(WMSTask task)
|
{
|
var db = new SqlHelper<object>().GetInstance();
|
task.T_MODIFY = DateTime.Now;
|
task.S_B_STATE = WMSTask.GetStateStr(task.N_B_STATE);
|
db.Updateable<WMSTask>(task).UpdateColumns(a => new { a.N_B_STATE, a.S_B_STATE, a.T_MODIFY }).ExecuteCommand();
|
}
|
|
internal static bool UpdateTaskEnd(WMSTask a)
|
{
|
var db = new SqlHelper<object>().GetInstance();
|
a.T_MODIFY = DateTime.Now;
|
return db.Updateable<WMSTask>(a).UpdateColumns(it => new { it.S_END_LOC, it.T_MODIFY }).ExecuteCommand() > 0;
|
}
|
|
internal static WMSTask GetWmsTask(string code)
|
{
|
var db = new SqlHelper<object>().GetInstance();
|
return db.Queryable<WMSTask>().Where(a => a.S_CODE == code).First();
|
}
|
|
|
}
|
}
|