上货增加用户上货 一部分配置 统一下发到用户
This commit is contained in:
1 parent
ca37be31c6
commit
65cbb347e1
9 files changed
+4124
-3364
No files matched your search
@@ -44,6 +44,9 @@
|
||||
<Compile Update="InitForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="KJDForms\SystemForms\SystemUploadConfigForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="KJDForms\SystemForms\SystemViolationDetectionForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
||||
+3
-1
@@ -30,8 +30,9 @@
|
||||
{
|
||||
System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("解除限制");
|
||||
System.Windows.Forms.TreeNode violationNode = new System.Windows.Forms.TreeNode("违规检测");
|
||||
System.Windows.Forms.TreeNode uploadConfigNode = new System.Windows.Forms.TreeNode("上货配置");
|
||||
System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("系统设置", new System.Windows.Forms.TreeNode[] {
|
||||
treeNode1, violationNode});
|
||||
treeNode1, violationNode, uploadConfigNode});
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.panel3 = new System.Windows.Forms.Panel();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
@@ -106,6 +107,7 @@
|
||||
treeNode1.Text = "解除限制";
|
||||
violationNode.Name = "违规检测";
|
||||
violationNode.Text = "违规检测";
|
||||
uploadConfigNode.Name = "上货配置";
|
||||
treeNode2.Name = "系统设置";
|
||||
treeNode2.Text = "系统设置";
|
||||
this.tv.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace TemuKJD.KJDForms.SystemForms
|
||||
{
|
||||
public Lazy<SystemRemoveRestrictionsForm> systemRemoveRestrictionsForm = new Lazy<SystemRemoveRestrictionsForm>();
|
||||
public Lazy<SystemViolationDetectionForm> systemViolationDetectionForm = new Lazy<SystemViolationDetectionForm>();
|
||||
public Lazy<SystemUploadConfigForm> systemUploadConfigForm = new Lazy<SystemUploadConfigForm>();
|
||||
public SystemForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -50,6 +51,9 @@ namespace TemuKJD.KJDForms.SystemForms
|
||||
case "违规检测":
|
||||
SetForm(systemViolationDetectionForm.Value);
|
||||
break;
|
||||
case "上货配置":
|
||||
SetForm(systemUploadConfigForm.Value);
|
||||
break;
|
||||
//case "商品管理":
|
||||
// SetForm(shopProductForm.Value);
|
||||
// break;
|
||||
|
||||
@@ -0,0 +1,279 @@
|
||||
namespace TemuKJD.KJDForms.SystemForms
|
||||
{
|
||||
partial class SystemUploadConfigForm
|
||||
{
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && components != null)
|
||||
components.Dispose();
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.contentLayout = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.grpReturnAddress = new System.Windows.Forms.GroupBox();
|
||||
this.returnAddressLayout = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.lblReturnAddressPolicy = new System.Windows.Forms.Label();
|
||||
this.chkUseOrderReturnWarehouseAddress = new TemuKJD.UserComponent.UcCheckBox(this.components);
|
||||
this.cmbReturnAddressPolicy = new System.Windows.Forms.ComboBox();
|
||||
this.sensitiveWordsLayout = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.cmbSensitiveWordsPolicy = new System.Windows.Forms.ComboBox();
|
||||
this.txtSensitiveWords = new System.Windows.Forms.TextBox();
|
||||
this.lblSensitiveWordsPolicy = new System.Windows.Forms.Label();
|
||||
this.grpSensitiveWords = new System.Windows.Forms.GroupBox();
|
||||
this.footerLayout = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.btnSave = new System.Windows.Forms.Button();
|
||||
this.btnLoad = new System.Windows.Forms.Button();
|
||||
this.lblStatus = new System.Windows.Forms.Label();
|
||||
this.contentLayout.SuspendLayout();
|
||||
this.grpReturnAddress.SuspendLayout();
|
||||
this.returnAddressLayout.SuspendLayout();
|
||||
this.sensitiveWordsLayout.SuspendLayout();
|
||||
this.grpSensitiveWords.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// contentLayout
|
||||
//
|
||||
this.contentLayout.AutoSize = true;
|
||||
this.contentLayout.ColumnCount = 1;
|
||||
this.contentLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.contentLayout.Controls.Add(this.grpReturnAddress, 0, 0);
|
||||
this.contentLayout.Controls.Add(this.grpSensitiveWords, 0, 1);
|
||||
this.contentLayout.Controls.Add(this.footerLayout, 0, 2);
|
||||
this.contentLayout.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.contentLayout.Location = new System.Drawing.Point(12, 12);
|
||||
this.contentLayout.MinimumSize = new System.Drawing.Size(560, 0);
|
||||
this.contentLayout.Name = "contentLayout";
|
||||
this.contentLayout.RowCount = 3;
|
||||
this.contentLayout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.contentLayout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.contentLayout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.contentLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.contentLayout.Size = new System.Drawing.Size(836, 214);
|
||||
this.contentLayout.TabIndex = 0;
|
||||
//
|
||||
// grpReturnAddress
|
||||
//
|
||||
this.grpReturnAddress.Controls.Add(this.returnAddressLayout);
|
||||
this.grpReturnAddress.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.grpReturnAddress.Location = new System.Drawing.Point(0, 0);
|
||||
this.grpReturnAddress.Margin = new System.Windows.Forms.Padding(0, 0, 0, 8);
|
||||
this.grpReturnAddress.Name = "grpReturnAddress";
|
||||
this.grpReturnAddress.Padding = new System.Windows.Forms.Padding(10);
|
||||
this.grpReturnAddress.Size = new System.Drawing.Size(836, 64);
|
||||
this.grpReturnAddress.TabIndex = 0;
|
||||
this.grpReturnAddress.TabStop = false;
|
||||
this.grpReturnAddress.Text = "使用拍单退货仓库地址";
|
||||
//
|
||||
// returnAddressLayout
|
||||
//
|
||||
this.returnAddressLayout.ColumnCount = 3;
|
||||
this.returnAddressLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.returnAddressLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.returnAddressLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 108F));
|
||||
this.returnAddressLayout.Controls.Add(this.lblReturnAddressPolicy, 1, 0);
|
||||
this.returnAddressLayout.Controls.Add(this.chkUseOrderReturnWarehouseAddress, 0, 0);
|
||||
this.returnAddressLayout.Controls.Add(this.cmbReturnAddressPolicy, 2, 0);
|
||||
this.returnAddressLayout.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.returnAddressLayout.Location = new System.Drawing.Point(10, 26);
|
||||
this.returnAddressLayout.Name = "returnAddressLayout";
|
||||
this.returnAddressLayout.RowCount = 1;
|
||||
this.returnAddressLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.returnAddressLayout.Size = new System.Drawing.Size(816, 28);
|
||||
this.returnAddressLayout.TabIndex = 0;
|
||||
//
|
||||
// lblReturnAddressPolicy
|
||||
//
|
||||
this.lblReturnAddressPolicy.AutoSize = true;
|
||||
this.lblReturnAddressPolicy.Location = new System.Drawing.Point(644, 4);
|
||||
this.lblReturnAddressPolicy.Margin = new System.Windows.Forms.Padding(12, 4, 8, 0);
|
||||
this.lblReturnAddressPolicy.Name = "lblReturnAddressPolicy";
|
||||
this.lblReturnAddressPolicy.Size = new System.Drawing.Size(56, 17);
|
||||
this.lblReturnAddressPolicy.TabIndex = 0;
|
||||
this.lblReturnAddressPolicy.Text = "继承策略";
|
||||
//
|
||||
// chkUseOrderReturnWarehouseAddress
|
||||
//
|
||||
this.chkUseOrderReturnWarehouseAddress.AccessibleName = "使用拍单退货仓库地址";
|
||||
this.chkUseOrderReturnWarehouseAddress.AutoSize = true;
|
||||
this.chkUseOrderReturnWarehouseAddress.Location = new System.Drawing.Point(0, 2);
|
||||
this.chkUseOrderReturnWarehouseAddress.Margin = new System.Windows.Forms.Padding(0, 2, 0, 0);
|
||||
this.chkUseOrderReturnWarehouseAddress.Name = "chkUseOrderReturnWarehouseAddress";
|
||||
this.chkUseOrderReturnWarehouseAddress.Size = new System.Drawing.Size(51, 21);
|
||||
this.chkUseOrderReturnWarehouseAddress.TabIndex = 0;
|
||||
this.chkUseOrderReturnWarehouseAddress.Text = "启用";
|
||||
//
|
||||
// cmbReturnAddressPolicy
|
||||
//
|
||||
this.cmbReturnAddressPolicy.AccessibleName = "使用拍单退货仓库地址继承策略";
|
||||
this.cmbReturnAddressPolicy.DisplayMember = "Text";
|
||||
this.cmbReturnAddressPolicy.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.cmbReturnAddressPolicy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbReturnAddressPolicy.Location = new System.Drawing.Point(708, 0);
|
||||
this.cmbReturnAddressPolicy.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.cmbReturnAddressPolicy.Name = "cmbReturnAddressPolicy";
|
||||
this.cmbReturnAddressPolicy.Size = new System.Drawing.Size(108, 25);
|
||||
this.cmbReturnAddressPolicy.TabIndex = 1;
|
||||
this.cmbReturnAddressPolicy.ValueMember = "Value";
|
||||
//
|
||||
// sensitiveWordsLayout
|
||||
//
|
||||
this.sensitiveWordsLayout.ColumnCount = 3;
|
||||
this.sensitiveWordsLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.sensitiveWordsLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.sensitiveWordsLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 108F));
|
||||
this.sensitiveWordsLayout.Controls.Add(this.lblSensitiveWordsPolicy, 1, 0);
|
||||
this.sensitiveWordsLayout.Controls.Add(this.txtSensitiveWords, 0, 0);
|
||||
this.sensitiveWordsLayout.Controls.Add(this.cmbSensitiveWordsPolicy, 2, 0);
|
||||
this.sensitiveWordsLayout.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.sensitiveWordsLayout.Location = new System.Drawing.Point(10, 26);
|
||||
this.sensitiveWordsLayout.Name = "sensitiveWordsLayout";
|
||||
this.sensitiveWordsLayout.RowCount = 1;
|
||||
this.sensitiveWordsLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.sensitiveWordsLayout.Size = new System.Drawing.Size(816, 94);
|
||||
this.sensitiveWordsLayout.TabIndex = 0;
|
||||
//
|
||||
// cmbSensitiveWordsPolicy
|
||||
//
|
||||
this.cmbSensitiveWordsPolicy.AccessibleName = "敏感词继承策略";
|
||||
this.cmbSensitiveWordsPolicy.DisplayMember = "Text";
|
||||
this.cmbSensitiveWordsPolicy.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.cmbSensitiveWordsPolicy.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbSensitiveWordsPolicy.Location = new System.Drawing.Point(708, 0);
|
||||
this.cmbSensitiveWordsPolicy.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.cmbSensitiveWordsPolicy.Name = "cmbSensitiveWordsPolicy";
|
||||
this.cmbSensitiveWordsPolicy.Size = new System.Drawing.Size(108, 25);
|
||||
this.cmbSensitiveWordsPolicy.TabIndex = 1;
|
||||
this.cmbSensitiveWordsPolicy.ValueMember = "Value";
|
||||
//
|
||||
// txtSensitiveWords
|
||||
//
|
||||
this.txtSensitiveWords.AcceptsReturn = true;
|
||||
this.txtSensitiveWords.AccessibleName = "敏感词";
|
||||
this.txtSensitiveWords.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.txtSensitiveWords.Location = new System.Drawing.Point(0, 0);
|
||||
this.txtSensitiveWords.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.txtSensitiveWords.Multiline = true;
|
||||
this.txtSensitiveWords.Name = "txtSensitiveWords";
|
||||
this.txtSensitiveWords.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
|
||||
this.txtSensitiveWords.Size = new System.Drawing.Size(632, 94);
|
||||
this.txtSensitiveWords.TabIndex = 0;
|
||||
//
|
||||
// lblSensitiveWordsPolicy
|
||||
//
|
||||
this.lblSensitiveWordsPolicy.AutoSize = true;
|
||||
this.lblSensitiveWordsPolicy.Location = new System.Drawing.Point(644, 4);
|
||||
this.lblSensitiveWordsPolicy.Margin = new System.Windows.Forms.Padding(12, 4, 8, 0);
|
||||
this.lblSensitiveWordsPolicy.Name = "lblSensitiveWordsPolicy";
|
||||
this.lblSensitiveWordsPolicy.Size = new System.Drawing.Size(56, 17);
|
||||
this.lblSensitiveWordsPolicy.TabIndex = 0;
|
||||
this.lblSensitiveWordsPolicy.Text = "继承策略";
|
||||
//
|
||||
// grpSensitiveWords
|
||||
//
|
||||
this.grpSensitiveWords.Controls.Add(this.sensitiveWordsLayout);
|
||||
this.grpSensitiveWords.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.grpSensitiveWords.Location = new System.Drawing.Point(0, 72);
|
||||
this.grpSensitiveWords.Margin = new System.Windows.Forms.Padding(0, 0, 0, 8);
|
||||
this.grpSensitiveWords.Name = "grpSensitiveWords";
|
||||
this.grpSensitiveWords.Padding = new System.Windows.Forms.Padding(10);
|
||||
this.grpSensitiveWords.Size = new System.Drawing.Size(836, 130);
|
||||
this.grpSensitiveWords.TabIndex = 1;
|
||||
this.grpSensitiveWords.TabStop = false;
|
||||
this.grpSensitiveWords.Text = "敏感词(每行一个)";
|
||||
//
|
||||
// footerLayout
|
||||
//
|
||||
this.footerLayout.AutoSize = true;
|
||||
this.footerLayout.ColumnCount = 1;
|
||||
this.footerLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.footerLayout.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.footerLayout.Location = new System.Drawing.Point(0, 214);
|
||||
this.footerLayout.Margin = new System.Windows.Forms.Padding(0, 4, 0, 0);
|
||||
this.footerLayout.Name = "footerLayout";
|
||||
this.footerLayout.RowCount = 1;
|
||||
this.footerLayout.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
this.footerLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
|
||||
this.footerLayout.Size = new System.Drawing.Size(836, 0);
|
||||
this.footerLayout.TabIndex = 2;
|
||||
//
|
||||
// btnSave
|
||||
//
|
||||
this.btnSave.Location = new System.Drawing.Point(21, 239);
|
||||
this.btnSave.Name = "btnSave";
|
||||
this.btnSave.Size = new System.Drawing.Size(75, 33);
|
||||
this.btnSave.TabIndex = 5;
|
||||
this.btnSave.Text = "保存配置";
|
||||
this.btnSave.UseVisualStyleBackColor = true;
|
||||
this.btnSave.Click += new System.EventHandler(this.Save_Click);
|
||||
//
|
||||
// btnLoad
|
||||
//
|
||||
this.btnLoad.Location = new System.Drawing.Point(102, 239);
|
||||
this.btnLoad.Name = "btnLoad";
|
||||
this.btnLoad.Size = new System.Drawing.Size(75, 33);
|
||||
this.btnLoad.TabIndex = 6;
|
||||
this.btnLoad.Text = "读取配置";
|
||||
this.btnLoad.UseVisualStyleBackColor = true;
|
||||
this.btnLoad.Click += new System.EventHandler(this.btnLoad_Click);
|
||||
//
|
||||
// lblStatus
|
||||
//
|
||||
this.lblStatus.AutoSize = true;
|
||||
this.lblStatus.Location = new System.Drawing.Point(196, 247);
|
||||
this.lblStatus.Name = "lblStatus";
|
||||
this.lblStatus.Size = new System.Drawing.Size(43, 17);
|
||||
this.lblStatus.TabIndex = 7;
|
||||
this.lblStatus.Text = "label1";
|
||||
//
|
||||
// SystemUploadConfigForm
|
||||
//
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
this.AutoScroll = true;
|
||||
this.ClientSize = new System.Drawing.Size(860, 450);
|
||||
this.Controls.Add(this.lblStatus);
|
||||
this.Controls.Add(this.btnLoad);
|
||||
this.Controls.Add(this.btnSave);
|
||||
this.Controls.Add(this.contentLayout);
|
||||
this.Font = new System.Drawing.Font("微软雅黑", 9F);
|
||||
this.Name = "SystemUploadConfigForm";
|
||||
this.Padding = new System.Windows.Forms.Padding(12);
|
||||
this.Text = "上货配置";
|
||||
this.contentLayout.ResumeLayout(false);
|
||||
this.contentLayout.PerformLayout();
|
||||
this.grpReturnAddress.ResumeLayout(false);
|
||||
this.returnAddressLayout.ResumeLayout(false);
|
||||
this.returnAddressLayout.PerformLayout();
|
||||
this.sensitiveWordsLayout.ResumeLayout(false);
|
||||
this.sensitiveWordsLayout.PerformLayout();
|
||||
this.grpSensitiveWords.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TableLayoutPanel contentLayout;
|
||||
private System.Windows.Forms.GroupBox grpReturnAddress;
|
||||
private System.Windows.Forms.TableLayoutPanel returnAddressLayout;
|
||||
private System.Windows.Forms.Label lblReturnAddressPolicy;
|
||||
private TemuKJD.UserComponent.UcCheckBox chkUseOrderReturnWarehouseAddress;
|
||||
private System.Windows.Forms.ComboBox cmbReturnAddressPolicy;
|
||||
private System.Windows.Forms.GroupBox grpSensitiveWords;
|
||||
private System.Windows.Forms.TableLayoutPanel sensitiveWordsLayout;
|
||||
private System.Windows.Forms.Label lblSensitiveWordsPolicy;
|
||||
private System.Windows.Forms.TextBox txtSensitiveWords;
|
||||
private System.Windows.Forms.ComboBox cmbSensitiveWordsPolicy;
|
||||
private System.Windows.Forms.TableLayoutPanel footerLayout;
|
||||
private System.Windows.Forms.Button btnSave;
|
||||
private System.Windows.Forms.Button btnLoad;
|
||||
private System.Windows.Forms.Label lblStatus;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,189 @@
|
||||
using AllBase;
|
||||
using AllBase.Model.Result;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using TemuKJD.BaseForms;
|
||||
using Work;
|
||||
|
||||
namespace TemuKJD.KJDForms.SystemForms
|
||||
{
|
||||
public partial class SystemUploadConfigForm : BaseForm
|
||||
{
|
||||
private UserConfig config = new UserConfig();
|
||||
private readonly bool IsMainUser;
|
||||
private bool isBusy;
|
||||
|
||||
public SystemUploadConfigForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
IsMainUser = BaseClass.GroupId == 3;
|
||||
InitializePolicy(cmbSensitiveWordsPolicy);
|
||||
InitializePolicy(cmbReturnAddressPolicy);
|
||||
UpdateAccess();
|
||||
lblStatus.Text = IsMainUser ? "可编辑、保存和读取配置。" : "当前账号只读。";
|
||||
Load += btnLoad_Click;
|
||||
}
|
||||
|
||||
private void UpdateAccess()
|
||||
{
|
||||
bool canEdit = IsMainUser && !isBusy;
|
||||
txtSensitiveWords.ReadOnly = !canEdit;
|
||||
chkUseOrderReturnWarehouseAddress.Enabled = canEdit;
|
||||
cmbSensitiveWordsPolicy.Enabled = canEdit;
|
||||
cmbReturnAddressPolicy.Enabled = canEdit;
|
||||
btnSave.Visible = IsMainUser;
|
||||
btnSave.Enabled = canEdit;
|
||||
btnLoad.Enabled = !isBusy;
|
||||
}
|
||||
|
||||
private async void btnLoad_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (isBusy) return;
|
||||
if (string.IsNullOrWhiteSpace(BaseClass.UserName))
|
||||
{
|
||||
lblStatus.Text = "读取失败:当前登录账号为空。";
|
||||
return;
|
||||
}
|
||||
|
||||
isBusy = true;
|
||||
UpdateAccess();
|
||||
lblStatus.Text = "正在读取配置…";
|
||||
try
|
||||
{
|
||||
ApplyConfig(await LoadConfigAsync());
|
||||
lblStatus.Text = IsMainUser ? "配置已读取。" : "配置已读取,当前账号只读。";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
lblStatus.Text = "读取失败:" + ex.Message;
|
||||
}
|
||||
finally
|
||||
{
|
||||
isBusy = false;
|
||||
UpdateAccess();
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyConfig(UserConfig loadedConfig)
|
||||
{
|
||||
loadedConfig.Configs.TryGetValue(UserConfig.SensitiveWordsKey, out var words);
|
||||
loadedConfig.Configs.TryGetValue(UserConfig.UseOrderReturnWarehouseAddressKey, out var address);
|
||||
if ((words != null && !Enum.IsDefined(typeof(UserConfig.InheritPolicy), words.Policy)) ||
|
||||
(address != null && !Enum.IsDefined(typeof(UserConfig.InheritPolicy), address.Policy)))
|
||||
throw new InvalidOperationException("云端配置包含无效的继承策略。");
|
||||
|
||||
bool useAddress = false;
|
||||
if (address != null && !bool.TryParse(address.Value, out useAddress))
|
||||
throw new InvalidOperationException("云端退货仓库地址开关值无效。");
|
||||
|
||||
txtSensitiveWords.Text = words?.Value ?? string.Empty;
|
||||
cmbSensitiveWordsPolicy.SelectedValue = words?.Policy ?? UserConfig.InheritPolicy.Free;
|
||||
chkUseOrderReturnWarehouseAddress.Checked = useAddress;
|
||||
cmbReturnAddressPolicy.SelectedValue = address?.Policy ?? UserConfig.InheritPolicy.Free;
|
||||
config = loadedConfig;
|
||||
}
|
||||
|
||||
private async void Save_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsMainUser)
|
||||
{
|
||||
lblStatus.Text = "当前账号只读,只有主账号可以保存配置。";
|
||||
return;
|
||||
}
|
||||
if (isBusy) return;
|
||||
if (string.IsNullOrWhiteSpace(BaseClass.UserName))
|
||||
{
|
||||
lblStatus.Text = "保存失败:当前登录账号为空。";
|
||||
return;
|
||||
}
|
||||
|
||||
isBusy = true;
|
||||
UpdateAccess();
|
||||
lblStatus.Text = "正在保存配置…";
|
||||
try
|
||||
{
|
||||
config.Configs[UserConfig.SensitiveWordsKey] = new UserConfig.ConfigItem
|
||||
{
|
||||
Key = UserConfig.SensitiveWordsKey,
|
||||
Value = txtSensitiveWords.Text,
|
||||
Policy = (UserConfig.InheritPolicy)cmbSensitiveWordsPolicy.SelectedValue
|
||||
};
|
||||
config.Configs[UserConfig.UseOrderReturnWarehouseAddressKey] = new UserConfig.ConfigItem
|
||||
{
|
||||
Key = UserConfig.UseOrderReturnWarehouseAddressKey,
|
||||
Value = chkUseOrderReturnWarehouseAddress.Checked.ToString(),
|
||||
Policy = (UserConfig.InheritPolicy)cmbReturnAddressPolicy.SelectedValue
|
||||
};
|
||||
await UploadConfigAsync(JsonConvert.SerializeObject(config));
|
||||
lblStatus.Text = "配置已保存。";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
lblStatus.Text = "保存失败:" + ex.Message;
|
||||
}
|
||||
finally
|
||||
{
|
||||
isBusy = false;
|
||||
UpdateAccess();
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<UserConfig> LoadConfigAsync()
|
||||
{
|
||||
var url = BaseClass.BuildObjString("user/getUserConfig");
|
||||
var data = UserLogin.GetSignPostData(new { });
|
||||
var html = await GetHtml.PostJsonAsync(url, data);
|
||||
return ParseConfigResponse(html);
|
||||
}
|
||||
|
||||
private static UserConfig ParseConfigResponse(string html)
|
||||
{
|
||||
var ret = JsonConvert.DeserializeObject<Result<string>>(html);
|
||||
if (ret == null)
|
||||
throw new InvalidOperationException("服务器返回为空。");
|
||||
if (ret.Code != 200)
|
||||
throw new InvalidOperationException(ret.Msg ?? "读取配置失败。");
|
||||
if (ret.Data == null)
|
||||
throw new InvalidOperationException("服务器未返回配置数据。");
|
||||
if (string.IsNullOrWhiteSpace(ret.Data))
|
||||
return new UserConfig();
|
||||
|
||||
var loadedConfig = JsonConvert.DeserializeObject<UserConfig>(ret.Data);
|
||||
if (loadedConfig?.Configs == null)
|
||||
throw new InvalidOperationException("云端配置格式无效。");
|
||||
return loadedConfig;
|
||||
}
|
||||
|
||||
private async Task UploadConfigAsync(string configJson)
|
||||
{
|
||||
if (!IsMainUser)
|
||||
throw new InvalidOperationException("只有主账号可以保存配置。");
|
||||
var url = BaseClass.BuildObjString("user/saveUserConfig");
|
||||
var data = UserLogin.GetSignPostData(new { Config = configJson });
|
||||
var html = await GetHtml.PostJsonAsync(url, data);
|
||||
var ret = JsonConvert.DeserializeObject<Result>(html);
|
||||
if (ret == null)
|
||||
throw new InvalidOperationException("服务器返回为空。");
|
||||
if (ret.Code != 200)
|
||||
throw new InvalidOperationException(ret.Msg ?? "保存配置失败。");
|
||||
}
|
||||
|
||||
private sealed class UserConfigData
|
||||
{
|
||||
[JsonProperty(Required = Required.AllowNull)]
|
||||
public string Config { get; set; }
|
||||
}
|
||||
|
||||
private static void InitializePolicy(ComboBox comboBox)
|
||||
{
|
||||
comboBox.DataSource = new[]
|
||||
{
|
||||
new { Text = "自由", Value = UserConfig.InheritPolicy.Free },
|
||||
new { Text = "锁定", Value = UserConfig.InheritPolicy.Locked },
|
||||
new { Text = "仅追加", Value = UserConfig.InheritPolicy.AppendOnly }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
+3417
-3360
File diff suppressed because it is too large.
Load diff
@@ -32,6 +32,7 @@ using System.Windows.Forms;
|
||||
using TemuKJD.BaseForms;
|
||||
using TemuKJD.BLL;
|
||||
using TemuKJD.Extension;
|
||||
using TemuKJD.KJDForms.SystemForms;
|
||||
using TemuKJD.PDDForms.ProductSelectForms;
|
||||
using TemuKJD.ToolForms;
|
||||
using TemuKJD.UserControls;
|
||||
@@ -86,9 +87,55 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
DataContext<WaitingProductConfig> _bs;
|
||||
|
||||
WaitingProductConfig waiting_product_config = new WaitingProductConfig();
|
||||
private UserConfig UserConfig { get; set; } = new();
|
||||
void InitUserConfig()
|
||||
{
|
||||
Task.Run(async () =>
|
||||
{
|
||||
UserConfig = await SystemUploadConfigForm.LoadConfigAsync();
|
||||
|
||||
if (UserConfig != null)
|
||||
{
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
if (UserConfig.TryGetConfig(UserConfig.UseOrderReturnWarehouseAddressKey, out UserConfig.ConfigItem addItem))
|
||||
{
|
||||
chkUseShanghaiReturnOrderAddress.Enabled = addItem.Policy != UserConfig.InheritPolicy.Locked;
|
||||
chkUseShanghaiReturnOrderAddress.Checked = addItem.Value.ParseToBool(false);
|
||||
}
|
||||
|
||||
if (UserConfig.TryGetConfig(UserConfig.SensitiveWordsKey, out UserConfig.ConfigItem filterItem))
|
||||
{
|
||||
txtReplaceText.Enabled = filterItem.Policy != UserConfig.InheritPolicy.Locked;
|
||||
|
||||
if (filterItem.Policy == UserConfig.InheritPolicy.Locked)
|
||||
{
|
||||
txtReplaceText.Enabled = false;
|
||||
txtReplaceText.Text = filterItem.Value;
|
||||
}
|
||||
else if (filterItem.Policy == UserConfig.InheritPolicy.AppendOnly)
|
||||
{
|
||||
txtReplaceText.Enabled = false;
|
||||
txtReplaceText.Text += filterItem.Value;
|
||||
}
|
||||
else if (filterItem.Policy == UserConfig.InheritPolicy.Free)
|
||||
{
|
||||
if (string.IsNullOrEmpty(txtReplaceText.Text))
|
||||
{
|
||||
txtReplaceText.Text = filterItem.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}));
|
||||
}
|
||||
});
|
||||
}
|
||||
void InitWaitingProductConfigBinding()
|
||||
{
|
||||
InitUserConfig();
|
||||
|
||||
|
||||
Debug.WriteLine($"初始化配置");
|
||||
Invoke(new Action(() =>
|
||||
{
|
||||
@@ -125,7 +172,6 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
numFilterSaleCountNum.Bind(_bs, a => a.Value, a => a.FilterSaleCountNum);
|
||||
}));
|
||||
Debug.WriteLine($"初始化配置END");
|
||||
|
||||
}
|
||||
private void UserSelectDbProductForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
@@ -1693,9 +1739,9 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
|
||||
string UploadProduct(ShopLoginInfo shop, KJDDBProduct dbProd, TemuDBProductSelect selectProd, DataGridViewCell cell, DateTime startTime)
|
||||
{
|
||||
PlatformType Platform = (dbProd.product_get_type_text.Contains("多多")
|
||||
PlatformType Platform = (dbProd.product_get_type_text.Contains("多多")
|
||||
? PlatformType.PDD :
|
||||
dbProd.product_get_type_text.Contains("微信")
|
||||
dbProd.product_get_type_text.Contains("微信")
|
||||
? PlatformType.WX :
|
||||
PlatformType.None);
|
||||
|
||||
@@ -7688,6 +7734,15 @@ namespace TemuKJD.WXForms.ProductForms
|
||||
{
|
||||
RejectSevenDayReturn = chkRejectSevenDayReturn.Checked;
|
||||
}
|
||||
/// <summary>
|
||||
/// 刷新服务端配置
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void btnLoadConfig_Click(object sender, EventArgs e)
|
||||
{
|
||||
InitUserConfig();
|
||||
}
|
||||
}
|
||||
|
||||
public class WXUpload
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
using CefSharp.DevTools.IndexedDB;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Work;
|
||||
|
||||
/// <summary>
|
||||
/// 主账号云端配置
|
||||
/// </summary>
|
||||
public class UserConfig
|
||||
{
|
||||
public const string SensitiveWordsKey = "SensitiveWords";
|
||||
public const string UseOrderReturnWarehouseAddressKey = "UseOrderReturnWarehouseAddress";
|
||||
|
||||
public Dictionary<string, ConfigItem> Configs { get; set; } = [];
|
||||
public ConfigItem this[string key]
|
||||
{
|
||||
get => Configs.TryGetValue(key, out var item) ? item : null;
|
||||
}
|
||||
public bool TryGetConfig(string key, out ConfigItem item)
|
||||
{
|
||||
return Configs.TryGetValue(key, out item);
|
||||
}
|
||||
public enum InheritPolicy
|
||||
{
|
||||
/// <summary>
|
||||
/// 自由
|
||||
/// </summary>
|
||||
Free = 0,
|
||||
/// <summary>
|
||||
/// 锁定
|
||||
/// </summary>
|
||||
Locked = 1,
|
||||
/// <summary>
|
||||
/// 追加
|
||||
/// </summary>
|
||||
AppendOnly = 2
|
||||
}
|
||||
|
||||
|
||||
public class ConfigItem
|
||||
{
|
||||
public string Key { get; set; }
|
||||
public string Value { get; set; }
|
||||
public InheritPolicy Policy { get; set; } = InheritPolicy.Free;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user