893 lines
46 KiB
C#
893 lines
46 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using PosDataTest.Common;
|
|
|
|
namespace PosDataTest
|
|
{
|
|
public class GoodsTableHelper
|
|
{
|
|
static int promotion = 0;
|
|
|
|
/// <summary>
|
|
/// 主界面DataGrid数据源表结构
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static DataTable GetCommodityTableStructure()
|
|
{
|
|
DataTable GoodsTable = new DataTable();
|
|
GoodsTable.Columns.Add("commodity_barcode", typeof(string)); //商品条码
|
|
GoodsTable.Columns.Add("commodity_name", typeof(string)); //商品名称
|
|
GoodsTable.Columns.Add("count", typeof(decimal)); //销售数量
|
|
GoodsTable.Columns.Add("commodity_retailprice", typeof(decimal)); //销售单价
|
|
GoodsTable.Columns.Add("discount_rate", typeof(decimal)); //优惠金额
|
|
GoodsTable.Columns.Add("price", typeof(decimal)); //应收金额
|
|
GoodsTable.Columns.Add("actualprice", typeof(decimal)); //优惠单价
|
|
GoodsTable.Columns.Add("memberprice", typeof(decimal)); //会员单价
|
|
GoodsTable.Columns.Add("commodity_code", typeof(string)); //商品编码
|
|
GoodsTable.Columns.Add("foreground", typeof(string)); //字体颜色
|
|
GoodsTable.Columns.Add("background", typeof(string)); //背景颜色
|
|
GoodsTable.Columns.Add("promotioncode", typeof(string)); //套餐编号
|
|
GoodsTable.Columns.Add("promotion", typeof(string)); //套餐标识
|
|
GoodsTable.Columns.Add("listidentifier", typeof(string)); //取单标识
|
|
GoodsTable.Columns.Add("ConditionPromotion", typeof(string)); //促销条件
|
|
GoodsTable.Columns.Add("PrintGoodsName", typeof(string)); //打印名称
|
|
GoodsTable.Columns.Add("kitchenindex", typeof(decimal)); //厨打编号
|
|
GoodsTable.Columns.Add("commodity_type", typeof(string)); //商品类型
|
|
GoodsTable.Columns.Add("commodity_symbol", typeof(string)); //商品标识
|
|
GoodsTable.Columns.Add("ticketprefix", typeof(string)); //促销前缀
|
|
GoodsTable.Columns.Add("promotionid", typeof(decimal)); //促销内码
|
|
GoodsTable.Columns.Add("promotionprice", typeof(decimal)); //促销金额
|
|
GoodsTable.Columns.Add("promotionname", typeof(string)); //促销名称
|
|
GoodsTable.Columns.Add("promotionexplain", typeof(string)); //促销提示
|
|
GoodsTable.Columns.Add("commodity_unit", typeof(string)); //商品单位
|
|
GoodsTable.Columns.Add("material1", typeof(string)); //商品配料
|
|
GoodsTable.Columns.Add("material2", typeof(string)); //商品配料
|
|
GoodsTable.Columns.Add("material3", typeof(string)); //商品配料
|
|
GoodsTable.Columns.Add("material4", typeof(string)); //商品配料
|
|
GoodsTable.Columns.Add("material5", typeof(string)); //商品配料
|
|
GoodsTable.Columns.Add("meteringmethod", typeof(decimal)); //散称标识
|
|
GoodsTable.Columns.Add("kitchenconfig_index", typeof(decimal)); //触屏厨打
|
|
GoodsTable.Columns.Add("commodity_memberprice", typeof(decimal)); //会员单价
|
|
return GoodsTable;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 主页面异常交易数据源
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public static DataTable GetExTableStructure()
|
|
{
|
|
DataTable GoodsTable = new DataTable();
|
|
GoodsTable.Columns.Add("count", typeof(decimal));
|
|
GoodsTable.Columns.Add("price", typeof(decimal));
|
|
GoodsTable.Columns.Add("listidentifier", typeof(string));
|
|
GoodsTable.Columns.Add("commodity_code", typeof(string));
|
|
return GoodsTable;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 列表按行添加
|
|
/// </summary>
|
|
/// <param name="goodsRow">商品数据行</param>
|
|
/// <param name="GoodsTables">商品列表</param>
|
|
/// <param name="IsOverly">是否叠加</param>
|
|
/// <param name="IsMember">是否会员</param>
|
|
/// <returns></returns>
|
|
public static void KeyInputSale(DataRow goodsRow, DataTable GoodsTables, bool IsOverly, bool IsMember = false)
|
|
{
|
|
//记录商品刷入时间
|
|
PosControl.ProductAdditionTime = DateTime.Now;
|
|
//开始添加商品
|
|
goodsRow = PromotionCheck(goodsRow, GoodsTables);
|
|
if (IsMember)
|
|
{
|
|
goodsRow["actualprice"] = goodsRow["memberprice"];
|
|
goodsRow["price"] = (decimal)goodsRow["memberprice"] * (decimal)goodsRow["Count"];
|
|
}
|
|
if (IsOverly)
|
|
{
|
|
DataRow[] _Row = GoodsTables.Select("commodity_barcode = '" + goodsRow["commodity_barcode"] + "'");
|
|
if (_Row.Length > 0)
|
|
{
|
|
_Row[0]["price"] = (decimal)_Row[0]["price"] + (decimal)goodsRow["price"];
|
|
_Row[0]["count"] = (decimal)_Row[0]["count"] + (decimal)goodsRow["Count"];
|
|
if (int.TryParse(QualityHelper.price_accuracy, out int _Accuracy))
|
|
{
|
|
decimal _Price = Math.Round(decimal.Parse(
|
|
_Row[0]["price"].ToString()), _Accuracy, MidpointRounding.AwayFromZero);
|
|
if (_Price > 0)
|
|
{
|
|
_Row[0]["price"] = _Price.ToString("F2");
|
|
}
|
|
}
|
|
_Row[0]["discount_rate"] = ((decimal)_Row[0]["commodity_retailprice"] * (decimal)_Row[0]["count"]) - (decimal)_Row[0]["price"];
|
|
_Row[0]["actualprice"] = (decimal)_Row[0]["price"] / (decimal)_Row[0]["count"];
|
|
_Row[0]["promotionname"] = goodsRow["promotionname"];
|
|
//_Row[0]["discount_rate"] = (decimal)_Row[0]["discount_rate"] + (decimal)goodsRow["discount_rate"];
|
|
return;
|
|
}
|
|
}
|
|
if (int.TryParse(QualityHelper.price_accuracy, out int Places))
|
|
{
|
|
decimal _Price = Math.Round(decimal.Parse(
|
|
goodsRow["price"].ToString()), Places, MidpointRounding.AwayFromZero);
|
|
if (_Price >= 0)
|
|
{
|
|
goodsRow["price"] = _Price.ToString("F2");
|
|
}
|
|
}
|
|
goodsRow["discount_rate"] = ((decimal)goodsRow["commodity_retailprice"] *
|
|
(decimal)goodsRow["Count"]) - (decimal)goodsRow["price"];
|
|
GoodsTables.Rows.Add(goodsRow);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 列表按行添加(商品按钮版)
|
|
/// </summary>
|
|
/// <param name="goodsRow">商品数据行</param>
|
|
/// <param name="GoodsTables">商品列表</param>
|
|
/// <param name="IsOverly">是否叠加</param>
|
|
/// <param name="saleCount">销售数量</param>
|
|
/// <returns></returns>
|
|
public static DataRow TouchInputSale(DataRow goodsRow, DataTable GoodsTables, bool IsOverly, decimal saleCount = 1, bool IsMember = false)
|
|
{
|
|
//记录商品刷入时间
|
|
PosControl.ProductAdditionTime = DateTime.Now;
|
|
//开始添加商品
|
|
DataRow _DataRow = GoodsTables.NewRow();
|
|
_DataRow["commodity_barcode"] = goodsRow["commodity_barcode"];
|
|
_DataRow["commodity_name"] = goodsRow["commodity_name"];
|
|
|
|
_DataRow["count"] = saleCount;
|
|
|
|
_DataRow["commodity_retailprice"] = goodsRow["commodity_retailprice"];
|
|
if (IsMember && decimal.TryParse(goodsRow["memberprice"].ToString(), out decimal _MemberPrice))
|
|
{
|
|
_DataRow["actualprice"] = goodsRow["commodity_memberprice"];
|
|
}
|
|
else
|
|
{
|
|
_DataRow["actualprice"] = goodsRow["commodity_retailprice"];
|
|
}
|
|
_DataRow["price"] = ((decimal)goodsRow["actualprice"] * saleCount).ToString("F2");
|
|
|
|
_DataRow["memberprice"] = goodsRow["commodity_memberprice"];
|
|
_DataRow["commodity_code"] = goodsRow["commodity_code"];
|
|
_DataRow["PrintGoodsName"] = goodsRow["commodity_name"];
|
|
_DataRow["kitchenindex"] = goodsRow["KITCHENCONFIG_INDEX"];
|
|
_DataRow["commodity_type"] = goodsRow["commodity_type"];
|
|
_DataRow["commodity_symbol"] = goodsRow["commodity_symbol"];
|
|
_DataRow["meteringmethod"] = goodsRow["meteringmethod"];
|
|
|
|
_DataRow = PromotionCheck(_DataRow, GoodsTables);
|
|
if (IsOverly && QualityHelper.IsMaterial != "1" && (decimal)goodsRow["METERINGMETHOD"] == 1)
|
|
{
|
|
DataRow[] _Row = GoodsTables.Select("commodity_barcode = '" + _DataRow["commodity_barcode"] + "'");
|
|
if (_Row.Length > 0)
|
|
{
|
|
_Row[0]["count"] = ((decimal)_Row[0]["count"] + 1).ToString("F3");
|
|
_Row[0]["price"] = ((decimal)_Row[0]["price"] + (decimal)_DataRow["price"]).ToString("F2");
|
|
if (int.TryParse(QualityHelper.price_accuracy, out int Place))
|
|
{
|
|
decimal _Price = Math.Round(decimal.Parse(_Row[0]["price"].ToString()), Place, MidpointRounding.AwayFromZero);
|
|
if (_Price > 0)
|
|
{
|
|
_Row[0]["price"] = _Price.ToString("F2");
|
|
}
|
|
}
|
|
_Row[0]["discount_rate"] = ((decimal)_Row[0]["commodity_retailprice"] * (decimal)_Row[0]["count"]) - (decimal)_Row[0]["price"];
|
|
_Row[0]["actualprice"] = (decimal)_Row[0]["price"] / (decimal)_Row[0]["count"];
|
|
_Row[0]["promotionname"] = _DataRow["promotionname"];
|
|
//_Row[0]["discount_rate"] = ((decimal)_Row[0]["commodity_retailprice"] -
|
|
// (decimal)_Row[0]["actualprice"]) * (decimal)_Row[0]["count"];
|
|
return _DataRow;
|
|
}
|
|
}
|
|
|
|
if (int.TryParse(QualityHelper.price_accuracy, out int Places))
|
|
{
|
|
decimal _Price = Math.Round(decimal.Parse(
|
|
_DataRow["price"].ToString()), Places, MidpointRounding.AwayFromZero);
|
|
if (_Price > 0)
|
|
{
|
|
_DataRow["price"] = _Price.ToString("F2");
|
|
}
|
|
}
|
|
_DataRow["discount_rate"] = (decimal)_DataRow["commodity_retailprice"] * (decimal)_DataRow["count"] - (decimal)_DataRow["price"];
|
|
|
|
//string _strSelectSql = "SELECT PROMOTION_CODE FROM T_PROMOTION WHERE ISVALID = 1 " +
|
|
// "AND SERVERPARTCODE = '" + QualityHelper.serverpartcode + "' AND SHOPCODE = '" +
|
|
// QualityHelper.shopcode + "' AND COMMODITY_CODE = '" + _DataRow["commodity_code"] + "'";
|
|
//try
|
|
//{
|
|
// DataTable dataTable = DBHelper.QueryOdbc(_strSelectSql).Tables[0];
|
|
// if (dataTable.Rows.Count > 0)
|
|
// {
|
|
// _DataRow["promotioncode"] = dataTable.Rows[0]["PROMOTION_CODE"];
|
|
// }
|
|
//}
|
|
//catch { }
|
|
|
|
GoodsTables.Rows.Add(_DataRow);
|
|
return _DataRow;
|
|
}
|
|
/// <summary>
|
|
/// 触屏版添加商品(新版)
|
|
/// </summary>
|
|
/// <param name="goodsRow">商品数据行</param>
|
|
/// <param name="GoodsTables">商品列表</param>
|
|
/// <param name="IsOverly">是否叠加</param>
|
|
/// <param name="saleCount">销售数量</param>
|
|
/// <returns></returns>
|
|
public static DataRow TouchInputSale(Model.CommodityModel commodityModel, DataTable GoodsTables, bool IsOverly, decimal saleCount = 1, bool IsMember = false)
|
|
{
|
|
//记录商品刷入时间
|
|
PosControl.ProductAdditionTime = DateTime.Now;
|
|
//开始添加商品到销售列表
|
|
DataRow _DataRow = GoodsTables.NewRow();
|
|
_DataRow["commodity_barcode"] = commodityModel.CommodityBarCode;
|
|
_DataRow["commodity_name"] = commodityModel.CommodityName;
|
|
_DataRow["commodity_unit"] = commodityModel.CommodityUnit;
|
|
|
|
_DataRow["count"] = saleCount;
|
|
_DataRow["commodity_retailprice"] = commodityModel.RetailPrice;
|
|
_DataRow["actualprice"] = IsMember ? commodityModel.MemberPrice : commodityModel.RetailPrice;
|
|
_DataRow["price"] = ((IsMember ? commodityModel.MemberPrice : commodityModel.RetailPrice) * saleCount).ToString("F2");
|
|
|
|
_DataRow["memberprice"] = commodityModel.MemberPrice;
|
|
_DataRow["commodity_code"] = commodityModel.CommodityCode;
|
|
_DataRow["PrintGoodsName"] = commodityModel.PrintGoodsName;
|
|
_DataRow["kitchenindex"] = commodityModel.KitchenIndex;
|
|
_DataRow["commodity_type"] = commodityModel.CommodityType;
|
|
_DataRow["commodity_symbol"] = commodityModel.CommoditySymbol;
|
|
_DataRow["meteringmethod"] = commodityModel.MeteringMethod;
|
|
_DataRow["material1"] = commodityModel.Material1;
|
|
_DataRow["material2"] = commodityModel.Material2;
|
|
_DataRow["material3"] = commodityModel.Material3;
|
|
_DataRow["material4"] = commodityModel.Material4;
|
|
_DataRow["material5"] = commodityModel.Material5;
|
|
_DataRow = PromotionCheck(_DataRow, GoodsTables);
|
|
if (IsOverly && QualityHelper.IsMaterial != "1" && commodityModel.MeteringMethod == 1)
|
|
{
|
|
DataRow[] _Row = GoodsTables.Select("commodity_barcode = '" + _DataRow["commodity_barcode"] + "'");
|
|
if (_Row.Length > 0)
|
|
{
|
|
_Row[0]["count"] = ((decimal)_Row[0]["count"] + 1).ToString("F3");
|
|
_Row[0]["price"] = ((decimal)_Row[0]["price"] + (decimal)_DataRow["price"]).ToString("F2");
|
|
if (int.TryParse(QualityHelper.price_accuracy, out int Place))
|
|
{
|
|
decimal _Price = Math.Round(decimal.Parse(_Row[0]["price"].ToString()), Place, MidpointRounding.AwayFromZero);
|
|
if (_Price > 0)
|
|
{
|
|
_Row[0]["price"] = _Price.ToString("F2");
|
|
}
|
|
}
|
|
_Row[0]["discount_rate"] = ((decimal)_Row[0]["commodity_retailprice"] * (decimal)_Row[0]["count"]) - (decimal)_Row[0]["price"];
|
|
_Row[0]["actualprice"] = (decimal)_Row[0]["price"] / (decimal)_Row[0]["count"];
|
|
_Row[0]["promotionname"] = _DataRow["promotionname"];
|
|
return _DataRow;
|
|
}
|
|
}
|
|
|
|
if (int.TryParse(QualityHelper.price_accuracy, out int Places))
|
|
{
|
|
decimal _Price = Math.Round(decimal.Parse(
|
|
_DataRow["price"].ToString()), Places, MidpointRounding.AwayFromZero);
|
|
if (_Price > 0)
|
|
{
|
|
_DataRow["price"] = _Price.ToString("F2");
|
|
}
|
|
}
|
|
_DataRow["discount_rate"] = (decimal)_DataRow["commodity_retailprice"] * (decimal)_DataRow["count"] - (decimal)_DataRow["price"];
|
|
|
|
//string _strSelectSql = "SELECT PROMOTION_CODE FROM T_PROMOTION WHERE ISVALID = 1 " +
|
|
// "AND SERVERPARTCODE = '" + QualityHelper.serverpartcode + "' AND SHOPCODE = '" +
|
|
// QualityHelper.shopcode + "' AND COMMODITY_CODE = '" + _DataRow["commodity_code"] + "'";
|
|
//try
|
|
//{
|
|
// DataTable dataTable = DBHelper.QueryOdbc(_strSelectSql).Tables[0];
|
|
// if (dataTable.Rows.Count > 0)
|
|
// {
|
|
// _DataRow["promotioncode"] = dataTable.Rows[0]["PROMOTION_CODE"];
|
|
// }
|
|
//}
|
|
//catch { }
|
|
|
|
GoodsTables.Rows.Add(_DataRow);
|
|
return _DataRow;
|
|
}
|
|
|
|
//public static DataTable
|
|
/// <summary>
|
|
/// 企业会员优惠减免记录
|
|
/// </summary>
|
|
/// <param name="goodTable">流水列表</param>
|
|
/// <param name="couponAmount">减免金额</param>
|
|
public static void CouponAdd(DataTable goodTable, decimal couponAmount)
|
|
{
|
|
DataRow _SellRow = goodTable.NewRow();
|
|
_SellRow["commodity_barcode"] = "99999999";
|
|
_SellRow["commodity_name"] = "企业会员优惠";
|
|
_SellRow["count"] = 0;
|
|
_SellRow["commodity_retailprice"] = 0;
|
|
_SellRow["discount_rate"] = "0";
|
|
_SellRow["price"] = (couponAmount * -1).ToString("F2");
|
|
_SellRow["actualprice"] = 1;
|
|
_SellRow["memberprice"] = 1;
|
|
_SellRow["commodity_code"] = "99999999";
|
|
_SellRow["foreground"] = "#575757";
|
|
_SellRow["background"] = "#91DAC9";
|
|
_SellRow["promotioncode"] = "";
|
|
_SellRow["promotion"] = "";
|
|
_SellRow["listidentifier"] = "";
|
|
_SellRow["ConditionPromotion"] = "";
|
|
_SellRow["PrintGoodsName"] = "企业会员优惠";
|
|
_SellRow["kitchenindex"] = "1000";
|
|
_SellRow["commodity_type"] = "优惠";
|
|
_SellRow["commodity_symbol"] = "T0";
|
|
_SellRow["material1"] = "";
|
|
_SellRow["material2"] = "";
|
|
_SellRow["material3"] = "";
|
|
_SellRow["material4"] = "";
|
|
_SellRow["material5"] = "";
|
|
goodTable.Rows.Add(_SellRow);
|
|
}
|
|
/// <summary>
|
|
/// 大巴券优惠减免记录
|
|
/// </summary>
|
|
/// <param name="goodTable">流水列表</param>
|
|
/// <param name="couponAmount">减免金额</param>
|
|
/// <param name="couponName">优惠方式名称</param>
|
|
public static void CouponAdd(DataTable goodTable, decimal couponAmount, string couponName)
|
|
{
|
|
string str_Barcode;
|
|
string str_Symbol;
|
|
switch (couponName)
|
|
{
|
|
case "企业会员优惠":
|
|
str_Barcode = "99999999";
|
|
str_Symbol = "T0";
|
|
break;
|
|
case "大巴券优惠":
|
|
str_Barcode = "99999998";
|
|
str_Symbol = "T-1";
|
|
break;
|
|
case "团购餐优惠":
|
|
str_Barcode = "99999997";
|
|
str_Symbol = "T-2";
|
|
break;
|
|
default://其他优惠,如:电子券(无固定名称)
|
|
str_Barcode = "99999996";
|
|
str_Symbol = "T-3";
|
|
break;
|
|
}
|
|
DataRow _SellRow = goodTable.NewRow();
|
|
_SellRow["commodity_barcode"] = str_Barcode;
|
|
_SellRow["commodity_name"] = couponName;
|
|
_SellRow["count"] = 0;
|
|
_SellRow["commodity_retailprice"] = 0;
|
|
_SellRow["discount_rate"] = "0";
|
|
_SellRow["price"] = (couponAmount * -1).ToString("F2");
|
|
_SellRow["actualprice"] = 1;
|
|
_SellRow["memberprice"] = 1;
|
|
_SellRow["commodity_code"] = str_Barcode;
|
|
_SellRow["foreground"] = "#575757";
|
|
_SellRow["background"] = "#91DAC9";
|
|
_SellRow["promotioncode"] = "";
|
|
_SellRow["promotion"] = "";
|
|
_SellRow["listidentifier"] = "";
|
|
_SellRow["ConditionPromotion"] = "";
|
|
_SellRow["PrintGoodsName"] = couponName;
|
|
_SellRow["kitchenindex"] = "1000";
|
|
_SellRow["commodity_type"] = "优惠";
|
|
_SellRow["commodity_symbol"] = str_Symbol;
|
|
_SellRow["material1"] = "";
|
|
_SellRow["material2"] = "";
|
|
_SellRow["material3"] = "";
|
|
_SellRow["material4"] = "";
|
|
_SellRow["material5"] = "";
|
|
goodTable.Rows.Add(_SellRow);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 列表删除行
|
|
/// </summary>
|
|
/// <param name="Row">要删除的行</param>
|
|
/// <param name="GoodsTables">商品列表</param>
|
|
public static void TableRemove(DataRow goodsRow, DataTable GoodsTables)
|
|
{
|
|
if (goodsRow["ConditionPromotion"].ToString().Trim() != "")
|
|
{
|
|
string _StrSelectSql = string.Format("SELECT THRESHOLD_AMOUNT,COMMODITY_CODE,DISCOUNT_RATE,PROMOTION_ID " +
|
|
"FROM T_SALESPROMOTE WHERE SERVERPARTCODE = '{0}' AND SHOPCODE = '{1}' AND PROMOTION_ID = {2} AND " +
|
|
"CONDITION_SKU = '{3}'", QualityHelper.serverpartcode, QualityHelper.shopcode,
|
|
goodsRow["ConditionPromotion"], goodsRow["commodity_code"]);
|
|
try
|
|
{
|
|
DataTable _DataTable = ESSupport.Lib.SyBaseHelper.QueryOdbc(_StrSelectSql).Tables[0];
|
|
if (_DataTable.Rows.Count > 0)
|
|
{
|
|
decimal ThresholdAmount = decimal.Parse(_DataTable.Rows[0]["threshold_amount"].ToString());
|
|
string ConditionCode = goodsRow["PROMOTION_ID"].ToString();
|
|
string SellCode = _DataTable.Rows[0]["COMMODITY_CODE"].ToString();
|
|
decimal DiscountRate = decimal.Parse(_DataTable.Rows[0]["DISCOUNT_RATE"].ToString());
|
|
|
|
GoodsTables.DefaultView.RowFilter = "ConditionPromotion = '" + ConditionCode + "'";
|
|
DataTable ConditionTable = GoodsTables.DefaultView.ToTable();
|
|
GoodsTables.DefaultView.RowFilter = "";
|
|
decimal.TryParse(ConditionTable.Compute("Sum(count)", "").ToString(), out decimal ConditionCout);
|
|
if (QualityHelper.commodity_overlay != "1")
|
|
{
|
|
if ((ConditionCout % ThresholdAmount) == 0)
|
|
{
|
|
DataRow[] _Row = GoodsTables.Select("commodity_code = '" + SellCode + "' and Price = " + DiscountRate);
|
|
if (_Row.Length > 0)
|
|
{
|
|
_Row[_Row.Length - 1]["discount_rate"] = 0;
|
|
_Row[_Row.Length - 1]["Price"] = _Row[0]["commodity_retailprice"];
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
DataRow[] _Row = GoodsTables.Select("commodity_code = '" + SellCode + "'");
|
|
if (_Row.Length > 0)
|
|
{
|
|
_Row[0]["discount_rate"] = 0;
|
|
_Row[0]["Price"] = (decimal.Parse(_Row[0]["commodity_retailprice"].ToString()) * decimal.Parse(_Row[0]["Count"].ToString()));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
}
|
|
}
|
|
DataRow _DataRow = GoodsTables.NewRow();
|
|
_DataRow.ItemArray = goodsRow.ItemArray;
|
|
GoodsTables.Rows.Remove(goodsRow);
|
|
PromotionCheck(_DataRow, GoodsTables, true);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 取单添加数据
|
|
/// </summary>
|
|
/// <param name="_TakeBillTable">取单数据列表</param>
|
|
/// <param name="GoodsTables">商品列表</param>
|
|
/// <returns></returns>
|
|
public static void TableRowsAdd(DataTable _TakeBillTable, DataTable GoodsTables, bool IsMember = false)
|
|
{
|
|
//记录商品刷入时间
|
|
PosControl.ProductAdditionTime = DateTime.Now;
|
|
//开始添加商品到销售列表
|
|
for (int i = 0; i < _TakeBillTable.Rows.Count; i++)
|
|
{
|
|
DataRow Rows = GoodsTables.NewRow();
|
|
Rows["commodity_barcode"] = _TakeBillTable.Rows[i]["inputcode"];
|
|
Rows["commodity_name"] = _TakeBillTable.Rows[i]["commodity_name"];
|
|
Rows["PrintGoodsName"] = _TakeBillTable.Rows[i]["commodity_name"];
|
|
Rows["count"] = ((decimal)_TakeBillTable.Rows[i]["sellcount"]).ToString("F2");
|
|
Rows["commodity_retailprice"] = _TakeBillTable.Rows[i]["sellprice"];
|
|
Rows["discount_rate"] = ((decimal)_TakeBillTable.Rows[i]["sellprice"] -
|
|
(decimal)_TakeBillTable.Rows[i]["offprice"]) * (decimal)_TakeBillTable.Rows[i]["sellcount"];
|
|
Rows["price"] = ((decimal)_TakeBillTable.Rows[i]["factamount"]).ToString("F2");
|
|
Rows["commodity_code"] = _TakeBillTable.Rows[i]["commodity_code"];
|
|
Rows["actualprice"] = _TakeBillTable.Rows[i]["offprice"];
|
|
Rows["memberprice"] = _TakeBillTable.Rows[i]["COMMODITY_MEMBERPRICE"];
|
|
Rows["foreground"] = "#575757";
|
|
Rows["background"] = "#91DAC9";
|
|
Rows["listidentifier"] = _TakeBillTable.Rows[i]["ticketcode"];
|
|
Rows["kitchenindex"] = _TakeBillTable.Rows[i]["KITCHENCONFIG_INDEX"];
|
|
Rows["commodity_type"] = _TakeBillTable.Rows[i]["commodity_type"];
|
|
Rows["commodity_symbol"] = _TakeBillTable.Rows[i]["commodity_symbol"];
|
|
Rows["meteringmethod"] = _TakeBillTable.Rows[i]["meteringmethod"];
|
|
if (int.TryParse(QualityHelper.price_accuracy, out int Places))
|
|
{
|
|
decimal _Price = Math.Round(decimal.Parse(
|
|
Rows["price"].ToString()), Places, MidpointRounding.AwayFromZero);
|
|
if (_Price > 0)
|
|
{
|
|
Rows["price"] = _Price.ToString("F2");
|
|
}
|
|
}
|
|
Rows["discount_rate"] = (decimal)Rows["commodity_retailprice"] * (decimal)Rows["count"] - (decimal)Rows["price"];
|
|
if (IsMember)
|
|
{
|
|
Rows["actualprice"] = _TakeBillTable.Rows[i]["COMMODITY_MEMBERPRICE"];
|
|
Rows["discount_rate"] = ((decimal)_TakeBillTable.Rows[i]["sellprice"] -
|
|
(decimal)_TakeBillTable.Rows[i]["COMMODITY_MEMBERPRICE"]) * (decimal)_TakeBillTable.Rows[i]["sellcount"];
|
|
Rows["price"] = (decimal)_TakeBillTable.Rows[i]["COMMODITY_MEMBERPRICE"] * (decimal)_TakeBillTable.Rows[i]["sellcount"];
|
|
}
|
|
GoodsTables.Rows.Add(Rows);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 列表数据全清
|
|
/// </summary>
|
|
/// <param name="GoodsTables">商品列表</param>
|
|
/// <returns></returns>
|
|
public static void TableClear(DataTable GoodsTables)
|
|
{
|
|
GoodsTables.Clear();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 单行打折
|
|
/// </summary>
|
|
/// <param name="DisCount">折扣率</param>
|
|
/// <param name="goodsRow">商品数据行</param>
|
|
/// <param name="AllowDisCount">是否折上折</param>
|
|
/// <param name="GoodsTables">商品列表</param>
|
|
/// <returns></returns>
|
|
public static void TableDisCount(decimal DisCount, DataRow goodsRow, bool AllowDisCount)
|
|
{
|
|
goodsRow["actualprice"] = AllowDisCount ? ((decimal)goodsRow["actualprice"] * DisCount) :
|
|
((decimal)goodsRow["commodity_retailprice"] * DisCount);
|
|
goodsRow["price"] = (decimal)goodsRow["actualprice"] * (decimal)goodsRow["count"];
|
|
if (int.TryParse(QualityHelper.price_accuracy, out int Places))
|
|
{
|
|
decimal _Price = Math.Round(decimal.Parse(goodsRow["price"].ToString()),
|
|
Places, MidpointRounding.AwayFromZero);
|
|
if (_Price > 0)
|
|
{
|
|
goodsRow["price"] = _Price.ToString("F2");
|
|
}
|
|
}
|
|
goodsRow["discount_rate"] = ((decimal)goodsRow["commodity_retailprice"] *
|
|
(decimal)goodsRow["count"]) - (decimal)goodsRow["price"];
|
|
}
|
|
|
|
/// <summary>
|
|
/// 整单打折
|
|
/// </summary>
|
|
/// <param name="DisCount">折扣率</param>
|
|
/// <param name="AllowDisCount">是否折上折</param>
|
|
/// <param name="GoodsTables">商品列表</param>
|
|
/// <returns></returns>
|
|
public static void TableDisCount(decimal DisCount, bool AllowDisCount, DataTable GoodsTables)
|
|
{
|
|
foreach (DataRow _DataRow in GoodsTables.Rows)
|
|
{
|
|
_DataRow["actualprice"] = AllowDisCount ? ((decimal)_DataRow["actualprice"] * DisCount) :
|
|
((decimal)_DataRow["commodity_retailprice"] * DisCount);
|
|
_DataRow["price"] = ((decimal)_DataRow["actualprice"] * (decimal)_DataRow["count"]).ToString("F2");
|
|
if (int.TryParse(QualityHelper.price_accuracy, out int Places))
|
|
{
|
|
decimal _Price = Math.Round(decimal.Parse(
|
|
_DataRow["price"].ToString()), Places, MidpointRounding.AwayFromZero);
|
|
if (_Price > 0)
|
|
{
|
|
_DataRow["price"] = _Price.ToString("F2");
|
|
}
|
|
}
|
|
_DataRow["discount_rate"] = ((decimal)_DataRow["commodity_retailprice"] * (decimal)_DataRow["count"]) - (decimal)_DataRow["price"];
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 消费券转优惠
|
|
/// </summary>
|
|
/// <param name="totalAmount">消费总金额</param>
|
|
/// <param name="smallChange">优惠总金额</param>
|
|
/// <param name="goodsTable">商品列表</param>
|
|
public static void CouponToChange(decimal totalAmount, decimal smallChange, DataTable goodsTable)
|
|
{
|
|
//#region 替换为直接插入特殊优惠流水
|
|
decimal _Coupon = smallChange;
|
|
decimal _Discount = (totalAmount - smallChange) / totalAmount;
|
|
for (int i = 0; i < goodsTable.Rows.Count; i++)
|
|
{
|
|
if (i + 1 == goodsTable.Rows.Count)
|
|
{
|
|
goodsTable.Rows[i]["actualprice"] = Math.Round(((decimal)goodsTable.Rows[i]["price"] - _Coupon) /
|
|
(decimal)goodsTable.Rows[i]["count"], 4, MidpointRounding.AwayFromZero);
|
|
}
|
|
else
|
|
{
|
|
goodsTable.Rows[i]["actualprice"] = (decimal)goodsTable.Rows[i]["actualprice"] * _Discount;
|
|
}
|
|
if (!int.TryParse(QualityHelper.price_accuracy, out int Places))
|
|
{
|
|
Places = 1;
|
|
}
|
|
decimal _Price = Math.Round((decimal)goodsTable.Rows[i]["actualprice"] *
|
|
(decimal)goodsTable.Rows[i]["count"], Places, MidpointRounding.AwayFromZero);
|
|
|
|
_Coupon = _Coupon - ((decimal)goodsTable.Rows[i]["price"] - _Price);
|
|
if (_Price >= 0)
|
|
{
|
|
goodsTable.Rows[i]["price"] = _Price.ToString("F2");
|
|
}
|
|
goodsTable.Rows[i]["discount_rate"] = ((decimal)goodsTable.Rows[i]["commodity_retailprice"] *
|
|
(decimal)goodsTable.Rows[i]["count"]) - (decimal)goodsTable.Rows[i]["price"];
|
|
}
|
|
//#endregion
|
|
}
|
|
|
|
/// <summary>
|
|
/// 改价
|
|
/// </summary>
|
|
/// <param name="RevisePrice">修改金额</param>
|
|
/// <param name="goodsRow">商品数据行</param>
|
|
/// <param name="GoodsTables">商品列表</param>
|
|
/// <returns></returns>
|
|
public static void TableRevise(decimal RevisePrice, DataRow goodsRow)
|
|
{
|
|
goodsRow["actualprice"] = RevisePrice;
|
|
goodsRow["price"] = RevisePrice * (decimal)goodsRow["count"];
|
|
if (int.TryParse(QualityHelper.price_accuracy, out int Places))
|
|
{
|
|
decimal _Price = Math.Round(decimal.Parse(
|
|
goodsRow["price"].ToString()), Places, MidpointRounding.AwayFromZero);
|
|
if (_Price > 0)
|
|
{
|
|
goodsRow["price"] = _Price.ToString("F2");
|
|
}
|
|
}
|
|
goodsRow["discount_rate"] = ((decimal)goodsRow["commodity_retailprice"] *
|
|
(decimal)goodsRow["count"]) - (decimal)goodsRow["price"];
|
|
}
|
|
|
|
/// <summary>
|
|
/// 数量修改
|
|
/// </summary>
|
|
/// <param name="goodsCount">修改数量</param>
|
|
/// <param name="goodsRow">商品数据行</param>
|
|
/// <returns></returns>
|
|
public static void TableCountChange(decimal goodsCount, DataRow goodsRow)
|
|
{
|
|
goodsRow["count"] = goodsCount;
|
|
goodsRow["price"] = goodsCount * (decimal)goodsRow["actualprice"];
|
|
if (int.TryParse(QualityHelper.price_accuracy, out int Places))
|
|
{
|
|
decimal _Price = Math.Round(decimal.Parse(goodsRow["price"].ToString()), Places, MidpointRounding.AwayFromZero);
|
|
if (_Price > 0)
|
|
{
|
|
goodsRow["price"] = _Price.ToString("F2");
|
|
}
|
|
}
|
|
goodsRow["discount_rate"] = ((decimal)goodsRow["commodity_retailprice"] * (decimal)goodsRow["count"]) - (decimal)goodsRow["price"];
|
|
}
|
|
|
|
/// <summary>
|
|
/// 触摸版改数量和改价
|
|
/// </summary>
|
|
/// <param name="count">数量</param>
|
|
/// <param name="retailPrice">单价</param>
|
|
/// <param name="dataRow">商品行</param>
|
|
public static void ChangeData(decimal count, decimal retailPrice, DataRow dataRow, DataTable goodTable, bool IsDiscount = false)
|
|
{
|
|
dataRow["count"] = count;
|
|
dataRow["actualprice"] = retailPrice;
|
|
dataRow["price"] = (retailPrice * count).ToString("f2");
|
|
if (int.TryParse(QualityHelper.price_accuracy, out int Places))
|
|
{
|
|
decimal _Price = Math.Round(decimal.Parse(dataRow["price"].ToString()), Places, MidpointRounding.AwayFromZero);
|
|
if (_Price > 0)
|
|
{
|
|
dataRow["price"] = _Price.ToString("F2");
|
|
}
|
|
}
|
|
dataRow["discount_rate"] = ((decimal)dataRow["commodity_retailprice"] *
|
|
(decimal)dataRow["count"]) - (decimal)dataRow["price"];
|
|
|
|
if (goodTable != null)
|
|
{
|
|
PromotionCheck(dataRow, goodTable, true);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 挂单
|
|
/// </summary>
|
|
/// <param name="goodsTable">商品列表</param>
|
|
/// <param name="restingDate">挂单标识</param>
|
|
/// <returns></returns>
|
|
public static bool HangUp(DataTable goodsTable, DateTime restingDate, string ticketCode)
|
|
{
|
|
if (string.IsNullOrWhiteSpace(ticketCode))
|
|
{
|
|
ticketCode = restingDate.ToString("yyyyMMddHHmmss");
|
|
}
|
|
int _MaxID = ESSupport.DataStorage.DataFunction.CreateNextSequence("T_SELLDATA_BAK", "SELLDATA_ID");
|
|
string _InsertSql = "INSERT INTO T_SELLDATA_BAK (SELLDATA_ID,SELLDATA_DATE,SERVERPARTCODE," +
|
|
"SHOPCODE,MACHINECODE,COMMODITY_CODE,SELLCOUNT,SELLPRICE,OFFPRICE,FACTAMOUNT," +
|
|
"COMMODITY_NAME,INPUTCODE,LINENUM,METERINGMETHOD,TICKETCODE," +
|
|
"COMMODITY_TYPE,COMMODITY_SYMBOL,COMMODITY_MEMBERPRICE,KITCHENCONFIG_INDEX) VALUES ";
|
|
for (int i = 0; i < goodsTable.Rows.Count; i++)
|
|
{
|
|
_InsertSql += "(" + (_MaxID + i) + ",DATETIME('" + restingDate.ToString() + "'),'" + QualityHelper.serverpartcode + "','" +
|
|
QualityHelper.shopcode + "','" + QualityHelper.machinecode + "','" + goodsTable.Rows[i]["commodity_code"] + "','" +
|
|
goodsTable.Rows[i]["count"] + "','" + goodsTable.Rows[i]["commodity_retailprice"] + "','" +
|
|
goodsTable.Rows[i]["actualprice"] + "','" + goodsTable.Rows[i]["price"] + "','" +
|
|
goodsTable.Rows[i]["commodity_name"] + "','" + goodsTable.Rows[i]["commodity_barcode"] + "'," +
|
|
(i + 1) + "," + goodsTable.Rows[i]["memberprice"] + ",'" + ticketCode + "','" + goodsTable.Rows[i]["commodity_type"] +
|
|
"','" + goodsTable.Rows[i]["commodity_symbol"] + "'," + goodsTable.Rows[i]["memberprice"] + "," +
|
|
(string.IsNullOrWhiteSpace(goodsTable.Rows[i]["kitchenconfig_index"].ToString()) ? "NULL" : goodsTable.Rows[i]["kitchenconfig_index"]) + "),";
|
|
}
|
|
_InsertSql = _InsertSql.Substring(0, _InsertSql.Length - 1);
|
|
try
|
|
{
|
|
ESSupport.Lib.SyBaseHelper.ExecuteSqlTran(_InsertSql);
|
|
return true;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ESSupport.Lib.LogHelper.WriteServiceLog($"挂单操作失败:{ex.Message}");
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 会员操作
|
|
/// </summary>
|
|
/// <param name="goodsTable">商品列表</param>
|
|
public static void MemberChange(DataTable goodsTable)
|
|
{
|
|
foreach (DataRow _Row in goodsTable.Rows)
|
|
{
|
|
if ((decimal)_Row["actualprice"] == (decimal)_Row["commodity_retailprice"])
|
|
{
|
|
_Row["actualprice"] = (decimal)_Row["memberprice"];
|
|
_Row["price"] = (decimal)_Row["memberprice"] * (decimal)_Row["count"];
|
|
if (int.TryParse(QualityHelper.price_accuracy, out int Places))
|
|
{
|
|
decimal _Price = Math.Round(decimal.Parse(
|
|
_Row["price"].ToString()), Places, MidpointRounding.AwayFromZero);
|
|
if (_Price > 0)
|
|
{
|
|
_Row["price"] = _Price.ToString("F2");
|
|
}
|
|
}
|
|
_Row["discount_rate"] = ((decimal)_Row["commodity_retailprice"] * (decimal)_Row["count"]) - (decimal)_Row["price"];
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 会员操作
|
|
/// </summary>
|
|
/// <param name="goodsTable">商品列表</param>
|
|
public static void MemberChange(DataTable goodsTable, Model.StructMember stuMember)
|
|
{
|
|
//stuMember.DiscountAmount = 0;
|
|
foreach (DataRow _Row in goodsTable.Rows)
|
|
{
|
|
if ((decimal)_Row["actualprice"] == (decimal)_Row["commodity_retailprice"])
|
|
{
|
|
_Row["actualprice"] = (decimal)_Row["memberprice"];
|
|
_Row["price"] = (decimal)_Row["actualprice"] * (decimal)_Row["count"];
|
|
if (int.TryParse(QualityHelper.price_accuracy, out int Places))
|
|
{
|
|
decimal _Price = Math.Round(decimal.Parse(
|
|
_Row["price"].ToString()), Places, MidpointRounding.AwayFromZero);
|
|
if (_Price > 0)
|
|
{
|
|
_Row["price"] = _Price.ToString("F2");
|
|
}
|
|
}
|
|
_Row["discount_rate"] = ((decimal)_Row["commodity_retailprice"] * (decimal)_Row["count"]) - (decimal)_Row["price"];
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 套餐商品添加
|
|
/// </summary>
|
|
/// <param name="GoodsTable">套餐商品列表</param>
|
|
/// <param name="SaleTable">销售商品列表</param>
|
|
public static void PromotionAdd(DataTable GoodsTable, DataTable SaleTable)
|
|
{
|
|
//decimal.TryParse(GoodsTable.Compute("SUM(COMMODITY_RETAILPRICE)", "").ToString(), out decimal Price);
|
|
|
|
//记录商品刷入时间
|
|
PosControl.ProductAdditionTime = DateTime.Now;
|
|
//开始添加商品到销售列表
|
|
decimal _DisCount = (decimal)GoodsTable.Rows[0]["PROMOTION_AMOUNT"] / (decimal)GoodsTable.Compute("SUM(PRICE)", "");
|
|
for (int i = 0; i < GoodsTable.Rows.Count; i++)
|
|
{
|
|
if (decimal.TryParse(GoodsTable.Rows[i]["COUNT"].ToString(), out decimal Count))
|
|
{
|
|
DataRow _Row = SaleTable.NewRow();
|
|
_Row["COMMODITY_BARCODE"] = GoodsTable.Rows[i]["COMMODITY_BARCODE"];
|
|
_Row["COMMODITY_NAME"] = GoodsTable.Rows[i]["COMMODITY_NAME"];
|
|
_Row["PrintGoodsName"] = GoodsTable.Rows[i]["COMMODITY_NAME"];
|
|
_Row["COUNT"] = Count;
|
|
_Row["COMMODITY_RETAILPRICE"] = GoodsTable.Rows[i]["COMMODITY_RETAILPRICE"];
|
|
_Row["PRICE"] = _DisCount * ((decimal)GoodsTable.Rows[i]["COMMODITY_RETAILPRICE"]) * Count;
|
|
_Row["ACTUALPRICE"] = GoodsTable.Rows[i]["COMMODITY_RETAILPRICE"];
|
|
_Row["COMMODITY_CODE"] = GoodsTable.Rows[i]["COMMODITY_CODE"];
|
|
_Row["MEMBERPRICE"] = GoodsTable.Rows[i]["COMMODITY_RETAILPRICE"];
|
|
_Row["PROMOTIONCODE"] = GoodsTable.Rows[i]["PROMOTION_CODE"];
|
|
_Row["DISCOUNT_RATE"] = decimal.Parse(_Row["COMMODITY_RETAILPRICE"].ToString()) - decimal.Parse(_Row["PRICE"].ToString());
|
|
_Row["promotion"] = promotion;
|
|
_Row["kitchenindex"] = GoodsTable.Rows[i]["KITCHENCONFIG_INDEX"];
|
|
_Row["commodity_type"] = GoodsTable.Rows[0]["COMMODITY_TYPE"];
|
|
_Row["commodity_symbol"] = GoodsTable.Rows[0]["COMMODITY_SYMBOL"];
|
|
|
|
SaleTable.Rows.Add(_Row);
|
|
}
|
|
}
|
|
promotion++;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 商品自动合成套餐
|
|
/// </summary>
|
|
/// <param name="Count">套餐可选商品最大数量</param>
|
|
/// <param name="Price">套餐价格</param>
|
|
/// <param name="Code">套餐编号</param>
|
|
/// <param name="GoodsTable">商品列表</param>
|
|
public static void PromotionChange(decimal Count, decimal Price, string Code, DataTable GoodsTable)
|
|
{
|
|
DataRow[] _DataRows = GoodsTable.Select("PROMOTIONCODE = '" + Code + "' AND PROMOTION IS NULL");
|
|
decimal _DisCount = Price / (decimal)_DataRows.CopyToDataTable().Compute("SUM(PRICE)", "");
|
|
for (int i = 0; i < _DataRows.Length; i++)
|
|
{
|
|
_DataRows[i]["price"] = (decimal)_DataRows[i]["count"] * (decimal)_DataRows[i]["price"] * _DisCount;
|
|
_DataRows[i]["discount_rate"] = ((decimal)_DataRows[i]["actualprice"] * Count) - (decimal)_DataRows[i]["price"];
|
|
_DataRows[i]["promotion"] = promotion;
|
|
}
|
|
promotion++;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 套餐删除
|
|
/// </summary>
|
|
/// <param name="promotion"></param>
|
|
/// <param name="GoodsTable"></param>
|
|
public static void PromotionDelete(string promotion, DataTable GoodsTable)
|
|
{
|
|
DataRow[] _Rows = GoodsTable.Select("promotion = '" + promotion + "'");
|
|
if (_Rows.Length > 0)
|
|
{
|
|
for (int i = 0; i < _Rows.Length; i++)
|
|
{
|
|
_Rows[i]["price"] = decimal.Parse(_Rows[i]["Count"].ToString()) *
|
|
decimal.Parse(_Rows[i]["actualprice"].ToString());
|
|
_Rows[i]["discount_rate"] = ((decimal)_Rows[i]["commodity_retailprice"]
|
|
* (decimal)_Rows[i]["Count"]) - (decimal)_Rows[i]["price"];
|
|
_Rows[i]["promotion"] = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
#region 方法 -> 促销检测
|
|
/// <summary>
|
|
/// 促销检测
|
|
/// </summary>
|
|
/// <param name="goodsRow">当前商品信息</param>
|
|
/// <param name="goodsTable">商品列表</param>
|
|
/// <param name="isChangeCount">是否改数量(默认不改)</param>
|
|
/// <returns></returns>
|
|
public static DataRow PromotionCheck(DataRow goodsRow, DataTable goodsTable, bool isChangeCount = false)
|
|
{
|
|
//通过全局缓存对象判断,存在促销活动则进行商品判断
|
|
if (PosControl.SalesPromoteList != null && PosControl.SalesPromoteList.Count > 0)
|
|
{
|
|
//检查当前扫描的商品是否有正在进行的促销活动
|
|
List<ESSupport.Model.DataSave.SalesPromotionModel> pm_Promotion = PosControl.SalesPromoteList.FindAll(p =>
|
|
{
|
|
return (!string.IsNullOrWhiteSpace(p.Commodity_Main) && p.Commodity_Main.Split('|').Contains(goodsRow["commodity_barcode"].ToString())) ||
|
|
(!string.IsNullOrWhiteSpace(p.Commodity_Auxiliary) && p.Commodity_Auxiliary.Split('|').Contains(goodsRow["commodity_barcode"].ToString()));
|
|
});
|
|
//判断商品是否存在促销
|
|
if (pm_Promotion != null && pm_Promotion.Count > 0)
|
|
{
|
|
//检测当前时间是否还在促销期内
|
|
if (pm_Promotion[0].Promotion_StartDate <= DateTime.Now && pm_Promotion[0].Promotion_EndDate >= DateTime.Now)
|
|
{
|
|
goodsRow = ESSupport.Method.Sales.SalesPromotionMethod.SalesPromotionCheck(pm_Promotion[0], goodsRow, goodsTable, isChangeCount);
|
|
}
|
|
}
|
|
}
|
|
//返回最终的商品数据
|
|
return goodsRow;
|
|
}
|
|
#endregion
|
|
}
|
|
}
|