heshaofeng
2025-11-27 a118d7fe06475cf28efc6b565348933592278c5e
代码提交
已添加1个文件
已修改2个文件
39 ■■■■ 文件已修改
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Core/Helper/SqlSugarHelper.cs 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Core/Helper/SqlSugarHelper.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,29 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.DB;
using WIDESEA_Core.Seed;
namespace WIDESEA_Core.Helper
{
    public class SqlSugarHelper
    {
        //多库情况下使用说明:
        //如果是固定多库可以传 new SqlSugarScope(List<ConnectionConfig>,db=>{}) æ–‡æ¡£ï¼šå¤šç§Ÿæˆ·
        //如果是不固定多库 å¯ä»¥çœ‹æ–‡æ¡£Saas分库
        //用单例模式
        public static SqlSugarScope DbWMS = new SqlSugarScope(new ConnectionConfig()
        {
            ConnectionString = DBContext.GetMainConnectionDb().Connection,
            //ConnectionString = AppSettings.app(MainDb.ConnectionStringWCS),
            DbType = DbType.SqlServer,//数据库类型
            IsAutoCloseConnection = true //不设成true要手动close
        },
      db =>
      {
      });
    }
}
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs
@@ -22,16 +22,16 @@
        public IRepository<Dt_StockInfo> Repository => BaseDal;
        private readonly IRepository<Dt_StockInfoDetail> _stockInfoDetailRepository;
        private readonly IOutboundOrderService _outboundOrderService;
        private readonly IOutboundOrderDetailService _outboundOrderDetailService;
        //private readonly IOutboundOrderDetailService _outboundOrderDetailService;
        private readonly ILocationInfoService _locationInfoService;
        public StockInfoService(IRepository<Dt_StockInfo> BaseDal, IMapper mapper, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRecordService recordService, ILocationInfoService locationInfoService, IOutboundOrderService outboundOrderService, IOutboundOrderDetailService outboundOrderDetailService) : base(BaseDal)
        public StockInfoService(IRepository<Dt_StockInfo> BaseDal, IMapper mapper, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IRecordService recordService, ILocationInfoService locationInfoService, IOutboundOrderService outboundOrderService) : base(BaseDal)
        {
            _mapper = mapper;
            _stockInfoDetailRepository = stockInfoDetailRepository;
            _recordService = recordService;
            _locationInfoService = locationInfoService;
            _outboundOrderService = outboundOrderService;
            _outboundOrderDetailService = outboundOrderDetailService;
            //_outboundOrderDetailService = outboundOrderDetailService;
        }
        /// <summary>
@@ -289,7 +289,7 @@
            }
            // èŽ·å–å‡ºåº“å•æ˜Žç»†ï¼Œç”¨äºŽç¡®å®šéœ€è¦çš„æ‰¹æ¬¡å’Œä¾›åº”å•†
            var orderDetails = _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>().Where(x => x.OrderId == orderId && x.MaterielCode == materielCode).ToList();
            var orderDetails = SqlSugarHelper.DbWMS.Queryable<Dt_OutboundOrderDetail>().Where(x => x.OrderId == orderId && x.MaterielCode == materielCode).ToList();
            if (!orderDetails.Any())
            {
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs
@@ -25,7 +25,7 @@
        /// <param name="orderId"></param>
        /// <param name="materielCode"></param>
        /// <returns></returns>
        [HttpPost, HttpGet, Route("GetStockSelectViews")]
        [HttpPost, HttpGet, Route("GetStockSelectViews"),AllowAnonymous]
        public List<StockSelectViewDTO> GetStockSelectViews(int orderId, string materielCode)
        {
            return Service.GetStockSelectViews(orderId, materielCode);