1
zxx
2 天以前 d66d362ee6d76f02331e56df1fdec1c2114c9f3e
HH.WCS.Mobox3/HH.WCS.Mobox3.XiaoMi/dispatch/GZRobot.cs
@@ -1,11 +1,13 @@
using HH.WCS.XiaoMi.api;
using HH.WCS.XiaoMi.core;
using HH.WCS.XiaoMi.LISTA.dispatch;
using HH.WCS.XiaoMi.process;
using HH.WCS.XiaoMi.util;
using HH.WCS.XiaoMi.wms;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using static HH.WCS.XiaoMi.api.ApiModel;
using static HH.WCS.XiaoMi.LISTA.dispatch.XMWcsHelper;
@@ -249,14 +251,72 @@
                {
                    //2表示申请目标库位
                    var apply = new ApplyModel() { wcsTaskCode = wcsTask.S_WORKSHOP_NO };
                    var end = XMWcsHelper.GetPositionApply(apply);
                    if (!string.IsNullOrEmpty(end.body.pointCode))
                    #region 写死测试用
                    if (!string.IsNullOrEmpty("HC43"))
                    {
                        result.resultCode = 0;
                        result.msg = "目标库位已申请";
                        result.orderData = end.body.pointCode;
                        result.orderData = "HC43";
                        //任务表补上
                        var db = new SqlHelper<WCSTask>().GetInstance();
                        var task = db.Queryable<WCSTask>().Where(a => a.S_CODE == model.orderName).First();
                        LogHelper.Info($"task参数======={JsonConvert.SerializeObject(task)}");
                        var endLoc = LocationHelper.GetLocation("HC43");
                        LogHelper.Info($"endLoc参数======={JsonConvert.SerializeObject(endLoc)}");
                        task.S_END_LOC = "HC43";
                        task.S_END_AREA = endLoc.S_AREA_CODE;
                        var res = db.Updateable(task).UpdateColumns(it => new { it.S_END_LOC, it.S_END_AREA }).ExecuteCommand() > 0;
                        //锁住终点货位
                        LogHelper.Info($"task2参数======={JsonConvert.SerializeObject(task)}");
                        LocationHelper.LockLoc("HC43", 1);
                        if (!res)
                        {
                            result.resultCode = 1;
                            result.success = false;
                            result.msg = $"终点库位{task.S_END_LOC}更新失败";
                        }
                        LogHelper.Info($"result参数======={JsonConvert.SerializeObject(result)}");
                        return result;
                    }
                    #endregion
                    //var db = new SqlHelper<Object>().GetInstance();
                    //var end = XMWcsHelper.GetPositionApply(apply);
                    //string endPointCode = null;
                    //if (end.body.targetType.Equals("AREA")) {
                    //    var endLoc1 =TaskProcess.InWorkTransport(end.body.pointCode);
                    //    if (endLoc1!=null)
                    //    {
                    //        //如果没找到就等第一条
                    //        endPointCode = db.Queryable<Location>().Where(a => a.S_AREA_CODE.Trim() == end.body.pointCode).OrderByDescending(a => a.N_ROW).ToList()[0].S_CODE;
                    //    }
                    //} else if (end.body.targetType.Equals("STATION")) {
                    //    endPointCode= end.body.pointCode;
                    //}
                    //if (!string.IsNullOrEmpty(endPointCode))
                    //{
                    //    result.resultCode = 0;
                    //    result.msg = "目标库位已申请";
                    //    result.orderData = endPointCode;
                    //    //任务表补上
                    //    var task = db.Queryable<WCSTask>().Where(a => a.S_CODE == model.orderName).First();
                    //    var endLoc = LocationHelper.GetLocation(endPointCode);
                    //    task.S_END_LOC = endPointCode;
                    //    task.S_END_AREA = endLoc.S_AREA_CODE;
                    //    var res = db.Updateable(task).UpdateColumns(it => new { it.S_END_LOC, it.S_END_AREA }).ExecuteCommand() > 0;
                    //    //锁住终点货位
                    //    LocationHelper.LockLoc(endPointCode, 1);
                    //    if (!res)
                    //    {
                    //        result.resultCode = 1;
                    //        result.success = false;
                    //        result.msg = $"终点库位{task.S_END_LOC}更新失败";
                    //    }
                    //    return result;
                    //}
                    else
                    {
                        result.resultCode = 1;