From 5d6cb15ac86d9174393cb9d1538d69b567e2c26c Mon Sep 17 00:00:00 2001
From: 移动系统liao <liaoxujun@qq.com>
Date: 星期四, 09 五月 2024 08:56:50 +0800
Subject: [PATCH] 修改货品编辑bug
---
CoreCms.Net.Web.Admin/wwwroot/views/baifenbingfa/corecmsproducts/index.html | 8 ++--
CoreCms.Net.IServices/baifenbingfa/ICoreCmsProductsServices.cs | 7 +++
CoreCms.Net.Services/baifenbingfa/CoreCmsProductsServices.cs | 38 +++++++++++++++++++
CoreCms.Net.Web.Admin/Controllers/baifenbingfa/CoreCmsProductsController.cs | 2
CoreCms.Net.Repository/baifenbingfa/CoreCmsProductsRepository.cs | 29 +++++++-------
5 files changed, 65 insertions(+), 19 deletions(-)
diff --git a/CoreCms.Net.IServices/baifenbingfa/ICoreCmsProductsServices.cs b/CoreCms.Net.IServices/baifenbingfa/ICoreCmsProductsServices.cs
index 6e464e6..2e27509 100644
--- a/CoreCms.Net.IServices/baifenbingfa/ICoreCmsProductsServices.cs
+++ b/CoreCms.Net.IServices/baifenbingfa/ICoreCmsProductsServices.cs
@@ -116,5 +116,12 @@
/// <returns></returns>
public Task<List<CoreCmsProducts>> QueryDetaiListAsync(Expression<Func<CoreCmsProducts, bool>> predicate,
Expression<Func<CoreCmsProducts, object>> orderByExpression, OrderByType orderByType, bool blUseNoLock = false);
+
+ /// <summary>
+ /// 鑾峰彇缂栬緫鐩稿叧瀛楁
+ /// </summary>
+ /// <returns></returns>
+ public Task<CoreCmsProducts> QueryEditByID(int id);
+
}
}
diff --git a/CoreCms.Net.Repository/baifenbingfa/CoreCmsProductsRepository.cs b/CoreCms.Net.Repository/baifenbingfa/CoreCmsProductsRepository.cs
index e7f9cde..fcf8ddb 100644
--- a/CoreCms.Net.Repository/baifenbingfa/CoreCmsProductsRepository.cs
+++ b/CoreCms.Net.Repository/baifenbingfa/CoreCmsProductsRepository.cs
@@ -62,6 +62,7 @@
{
var jm = new AdminUiCallBack();
+
var oldModel = await DbClient.Queryable<CoreCmsProducts>().In(entity.id).SingleAsync();
if (oldModel == null)
{
@@ -69,23 +70,23 @@
return jm;
}
//浜嬬墿澶勭悊杩囩▼寮�濮�
- oldModel.id = entity.id;
- oldModel.goodsId = entity.goodsId;
- oldModel.barcode = entity.barcode;
- oldModel.sn = entity.sn;
+
+
+
+
oldModel.price = entity.price;
oldModel.costprice = entity.costprice;
oldModel.mktprice = entity.mktprice;
- oldModel.marketable = entity.marketable;
- oldModel.pointsDeduction = entity.pointsDeduction;
- oldModel.points = entity.points;
+ //oldModel.marketable = entity.marketable;
+ //oldModel.pointsDeduction = entity.pointsDeduction;
+ //oldModel.points = entity.points;
oldModel.weight = entity.weight;
- oldModel.stock = entity.stock;
- oldModel.freezeStock = entity.freezeStock;
- oldModel.spesDesc = entity.spesDesc;
- oldModel.isDefalut = entity.isDefalut;
- oldModel.images = entity.images;
- oldModel.isDel = entity.isDel;
+ //oldModel.stock = entity.stock;
+ //oldModel.freezeStock = entity.freezeStock;
+
+
+
+
oldModel.distributionPrice = entity.distributionPrice;
oldModel.cutMoney = entity.cutMoney;
oldModel.distributionCutMoney = entity.distributionCutMoney;
@@ -161,7 +162,7 @@
}
#endregion
-
+
#region 閲嶅啓鏍规嵁鏉′欢鏌ヨ鍒嗛〉鏁版嵁
/// <summary>
diff --git a/CoreCms.Net.Services/baifenbingfa/CoreCmsProductsServices.cs b/CoreCms.Net.Services/baifenbingfa/CoreCmsProductsServices.cs
index fbcae89..5df0ea1 100644
--- a/CoreCms.Net.Services/baifenbingfa/CoreCmsProductsServices.cs
+++ b/CoreCms.Net.Services/baifenbingfa/CoreCmsProductsServices.cs
@@ -20,6 +20,7 @@
using CoreCms.Net.Model.ViewModels.Basics;
using CoreCms.Net.Model.ViewModels.UI;
using SqlSugar;
+using static CoreCms.Net.Configuration.GlobalEnumVars;
namespace CoreCms.Net.Services
@@ -151,6 +152,43 @@
{
return await _dal.QueryDetaiListAsync(predicate, orderByExpression, orderByType, blUseNoLock);
}
+
+ public async Task<CoreCmsProducts> QueryEditByID(int id)
+ {
+ return await _unitOfWork.GetDbClient().Queryable<CoreCmsGoods, CoreCmsProducts>((good, product) => new JoinQueryInfos(
+ JoinType.Inner, good.id == product.goodsId
+ )
+ ).Where((good, product) =>product.id==id)
+ .Select((good, product) => new CoreCmsProducts
+ {
+ id = product.id,
+ goodsId = product.goodsId,
+ barcode = product.barcode,
+ sn = product.sn,
+ price = product.price,
+ costprice = product.costprice,
+ mktprice = product.mktprice,
+ marketable = product.marketable,
+ weight = product.weight,
+ stock = product.stock,
+ freezeStock = product.freezeStock,
+ pointsDeduction = product.pointsDeduction,
+ points = product.points,
+ spesDesc = product.spesDesc,
+ isDefalut = product.isDefalut,
+ images = product.images,
+ isDel = good.isDel,
+ name = good.name,
+ bn = good.bn,
+ isMarketable = good.isMarketable,
+ unit = good.unit,
+ distributionPrice = product.distributionPrice,
+ cutMoney = product.cutMoney,
+ distributionCutMoney = product.distributionCutMoney,
+ }).With(SqlWith.NoLock)
+ .FirstAsync();
+
+ }
#endregion
diff --git a/CoreCms.Net.Web.Admin/Controllers/baifenbingfa/CoreCmsProductsController.cs b/CoreCms.Net.Web.Admin/Controllers/baifenbingfa/CoreCmsProductsController.cs
index 3c45bd1..f4fe309 100644
--- a/CoreCms.Net.Web.Admin/Controllers/baifenbingfa/CoreCmsProductsController.cs
+++ b/CoreCms.Net.Web.Admin/Controllers/baifenbingfa/CoreCmsProductsController.cs
@@ -307,7 +307,7 @@
{
var jm = new AdminUiCallBack();
- var model = await _CoreCmsProductsServices.QueryByIdAsync(entity.id, false);
+ var model = await _CoreCmsProductsServices.QueryEditByID(entity.id);
if (model == null)
{
jm.msg = "涓嶅瓨鍦ㄦ淇℃伅";
diff --git a/CoreCms.Net.Web.Admin/wwwroot/views/baifenbingfa/corecmsproducts/index.html b/CoreCms.Net.Web.Admin/wwwroot/views/baifenbingfa/corecmsproducts/index.html
index 9a71a7e..1074605 100644
--- a/CoreCms.Net.Web.Admin/wwwroot/views/baifenbingfa/corecmsproducts/index.html
+++ b/CoreCms.Net.Web.Admin/wwwroot/views/baifenbingfa/corecmsproducts/index.html
@@ -286,10 +286,10 @@
});
});
//鐩戝惉琛屽弻鍑讳簨浠�
- table.on('rowDouble(LAY-app-CoreCmsbaifenProducts-tableBox)', function (obj) {
- //鏌ョ湅璇︽儏
- doDetails(obj);
- });
+ // table.on('rowDouble(LAY-app-CoreCmsbaifenProducts-tableBox)', function (obj) {
+ // //鏌ョ湅璇︽儏
+ // doDetails(obj);
+ // });
//澶村伐鍏锋爮浜嬩欢
table.on('pagebar(LAY-app-CoreCmsbaifenProducts-tableBox)', function (obj) {
var checkStatus = table.checkStatus(obj.config.id);
--
Gitblit v1.9.1