加价功能逻辑(暂时加价不开放)
This commit is contained in:
1 parent
535adc6011
commit
e4b726fc51
7 files changed
+320
-151
No files matched your search
@@ -27,8 +27,8 @@ namespace AllBase
|
||||
/// <summary>
|
||||
/// 版本ID
|
||||
/// </summary>
|
||||
public static int VersionCount = 525;
|
||||
//public static int VersionCount = 525;
|
||||
public static int VersionCount = 526;
|
||||
//public static int VersionCount = 526;
|
||||
|
||||
/// <summary>
|
||||
/// 版本号
|
||||
|
||||
@@ -106,7 +106,8 @@ namespace KJD_Web.BLL
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@end_markup_times", Value = end_markup_times.ParseToInt(), });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@start_extra_price", Value = start_extra_price.ParseToInt(), });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "@end_extra_price", Value = end_extra_price.ParseToInt(), });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@in_ext_code", Value = "'" + in_ext_code?.Replace(",","','") + "'", });
|
||||
//paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@in_ext_code", Value = "'" + in_ext_code?.Replace(",", "','") + "'", });
|
||||
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "@in_ext_code", Value = in_ext_code.ParseToString() });
|
||||
|
||||
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
|
||||
MysqlUtils mySql = new MysqlUtils(conn);
|
||||
@@ -131,7 +132,7 @@ namespace KJD_Web.BLL
|
||||
if (!string.IsNullOrWhiteSpace(end_extra_price))
|
||||
where += " and p.extra_price <= @end_extra_price";
|
||||
if (!string.IsNullOrEmpty(in_ext_code))
|
||||
where += " and p.ext_code in (@in_ext_code)";
|
||||
where += " and p.ext_code in ('" + in_ext_code?.Replace(",", "','") + "')";
|
||||
sql += where;
|
||||
|
||||
var count = mySql.ExecuteRowCount(sql, paramLst.ToArray());
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
{
|
||||
List<TemuDBProductSelect> lstAdminTemuDBProductSelect = new List<TemuDBProductSelect>();
|
||||
List<ShopLoginInfo> shopLst = new List<ShopLoginInfo>();
|
||||
List<TemuDBPriceInfo> lstDbPrice = new List<TemuDBPriceInfo>();
|
||||
|
||||
public DbProductSelectListManageForm()
|
||||
{
|
||||
@@ -486,6 +487,11 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colSelectId"]?.Value.ToString()).ToList();
|
||||
var prodList = this.lstAdminTemuDBProductSelect.Where(p => lstProdId.Contains(p.id.ParseToString())).ToArray();
|
||||
|
||||
// 上传前先获取加价信息
|
||||
var extCodes = prodList.Select(s => s.ext_code).Where(s => !string.IsNullOrWhiteSpace(s)).Distinct().ToList();
|
||||
lstDbPrice.Clear();
|
||||
lstDbPrice.AddRange(GetServerPriceLst(extCodes));
|
||||
|
||||
if (prodList.Count() > 0)
|
||||
{
|
||||
this.btnAdd.Enabled = false;
|
||||
@@ -1154,6 +1160,9 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
JsonHelper.SerializeObject(skuInfo.productSkuWhExtAttr.productSkuWeight)),
|
||||
};
|
||||
skuItem.supplierPrice = skuInfo.supplierPrice;
|
||||
//var dbPrice = lstDbPrice.FirstOrDefault(p => p.ext_code == dbProd.ext_code);
|
||||
//if (dbPrice != null)
|
||||
// skuItem.supplierPrice = dbPrice.original_price * dbPrice.markup_times + dbPrice.extra_price;
|
||||
|
||||
#region 使用随机sku价格上传(第一个sku价格不变,此处有bug,平台最后的sku排列不是按照提交上去的顺序排的)
|
||||
if (skuCount != 1 && chkSkuRandomPrice.Checked)
|
||||
@@ -1604,5 +1613,34 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
SearchDbProdSelect(this.ucSplitPage1.CurrentPage);
|
||||
});
|
||||
}
|
||||
|
||||
public List<TemuDBPriceInfo> GetServerPriceLst(List<string> extCodeList)
|
||||
{
|
||||
List<TemuDBPriceInfo> list = new List<TemuDBPriceInfo>();
|
||||
|
||||
var url = BaseClass.BuildObjString("price/get_price_list");
|
||||
var data = UserLogin.GetSignaturex();
|
||||
data += "&page=1";
|
||||
data += "&page_size=200";
|
||||
data += "&in_ext_code=" + string.Join(",", extCodeList);
|
||||
var html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
html = GetHtml.PostUtf8(url, data);
|
||||
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
|
||||
{
|
||||
return list;
|
||||
}
|
||||
|
||||
if (!html.Contains("data"))
|
||||
return list;
|
||||
|
||||
var jArr = JObject.Parse(html)["data"];
|
||||
if (jArr.Count() == 0)
|
||||
return list;
|
||||
|
||||
return JsonHelper.DeserializeJsonToList<TemuDBPriceInfo>(jArr.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
+115
-102
@@ -30,14 +30,15 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
|
||||
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.panel5 = new System.Windows.Forms.Panel();
|
||||
this.chkShowDelete = new TemuKJD.UserComponent.UcCheckBox(this.components);
|
||||
this.btnDelete = new TemuKJD.UserControls.ButtonEx();
|
||||
this.panel4 = new System.Windows.Forms.Panel();
|
||||
this.btnImport = new DevComponents.DotNetBar.PanelEx();
|
||||
this.loginPanel = new DevComponents.DotNetBar.PanelEx();
|
||||
this.numericUpDown6 = new System.Windows.Forms.NumericUpDown();
|
||||
this.numericUpDown5 = new System.Windows.Forms.NumericUpDown();
|
||||
@@ -59,18 +60,18 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
|
||||
this.pbLoading = new System.Windows.Forms.PictureBox();
|
||||
this.dgvPrice = new TemuKJD.UserComponent.DataGridViewEx();
|
||||
this.chkAutoDrag = new System.Windows.Forms.CheckBox();
|
||||
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
|
||||
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
|
||||
this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||
this.colExtCpde = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colId = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colExtCode = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colOriginalPrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colMarkupTimes = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colExtraPrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.conNotes = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.colEdit = new System.Windows.Forms.DataGridViewLinkColumn();
|
||||
this.colDelete = new System.Windows.Forms.DataGridViewLinkColumn();
|
||||
this.chkAutoDrag = new System.Windows.Forms.CheckBox();
|
||||
this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage();
|
||||
this.statusBar = new TemuKJD.UserControls.StatusBarUserControl();
|
||||
this.btnImport = new DevComponents.DotNetBar.PanelEx();
|
||||
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
|
||||
this.splitContainer1.Panel1.SuspendLayout();
|
||||
this.splitContainer1.Panel2.SuspendLayout();
|
||||
@@ -165,6 +166,7 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
this.btnDelete.Text = "删除选中";
|
||||
this.btnDelete.UseVisualStyleBackColor = false;
|
||||
this.btnDelete.Visible = false;
|
||||
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
|
||||
//
|
||||
// panel4
|
||||
//
|
||||
@@ -193,6 +195,30 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
this.panel4.Size = new System.Drawing.Size(1087, 40);
|
||||
this.panel4.TabIndex = 0;
|
||||
//
|
||||
// btnImport
|
||||
//
|
||||
this.btnImport.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnImport.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnImport.DisabledBackColor = System.Drawing.Color.Empty;
|
||||
this.btnImport.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.btnImport.Location = new System.Drawing.Point(11, 8);
|
||||
this.btnImport.Name = "btnImport";
|
||||
this.btnImport.Size = new System.Drawing.Size(48, 26);
|
||||
this.btnImport.Style.Alignment = System.Drawing.StringAlignment.Center;
|
||||
this.btnImport.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.btnImport.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.btnImport.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
|
||||
this.btnImport.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
|
||||
this.btnImport.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
|
||||
this.btnImport.Style.ForeColor.Color = System.Drawing.Color.White;
|
||||
this.btnImport.Style.GradientAngle = 90;
|
||||
this.btnImport.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
|
||||
this.btnImport.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
|
||||
this.btnImport.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
|
||||
this.btnImport.TabIndex = 451;
|
||||
this.btnImport.Text = "导入";
|
||||
this.btnImport.Click += new System.EventHandler(this.btnImport_Click);
|
||||
//
|
||||
// loginPanel
|
||||
//
|
||||
this.loginPanel.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
@@ -481,27 +507,28 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
this.pbLoading.TabStop = false;
|
||||
this.pbLoading.Visible = false;
|
||||
//
|
||||
// dgvShop
|
||||
// dgvPrice
|
||||
//
|
||||
this.dgvPrice.AllowUserToAddRows = false;
|
||||
this.dgvPrice.AllowUserToDeleteRows = false;
|
||||
dataGridViewCellStyle5.BackColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.dgvPrice.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle5;
|
||||
dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
|
||||
this.dgvPrice.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
|
||||
this.dgvPrice.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
|
||||
this.dgvPrice.BackgroundColor = System.Drawing.Color.White;
|
||||
this.dgvPrice.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
dataGridViewCellStyle6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle6.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle6.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
dataGridViewCellStyle6.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle6.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle6.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.dgvPrice.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle6;
|
||||
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False;
|
||||
this.dgvPrice.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
|
||||
this.dgvPrice.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvPrice.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
|
||||
this.colSelect,
|
||||
this.colExtCpde,
|
||||
this.colId,
|
||||
this.colExtCode,
|
||||
this.colOriginalPrice,
|
||||
this.colMarkupTimes,
|
||||
this.colExtraPrice,
|
||||
@@ -510,69 +537,12 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
this.colDelete});
|
||||
this.dgvPrice.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.dgvPrice.Location = new System.Drawing.Point(4, 0);
|
||||
this.dgvPrice.Name = "dgvShop";
|
||||
this.dgvPrice.Name = "dgvPrice";
|
||||
this.dgvPrice.ReadOnly = true;
|
||||
this.dgvPrice.RowTemplate.Height = 23;
|
||||
this.dgvPrice.Size = new System.Drawing.Size(1299, 456);
|
||||
this.dgvPrice.TabIndex = 5;
|
||||
//
|
||||
// colSelect
|
||||
//
|
||||
this.colSelect.FillWeight = 26F;
|
||||
this.colSelect.HeaderText = "选";
|
||||
this.colSelect.Name = "colSelect";
|
||||
this.colSelect.ReadOnly = true;
|
||||
this.colSelect.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colSelect.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
||||
//
|
||||
// colExtCpde
|
||||
//
|
||||
this.colExtCpde.FillWeight = 69.42599F;
|
||||
this.colExtCpde.HeaderText = "商品货号";
|
||||
this.colExtCpde.Name = "colExtCpde";
|
||||
this.colExtCpde.ReadOnly = true;
|
||||
//
|
||||
// colOriginalPrice
|
||||
//
|
||||
this.colOriginalPrice.FillWeight = 69.42599F;
|
||||
this.colOriginalPrice.HeaderText = "商品原价";
|
||||
this.colOriginalPrice.Name = "colOriginalPrice";
|
||||
this.colOriginalPrice.ReadOnly = true;
|
||||
//
|
||||
// colMarkupTimes
|
||||
//
|
||||
this.colMarkupTimes.HeaderText = "加价倍数";
|
||||
this.colMarkupTimes.Name = "colMarkupTimes";
|
||||
this.colMarkupTimes.ReadOnly = true;
|
||||
//
|
||||
// colExtraPrice
|
||||
//
|
||||
this.colExtraPrice.HeaderText = "额外加价";
|
||||
this.colExtraPrice.Name = "colExtraPrice";
|
||||
this.colExtraPrice.ReadOnly = true;
|
||||
//
|
||||
// conNotes
|
||||
//
|
||||
this.conNotes.HeaderText = "备注";
|
||||
this.conNotes.Name = "conNotes";
|
||||
this.conNotes.ReadOnly = true;
|
||||
//
|
||||
// colEdit
|
||||
//
|
||||
this.colEdit.FillWeight = 46F;
|
||||
this.colEdit.HeaderText = "编辑";
|
||||
this.colEdit.Name = "colEdit";
|
||||
this.colEdit.ReadOnly = true;
|
||||
this.colEdit.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colEdit.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
||||
//
|
||||
// colDelete
|
||||
//
|
||||
this.colDelete.FillWeight = 46F;
|
||||
this.colDelete.HeaderText = "删除";
|
||||
this.colDelete.Name = "colDelete";
|
||||
this.colDelete.ReadOnly = true;
|
||||
this.colDelete.Visible = false;
|
||||
this.dgvPrice.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvPrice_CellContentClick);
|
||||
//
|
||||
// chkAutoDrag
|
||||
//
|
||||
@@ -609,29 +579,71 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
this.statusBar.Size = new System.Drawing.Size(1307, 25);
|
||||
this.statusBar.TabIndex = 1;
|
||||
//
|
||||
// btnImport
|
||||
// colSelect
|
||||
//
|
||||
this.btnImport.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
|
||||
this.btnImport.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.btnImport.DisabledBackColor = System.Drawing.Color.Empty;
|
||||
this.btnImport.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.btnImport.Location = new System.Drawing.Point(11, 8);
|
||||
this.btnImport.Name = "btnImport";
|
||||
this.btnImport.Size = new System.Drawing.Size(48, 26);
|
||||
this.btnImport.Style.Alignment = System.Drawing.StringAlignment.Center;
|
||||
this.btnImport.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.btnImport.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
|
||||
this.btnImport.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
|
||||
this.btnImport.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
|
||||
this.btnImport.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
|
||||
this.btnImport.Style.ForeColor.Color = System.Drawing.Color.White;
|
||||
this.btnImport.Style.GradientAngle = 90;
|
||||
this.btnImport.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
|
||||
this.btnImport.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
|
||||
this.btnImport.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
|
||||
this.btnImport.TabIndex = 451;
|
||||
this.btnImport.Text = "导入";
|
||||
this.btnImport.Click += new System.EventHandler(this.btnImport_Click);
|
||||
this.colSelect.FillWeight = 26F;
|
||||
this.colSelect.HeaderText = "选";
|
||||
this.colSelect.Name = "colSelect";
|
||||
this.colSelect.ReadOnly = true;
|
||||
this.colSelect.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colSelect.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
||||
//
|
||||
// colId
|
||||
//
|
||||
this.colId.HeaderText = "数据库编号";
|
||||
this.colId.Name = "colId";
|
||||
this.colId.ReadOnly = true;
|
||||
this.colId.Visible = false;
|
||||
//
|
||||
// colExtCode
|
||||
//
|
||||
this.colExtCode.FillWeight = 69.42599F;
|
||||
this.colExtCode.HeaderText = "商品货号";
|
||||
this.colExtCode.Name = "colExtCode";
|
||||
this.colExtCode.ReadOnly = true;
|
||||
//
|
||||
// colOriginalPrice
|
||||
//
|
||||
this.colOriginalPrice.FillWeight = 69.42599F;
|
||||
this.colOriginalPrice.HeaderText = "商品原价";
|
||||
this.colOriginalPrice.Name = "colOriginalPrice";
|
||||
this.colOriginalPrice.ReadOnly = true;
|
||||
//
|
||||
// colMarkupTimes
|
||||
//
|
||||
this.colMarkupTimes.HeaderText = "加价倍数";
|
||||
this.colMarkupTimes.Name = "colMarkupTimes";
|
||||
this.colMarkupTimes.ReadOnly = true;
|
||||
//
|
||||
// colExtraPrice
|
||||
//
|
||||
this.colExtraPrice.HeaderText = "额外加价";
|
||||
this.colExtraPrice.Name = "colExtraPrice";
|
||||
this.colExtraPrice.ReadOnly = true;
|
||||
//
|
||||
// conNotes
|
||||
//
|
||||
this.conNotes.HeaderText = "备注";
|
||||
this.conNotes.Name = "conNotes";
|
||||
this.conNotes.ReadOnly = true;
|
||||
//
|
||||
// colEdit
|
||||
//
|
||||
this.colEdit.FillWeight = 46F;
|
||||
this.colEdit.HeaderText = "编辑";
|
||||
this.colEdit.Name = "colEdit";
|
||||
this.colEdit.ReadOnly = true;
|
||||
this.colEdit.Resizable = System.Windows.Forms.DataGridViewTriState.True;
|
||||
this.colEdit.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
|
||||
this.colEdit.Visible = false;
|
||||
//
|
||||
// colDelete
|
||||
//
|
||||
this.colDelete.FillWeight = 46F;
|
||||
this.colDelete.HeaderText = "删除";
|
||||
this.colDelete.Name = "colDelete";
|
||||
this.colDelete.ReadOnly = true;
|
||||
this.colDelete.Visible = false;
|
||||
//
|
||||
// DbPriceMarkUpForm
|
||||
//
|
||||
@@ -701,14 +713,15 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label8;
|
||||
private DevComponents.DotNetBar.PanelEx loginPanel;
|
||||
private DevComponents.DotNetBar.PanelEx btnImport;
|
||||
private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colExtCpde;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colId;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colExtCode;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colOriginalPrice;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colMarkupTimes;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn colExtraPrice;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn conNotes;
|
||||
private System.Windows.Forms.DataGridViewLinkColumn colEdit;
|
||||
private System.Windows.Forms.DataGridViewLinkColumn colDelete;
|
||||
private DevComponents.DotNetBar.PanelEx btnImport;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using TemuKJD.Extension;
|
||||
@@ -61,11 +62,11 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
private void btnImport_Click(object sender, EventArgs e)
|
||||
{
|
||||
ImportShop();
|
||||
SearchPrice(this.ucSplitPage1.CurrentPage);
|
||||
}
|
||||
|
||||
void ImportShop()
|
||||
{
|
||||
this.btnImport.Enabled = false;
|
||||
string text = "货号加价导入格式:\r\n\r\n" +
|
||||
"1.货号,价格/元,申报价格倍数,额外加价金额/元\r\n" +
|
||||
"2.货号,价格/元,申报价格倍数,额外加价金额/元,备注\r\n" +
|
||||
@@ -79,50 +80,85 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
openFileDialog.FilterIndex = 1;
|
||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
using (StreamReader sr = new StreamReader(openFileDialog.FileName, System.Text.Encoding.UTF8))
|
||||
//using (StreamReader sr = new StreamReader(openFileDialog.FileName, Encoding.GetEncoding("gb2312")))
|
||||
this.btnImport.Enabled = false;
|
||||
this.pbLoading.Enabled = true;
|
||||
Task.Run(() =>
|
||||
{
|
||||
string fileName = openFileDialog.FileName;
|
||||
string importStr = sr.ReadToEnd().Trim();
|
||||
var strArr = importStr.Split(new string[] { "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
for (int i = 0; i < strArr.Length; i++)
|
||||
using (StreamReader sr = new StreamReader(openFileDialog.FileName, System.Text.Encoding.UTF8))
|
||||
//using (StreamReader sr = new StreamReader(openFileDialog.FileName, Encoding.GetEncoding("gb2312")))
|
||||
{
|
||||
try
|
||||
string fileName = openFileDialog.FileName;
|
||||
string importStr = sr.ReadToEnd().Trim();
|
||||
var strArr = importStr.Split(new string[] { "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
Dictionary<string, string> errMsgDic = new Dictionary<string, string>();
|
||||
int count = 0;
|
||||
for (int i = 0; i < strArr.Length; i++)
|
||||
{
|
||||
// 通用格式
|
||||
//货号,价格/元,申报价格(加价比例),
|
||||
//001-007,9,2倍+3,
|
||||
if (strArr[i].Contains("倍+"))
|
||||
try
|
||||
{
|
||||
var productArr = strArr[i].Split(new string[] { " ", "\t", ",", "倍+" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (productArr.Length > 3)
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
TemuDBPriceInfo price = new TemuDBPriceInfo
|
||||
this.statusBar.lblTaskStatus.Text = "正在导入...";
|
||||
this.statusBar.pgbTaskProgress.Maximum = strArr.Length;
|
||||
this.statusBar.UpdateProgressBar(i+1);
|
||||
}));
|
||||
// 通用格式
|
||||
//货号,价格/元,申报价格(加价比例),
|
||||
//001-007,9,2倍+3,
|
||||
if (strArr[i].Contains("倍+"))
|
||||
{
|
||||
var productArr = strArr[i].Split(new string[] { " ", "\t", ",", "倍+" }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (productArr.Length > 3)
|
||||
{
|
||||
ext_code = productArr[0],
|
||||
original_price = (productArr[1].ParseToDecimal() * 100).ParseToInt(),
|
||||
markup_times = productArr[2].ParseToInt(),
|
||||
extra_price = (productArr[3].ParseToDecimal() * 100).ParseToInt(),
|
||||
};
|
||||
if (productArr.Length > 4)
|
||||
{
|
||||
price.notes = productArr[4];
|
||||
}
|
||||
count++;
|
||||
TemuDBPriceInfo price = new TemuDBPriceInfo
|
||||
{
|
||||
ext_code = productArr[0],
|
||||
original_price = (productArr[1].ParseToDecimal() * 100).ParseToInt(),
|
||||
markup_times = productArr[2].ParseToInt(),
|
||||
extra_price = (productArr[3].ParseToDecimal() * 100).ParseToInt(),
|
||||
};
|
||||
if (productArr.Length > 4)
|
||||
{
|
||||
price.notes = productArr[4];
|
||||
}
|
||||
|
||||
AddDbPrice(price);
|
||||
var msg = AddDbPrice(price, false);
|
||||
if (msg != "success")
|
||||
{
|
||||
errMsgDic[price.ext_code] = msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
int failCount = errMsgDic.Keys.Count;
|
||||
string failReason = string.Join(",", errMsgDic.Values.Distinct().ToArray());
|
||||
if (failReason.Length > 200)
|
||||
failReason = failReason.Substring(0, 200) + "...";
|
||||
string resultMsg = "加价信息导入完成,共导入 " + (count - failCount) + " 条数据";
|
||||
if (!string.IsNullOrWhiteSpace(failReason))
|
||||
resultMsg += "\r\n\r\n失败 " + failCount + " 条数据主要原因如下:\r\n" + failReason;
|
||||
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
}
|
||||
this.statusBar.lblTaskStatus.Text = "导入结束";
|
||||
BaseMsgForm.ShowInfo(resultMsg, "", FormLevel.LARGE);
|
||||
}));
|
||||
}
|
||||
}
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
this.pbLoading.Visible = false;
|
||||
this.btnImport.Enabled = true;
|
||||
}));
|
||||
});
|
||||
}
|
||||
this.btnImport.Enabled = true;
|
||||
}
|
||||
|
||||
public string AddDbPrice(TemuDBPriceInfo _price)
|
||||
public string AddDbPrice(TemuDBPriceInfo _price, bool isShowErrMsg = true)
|
||||
{
|
||||
var url = BaseClass.BuildObjString("price/add_price");
|
||||
var data = UserLogin.GetSignaturex()
|
||||
@@ -142,9 +178,13 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
var msg = BaseRegex.GetStringJson(ref result, "msg");
|
||||
if (string.IsNullOrEmpty(msg))
|
||||
msg = "加价保存失败!";
|
||||
BaseMsgForm.ShowError(msg);
|
||||
|
||||
if (isShowErrMsg)
|
||||
BaseMsgForm.ShowError(msg);
|
||||
|
||||
return msg;
|
||||
}
|
||||
return result;
|
||||
return "success";
|
||||
}
|
||||
|
||||
private void pnlEmpty_Click(object sender, EventArgs e)
|
||||
@@ -198,10 +238,11 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
{
|
||||
int rowIndex = this.dgvPrice.Rows.Add(
|
||||
extCodeList.Contains(price.ext_code),
|
||||
price.id,
|
||||
price.ext_code,
|
||||
price.original_price,
|
||||
price.original_price * 0.01,
|
||||
price.markup_times,
|
||||
price.extra_price,
|
||||
price.extra_price * 0.01,
|
||||
price.notes,
|
||||
"编辑",
|
||||
"删除");
|
||||
@@ -236,19 +277,19 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
|
||||
var url = BaseClass.BuildObjString("price/get_price_list");
|
||||
var data = UserLogin.GetSignaturex();
|
||||
data += "&page=" + page;
|
||||
data += "&page_size=" + pageSize;
|
||||
data += "&page=" + page;
|
||||
data += "&page_size=" + pageSize;
|
||||
if (numericUpDown1.Value > 0)
|
||||
data += "&start_original_price=" + numericUpDown1.Value * 100;
|
||||
data += "&end_original_price=" + numericUpDown2.Value * 100;
|
||||
data += "&end_original_price=" + numericUpDown2.Value * 100;
|
||||
if (numericUpDown3.Value > 0)
|
||||
data += "&start_markup_times=" + numericUpDown3.Value;
|
||||
data += "&end_markup_times=" + numericUpDown4.Value;
|
||||
data += "&end_markup_times=" + numericUpDown4.Value;
|
||||
if (numericUpDown5.Value > 0)
|
||||
data += "&start_extra_price=" + numericUpDown5.Value * 100;
|
||||
data += "&end_extra_price=" + numericUpDown6.Value * 100;
|
||||
data += "&search_ext_code=" + txtExtCode.Text.Trim();
|
||||
data += "&search_notes=" + txtNotes.Text.Trim();
|
||||
data += "&end_extra_price=" + numericUpDown6.Value * 100;
|
||||
data += "&search_ext_code=" + txtExtCode.Text.Trim();
|
||||
data += "&search_notes=" + txtNotes.Text.Trim();
|
||||
if (BaseClass.SaLevel > 1)
|
||||
data += "&operate_sub_sa_name=" + BaseClass.UserName;
|
||||
var html = GetHtml.PostUtf8(url, data);
|
||||
@@ -274,5 +315,78 @@ namespace TemuKJD.KJDForms.ProductSelectForms
|
||||
|
||||
return JsonHelper.DeserializeJsonToList<TemuDBPriceInfo>(jArr.ToString());
|
||||
}
|
||||
|
||||
private void dgvPrice_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.ColumnIndex < 0 || e.RowIndex < 0)
|
||||
return;
|
||||
string headerText = dgvPrice.Columns[e.ColumnIndex].HeaderText;
|
||||
string extCode = dgvPrice.Rows[e.RowIndex].Cells["colExtCode"].Value.ParseToString();
|
||||
string dbId = dgvPrice.Rows[e.RowIndex].Cells["colId"].Value.ParseToString();
|
||||
|
||||
switch (headerText)
|
||||
{
|
||||
case "删除":
|
||||
if (BaseMsgForm.ShowConfirm("确定删除加价数据吗?删除后不可恢复!").DialogResult == DialogResult.Cancel)
|
||||
return;
|
||||
var rst = DeleteServerPrice(dbId);
|
||||
if (rst)
|
||||
SearchPrice(this.ucSplitPage1.CurrentPage);
|
||||
break;
|
||||
case "编辑":
|
||||
//ShopAddEditForm editForm = new ShopAddEditForm(shop);
|
||||
//editForm.SaveCompleteWithDescribe += EditForm_SaveCompleteWithDescribe;
|
||||
//editForm.ShowDialog();
|
||||
break;
|
||||
default:
|
||||
dgvPrice.Rows[e.RowIndex].Cells["colSelect"].Value = !(bool)dgvPrice.Rows[e.RowIndex].Cells["colSelect"].Value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool DeleteServerPrice(string dbId, bool isShowErrMsg = true)
|
||||
{
|
||||
var url = BaseClass.BuildObjString("price/del_db_price");
|
||||
var data = UserLogin.GetSignaturex() + "&db_id=" + dbId;
|
||||
var result = GetHtml.PostUtf8(url, data);
|
||||
if (!result.Contains("\"code\":200"))
|
||||
{
|
||||
if (isShowErrMsg)
|
||||
BaseMsgForm.ShowError("删除失败:" + BaseRegex.GetStringJson(ref result, "msg"));
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (BaseMsgForm.ShowConfirm("确定删除加价参数吗?删除后不可恢复!").DialogResult == DialogResult.Cancel)
|
||||
return;
|
||||
|
||||
pbLoading.Visible = true;
|
||||
var dbIds = dgvPrice.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colSelect"].Value.ParseToBool() == true)
|
||||
.Select(r => r.Cells["colId"].Value.ParseToString());
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
foreach (var dbId in dbIds)
|
||||
{
|
||||
Thread.Sleep(50);
|
||||
var rst = DeleteServerPrice(dbId, false);
|
||||
if (rst == false)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
BaseMsgForm.ShowError("数据删除失败,请稍后重试!");
|
||||
}));
|
||||
break;
|
||||
}
|
||||
};
|
||||
SearchPrice(this.ucSplitPage1.CurrentPage);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -120,7 +120,10 @@
|
||||
<metadata name="colSelect.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colExtCpde.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<metadata name="colId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colExtCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="colOriginalPrice.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
|
||||
+3
-3
@@ -264,7 +264,7 @@
|
||||
"全部",
|
||||
"重上",
|
||||
"已买"});
|
||||
this.cmbUserNotes.Location = new System.Drawing.Point(1044, 5);
|
||||
this.cmbUserNotes.Location = new System.Drawing.Point(1044, 8);
|
||||
this.cmbUserNotes.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.cmbUserNotes.Name = "cmbUserNotes";
|
||||
this.cmbUserNotes.Size = new System.Drawing.Size(65, 25);
|
||||
@@ -281,7 +281,7 @@
|
||||
"核价成功",
|
||||
"核价成功(重复)",
|
||||
"重复"});
|
||||
this.cmbNotes.Location = new System.Drawing.Point(917, 5);
|
||||
this.cmbNotes.Location = new System.Drawing.Point(917, 8);
|
||||
this.cmbNotes.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.cmbNotes.Name = "cmbNotes";
|
||||
this.cmbNotes.Size = new System.Drawing.Size(65, 25);
|
||||
@@ -308,7 +308,7 @@
|
||||
"已上传",
|
||||
"草稿箱",
|
||||
"全部"});
|
||||
this.cmbStatus.Location = new System.Drawing.Point(814, 5);
|
||||
this.cmbStatus.Location = new System.Drawing.Point(814, 8);
|
||||
this.cmbStatus.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.cmbStatus.Name = "cmbStatus";
|
||||
this.cmbStatus.Size = new System.Drawing.Size(65, 25);
|
||||
|
||||
Reference in new issue
Block a user