lss
5 天以前 f46e8e10c579b92a807b10fa00f5076f33198ce8
HH.WCS.Mobox3 - ´ó³µ¼ä/HH.WCS.Mobox3.JiaTong/api/ApiHelper.cs
@@ -1,9 +1,9 @@
using HH.WCS.JiaTong.device;
using HH.WCS.JiaTong.dispatch;
using HH.WCS.JiaTong.LISTA.models;
using HH.WCS.JiaTong.process;
using HH.WCS.JiaTong.util;
using HH.WCS.JiaTong.wms;
using HH.WCS.JiaTong_DCJ.device;
using HH.WCS.JiaTong_DCJ.dispatch;
using HH.WCS.JiaTong_DCJ.LISTA.models;
using HH.WCS.JiaTong_DCJ.process;
using HH.WCS.JiaTong_DCJ.util;
using HH.WCS.JiaTong_DCJ.wms;
using Newtonsoft.Json;
using NLog.Fluent;
using S7.Net;
@@ -17,12 +17,12 @@
using System.Threading;
using System.Threading.Tasks;
using System.Web.UI.WebControls;
using static HH.WCS.JiaTong.api.ApiModel;
using static HH.WCS.JiaTong.api.OtherModel;
using static HH.WCS.JiaTong.LISTA.process.HttpModel;
using static HH.WCS.JiaTong.util.Settings;
using static HH.WCS.JiaTong_DCJ.api.ApiModel;
using static HH.WCS.JiaTong_DCJ.api.OtherModel;
using static HH.WCS.JiaTong_DCJ.LISTA.process.HttpModel;
using static HH.WCS.JiaTong_DCJ.util.Settings;
namespace HH.WCS.JiaTong.api
namespace HH.WCS.JiaTong_DCJ.api
{
    /// <summary>
    /// api接口辅助类
@@ -123,110 +123,6 @@
                Location startloc = null;
                lock (_lockCreateTask)
                {
                    if (taskData.taskType == 1) //出库流程,通过物料机台计算线边货位
                    {
                        note = "出库";
                        startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First();
                        if (startloc != null)
                        {
                            //创建托盘物料绑定信息,并计算终点货位
                            Start = taskData.pickStation;
                            if (CreateCntrIteminfo(partData, taskData))
                            {
                                endloc = Computeloc(CntrCode, taskData.dropStation, taskData.carrierType);
                                if (endloc != null)
                                {
                                    End = endloc.S_CODE;
                                }
                                else
                                {
                                    result.code = "1";
                                    result.msg = $"机台编码:{taskData.dropStation},未找到可用货位";
                                    AddErrorInfo("寻找出库货位失败", result.msg, Source);
                                    return result;
                                }
                                //endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.dropStation).First();
                                //if (endloc != null)
                                //{
                                //    End = taskData.dropStation;
                                //}
                                //else
                                //{
                                //    result.code = "1";
                                //    result.msg = $"根据终点{End},找不到对应货位,请检查货位表";
                                //    AddErrorInfo("货位查找失败", result.msg, Source);
                                //    return result;
                                //}
                            }
                            else
                            {
                                result.code = "1";
                                result.msg = "创建托盘物料信息失败";
                                AddErrorInfo("创建托盘失败", result.msg, Source);
                                return result;
                            }
                        }
                        else
                        {
                            result.code = "1";
                            result.msg = $"Putin==> ä»»åŠ¡èµ·ç‚¹:{taskData.pickStation}找不到对应货位,请检查货位表";
                            LogHelper.Info($"Putin==> {result.msg}");
                            AddErrorInfo("货位查找失败", result.msg, Source);
                            return result;
                        }
                    }
                    else if (taskData.taskType == 2)//入库流程,直接使用起点货位和终点货位生成任务,起点需要有托盘
                    {
                        note = "入库";
                        startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First();
                        if (startloc != null)
                        {
                            Start = startloc.S_CODE;
                            var CntrRel = LocationHelper.GetLocCntrRel(startloc.S_CODE).OrderBy(a => a.T_CREATE).FirstOrDefault();
                            if (CntrRel != null)
                            {
                                if (CntrRel.S_CNTR_CODE != partData.rfid)
                                {
                                    result.code = "1";
                                    result.msg = $"根据起点:{Start}获取托盘:{CntrRel.S_CNTR_CODE}与下发托盘:{partData.rfid}不一致,请检查托盘码是否正确";
                                    AddErrorInfo("托盘码校检失败", result.msg, Source);
                                    return result;
                                }
                                else
                                {
                                    CntrCode = CntrRel.S_CNTR_CODE;
                                }
                            }
                        }
                        else
                        {
                            result.code = "1";
                            result.msg = $"根据起点{taskData.pickStation},找不到对应货位,请检查货位表";
                            AddErrorInfo("货位查找失败", result.msg, Source);
                            return result;
                        }
                        endloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.dropStation).First();
                        if (endloc != null)
                        {
                            End = taskData.dropStation;
                        }
                        else
                        {
                            result.code = "1";
                            result.msg = $"根据终点{End},找不到对应货位,请检查货位表";
                            AddErrorInfo("货位查找失败", result.msg, Source);
                            return result;
                        }
                    }
                    else if (taskData.taskType == 3)//移库流程,直接使用起点货位和终点货位生成任务,
                    {
                        note = "出库";
                        //创建托盘物料绑定信息,并计算终点货位
                        startloc = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == taskData.pickStation).First();
@@ -252,15 +148,6 @@
                            result.msg = $"根据终点{taskData.dropStation},找不到对应货位,请检查货位表";
                            AddErrorInfo("货位查找失败", result.msg, Source);
                            return result;
                        }
                    }
                    else
                    {
                        LogHelper.Info($"Createtask==> ä»»åŠ¡ç±»åž‹æœ‰è¯¯");
                        result.code = "1";
                        result.msg = "任务类型:{taskData.taskType}不在规定范围内";
                        AddErrorInfo("任务类型错误", result.msg, Source);
                    }
                
                        if (!string.IsNullOrEmpty(Start) && !string.IsNullOrEmpty(End))
@@ -338,7 +225,6 @@
                        }
              
                }
                return result;
            }