| | |
| | | /// </summary> |
| | | public class WMSHelper { |
| | | /// <summary> |
| | | /// 检查容器类型 |
| | | /// 检查容器类型 ( 容器表 不存在 / 类型不匹配 时 , 返回 false ) |
| | | /// </summary> |
| | | /// <param name="cntrCode"></param> |
| | | /// <param name="cntrType"></param> |
| | |
| | | return (true, "检查容器类型成功!!"); |
| | | } |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | /// <param name="locCode"></param> |
| | | /// <param name="areas"></param> |
| | | /// <param name="startLoc"></param> |
| | | /// <returns></returns> |
| | | public static (bool, string) FindStartLocUnbind(string locCode, List<string> areas, out TN_Location startLoc) { |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | startLoc = db.Queryable<TN_Location>().Where(DbExpr.StartLocUnbind(locCode, areas)).First(); |
| | | if (startLoc == null) { |
| | | return (false, LogMsg.StartLocUnbindNotFound(locCode, areas)); |
| | | } |
| | | return (true, ""); |
| | | } |
| | | /// <summary> |
| | | /// 根据容器号 , 查找旧的货位 / 货位绑定 / 物料信息 ( 将待删除 / 更新数据写入 obj ) |
| | | /// </summary> |
| | | /// <remarks><code><![CDATA[obj.Old = oldLocCntrCg;]]></code></remarks> |
| | |
| | | /// <param name="cntrCode"></param> |
| | | /// <param name="skipCgDetail"></param> |
| | | /// <returns></returns> |
| | | public static LocCntrCg FindCntrOldInfo(CreateTaskObj obj, string cntrCode, bool skipCgDetail = true) { |
| | | public static LocCntrCg FindOldCntrInfo(CreateTaskObj obj, string cntrCode, bool skipCgDetail = true) { |
| | | var oldLocCntrCg = WCSHelper.GetLocCntrCg(cntrCode, skipCgDetail); |
| | | obj.Old = oldLocCntrCg; |
| | | return oldLocCntrCg; |
| | | } |
| | | /// <summary> |
| | | /// 绑定货位容器 ( 修改 [ 货位容器表 ] [ 货位类型 ] = cntrType ; 将 [ 待插入 ] 货位容器关系 加入到 obj 中 ) |
| | | /// 绑定货位容器 ( 修改 [ 货位容器表 ] [ 货位类型 ] = cntrType ; 将 [ 待插入 ] 货位容器关系 加入到 obj 中 )<br/> |
| | | /// 调用 <see cref="WCSHelper.BindLocCntr"/> 设置 loc.N_CURRENT_NUM = 1 |
| | | /// </summary> |
| | | /// <remarks><code><![CDATA[obj.New = new LocCntrCg { LocCntrRel = locCntrRel };]]></code></remarks> |
| | | /// <param name="obj"></param> |
| | |
| | | |
| | | return task; |
| | | } |
| | | |
| | | private const bool __查询语句封装__ = false; // 仅用于分段,没有实质意义(VS2022 v17.4.3 文档大纲) |
| | | #region 查询语句(搁置,设为私有,查询需求变更多,封装不够灵活) |
| | | /// <summary> |
| | | /// 查询 [ 绑定前 ] 的起点货位 |
| | | /// </summary> |
| | | /// <example><code><![CDATA[ |
| | | /// (ok, msg) = WMSHelper.FindStartLocUnbind(model.StartLoc, taskInfo.StartAreas, out var startLoc); |
| | | /// if (!ok) return NewSimpleResult(2, preLog + msg); |
| | | /// ]]></code></example> |
| | | /// <param name="locCode"></param> |
| | | /// <param name="areas"></param> |
| | | /// <param name="startLoc"></param> |
| | | /// <returns></returns> |
| | | private static (bool, string) FindStartLocUnbind(string locCode, List<string> areas, out TN_Location startLoc) { |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | startLoc = db.Queryable<TN_Location>().Where(DbExpr.StartLocUnbind(locCode, areas)).First(); |
| | | if (startLoc == null) { |
| | | return (false, LogMsg.StartLocUnbindNotFound(locCode, areas)); |
| | | } |
| | | return (true, ""); |
| | | } |
| | | /// <summary> |
| | | /// 查询 [ 绑定后 ] 的起点货位 |
| | | /// </summary> |
| | | /// <example><code><![CDATA[ |
| | | /// (ok, msg) = WMSHelper.FindStartLoc(model.StartLoc, taskInfo.StartAreas, out var startLoc); |
| | | /// if (!ok) return NewSimpleResult(2, preLog + msg); |
| | | /// ]]></code></example> |
| | | /// <param name="locCode"></param> |
| | | /// <param name="areas"></param> |
| | | /// <param name="startLoc"></param> |
| | | /// <returns></returns> |
| | | private static (bool, string) FindStartLoc(string locCode, List<string> areas, out TN_Location startLoc) { |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | startLoc = db.Queryable<TN_Location>().Where(DbExpr.StartLoc(locCode, areas)).First(); |
| | | if (startLoc == null) { |
| | | return (false, LogMsg.StartLocNotFound(locCode, areas)); |
| | | } |
| | | return (true, ""); |
| | | } |
| | | /// <summary> |
| | | /// 查询终点货位 |
| | | /// </summary> |
| | | /// <example><code><![CDATA[ |
| | | /// (ok, msg) = WMSHelper.FindEndLoc(areas: taskInfo.EndAreas, out var endLoc); |
| | | /// if (!ok) return NewSimpleResult(3, preLog + msg); |
| | | /// ]]></code></example> |
| | | /// <param name="locCode"></param> |
| | | /// <param name="areas"></param> |
| | | /// <param name="endLoc"></param> |
| | | /// <returns></returns> |
| | | private static (bool, string) FindEndLoc(string locCode, List<string> areas, out TN_Location endLoc) { |
| | | var db = new SqlHelper<object>().GetInstance(); |
| | | endLoc = db.Queryable<TN_Location>().Where(DbExpr.EndLoc(locCode, areas)).First(); |
| | | if (endLoc == null) { |
| | | return (false, LogMsg.EndLocNotFound(locCode, areas)); |
| | | } |
| | | return (true, ""); |
| | | } |
| | | #endregion |
| | | } |
| | | } |