process/TaskProcess.cs
@@ -15,6 +15,7 @@
using static HH.WCS.Mobox3.pinggao.models.SapRoot.WcReturnRoot;
using static HH.WCS.Mobox3.pinggao.api.OtherModel;
using NLog.Fluent;
using System.Xml.Linq;
namespace HH.WCS.Mobox3.pinggao.process
{
@@ -165,7 +166,7 @@
                                   .ToList();
                        if (TN_Task.N_ERR == 2)//前移车
                        {
                            endlist = endlist.Where(s => s.N_LAYER < 7).ToList();
                        }
                        foreach (var item in endlist)
@@ -567,24 +568,72 @@
        }
        public static DateTime? ParseCustomFormatDate(string dateStr)
        {
            // 假设日期格式是 yy:mm
            if (DateTime.TryParseExact(dateStr, "HH:mm", null, System.Globalization.DateTimeStyles.None, out DateTime result))
            {
                return result;
            }
            return null;
        }
        public static bool SendCd()
        {
            var db = new SqlHelper<object>().GetInstance();
            var dstart = db.Queryable<TN_CD>().Where(s => s.N_STATE == 0).First();
        public static bool SendCd() {
             var result=false;
                var dic = new Dictionary<string, string>();
                var dic1 = new Dictionary<string, string>();
                dic.Add("ExtDeviceNo", "1");
                //判断
                var res = NDC.OrderAdd(99, dic, dic1);
                if (res != null && (res.Res.ErrCode == 0 || res.Res.ErrCode == 50009))
            var result = false;
            if (dstart != null)
            {
                DateTime currentDate = DateTime.Now;
                // 格式化输出时分部分
                string currentHourMinute = currentDate.ToString("HH:mm");
                if (currentHourMinute == "00:00")
                {
                result = true;
                    dstart.N_STATE = 0;
                    db.Updateable<TN_CD>(dstart).UpdateColumns(a => new { a.N_STATE }).ExecuteCommand();
                }
                if (dstart.S_TIME == currentHourMinute)
                {
                    var dic = new Dictionary<string, string>();
                    var dic1 = new Dictionary<string, string>();
                    var no = WMSHelper.GenerateTaskNo();
                    dic.Add("No", no);
                    dic.Add("Pri", "0");
                    dic1.Add("ExtDeviceNo", "1");
                    //判断
                    var res = NDC.OrderAdd(99, dic, dic1);
                    if (res != null && (res.Res.ErrCode == 0 || res.Res.ErrCode == 50009))
                    {
                        //    dstart.N_STATE = 1;
                        //    db.Updateable<TN_CD>(dstart).UpdateColumns(a => new { a.N_STATE }).ExecuteCommand();
                        // result = true;
                    }
                    var dic12 = new Dictionary<string, string>();
                    var dic11 = new Dictionary<string, string>();
                    var no1 = WMSHelper.GenerateTaskNo();
                    dic12.Add("No", no1);
                    dic12.Add("Pri", "0");
                    dic11.Add("ExtDeviceNo", "2");
                    //判断
                    var res1 = NDC.OrderAdd(99, dic12, dic11);
                    if (res1 != null && (res1.Res.ErrCode == 0 || res1.Res.ErrCode == 50009))
                    {
                        dstart.N_STATE = 1;
                        db.Updateable<TN_CD>(dstart).UpdateColumns(a => new { a.N_STATE }).ExecuteCommand();
                        result = true;
                    }
                }
            }
            return result;
        }
        /// <summary>