| | |
| | | <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>搜索 |
| | | </button> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <button class="layui-btn layui-btn-sm layuiadmin-btn-list approvalBtn" data-type="add" id="approvalBtn"> |
| | | <i class="layui-icon layuiadmin-button-btn"></i>添加 |
| | | </button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="layui-card-body"> |
| | |
| | | form = layui.form, |
| | | laypage = layui.laypage, |
| | | layer = layui.layer; |
| | | // var $ = layui.$; |
| | | var $ = layui.$; |
| | | refreshTable("","","",""); |
| | | var tableIns; |
| | | |
| | |
| | | $(function() { |
| | | $(".editClass").hide(); |
| | | $(".onOffClass").hide(); |
| | | $("#approvalBtn").hide(); |
| | | }); |
| | | sendData(IP + "/Basis/GetRoleRightList", {}, 'get', function(res) { |
| | | if (res.code == 0) { //成功 |
| | |
| | | if (res.data[k].MenuName == "启停区域") { |
| | | $(function() { |
| | | $(".onOffClass").show(); |
| | | }); |
| | | } |
| | | if (res.data[k].MenuName == "添加区域") { |
| | | $(function() { |
| | | $("#approvalBtn").show(); |
| | | }); |
| | | } |
| | | } |
| | |
| | | |
| | | refreshTable(WareHouseNo,AreaName,Type,Status); |
| | | }); |
| | | |
| | | var doing = true; |
| | | active = { |
| | | //新增 |
| | | add: function() { |
| | | layer.open({ |
| | | type: 2, |
| | | title: '添加区域信息', |
| | | content: 'AreaAddFrom.html', |
| | | maxmin: true, |
| | | area: ['530px', '530px'], |
| | | btn: ['确定', '取消'], |
| | | yes: function(index, layero) { |
| | | var iframeWindow = window['layui-layer-iframe' + index], |
| | | submitID = 'layuiadmin-app-form-submit', |
| | | submit = layero.find('iframe').contents().find('#' + submitID); |
| | | //监听提交 |
| | | iframeWindow.layui.form.on('submit(' + submitID + ')', function(data) { |
| | | var field = data.field; //获取提交的字段 |
| | | console.log(field) |
| | | //提交 Ajax 成功后,静态更新表格中的数据 |
| | | var param = { |
| | | // AreaNo: field.AreaNo, //区域编码 |
| | | AreaName: field.AreaName, //区域名称 |
| | | WareHouseNo: field.WareHouseNo, //所属仓库 |
| | | Status: field.Status, //是否启用 0 |
| | | Priority: parseInt(field.Priority), //优先级 |
| | | Temperature: field.Temperature, //区域类别 |
| | | Type: field.Type, //存储类别 |
| | | }; |
| | | if(doing){ |
| | | doing = false; |
| | | sendData(IP + "/sys/InsertStorageArea", param, 'post',function(res) { |
| | | console.log(res); |
| | | if (res.code == 0) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | | }, function() { |
| | | layer.close(index); //关闭弹层 |
| | | // refreshTable($("#CategoryName").val(),$("#AreaNo").val()); |
| | | doing = true; |
| | | }); |
| | | } |
| | | else |
| | | { //不成功 |
| | | layer.msg(res.msg, { |
| | | icon: 2, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | | }, function() {doing = true;}); |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | submit.trigger('click'); |
| | | } |
| | | }); |
| | | } |
| | | }; |
| | | $('.layui-btn.layuiadmin-btn-list').on('click', function() { |
| | | var type = $(this).data('type'); |
| | | active[type] ? active[type].call(this) : ''; |
| | | }); |
| | | |
| | | table.on('tool(LAY-app-content-list)', function(obj) { |
| | | var data = obj.data; |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html> |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <title>区域维护管理</title> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"> |
| | | <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all"> |
| | | </head> |
| | | <body> |
| | | <div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;"> |
| | | <!-- <div class="layui-form-item"> |
| | | <label class="layui-form-label">区域编码</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="AreaNo" lay-verify="required" placeholder="请输入区域编码" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> --> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">区域名称</label> |
| | | <div class="layui-input-block"> |
| | | <input type="text" name="AreaName" lay-verify="required" placeholder="请输入区域名称" autocomplete="off" class="layui-input"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">所属仓库</label> |
| | | <div class="layui-input-block"> |
| | | <select name="WareHouseNo" id="WareHouseNo" lay-verify="" lay-search > |
| | | <option value=""></option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">是否启用</label> |
| | | <div class="layui-input-block"> |
| | | <select name="Status" id="Status" lay-verify="required"> |
| | | <option value="0" selected>启用</option> |
| | | <option value="1">禁用</option> |
| | | </select> |
| | | </div> |
| | | |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">优先级</label> |
| | | <div class="layui-input-block"> |
| | | <select name="Priority" id="Priority" lay-verify="required"> |
| | | <option value="1">1</option> |
| | | <option value="2">2</option> |
| | | <option value="3">3</option> |
| | | <option value="4">4</option> |
| | | </select> |
| | | </div> |
| | | |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">类别</label> |
| | | <div class="layui-input-block"> |
| | | <select name="Type" id="Type" lay-verify="required" lay-search lay-filter="SelectType"> |
| | | <option value=""></option> |
| | | <option value="1">成品区</option> |
| | | <option value="2">原料区</option> |
| | | <option value="3">包材区</option> |
| | | <option value="4">空托区</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">存储类别</label> |
| | | <div class="layui-input-block"> |
| | | <select name="Temperature" id="Temperature" lay-search> |
| | | <option value=""></option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item layui-hide"> |
| | | <input type="button" lay-submit lay-filter="layuiadmin-app-form-submit" id="layuiadmin-app-form-submit" value="确认添加"> |
| | | <input type="button" lay-submit lay-filter="layuiadmin-app-form-edit" id="layuiadmin-app-form-edit" value="确认编辑"> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | <script src="../../layuiadmin/layui/layui.js"></script> |
| | | <script src="../../js/public.js"></script> |
| | | <script src="../../js/jquery-3.5.1.min.js"></script> |
| | | <script src="../../js/jquery.cookie.js"></script> |
| | | <script> |
| | | layui.config({ |
| | | base: '../../layuiadmin/' //静态资源所在路径 |
| | | }).extend({ |
| | | index: 'lib/index' //主入口模块 |
| | | }).use(['index', 'form', 'layer'], function() { |
| | | var $ = layui.$, |
| | | form = layui.form, |
| | | layer = layui.layer; |
| | | |
| | | |
| | | |
| | | |
| | | //获取仓库 |
| | | sendData(IP + "/Sys/GetWarehouseDic", {}, 'get', function(res) { |
| | | if (res.code == 0) { //成功 |
| | | // $("#RoadwayNo").empty(); |
| | | for (var i = 0; i < res.data.length; i++) { |
| | | //判断是否为立体库 |
| | | if (res.data[i].WareHouseNo != "W02") |
| | | { |
| | | $("#WareHouseNo").append('<option value =' + res.data[i].WareHouseNo + '>' + res.data[i].WareHouseNo + '-' + |
| | | res.data[i].WareHouseName + '</option>'); |
| | | } |
| | | } |
| | | // $("select[name='WareHouseNo']").val(val); |
| | | form.render('select'); |
| | | } else { //不成功 |
| | | layer.msg(res.msg, { |
| | | icon: 2, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | | }, function() {}); |
| | | } |
| | | }); |
| | | //获取存储环境 |
| | | form.on('select(SelectType)', function (data) { |
| | | console.log(12) |
| | | sendData(IP + "/Sys/GetDictionaryByParentNo?parentNo="+"Temperature", {}, 'get', function(res) { |
| | | if (res.code == 0) { //成功 |
| | | $("#Temperature").empty();//清空上一个查询下拉值 |
| | | for (var i = 0; i < res.data.length; i++) { |
| | | $("#Temperature").append('<option value =' + res.data[i].Id + '>' + |
| | | res.data[i].DictName + '</option>'); |
| | | } |
| | | |
| | | // $("select[name='Temperature']").val(temp); |
| | | |
| | | form.render('select'); |
| | | } else { //不成功 |
| | | layer.msg(res.msg, { |
| | | icon: 2, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | | }, function() {}); |
| | | } |
| | | }); |
| | | }); |
| | | |
| | | |
| | | //获取浏览器参数 |
| | | function getQueryString(name) { |
| | | var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i"); |
| | | var r = window.location.search.substr(1).match(reg); |
| | | if (r != null) return unescape(r[2]); |
| | | return null; |
| | | } |
| | | }) |
| | | </script> |
| | | |
| | | </body> |
| | | </html> |
| | |
| | | if (checkData.length === 0) { |
| | | return layer.msg('请选择数据'); |
| | | } |
| | | else if(checkData.length > 1) |
| | | { |
| | | var li = 0; |
| | | var ping = 0; |
| | | var WareNo = "W01"; |
| | | checkData.forEach(item => { |
| | | if (item.WareHouseName == "力诺立体库") |
| | | { |
| | | li += 1; |
| | | WareNo = "W01"; |
| | | if (ping > 0) |
| | | { |
| | | return; |
| | | } |
| | | } |
| | | if (item.WareHouseName == "力诺平库") |
| | | { |
| | | ping += 1; |
| | | WareNo = "W02"; |
| | | if (li > 0) |
| | | { |
| | | return; |
| | | } |
| | | } |
| | | }); |
| | | if (li != 0 && ping != 0) |
| | | { |
| | | return layer.msg('请勿选择多种仓库!'); |
| | | } |
| | | } |
| | | |
| | | layer.open({ |
| | | type: 2, |
| | | title: '编辑储位状态集合', |
| | | content: 'LocateFrom.html', |
| | | content: 'LocateFrom.html?WareHouseNo='+WareNo, |
| | | maxmin: true, |
| | | area: ['560px', '510px'], |
| | | btn: ['确定', '取消'], |
| | |
| | | $("#AreaNo").append('<option value =""></option>'); |
| | | if (res.code == 0) { //成功 |
| | | for (var i = 0; i < res.data.length; i++) { |
| | | $("#AreaNo").append('<option value =' + res.data[i].AreaNo + '>' + res.data[i].WareHouseNo + '-' + |
| | | $("#AreaNo").append('<option value =' + res.data[i].AreaNo + '>' + res.data[i].AreaNo + '-' + |
| | | res.data[i].AreaName + '</option>'); |
| | | } |
| | | form.render('select'); |
| | |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">所属区域</label> |
| | | <div class="layui-input-inline"> |
| | | <select name="AreaNo" id="AreaNo" lay-filter="getAreaNo" lay-search disabled=""> |
| | | <select name="AreaNo" id="AreaNo" lay-filter="getAreaNo" lay-search> |
| | | <option value=""></option> |
| | | </select> |
| | | </div> |
| | |
| | | layer = layui.layer; |
| | | |
| | | var id = getQueryString('id'); |
| | | var no = getQueryString('WareHouseNo'); |
| | | var param = { |
| | | Id: parseInt(id) |
| | | } |
| | | console.log(no) |
| | | if(no != null) |
| | | { |
| | | GetArea('',no) |
| | | } |
| | | if(getQueryString('id') != null) |
| | | { |
| | |
| | | if (res.code == 0) { |
| | | // $("input[name=Id]").val(res.data.Id); |
| | | GetHouse(res.data.WareHouseNo) |
| | | GetArea(res.data.AreaNo) |
| | | GetArea(res.data.AreaNo,res.data.WareHouseNo) |
| | | GetRoadway(res.data.RoadwayNo) |
| | | GetTemp(res.data.Temperature); |
| | | $("input[name=Row]").val(res.data.Row); |
| | |
| | | }); |
| | | } |
| | | //获取区域 |
| | | function GetArea(val){ |
| | | sendData(IP + "/Sys/GetStorageAreaByHouseNo?wareHouseNo=", {}, 'get', function(res) { |
| | | |
| | | function GetArea(val,wareHouse){ |
| | | var a = $("#WareHouseNo").val(); |
| | | if (wareHouse != null) |
| | | { |
| | | a = wareHouse; |
| | | } |
| | | sendData(IP + "/Sys/GetStorageAreaByHouseNo?wareHouseNo="+a, {}, 'get', function(res) { |
| | | console.log(res) |
| | | if (res.code == 0) { //成功 |
| | | $("#AreaNo").empty(); |
| | | for (var i = 0; i < res.data.length; i++) { |
| | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Linq.Expressions; |
| | | using System.Security.Permissions; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using Dm; |
| | | using Model.ModelDto.SysDto; |
| | | using SqlSugar; |
| | | using WMS.DAL; |
| | | using WMS.Entity.Context; |
| | | using WMS.Entity.SysEntity; |
| | | using WMS.IBLL.ISysServer; |
| | | using WMS.IDAL.ISysInterface; |
| | | |
| | | namespace WMS.BLL.SysServer |
| | | { |
| | | public class StorageAreaServer: IStorageAreaServer |
| | | public class StorageAreaServer : DbHelper<SysStorageArea>, IStorageAreaServer |
| | | { |
| | | private static readonly SqlSugarScope Db = DataContext.Db; |
| | | public IStorageAreaRepository AreaRst { get; set; } |
| | | public StorageAreaServer(IStorageAreaRepository areaRst) |
| | | public StorageAreaServer(IStorageAreaRepository areaRst) : base(Db) |
| | | { |
| | | AreaRst = areaRst; |
| | | } |
| | |
| | | /// <param name="limit"></param> |
| | | /// <param name="count"></param> |
| | | /// <returns></returns> |
| | | public List<AreaDto> GetStorageAreaList(string areaName, string wareHouseNo, string status, string type,int page, int limit,out int count) |
| | | public List<AreaDto> GetStorageAreaList(string areaName, string wareHouseNo, string status, string type, int page, int limit, out int count) |
| | | { |
| | | try |
| | | { |
| | |
| | | .AndIF(!string.IsNullOrWhiteSpace(type), it => it.Type == type) |
| | | .ToExpression();//注意 这一句 不能少 |
| | | |
| | | |
| | | |
| | | var data = AreaRst.GetAllByOrderPageAsync(item, limit, page, out int counts) |
| | | .Includes(x => x.WareHouseInfo) |
| | | .Includes(x => x.TemperatureInfo) |
| | |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取单条库区域信息 |
| | | /// </summary> |
| | | /// <param name="id">ID</param> |
| | | /// <returns></returns> |
| | | public SysStorageArea GetStorageMaxArea() |
| | | { |
| | | try |
| | | { |
| | | var data = Db.Queryable<SysStorageArea>().Where(a => a.IsDel == "0" && a.WareHouseNo == "W01").OrderByDescending(a => a.CreateTime).First(); |
| | | return data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取区域信息(根据仓库号) |
| | | /// </summary> |
| | |
| | | if (!string.IsNullOrWhiteSpace(wareHouseNo)) |
| | | { |
| | | data = data.Where(m => m.WareHouseNo == wareHouseNo).ToList(); |
| | | } |
| | | } |
| | | return data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 修改库区域信息 |
| | | /// </summary> |
| | | /// <param name="model">区域实体</param> |
| | | /// <returns>是否成功</returns> |
| | | public string InsertStorageArea(SysStorageArea model) |
| | | { |
| | | try |
| | | { |
| | | string str = ""; |
| | | //判断所属仓库是否为立体库 |
| | | if (model.WareHouseNo != "W01") |
| | | { |
| | | str = "-1:所属仓库不为立体库,请重新选择!"; |
| | | return str; |
| | | } |
| | | //获取立体库最大编码 |
| | | //var area = Db.Queryable<SysStorageArea>().Max(a => a.Id)(a => a.IsDel == "0" && a.WareHouseNo == "W01"); |
| | | var area = Db.Queryable<SysStorageArea>().Where(a => a.IsDel == "0" && a.WareHouseNo == "W01").OrderByDescending(a=>a.CreateTime).First(); |
| | | //验证是否存在立体库第一条区域信息 |
| | | if (area == null) |
| | | { |
| | | model.AreaNo = "A01"; |
| | | } |
| | | else |
| | | { |
| | | var arr = area.AreaNo.Split("A"); |
| | | int a = int.Parse(arr[1]) + 1; |
| | | //判断是否小于10 |
| | | if (a < 10) |
| | | { |
| | | model.AreaNo = "A0" + (int.Parse(arr[1]) + 1).ToString(); |
| | | } |
| | | else |
| | | { |
| | | model.AreaNo = "A" + (int.Parse(arr[1]) + 1).ToString(); |
| | | } |
| | | |
| | | } |
| | | Db.BeginTran(); |
| | | |
| | | //新增区域信息 |
| | | SysStorageArea list = new SysStorageArea() |
| | | { |
| | | AreaNo = model.AreaNo, //区域编码 |
| | | AreaName = model.AreaName, //区域名称 |
| | | WareHouseNo = model.WareHouseNo, //所属仓库 |
| | | RoadwayNo = null, //所属巷道 |
| | | Status = model.Status, //是否启用 |
| | | Priority = model.Priority, //优先级 |
| | | Type = model.Type, //存储类别 |
| | | Temperature = model.Temperature, //存储环境 |
| | | IsDel = "0", //是否删除 |
| | | CreateUser = model.CreateUser, //创建人 |
| | | CreateTime = Db.GetDate(), //创建时间 |
| | | UpdateUser = null, //修改人 |
| | | UpdateTime = null, //修改时间 |
| | | }; |
| | | Db.Insertable(list).ExecuteCommand(); |
| | | |
| | | Db.CommitTran(); |
| | | |
| | | str = "添加成功"; |
| | | return str; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | Db.RollbackTran(); |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | |
| | | /// <param name="status">状态 0 启用 1停用</param> |
| | | /// <param name="userId">操作人ID</param> |
| | | /// <returns></returns> |
| | | public bool EditStorageAreaStatus(int id,string status,int userId) |
| | | public bool EditStorageAreaStatus(int id, string status, int userId) |
| | | { |
| | | try |
| | | { |
| | |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取区域类型 |
| | |
| | | /// <param name="count"></param> |
| | | /// <returns></returns> |
| | | List<AreaDto> GetStorageAreaList(string areaName, string wareHouseNo,string status, string type, int page, int limit,out int count); |
| | | |
| | | /// <summary> |
| | | /// 获取单条库区域信息 |
| | | /// </summary> |
| | |
| | | SysStorageArea GetStorageArea(int id); |
| | | |
| | | /// <summary> |
| | | /// 获取单条库区域信息 |
| | | /// </summary> |
| | | /// <param name="id">ID</param> |
| | | /// <returns></returns> |
| | | SysStorageArea GetStorageMaxArea(); |
| | | |
| | | /// <summary> |
| | | /// 获取区域信息(根据仓库号) |
| | | /// </summary> |
| | | /// <param name="wareHouseNo">仓库号</param> |
| | | /// <returns></returns> |
| | | List<SysStorageArea> GetStorageAreaByHouseNo(string wareHouseNo); |
| | | |
| | | |
| | | /// <summary> |
| | | /// 添加库区域信息 |
| | | /// </summary> |
| | | /// <param name="model">区域实体</param> |
| | | /// <returns>是否成功</returns> |
| | | string InsertStorageArea(SysStorageArea model); |
| | | |
| | | /// <summary> |
| | | /// 修改库区域信息 |
| | | /// </summary> |
| | |
| | | /// <param name="userId">操作人</param> |
| | | /// <returns>是否成功</returns> |
| | | bool EditStorageArea(int id,string name, int priority, string type, string temp, int userId); |
| | | |
| | | /// <summary> |
| | | /// 修改区域状态 |
| | | /// </summary> |
| | |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 添加区域信息 |
| | | /// </summary> |
| | | /// <param name="model">模型</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult InsertStorageArea(SysStorageArea model) |
| | | { |
| | | try |
| | | { |
| | | //获取当前登录的用户ID |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | if (claimsIdentity == null) |
| | | { |
| | | return Ok(new { code = 1, msg = "为获取到当前操作人信息" }); |
| | | } |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | if (string.IsNullOrWhiteSpace(userId)) |
| | | { |
| | | return Ok(new { code = 1, msg = "为获取到当前操作人信息" }); |
| | | } |
| | | model.CreateUser = int.Parse(userId); |
| | | string bolls = _areaSvc.InsertStorageArea(model); |
| | | var arr = bolls.Split(":"); |
| | | if (arr[0] != "-1" ) |
| | | { |
| | | SysStorageArea area = _areaSvc.GetStorageMaxArea(); |
| | | _operation.InsertOperation("仓库设置", "区域管理", area.AreaNo, "添加", "添加区域信息 区域号:" + area.AreaNo, Convert.ToInt32(userId)); |
| | | return Ok(new { code = 0, msg = bolls, data = "" }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = bolls, data = "" }); |
| | | } |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 修改区域信息 |
| | | /// </summary> |