lss
2025-06-16 279721980221a604d6e3dffa48d13ee9dbd0134a
HH.WCS.Mobox3/HH.WCS.Mobox3.JiaTong/wms/WCSHelper.cs
@@ -20,8 +20,13 @@
        {
            var res = false;
            var db = new SqlHelper<WCSTask>().GetInstance();
            if (status == "取货完成")
            {
                task.T_START_TIME = DateTime.Now;
            }
            task.S_B_STATE = status;
            db.Updateable(task).UpdateColumns(it => new { it.S_B_STATE }).ExecuteCommand();
            db.Updateable(task).UpdateColumns(it => new { it.S_B_STATE, it.T_START_TIME }).ExecuteCommand();
            return res;
        }
        internal static bool UpdateStatus(WCSTask task)
@@ -172,6 +177,7 @@
        internal static bool AddActionRecord(string no, int state, string forkliftNo, string extData)
        {
            var db = new SqlHelper<TaskAction>().GetInstance();
            var action = new TaskAction()
            {
                N_ACTION_CODE = state,
@@ -198,7 +204,7 @@
                    task.S_B_STATE = WCSTask.GetStateStr(task.N_B_STATE);
                    task.T_START_TIME = DateTime.Now;
                    task.S_WORKSHOP_NO = agvno;
                    db.Updateable(task).UpdateColumns(it => new { it.N_B_STATE, it.S_B_STATE, it.T_START_TIME, it.S_WORKSHOP_NO }).ExecuteCommand();
                    db.Updateable(task).UpdateColumns(it => new { it.N_B_STATE, it.S_B_STATE, it.S_WORKSHOP_NO }).ExecuteCommand();
                }
            }
@@ -232,9 +238,10 @@
            try
            {
                bool res = false;
                LogHelper.Info($"任务:{TN_Task.S_CODE}开始创建");
                db.BeginTran();
                res = db.Insertable(TN_Task).ExecuteCommand() > 0;
                if (res)
                if (res)
                {
                    var Startmodel = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == TN_Task.S_START_LOC).First();
                    var Endmodel = db.Queryable<Location>().Where(a => a.S_CODE.Trim() == TN_Task.S_END_LOC).First();
@@ -243,6 +250,12 @@
                        Startmodel.N_LOCK_STATE = 2;
                        Startmodel.S_LOCK_STATE = Location.GetLockStateStr(2);
                        res = db.Updateable(Startmodel).UpdateColumns(it => new { it.N_LOCK_STATE, it.S_LOCK_STATE }).ExecuteCommand() > 0;
                    }
                    else
                    {
                        LogHelper.Info($"任务:{TN_Task.S_CODE}生成失败,起点货位不可用");
                        db.RollbackTran();
                        return false;
                    }
                    if (Endmodel != null && Endmodel.S_LOCK_STATE.Trim() == "无")
                    {
@@ -266,7 +279,7 @@
                    LogHelper.Info($"任务:{TN_Task.S_CODE}生成失败");
                    db.RollbackTran();
                }
                return res;
                return res;
            }
            catch (Exception ex)
            {