Merge branch 'hwh' into Liudl
| | |
| | | { |
| | | sendData(IP + "/Basis/GetFunSettingByNo?funSetNo="+"Fun013", {}, 'get', function (res) { |
| | | console.log(res.data.SetValue) |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | if(res.data.IsEnable == 'NO') |
| | | { |
| | | pageCnt = parseInt(res.data.SetValue); |
| | |
| | | if (!$.cookie('token')) { |
| | | callbackFun("登录人信息已失效"); |
| | | } |
| | | if(isExpired = isTokenExpired($.cookie('token'))){ |
| | | try{ |
| | | parent.window.location.href = '/views/Login.html'; |
| | | } |
| | | catch(error){ |
| | | window.location.href = '/views/Login.html'; |
| | | } |
| | | return; |
| | | } |
| | | } |
| | | $.ajax({ |
| | | url: url, |
| | |
| | | callbackFun(res); |
| | | }, |
| | | error: function (res, status, error) { |
| | | // console.log(res); |
| | | // console.log(status); |
| | | callbackFun(res.responseJSON, status, error); |
| | | // layer.msg(res.statusText, { |
| | | // icon: 2, |
| | |
| | | // }, function() {}); |
| | | }, |
| | | }); |
| | | } |
| | | function isTokenExpired(token) { |
| | | const tokenParts = token.split('.'); |
| | | if (tokenParts.length !== 3) { |
| | | return true; // JWT 格式不正确 |
| | | } |
| | | const payloadBase64 = tokenParts[1]; |
| | | const payload = JSON.parse(atob(payloadBase64)); |
| | | |
| | | if (!payload || !payload.exp) { |
| | | return true; // 没有有效载荷或者没有过期时间 |
| | | } |
| | | |
| | | const now = Date.now() / 1000; // 当前时间戳(秒) |
| | | const expiration = payload.exp; |
| | | |
| | | return now >= expiration; |
| | | } |
| | | function synData(url, data, type, callbackFun) { |
| | | var deferred = $.Deferred(); |
| | |
| | | function GetIsSetColW() |
| | | { |
| | | sendData(IP + "/Basis/GetFunSettingByNo?funSetNo="+"Fun014", {}, 'get', function (res) { |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | if(res.data.IsEnable == 'NO') |
| | | { |
| | | isSetColW=true; |
| | |
| | | $(".shenqingClass").hide(); //申请储位 |
| | | }); |
| | | sendData(IP + "/Basis/GetFunSettingByNo?funSetNo="+"Fun012", {}, 'get', function (res) { |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | if(res.data.IsEnable == 'NO') |
| | | { |
| | | $(function () { |
| | |
| | | 0、2、4、6 |
| | | */ |
| | | sendData(IP + "/Basis/GetCustomerSelect", {}, 'get', function (res) { |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | $("#CustomerName").empty(); |
| | | $("#CustomerName").append('<option value =""></option>'); |
| | | |
| | |
| | | 0、2、4、6 |
| | | */ |
| | | sendData(IP + "/Basis/GetCustomerSelect", {}, 'get', function (res) { |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | $("#CustomerName").empty(); |
| | | $("#CustomerName").append('<option value =""></option>'); |
| | | |
| | |
| | | // refreshTablemx(xqid); |
| | | //获取承运商物流 |
| | | sendData(IP + "/Basis/GetLogisticsInfoSelect", {}, 'get', function (res) { |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | $("#LogisticsId").empty(); |
| | | $("#LogisticsId").append('<option value =""></option>'); |
| | | for (var i = 0; i < res.data.length; i++) { |
| | |
| | | bindTable(); |
| | | //获取承运商物流 |
| | | sendData(IP + "/Basis/GetLogisticsInfoSelect", {}, 'get', function (res) { |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | $("#LogisticsId").empty(); |
| | | $("#LogisticsId").append('<option value =""></option>'); |
| | | for (var i = 0; i < res.data.length; i++) { |
| | |
| | | height: 'full-95', |
| | | id: 'LAY-app-content-list', |
| | | where: param, |
| | | parseData: FnParseData, |
| | | contentType: 'application/json', |
| | | headers:{ToKen:$.cookie('token')}, |
| | | page: true, |
| | |
| | | }; |
| | | sendData(IP + "/Basis/DelsCustomer", param, 'post', function (res) { |
| | | console.log(res); |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | sendData(IP + "/Basis/AddCustomer", param, 'post', |
| | | function (res) { |
| | | console.log(res); |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | }; |
| | | sendData(IP + "/Basis/DelCustomer", param, 'post', function (res) { |
| | | console.log(res); |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 1000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | sendData(IP + "/Basis/EditCustomer", param, 'post', |
| | | function (res) { |
| | | console.log(res); |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 1000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | Id: parseInt(id), |
| | | }; |
| | | sendData(IP + "/Basis/GetCustomer", param, 'post', function(res) { |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | //页面赋值 |
| | | $("input[name='CustomerNo']").val(res.data.CustomerNo); |
| | | $("input[name='CustomerNo']").attr('disabled', 'true'); |
| | |
| | | |
| | | sendData(IP + "/Basis/GetDepartmentList?DepartmentName=" + DepartmentName + "&&DepartmentNo=" + DepartmentNo, {}, "get", function (res) { |
| | | console.log(res.data); |
| | | if (res.code == 0) |
| | | if (res.code == 200) |
| | | { |
| | | //成功 |
| | | var list = res.data; |
| | |
| | | Demo: field.Demo, |
| | | }; |
| | | sendData( IP + "/Basis/AddDepartment", param, "post", function (res) { |
| | | if (res.code == 0) //成功 |
| | | if (res.code == 200) //成功 |
| | | { |
| | | layer.msg( |
| | | res.msg, |
| | |
| | | msg: cusid, |
| | | }; |
| | | sendData( IP + "/Basis/DelDepartment?Id="+cusid+"",{},"get",function (res) { |
| | | if (res.code == 0) //成功 |
| | | if (res.code == 200) //成功 |
| | | { |
| | | layer.msg( |
| | | res.msg, |
| | |
| | | Demo: field.Demo, |
| | | }; |
| | | sendData( IP + "/Basis/ExitDepartment", param, "post", function (res) { |
| | | if (res.code == 0) //成功 |
| | | if (res.code == 200) //成功 |
| | | { |
| | | layer.msg("修改成功", |
| | | { |
| | |
| | | }; |
| | | sendData(IP + "/Basis/GetDepartmentById?Id="+param.id+"", {}, 'get', function(res) { |
| | | console.log(res); |
| | | if (res.code == 0) //成功 |
| | | if (res.code == 200) //成功 |
| | | { |
| | | //部门号编辑不显示 |
| | | if(res.data.DepartmentNo != "") |
| | |
| | | height: h1, |
| | | id: 'LAY-app-content-list', |
| | | where: param, |
| | | parseData: FnParseData, |
| | | contentType: 'application/json', |
| | | headers:{ToKen:$.cookie('token')}, |
| | | // toolbar:'#toolbarDemo', |
| | |
| | | |
| | | sendData(IP + "/Basis/DelsLogisticsInfo", param, 'post', function (res) { |
| | | console.log(res); |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | }; |
| | | sendData(IP + "/Basis/AddLogisticsInfo", param, 'post', function (res) { |
| | | console.log(res); |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | }; |
| | | sendData(IP + "/Basis/DelLogisticsInfo", param, 'post', function (res) { |
| | | console.log(res); |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 1000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | sendData(IP + "/Basis/EditLogisticsInfo", param, 'post', |
| | | function (res) { |
| | | console.log(res); |
| | | if(res.code == 0) { //成功 |
| | | if(res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | Id: parseInt(id), |
| | | }; |
| | | sendData(IP + "/Basis/GetLogisticsInfo", param, 'post', function (res) { |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | //页面赋值 |
| | | $("input[name='CarrierName']").val(res.data.CarrierName); |
| | | $("input[name='Address']").val(res.data.Address); |
| | |
| | | |
| | | 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, { |
| | |
| | | doing = false; |
| | | sendData(IP + "/Basis/AddMate", param, 'post',function(res) { |
| | | console.log(res); |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | doing = false; |
| | | sendData(IP + "/Basis/DelMate?Id="+data.Id+"", {} , 'get', function(res) { |
| | | console.log(res); |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | doing = false; |
| | | sendData(IP + "/Basis/ExitMate", param, 'post', |
| | | function(res) { |
| | | if (res.code == 0) //成功 |
| | | if (res.code == 200) //成功 |
| | | { |
| | | layer.msg("修改成功", { |
| | | icon: 1, |
| | |
| | | var sel1 = false; |
| | | //获取单位下拉菜单 UnitNo |
| | | synData(IP + "/Basis/GetUnitList", {}, 'get', function (res) { |
| | | if (res.code == 0) //成功 |
| | | if (res.code == 200) //成功 |
| | | { |
| | | for (var i = 0; i < res.data.length; i++) { |
| | | $("#UnitNo").append('<option value =' + res.data[i].UnitNo + '>' + res.data[i].UnitName + '</option>'); |
| | |
| | | var sel2 = false; |
| | | //获取包装下拉菜单 PackagNo |
| | | synData(IP + "/Basis/GetPackagList", {}, 'get', function (res) { |
| | | if (res.code == 0) //成功 |
| | | if (res.code == 200) //成功 |
| | | { |
| | | for (var i = 0; i < res.data.length; i++) { |
| | | $("#PackagNo").append('<option value =' + res.data[i].PackagNo + '>' + res.data[i].PackagName + '</option>'); |
| | |
| | | UserId: id, |
| | | }; |
| | | synData(IP + "/Basis/GetMateById?Id= " + getQueryString('id') + "", {}, 'get', function (res) { |
| | | if (res.code == 0) //成功 |
| | | if (res.code == 200) //成功 |
| | | { |
| | | // console.log(res.data.CategoryNo) |
| | | //审批状态编辑显示 |
| | |
| | | url: url, |
| | | method: 'post', |
| | | where: where, |
| | | parseData: FnParseData, |
| | | contentType: 'application/json', |
| | | headers:{ToKen:$.cookie('token')}, |
| | | page: true, |
| | |
| | | doing = false; |
| | | sendData(IP + "/Basis/GetPackagList", param, 'post', function (res) { |
| | | console.log(res); |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | |
| | | sendData(IP + "/Basis/AddPackag", param, 'post', |
| | | function (res) { |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | if (doing) { |
| | | doing = false; |
| | | sendData(IP + "/Basis/DelPackag", param, 'post', function (res) { |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 1000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | sendData(IP + "/Basis/EditPackag", param, 'post', |
| | | function (res) { |
| | | console.log(res); |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg("修改成功", { |
| | | icon: 1, |
| | | time: 1000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | sendData(IP + "/Basis/GetPackagById?Id="+id, param, 'get', function(res) { |
| | | console.log(res); |
| | | //console.log(res.data.IsValid == 0); |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | //包装编码 |
| | | if (res.data.SkuNo != "") { |
| | | $("input[name='PackCode']").attr("disabled", "disabled") |
| | |
| | | url: url, |
| | | method: 'post', |
| | | where: where, |
| | | parseData: FnParseData, |
| | | contentType: 'application/json', |
| | | headers:{ToKen:$.cookie('token')}, |
| | | page: true, |
| | |
| | | doing = false; |
| | | synData(IP + "/Basis/DelsUnit", param, 'post', function (res) { |
| | | console.log(res); |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | sendData(IP + "/Basis/AddUnit", param, 'post', |
| | | function (res) { |
| | | console.log(res); |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | doing = false; |
| | | sendData(IP + "/Basis/DelUnit", param, 'post', function (res) { |
| | | console.log(res); |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | sendData(IP + "/Basis/EditUnit", param, 'post', |
| | | function (res) { |
| | | console.log(res); |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg("修改成功", { |
| | | icon: 1, |
| | | time: 1000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | }; |
| | | sendData(IP + "/Basis/GetUnit", param, 'post', function(res) { |
| | | console.log(res); |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | //页面赋值 |
| | | $("input[name='UnitNo']").val(res.data.UnitNo); |
| | | $("input[name='UnitName']").val(res.data.UnitName); |
| | |
| | | doing = false; |
| | | sendData(IP + "/Basis/AddMate", param, 'post',function(res) { |
| | | console.log(res); |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | |
| | | //获取单位下拉菜单 UnitNo |
| | | sendData(IP + "/Basis/GetUnitList",{},'get',function(res){ |
| | | if(res.code == 0) //成功 |
| | | if(res.code == 200) //成功 |
| | | { |
| | | for (var i = 0; i < res.data.length; i++) |
| | | { |
| | |
| | | |
| | | //获取包装下拉菜单 PackagNo |
| | | sendData(IP + "/Basis/GetPackagList",{},'get',function(res){ |
| | | if(res.code == 0) //成功 |
| | | if(res.code == 200) //成功 |
| | | { |
| | | for (var i = 0; i < res.data.length; i++) |
| | | { |
| | |
| | | UserId: id, |
| | | }; |
| | | sendData(IP + "/Basis/GetMateById?Id= " +getQueryString('id')+ "", {}, 'get', function(res) { |
| | | if (res.code == 0) //成功 |
| | | if (res.code == 200) //成功 |
| | | { |
| | | //审批状态编辑显示 |
| | | if(res.data.AuditStatusNo != "") |
| | |
| | | // refreshTablemx(xqid); |
| | | //获取承运商物流 |
| | | sendData(IP + "/Basis/GetLogisticsInfoSelect", {}, 'get', function (res) { |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | $("#LogisticsId").empty(); |
| | | $("#LogisticsId").append('<option value =""></option>'); |
| | | for (var i = 0; i < res.data.length; i++) { |
| | |
| | | $(".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 == "添加出库单") { |
| | |
| | | //获取客户下拉框信息 |
| | | function getCustomerList() { |
| | | sendData(IP + "/Basis/GetCustomerSelect", {}, 'get', function(res) { |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | $("#CustomerNo").empty(); |
| | | $("#CustomerNo").append('<option value =""></option>'); |
| | | for (var i = 0; i < res.data.length; i++) { |
| | |
| | | //获取物流承运商下拉框信息 |
| | | function getLogisticsInfoList() { |
| | | sendData(IP + "/Basis/GetLogisticsInfoSelect", {}, 'get', function(res) { |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | $("#LogisticsId").empty(); |
| | | $("#LogisticsId").append('<option value =""></option>'); |
| | | for (var i = 0; i < res.data.length; i++) { |
| | |
| | | //获取客户下拉框信息 |
| | | function getCustomerList(customerNo) { |
| | | sendData(IP + "/Basis/GetCustomerSelect", {}, 'get', function(res) { |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | var TypeNum = 0; |
| | | |
| | | switch($("#Type").val()) |
| | |
| | | //获取物流承运商下拉框信息 |
| | | function getLogisticsInfoList(logisticsId) { |
| | | sendData(IP + "/Basis/GetLogisticsInfoSelect", {}, 'get', function(res) { |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | $("#LogisticsId").empty(); |
| | | $("#LogisticsId").append('<option value =""></option>'); |
| | | for (var i = 0; i < res.data.length; i++) { |
| | |
| | | bindTable(); |
| | | //获取承运商物流 |
| | | sendData(IP + "/Basis/GetLogisticsInfoSelect", {}, 'get', function(res) { |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | $("#LogisticsId").empty(); |
| | | $("#LogisticsId").append('<option value =""></option>'); |
| | | for (var i = 0; i < res.data.length; i++) { |
| | |
| | | |
| | | //获取承运商物流 |
| | | sendData(IP + "/Basis/GetLogisticsInfoSelect", {}, 'get', function(res) { |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | $("#LogisticsId").empty(); |
| | | $("#LogisticsId").append('<option value =""></option>'); |
| | | for (var i = 0; i < res.data.length; i++) { |
| | |
| | | GroupNo: GroupNo |
| | | }; |
| | | sendData(IP + "/Basis/GetFunSettingList?FunSetName="+FunSetName+"&&IsEnable="+IsEnable+"&&GroupNo="+GroupNo, {}, 'get', function(res) { |
| | | if (res.code == 0) |
| | | if (res.code == 200) |
| | | { //成功 |
| | | var list = res.data; |
| | | $.extend(infoOptions, { |
| | |
| | | doing = false; |
| | | sendData(IP + "/basis/AddFunSettings", param, 'post',function(res) { |
| | | console.log(res); |
| | | if (res.code == 0) |
| | | if (res.code == 200) |
| | | { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | |
| | | doing = false; |
| | | sendData(IP + "/Basis/DelFunSettings?Id="+data.Id+"", {} , 'get', function(res) { |
| | | console.log(res); |
| | | if (res.code == 0) |
| | | if (res.code == 200) |
| | | { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | |
| | | doing = false; |
| | | sendData(IP + "/basis/ExitFunSettings", param, 'post', |
| | | function(res) { |
| | | if (res.code == 0) |
| | | if (res.code == 200) |
| | | { //成功 |
| | | layer.msg("修改成功", { |
| | | icon: 1, |
| | |
| | | UserId: id, |
| | | }; |
| | | sendData(IP + "/basis/GetFunSettingById?Id= " +getQueryString('id')+ "", {}, 'get', function(res) { |
| | | if (res.code == 0) |
| | | if (res.code == 200) |
| | | { //成功 |
| | | //页面赋值 |
| | | if(res.data.FunSetNo != "") |
| | |
| | | height: h1, |
| | | id: 'LAY-app-content-list', |
| | | where: param, |
| | | parseData: FnParseData, |
| | | contentType: 'application/json', |
| | | headers:{ToKen:$.cookie('token')}, |
| | | page: true, |
| | |
| | | height: h2, |
| | | id: 'LAY-app-content-list2', |
| | | where: param, |
| | | parseData: FnParseData, |
| | | contentType: 'application/json', |
| | | toolbar:'', |
| | | defaultToolbar: '', //'print', 'exports' |
| | |
| | | InterfaceNo:data.InterfaceNo, |
| | | }; |
| | | sendData(IP + "/Basis/DelInterface", param, 'post', function (res) { |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | InterfaceNo:data.InterfaceNo |
| | | }; |
| | | sendData(IP + "/Basis/DelInterfaceDetail", param, 'post', function (res) { |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | margin-left: -15px; |
| | | margin-right: -15px; |
| | | } |
| | | |
| | | .layui-table-mend{ |
| | | position: relative; |
| | | } |
| | |
| | | <div class="layui-card"> |
| | | <div class="layui-card-body"> |
| | | <div style="width: 100%;right: 0;"> |
| | | <table id="LAY-app-content-list" name="LAY-app-content-list" lay-filter="LAY-app-content-list"></table> |
| | | <table id="LAY-app-content-list" name="LAY-app-content-list" lay-filter="LAY-app-content-list"> |
| | | </table> |
| | | |
| | | <script type="text/html" id="templetIsNull"> |
| | | {{# function GetBtn(d){ |
| | |
| | | InterfaceNo: id |
| | | }; |
| | | sendData(IP + "/Basis/GetInterfaceList", param, 'post', function (res) { |
| | | if (res.code == 0) { |
| | | $("input[name='InterfaceNo']").val(res.data[0].InterfaceNo); |
| | | $("input[name='InterfaceName']").val(res.data[0].InterfaceName); |
| | | $("#Direction option[value = '" + res.data[0].Direction + "']").prop("selected", true); |
| | | $("#TransmissionMode option[value = '" + res.data[0].TransmissionMode + "']").prop("selected", true); |
| | | $("input[name='Remark']").val(res.data[0].Remark); |
| | | $("input[name='Url']").val(res.data[0].Url); |
| | | $("input[name='DataSources']").val(res.data[0].DataSources); |
| | | if (res.code == 200) { |
| | | var data = res.data.Items[0]; |
| | | $("input[name='InterfaceNo']").val(data.InterfaceNo); |
| | | $("input[name='InterfaceName']").val(data.InterfaceName); |
| | | $("#Direction option[value = '" + data.Direction + "']").prop("selected", true); |
| | | $("#TransmissionMode option[value = '" + data.TransmissionMode + "']").prop("selected", true); |
| | | $("input[name='Remark']").val(data.Remark); |
| | | $("input[name='Url']").val(data.Url); |
| | | $("input[name='DataSources']").val(data.DataSources); |
| | | |
| | | $("#InterfaceNo").attr("disabled", "disabled"); |
| | | |
| | |
| | | InterfaceNo:id |
| | | }; |
| | | sendData(IP + "/Basis/GetInterfaceDetailList", paramDetail, 'post', function (res) { |
| | | if (res.code == 0) { //成功 |
| | | var data = res.data; |
| | | if (res.code == 200) { //成功 |
| | | var data = res.data.Items; |
| | | //页面赋值 |
| | | $.extend(infoOptions, { |
| | | data: data |
| | |
| | | else{ |
| | | MapFieldNum=MapFieldNum+1; |
| | | } |
| | | if(menu==undefined) |
| | | { |
| | | if (menu == undefined) { |
| | | menu=[] |
| | | } |
| | | var newRow={InterfaceNo:InterfaceNo,MapField:'Field'+MapFieldNum,IsNull:'0'}; |
| | |
| | | if (id == null) { |
| | | // 添加 |
| | | sendData(IP + "/Basis/AddInterface", item2, 'post', function (res) { |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | else { |
| | | // 编辑 |
| | | sendData(IP + "/Basis/EditInterface", item2, 'post', function (res) { |
| | | if (res.code == 0) { //成功 |
| | | if (res.code == 200) { //成功 |
| | | layer.msg(res.msg, { |
| | | icon: 1, |
| | | time: 2000 //2秒关闭(如果不配置,默认是3秒) |
| | |
| | | if (!string.IsNullOrEmpty(token)) |
| | | { |
| | | var handler = new JwtSecurityTokenHandler(); |
| | | try |
| | | { |
| | | var jwtToken = handler.ReadJwtToken(token); |
| | | var claim = jwtToken.Payload.Claims.FirstOrDefault(s => s.Type == "LoginName"); |
| | | //foreach (var claim in jwtToken.Payload.Claims) |
| | |
| | | else |
| | | diagnosticContext.Set("_UserName", ""); |
| | | } |
| | | catch (Exception) |
| | | { |
| | | |
| | | } |
| | | } |
| | | //请求body |
| | | var requestContent = "{}"; |
| | | var method = httpContext.Request.Method.ToLower(); |
| | |
| | | } |
| | | |
| | | |
| | | public List<CustomerDto> GetCustomerList(string no,string name, int? type, string linkMan, string phone, int page, int limit, out int count) |
| | | public async Task<List<CustomerDto>> GetCustomerList(string no, string name, int? type, string linkMan, string phone, int page, int limit, RefAsync<int> count) |
| | | { |
| | | try |
| | | { |
| | |
| | | .AndIF(!string.IsNullOrWhiteSpace(phone), it => it.Phone.Contains(phone.Trim())) |
| | | .ToExpression();//注意 这一句 不能少 |
| | | |
| | | var data = CustomerRst.GetAllByOrderPageAsync(item, limit, page, out int counts) |
| | | var data = await CustomerRst.GetAllByOrderPage(item, limit, page, out int counts) |
| | | .Includes(x => x.CreateUserInfo) |
| | | .Includes(x => x.UpdateUserInfo) |
| | | .ToList(); |
| | | .ToListAsync(); |
| | | count = counts; |
| | | |
| | | return data.Select(m => new CustomerDto() |
| | |
| | | } |
| | | } |
| | | |
| | | public SysCustomer GetCustomer(int id) |
| | | public async Task<SysCustomer> GetCustomer(int id) |
| | | { |
| | | try |
| | | { |
| | | var data = CustomerRst.GetOneById(id); |
| | | var data = await CustomerRst.GetOneByIdAsync(id); |
| | | return data; |
| | | } |
| | | catch (Exception e) |
| | |
| | | } |
| | | } |
| | | |
| | | public List<SysCustomer> GetCustomerSelect() |
| | | public async Task<List<SysCustomer>> GetCustomerSelect() |
| | | { |
| | | try |
| | | { |
| | | var data = CustomerRst.GetAllAsync().ToList(); |
| | | var data = await CustomerRst.GetAllAsync(); |
| | | return data; |
| | | } |
| | | catch (Exception e) |
| | |
| | | } |
| | | } |
| | | |
| | | public bool AddCustomer(string no, string name, int type, string address, string linkMan, string phone, string bankAccount, string creditRating, string demo, int userId) |
| | | public async Task<bool> AddCustomer(string no, string name, int type, string address, string linkMan, string phone, string bankAccount, string creditRating, string demo, int userId) |
| | | { |
| | | try |
| | | { |
| | | //判断是否重复 |
| | | var customer = CustomerRst.GetAllWhereAsync(m => m.CustomerNo == no && m.IsDel == "0").First(); |
| | | var customer = CustomerRst.GetAllWhere(m => m.CustomerNo == no && m.IsDel == "0").First(); |
| | | if (customer != null) |
| | | { |
| | | throw new Exception("相同编码的客户已存在,请勿重复添加"); |
| | | } |
| | | var num = CustomerRst.Add(new SysCustomer() |
| | | var num = await CustomerRst.AddAsync(new SysCustomer() |
| | | { |
| | | CustomerNo = no, |
| | | CustomerName = name, |
| | |
| | | } |
| | | } |
| | | |
| | | public bool EditCustomer(int id, string no, string name, int type, string address, string linkMan, string phone, |
| | | public async Task<bool> EditCustomer(int id, string no, string name, int type, string address, string linkMan, string phone, |
| | | string bankAccount, string creditRating, string demo, int userId) |
| | | { |
| | | try |
| | | { |
| | | var customer = CustomerRst.GetOneById(id); |
| | | var customer = await CustomerRst.GetOneByIdAsync(id); |
| | | if (customer == null) |
| | | { |
| | | throw new Exception("未查询到客户信息"); |
| | |
| | | customer.Demo = demo; |
| | | customer.UpdateUser = userId; |
| | | customer.UpdateTime = DateTime.Now; |
| | | var num = CustomerRst.Edit(customer); |
| | | var num = await CustomerRst.EditAsync(customer); |
| | | return num > 0; |
| | | } |
| | | catch (Exception e) |
| | |
| | | } |
| | | } |
| | | |
| | | public bool DelCustomer(int id, int userId) |
| | | public async Task<bool> DelCustomer(int id, int userId) |
| | | { |
| | | try |
| | | { |
| | | var num = CustomerRst.Remove(id, userId); |
| | | var num = await CustomerRst.RemoveAsync(id, userId); |
| | | return num > 0; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | |
| | | public bool DelsCustomer(List<int> ids, int userId) |
| | | public async Task<bool> DelsCustomer(List<int> ids, int userId) |
| | | { |
| | | try |
| | | { |
| | | var list = CustomerRst.GetAllWhereAsync(m => ids.Contains(m.Id)).ToList(); |
| | | var list = await CustomerRst.GetAllWhere(m => ids.Contains(m.Id)).ToListAsync(); |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | _operation.InsertOperation("基础信息", "客户管理", list[i].CustomerNo, "删除", "删除客户信息 客户号:" + list[i].CustomerNo, userId); |
| | | await _operation.InsertOperation("基础信息", "客户管理", list[i].CustomerNo, "删除", "删除客户信息 客户号:" + list[i].CustomerNo, userId); |
| | | } |
| | | var num = CustomerRst.RemoveAll(list, userId); |
| | | var num = await CustomerRst.RemoveAllAsync(list, userId); |
| | | return num > 0; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | using WMS.Entity.SysEntity; |
| | | using WMS.IBLL.ISysServer; |
| | | using WMS.IDAL.ISysInterface; |
| | | using SqlSugar; |
| | | using WMS.Entity.Context; |
| | | using Utility; |
| | | using Microsoft.AspNetCore.Identity; |
| | | using System.Data; |
| | | |
| | | namespace WMS.BLL.SysServer |
| | | { |
| | |
| | | /// </summary> |
| | | private readonly IDepartmentRepository _department; |
| | | readonly IMapper _mapper; |
| | | private static readonly SqlSugarScope Db = DataContext.Db; |
| | | private readonly UserManager _userManager; |
| | | /// <summary> |
| | | /// 构造函数 |
| | | /// </summary> |
| | | /// <param name="server">部门仓储接口</param> |
| | | /// <param name="mapper">automapper</param> |
| | | public DepartmentServer(IDepartmentRepository department, IMapper mapper) |
| | | public DepartmentServer(IDepartmentRepository department, IMapper mapper, UserManager userManager) |
| | | { |
| | | _department = department;//部门 |
| | | _mapper = mapper;//automapper |
| | | _userManager = userManager; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="DepartmentName">部门名称</param> |
| | | /// <param name="DepartmentNo">部门号</param> |
| | | /// <returns></returns> |
| | | public List<DepartmentDto> GetDepartmentList(string DepartmentName, string DepartmentNo) |
| | | public async Task<List<DepartmentDto>> GetDepartmentList(string DepartmentName, string DepartmentNo) |
| | | { |
| | | List<DepartmentDto> departmentlist = _department.GetDepartmentList(DepartmentName, DepartmentNo); |
| | | return departmentlist; |
| | | return await Db.Queryable<SysDepartment>() |
| | | .LeftJoin<SysUserInfor>((a, b) => a.CreateUser == b.Id) |
| | | .WhereIF(!string.IsNullOrEmpty(DepartmentNo), a => a.DepartmentNo.Contains(DepartmentNo)) |
| | | .WhereIF(!string.IsNullOrEmpty(DepartmentName), a => a.DepartmentName.Contains(DepartmentName)) |
| | | .Where(a => a.IsDel == "0") |
| | | .Select<DepartmentDto>((a, b) => new DepartmentDto() { CreateUserName = b.RealName }, true) |
| | | .ToListAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="id">部门id</param> |
| | | /// <returns></returns> |
| | | public SysDepartment GetDepartmentById(int id) |
| | | public async Task<SysDepartment> GetDepartmentById(int id) |
| | | { |
| | | SysDepartment department = _department.GetDepartmentById(id); |
| | | return department; |
| | | return await Db.Queryable<SysDepartment>().FirstAsync(s => s.Id == id); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据部门号获取部门信息 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public int GetDepartmentByNo(string DepartmentNo) |
| | | public async Task<int> GetDepartmentByNo(string DepartmentNo) |
| | | { |
| | | List<SysDepartment> department = _department.GetDepartmentByNo(DepartmentNo); |
| | | return department.Count; |
| | | return await Db.Queryable<SysDepartment>().CountAsync(s => s.DepartmentNo == DepartmentNo && s.IsDel == "0"); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | public async Task<int> AddDepartment(DepartmentDto departmentdto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | { |
| | | //模型映射 |
| | | SysDepartment department = _mapper.Map<SysDepartment>(departmentdto); |
| | | //判断部门号是否唯一 |
| | | int count = GetDepartmentByNo(department.DepartmentNo); |
| | | int i = 0; |
| | | int count = await GetDepartmentByNo(department.DepartmentNo); |
| | | if (count > 0) |
| | | { |
| | | i = 3; |
| | | throw Oops.Bah("部门号必须唯一"); |
| | | } |
| | | else if (count == 0) |
| | | { |
| | | i = await _department.AddDepartment(department); |
| | | } |
| | | return i; |
| | | department.CreateTime = DateTime.Now; |
| | | department.CreateUser = _userManager.UserId; |
| | | return await Db.Insertable(department).ExecuteCommandAsync(); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception("新增部门异常", ex); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | public async Task<int> DelDepartment(SysDepartment department) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | { |
| | | //删除 |
| | | int i = await _department.DelDepartment(department); |
| | | return i; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception("删除部门异常", ex); |
| | | } |
| | | return await Db.Updateable<SysDepartment>() |
| | | .Where(s => s.Id == department.Id) |
| | | .SetColumns(s => s.IsDel == "1") |
| | | .SetColumns(s => s.UpdateTime == DateTime.Now) |
| | | .SetColumns(s => s.UpdateUser == _userManager.UserId) |
| | | .ExecuteCommandAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | public async Task<int> ExitDepartment(DepartmentDto departmentdto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | { |
| | | //模型映射 |
| | | SysDepartment department = _mapper.Map<SysDepartment>(departmentdto); |
| | | //编辑 |
| | | int i = await _department.ExitDepartment(department); |
| | | return i; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception("编辑部门异常", ex); |
| | | } |
| | | int count = await Db.Queryable<SysDepartment>().CountAsync(s => s.DepartmentNo == departmentdto.DepartmentNo && s.Id != departmentdto.Id && s.IsDel == "0"); |
| | | if (count > 0) |
| | | throw Oops.Bah("部门号必须唯一"); |
| | | department.UpdateUser = _userManager.UserId; |
| | | department.UpdateTime = DateTime.Now; |
| | | return await Db.Updateable(department) |
| | | .UpdateColumns(s => new { s.DepartmentNo, s.DepartmentName, s.Demo, s.UpdateUser, s.UpdateTime }) |
| | | .ExecuteCommandAsync(); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | var data = _dic.GetAllWhereAsync(m => m.ParentNo == parentNo && m.Level == "1").OrderBy(m => m.Ord).ToList(); |
| | | var data = _dic.GetAllWhere(m => m.ParentNo == parentNo && m.Level == "1").OrderBy(m => m.Ord).ToList(); |
| | | return data; |
| | | } |
| | | catch (Exception e) |
| | |
| | | .AndIF(!string.IsNullOrWhiteSpace(type), it => it.Type == type) |
| | | .ToExpression();//注意 这一句 不能少 |
| | | |
| | | var data = await ExceptionRst.GetAllByOrderPageAsync(item, limit, page, out int counts).ToListAsync(); |
| | | var data = await ExceptionRst.GetAllByOrderPage(item, limit, page, out int counts).ToListAsync(); |
| | | return data; |
| | | } |
| | | catch (Exception e) |
| | |
| | | using WMS.Entity.SysEntity; |
| | | using WMS.IBLL.ISysServer; |
| | | using WMS.IDAL.ISysInterface; |
| | | using Utility; |
| | | using Microsoft.AspNetCore.Identity; |
| | | |
| | | namespace WMS.BLL.SysServer |
| | | { |
| | |
| | | /// </summary> |
| | | private readonly IFunSettingRepository _setting; |
| | | private readonly IMapper _mapper; |
| | | private readonly UserManager _userManager; |
| | | /// <summary> |
| | | /// 构造函数 |
| | | /// </summary> |
| | | /// <param name="setting">功能设定</param> |
| | | /// <param name="mapper">automapper</param> |
| | | public FunSettingServer(IFunSettingRepository setting, IMapper mapper) : base(Db) |
| | | public FunSettingServer(IFunSettingRepository setting, IMapper mapper, UserManager userManager) : base(Db) |
| | | { |
| | | _setting = setting;//功能设定 |
| | | _mapper = mapper;//automapper |
| | | _userManager = userManager; |
| | | } |
| | | |
| | | |
| | |
| | | /// <param name="IsEnable">开启状态</param> |
| | | /// <param name="GroupNo">组号</param> |
| | | /// <returns></returns> |
| | | public List<FunSettingDto> GetFunSettingList(string FunSetName, string IsEnable, string GroupNo) |
| | | public async Task<List<FunSettingDto>> GetFunSettingList(string FunSetName, string IsEnable, string GroupNo) |
| | | { |
| | | |
| | | List<FunSettingDto> settinglist = _setting.GetFunSettingList(FunSetName, IsEnable, GroupNo); |
| | | return settinglist; |
| | | return await Db.Queryable<SysFunSetting>() |
| | | .LeftJoin<SysUserInfor>((a, b) => a.CreateUser == b.Id) |
| | | .WhereIF(!string.IsNullOrEmpty(FunSetName), a => a.FunSetName.Contains(FunSetName)) |
| | | .WhereIF(!string.IsNullOrEmpty(GroupNo), a => a.GroupNo.Contains(GroupNo)) |
| | | .WhereIF(!string.IsNullOrEmpty(IsEnable), a => a.IsEnable == IsEnable) |
| | | .Where(a => a.IsDel == "0") |
| | | .Select<FunSettingDto>((a, b) => new FunSettingDto() { CreateName = b.RealName }, true) |
| | | .ToListAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="id">功能id</param> |
| | | /// <returns></returns> |
| | | public SysFunSetting GetFunSettingById(int id) |
| | | public async Task<SysFunSetting> GetFunSettingById(int id) |
| | | { |
| | | SysFunSetting settinglist = _setting.GetFunSettingById(id); |
| | | return settinglist; |
| | | return await Db.Queryable<SysFunSetting>().FirstAsync(s => s.Id == id); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="funSetNo">功能编号</param> |
| | | /// <returns></returns> |
| | | public SysFunSetting GetFunSettingByNo(string funSetNo) |
| | | public async Task<SysFunSetting> GetFunSettingByNo(string funSetNo) |
| | | { |
| | | try |
| | | { |
| | | var list = Db.Queryable<SysFunSetting>().First(a => a.IsDel == "0" && a.FunSetNo == funSetNo); |
| | | return list; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | throw ex; |
| | | } |
| | | return await Db.Queryable<SysFunSetting>().FirstAsync(a => a.IsDel == "0" && a.FunSetNo == funSetNo); |
| | | } |
| | | |
| | | ///// <summary> |
| | |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | public async Task<int> AddFunSettings(FunSettingDto settingdto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | { |
| | | //映射模型 |
| | | SysFunSetting setting = _mapper.Map<SysFunSetting>(settingdto); |
| | | //判断功能编号是否唯一 |
| | | var set = GetFunSettingByNo(setting.FunSetNo); |
| | | int i = 0; |
| | | if (set != null) |
| | | { |
| | | i = 3; |
| | | } |
| | | else if (set == null) |
| | | { |
| | | var setData = Db.Queryable<SysFunSetting>() |
| | | .First(m => m.IsDel == "0" && m.GroupNo == settingdto.GroupNo && m.SetValue==settingdto.SetValue); |
| | | var setData = await Db.Queryable<SysFunSetting>().FirstAsync(m => m.IsDel == "0" && m.GroupNo == settingdto.GroupNo && m.SetValue == settingdto.SetValue); |
| | | if (setData!=null) |
| | | { |
| | | throw new Exception("同组内设定值重复"); |
| | | throw Oops.Bah("同组内设定值重复"); |
| | | } |
| | | //新增 |
| | | i = await _setting.AddFunSettings(setting); |
| | | } |
| | | return i; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception(ex.Message); |
| | | } |
| | | setting.CreateTime = DateTime.Now; |
| | | setting.CreateUser = _userManager.UserId; |
| | | return await Db.Insertable(setting).ExecuteCommandAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | public async Task<int> DelFunSettings(SysFunSetting funSetting) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | { |
| | | //删除 |
| | | int i = await _setting.DelFunSettings(funSetting); |
| | | return i; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception("删除功能异常", ex); |
| | | } |
| | | return await Db.Updateable<SysFunSetting>() |
| | | .Where(s => s.Id == funSetting.Id) |
| | | .SetColumns(s => s.IsDel == "1") |
| | | .SetColumns(s => s.UpdateTime == DateTime.Now) |
| | | .SetColumns(s => s.UpdateUser == _userManager.UserId) |
| | | .ExecuteCommandAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | public async Task<int> ExitFunSettings(FunSettingDto settingdto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | { |
| | | //映射模型 |
| | | SysFunSetting setting = _mapper.Map<SysFunSetting>(settingdto); |
| | | |
| | | var setData = Db.Queryable<SysFunSetting>() |
| | | .First(m => m.IsDel == "0" && m.GroupNo == settingdto.GroupNo && m.SetValue == settingdto.SetValue && m.Id!=settingdto.Id); |
| | | var setData = await Db.Queryable<SysFunSetting>() |
| | | .FirstAsync(m => m.IsDel == "0" && m.GroupNo == settingdto.GroupNo && m.SetValue == settingdto.SetValue && m.Id != settingdto.Id); |
| | | if (setData != null) |
| | | { |
| | | throw new Exception("同组内设定值重复"); |
| | | throw Oops.Bah("同组内设定值重复"); |
| | | } |
| | | //编辑 |
| | | int i = await _setting.ExitFunSettings(setting); |
| | | return i; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception(ex.Message); |
| | | } |
| | | setting.UpdateUser = _userManager.UserId; |
| | | setting.UpdateTime = DateTime.Now; |
| | | return await Db.Updateable(setting) |
| | | .UpdateColumns(s => new { s.FunSetName, s.SetValue, s.FunText, s.IsEnable, s.Ord, s.GroupNo, s.UpdateUser, s.UpdateTime }) |
| | | .ExecuteCommandAsync(); |
| | | } |
| | | } |
| | | } |
| | |
| | | using Model.ModelDto.SysDto; |
| | | using AutoMapper; |
| | | using Model.ModelDto.LogDto; |
| | | using Model.ModelDto.SysDto; |
| | | using Model.ModelVm.SysVm; |
| | | using Newtonsoft.Json; |
| | | using SqlSugar; |
| | |
| | | using System.Linq; |
| | | using System.Reflection; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using Utility; |
| | | using WMS.DAL; |
| | | using WMS.Entity.Context; |
| | | using WMS.Entity.LogEntity; |
| | | using WMS.Entity.SysEntity; |
| | | using WMS.IBLL.ILogServer; |
| | | using WMS.IBLL.ISysServer; |
| | |
| | | private static readonly SqlSugarScope Db = DataContext.Db; |
| | | |
| | | private readonly IOperationSysServer _operation; //操作日志 |
| | | public InterfaceServer(IOperationSysServer operation) |
| | | private readonly UserManager _userManager; |
| | | private readonly IMapper _mapper; |
| | | public InterfaceServer(IOperationSysServer operation, IMapper mapper, UserManager userManager) |
| | | { |
| | | _operation = operation; |
| | | _userManager = userManager; |
| | | _mapper = mapper;//automapper |
| | | } |
| | | /// <summary> |
| | | /// 获取接口列表 |
| | |
| | | /// <param name="model"></param> |
| | | /// <param name="count"></param> |
| | | /// <returns></returns> |
| | | public List<InterfaceDto> GetInterfaceList(InterfaceVm model, out int count) |
| | | public async Task<SqlSugarPagedList<InterfaceDto>> GetInterfaceList(InterfaceVm model) |
| | | { |
| | | string sqlString = string.Empty; |
| | | string sqlCount = string.Empty; |
| | | string sqlPub = string.Empty; |
| | | try |
| | | return await Db.Queryable<SysInterface>() |
| | | .LeftJoin<SysUserInfor>((a, b) => a.CreateUser == b.Id) |
| | | .LeftJoin<SysUserInfor>((a, b, c) => a.UpdateUser == c.Id) |
| | | .Where(a => a.IsDel == "0") |
| | | .WhereIF(!string.IsNullOrEmpty(model.InterfaceNo), a => a.InterfaceNo.Contains(model.InterfaceNo)) |
| | | .WhereIF(!string.IsNullOrEmpty(model.InterfaceName), a => a.InterfaceName.Contains(model.InterfaceName)) |
| | | .WhereIF(!string.IsNullOrEmpty(model.Direction), a => a.Direction == model.Direction) |
| | | .OrderBy(a => a.Id) |
| | | .Select<InterfaceDto>((a, b, c) => new InterfaceDto() |
| | | { |
| | | sqlCount += "SELECT DISTINCT COUNT(tb1.Id) FROM SysInterface AS tb1 "; |
| | | |
| | | sqlString += "SELECT DISTINCT tb1.*,tb2.RealName as CreateUserName,tb3.RealName as UpdateUserName FROM SysInterface AS tb1 "; |
| | | sqlPub += "LEFT JOIN SysUserInfor AS tb2 ON tb1.CreateUser = tb2.Id "; |
| | | sqlPub += "LEFT JOIN SysUserInfor AS tb3 ON tb1.UpdateUser = tb3.Id "; |
| | | sqlPub += $"WHERE tb1.IsDel=0 "; |
| | | if (!string.IsNullOrEmpty(model.InterfaceNo)) |
| | | { |
| | | sqlPub += $"AND tb1.InterfaceNo LIKE '%{model.InterfaceNo}%' "; |
| | | } |
| | | if (!string.IsNullOrEmpty(model.InterfaceName)) |
| | | { |
| | | sqlPub += $"AND tb1.InterfaceName LIKE '%{model.InterfaceName}%' "; |
| | | } |
| | | if (!string.IsNullOrEmpty(model.Direction)) |
| | | { |
| | | sqlPub += $"AND tb1.Direction = '{model.Direction}' "; |
| | | } |
| | | sqlCount += sqlPub; |
| | | sqlPub += " order by tb1.Id "; |
| | | if (model.Page == 0) |
| | | { |
| | | model.Page = 1; |
| | | } |
| | | sqlString += sqlPub + $" offset {((model.Page - 1) * model.Limit)} rows fetch next {model.Limit} rows only;"; |
| | | |
| | | var com = new Common(); |
| | | count = com.GetRowCount(sqlCount); |
| | | |
| | | var modelList = Db.Ado.SqlQuery<InterfaceDto>(sqlString); |
| | | |
| | | return modelList; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw ex; |
| | | } |
| | | Id = a.Id, |
| | | CreateUserName = b.RealName, |
| | | UpdateUserName = c.RealName, |
| | | }, true) |
| | | .ToPagedListAsync(model.Page, model.Limit); |
| | | } |
| | | /// <summary> |
| | | /// 获取接口明细列表 |
| | |
| | | /// <param name="model"></param> |
| | | /// <param name="count"></param> |
| | | /// <returns></returns> |
| | | public List<InterfaceDetailDto> GetInterfaceDetailList(InterfaceDetailVm model, out int count) |
| | | public async Task<SqlSugarPagedList<InterfaceDetailDto>> GetInterfaceDetailList(InterfaceDetailVm model) |
| | | { |
| | | string sqlString = string.Empty; |
| | | string sqlCount = string.Empty; |
| | | int rowCount = 1; |
| | | try |
| | | return await Db.Queryable<SysInterfaceDetail>() |
| | | .LeftJoin<SysUserInfor>((a, b) => a.CreateUser == b.Id) |
| | | .LeftJoin<SysUserInfor>((a, b, c) => a.UpdateUser == c.Id) |
| | | .Where(a => a.IsDel == "0") |
| | | .WhereIF(!string.IsNullOrEmpty(model.InterfaceNo), a => a.InterfaceNo == model.InterfaceNo) |
| | | .Select<InterfaceDetailDto>((a, b, c) => new InterfaceDetailDto() |
| | | { |
| | | if (model.Page == 0) |
| | | { |
| | | model.Page = 1; |
| | | } |
| | | sqlCount += $"SELECT COUNT(ID) FROM SysInterfaceDetail where InterfaceNo = '{model.InterfaceNo}' and isdel = '0';"; |
| | | var com = new Common(); |
| | | count = com.GetRowCount(sqlCount); |
| | | if (count != 0) |
| | | { |
| | | rowCount = count; |
| | | } |
| | | |
| | | sqlString += "SELECT tb1.*,tb2.RealName as CreateUserName,tb3.RealName as UpdateUserName FROM SysInterfaceDetail AS tb1 "; |
| | | sqlString += "LEFT JOIN SysUserInfor AS tb2 ON tb1.CreateUser = tb2.Id "; |
| | | sqlString += "LEFT JOIN SysUserInfor AS tb3 ON tb1.UpdateUser = tb3.Id "; |
| | | sqlString += $"WHERE tb1.InterfaceNo = '{model.InterfaceNo}' AND tb1.IsDel = '0' order by tb1.Id "; |
| | | sqlString += $"offset {((model.Page - 1) * model.Limit)} rows fetch next {rowCount} rows only;"; |
| | | |
| | | var modelList = Db.Ado.SqlQuery<InterfaceDetailDto>(sqlString); |
| | | |
| | | return modelList; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw ex; |
| | | } |
| | | Id = a.Id, |
| | | CreateUserName = b.RealName, |
| | | UpdateUserName = c.RealName, |
| | | }, true) |
| | | .ToPagedListAsync(model.Page, model.Limit); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public string AddInterface(InterfaceVm model) |
| | | public async Task AddInterface(InterfaceVm model) |
| | | { |
| | | string strMessage = ""; |
| | | string sqlString = string.Empty; |
| | | string sqlDetailStr = string.Empty; |
| | | try |
| | | if (await Db.Queryable<SysInterface>().AnyAsync(s => s.InterfaceNo == model.InterfaceNo)) |
| | | { |
| | | string sqlCount = $"SELECT COUNT(ID) FROM SysInterface where InterfaceNo = '{model.InterfaceNo}' and isdel = '0';"; |
| | | var com = new Common().GetRowCount(sqlCount); |
| | | if (com > 0) |
| | | { |
| | | strMessage = "-1:接口编号已存在,请勿重复添加!"; |
| | | return strMessage; |
| | | throw Oops.Bah("接口编号已存在,请勿重复添加"); |
| | | } |
| | | //接口总信息 |
| | | sqlString += "Insert into SysInterface (InterfaceNo,InterfaceName,Direction,TransmissionMode,Remark,Url,DataSources,CreateUser) values ( "; |
| | | sqlString += $"'{model.InterfaceNo}','{model.InterfaceName}','{model.Direction}','{model.TransmissionMode}','{model.Remark}','{model.Url}','{model.DataSources}','{model.CreateUser}' );"; |
| | | SysInterface modInterface = _mapper.Map<SysInterface>(model); |
| | | modInterface.CreateUser = _userManager.UserId; |
| | | modInterface.CreateTime = DateTime.Now; |
| | | await Db.Insertable<SysInterface>(modInterface).ExecuteCommandAsync(); |
| | | |
| | | //接口明细 |
| | | var detailModels = model.InterfaceDetail; |
| | | foreach (InterfaceDetailVm detailModel in detailModels) |
| | | List<SysInterfaceDetail> listDetails = new List<SysInterfaceDetail>(); |
| | | foreach (InterfaceDetailVm detailModel in model.InterfaceDetail) |
| | | { |
| | | sqlDetailStr += "Insert into SysInterfaceDetail (InterfaceNo,ExtField,MapField,Field,"; |
| | | sqlDetailStr += "FieldType,DataType,IsNull,Remark,FieldFather,CreateUser) values ( "; |
| | | sqlDetailStr += $"'{model.InterfaceNo}','{detailModel.ExtField}','{detailModel.MapField}','{detailModel.Field}', "; |
| | | sqlDetailStr += $"'{detailModel.FieldType}','{detailModel.DataType}','{detailModel.IsNull}','{detailModel.Remark}','{detailModel.FieldFather}','{model.CreateUser}'); "; |
| | | SysInterfaceDetail modDetail = _mapper.Map<SysInterfaceDetail>(detailModel); |
| | | modDetail.CreateTime = modInterface.CreateTime; |
| | | modDetail.CreateUser = _userManager.UserId; |
| | | listDetails.Add(modDetail); |
| | | } |
| | | await Db.Insertable(listDetails).ExecuteCommandAsync(); |
| | | |
| | | if (sqlDetailStr == string.Empty) |
| | | { |
| | | return strMessage; |
| | | } |
| | | Db.Ado.BeginTran(); |
| | | |
| | | int rowCount = Db.Ado.ExecuteCommand(sqlString); |
| | | var rowDetailCount = 1; |
| | | if (sqlDetailStr.Length > 0) |
| | | { |
| | | rowDetailCount = Db.Ado.ExecuteCommand(sqlDetailStr); |
| | | } |
| | | Db.Ado.CommitTran(); |
| | | if (rowCount > 0 && rowDetailCount > 0) |
| | | { |
| | | //维护操作日志 |
| | | _operation.InsertOperation("系统设置", "接口管理", model.InterfaceNo, "添加", $"添加了接口编号为{model.InterfaceNo}的接口信息", Convert.ToInt32(model.CreateUser)); |
| | | return strMessage; |
| | | } |
| | | else |
| | | { |
| | | Db.Ado.RollbackTran(); |
| | | return "-2:添加失败数据回滚!"; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public string EditInterface(InterfaceVm model) |
| | | public async Task EditInterface(InterfaceVm model) |
| | | { |
| | | string strMessage = ""; |
| | | string sqlString = string.Empty; |
| | | string sqlDetailStr = string.Empty; |
| | | try |
| | | { |
| | | sqlString = "UPDATE SysInterface SET "; |
| | | sqlString += $"InterfaceName = '{model.InterfaceName}',Direction = '{model.Direction}',"; |
| | | sqlString += $"TransmissionMode = '{model.TransmissionMode}',Remark = '{model.Remark}',Url = '{model.Url}',DataSources = '{model.DataSources}', "; |
| | | sqlString += $"UpdateTime = GETDATE(),UpdateUser = '{model.CreateUser}' "; |
| | | sqlString += $"WHERE InterfaceNo = '{model.InterfaceNo}'"; |
| | | SysInterface modInterface = _mapper.Map<SysInterface>(model); |
| | | modInterface.UpdateUser = _userManager.UserId; |
| | | modInterface.UpdateTime = DateTime.Now; |
| | | await Db.Updateable(modInterface) |
| | | .UpdateColumns(s => new { s.InterfaceName, s.Direction, s.TransmissionMode, s.Remark, s.Url, s.DataSources, s.UpdateTime, s.UpdateUser }) |
| | | .ExecuteCommandAsync(); |
| | | |
| | | var detailModels = model.InterfaceDetail; |
| | | sqlDetailStr += $"SELECT * FROM SysInterfaceDetail WHERE InterfaceNo = '{model.InterfaceNo}' and isDel = '0';"; |
| | | var dbDetailModels = DataContext.Db.Ado.SqlQuery<SysInterfaceDetail>(sqlDetailStr); |
| | | |
| | | sqlDetailStr = string.Empty; |
| | | // 处理已删除的明细 |
| | | foreach (SysInterfaceDetail dbDetailModel in dbDetailModels) |
| | | var listDetails = await Db.Queryable<SysInterfaceDetail>().Where(s => s.InterfaceNo == model.InterfaceNo && s.IsDel == "0").ToListAsync(); |
| | | foreach (SysInterfaceDetail dbDetailModel in listDetails) |
| | | { |
| | | if (detailModels.Count(it => it.Id == dbDetailModel.Id) == 0) |
| | | if (!model.InterfaceDetail.Any(s => s.Id == dbDetailModel.Id)) |
| | | { |
| | | sqlDetailStr += $"UPDATE SysInterfaceDetail SET IsDel = '1',"; |
| | | sqlDetailStr += $"UpdateTime = GETDATE(),UpdateUser = '{model.CreateUser}' "; |
| | | sqlDetailStr += $"WHERE Id = {dbDetailModel.Id};"; |
| | | await Db.Updateable<SysInterfaceDetail>() |
| | | .SetColumns(s => s.IsDel == "1") |
| | | .SetColumns(s => s.UpdateTime == DateTime.Now) |
| | | .SetColumns(s => s.UpdateUser == _userManager.UserId) |
| | | .Where(s => s.Id == dbDetailModel.Id && s.IsDel == "0") |
| | | .ExecuteCommandAsync(); |
| | | } |
| | | } |
| | | |
| | | // 处理修改和添加的明细 |
| | | foreach (InterfaceDetailVm detailModel in detailModels) |
| | | foreach (InterfaceDetailVm detailModel in model.InterfaceDetail) |
| | | { |
| | | if (detailModel.Id == 0 || detailModel.Id == null) |
| | | { |
| | | sqlDetailStr += "Insert into SysInterfaceDetail (InterfaceNo,ExtField,MapField,Field,"; |
| | | sqlDetailStr += "FieldType,DataType,IsNull,Remark,FieldFather,CreateUser) values ( "; |
| | | sqlDetailStr += $"'{model.InterfaceNo}','{detailModel.ExtField}','{detailModel.MapField}','{detailModel.Field}', "; |
| | | sqlDetailStr += $"'{detailModel.FieldType}','{detailModel.DataType}','{detailModel.IsNull}','{detailModel.Remark}','{detailModel.FieldFather}','{model.CreateUser}'); "; |
| | | var modDetail = _mapper.Map<SysInterfaceDetail>(detailModel); |
| | | modDetail.CreateTime = DateTime.Now; |
| | | modDetail.CreateUser = _userManager.UserId; |
| | | modDetail.UpdateUser = _userManager.UserId; |
| | | modDetail.UpdateTime = DateTime.Now; |
| | | await Db.Insertable(modDetail).ExecuteCommandAsync(); |
| | | } |
| | | else |
| | | { |
| | | //判断是否更改 |
| | | int rowNum = dbDetailModels |
| | | .Count(it => it.Id == detailModel.Id |
| | | int rowNum = listDetails.Count(it => it.Id == detailModel.Id |
| | | && it.ExtField == detailModel.ExtField |
| | | && it.MapField == detailModel.MapField |
| | | && it.Field == detailModel.Field |
| | |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | sqlDetailStr += $"UPDATE SysInterfaceDetail SET "; |
| | | sqlDetailStr += $"ExtField = '{detailModel.ExtField}',MapField = '{detailModel.MapField}',Field='{detailModel.Field}',FieldFather='{detailModel.FieldFather}', "; |
| | | sqlDetailStr += $"FieldType = '{detailModel.FieldType}',DataType = '{detailModel.DataType}', "; |
| | | sqlDetailStr += $"IsNull = '{detailModel.IsNull}',Remark = '{detailModel.Remark}', "; |
| | | sqlDetailStr += $"UpdateTime = GETDATE(),UpdateUser = '{model.CreateUser}' "; |
| | | sqlDetailStr += $"WHERE Id = {detailModel.Id};"; |
| | | var modDetail = _mapper.Map<SysInterfaceDetail>(detailModel); |
| | | modDetail.UpdateUser = _userManager.UserId; |
| | | modDetail.UpdateTime = DateTime.Now; |
| | | await Db.Updateable<SysInterfaceDetail>(modDetail) |
| | | .UpdateColumns(s => new { s.ExtField, s.MapField, s.Field, s.FieldFather, s.FieldType, s.DataType, s.IsNull, s.Remark, s.UpdateUser, s.UpdateTime }) |
| | | .ExecuteCommandAsync(); |
| | | } |
| | | } |
| | | |
| | | Db.Ado.BeginTran(); |
| | | |
| | | int rowCount = Db.Ado.ExecuteCommand(sqlString); |
| | | var rowDetailCount = 1; |
| | | if (sqlDetailStr.Length > 0) |
| | | { |
| | | rowDetailCount = Db.Ado.ExecuteCommand(sqlDetailStr); |
| | | } |
| | | Db.Ado.CommitTran(); |
| | | if (rowCount > 0 && rowDetailCount > 0) |
| | | { |
| | | //维护操作日志 |
| | | _operation.InsertOperation("系统设置", "接口管理", model.InterfaceNo, "编辑", $"编辑了接口编号为{model.InterfaceNo}的接口信息", Convert.ToInt32(model.CreateUser)); |
| | | return strMessage; |
| | | } |
| | | else |
| | | { |
| | | Db.Ado.RollbackTran(); |
| | | return "-2:添加失败数据回滚!"; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw ex; |
| | | } |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public string DelInterface(InterfaceVm model) |
| | | public async Task DelInterface(InterfaceVm model) |
| | | { |
| | | try |
| | | { |
| | | string sqlString = ""; |
| | | // 删除总 |
| | | sqlString = $"UPDATE SysInterface SET IsDel = '1',"; |
| | | sqlString += $"UpdateTime = GETDATE(),UpdateUser = '{model.CreateUser}' "; |
| | | sqlString += $"WHERE InterfaceNo = '{model.InterfaceNo}';"; |
| | | await Db.Updateable<SysInterface>() |
| | | .SetColumns(s => s.IsDel == "1") |
| | | .SetColumns(s => s.UpdateTime == DateTime.Now) |
| | | .SetColumns(s => s.UpdateUser == _userManager.UserId) |
| | | .Where(s => s.InterfaceNo == model.InterfaceNo && s.IsDel == "0") |
| | | .ExecuteCommandAsync(); |
| | | |
| | | // 删除明细 |
| | | sqlString += $"UPDATE SysInterfaceDetail SET IsDel = '1',"; |
| | | sqlString += $"UpdateTime = GETDATE(),UpdateUser = '{model.CreateUser}' "; |
| | | sqlString += $"WHERE InterfaceNo = '{model.InterfaceNo}';"; |
| | | Db.Ado.BeginTran(); |
| | | int rowCount = Db.Ado.ExecuteCommand(sqlString); |
| | | |
| | | if (rowCount < 2) |
| | | { |
| | | Db.RollbackTran(); |
| | | return "-1:删除失败!"; |
| | | } |
| | | Db.Ado.CommitTran(); |
| | | _operation.InsertOperation("系统设置", "接口管理", model.InterfaceNo, "删除", $"删除了接口编号为{model.InterfaceNo}的接口信息", Convert.ToInt32(model.CreateUser)); |
| | | return ""; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw ex; |
| | | } |
| | | await Db.Updateable<SysInterfaceDetail>() |
| | | .SetColumns(s => s.IsDel == "1") |
| | | .SetColumns(s => s.UpdateTime == DateTime.Now) |
| | | .SetColumns(s => s.UpdateUser == _userManager.UserId) |
| | | .Where(s => s.InterfaceNo == model.InterfaceNo && s.IsDel == "0") |
| | | .ExecuteCommandAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | public string DelInterfaceDetail(InterfaceDetailVm model) |
| | | public async Task DelInterfaceDetail(InterfaceDetailVm model) |
| | | { |
| | | try |
| | | { |
| | | string sqlString = ""; |
| | | |
| | | // 删除明细 |
| | | sqlString += $"UPDATE SysInterfaceDetail SET IsDel = '1',"; |
| | | sqlString += $"UpdateTime = GETDATE(),UpdateUser = '{model.CreateUser}' "; |
| | | sqlString += $"WHERE Id = '{model.Id}';"; |
| | | Db.Ado.BeginTran(); |
| | | int rowCount = Db.Ado.ExecuteCommand(sqlString); |
| | | |
| | | if (rowCount < 1) |
| | | { |
| | | Db.RollbackTran(); |
| | | return "-1:删除失败!"; |
| | | } |
| | | Db.Ado.CommitTran(); |
| | | _operation.InsertOperation("系统设置", "接口管理", model.InterfaceNo, "删除", $"删除了接口编号为{model.InterfaceNo},本系统字段为{model.Field}的接口信息", Convert.ToInt32(model.CreateUser)); |
| | | return ""; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw ex; |
| | | } |
| | | await Db.Updateable<SysInterfaceDetail>() |
| | | .SetColumns(s => s.IsDel == "1") |
| | | .SetColumns(s => s.UpdateTime == DateTime.Now) |
| | | .SetColumns(s => s.UpdateUser == _userManager.UserId) |
| | | .Where(s => s.Id == model.Id) |
| | | .ExecuteCommandAsync(); |
| | | } |
| | | |
| | | //public void ceshi() |
| | |
| | | _operation = operation; |
| | | } |
| | | |
| | | public List<LogisticsInfoDto> GetLogisticsInfoList(string name, string linkMan, string phone, string licensePlate, string type, int page, int limit, out int count) |
| | | public async Task<List<LogisticsInfoDto>> GetLogisticsInfoList(string name, string linkMan, string phone, string licensePlate, string type, int page, int limit, RefAsync<int> count) |
| | | { |
| | | try |
| | | { |
| | |
| | | .AndIF(!string.IsNullOrWhiteSpace(type), it => it.Type == type) |
| | | .ToExpression();//注意 这一句 不能少 |
| | | |
| | | var data = LogisticsInfoRst.GetAllByOrderPageAsync(item, limit, page, out int counts) |
| | | var data = await LogisticsInfoRst.GetAllByOrderPage(item, limit, page, out int counts) |
| | | .Includes(x => x.CreateUserInfo) |
| | | .Includes(x => x.UpdateUserInfo).ToList(); |
| | | .Includes(x => x.UpdateUserInfo).ToListAsync(); |
| | | count = counts; |
| | | return data.Select(m => new LogisticsInfoDto() |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | public SysLogisticsInfo GetLogisticsInfo(int id) |
| | | public async Task<SysLogisticsInfo> GetLogisticsInfo(int id) |
| | | { |
| | | try |
| | | { |
| | | var data = LogisticsInfoRst.GetOneById(id); |
| | | var data = await LogisticsInfoRst.GetOneByIdAsync(id); |
| | | return data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | |
| | | public List<SysLogisticsInfo> GetLogisticsInfoSelect() |
| | | public async Task<List<SysLogisticsInfo>> GetLogisticsInfoSelect() |
| | | { |
| | | try |
| | | { |
| | | var data = LogisticsInfoRst.GetAllAsync().ToList(); |
| | | var data = await LogisticsInfoRst.GetAllAsync(); |
| | | return data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | |
| | | public bool AddLogisticsInfo(AddLogisticsInfoVm model, int userId) |
| | | public async Task<bool> AddLogisticsInfo(AddLogisticsInfoVm model, int userId) |
| | | { |
| | | try |
| | | { |
| | | |
| | | var num = LogisticsInfoRst.Add(new SysLogisticsInfo() |
| | | var num = await LogisticsInfoRst.AddAsync(new SysLogisticsInfo() |
| | | { |
| | | CarrierName = model.CarrierName, |
| | | Address = model.Address, |
| | |
| | | }); |
| | | return num > 0; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | |
| | | public bool EditLogisticsInfo(EditLogisticsInfoVm model, int userId) |
| | | public async Task<bool> EditLogisticsInfo(EditLogisticsInfoVm model, int userId) |
| | | { |
| | | try |
| | | { |
| | | var logistics = LogisticsInfoRst.GetOneById(model.Id); |
| | | var logistics = await LogisticsInfoRst.GetOneByIdAsync(model.Id); |
| | | if (logistics == null) |
| | | { |
| | | throw new Exception("未查询到物流信息"); |
| | |
| | | logistics.Demo = model.Demo; |
| | | logistics.UpdateUser = userId; |
| | | logistics.UpdateTime = DateTime.Now; |
| | | var num = LogisticsInfoRst.Edit(logistics); |
| | | var num = await LogisticsInfoRst.EditAsync(logistics); |
| | | return num > 0; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | |
| | | public bool DelLogisticsInfo(int id, int userId) |
| | | public async Task<bool> DelLogisticsInfo(int id, int userId) |
| | | { |
| | | try |
| | | { |
| | | var num = LogisticsInfoRst.Remove(id, userId); |
| | | var num = await LogisticsInfoRst.RemoveAsync(id, userId); |
| | | return num > 0; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | |
| | | public bool DelsLogisticsInfo(List<int> ids, int userId) |
| | | public async Task<bool> DelsLogisticsInfo(List<int> ids, int userId) |
| | | { |
| | | try |
| | | { |
| | | var list = LogisticsInfoRst.GetAllWhereAsync(m => ids.Contains(m.Id)).ToList(); |
| | | var list = await LogisticsInfoRst.GetAllWhere(m => ids.Contains(m.Id)).ToListAsync(); |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | _operation.InsertOperation("基础信息", "物流管理", list[i].CarrierName, "删除", "删除物流信息 公司名称:" + list[i].CarrierName, Convert.ToInt32(userId)); |
| | | await _operation.InsertOperation("基础信息", "物流管理", list[i].CarrierName, "删除", "删除物流信息 公司名称:" + list[i].CarrierName, Convert.ToInt32(userId)); |
| | | } |
| | | var num = LogisticsInfoRst.RemoveAll(list, userId); |
| | | return num > 0; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | using AutoMapper; |
| | | using Model.ModelDto.SysDto; |
| | | using SqlSugar; |
| | | using Utility; |
| | | using WMS.DAL; |
| | | using WMS.Entity.Context; |
| | | using WMS.Entity.SysEntity; |
| | |
| | | public IMaterialsRepository _mate { get; set; } |
| | | private readonly IMapper _mapper; |
| | | private static readonly SqlSugarScope Db = DataContext.Db; |
| | | private readonly UserManager _userManager; |
| | | /// <summary> |
| | | /// 构造函数 |
| | | /// </summary> |
| | | /// <param name="mate">物料编码</param> |
| | | /// <param name="mapper">automapper</param> |
| | | public MaterialsServer(IMaterialsRepository mate, IMapper mapper) : base(Db) |
| | | public MaterialsServer(IMaterialsRepository mate, IMapper mapper, UserManager userManager) : base(Db) |
| | | { |
| | | _mate = mate; //物料编码 |
| | | _mapper = mapper; //automapper |
| | | _userManager = userManager; |
| | | } |
| | | |
| | | #region wms |
| | | |
| | | //public List<MaterialsDto> GetMaterialsList(string skuNo, string skuName, string type, string isInspect, int page, int limit, out int count) |
| | | //{ |
| | | // try |
| | | // { |
| | | // Expression<Func<SysMaterials, bool>> item = Expressionable.Create<SysMaterials>() |
| | | // .AndIF(!string.IsNullOrWhiteSpace(skuNo), it => it.SkuNo.Contains(skuNo.Trim())) |
| | | // .AndIF(!string.IsNullOrWhiteSpace(skuName), it => it.SkuName.Contains(skuName.Trim())) |
| | | // .AndIF(!string.IsNullOrWhiteSpace(type), it => it.Type == type) |
| | | // .AndIF(!string.IsNullOrWhiteSpace(isInspect), it => it.IsInspect == isInspect) |
| | | // .ToExpression();//注意 这一句 不能少 |
| | | |
| | | // var data = _mate.GetAllByOrderPageAsync(item, limit, page, out int counts) |
| | | // .Includes(x => x.TypeInfo) |
| | | // .Includes(x => x.EnvironmentInfo) |
| | | // .Includes(x => x.UnitInfo) |
| | | // .Includes(x => x.PackagInfo) |
| | | // .Includes(x => x.CreateUserInfo) |
| | | // .Includes(x => x.UpdateUserInfo) |
| | | // .ToList(); |
| | | // count = counts; |
| | | |
| | | // return data.Select(m => new MaterialsDto() |
| | | // { |
| | | // Id = m.Id, |
| | | // SkuNo = m.SkuNo, |
| | | // SkuName = m.SkuName, |
| | | // Standard = m.Standard, |
| | | // AuditStatusNo = m.AuditStatusNo, |
| | | // Type = m.Type, |
| | | // TypeName = m.TypeInfo == null ? "" : m.TypeInfo.DictName, |
| | | // IsControlled = m.IsControlled, |
| | | // IsInspect = m.IsInspect, |
| | | // Origin = m.Origin, |
| | | // UnitNo = m.UnitNo, |
| | | // UnitName = m.UnitInfo == null ? "" : m.UnitInfo.UnitName, |
| | | // PackagNo = m.PackagNo, |
| | | // PackagName = m.PackagInfo == null ? "" : m.PackagInfo.PackagName, |
| | | // Environment = m.Environment, |
| | | // EnvironmentName = m.EnvironmentInfo == null ? "" : m.EnvironmentInfo.DictName, |
| | | // Weight = m.Weight, |
| | | // Warranty = m.Warranty, |
| | | // Price = m.Price, |
| | | // Demo = m.Demo, |
| | | |
| | | // CreateUserName = m.CreateUserInfo == null ? "" : m.CreateUserInfo.UserName, |
| | | // UpdateUserName = m.UpdateUserInfo == null ? "" : m.UpdateUserInfo.UserName, |
| | | // CreateTime = m.CreateTime, |
| | | // UpdateTime = m.UpdateTime |
| | | // }).ToList(); |
| | | // } |
| | | // catch (Exception e) |
| | | // { |
| | | // throw new Exception(e.Message); |
| | | // } |
| | | //} |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取物料信息列表 |
| | |
| | | /// <param name="environment">存储环境</param> |
| | | /// <param name="categoryNo">类别编码</param> |
| | | /// <returns></returns> |
| | | public List<MaterialsDto> GetMateList(string skuNo, string skuName, string auditStatusNo, string type, string isControlled, string isInspect, string environment, string categoryNo) |
| | | public Task<List<MaterialsDto>> GetMateList(string skuNo, string skuName, string auditStatusNo, string type, string isControlled, string isInspect, string environment, string categoryNo) |
| | | { |
| | | List<MaterialsDto> matedto = _mate.GetMateList(skuNo, skuName, auditStatusNo, type, isControlled, isInspect, environment, categoryNo); |
| | | return matedto; |
| | | return Db.Queryable<SysMaterials>() |
| | | .LeftJoin<SysUserInfor>((a, b) => a.CreateUser == b.Id) |
| | | .WhereIF(!string.IsNullOrEmpty(skuNo), a => a.SkuNo.Contains(skuNo)) |
| | | .WhereIF(!string.IsNullOrEmpty(skuName), a => a.SkuNo.Contains(skuName)) |
| | | .WhereIF(!string.IsNullOrEmpty(auditStatusNo), a => a.AuditStatusNo == auditStatusNo) |
| | | .WhereIF(!string.IsNullOrEmpty(type), a => a.Type == type) |
| | | .WhereIF(!string.IsNullOrEmpty(isControlled), a => a.IsControlled == isControlled) |
| | | .WhereIF(!string.IsNullOrEmpty(isInspect), a => a.IsInspect == isInspect) |
| | | .WhereIF(!string.IsNullOrEmpty(environment), a => a.Environment == environment) |
| | | .WhereIF(!string.IsNullOrEmpty(categoryNo), a => a.CategoryNo == categoryNo) |
| | | .Where(a => a.IsDel == "0") |
| | | .Select<MaterialsDto>((a, b) => new MaterialsDto() { CreateUserName = b.RealName }, true) |
| | | .ToListAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="id">物料id</param> |
| | | /// <returns></returns> |
| | | public SysMaterials GetMateById(int id) |
| | | public async Task<SysMaterials> GetMateById(int id) |
| | | { |
| | | SysMaterials mate = _mate.GetMateById(id); |
| | | return mate; |
| | | return await Db.Queryable<SysMaterials>().FirstAsync(s => s.Id == id); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="SkuNo">物料编号</param> |
| | | /// <returns></returns> |
| | | public int GetMateByNo(string SkuNo) |
| | | public async Task<int> GetMateByNo(string SkuNo) |
| | | { |
| | | List<SysMaterials> mate = _mate.GetMateByNo(SkuNo); |
| | | return mate.Count; |
| | | return await Db.Queryable<SysMaterials>().CountAsync(s => s.SkuNo == SkuNo && s.IsDel == "0"); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | public async Task<int> AddMate(MaterialsDto matedto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | { |
| | | int count = GetMateByNo(matedto.SkuNo); |
| | | |
| | | if (count > 0) |
| | | { |
| | | throw new Exception("系统中已存在该物料"); |
| | | } |
| | | if (string.IsNullOrWhiteSpace(matedto.PackagNo)) |
| | | { |
| | | throw new Exception("包装信息不能为空"); |
| | | } |
| | | |
| | | |
| | | throw Oops.Bah("包装信息不能为空"); |
| | | if (await GetMateByNo(matedto.SkuNo) > 0) |
| | | throw Oops.Bah("系统中已存在该物料"); |
| | | //映射模型 |
| | | SysMaterials mate = _mapper.Map<SysMaterials>(matedto); |
| | | mate.AuditStatusNo = "9"; //审核状态 |
| | |
| | | mate.IsPasteCode = string.IsNullOrWhiteSpace(mate.IsPasteCode) ? "0" : mate.IsPasteCode; //是否免检 |
| | | mate.Origin = "WMS"; //来源 |
| | | mate.IsDel = "0"; |
| | | mate.CreateTime = Db.GetDate(); |
| | | Db.BeginTran(); |
| | | Db.Insertable(mate).ExecuteCommand(); |
| | | Db.CommitTran(); |
| | | return 1; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | Db.RollbackTran(); |
| | | //抛出异常 |
| | | throw new Exception(ex.Message); |
| | | } |
| | | mate.CreateTime = DateTime.Now; |
| | | mate.CreateUser = _userManager.UserId; |
| | | return await Db.Insertable(mate).ExecuteCommandAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | public async Task<int> DelMate(SysMaterials mate) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | { |
| | | //删除 |
| | | int i = await _mate.DelMate(mate); |
| | | return i; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception("删除物料异常", ex); |
| | | } |
| | | return await Db.Updateable<SysMaterials>() |
| | | .Where(s => s.Id == mate.Id) |
| | | .SetColumns(s => s.IsDel == "1") |
| | | .SetColumns(s => s.UpdateTime == DateTime.Now) |
| | | .SetColumns(s => s.UpdateUser == _userManager.UserId) |
| | | .ExecuteCommandAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | public async Task<int> ExitMate(MaterialsDto matedto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | { |
| | | if (matedto.AdventTime > 365 && matedto.AdventTime < 30) |
| | | { |
| | | return 2; |
| | | throw Oops.Bah("临期天数不可大于365及小于30"); |
| | | } |
| | | else if (string.IsNullOrWhiteSpace(matedto.PackagNo)) |
| | | { |
| | | throw new Exception("包装不能为空"); |
| | | throw Oops.Bah("包装不能为空"); |
| | | } |
| | | //else if (matedto.LowInventory > 1000) |
| | | //{ |
| | | // return 4; |
| | | //} |
| | | else |
| | | { |
| | | //映射模型 |
| | | SysMaterials mate = _mapper.Map<SysMaterials>(matedto); |
| | | //编辑 |
| | | //根据id获取物料信息 |
| | | var list = Db.Queryable<SysMaterials>().First(a => a.IsDel == "0" && a.Id == mate.Id); |
| | | var modMaterial = await Db.Queryable<SysMaterials>().FirstAsync(a => a.IsDel == "0" && a.Id == mate.Id); |
| | | //mate.CategoryNo = list.CategoryNo; |
| | | mate.Origin = list.Origin; |
| | | mate.CreateUser = list.CreateUser; |
| | | mate.UpdateTime = Db.GetDate(); |
| | | mate.CreateTime = list.CreateTime; |
| | | |
| | | mate.Origin = modMaterial.Origin; |
| | | mate.CreateUser = modMaterial.CreateUser; |
| | | mate.UpdateTime = DateTime.Now; |
| | | mate.UpdateUser = _userManager.UserId; |
| | | mate.CreateTime = modMaterial.CreateTime; |
| | | int i = Db.Updateable(mate).ExecuteCommand(); |
| | | return i; |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception(ex.Message); |
| | | } |
| | | } |
| | | |
| | | #region 包装 单位 |
| | |
| | | /// 获取计量单位信息列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public List<SysUnit> GetUnitList() |
| | | public async Task<List<SysUnit>> GetUnitList() |
| | | { |
| | | List<SysUnit> unitlist = _mate.GetUnitList(); |
| | | return unitlist; |
| | | return await Db.Queryable<SysUnit>().Where(s => s.IsDel == "0").ToListAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取包装信息列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public List<SysPackag> GetPackagList() |
| | | public async Task<List<SysPackag>> GetPackagList() |
| | | { |
| | | List<SysPackag> packlist = _mate.GetPackagList(); |
| | | return packlist; |
| | | return await Db.Queryable<SysPackag>().Where(s => s.IsDel == "0").ToListAsync(); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | /// </summary> |
| | | /// <param name="menuDto">菜单Dto</param> |
| | | /// <returns></returns> |
| | | public List<FunctionMenuVm> GetMenuList(string MenuName, string pMenuNo, string MenuNo, string level = "") |
| | | public async Task<List<FunctionMenuVm>> GetMenuList(string MenuName, string pMenuNo, string MenuNo, string level = "") |
| | | { |
| | | string str = "select menu1.Id,menu1.MenuNo,menu1.MenuName,menu2.MenuName ParentName,menu1.ParentNo,menu1.Ord,menu1.Url,menu1.level,menu1.IsEnable,menu1.Demo,menu1.IsDel,menu1.CreateTime,menu1.CreateUser,menu1.UpdateTime,menu1.UpdateUser,user1.RealName CreateUserName from SysFunctionMenu menu1 left join sysfunctionmenu menu2 on menu1.parentNo = menu2.MenuNo join SysUserInfor user1 on menu1.CreateUser = user1.id where menu1.IsDel = '0' and menu1.IsEnable = '0' "; |
| | | |
| | | //string str = "select menu1.Id,menu1.MenuNo,menu1.MenuName,menu2.MenuName ParentName,menu1.ParentNo,menu1.Ord,menu1.Url,menu1.level,menu1.IsEnable,menu1.Demo,menu1.IsDel,menu1.CreateTime,menu1.CreateUser,menu1.UpdateTime,menu1.UpdateUser,user1.RealName CreateUserName from SysFunctionMenu menu1 left join sysfunctionmenu menu2 on menu1.parentNo = menu2.MenuNo join SysUserInfor user1 on menu1.CreateUser = user1.id where menu1.IsDel = '0' and menu1.IsEnable = '0' "; |
| | | var queryAble = Db.Queryable<SysFunctionMenu>() |
| | | .LeftJoin<SysFunctionMenu>((a, b) => a.ParentNo == b.MenuNo) |
| | | .LeftJoin<SysUserInfor>((a, b, c) => a.CreateUser == c.Id); |
| | | var exp = Expressionable.Create<SysFunctionMenu, SysFunctionMenu, SysUserInfor>(); |
| | | //判断页面菜单 |
| | | if (!string.IsNullOrEmpty(MenuNo)) |
| | | { |
| | |
| | | if (level == "1") |
| | | { |
| | | //页面 |
| | | str += $" and menu1.MenuNo = '{MenuNo}'"; |
| | | exp.And((a, b, c) => a.MenuNo == MenuNo); |
| | | //str += $" and menu1.MenuNo = '{MenuNo}'"; |
| | | } |
| | | if (level == "2") |
| | | { |
| | | //按钮 |
| | | str += $" and menu1.ParentNo = '{MenuNo}'"; |
| | | exp.And((a, b, c) => a.ParentNo == MenuNo); |
| | | //str += $" and menu1.ParentNo = '{MenuNo}'"; |
| | | } |
| | | if (level == "0") |
| | | { |
| | | //模块 |
| | | str += $" and menu1.ParentNo = '{MenuNo}'"; |
| | | exp.And((a, b, c) => a.ParentNo == MenuNo); |
| | | //str += $" and menu1.ParentNo = '{MenuNo}'"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (!string.IsNullOrEmpty(MenuName)) |
| | | { |
| | | str += $" and menu1.ParentNo = '{MenuNo}'"; |
| | | exp.And((a, b, c) => a.ParentNo == MenuNo); |
| | | //str += $" and menu1.ParentNo = '{MenuNo}'"; |
| | | } |
| | | else |
| | | { |
| | | str += $" and (menu1.ParentNo = '{MenuNo}' or menu1.MenuNo = '{MenuNo}')"; |
| | | exp.And((a, b, c) => a.ParentNo == MenuNo || a.MenuNo == MenuNo); |
| | | //str += $" and (menu1.ParentNo = '{MenuNo}' or menu1.MenuNo = '{MenuNo}')"; |
| | | |
| | | } |
| | | } |
| | |
| | | if (level == "1") |
| | | { |
| | | //页面 |
| | | str += $" and menu1.ParentNo = '{pMenuNo}'"; |
| | | exp.And((a, b, c) => a.ParentNo == pMenuNo); |
| | | //str += $" and menu1.ParentNo = '{pMenuNo}'"; |
| | | } |
| | | if (level == "2") |
| | | { |
| | | //按钮 |
| | | str += $" and menu1.ParentNo in (select MenuNo from SysFunctionMenu where ParentNo = '{pMenuNo}')"; |
| | | exp.And((a, b, c) => SqlFunc.Subqueryable<SysFunctionMenu>().Where(d => d.ParentNo == pMenuNo && a.ParentNo == d.MenuNo).Any()); |
| | | //str += $" and menu1.ParentNo in (select MenuNo from SysFunctionMenu where ParentNo = '{pMenuNo}')"; |
| | | } |
| | | if (level == "0") |
| | | { |
| | | //模块 |
| | | str += $" and menu1.MenuNo= '{pMenuNo}'"; |
| | | exp.And((a, b, c) => a.MenuNo == pMenuNo); |
| | | //str += $" and menu1.MenuNo= '{pMenuNo}'"; |
| | | } |
| | | } |
| | | else |
| | |
| | | //判断菜单名称是否为空 |
| | | if (!string.IsNullOrEmpty(MenuName) && string.IsNullOrEmpty(MenuNo)) |
| | | { |
| | | str += $" and menu1.ParentNo in (select MenuNo from SysFunctionMenu where ParentNo = '{pMenuNo}')"; |
| | | queryAble.Where(a => SqlFunc.Subqueryable<SysFunctionMenu>().Where(d => d.ParentNo == pMenuNo && a.ParentNo == d.MenuNo).Any()); |
| | | //str += $" and menu1.ParentNo in (select MenuNo from SysFunctionMenu where ParentNo = '{pMenuNo}')"; |
| | | } |
| | | else |
| | | { |
| | | str += $" and ( menu1.ParentNo = '{pMenuNo}' or menu1.MenuNo = '{pMenuNo}' or menu1.ParentNo in (select MenuNo from SysFunctionmenu where ParentNo = {pMenuNo}) )"; |
| | | exp.And((a, b, c) => a.ParentNo == pMenuNo || a.MenuNo == pMenuNo || SqlFunc.Subqueryable<SysFunctionMenu>().Where(d => d.ParentNo == pMenuNo && a.ParentNo == d.MenuNo).Any()); |
| | | //str += $" and ( menu1.ParentNo = '{pMenuNo}' or menu1.MenuNo = '{pMenuNo}' or menu1.ParentNo in (select MenuNo from SysFunctionmenu where ParentNo = {pMenuNo}) )"; |
| | | } |
| | | } |
| | | } |
| | | //判断菜单名称与编号是否为空 |
| | | if (!string.IsNullOrEmpty(MenuName)) |
| | | { |
| | | str += $" and menu1.MenuName like '%{MenuName}%'"; |
| | | exp.And((a, b, c) => a.MenuName.Contains(MenuName)); |
| | | //str += $" and menu1.MenuName like '%{MenuName}%'"; |
| | | //判断父级菜单是否为空 |
| | | if (!string.IsNullOrEmpty(pMenuNo) && string.IsNullOrEmpty(MenuNo)) |
| | | { |
| | | str += $" or menu1.MenuNo in (select MenuNo from SysFunctionMenu where ( ParentNo = '{pMenuNo}' or MenuNo='{pMenuNo}' ) and MenuName like '%{MenuName}%')"; |
| | | exp.Or((a, b, c) => SqlFunc.Subqueryable<SysFunctionMenu>().Where(e => (e.ParentNo == pMenuNo || e.MenuNo == pMenuNo && MenuName.Contains(MenuName)) && e.MenuNo == a.MenuNo).Any()); |
| | | //str += $" or menu1.MenuNo in (select MenuNo from SysFunctionMenu where ( ParentNo = '{pMenuNo}' or MenuNo='{pMenuNo}' ) and MenuName like '%{MenuName}%')"; |
| | | } |
| | | } |
| | | //判断菜单层级 |
| | | if (!string.IsNullOrEmpty(level)) |
| | | { |
| | | str += $" and menu1.Level = '{level}'"; |
| | | exp.And((a, b, c) => a.Level == level); |
| | | //str += $" and menu1.Level = '{level}'"; |
| | | } |
| | | str += " order by menu1.MenuNo,menu1.Ord"; |
| | | List<FunctionMenuVm> menulist = _menu.GetMenuList(str); |
| | | return menulist; |
| | | return await queryAble.Where(exp.ToExpression()).OrderBy((a, b, c) => a.MenuNo).OrderBy((a, b, c) => a.Ord) |
| | | .Select<FunctionMenuVm>((a, b, c) => new FunctionMenuVm() |
| | | { |
| | | Id = a.Id, |
| | | MenuNo = a.MenuNo, |
| | | MenuName = a.MenuName, |
| | | ParentNo = a.ParentNo, |
| | | ParentName = b.MenuName, |
| | | Ord = a.Ord, |
| | | Url = a.Url, |
| | | Level = a.Level, |
| | | IsEnable = a.IsEnable, |
| | | Demo = a.Demo, |
| | | CreateTime = a.CreateTime, |
| | | CreateUser = a.CreateUser, |
| | | CreateUserName = c.RealName, |
| | | }, true).ToListAsync(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | using WMS.IBLL.ISysServer; |
| | | using WMS.IDAL.ISysInterface; |
| | | using Model.ModelVm.SysVm; |
| | | using System.Threading.Tasks; |
| | | using Utility; |
| | | |
| | | namespace WMS.BLL.SysServer |
| | | { |
| | |
| | | /// <param name="packagName">包装名称</param> |
| | | /// <param name="level">等级</param> |
| | | /// <returns>包装集合</returns> |
| | | public List<PackagDto> GetPackagList(string packagNo, string packagName, int? level, int page, int limit, out int count) |
| | | public async Task<List<PackagDto>> GetPackagList(string packagNo, string packagName, int? level, int page, int limit, RefAsync<int> count) |
| | | { |
| | | try |
| | | { |
| | |
| | | .AndIF(level != null, it => it.Level.Equals(level)) |
| | | .ToExpression();//注意 这一句 不能少 |
| | | |
| | | var data = PackagRst.GetAllByOrderPageAsync(item, limit, page, out int counts) |
| | | var data = await PackagRst.GetAllByOrderPage(item, limit, page, out int counts) |
| | | .Includes(x => x.CreateUserInfo) |
| | | .Includes(x => x.UpdateUserInfo).ToList(); |
| | | .Includes(x => x.UpdateUserInfo).ToListAsync(); |
| | | count = counts; |
| | | |
| | | return data.Select(m => new PackagDto() |
| | |
| | | /// </summary> |
| | | /// <param name="id">包装id</param> |
| | | /// <returns></returns> |
| | | public SysPackag GetPackagById(int id) |
| | | public async Task<SysPackag> GetPackagById(int id) |
| | | { |
| | | SysPackag packag = PackagRst.GetOneById(id); |
| | | return packag; |
| | | return await PackagRst.GetOneByIdAsync(id); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="model">包装信息</param> |
| | | /// <returns>true:成功 flase:失败</returns> |
| | | public int AddPackag(AddEditPackagVm model) |
| | | public async Task<int> AddPackag(AddEditPackagVm model) |
| | | { |
| | | try |
| | | { |
| | | var rowCount = PackagRst.GetAllWhereAsync(m => m.PackagNo == model.PackagNo).Count(); |
| | | var rowCount = await PackagRst.GetAllWhere(m => m.PackagNo == model.PackagNo).CountAsync(); |
| | | if (rowCount > 0) |
| | | { |
| | | throw new Exception("包装编号已存在!"); |
| | | throw Oops.Bah("包装编号已存在!"); |
| | | } |
| | | |
| | | rowCount = PackagRst.GetAllWhereAsync(m => m.PackagName == model.PackagName).Count(); |
| | | rowCount = await PackagRst.GetAllWhere(m => m.PackagName == model.PackagName).CountAsync(); |
| | | if (rowCount > 0) |
| | | { |
| | | throw new Exception("包装名称已存在!"); |
| | | throw Oops.Bah("包装名称已存在!"); |
| | | } |
| | | |
| | | SysPackag packagModel = new SysPackag(); |
| | |
| | | //判断四级包装是否为空 |
| | | if (string.IsNullOrEmpty(model.L4Num) && string.IsNullOrEmpty(model.L4Name)) |
| | | { |
| | | return 2; |
| | | throw Oops.Bah("包装等级不可越级添加!"); |
| | | } |
| | | } |
| | | //判断四级包装是否为空 |
| | |
| | | //判断三级包装是否为空 |
| | | if (string.IsNullOrEmpty(model.L3Num) && string.IsNullOrEmpty(model.L3Name)) |
| | | { |
| | | return 2; |
| | | throw Oops.Bah("包装等级不可越级添加!"); |
| | | } |
| | | } |
| | | //判断三级包装是否为空 |
| | |
| | | //判断二级包装是否为空 |
| | | if (string.IsNullOrEmpty(model.L2Num) && string.IsNullOrEmpty(model.L2Name)) |
| | | { |
| | | return 2; |
| | | throw Oops.Bah("包装等级不可越级添加!"); |
| | | } |
| | | } |
| | | //判断二级包装是否为空 |
| | |
| | | //判断一级包装是否为空 |
| | | if (string.IsNullOrEmpty(model.L1Num) && string.IsNullOrEmpty(model.L1Name)) |
| | | { |
| | | return 2; |
| | | throw Oops.Bah("包装等级不可越级添加!"); |
| | | } |
| | | } |
| | | //判断一级包装是否为空 |
| | |
| | | } |
| | | else |
| | | { |
| | | return 2; |
| | | throw Oops.Bah("包装等级不可越级添加!"); |
| | | } |
| | | |
| | | packagModel.CreateUser = (int)model.CreateUser; |
| | | |
| | | int rowNum = PackagRst.Add(packagModel); |
| | | if (rowNum > 0) |
| | | { |
| | | return 1; |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | return await PackagRst.AddAsync(packagModel); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="model">包装信息</param> |
| | | /// <returns>true:成功 flase:失败</returns> |
| | | public int EditPackag(AddEditPackagVm model) |
| | | { |
| | | try |
| | | public async Task<int> EditPackag(AddEditPackagVm model) |
| | | { |
| | | if (string.IsNullOrEmpty(model.PackagName)) |
| | | { |
| | | var date = PackagRst.GetAllWhereAsync(m => m.Id != model.Id && (m.PackagName == model.PackagName)).Count(); |
| | | var date = await PackagRst.GetAllWhere(m => m.Id != model.Id && (m.PackagName == model.PackagName)).CountAsync(); |
| | | if (date > 0) |
| | | { |
| | | throw new Exception("包装名称已存在!"); |
| | | throw Oops.Bah("包装名称已存在!"); |
| | | } |
| | | } |
| | | var packagItems = PackagRst.GetOneById(model.Id); |
| | |
| | | //判断四级包装是否为空 |
| | | if (string.IsNullOrEmpty(model.L4Num) && string.IsNullOrEmpty(model.L4Name)) |
| | | { |
| | | return 2; |
| | | throw Oops.Bah("包装等级不可越级修改 请重新输入"); |
| | | } |
| | | } |
| | | else |
| | |
| | | //判断三级包装是否为空 |
| | | if (string.IsNullOrEmpty(model.L3Num) && string.IsNullOrEmpty(model.L3Name)) |
| | | { |
| | | return 2; |
| | | throw Oops.Bah("包装等级不可越级修改 请重新输入"); |
| | | } |
| | | } |
| | | else |
| | |
| | | //判断二级包装是否为空 |
| | | if (string.IsNullOrEmpty(model.L2Num) && string.IsNullOrEmpty(model.L2Name)) |
| | | { |
| | | return 2; |
| | | throw Oops.Bah("包装等级不可越级修改 请重新输入"); |
| | | } |
| | | } |
| | | else |
| | |
| | | //判断一级包装是否为空 |
| | | if (string.IsNullOrEmpty(model.L1Num) && string.IsNullOrEmpty(model.L1Name)) |
| | | { |
| | | return 2; |
| | | throw Oops.Bah("包装等级不可越级修改 请重新输入"); |
| | | } |
| | | } |
| | | else |
| | |
| | | packagItems.L1Num = null; |
| | | packagItems.L1Name = null; |
| | | |
| | | return 2; |
| | | throw Oops.Bah("包装等级不可越级修改 请重新输入"); |
| | | } |
| | | |
| | | var rowCount = PackagRst.Edit(packagItems); |
| | | return rowCount; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | return await PackagRst.EditAsync(packagItems); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="packagId">包装信息主键ID</param> |
| | | /// <returns>true:成功 flase:失败</returns> |
| | | public bool DelPackag(int packagId, int userId) |
| | | public async Task<bool> DelPackag(int packagId, int userId) |
| | | { |
| | | try |
| | | { |
| | | var packagItems = PackagRst.GetOneById(packagId); |
| | | var packagItems = await PackagRst.GetOneByIdAsync(packagId); |
| | | if (packagItems == null) |
| | | { |
| | | throw new Exception("包装信息不存在!"); |
| | | throw Oops.Bah("包装信息不存在!"); |
| | | } |
| | | |
| | | packagItems.IsDel = "1"; |
| | | packagItems.UpdateTime = DateTime.Now; |
| | | packagItems.UpdateUser = userId; |
| | | |
| | | var rowCount = PackagRst.Edit(packagItems); |
| | | return rowCount > 0; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | return await PackagRst.EditAsync(packagItems) > 0; |
| | | } |
| | | } |
| | | } |
| | |
| | | .ToExpression();//注意 这一句 不能少 |
| | | |
| | | |
| | | var data = PalletsRst.GetAllByOrderPageAsync(item, limit, page, out int counts) |
| | | var data = PalletsRst.GetAllByOrderPage(item, limit, page, out int counts) |
| | | .Includes(x => x.CreateUserInfo) |
| | | .ToList(); |
| | | count = counts; |
| | |
| | | |
| | | if (!string.IsNullOrWhiteSpace(palletNo)) |
| | | { |
| | | var code = PalletsRst.GetAllWhereAsync(m => m.PalletNo == palletNo).First(); |
| | | var code = PalletsRst.GetAllWhere(m => m.PalletNo == palletNo).First(); |
| | | return code.PalletNo; |
| | | } |
| | | else |
| | | { |
| | | var code = PalletsRst.GetAllAsync().OrderByDescending(m => m.PalletNo).First(); |
| | | var code = PalletsRst.GetAll().OrderByDescending(m => m.PalletNo).First(); |
| | | |
| | | if (code != null) |
| | | { |
| | |
| | | .LeftJoin<SysRoles>((a, b, c) => a.RoleNo == c.RoleNo) |
| | | .Where((a, b, c) => a.IsDel == "0" && b.IsDel == "0" && c.IsDel == "0") |
| | | .Where((a, b, c) => a.RoleNo == modUser.RoleNo) |
| | | .OrderBy((a, b, c) => b.Ord) |
| | | .Select<RoleRightDto>() |
| | | .ToListAsync(); |
| | | } |
| | |
| | | .ToExpression();//注意 这一句 不能少 |
| | | |
| | | |
| | | var data = AreaRst.GetAllByOrderPageAsync(item, limit, page, out int counts) |
| | | var data = AreaRst.GetAllByOrderPage(item, limit, page, out int counts) |
| | | .Includes(x => x.WareHouseInfo) |
| | | .Includes(x => x.TemperatureInfo) |
| | | .Includes(x => x.CreateUserInfo) |
| | |
| | | { |
| | | try |
| | | { |
| | | var data = AreaRst.GetAllAsync().ToList(); |
| | | var data = AreaRst.GetAll().ToList(); |
| | | if (!string.IsNullOrWhiteSpace(wareHouseNo)) |
| | | { |
| | | data = data.Where(m => m.WareHouseNo == wareHouseNo).ToList(); |
| | |
| | | try |
| | | { |
| | | //判断除当前id信息以外是否含有编号和名称 |
| | | var bol = AreaRst.GetAllAsync() |
| | | var bol = AreaRst.GetAll() |
| | | .Any(m => m.Id != id && m.AreaName == name.Trim()); |
| | | if (bol) |
| | | { |
| | |
| | | .ToExpression();//注意 这一句 不能少 |
| | | |
| | | |
| | | var data = LocatRst.GetAllByOrderPageAsync(item, limit, page, out int counts) |
| | | var data = LocatRst.GetAllByOrderPage(item, limit, page, out int counts) |
| | | .Includes(x => x.WareHouseInfo) |
| | | .Includes(x => x.AreaInfo) |
| | | .Includes(x => x.RoadwayInfo) |
| | |
| | | .AndIF(!string.IsNullOrWhiteSpace(type), it => it.Type == type) |
| | | .ToExpression();//注意 这一句 不能少 |
| | | |
| | | var data = RoadwayRst.GetAllByOrderPageAsync(item, limit, page,out int counts) |
| | | var data = RoadwayRst.GetAllByOrderPage(item, limit, page,out int counts) |
| | | .Includes(x => x.WareHouseInfo) |
| | | .Includes(x => x.TemperatureInfo) |
| | | .Includes(x => x.CreateUserInfo) |
| | |
| | | { |
| | | try |
| | | { |
| | | var data = RoadwayRst.GetAllAsync().ToList(); |
| | | var data = RoadwayRst.GetAll().ToList(); |
| | | if (!string.IsNullOrWhiteSpace(wareHouseNo)) |
| | | { |
| | | data = data.Where(m => m.WareHouseNo == wareHouseNo).ToList(); |
| | |
| | | throw new Exception("为查询到当前巷道信息"); |
| | | } |
| | | //判断除当前id信息以外是否含有编号和名称 |
| | | var bol = RoadwayRst.GetAllAsync().Any(m => m.Id != id && m.RoadwayNo== roadway.RoadwayNo && m.RoadwayName == roadwayName.Trim()); |
| | | var bol = RoadwayRst.GetAll().Any(m => m.Id != id && m.RoadwayNo== roadway.RoadwayNo && m.RoadwayName == roadwayName.Trim()); |
| | | if (bol) |
| | | { |
| | | throw new Exception("当前巷道号或巷道名称已存在"); |
| | |
| | | /// <param name="limit"></param> |
| | | /// <param name="count"></param> |
| | | /// <returns></returns> |
| | | public List<UnitDto> GetUnitList(string unitNo, string unitName, int page, int limit, out int count) |
| | | { |
| | | try |
| | | public async Task<List<UnitDto>> GetUnitList(string unitNo, string unitName, int page, int limit, RefAsync<int> count) |
| | | { |
| | | Expression<Func<SysUnit, bool>> item = Expressionable.Create<SysUnit>() //创建表达式 |
| | | .AndIF(!string.IsNullOrWhiteSpace(unitNo), it => it.UnitNo.Contains(unitNo.Trim())) |
| | |
| | | .ToExpression();//注意 这一句 不能少 |
| | | |
| | | |
| | | var data = UnitRst.GetAllByOrderPageAsync(item, limit, page, out int counts) |
| | | var data = await UnitRst.GetAllByOrderPage(item, limit, page, out int counts) |
| | | .Includes(x => x.CreateUserInfo) |
| | | .Includes(x => x.UpdateUserInfo).ToList(); |
| | | .Includes(x => x.UpdateUserInfo).ToListAsync(); |
| | | count = counts; |
| | | return data.Select(m => new UnitDto() |
| | | { |
| | |
| | | UpdateTime = m.UpdateTime, |
| | | UpdateUserName = m.UpdateUserInfo == null ? "" : m.UpdateUserInfo.RealName |
| | | }).ToList(); |
| | | |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 获取单条单位信息 |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <returns></returns> |
| | | public SysUnit GetUnit(int id) |
| | | public async Task<SysUnit> GetUnit(int id) |
| | | { |
| | | try |
| | | { |
| | | var data = UnitRst.GetOneById(id); |
| | | var data = await UnitRst.GetOneByIdAsync(id); |
| | | return data; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 添加单位信息 |
| | |
| | | /// <param name="abbrev">缩写</param> |
| | | /// <param name="userId">操作人</param> |
| | | /// <returns></returns> |
| | | public bool AddUnit(string unitName, string abbrev, int userId) |
| | | public async Task<bool> AddUnit(string unitName, string abbrev, int userId) |
| | | { |
| | | try |
| | | { |
| | | if (string.IsNullOrEmpty(abbrev)) |
| | | { |
| | | var date = UnitRst.GetAllWhereAsync(m => m.UnitName == unitName).Count(); |
| | | var date = await UnitRst.GetAllWhere(m => m.UnitName == unitName).CountAsync(); |
| | | if (date > 0) |
| | | { |
| | | throw new Exception("单位名称重复"); |
| | |
| | | } |
| | | else |
| | | { |
| | | var date = UnitRst.GetAllWhereAsync(m => m.UnitName == unitName || m.Abbrev == abbrev).Count(); |
| | | var date = await UnitRst.GetAllWhere(m => m.UnitName == unitName || m.Abbrev == abbrev).CountAsync(); |
| | | if (date > 0) |
| | | { |
| | | throw new Exception("单位名称或英文缩写重复"); |
| | |
| | | } |
| | | |
| | | //自动UnitCode处理 |
| | | var unitList = UnitRst.GetAllAsync().OrderByDescending(m => m.UnitNo); |
| | | var unitList = UnitRst.GetAll().OrderByDescending(m => m.UnitNo); |
| | | var code = "01"; |
| | | if (unitList != null && unitList.Count()>0) |
| | | { |
| | |
| | | code = str == "0" ? (str2 == "9" ? (int.Parse(str2) + 1).ToString() : "0" + (int.Parse(str2) + 1)) : (int.Parse(unitCode) + 1).ToString(); |
| | | } |
| | | |
| | | var num = UnitRst.Add(new SysUnit() |
| | | var num = await UnitRst.AddAsync(new SysUnit() |
| | | { |
| | | UnitNo = code, |
| | | UnitName = unitName, |
| | |
| | | }); |
| | | if (num > 0) |
| | | { |
| | | _operation.InsertOperation("基础信息", "计量单位", code, "添加", "添加计量单位 单位号:" + code, Convert.ToInt32(userId)); |
| | | await _operation.InsertOperation("基础信息", "计量单位", code, "添加", "添加计量单位 单位号:" + code, Convert.ToInt32(userId)); |
| | | } |
| | | return num > 0; |
| | | } |
| | |
| | | /// <param name="abbrev">缩写</param> |
| | | /// <param name="userId">操作人</param> |
| | | /// <returns></returns> |
| | | public bool EditUnit(int id, string unitName, string abbrev, int userId) |
| | | { |
| | | try |
| | | public async Task<bool> EditUnit(int id, string unitName, string abbrev, int userId) |
| | | { |
| | | if (string.IsNullOrEmpty(abbrev)) |
| | | { |
| | | var date = UnitRst.GetAllWhereAsync(m => m.Id != id && m.UnitName == unitName).Count(); |
| | | var date = await UnitRst.GetAllWhere(m => m.Id != id && m.UnitName == unitName).CountAsync(); |
| | | if (date > 0) |
| | | { |
| | | throw new Exception("单位名称重复"); |
| | |
| | | } |
| | | else |
| | | { |
| | | var date = UnitRst.GetAllWhereAsync(m => m.Id != id && (m.UnitName == unitName || m.Abbrev == abbrev)).Count(); |
| | | var date = await UnitRst.GetAllWhere(m => m.Id != id && (m.UnitName == unitName || m.Abbrev == abbrev)).CountAsync(); |
| | | if (date > 0) |
| | | { |
| | | throw new Exception("单位名称或英文缩写重复"); |
| | |
| | | unit.UpdateUser = userId; |
| | | unit.UpdateTime = DateTime.Now; |
| | | |
| | | var num = UnitRst.Edit(unit); |
| | | var num = await UnitRst.EditAsync(unit); |
| | | return num > 0; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | |
| | | public bool DelUnit(int id, int userId) |
| | | { |
| | | try |
| | | public async Task<bool> DelUnit(int id, int userId) |
| | | { |
| | | var unit = UnitRst.GetOneById(id); |
| | | if (unit == null) |
| | | { |
| | | throw new Exception("未查询到单位信息"); |
| | | } |
| | | int num = UnitRst.Remove(id, userId); |
| | | int num = await UnitRst.RemoveAsync(id, userId); |
| | | if (num > 0) |
| | | { |
| | | _operation.InsertOperation("基础信息", "计量单位", unit.UnitNo, "删除", "删除计量单位 单位号:" + unit.UnitNo, Convert.ToInt32(userId)); |
| | | await _operation.InsertOperation("基础信息", "计量单位", unit.UnitNo, "删除", "删除计量单位 单位号:" + unit.UnitNo, Convert.ToInt32(userId)); |
| | | } |
| | | |
| | | return num > 0; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | throw new Exception(e.Message); |
| | | } |
| | | } |
| | | |
| | | public bool DelsUnit(List<int> ids, int userId) |
| | | public async Task<bool> DelsUnit(List<int> ids, int userId) |
| | | { |
| | | try |
| | | { |
| | | var list = UnitRst.GetAllWhereAsync(m => ids.Contains(m.Id)).ToList(); |
| | | var list = await UnitRst.GetAllWhere(m => ids.Contains(m.Id)).ToListAsync(); |
| | | if (list.Count > 0) |
| | | { |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | _operation.InsertOperation("基础信息", "计量单位", list[i].UnitNo, "删除", "删除计量单位 单位号:" + list[i].UnitNo, Convert.ToInt32(userId)); |
| | | await _operation.InsertOperation("基础信息", "计量单位", list[i].UnitNo, "删除", "删除计量单位 单位号:" + list[i].UnitNo, Convert.ToInt32(userId)); |
| | | } |
| | | } |
| | | var num = UnitRst.RemoveAll(list, userId); |
| | | var num = await UnitRst.RemoveAllAsync(list, userId); |
| | | return num > 0; |
| | | } |
| | | catch (Exception e) |
| | |
| | | .ToExpression();//注意 这一句 不能少 |
| | | |
| | | |
| | | var data = WareHouseRst.GetAllByOrderPageAsync(item, limit, page,out int counts) |
| | | var data = WareHouseRst.GetAllByOrderPage(item, limit, page,out int counts) |
| | | .Includes(x => x.TypeInfo) |
| | | .Includes(x => x.TemperatureInfo) |
| | | .Includes(x => x.CreateUserInfo) |
| | |
| | | try |
| | | { |
| | | //判断除当前id信息以外是否含有编号和名称 |
| | | var bol = await WareHouseRst.GetAllAsync() |
| | | var bol = await WareHouseRst.GetAll() |
| | | .AnyAsync(m => m.Id != id && (m.WareHouseNo == no.Trim() || m.WareHouseName == name.Trim())); |
| | | if (bol) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | var list = await WareHouseRst.GetAllAsync().ToListAsync(); |
| | | var list = await WareHouseRst.GetAll().ToListAsync(); |
| | | return list; |
| | | } |
| | | catch (Exception e) |
| | |
| | | return model.FirstOrDefault(); |
| | | } |
| | | |
| | | public SqlSugar.ISugarQueryable<T> GetAllAsync() |
| | | public SqlSugar.ISugarQueryable<T> GetAll() |
| | | { |
| | | var data =_db.Queryable<T>().Where(m=>m.IsDel =="0"); |
| | | return data; |
| | | } |
| | | public SqlSugar.ISugarQueryable<T> GetAllWhereAsync(System.Linq.Expressions.Expression<Func<T, bool>> predicate) |
| | | public async Task<List<T>> GetAllAsync() |
| | | { |
| | | var data = GetAllAsync().Where(predicate); |
| | | return await _db.Queryable<T>().Where(m => m.IsDel == "0").ToListAsync(); |
| | | } |
| | | public SqlSugar.ISugarQueryable<T> GetAllWhere(System.Linq.Expressions.Expression<Func<T, bool>> predicate) |
| | | { |
| | | var data = GetAll().Where(predicate); |
| | | return data; |
| | | } |
| | | public SqlSugar.ISugarQueryable<T> GetAllByOrderAsync(System.Linq.Expressions.Expression<Func<T, bool>> predicate, bool asc = true) |
| | | public SqlSugar.ISugarQueryable<T> GetAllByOrder(System.Linq.Expressions.Expression<Func<T, bool>> predicate, bool asc = true) |
| | | { |
| | | var type = OrderByType.Asc; |
| | | if (!asc) |
| | | { |
| | | type = OrderByType.Desc; |
| | | } |
| | | var data = GetAllWhereAsync(predicate).OrderBy(m => m.CreateTime, type); |
| | | var data = GetAllWhere(predicate).OrderBy(m => m.CreateTime, type); |
| | | return data; |
| | | } |
| | | public SqlSugar.ISugarQueryable<T> GeTAllByPageAsync(System.Linq.Expressions.Expression<Func<T, bool>> predicate, int pageSize, int pageIndex,out int count ) |
| | | public SqlSugar.ISugarQueryable<T> GeTAllByPage(System.Linq.Expressions.Expression<Func<T, bool>> predicate, int pageSize, int pageIndex,out int count ) |
| | | { |
| | | var list = GetAllWhereAsync(predicate); |
| | | var list = GetAllWhere(predicate); |
| | | count = list.Count(); |
| | | var data = list.Skip(pageSize * (pageIndex - 1)).Take(pageSize); |
| | | return data; |
| | | } |
| | | |
| | | public SqlSugar.ISugarQueryable<T> GetAllByOrderPageAsync(System.Linq.Expressions.Expression<Func<T, bool>> predicate, int pageSize, int pageIndex, out int count , bool asc = true) |
| | | public SqlSugar.ISugarQueryable<T> GetAllByOrderPage(System.Linq.Expressions.Expression<Func<T, bool>> predicate, int pageSize, int pageIndex, out int count , bool asc = true) |
| | | { |
| | | var list = GetAllByOrderAsync(predicate, asc); |
| | | var list = GetAllByOrder(predicate, asc); |
| | | count = list.Count(); |
| | | var data = list.Skip(pageSize * (pageIndex-1)).Take(pageSize); |
| | | |
| | |
| | | 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; |
| | |
| | | { |
| | | try |
| | | { |
| | | var locateList = GetAllWhereAsync(m => id.Contains(m.Id)).ToList(); |
| | | var locateList = GetAllWhere(m => id.Contains(m.Id)).ToList(); |
| | | if (locateList.Count == 0) |
| | | { |
| | | throw new Exception($"为查询到id为{id}的储位信息"); |
| | |
| | | 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() |
| | |
| | | using Model.ModelDto.SysDto; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | |
| | | /// <param name="limit"></param> |
| | | /// <param name="count"></param> |
| | | /// <returns></returns> |
| | | List<CustomerDto> GetCustomerList(string no, string name,int? type,string linkMan,string phone ,int page,int limit,out int count); |
| | | Task<List<CustomerDto>> GetCustomerList(string no, string name,int? type,string linkMan,string phone ,int page,int limit,RefAsync<int> count); |
| | | /// <summary> |
| | | /// 查询单条客户信息 |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <returns></returns> |
| | | SysCustomer GetCustomer(int id); |
| | | Task<SysCustomer> GetCustomer(int id); |
| | | /// <summary> |
| | | /// 查询全部客户信息 |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <returns></returns> |
| | | List<SysCustomer> GetCustomerSelect(); |
| | | Task<List<SysCustomer>> GetCustomerSelect(); |
| | | /// <summary> |
| | | /// 添加客户信息 |
| | | /// </summary> |
| | |
| | | /// <param name="creditRating">信用等级</param> |
| | | /// <param name="userId">操作人</param> |
| | | /// <returns></returns> |
| | | bool AddCustomer(string no,string name, int type,string address, string linkMan, string phone,string bankAccount,string creditRating, string demo,int userId); |
| | | Task<bool> AddCustomer(string no,string name, int type,string address, string linkMan, string phone,string bankAccount,string creditRating, string demo,int userId); |
| | | |
| | | /// <summary> |
| | | /// 编辑客户信息 |
| | |
| | | /// <param name="creditRating">信用等级</param> |
| | | /// <param name="userId">操作人</param> |
| | | /// <returns></returns> |
| | | bool EditCustomer(int id,string no,string name, int type, string address, string linkMan, string phone, string bankAccount, string creditRating, string demo, int userId); |
| | | Task<bool> EditCustomer(int id,string no,string name, int type, string address, string linkMan, string phone, string bankAccount, string creditRating, string demo, int userId); |
| | | /// <summary> |
| | | /// 删除单条客户信息 |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <param name="userId"></param> |
| | | /// <returns></returns> |
| | | bool DelCustomer(int id,int userId); |
| | | Task<bool> DelCustomer(int id,int userId); |
| | | /// <summary> |
| | | /// 删除单条客户信息 |
| | | /// </summary> |
| | | /// <param name="ids"></param> |
| | | /// <param name="userId"></param> |
| | | /// <returns></returns> |
| | | bool DelsCustomer(List<int> ids, int userId); |
| | | Task<bool> DelsCustomer(List<int> ids, int userId); |
| | | } |
| | | } |
| | |
| | | /// <param name="DepartmentName">部门名称</param> |
| | | /// <param name="DepartmentNo">部门号</param> |
| | | /// <returns></returns> |
| | | List<DepartmentDto> GetDepartmentList(string DepartmentName, string DepartmentNo); |
| | | Task<List<DepartmentDto>> GetDepartmentList(string DepartmentName, string DepartmentNo); |
| | | |
| | | /// <summary> |
| | | /// 根据id获取部门信息 |
| | | /// </summary> |
| | | /// <param name="id">部门id</param> |
| | | /// <returns></returns> |
| | | SysDepartment GetDepartmentById(int id); |
| | | Task<SysDepartment> GetDepartmentById(int id); |
| | | |
| | | /// <summary> |
| | | /// 根据部门号获取部门信息 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | int GetDepartmentByNo(string DepartmentNo); |
| | | Task<int> GetDepartmentByNo(string DepartmentNo); |
| | | |
| | | /// <summary> |
| | | /// 新增部门信息 |
| | |
| | | /// <param name="IsEnable">开启状态</param> |
| | | /// <param name="GroupNo">组号</param> |
| | | /// <returns></returns> |
| | | List<FunSettingDto> GetFunSettingList(string FunSetName, string IsEnable, string GroupNo); |
| | | Task<List<FunSettingDto>> GetFunSettingList(string FunSetName, string IsEnable, string GroupNo); |
| | | |
| | | /// <summary> |
| | | /// 根据id查询功能设定信息 |
| | | /// </summary> |
| | | /// <param name="id">功能id</param> |
| | | /// <returns></returns> |
| | | SysFunSetting GetFunSettingById(int id); |
| | | Task<SysFunSetting> GetFunSettingById(int id); |
| | | |
| | | /// <summary> |
| | | /// 根据编号查询功能设定消息 |
| | | /// </summary> |
| | | /// <param name="funSetNo">功能编号</param> |
| | | /// <returns></returns> |
| | | SysFunSetting GetFunSettingByNo(string funSetNo); |
| | | Task<SysFunSetting> GetFunSettingByNo(string funSetNo); |
| | | |
| | | /// <summary> |
| | | /// 新增功能信息 |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using Utility; |
| | | using WMS.Entity.SysEntity; |
| | | |
| | | namespace WMS.IBLL.ISysServer |
| | |
| | | /// <param name="model"></param> |
| | | /// <param name="count"></param> |
| | | /// <returns></returns> |
| | | List<InterfaceDto> GetInterfaceList(InterfaceVm model, out int count); |
| | | Task<SqlSugarPagedList<InterfaceDto>> GetInterfaceList(InterfaceVm model); |
| | | |
| | | /// <summary> |
| | | /// 获取接口明细列表 |
| | |
| | | /// <param name="model"></param> |
| | | /// <param name="count"></param> |
| | | /// <returns></returns> |
| | | List<InterfaceDetailDto> GetInterfaceDetailList(InterfaceDetailVm model, out int count); |
| | | Task<SqlSugarPagedList<InterfaceDetailDto>> GetInterfaceDetailList(InterfaceDetailVm model); |
| | | |
| | | /// <summary> |
| | | /// 添加接口信息 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | string AddInterface(InterfaceVm model); |
| | | Task AddInterface(InterfaceVm model); |
| | | |
| | | /// <summary> |
| | | /// 编辑接口信息 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | string EditInterface(InterfaceVm model); |
| | | Task EditInterface(InterfaceVm model); |
| | | |
| | | /// <summary> |
| | | /// 删除接口信息 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | string DelInterface(InterfaceVm model); |
| | | Task DelInterface(InterfaceVm model); |
| | | |
| | | /// <summary> |
| | | /// 删除接口明细信息 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | string DelInterfaceDetail(InterfaceDetailVm model); |
| | | Task DelInterfaceDetail(InterfaceDetailVm model); |
| | | } |
| | | } |
| | |
| | | using Model.ModelDto.SysDto; |
| | | using Model.ModelVm.SysVm; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | |
| | | /// <param name="limit"></param> |
| | | /// <param name="count"></param> |
| | | /// <returns></returns> |
| | | List<LogisticsInfoDto> GetLogisticsInfoList(string name,string linkMan,string phone,string licensePlate,string type,int page,int limit,out int count); |
| | | Task<List<LogisticsInfoDto>> GetLogisticsInfoList(string name, string linkMan, string phone, string licensePlate, string type, int page, int limit, RefAsync<int> count); |
| | | /// <summary> |
| | | /// 查询单条物流信息 |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <returns></returns> |
| | | SysLogisticsInfo GetLogisticsInfo(int id); |
| | | Task<SysLogisticsInfo> GetLogisticsInfo(int id); |
| | | /// <summary> |
| | | /// 查询全部物流信息 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | List<SysLogisticsInfo> GetLogisticsInfoSelect(); |
| | | Task<List<SysLogisticsInfo>> GetLogisticsInfoSelect(); |
| | | /// <summary> |
| | | /// 添加物流信息 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <param name="userId">操作人</param> |
| | | /// <returns></returns> |
| | | bool AddLogisticsInfo(AddLogisticsInfoVm model, int userId); |
| | | Task<bool> AddLogisticsInfo(AddLogisticsInfoVm model, int userId); |
| | | /// <summary> |
| | | /// 编辑物流信息 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <param name="userId">操作人</param> |
| | | /// <returns></returns> |
| | | bool EditLogisticsInfo(EditLogisticsInfoVm model, int userId); |
| | | Task<bool> EditLogisticsInfo(EditLogisticsInfoVm model, int userId); |
| | | /// <summary> |
| | | /// 删除单条物流信息 |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <param name="userId">操作人</param> |
| | | /// <returns></returns> |
| | | bool DelLogisticsInfo(int id,int userId); |
| | | Task<bool> DelLogisticsInfo(int id, int userId); |
| | | |
| | | /// <summary> |
| | | /// 删除物流信息(多条信息) |
| | |
| | | /// <param name="ids"></param> |
| | | /// <param name="userId">操作人</param> |
| | | /// <returns></returns> |
| | | bool DelsLogisticsInfo(List<int> ids,int userId); |
| | | Task<bool> DelsLogisticsInfo(List<int> ids, int userId); |
| | | } |
| | | } |
| | |
| | | { |
| | | #region wms |
| | | |
| | | ///// <summary> |
| | | ///// 查询物料信息 |
| | | ///// </summary> |
| | | ///// <param name="skuNo">物料号</param> |
| | | ///// <param name="skuName">物料名称</param> |
| | | ///// <param name="type">物料类型</param> |
| | | ///// <param name="isInspect">是否免检</param> |
| | | ///// <param name="page"></param> |
| | | ///// <param name="limit"></param> |
| | | ///// <param name="count"></param> |
| | | ///// <returns></returns> |
| | | //List<MaterialsDto> GetMaterialsList(string skuNo, string skuName, string type, string isInspect, int page, int limit, out int count); |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取物料信息列表 |
| | | /// </summary> |
| | |
| | | /// <param name="environment">存储环境</param> |
| | | /// <param name="categoryNo">类别编码</param> |
| | | /// <returns></returns> |
| | | List<MaterialsDto> GetMateList(string skuNo, string skuName, string auditStatusNo, string type, string isControlled, string isInspect, string environment,string categoryNo); |
| | | Task<List<MaterialsDto>> GetMateList(string skuNo, string skuName, string auditStatusNo, string type, string isControlled, string isInspect, string environment,string categoryNo); |
| | | |
| | | /// <summary> |
| | | /// 根据id查询物料信息 |
| | | /// </summary> |
| | | /// <param name="id">物料id</param> |
| | | /// <returns></returns> |
| | | SysMaterials GetMateById(int id); |
| | | Task<SysMaterials> GetMateById(int id); |
| | | |
| | | /// <summary> |
| | | /// 根据编号查询物料信息 |
| | | /// </summary> |
| | | /// <param name="SkuNo">物料编号</param> |
| | | /// <returns></returns> |
| | | int GetMateByNo(string SkuNo); |
| | | Task<int> GetMateByNo(string SkuNo); |
| | | |
| | | /// <summary> |
| | | /// 新增物料信息 |
| | |
| | | /// 获取计量单位信息列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | List<SysUnit> GetUnitList(); |
| | | Task<List<SysUnit>> GetUnitList(); |
| | | |
| | | /// <summary> |
| | | /// 获取包装信息列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | List<SysPackag> GetPackagList(); |
| | | Task<List<SysPackag>> GetPackagList(); |
| | | |
| | | #endregion |
| | | |
| | |
| | | /// </summary> |
| | | /// <param name="menuDto">菜单Dto</param> |
| | | /// <returns></returns> |
| | | List<FunctionMenuVm> GetMenuList(string MenuName, string pMenuNo, string MenuNo, string level); |
| | | Task<List<FunctionMenuVm>> GetMenuList(string MenuName, string pMenuNo, string MenuNo, string level); |
| | | |
| | | /// <summary> |
| | | /// 根据层级获取菜单列表 |
| | |
| | | using System.Threading.Tasks; |
| | | using Model.ModelDto.SysDto; |
| | | using Model.ModelVm.SysVm; |
| | | using SqlSugar; |
| | | using WMS.Entity.SysEntity; |
| | | |
| | | namespace WMS.IBLL.ISysServer |
| | |
| | | /// <param name="limit"></param> |
| | | /// <param name="count"></param> |
| | | /// <returns></returns> |
| | | List<PackagDto> GetPackagList(string packagNo, string packagName, int? level, int page, int limit, out int count); |
| | | Task<List<PackagDto>> GetPackagList(string packagNo, string packagName, int? level, int page, int limit, RefAsync<int> count); |
| | | |
| | | /// <summary> |
| | | /// 根据id获取包装信息 |
| | | /// </summary> |
| | | /// <param name="id">包装id</param> |
| | | /// <returns></returns> |
| | | SysPackag GetPackagById(int id); |
| | | Task<SysPackag> GetPackagById(int id); |
| | | |
| | | /// <summary> |
| | | /// 新增包装信息 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | int AddPackag(AddEditPackagVm model); |
| | | Task<int> AddPackag(AddEditPackagVm model); |
| | | |
| | | /// <summary> |
| | | /// 修改包装信息 |
| | | /// </summary> |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | int EditPackag(AddEditPackagVm model); |
| | | Task<int> EditPackag(AddEditPackagVm model); |
| | | |
| | | /// <summary> |
| | | /// 逻辑删除包装信息 |
| | | /// </summary> |
| | | /// <param name="packagId">包装主键Id</param> |
| | | /// <returns></returns> |
| | | bool DelPackag(int packagId, int userId); |
| | | Task<bool> DelPackag(int packagId, int userId); |
| | | |
| | | } |
| | | } |
| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using Model.ModelDto.SysDto; |
| | | using SqlSugar; |
| | | using WMS.Entity.SysEntity; |
| | | |
| | | namespace WMS.IBLL.ISysServer |
| | |
| | | /// <param name="limit"></param> |
| | | /// <param name="count"></param> |
| | | /// <returns></returns> |
| | | List<UnitDto> GetUnitList(string unitNo,string unitName,int page,int limit,out int count); |
| | | Task<List<UnitDto>> GetUnitList(string unitNo,string unitName,int page,int limit, RefAsync<int> count); |
| | | /// <summary> |
| | | /// 获取单条单位信息 |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <returns></returns> |
| | | SysUnit GetUnit(int id); |
| | | Task<SysUnit> GetUnit(int id); |
| | | /// <summary> |
| | | /// 添加单位信息 |
| | | /// </summary> |
| | |
| | | /// <param name="abbrev">缩写</param> |
| | | /// <param name="userId">操作人</param> |
| | | /// <returns></returns> |
| | | bool AddUnit(string unitName,string abbrev,int userId); |
| | | Task<bool> AddUnit(string unitName,string abbrev,int userId); |
| | | /// <summary> |
| | | /// 编辑单位信息 |
| | | /// </summary> |
| | |
| | | /// <param name="abbrev">缩写</param> |
| | | /// <param name="userId">操作人</param> |
| | | /// <returns></returns> |
| | | bool EditUnit(int id, string unitName, string abbrev, int userId); |
| | | Task<bool> EditUnit(int id, string unitName, string abbrev, int userId); |
| | | /// <summary> |
| | | /// 删除单位信息 |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <param name="userId"></param> |
| | | /// <returns></returns> |
| | | bool DelUnit(int id,int userId); |
| | | Task<bool> DelUnit(int id,int userId); |
| | | /// <summary> |
| | | /// 删除单位信息(多删除) |
| | | /// </summary> |
| | | /// <param name="ids">id集合</param> |
| | | /// <param name="userId"></param> |
| | | /// <returns></returns> |
| | | bool DelsUnit(List<int> ids, int userId); |
| | | Task<bool> DelsUnit(List<int> ids, int userId); |
| | | } |
| | | } |
| | |
| | | Task SaveAsync(); |
| | | |
| | | |
| | | ISugarQueryable<T> GetAllAsync(); |
| | | |
| | | ISugarQueryable<T> GetAll(); |
| | | Task<List<T>> GetAllAsync(); |
| | | T GetOneById(int id); |
| | | Task<T> GetOneByIdAsync(int id); |
| | | |
| | |
| | | |
| | | T GetModel(string sqlString); |
| | | |
| | | ISugarQueryable<T> GetAllWhereAsync(Expression<Func<T, bool>> predicate); |
| | | ISugarQueryable<T> GeTAllByPageAsync(Expression<Func<T, bool>> predicate,int pageSize,int pageIndex, out int count); |
| | | ISugarQueryable<T> GetAllByOrderAsync(Expression<Func<T, bool>> predicate, bool asc = true); |
| | | ISugarQueryable<T> GetAllByOrderPageAsync(Expression<Func<T, bool>> predicate, int pageSize , int pageIndex , out int count,bool asc = true); |
| | | ISugarQueryable<T> GetAllWhere(Expression<Func<T, bool>> predicate); |
| | | ISugarQueryable<T> GeTAllByPage(Expression<Func<T, bool>> predicate,int pageSize,int pageIndex, out int count); |
| | | ISugarQueryable<T> GetAllByOrder(Expression<Func<T, bool>> predicate, bool asc = true); |
| | | ISugarQueryable<T> GetAllByOrderPage(Expression<Func<T, bool>> predicate, int pageSize , int pageIndex , out int count,bool asc = true); |
| | | } |
| | | } |
| | |
| | | using Model.ModelDto.LogDto; |
| | | using Model.ModelDto.SysDto; |
| | | using Model.ModelVm.SysVm; |
| | | using WMS.Entity.SysEntity; |
| | | |
| | | namespace Wms.AutoMapperServer |
| | | { |
| | |
| | | |
| | | CreateMap<WMS.Entity.LogEntity.LogOperationSys, OperationDto>().ReverseMap();//系统操作日志(实体与Dto) |
| | | CreateMap<WMS.Entity.SysEntity.SysException, ExceptionDto>().ReverseMap();//异常处理(实体与Dto) |
| | | |
| | | CreateMap<WMS.Entity.SysEntity.SysInterface, InterfaceVm>().ReverseMap(); |
| | | CreateMap<WMS.Entity.SysEntity.SysInterfaceDetail, InterfaceDetailVm>().ReverseMap(); |
| | | } |
| | | } |
| | | } |
| | |
| | | [Route("api/[controller]/[action]")] |
| | | [ApiController] |
| | | [Authorize] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public class BasisController : ControllerBase |
| | | { |
| | | /// <summary> |
| | |
| | | /// <param name="Status">状态</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<List<UserInfoDto>> GetUserRoleList(string UserName, string DepartmentNo, string RoleNo, string Status) |
| | | { |
| | | return await _userInforServer.GetUserRoleList(UserName, DepartmentNo, RoleNo, Status); |
| | |
| | | /// <param name="id">用户id</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<SysUserInfor> GetUserinfoListById(int id) |
| | | { |
| | | return await _userInforServer.GetUserInfoById(id); |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="System.Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task InsertUserinfo(UserInfoDto UserInfoDto) |
| | | { |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="System.Exception">异常</exception> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task DeleteUserInfo(int userids) |
| | | { |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="System.Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task UpdateUserinfo(UserInfoDto userdto) |
| | | { |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task UptUserPassWord(string pwdOld, string pwdNew, string pwdNewTwo/*, int userId*/) |
| | | { |
| | | pwdOld = Md5Tools.CalcMd5(pwdOld); |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<int> IsPassWordTime() |
| | | { |
| | | return await _userInforServer.IsPassWordTime(_userManager.UserId); |
| | |
| | | /// <param name="RoleName">角色名称</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<List<RoleDto>> GetRolesList(string RoleNo, string RoleName) |
| | | { |
| | | return await _rolesServer.GetRoleList(RoleNo, RoleName); |
| | |
| | | /// <param name="roleid">角色id</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<SysRoles> GetRolesListById(int roleid) |
| | | { |
| | | return await _rolesServer.GetRoleInfoById(roleid); |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="System.Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task InsertRoleInfo(RoleDto roledto) |
| | | { |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="System.Exception"></exception> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task DeleteRoleInfo(int roleids) |
| | | { |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="System.Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task UpdateRolesInfo(SysRoles role) |
| | | { |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<List<FunctionMenuDto>> GetRoleRightRBAC(int id, string MenuNo) |
| | | { |
| | | return await _rBACServer.GetRoleRightRBAC(MenuNo, UserId); |
| | | return await _rBACServer.GetRoleRightRBAC(MenuNo, _userManager.UserId.ToString()); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<List<RoleRightDto>> GetRoleRightLists(int id) |
| | | { |
| | | return await _rBACServer.GetRoleRightList(id); |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<List<RoleRightDto>> GetRoleRightList() |
| | | { |
| | | return await _roleRightServer.GetRoleMenuList(); |
| | |
| | | /// <param name="id">角色权限id</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | public async Task<List<SysRoleRight>> GetRoleRightOneListById(int id) |
| | | { |
| | | return await _roleRightServer.GetRoleRightOneListById(id); |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | [ServiceFilter(typeof(ApiResponseActionFilter))] |
| | | [UnitOfWork] |
| | | public async Task InsertRoleRight(string MenuNo, int id) |
| | | { |
| | |
| | | /// <param name="DepartmentNo">部门号</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetDepartmentList(string DepartmentName, string DepartmentNo) |
| | | public async Task<List<DepartmentDto>> GetDepartmentList(string DepartmentName, string DepartmentNo) |
| | | { |
| | | List<DepartmentDto> departmentlist = _department.GetDepartmentList(DepartmentName, DepartmentNo); |
| | | return Ok(new |
| | | { |
| | | data = departmentlist, |
| | | code = 0, |
| | | msg = "获取部门信息列表成功" |
| | | }); |
| | | return await _department.GetDepartmentList(DepartmentName, DepartmentNo); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="id">部门id</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetDepartmentById(int id) |
| | | public async Task<SysDepartment> GetDepartmentById(int id) |
| | | { |
| | | SysDepartment department = _department.GetDepartmentById(id); |
| | | return Ok(new |
| | | { |
| | | data = department, |
| | | msg = "成功", |
| | | code = 0 |
| | | }); |
| | | return await _department.GetDepartmentById(id); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | public async Task<IActionResult> AddDepartment(DepartmentDto departmentdto) |
| | | [UnitOfWork] |
| | | public async Task AddDepartment(DepartmentDto departmentdto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | await _department.AddDepartment(departmentdto); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | //获取当前操作用户id |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | |
| | | int uid = Convert.ToInt32(userId); |
| | | //更改人 |
| | | departmentdto.CreateUser = uid; |
| | | |
| | | int i = await _department.AddDepartment(departmentdto); |
| | | //判断是否新增成功 |
| | | if (i == 0) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 1, |
| | | msg = "新增失败" |
| | | ParentName = "基础信息", |
| | | MenuName = "部门管理", |
| | | FkNo = departmentdto.DepartmentNo, |
| | | TypeName = "添加", |
| | | Msg = "添加部门信息 部门号:" + departmentdto.DepartmentNo |
| | | }); |
| | | } |
| | | else if (i == 3) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 3, |
| | | msg = "部门号必须唯一" |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | await _operation.InsertOperation("基础信息", "部门管理", departmentdto.DepartmentNo, "添加", "添加部门信息 部门号:" + departmentdto.DepartmentNo, uid); |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 0, |
| | | msg = "新增成功" |
| | | }); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception("新增部门异常", ex); |
| | | } |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpGet] |
| | | public async Task<IActionResult> DelDepartment(int Id) |
| | | [UnitOfWork] |
| | | public async Task DelDepartment(int Id) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | SysDepartment department = await _department.GetDepartmentById(Id); |
| | | await _department.DelDepartment(department); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | SysDepartment department = _department.GetDepartmentById(Id); |
| | | |
| | | //获取当前操作用户id |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | int uid = Convert.ToInt32(userId); |
| | | //更改人 |
| | | department.UpdateUser = uid; |
| | | int i = await _department.DelDepartment(department); |
| | | //判断是否删除成功 |
| | | if (i == 0) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 1, |
| | | msg = "删除失败" |
| | | ParentName = "基础信息", |
| | | MenuName = "部门管理", |
| | | FkNo = department.DepartmentNo, |
| | | TypeName = "删除", |
| | | Msg = "删除部门信息 部门号:" + department.DepartmentNo |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | await _operation.InsertOperation("基础信息", "部门管理", department.DepartmentNo, "删除", "删除部门信息 部门号:" + department.DepartmentNo, uid); |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 0, |
| | | msg = "删除成功" |
| | | }); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception("删除部门异常", ex); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | public async Task<IActionResult> ExitDepartment(DepartmentDto departmentdto) |
| | | [UnitOfWork] |
| | | public async Task ExitDepartment(DepartmentDto departmentdto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | await _department.ExitDepartment(departmentdto); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | //获取当前操作用户id |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | int uid = Convert.ToInt32(userId); |
| | | //更改人 |
| | | departmentdto.UpdateUser = uid; |
| | | int i = await _department.ExitDepartment(departmentdto); |
| | | //判断是否编辑成功 |
| | | if (i == 0) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 1, |
| | | msg = "编辑失败" |
| | | ParentName = "基础信息", |
| | | MenuName = "部门管理", |
| | | FkNo = departmentdto.DepartmentNo, |
| | | TypeName = "编辑", |
| | | Msg = "编辑部门信息 部门号:" + departmentdto.DepartmentNo |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | await _operation.InsertOperation("基础信息", "部门管理", departmentdto.DepartmentNo, "修改", "编辑部门信息 部门号:" + departmentdto.DepartmentNo, uid); |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 0, |
| | | msg = "编辑成功" |
| | | }); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception("编辑部门异常", ex); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | |
| | | /// <param name="GroupNo">组号</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetFunSettingList(string FunSetName, string IsEnable, string GroupNo) |
| | | public async Task<List<FunSettingDto>> GetFunSettingList(string FunSetName, string IsEnable, string GroupNo) |
| | | { |
| | | List<FunSettingDto> settinglist = _setting.GetFunSettingList(FunSetName, IsEnable, GroupNo); |
| | | return Ok(new |
| | | { |
| | | data = settinglist, |
| | | code = 0, |
| | | msg = "成功" |
| | | }); |
| | | return await _setting.GetFunSettingList(FunSetName, IsEnable, GroupNo); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="id">功能id</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetFunSettingById(int id) |
| | | public async Task<SysFunSetting> GetFunSettingById(int id) |
| | | { |
| | | SysFunSetting settinglist = _setting.GetFunSettingById(id); |
| | | return Ok(new |
| | | { |
| | | data = settinglist, |
| | | code = 0, |
| | | msg = "成功" |
| | | }); |
| | | return await _setting.GetFunSettingById(id); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="funSetNo">功能编号</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetFunSettingByNo(string funSetNo) |
| | | public async Task<SysFunSetting> GetFunSettingByNo(string funSetNo) |
| | | { |
| | | try |
| | | { |
| | | var models = _setting.GetFunSettingByNo(funSetNo); |
| | | |
| | | return Ok(new { code = 0, msg = "功能设定信息", data = models }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | return await _setting.GetFunSettingByNo(funSetNo); |
| | | } |
| | | /// <summary> |
| | | /// 新增功能信息 |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | public async Task<IActionResult> AddFunSettings(FunSettingDto settingdto) |
| | | [UnitOfWork] |
| | | public async Task AddFunSettings(FunSettingDto settingdto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | await _setting.AddFunSettings(settingdto); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | //获取当前操作用户id |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | int uid = Convert.ToInt32(userId); |
| | | //创建人 |
| | | settingdto.CreateUser = uid; |
| | | //新增 |
| | | int i = await _setting.AddFunSettings(settingdto); |
| | | //判断是否新增成功 |
| | | if (i == 0) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 1, |
| | | msg = "失败" |
| | | ParentName = "系统设置", |
| | | MenuName = "功能设定", |
| | | FkNo = settingdto.FunSetNo, |
| | | TypeName = "添加", |
| | | Msg = "添加功能设定 功能号:" + settingdto.FunSetNo |
| | | }); |
| | | } |
| | | else if (i == 3) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 3, |
| | | msg = "功能号必须唯一" |
| | | }); |
| | | } |
| | | else if (i == 4) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 4, |
| | | msg = "显示顺序范围为1---5" |
| | | }); |
| | | } |
| | | else if (i == 5) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 5, |
| | | msg = "请输入正确组号" |
| | | }); |
| | | } |
| | | else if (i == 6) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 6, |
| | | msg = "每一组只能开启一个功能" |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | await _operation.InsertOperation("系统设置", "功能设定", settingdto.FunSetNo, "添加", "添加功能设定 功能号:" + settingdto.FunSetNo, uid); |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 0, |
| | | msg = "成功" |
| | | }); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return Ok(new { data = "", code = 1, msg = "新增功能异常:" + ex.Message }); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpGet] |
| | | public async Task<IActionResult> DelFunSettings(int id) |
| | | [UnitOfWork] |
| | | public async Task DelFunSettings(int id) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | SysFunSetting funSetting = await _setting.GetFunSettingById(id); |
| | | await _setting.DelFunSettings(funSetting); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | SysFunSetting funSetting = _setting.GetFunSettingById(id); |
| | | //获取当前操作用户id |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | int uid = Convert.ToInt32(userId); |
| | | //更改人 |
| | | funSetting.UpdateUser = uid; |
| | | //删除 |
| | | int i = await _setting.DelFunSettings(funSetting); |
| | | //判断是否删除成功 |
| | | if (i == 0) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 1, |
| | | msg = "失败" |
| | | ParentName = "系统设置", |
| | | MenuName = "功能设定", |
| | | FkNo = funSetting.FunSetNo, |
| | | TypeName = "删除", |
| | | Msg = "删除功能设定 功能号:" + funSetting.FunSetNo |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | await _operation.InsertOperation("系统设置", "功能设定", funSetting.FunSetNo, "删除", "删除功能设定 功能号:" + funSetting.FunSetNo, uid); |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 0, |
| | | msg = "成功" |
| | | }); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception("删除功能异常", ex); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | public async Task<IActionResult> ExitFunSettings(FunSettingDto settingdto) |
| | | [UnitOfWork] |
| | | public async Task ExitFunSettings(FunSettingDto settingdto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | await _setting.ExitFunSettings(settingdto); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | //获取当前操作用户id |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | int uid = Convert.ToInt32(userId); |
| | | //更改人 |
| | | settingdto.UpdateUser = uid; |
| | | //编辑 |
| | | int i = await _setting.ExitFunSettings(settingdto); |
| | | //判断是否编辑成功 |
| | | if (i == 0) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 1, |
| | | msg = "失败" |
| | | ParentName = "系统设置", |
| | | MenuName = "功能设定", |
| | | FkNo = settingdto.FunSetNo, |
| | | TypeName = "编辑", |
| | | Msg = "修改功能设定 功能号:" + settingdto.FunSetNo |
| | | }); |
| | | } |
| | | else if (i == 6) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 6, |
| | | msg = "每一组只能开启一个功能" |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | await _operation.InsertOperation("系统设置", "功能设定", settingdto.FunSetNo, "修改", "修改功能设定 功能号:" + settingdto.FunSetNo, uid); |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 0, |
| | | msg = "成功" |
| | | }); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return Ok(new { data = "", code = 1, msg = "编辑功能异常:" + ex.Message }); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 物料管理 |
| | | |
| | | ///// <summary> |
| | | ///// 查询物料信息 |
| | | ///// </summary> |
| | | ///// <param name="matevm">物料编码视图模型</param> |
| | | ///// <returns></returns> |
| | | //[HttpPost] |
| | | //public IActionResult GetMaterialsList(GetMaterialsVm matevm) |
| | | //{ |
| | | // try |
| | | // { |
| | | // var bolls = _mate.GetMaterialsList(matevm.SkuNo, matevm.SkuName, matevm.Type, matevm.IsInspect, matevm.Page, matevm.Limit, out int count); |
| | | |
| | | // return Ok(new { code = 0, count, msg = "物料信息", data = bolls }); |
| | | // } |
| | | // catch (Exception e) |
| | | // { |
| | | // return Ok(new { code = 1, msg = e.Message }); |
| | | // } |
| | | //} |
| | | |
| | | |
| | | #region yyk |
| | | |
| | |
| | | /// <param name="categoryNo">类别编码</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetMateList(string skuNo, string skuName, string auditStatusNo, string type, string isControlled, string isInspect, string environment, string categoryNo) |
| | | public async Task<List<MaterialsDto>> GetMateList(string skuNo, string skuName, string auditStatusNo, string type, string isControlled, string isInspect, string environment, string categoryNo) |
| | | { |
| | | List<MaterialsDto> matedto = _mate.GetMateList(skuNo, skuName, auditStatusNo, type, isControlled, isInspect, environment, categoryNo); |
| | | return Ok(new |
| | | { |
| | | data = matedto, |
| | | code = 0, |
| | | msg = "成功" |
| | | }); |
| | | return await _mate.GetMateList(skuNo, skuName, auditStatusNo, type, isControlled, isInspect, environment, categoryNo); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="id">物料id</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetMateById(int id) |
| | | public async Task<SysMaterials> GetMateById(int id) |
| | | { |
| | | SysMaterials mate = _mate.GetMateById(id); |
| | | return Ok(new |
| | | { |
| | | data = mate, |
| | | code = 0, |
| | | msg = "成功" |
| | | }); |
| | | return await _mate.GetMateById(id); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="matedto">物料dto</param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | public async Task<IActionResult> AddMate(MaterialsDto matedto) |
| | | public async Task AddMate(MaterialsDto matedto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | await _mate.AddMate(matedto); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | //获取当前操作用户id |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | int uid = Convert.ToInt32(userId); |
| | | //创建人 |
| | | matedto.CreateUser = uid; |
| | | //新增 |
| | | int i = await _mate.AddMate(matedto); |
| | | |
| | | await _operation.InsertOperation("基础信息", "物料管理", matedto.SkuNo, "添加", "添加物料信息 物料号:" + matedto.SkuNo, uid); |
| | | return Ok(new { data = i, code = 0, msg = "成功" }); |
| | | |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | return Ok(new { code = 1, msg = "新增物料异常" + ex.Message }); |
| | | } |
| | | ParentName = "基础信息", |
| | | MenuName = "物料管理", |
| | | FkNo = matedto.SkuNo, |
| | | TypeName = "添加", |
| | | Msg = "添加物料信息 物料号:" + matedto.SkuNo |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpGet] |
| | | public async Task<IActionResult> DelMate(int id) |
| | | public async Task DelMate(int id) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | SysMaterials mate = await _mate.GetMateById(id); |
| | | await _mate.DelMate(mate); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | SysMaterials mate = _mate.GetMateById(id); |
| | | //获取当前操作用户id |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | int uid = Convert.ToInt32(userId); |
| | | mate.UpdateUser = uid; |
| | | //删除 |
| | | int i = await _mate.DelMate(mate); |
| | | //判断是否删除成功 |
| | | if (i == 0) |
| | | { |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 1, |
| | | msg = "失败" |
| | | ParentName = "基础信息", |
| | | MenuName = "物料管理", |
| | | FkNo = mate.SkuNo, |
| | | TypeName = "删除", |
| | | Msg = "删除物料信息 物料号:" + mate.SkuNo |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | await _operation.InsertOperation("基础信息", "物料管理", mate.SkuNo, "删除", "删除物料信息 物料号:" + mate.SkuNo, uid); |
| | | return Ok(new |
| | | { |
| | | data = i, |
| | | code = 0, |
| | | msg = "成功" |
| | | }); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异常 |
| | | throw new Exception("删除物料异常", ex); |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception">捕获异常</exception> |
| | | [HttpPost] |
| | | public async Task<IActionResult> ExitMate(MaterialsDto matedto) |
| | | public async Task ExitMate(MaterialsDto matedto) |
| | | { |
| | | //捕获异常 |
| | | try |
| | | await _mate.ExitMate(matedto); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | //获取当前操作用户id |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | var userId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | int uid = Convert.ToInt32(userId); |
| | | //更新人 |
| | | matedto.UpdateUser = uid; |
| | | //编辑 |
| | | int i = await _mate.ExitMate(matedto); |
| | | //判断是否编辑成功 |
| | | if (i == 0) |
| | | { |
| | | return Ok(new { data = i, code = 1, msg = "修改失败" }); |
| | | } |
| | | else if (i == 2) |
| | | { |
| | | return Ok(new { data = i, code = 2, msg = "临期天数不可大于365及小于30" }); |
| | | } |
| | | //else if (i == 4) |
| | | //{ |
| | | // return Ok(new { data = i, code = 4, msg = "低库存不可高于1000" }); |
| | | //} |
| | | else |
| | | { |
| | | await _operation.InsertOperation("基础信息", "物料管理", matedto.SkuNo, "修改", "编辑物料信息 物料号:" + matedto.SkuNo, uid); |
| | | return Ok(new { data = i, code = 0, msg = "修改成功" }); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | //抛出异 |
| | | return Ok(new { code = 1, msg = "编辑物料异常" + ex.Message }); |
| | | } |
| | | ParentName = "基础信息", |
| | | MenuName = "物料管理", |
| | | FkNo = matedto.SkuNo, |
| | | TypeName = "编辑", |
| | | Msg = "编辑物料信息 物料号:" + matedto.SkuNo |
| | | }); |
| | | } |
| | | |
| | | #region 包装 单位 |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetUnitList() |
| | | public async Task<List<SysUnit>> GetUnitList() |
| | | { |
| | | List<SysUnit> unitlist = _mate.GetUnitList(); |
| | | return Ok(new |
| | | { |
| | | data = unitlist, |
| | | code = 0, |
| | | msg = "成功" |
| | | }); |
| | | return await _mate.GetUnitList(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetPackagList() |
| | | public async Task<List<SysPackag>> GetPackagList() |
| | | { |
| | | List<SysPackag> packlist = _mate.GetPackagList(); |
| | | return Ok(new |
| | | { |
| | | data = packlist, |
| | | code = 0, |
| | | msg = "成功" |
| | | }); |
| | | return await _mate.GetPackagList(); |
| | | } |
| | | |
| | | #endregion |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult GetCustomerList(GetCustomerVm model) |
| | | public async Task<SqlSugarPagedList<CustomerDto>> GetCustomerList(GetCustomerVm model) |
| | | { |
| | | try |
| | | { |
| | | var bolls = _customerSvc.GetCustomerList(model.CustomerNo, model.CustomerName, model.Type, model.LinkMan, model.Phone, model.Page, model.Limit, out int count); |
| | | |
| | | return Ok(new { code = 0, count, msg = "客户信息", data = bolls }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | RefAsync<int> count = new RefAsync<int>(); |
| | | var bolls = await _customerSvc.GetCustomerList(model.CustomerNo, model.CustomerName, model.Type, model.LinkMan, model.Phone, model.Page, model.Limit, count); |
| | | return new SqlSugarPagedList<CustomerDto>() { Items = bolls, Total = bolls.Count }; |
| | | } |
| | | /// <summary> |
| | | /// 查询单条客户信息 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult GetCustomer(IdVm model) |
| | | public async Task<SysCustomer> GetCustomer(IdVm model) |
| | | { |
| | | try |
| | | { |
| | | var bolls = _customerSvc.GetCustomer(model.Id); |
| | | |
| | | return Ok(new { code = 0, count = 0, msg = "客户信息", data = bolls }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | return await _customerSvc.GetCustomer(model.Id); |
| | | } |
| | | /// <summary> |
| | | /// 查询全部客户信息 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetCustomerSelect() |
| | | public async Task<List<SysCustomer>> GetCustomerSelect() |
| | | { |
| | | try |
| | | { |
| | | var bolls = _customerSvc.GetCustomerSelect(); |
| | | |
| | | return Ok(new { code = 0, count = 0, msg = "客户信息", data = bolls }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | return await _customerSvc.GetCustomerSelect(); |
| | | } |
| | | /// <summary> |
| | | /// 添加客户信息 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult AddCustomer(AddCustomerVm model) |
| | | [UnitOfWork] |
| | | public async Task AddCustomer(AddCustomerVm 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 = "为获取到当前操作人信息" }); |
| | | } |
| | | |
| | | var bolls = _customerSvc.AddCustomer(model.CustomerNo, model.CustomerName, model.Type, model.Address, model.LinkMan, model.Phone, model.BankAccount, model.CreditRating, model.Demo, int.Parse(userId)); |
| | | |
| | | if (bolls) |
| | | { |
| | | _operation.InsertOperation("基础信息", "客户管理", model.CustomerNo, "添加", "添加客户信息 客户号:" + model.CustomerNo, Convert.ToInt32(userId)); |
| | | return Ok(new { code = 0, msg = "添加成功" }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = "添加失败" }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | await _customerSvc.AddCustomer(model.CustomerNo, model.CustomerName, model.Type, model.Address, model.LinkMan, model.Phone, model.BankAccount, model.CreditRating, model.Demo, _userManager.UserId); |
| | | await _operation.InsertOperation("基础信息", "客户管理", model.CustomerNo, "添加", "添加客户信息 客户号:" + model.CustomerNo, _userManager.UserId); |
| | | } |
| | | /// <summary> |
| | | /// 编辑客户信息 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult EditCustomer(EditCustomerVm model) |
| | | [UnitOfWork] |
| | | public async Task EditCustomer(EditCustomerVm 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 = "为获取到当前操作人信息" }); |
| | | } |
| | | |
| | | var bolls = _customerSvc.EditCustomer(model.Id, model.CustomerNo, model.CustomerName, model.Type, model.Address, model.LinkMan, model.Phone, model.BankAccount, model.CreditRating, model.Demo, int.Parse(userId)); |
| | | |
| | | if (bolls) |
| | | { |
| | | _operation.InsertOperation("基础信息", "客户管理", model.CustomerNo, "编辑", "编辑客户信息 客户号:" + model.CustomerNo, Convert.ToInt32(userId)); |
| | | return Ok(new { code = 0, msg = "编辑成功" }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = "编辑失败" }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | await _customerSvc.EditCustomer(model.Id, model.CustomerNo, model.CustomerName, model.Type, model.Address, model.LinkMan, model.Phone, model.BankAccount, model.CreditRating, model.Demo, _userManager.UserId); |
| | | await _operation.InsertOperation("基础信息", "客户管理", model.CustomerNo, "编辑", "编辑客户信息 客户号:" + model.CustomerNo, _userManager.UserId); |
| | | } |
| | | /// <summary> |
| | | /// 删除客户信息 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult DelCustomer(IdVm model) |
| | | [UnitOfWork] |
| | | public async Task DelCustomer(IdVm model) |
| | | { |
| | | try |
| | | { |
| | | SysCustomer customer = _customerSvc.GetCustomer(model.Id); |
| | | //获取当前登录的用户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 = "为获取到当前操作人信息" }); |
| | | } |
| | | |
| | | var bolls = _customerSvc.DelCustomer(model.Id, int.Parse(userId)); |
| | | if (bolls) |
| | | { |
| | | _operation.InsertOperation("基础信息", "客户管理", customer.CustomerNo, "删除", "删除客户信息 客户号:" + customer.CustomerNo, Convert.ToInt32(userId)); |
| | | return Ok(new { code = 0, msg = "删除成功" }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = "删除失败" }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | SysCustomer customer = await _customerSvc.GetCustomer(model.Id); |
| | | var bolls = await _customerSvc.DelCustomer(model.Id, _userManager.UserId); |
| | | await _operation.InsertOperation("基础信息", "客户管理", customer.CustomerNo, "删除", "删除客户信息 客户号:" + customer.CustomerNo, _userManager.UserId); |
| | | } |
| | | /// <summary> |
| | | /// 删除客户信息(多删除) |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult DelsCustomer(IdVm model) |
| | | [UnitOfWork] |
| | | public async Task DelsCustomer(IdVm 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 = "为获取到当前操作人信息" }); |
| | | } |
| | | |
| | | var bolls = _customerSvc.DelsCustomer(model.Ids, int.Parse(userId)); |
| | | if (bolls) |
| | | { |
| | | return Ok(new { code = 0, msg = "删除成功" }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = "删除失败" }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | await _customerSvc.DelsCustomer(model.Ids, _userManager.UserId); |
| | | } |
| | | #endregion |
| | | |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult GetLogisticsInfoList(GetLogisticsInfoVm model) |
| | | public async Task<SqlSugarPagedList<LogisticsInfoDto>> GetLogisticsInfoList(GetLogisticsInfoVm model) |
| | | { |
| | | try |
| | | { |
| | | var bolls = _logisticsSvc.GetLogisticsInfoList(model.CarrierName, model.LinkMan, model.Phone, model.LicensePlate, model.Type, model.Page, model.Limit, out int count); |
| | | |
| | | return Ok(new { code = 0, count, msg = "物流信息", data = bolls }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | RefAsync<int> count = new RefAsync<int>(); |
| | | var list = await _logisticsSvc.GetLogisticsInfoList(model.CarrierName, model.LinkMan, model.Phone, model.LicensePlate, model.Type, model.Page, model.Limit, count); |
| | | return new SqlSugarPagedList<LogisticsInfoDto>() { Items = list, Total = count }; |
| | | } |
| | | /// <summary> |
| | | /// 查询单条物流信息 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult GetLogisticsInfo(IdVm model) |
| | | public async Task<SysLogisticsInfo> GetLogisticsInfo(IdVm model) |
| | | { |
| | | try |
| | | { |
| | | var bolls = _logisticsSvc.GetLogisticsInfo(model.Id); |
| | | |
| | | return Ok(new { code = 0, data = bolls }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | return await _logisticsSvc.GetLogisticsInfo(model.Id); |
| | | } |
| | | /// <summary> |
| | | /// 查询全部物流信息 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetLogisticsInfoSelect() |
| | | public async Task<List<SysLogisticsInfo>> GetLogisticsInfoSelect() |
| | | { |
| | | try |
| | | { |
| | | var bolls = _logisticsSvc.GetLogisticsInfoSelect(); |
| | | |
| | | return Ok(new { code = 0, data = bolls }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | return await _logisticsSvc.GetLogisticsInfoSelect(); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult AddLogisticsInfo(AddLogisticsInfoVm model) |
| | | [UnitOfWork] |
| | | public async Task AddLogisticsInfo(AddLogisticsInfoVm 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 = "为获取到当前操作人信息" }); |
| | | } |
| | | |
| | | var bolls = _logisticsSvc.AddLogisticsInfo(model, int.Parse(userId)); |
| | | |
| | | if (bolls) |
| | | { |
| | | _operation.InsertOperation("基础信息", "物流管理", model.CarrierName, "添加", "添加物流信息 公司名称:" + model.CarrierName, Convert.ToInt32(userId)); |
| | | return Ok(new { code = 0, msg = "添加成功" }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = "添加失败" }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | await _logisticsSvc.AddLogisticsInfo(model, _userManager.UserId); |
| | | await _operation.InsertOperation("基础信息", "物流管理", model.CarrierName, "添加", "添加物流信息 公司名称:" + model.CarrierName, _userManager.UserId); |
| | | } |
| | | /// <summary> |
| | | /// 编辑物流信息 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult EditLogisticsInfo(EditLogisticsInfoVm model) |
| | | [UnitOfWork] |
| | | public async Task EditLogisticsInfo(EditLogisticsInfoVm 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 = "为获取到当前操作人信息" }); |
| | | } |
| | | |
| | | var bolls = _logisticsSvc.EditLogisticsInfo(model, int.Parse(userId)); |
| | | |
| | | if (bolls) |
| | | { |
| | | _operation.InsertOperation("基础信息", "物流管理", model.CarrierName, "编辑", "编辑物流信息 公司名称:" + model.CarrierName, Convert.ToInt32(userId)); |
| | | return Ok(new { code = 0, msg = "编辑成功" }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = "编辑失败" }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | await _logisticsSvc.EditLogisticsInfo(model, _userManager.UserId); |
| | | await _operation.InsertOperation("基础信息", "物流管理", model.CarrierName, "编辑", "编辑物流信息 公司名称:" + model.CarrierName, _userManager.UserId); |
| | | } |
| | | /// <summary> |
| | | /// 删除物流信息 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult DelLogisticsInfo(IdVm model) |
| | | [UnitOfWork] |
| | | public async Task DelLogisticsInfo(IdVm model) |
| | | { |
| | | try |
| | | { |
| | | SysLogisticsInfo logisit = _logisticsSvc.GetLogisticsInfo(model.Id); |
| | | //获取当前登录的用户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 = "为获取到当前操作人信息" }); |
| | | } |
| | | |
| | | var bolls = _logisticsSvc.DelLogisticsInfo(model.Id, int.Parse(userId)); |
| | | if (bolls) |
| | | { |
| | | |
| | | _operation.InsertOperation("基础信息", "物流管理", logisit.CarrierName, "删除", "删除物流信息 公司名称:" + logisit.CarrierName, Convert.ToInt32(userId)); |
| | | return Ok(new { code = 0, msg = "删除成功" }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = "删除失败" }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | await _logisticsSvc.DelLogisticsInfo(model.Id, _userManager.UserId); |
| | | SysLogisticsInfo logisit = await _logisticsSvc.GetLogisticsInfo(model.Id); |
| | | await _operation.InsertOperation("基础信息", "物流管理", logisit.CarrierName, "删除", "删除物流信息 公司名称:" + logisit.CarrierName, _userManager.UserId); |
| | | } |
| | | /// <summary> |
| | | /// 删除物流信息(多条信息) |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult DelsLogisticsInfo(IdVm model) |
| | | [UnitOfWork] |
| | | public async Task DelsLogisticsInfo(IdVm 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 = "为获取到当前操作人信息" }); |
| | | } |
| | | |
| | | var bolls = _logisticsSvc.DelsLogisticsInfo(model.Ids, int.Parse(userId)); |
| | | if (bolls) |
| | | { |
| | | return Ok(new { code = 0, msg = "删除成功" }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = "删除失败" }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | await _logisticsSvc.DelsLogisticsInfo(model.Ids, _userManager.UserId); |
| | | } |
| | | #endregion |
| | | |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult GetUnitList(GetUnitVm model) |
| | | public async Task<SqlSugarPagedList<UnitDto>> GetUnitList(GetUnitVm model) |
| | | { |
| | | try |
| | | { |
| | | var list = _unitSvc.GetUnitList(model.UnitNo, model.UnitName, model.Page, model.Limit, out int count); |
| | | |
| | | return Ok(new { code = 0, count, msg = "物流信息", data = list }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | RefAsync<int> count = new RefAsync<int>(); |
| | | var list = await _unitSvc.GetUnitList(model.UnitNo, model.UnitName, model.Page, model.Limit, count); |
| | | return new SqlSugarPagedList<UnitDto>() { Items = list, Total = count }; |
| | | } |
| | | /// <summary> |
| | | /// 查询单条单位信息 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult GetUnit(IdVm model) |
| | | public async Task<SysUnit> GetUnit(IdVm model) |
| | | { |
| | | try |
| | | { |
| | | var data = _unitSvc.GetUnit(model.Id); |
| | | if (data != null) |
| | | { |
| | | return Ok(new { code = 0, data }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, data = "未查询到物流信息" }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | return await _unitSvc.GetUnit(model.Id); |
| | | } |
| | | /// <summary> |
| | | /// 添加计量信息 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult AddUnit(AddEditUnitVm model) |
| | | [UnitOfWork] |
| | | public async Task AddUnit(AddEditUnitVm model) |
| | | { |
| | | if (ModelState.IsValid) |
| | | { |
| | | 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 = "为获取到当前操作人信息" }); |
| | | } |
| | | |
| | | var bolls = _unitSvc.AddUnit(model.UnitName, model.Abbrev, int.Parse(userId)); |
| | | |
| | | if (bolls) |
| | | { |
| | | return Ok(new { code = 0, msg = "添加成功" }); |
| | | await _unitSvc.AddUnit(model.UnitName, model.Abbrev, _userManager.UserId); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = "添加失败" }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = "数据格式错误" }); |
| | | throw Oops.Bah("数据格式错误"); |
| | | } |
| | | |
| | | } |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult EditUnit(AddEditUnitVm model) |
| | | [UnitOfWork] |
| | | public async Task EditUnit(AddEditUnitVm model) |
| | | { |
| | | if (ModelState.IsValid) |
| | | { |
| | | 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 = "为获取到当前操作人信息" }); |
| | | } |
| | | |
| | | var bolls = _unitSvc.EditUnit(model.Id, model.UnitName, model.Abbrev, int.Parse(userId)); |
| | | |
| | | if (bolls) |
| | | { |
| | | SysUnit unit = _unitSvc.GetUnit(model.Id); |
| | | _operation.InsertOperation("基础信息", "计量单位", unit.UnitNo, "编辑", "编辑计量单位 单位名称:" + unit.UnitNo, Convert.ToInt32(userId)); |
| | | return Ok(new { code = 0, msg = "编辑成功" }); |
| | | await _unitSvc.EditUnit(model.Id, model.UnitName, model.Abbrev, _userManager.UserId); |
| | | SysUnit unit = await _unitSvc.GetUnit(model.Id); |
| | | await _operation.InsertOperation("基础信息", "计量单位", unit.UnitNo, "编辑", "编辑计量单位 单位名称:" + unit.UnitNo, _userManager.UserId); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = "编辑失败" }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = "数据格式错误" }); |
| | | throw Oops.Bah("数据格式错误"); |
| | | } |
| | | |
| | | } |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult DelUnit(IdVm model) |
| | | [UnitOfWork] |
| | | public async Task DelUnit(IdVm 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 = "为获取到当前操作人信息" }); |
| | | } |
| | | var bolls = _unitSvc.DelUnit(model.Id, int.Parse(userId)); |
| | | if (bolls) |
| | | { |
| | | return Ok(new { code = 0, msg = "删除成功" }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = "删除失败" }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | await _unitSvc.DelUnit(model.Id, _userManager.UserId); |
| | | } |
| | | /// <summary> |
| | | /// 删除计量单位信息(多删除) |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult DelsUnit(IdVm model) |
| | | [UnitOfWork] |
| | | public async Task DelsUnit(IdVm 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 = "为获取到当前操作人信息" }); |
| | | } |
| | | var bolls = _unitSvc.DelsUnit(model.Ids, int.Parse(userId)); |
| | | if (bolls) |
| | | { |
| | | return Ok(new { code = 0, msg = "删除成功" }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = "删除失败" }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | var bolls = await _unitSvc.DelsUnit(model.Ids, _userManager.UserId); |
| | | } |
| | | #endregion |
| | | |
| | | #region 包装管理 |
| | | private string UserId; |
| | | //public BasisController() |
| | | //{ |
| | | // var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | // if (claimsIdentity == null) |
| | | // { |
| | | // throw new Exception("未获取到用户信息"); |
| | | // } |
| | | // UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | // if (string.IsNullOrWhiteSpace(UserId)) |
| | | // { |
| | | // throw new Exception("未获取到用户信息"); |
| | | // } |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// 查询包装信息 |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult GetPackagList(GetPackagVm model) |
| | | public async Task<SqlSugarPagedList<PackagDto>> GetPackagList(GetPackagVm model) |
| | | { |
| | | try |
| | | { |
| | | var list = _packagSvc.GetPackagList(model.PackagNo, model.PackagName, model.Level, model.Page, model.Limit, out int count); |
| | | |
| | | return Ok(new { code = 0, count, msg = "物流信息", data = list }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | RefAsync<int> count = new RefAsync<int>(); |
| | | var list = await _packagSvc.GetPackagList(model.PackagNo, model.PackagName, model.Level, model.Page, model.Limit, count); |
| | | return new SqlSugarPagedList<PackagDto> { Items = list, Total = count }; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="id">包装id</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | public IActionResult GetPackagById(int id) |
| | | public async Task<SysPackag> GetPackagById(int id) |
| | | { |
| | | SysPackag packag = _packagSvc.GetPackagById(id); |
| | | return Ok(new |
| | | { |
| | | data = packag, |
| | | code = 0, |
| | | msg = "成功" |
| | | }); |
| | | return await _packagSvc.GetPackagById(id); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="model">包装信息</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult AddPackag(AddEditPackagVm model) |
| | | [UnitOfWork] |
| | | public async Task AddPackag(AddEditPackagVm model) |
| | | { |
| | | try |
| | | { |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | if (claimsIdentity == null) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | if (string.IsNullOrWhiteSpace(UserId)) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | |
| | | model.CreateUser = int.Parse(UserId); |
| | | int i = _packagSvc.AddPackag(model); |
| | | |
| | | if (i == 1) |
| | | { |
| | | _operation.InsertOperation("基础信息", "包装管理", model.PackagNo, "添加", "添加包装信息 包装编号:" + model.PackagNo, Convert.ToInt32(UserId)); |
| | | return Ok(new { code = 0, msg = "添加成功" }); |
| | | } |
| | | else if (i > 1) |
| | | { |
| | | return Ok(new { code = i, msg = "包装等级不可越级添加" }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = "添加失败" }); |
| | | } |
| | | } |
| | | |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new |
| | | { |
| | | code = 1, |
| | | msg = e.Message |
| | | }); |
| | | } |
| | | await _packagSvc.AddPackag(model); |
| | | await _operation.InsertOperation("基础信息", "包装管理", model.PackagNo, "添加", "添加包装信息 包装编号:" + model.PackagNo, _userManager.UserId); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="model">包装信息</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult EditPackag(AddEditPackagVm model) |
| | | [UnitOfWork] |
| | | public async Task EditPackag(AddEditPackagVm model) |
| | | { |
| | | try |
| | | { |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | if (claimsIdentity == null) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | if (string.IsNullOrWhiteSpace(UserId)) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | |
| | | model.CreateUser = int.Parse(UserId); |
| | | int i = _packagSvc.EditPackag(model); |
| | | |
| | | if (i == 1) |
| | | { |
| | | _operation.InsertOperation("基础信息", "包装管理", model.PackagNo, "编辑", "编辑包装信息 包装编号:" + model.PackagNo, Convert.ToInt32(UserId)); |
| | | return Ok(new { code = 0, msg = "编辑成功" }); |
| | | } |
| | | if (i == 2) |
| | | { |
| | | return Ok(new { code = i, msg = "包装等级不可越级修改 请重新输入" }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = "编辑失败" }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | await _packagSvc.EditPackag(model); |
| | | await _operation.InsertOperation("基础信息", "包装管理", model.PackagNo, "编辑", "编辑包装信息 包装编号:" + model.PackagNo, _userManager.UserId); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult DelPackag(AddEditPackagVm model) |
| | | [UnitOfWork] |
| | | public async Task DelPackag(AddEditPackagVm model) |
| | | { |
| | | try |
| | | { |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | if (claimsIdentity == null) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | if (string.IsNullOrWhiteSpace(UserId)) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | |
| | | var bolls = _packagSvc.DelPackag(model.Id, int.Parse(UserId)); |
| | | |
| | | if (bolls) |
| | | { |
| | | _operation.InsertOperation("基础信息", "包装管理", model.PackagNo, "删除", "删除包装信息 包装编号:" + model.PackagNo, Convert.ToInt32(UserId)); |
| | | return Ok(new { code = 0, msg = "删除成功" }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = "删除失败" }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | await _packagSvc.DelPackag(model.Id, _userManager.UserId); |
| | | await _operation.InsertOperation("基础信息", "包装管理", model.PackagNo, "删除", "删除包装信息 包装编号:" + model.PackagNo, _userManager.UserId); |
| | | } |
| | | #endregion |
| | | |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult GetInterfaceList(InterfaceVm model) |
| | | public async Task<SqlSugarPagedList<InterfaceDto>> GetInterfaceList(InterfaceVm model) |
| | | { |
| | | try |
| | | { |
| | | var models = _interface.GetInterfaceList(model, out int count); |
| | | |
| | | return Ok(new { code = 0, count, msg = "接口列表", data = models }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | return await _interface.GetInterfaceList(model); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult GetInterfaceDetailList(InterfaceDetailVm model) |
| | | public async Task<SqlSugarPagedList<InterfaceDetailDto>> GetInterfaceDetailList(InterfaceDetailVm model) |
| | | { |
| | | try |
| | | { |
| | | var models = _interface.GetInterfaceDetailList(model, out int count); |
| | | |
| | | return Ok(new { code = 0, count, msg = "接口明细列表", data = models }); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | return await _interface.GetInterfaceDetailList(model); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult AddInterface(InterfaceVm model) |
| | | [UnitOfWork] |
| | | public async Task AddInterface(InterfaceVm model) |
| | | { |
| | | try |
| | | await _interface.AddInterface(model); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | if (claimsIdentity == null) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | if (string.IsNullOrWhiteSpace(UserId)) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | |
| | | model.CreateUser = int.Parse(UserId); |
| | | string strMesage = _interface.AddInterface(model); |
| | | |
| | | if (strMesage == "") |
| | | { |
| | | return Ok(new { code = 0, msg = "添加成功" }); |
| | | } |
| | | if (strMesage.Contains("-1")) |
| | | { |
| | | return Ok(new { code = 1, msg = strMesage }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 0, msg = strMesage }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | ParentName = "系统设置", |
| | | MenuName = "接口管理", |
| | | FkNo = model.InterfaceNo, |
| | | TypeName = "添加", |
| | | Msg = $"添加了接口编号为{model.InterfaceNo}的接口信息" |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult EditInterface(InterfaceVm model) |
| | | [UnitOfWork] |
| | | public async Task EditInterface(InterfaceVm model) |
| | | { |
| | | try |
| | | await _interface.EditInterface(model); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | if (claimsIdentity == null) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | if (string.IsNullOrWhiteSpace(UserId)) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | |
| | | model.CreateUser = int.Parse(UserId); |
| | | string strMesage = _interface.EditInterface(model); |
| | | |
| | | if (strMesage == "") |
| | | { |
| | | return Ok(new { code = 0, msg = "编辑成功" }); |
| | | } |
| | | if (strMesage.Contains("-1")) |
| | | { |
| | | return Ok(new { code = 0, msg = "部分成功" }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = strMesage }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | ParentName = "系统设置", |
| | | MenuName = "接口管理", |
| | | FkNo = model.InterfaceNo, |
| | | TypeName = "编辑", |
| | | Msg = $"编辑了接口编号为{model.InterfaceNo}的接口信息" |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult DelInterface(InterfaceVm model) |
| | | [UnitOfWork] |
| | | public async Task DelInterface(InterfaceVm model) |
| | | { |
| | | try |
| | | await _interface.DelInterface(model); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | if (claimsIdentity == null) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | if (string.IsNullOrWhiteSpace(UserId)) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | |
| | | model.CreateUser = int.Parse(UserId); |
| | | string strMesage = _interface.DelInterface(model); |
| | | |
| | | if (strMesage == "") |
| | | { |
| | | return Ok(new { code = 0, msg = "删除成功" }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = strMesage }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | ParentName = "系统设置", |
| | | MenuName = "接口管理", |
| | | FkNo = model.InterfaceNo, |
| | | TypeName = "编辑", |
| | | Msg = $"删除了接口编号为{model.InterfaceNo}的接口信息" |
| | | }); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <param name="model"></param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult DelInterfaceDetail(InterfaceDetailVm model) |
| | | [UnitOfWork] |
| | | public async Task DelInterfaceDetail(InterfaceDetailVm model) |
| | | { |
| | | try |
| | | await _interface.DelInterfaceDetail(model); |
| | | await _operation.InsertOperation(new OperationInputVm() |
| | | { |
| | | var claimsIdentity = this.User.Identity as ClaimsIdentity; |
| | | if (claimsIdentity == null) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | string UserId = claimsIdentity.FindFirst(ClaimTypes.Name)?.Value; |
| | | if (string.IsNullOrWhiteSpace(UserId)) |
| | | { |
| | | throw new Exception("未获取到用户信息"); |
| | | } |
| | | |
| | | model.CreateUser = int.Parse(UserId); |
| | | string strMesage = _interface.DelInterfaceDetail(model); |
| | | |
| | | if (strMesage == "") |
| | | { |
| | | return Ok(new { code = 0, msg = "删除成功" }); |
| | | } |
| | | else |
| | | { |
| | | return Ok(new { code = 1, msg = strMesage }); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | return Ok(new { code = 1, msg = e.Message }); |
| | | } |
| | | ParentName = "系统设置", |
| | | MenuName = "接口管理", |
| | | FkNo = model.InterfaceNo, |
| | | TypeName = "编辑", |
| | | Msg = $"删除了接口编号为{model.InterfaceNo}的接口信息,本系统字段为{model.Field}的接口信息" |
| | | }); |
| | | } |
| | | #endregion |
| | | } |
| | |
| | | /// <param name="level">层级</param> |
| | | /// <returns></returns> |
| | | [HttpPost] |
| | | public IActionResult GetMenuList(string MenuName, string pMenuNo, string MenuNo, string level) |
| | | public async Task<IActionResult> GetMenuList(string MenuName, string pMenuNo, string MenuNo, string level) |
| | | { |
| | | //查询菜单信息列表 |
| | | List<FunctionMenuVm> menulist = _menuSvc.GetMenuList(MenuName, pMenuNo, MenuNo, level); |
| | | List<FunctionMenuVm> menulist = await _menuSvc.GetMenuList(MenuName, pMenuNo, MenuNo, level); |
| | | return Ok(new |
| | | { |
| | | data = menulist, |