| | |
| | | using System.Data; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using Model.ModelDto.BllSoDto; |
| | | using Model.ModelDto.SysDto; |
| | | using SqlSugar; |
| | | using WMS.Entity.BllAsnEntity; |
| | | using WMS.Entity.BllCheckEntity; |
| | | using WMS.Entity.BllQualityEntity; |
| | |
| | | { |
| | | var Db = DataContext.Db; |
| | | //获取储位信息 |
| | | var sql = $@"select * from SysStorageLocat where WareHouseNo = '{houseNo}' and LocatNo = '{locateNo}'; "; |
| | | var locate = Db.Ado.SqlQuery<SysStorageLocat>(sql).First(); |
| | | //var sql = $@"select * from SysStorageLocat where WareHouseNo = '{houseNo}' and LocatNo = '{locateNo}'; "; |
| | | var locate = Db.Queryable<SysStorageLocat>().Where(s => s.WareHouseNo == houseNo && s.LocatNo == locateNo).First(); |
| | | if (locate == null) |
| | | { |
| | | throw new Exception($"未查询到仓库号为{houseNo}、储位号为{locateNo}的信息"); |
| | | } |
| | | //获取深度为2的储位信息 |
| | | var sql2 = $@"select * from SysStorageLocat where WareHouseNo = '{houseNo}' and row = {locate.Row} and [Column] = {locate.Column} and Layer = {locate.Layer} and Depth = '01'; "; |
| | | var data = Db.Ado.SqlQuery<SysStorageLocat>(sql2).First(); |
| | | //var sql2 = $@"select * from SysStorageLocat where WareHouseNo = '{houseNo}' and row = {locate.Row} and [Column] = {locate.Column} and Layer = {locate.Layer} and Depth = '01'; "; |
| | | //var data = Db.Ado.SqlQuery<SysStorageLocat>(sql2).First(); |
| | | var data = Db.Queryable<SysStorageLocat>().Where(s => s.WareHouseNo == houseNo && s.Row == locate.Row && s.Column == locate.Column && s.Layer == locate.Layer && s.Depth == "01").First(); |
| | | if (data == null) |
| | | { |
| | | throw new Exception($"未查询到仓库号为{houseNo}、储位号为{locateNo}的里面储位信息"); |
| | |
| | | { |
| | | var Db = DataContext.Db; |
| | | //获取储位信息 |
| | | var sql = $@"select * from SysStorageLocat where WareHouseNo = '{houseNo}' and LocatNo = '{locateNo}'; "; |
| | | var locate = Db.Ado.SqlQuery<SysStorageLocat>(sql).First(); |
| | | //var sql = $@"select * from SysStorageLocat where WareHouseNo = '{houseNo}' and LocatNo = '{locateNo}'; "; |
| | | //var locate = Db.Ado.SqlQuery<SysStorageLocat>(sql).First(); |
| | | var locate = Db.Queryable<SysStorageLocat>().Where(s => s.WareHouseNo == houseNo && s.LocatNo == locateNo).First(); |
| | | if (locate == null) |
| | | { |
| | | throw new Exception($"未查询到仓库号为{houseNo}、储位号为{locateNo}的信息"); |
| | | } |
| | | //获取深度为2的储位信息 |
| | | var sql2 = $@"select * from SysStorageLocat where WareHouseNo = '{houseNo}' and row = {locate.Row} and [Column] = {locate.Column} and Layer = {locate.Layer} and Depth = '02'; "; |
| | | var data = Db.Ado.SqlQuery<SysStorageLocat>(sql2).First(); |
| | | //var sql2 = $@"select * from SysStorageLocat where WareHouseNo = '{houseNo}' and row = {locate.Row} and [Column] = {locate.Column} and Layer = {locate.Layer} and Depth = '02'; "; |
| | | //var data = Db.Ado.SqlQuery<SysStorageLocat>(sql2).First(); |
| | | var data = Db.Queryable<SysStorageLocat>().Where(s => s.WareHouseNo == houseNo && s.Row == locate.Row && s.Column == locate.Column && s.Layer == locate.Layer && s.Depth == "02").First(); |
| | | if (data == null) |
| | | { |
| | | throw new Exception($"未查询到仓库号为{houseNo}、储位号为{locateNo}的里面储位信息"); |
| | |
| | | var lie = int.Parse(oldAddress.Substring(2, 2)); |
| | | var ceng = int.Parse(oldAddress.Substring(4, 2)); |
| | | |
| | | var sqlString = $@"select LocatNo,[Row],[Column],Layer, (ABS(Row-{row}) + ABS([Column]-{lie}) + ABS(Layer-{ceng})) as distNum from SysStorageLocat where Flag = '0' and Status = '0' and Depth = '02' and RoadwayNo = '{roadWay}' and AreaNo in ('{category.AreaNo}') order by distNum;"; |
| | | //var sqlString = $@"select LocatNo,[Row],[Column],Layer, (ABS(Row-{row}) + ABS([Column]-{lie}) + ABS(Layer-{ceng})) as distNum from SysStorageLocat where Flag = '0' and Status = '0' and Depth = '02' and RoadwayNo = '{roadWay}' and AreaNo in ('{category.AreaNo}') order by distNum;"; |
| | | |
| | | var addressModels = Db.Ado.SqlQuery<AddressCls>(sqlString).ToList(); |
| | | //var addressModels = Db.Ado.SqlQuery<AddressCls>(sqlString).ToList(); |
| | | var listArea = category.AreaNo.Split(','); |
| | | var addressModels = Db.Queryable<SysStorageLocat>() |
| | | .Where(s => s.Flag == "0" && s.Status == "0" && s.Depth == "02" && s.RoadwayNo == roadWay && listArea.Contains(s.AreaNo)) |
| | | .Select(s => new AddressCls() |
| | | { |
| | | LocatNo = s.LocatNo, |
| | | Row = s.Row, |
| | | Column = s.Column, |
| | | Layer = s.Layer, |
| | | DistNum = SqlFunc.Abs(s.Row - row) + SqlFunc.Abs(s.Column - lie) + SqlFunc.Abs(s.Layer - ceng) |
| | | }) |
| | | .OrderBy(s => s.DistNum) |
| | | .ToList(); |
| | | if (addressModels.Count > 0) // 判断同巷道内排空库位 |
| | | { |
| | | var listLocaete = new List<string>(); |
| | |
| | | |
| | | // 判断目标库位的外库位是否存在货物 (正常情况下正在移入情况不存在,因为移库先移入里面,后移入外面) |
| | | //SlotStatus 0: 空储位 1:有货 2:正在入库 3:正在出库 4:正在移入 5:正在移出 |
| | | sqlString = $"select count(*) from SysStorageLocat where LocatNo = '{addressee}' and Status = '0' and Flag in ('0','1') ; "; |
| | | var rowNum = Db.Ado.SqlQuery<int>(sqlString).First(); |
| | | //sqlString = $"select count(*) from SysStorageLocat where LocatNo = '{addressee}' and Status = '0' and Flag in ('0','1') ; "; |
| | | //var rowNum = Db.Ado.SqlQuery<int>(sqlString).First(); |
| | | var rowNum = Db.Queryable<SysStorageLocat>().Count(s => s.LocatNo == addressee && s.Status == "0" && (s.Flag == "0" || s.Flag == "1")); |
| | | if (rowNum == 0) |
| | | { |
| | | continue; |
| | |
| | | if (nowAddress == "") |
| | | { |
| | | // 判断同巷道外排空库位 |
| | | sqlString = $@"select LocatNo,[Row],[Column],Layer, (ABS(Row-{row}) + ABS([Column]-{lie}) + ABS(Layer-{ceng})) as distNum |
| | | from SysStorageLocat |
| | | where Flag = '0' and Status = '0' and Depth = '01' and RoadwayNo = '{roadWay}' and AreaNo in '{category}' |
| | | order by distNum;"; |
| | | var adderModeling = Db.Ado.SqlQuery<AddressCls>(sqlString).ToList(); |
| | | //sqlString = $@"select LocatNo,[Row],[Column],Layer, (ABS(Row-{row}) + ABS([Column]-{lie}) + ABS(Layer-{ceng})) as distNum |
| | | // from SysStorageLocat |
| | | // where Flag = '0' and Status = '0' and Depth = '01' and RoadwayNo = '{roadWay}' and AreaNo in '{category}' |
| | | // order by distNum;"; |
| | | //var adderModeling = Db.Ado.SqlQuery<AddressCls>(sqlString).ToList(); |
| | | var adderModeling = Db.Queryable<SysStorageLocat>() |
| | | .Where(s => s.Flag == "0" && s.Status == "0" && s.Depth == "01" && s.RoadwayNo == roadWay && listArea.Contains(s.AreaNo)) |
| | | .Select(s => new AddressCls() |
| | | { |
| | | LocatNo = s.LocatNo, |
| | | Row = s.Row, |
| | | Column = s.Column, |
| | | Layer = s.Layer, |
| | | DistNum = SqlFunc.Abs(s.Row - row) + SqlFunc.Abs(s.Column - lie) + SqlFunc.Abs(s.Layer - ceng) |
| | | }) |
| | | .OrderBy(s => s.DistNum) |
| | | .ToList(); |
| | | if (adderModeling.Count > 0) |
| | | { |
| | | nowAddress = adderModeling[0].LocatNo; |
| | |
| | | orderNo = list.Select(a => a.ASNNo).Max(); |
| | | } |
| | | else if (codeFlag == InOutFlag.PM.ToString())//移库 |
| | | { |
| | | { |
| | | } |
| | | else if (codeFlag == InOutFlag.CR.ToString())//盘点 |
| | | { |
| | |
| | | else if (codeFlag == InOutFlag.TK.ToString())//任务 |
| | | { |
| | | var list = DataContext.Db.Queryable<LogTask>().Where(m => m.TaskNo.StartsWith("TK")).ToList(); |
| | | orderNo = list.Max(m=>m.TaskNo); |
| | | orderNo = list.Max(m => m.TaskNo); |
| | | } |
| | | else if (codeFlag == InOutFlag.EX.ToString())//异常 |
| | | { |
| | |
| | | /// </summary> |
| | | /// <param name="sqlString">查询语句</param> |
| | | /// <returns>行数</returns> |
| | | public int GetRowCount(string sqlString) |
| | | public int GetRowCount(string sqlString) |
| | | { |
| | | try |
| | | { |
| | |
| | | var db = DataContext.Db; |
| | | //查询托盘是否有正在入库的任务 |
| | | var imTask = db.Queryable<LogTask>().First(m => m.PalletNo == palletNo && m.IsDel == "0" && m.Status == "1"); |
| | | |
| | | |
| | | return imTask; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | /// <param name="packNo"></param> |
| | | /// <param name="pNum">托盘包装数</param> |
| | | /// <param name="bNum">箱包装数</param> |
| | | public void GetPackQtyInfo(string packNo,ref int pNum,ref int bNum) |
| | | public void GetPackQtyInfo(string packNo, ref int pNum, ref int bNum) |
| | | { |
| | | try |
| | | { |
| | | var db = DataContext.Db; |
| | | var pack = db.Queryable<SysPackag>().First(m => m.PackagNo == packNo); |
| | | if (pack!= null) |
| | | if (pack != null) |
| | | { |
| | | if (pack.L5Num.HasValue) |
| | | { |
| | |
| | | break; |
| | | } |
| | | } |
| | | |
| | | return allotSet; |
| | | |
| | | |
| | | return allotSet; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 根据小数位数值转换展示值 |
| | | /// </summary> |
| | |
| | | } |
| | | decimal s = (decimal)val; |
| | | string r = "0"; |
| | | double data ; |
| | | double data; |
| | | //decimal data2 = 0.00M; |
| | | switch (digit) |
| | | { |
| | | case 1: |
| | | case 1: |
| | | r = s.ToString("0.0"); |
| | | data = Math.Round(double.Parse(r), 1); |
| | | break; |
| | |
| | | /// </summary> |
| | | [Description("移库单")] |
| | | PM, |
| | | |
| | | |
| | | /// <summary> |
| | | /// 任务 |
| | | /// </summary> |