导出功能及相关优化

master
ZR20090193-陈敬勇 2 years ago
parent bb28d72b6d
commit f1e79c2c96

@ -7,6 +7,7 @@ enum Api {
getUser = '/WxUser/GetUserInfo',
auditUser = '/WxUser/AuditUser',
unAuditUser = '/WxUser/UnAuditUser',
}
export function getUserList(data: API.PageRequest) {
return request<API.DataResult>({
@ -37,3 +38,10 @@ export function auditUser(query: { id: string }) {
params: query,
});
}
export function unAuditUser(query: { id: string }) {
return request<API.DataResult>({
url: Api.unAuditUser,
method: 'get',
params: query,
});
}

@ -71,7 +71,7 @@ const setting: ProjectConfig = {
// Whether to show footer
// 是否显示底部信息 copyright
showFooter: true,
showFooter: false,
// Header configuration
// 头部配置

@ -22,9 +22,9 @@
class="w-1/2 -mt-16 -enter-x"
/>
<div class="mt-10 font-medium text-white -enter-x">
<span class="inline-block mt-4 text-3xl"> {{ t('sys.login.signInTitle') }}</span>
</div>
<!-- <div class="mt-10 font-medium text-white -enter-x">-->
<!-- <span class="inline-block mt-4 text-3xl"> {{ t('sys.login.signInTitle') }}</span>-->
<!-- </div>-->
<!-- <div class="mt-5 font-normal text-white text-md dark:text-gray-500 -enter-x">-->
<!-- {{ t('sys.login.signInDesc') }}-->
<!-- </div>-->

@ -30,7 +30,7 @@
const dictOptions = ref<any[]>([]);
const [registerModal, { openModal }] = useModal();
const [registerPermissionModal, { openModal: openPermissionModal }] = useModal();
const [registerTable, { reload, getForm }] = useTable({
const [registerTable, { reload, getForm, getPaginationRef }] = useTable({
title: '公众号配置列表',
// api: getSysDictTypeList,
api: async (p) => {
@ -41,12 +41,13 @@
});
},
beforeFetch: () => {
var currentPageInfo: any = getPaginationRef();
var data = getForm().getFieldsValue();
const postParam: API.PageRequest = {
queryCondition: '',
pageCondition: {
pageIndex: 1,
pageSize: 10,
pageIndex: currentPageInfo.current,
pageSize: currentPageInfo.pageSize,
sortConditions: [],
},
};
@ -75,7 +76,7 @@
schemas: searchFormSchema,
},
isTreeTable: false,
pagination: false,
pagination: true,
striped: true,
useSearchForm: true,
showTableSetting: true,

@ -65,7 +65,7 @@
import { BasicForm, useForm } from '/@/components/Form/index';
import { formSchema } from './columns';
import ClientSelectModal from './ClientSelectModal.vue';
import { editUser, getUser, auditUser } from '/@/api/wxpublic/wxuser';
import { editUser, getUser, auditUser, unAuditUser } from '/@/api/wxpublic/wxuser';
import { useUserStore } from '/@/store/modules/user';
import { useMessage } from '/@/hooks/web/useMessage';
// import {ADivider, ATextarea} from "../../../../dist/assets/index.eec9d2ff";

@ -9,7 +9,12 @@
>
<BasicForm @register="registerForm">
<template #clientSelectSlot="{ model, field }">
<a-input-search placeholder="请选择客户" v-model:value="model[field]" enter-button @search="onSearch" />
<a-input-search
placeholder="请选择客户"
v-model:value="model[field]"
enter-button
@search="onSearch"
/>
</template>
</BasicForm>
<!--右下角按钮-->
@ -23,6 +28,15 @@
style="margin-right: 0.8rem"
>审核</a-button
>
<a-button
v-show="isUpdate"
@click="handleCancel"
preIcon="mdi:cloud-cancel-outline"
type="warning"
:loading="loading"
style="margin-right: 0.8rem"
>取消审核</a-button
>
<a-button
@click="closeModal"
preIcon="ant-design:close-outlined"
@ -49,7 +63,7 @@
import { BasicForm, useForm } from '/@/components/Form/index';
import { formSchema } from './columns';
import ClientSelectModal from './ClientSelectModal.vue';
import { editUser, getUser, auditUser } from '/@/api/wxpublic/wxuser';
import { editUser, getUser, auditUser, unAuditUser } from '/@/api/wxpublic/wxuser';
import { useUserStore } from '/@/store/modules/user';
import { useMessage } from '/@/hooks/web/useMessage';
// Emits
@ -169,4 +183,35 @@
// loading.value = false;
}
}
async function handleCancel() {
try {
const { createConfirm } = useMessage();
const values = await validate();
const userStore = useUserStore();
const user = userStore.getUserInfo;
values.userName = user.userName;
loading.value = true;
createConfirm({
iconType: 'warning',
title: '确认取消审核',
content: '是否取消审核该单据!!!',
onOk: async () => {
const res: API.DataResult = await unAuditUser({ id: unref(rowId) });
// console.log(res);
if (res.succeeded) {
createMessage.success(res.message);
closeModal();
emit('success');
} else {
createMessage.error(res.message);
}
},
});
loading.value = false;
// exit && closeModal();
} finally {
// loading.value = false;
}
}
</script>

@ -26,7 +26,7 @@
import { columns, searchFormSchema } from './columns';
// const dictOptions = ref<any[]>([]);
const [registerModal, { openModal }] = useModal();
const [registerTable, { reload, getForm }] = useTable({
const [registerTable, { reload, getForm, getPaginationRef }] = useTable({
title: '公众号用户列表',
api: async (p) => {
const res: API.DataResult = await getUserList(p);
@ -36,12 +36,13 @@
});
},
beforeFetch: () => {
var currentPageInfo: any = getPaginationRef();
var data = getForm().getFieldsValue();
const postParam: API.PageRequest = {
queryCondition: '',
pageCondition: {
pageIndex: 1,
pageSize: 10,
pageIndex: currentPageInfo.current,
pageSize: currentPageInfo.pageSize,
sortConditions: [],
},
};
@ -70,7 +71,7 @@
schemas: searchFormSchema,
},
isTreeTable: false,
pagination: false,
pagination: true,
striped: true,
useSearchForm: true,
showTableSetting: true,

@ -217,6 +217,10 @@
<workItem from="1670384470827" duration="5526000" />
<workItem from="1670460532823" duration="2649000" />
<workItem from="1670465623039" duration="9119000" />
<workItem from="1670578771501" duration="862000" />
<workItem from="1670913546007" duration="1620000" />
<workItem from="1672034320128" duration="3155000" />
<workItem from="1672101506325" duration="4882000" />
</task>
<servers />
</component>
@ -309,6 +313,19 @@
</properties>
<option name="timeStamp" value="21" />
</line-breakpoint>
<line-breakpoint enabled="true" type="DotNet Breakpoints">
<url>file://$PROJECT_DIR$/DS.WMS.Core/WxModule/Method/WxQueryService.cs</url>
<line>155</line>
<properties documentPath="D:\Code\DS\WmsSolution\wmsapi-service\DS.WMS.Core\WxModule\Method\WxQueryService.cs" initialLine="151" containingFunctionPresentation="method 'ExportStockList'">
<startOffsets>
<option value="6005" />
</startOffsets>
<endOffsets>
<option value="6036" />
</endOffsets>
</properties>
<option name="timeStamp" value="23" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
<pin-to-top-manager>

@ -554,6 +554,13 @@
<param name="request"></param>
<returns></returns>
</member>
<member name="M:DS.WMS.WebApi.Controllers.WxQueryController.ExportStockList(DS.WMS.Core.WxModule.Dtos.StockQueryModel)">
<summary>
导出库存列表
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="T:DS.WMS.WebApi.Controllers.WxUserController">
<summary>
公众号用户
@ -593,6 +600,13 @@
<param name="id"></param>
<returns></returns>
</member>
<member name="M:DS.WMS.WebApi.Controllers.WxUserController.UnAuditUser(System.String)">
<summary>
取消审核
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:DS.WMS.WebApi.Controllers.WxUserController.GetInfoClientList(DS.Module.Core.PageRequest)">
<summary>
获取客户信息列表

@ -15,6 +15,7 @@
<PackageReference Include="FluentValidation" Version="11.2.2" />
<PackageReference Include="FluentValidation.AspNetCore" Version="11.2.2" />
<PackageReference Include="Mapster" Version="7.3.0" />
<PackageReference Include="MiniExcel" Version="1.29.0" />
<PackageReference Include="SqlSugarCore" Version="5.1.0" />
<PackageReference Include="UAParser" Version="3.1.47" />
</ItemGroup>

@ -11,4 +11,10 @@ public interface IWxQueryService
/// <param name="request"></param>
/// <returns></returns>
DataResult GetStockList(StockQueryModel request);
/// <summary>
/// 导出库存列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
DataResult ExportStockList(StockQueryModel request);
}

@ -40,16 +40,24 @@ public interface IWxUserService
/// <param name="model"></param>
/// <returns></returns>
DataResult WxUserLogin(WxUserLoginInput model);
/// <summary>
/// 获取客户信息列表
/// </summary>
/// <returns></returns>
DataResult<List<InfoClientListViewModel>> GetInfoClientList(PageRequest request);
/// <summary>
/// 审核用户
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
DataResult AuditUser(string id);
/// <summary>
/// 取消审核
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
DataResult UnAuditUser(string id);
}

@ -4,7 +4,9 @@ using DS.Module.User;
using DS.WMS.Core.WxModule.Dtos;
using DS.WMS.Core.WxModule.Entity;
using DS.WMS.Core.WxModule.Interface;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using MiniExcelLibs;
using SqlSugar;
namespace DS.WMS.Core.WxModule.Method;
@ -17,7 +19,7 @@ public class WxQueryService : IWxQueryService
private readonly IServiceProvider _serviceProvider;
private readonly ISqlSugarClient db;
private readonly IUser user;
private readonly IWebHostEnvironment _environment;
/// <summary>
///
/// </summary>
@ -27,6 +29,7 @@ public class WxQueryService : IWxQueryService
_serviceProvider = serviceProvider;
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
user = _serviceProvider.GetRequiredService<IUser>();
_environment = _serviceProvider.GetRequiredService<IWebHostEnvironment>();
}
/// <summary>
@ -85,4 +88,78 @@ public class WxQueryService : IWxQueryService
return DataResult.Failed("非法租户!");
}
}
/// <summary>
/// 导出库存列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public DataResult ExportStockList(StockQueryModel request)
{
var tenantId = user.GetTenantId();
var userId = user.UserId;
//虎鲸
if (tenantId == "1595354960864874496")
{
var HJdb = db.AsTenant().GetConnection(tenantId);
var userinfo = db.Queryable<WxUser>().Where(x => x.Id == userId).First();
if (userinfo.AuditStatus != 1)
{
return DataResult.Failed("用户未审核,请及时联系管理员!");
}
if (userinfo.InfoClient.IsNullOrEmpty())
{
return DataResult.Failed("未指定客户,请及时联系管理员!");
}
var data = HJdb.Queryable<WmsStockTake>()
.Where(x => x.CUSTOMERNAME == userinfo.InfoClient)//查询绑定客户
.WhereIF(!request.BLNO.IsNullOrEmpty(), a => a.BLNO.Contains(request.BLNO.Trim()))
.WhereIF(!request.GOODSNAME.IsNullOrEmpty(), a => a.GOODSNAME.Contains(request.GOODSNAME.Trim()))
.WhereIF(!request.CONTRACTNO.IsNullOrEmpty(), a => a.CONTRACTNO.Contains(request.CONTRACTNO.Trim()))
// .WhereIF(request.StockStatus != 0,
// a => request.StockStatus == 1 ? a.hj_GOODSPACKSTOCK != 0 : a.hj_GOODSPACKSTOCK == 0)
.WhereIF(request.StockStatus == 1,
a => a.hj_GOODSPACKSTOCK != 0)
.WhereIF(request.StockStatus == 2,
a => a.hj_GOODSPACKSTOCK == 0)
.OrderBy(x => x.WMSDATE, OrderByType.Desc)
.Select<WmsStockViewModel>()
.Mapper(it =>
{
//只能写在Select后面
it.KeFaHuo = it.GOODSNUM -it.hj_GOODSPACKPFSL;
})
.ToList();
if (data.Count == 0)
{
return DataResult.Failed("查询数据记录为空!");
}
var filename = Guid.NewGuid() + ".xlsx";
var path = Path.Combine(_environment.WebRootPath, "export/" + filename);
var values = new List<Dictionary<string, object>>();
foreach (var item in data)
{
var info = new Dictionary<string, object>
{
{ "品名", item.GOODSNAME },
{ "提单号", item.BLNO },
{ "合同号", item.CONTRACTNO },
{ "入库件数", item.hj_GOODSPACK },
{ "库存件数", item.hj_GOODSPACKSTOCK },
{ "未完税件数", item.WeiWanShui },
{ "可发货件数", item.KeFaHuo},
};
values.Add(info);
}
MiniExcel.SaveAs(path, values);
return DataResult.Successed("导出成功", filename);
}
else
{
return DataResult.Failed("非法租户!");
}
}
}

@ -94,6 +94,27 @@ public class WxUserService:IWxUserService
db.Updateable(wxUser).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
return DataResult.Successed("审核成功!");
}
/// <summary>
/// 取消审核
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public DataResult UnAuditUser(string id)
{
var wxUser = db.Queryable<WxUser>()
.Where(a => a.Id == id)
.First();
if (wxUser.AuditStatus == 0)
{
return DataResult.Failed("已经取消审核!");
}
wxUser.AuditStatus = 0;
db.Updateable(wxUser).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
return DataResult.Successed("取消审核成功!");
}
/// <summary>
/// 微信用户登录
/// </summary>
@ -168,6 +189,7 @@ public class WxUserService:IWxUserService
else
{
var info = model.MapTo<RegisterUserInput, WxUser>();
info.AuditStatus = 0;
db.Insertable(info).ExecuteCommand();
return DataResult.Successed("注册成功,请等待管理员审核!");
}

@ -554,6 +554,13 @@
<param name="request"></param>
<returns></returns>
</member>
<member name="M:DS.WMS.WebApi.Controllers.WxQueryController.ExportStockList(DS.WMS.Core.WxModule.Dtos.StockQueryModel)">
<summary>
导出库存列表
</summary>
<param name="request"></param>
<returns></returns>
</member>
<member name="T:DS.WMS.WebApi.Controllers.WxUserController">
<summary>
公众号用户
@ -593,6 +600,13 @@
<param name="id"></param>
<returns></returns>
</member>
<member name="M:DS.WMS.WebApi.Controllers.WxUserController.UnAuditUser(System.String)">
<summary>
取消审核
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:DS.WMS.WebApi.Controllers.WxUserController.GetInfoClientList(DS.Module.Core.PageRequest)">
<summary>
获取客户信息列表

@ -33,4 +33,17 @@ public class WxQueryController : ApiController
var res = _invokeService.GetStockList(request);
return res;
}
/// <summary>
/// 导出库存列表
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
[HttpPost]
[Route("ExportStockList")]
public DataResult ExportStockList([FromBody] StockQueryModel request)
{
var res = _invokeService.ExportStockList(request);
return res;
}
}

@ -73,6 +73,18 @@ public class WxUserController : ApiController
return res;
}
/// <summary>
/// 取消审核
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("UnAuditUser")]
public DataResult UnAuditUser([FromQuery] string id)
{
var res = _invokeService.UnAuditUser(id);
return res;
}
/// <summary>
/// 获取客户信息列表
/// </summary>
/// <returns></returns>

@ -2843,3 +2843,26 @@
2022-12-08 12:34:17.1300 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: console
2022-12-08 14:50:36.3069 Info AppDomain Shutting down. LogFactory closing...
2022-12-08 14:50:36.3290 Info LogFactory has been closed.
2022-12-26 16:15:24.1250 Info Message Template Auto Format enabled
2022-12-26 16:15:24.1429 Info Loading assembly: NLog.Web.AspNetCore
2022-12-26 16:15:24.2326 Info Adding target FileTarget(Name=allfile)
2022-12-26 16:15:24.2326 Info Adding target FileTarget(Name=ownFile-web)
2022-12-26 16:15:24.2536 Info Adding target ColoredConsoleTarget(Name=console)
2022-12-26 16:15:24.2957 Info Validating config: TargetNames=allfile, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\WmsSolution\wmsapi-service\DS.WMS.WebApi\bin\Debug\net6.0\nlog.config
2022-12-26 16:15:24.2957 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: console
2022-12-26 18:16:08.7622 Info AppDomain Shutting down. LogFactory closing...
2022-12-26 18:16:08.7832 Info LogFactory has been closed.
2022-12-27 08:59:28.3615 Info Message Template Auto Format enabled
2022-12-27 08:59:28.4052 Info Loading assembly: NLog.Web.AspNetCore
2022-12-27 08:59:28.5267 Info Adding target FileTarget(Name=allfile)
2022-12-27 08:59:28.5267 Info Adding target FileTarget(Name=ownFile-web)
2022-12-27 08:59:28.5496 Info Adding target ColoredConsoleTarget(Name=console)
2022-12-27 08:59:28.5875 Info Validating config: TargetNames=allfile, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\WmsSolution\wmsapi-service\DS.WMS.WebApi\bin\Debug\net6.0\nlog.config
2022-12-27 08:59:28.6047 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: console
2022-12-27 11:11:17.9952 Info Message Template Auto Format enabled
2022-12-27 11:11:18.0301 Info Loading assembly: NLog.Web.AspNetCore
2022-12-27 11:11:18.2323 Info Adding target FileTarget(Name=allfile)
2022-12-27 11:11:18.2323 Info Adding target FileTarget(Name=ownFile-web)
2022-12-27 11:11:18.2795 Info Adding target ColoredConsoleTarget(Name=console)
2022-12-27 11:11:18.3632 Info Validating config: TargetNames=allfile, ownFile-web, ConfigItems=54, FilePath=D:\Code\DS\WmsSolution\wmsapi-service\DS.WMS.WebApi\bin\Debug\net6.0\nlog.config
2022-12-27 11:11:18.3855 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: console

@ -67,18 +67,18 @@ if (!policyName.IsNullOrEmpty())
app.UseRouting();
// app.UseStaticFiles();
app.UseStaticFiles();
//文件
app.UseStaticFiles(new StaticFileOptions
{
//FileProvider = new PhysicalFileProvider(Directory.GetCurrentDirectory()),
//设置不限制content-type 该设置可以下载所有类型的文件,但是不建议这么设置,因为不安全
//下面设置可以下载apk和nupkg类型的文件
ContentTypeProvider = new FileExtensionContentTypeProvider(new Dictionary<string, string>
{
{ ".apk", "application/vnd.android.package-archive" }
})
});
//app.UseStaticFiles(new StaticFileOptions
//{
// //FileProvider = new PhysicalFileProvider(Directory.GetCurrentDirectory()),
// //设置不限制content-type 该设置可以下载所有类型的文件,但是不建议这么设置,因为不安全
// //下面设置可以下载apk和nupkg类型的文件
// ContentTypeProvider = new FileExtensionContentTypeProvider(new Dictionary<string, string>
// {
// { ".apk", "application/vnd.android.package-archive" }
// })
//});
ServiceLocator.Instance = app.Services;
ServiceLocator.ApplicationBuilder = app;
// 先开启认证

Loading…
Cancel
Save