hwh
2024-07-09 23ffc2ee97c99eb6a7305b7c61e660d0d0d84b89
获取储位号
4个文件已修改
117 ■■■■ 已修改文件
HTML/views/BaseSetting/Materials.html 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
HTML/views/SOSetting/ExportNotice.html 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.DAL/Common.cs 92 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Wms/WMS.Entity/Context/DataContext.cs 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
HTML/views/BaseSetting/Materials.html
@@ -245,7 +245,7 @@
                    
                    var url  = "/Basis/GetMateList?SkuNo="+SkuNo+"&&SkuName="+SkuName+"&&AuditStatusNo="+AuditStatusNo+"&&Type="+Type+"&&IsControlled="+IsControlled+"&&IsInspect="+IsInspect+"&&Environment="+Environment+"&CategoryNo="+CategoryNo;
                    sendData(IP + url, {}, 'get', function(res) {
                        if (res.code == 0) //成功
                        if (res.code == 200) //成功
                        {
                            var list = res.data;
                            $.extend(infoOptions, {
HTML/views/SOSetting/ExportNotice.html
@@ -1033,8 +1033,8 @@
                    $(".editDemoClass").hide();//备注
                    $(".checkClass").hide(); //复核
                });
                sendData(IP + "/Basis/", {}, 'get', function (res) {
                    if (res.code == 0) { //成功
                sendData(IP + "/Basis/GetRoleRightList", {}, 'get', function (res) {
                    if (res.code == 200) { //成功
                        for (var k = 0; k < res.data.length; k++) {
                            if (res.data[k].ParentNo == "2100") {
                                if (res.data[k].MenuName == "添加出库单") {
Wms/WMS.DAL/Common.cs
@@ -5,7 +5,10 @@
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;
@@ -33,15 +36,16 @@
            {
                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}的里面储位信息");
@@ -66,15 +70,17 @@
            {
                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}的里面储位信息");
@@ -107,9 +113,22 @@
            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>();
@@ -120,8 +139,9 @@
                    // 判断目标库位的外库位是否存在货物   (正常情况下正在移入情况不存在,因为移库先移入里面,后移入外面)
                    //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;
@@ -136,11 +156,23 @@
            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;
@@ -225,7 +257,7 @@
                    orderNo = list.Select(a => a.ASNNo).Max();
                }
                else if (codeFlag == InOutFlag.PM.ToString())//移库
                {
                {
                }
                else if (codeFlag == InOutFlag.CR.ToString())//盘点
                {
@@ -235,7 +267,7 @@
                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())//异常
                {
@@ -261,7 +293,7 @@
        /// </summary>
        /// <param name="sqlString">查询语句</param>
        /// <returns>行数</returns>
        public int GetRowCount(string sqlString)
        public int GetRowCount(string sqlString)
        {
            try
            {
@@ -288,7 +320,7 @@
                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)
@@ -303,13 +335,13 @@
        /// <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)
                    {
@@ -379,16 +411,16 @@
                            break;
                    }
                }
                return allotSet;
                return allotSet;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }
        /// <summary>
        /// 根据小数位数值转换展示值
        /// </summary>
@@ -405,11 +437,11 @@
                }
                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;
@@ -473,7 +505,7 @@
        /// </summary>
        [Description("移库单")]
        PM,
        /// <summary>
        /// 任务
        /// </summary>
Wms/WMS.Entity/Context/DataContext.cs
@@ -16,6 +16,25 @@
            DbType = DbType.SqlServer, //数据库类型
            IsAutoCloseConnection = true, //自动释放
            InitKeyType = InitKeyType.Attribute //根据实体类取发现主键
        }, db => {
            //(A)全局生效配置点,一般AOP和程序启动的配置扔这里面 ,所有上下文生效
            //调试SQL事件,可以删掉
            db.Aop.OnLogExecuting = (sql, pars) =>
            {
                //获取原生SQL推荐 5.1.4.63  性能OK
                //Console.WriteLine(UtilMethods.GetNativeSql(sql, pars));
                //获取无参数化SQL 对性能有影响,特别大的SQL参数多的,调试使用
                //Console.WriteLine(UtilMethods.GetSqlString(DbType.SqlServer, sql, pars));
            };
            //多个配置就写下面
            //db.Ado.IsDisableMasterSlaveSeparation=true;
            //注意多租户 有几个设置几个
            //db.GetConnection(i).Aop
        });
        public DataContext()