| | |
| | | /// <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 |
| | |
| | | { |
| | | 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("该储位地址非空闲状态"); |
| | |
| | | { |
| | | 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"; |
| | |
| | | case "800": |
| | | deviceCode = "800L"; |
| | | break; |
| | | case "1000": |
| | | case "100": |
| | | deviceCode = "1000L"; |
| | | break; |
| | | default: |
| | | throw new Exception("不能录入400,800,1000以外的值"); |
| | | throw new Exception("桶号录入错误,请核实!"); |
| | | } |
| | | |
| | | } |
| | |
| | | palletModel.CreateUser = userId; |
| | | //添加桶 |
| | | db.Insertable(palletModel).ExecuteCommand(); |
| | | |
| | | |
| | | var comTime = DateTime.Now; |
| | | var model = new DataStockDetail() |
| | |
| | | SkuName = "", |
| | | LotNo = "", |
| | | |
| | | PalletStatus = "0",//净桶 |
| | | PalletStatus = status, |
| | | |
| | | Standard = deviceCode, //规格 |
| | | |
| | |
| | | |
| | | //下发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(); |