zhaowc
20 小时以前 35e3dae48db445e66c9614ee55dba062659e33d7
Wms/WMS.BLL/SysServer/PalletsServer.cs
@@ -123,7 +123,7 @@
        /// <param name="locatNo"></param>
        /// <param name="userId"></param>
        /// <exception cref="Exception"></exception>
        public void AddPallets(string palletNo,string locatNo, string deviceCode, string url, int userId)
        public void AddPallets(string palletNo,string locatNo, string status, string url, int userId)
        {
            var db = DataContext.Db;
            try
@@ -146,6 +146,18 @@
                {
                    throw new Exception("储位地址不存在");
                }
                if (locatModel.Flag == "1")
                {
                    throw new Exception("该储位已屏蔽");
                }
                var nlocat = db.Queryable<SysStorageLocat>().First(w => w.AisleOne == locatModel.LocatNo && w.IsDel == "0");
                if (nlocat != null)
                {
                    if (nlocat.Status == "0")
                    {
                        throw new Exception("请从内侧库位开始绑定");
                    }
                }
                if (locatModel.Status != "0")
                {
                    throw new Exception("该储位地址非空闲状态");
@@ -155,14 +167,28 @@
                {
                    throw new Exception("储位地址所属区域不存在");
                }
                if (!areaModel.AreaName.Contains("净桶"))
                switch (status)
                {
                    throw new Exception("新添加的桶只能绑定净桶区");
                    case "0":
                        if (!areaModel.AreaName.Contains("净桶"))
                        {
                            throw new Exception("请选择净桶区域进行绑定");
                        }
                        break;
                    case "3":
                        if (!areaModel.AreaName.Contains("脏桶"))
                        {
                            throw new Exception("请选择脏桶区域进行绑定");
                        }
                        break;
                    default:
                        throw new Exception("请选择桶类型!");
                        break;
                }
                if (!string.IsNullOrEmpty(deviceCode))
                string deviceCode = "";
                if (!string.IsNullOrEmpty(palletNo))
                {
                    switch (deviceCode)
                    switch (palletNo.Substring(2,3))
                    {
                        case "400":
                            deviceCode = "400L";
@@ -170,11 +196,11 @@
                        case "800":
                            deviceCode = "800L";
                            break;
                        case "1000":
                        case "100":
                            deviceCode = "1000L";
                            break;
                        default:
                            throw new Exception("不能录入400,800,1000以外的值");
                            throw new Exception("桶号录入错误,请核实!");
                    }
                }
@@ -189,6 +215,7 @@
                palletModel.CreateUser = userId;
                //添加桶
                db.Insertable(palletModel).ExecuteCommand();
                var comTime = DateTime.Now;
                var model = new DataStockDetail()
@@ -221,7 +248,7 @@
                    SkuName = "",
                    LotNo = "",
                    PalletStatus = "0",//净桶
                    PalletStatus = status,
                    Standard = deviceCode,  //规格
@@ -240,17 +267,17 @@
                //下发AGV绑定载具接口
                //调用AGV接口下发任务
                //string agvMsg = string.Empty;
                ////给下车下发任务
                //var agvResult = RcsHelper.BindPalletAndSite(palletNo, locatNo,url, out agvMsg);
                //if (agvResult)//成功
                //{
                //     //增加日志
                //}
                //else//失败
                //{
                //    throw new Exception("小车载具和库位关系绑定失败,原因:"+agvMsg);
                //}
                string agvMsg = string.Empty;
                //给下车下发任务
                var agvResult = RcsHelper.BindPalletAndSite(palletNo, locatNo, url, out agvMsg);
                if (agvResult)//成功
                {
                    //增加日志
                }
                else//失败
                {
                    throw new Exception("小车载具和库位关系绑定失败,原因:" + agvMsg);
                }
                //提交事务
                db.CommitTran();