Files
KJD_WebService/TEMUKJD/KJDForms/JITForms/JITForm.cs
T
2025-12-26 09:53:29 +08:00

143 lines
4.7 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TemuKJD.BaseForms;
using TemuKJD.BLL;
using TemuKJD.KJDForms.AdminForms;
using TemuKJD.KJDForms.ProductForms;
using TemuKJD.KJDForms.ProductSelectForms;
namespace TemuKJD.KJDForms.JITForms
{
public partial class JITForm : BaseForm
{
public Lazy<JitShopActiveForm> jitShopActiveForm = new Lazy<JitShopActiveForm>(); // jit卡密激活
public Lazy<DbProductListForm> dbProductListForm = new Lazy<DbProductListForm>(); // jit选品库
public Lazy<DbProductSelectListManageForm> dDbProductSelectListManageForm = new Lazy<DbProductSelectListManageForm>(); // jit商品上传
public Lazy<AdminProductPriceCheckForm> productPriceCheckForm = new Lazy<AdminProductPriceCheckForm>(); // jit商品核价
public Lazy<TemuJitForm> temuJitForm = new Lazy<TemuJitForm>();
public Lazy<JitPushOrder> jitPushOrder = new Lazy<JitPushOrder>();
public JITForm()
{
InitializeComponent();
try
{
tv.SelectedNode = tv.Nodes[0].Nodes[0];
tv.ExpandGroup(tv.Nodes[0].Name);
List<string> hideName = new List<string>() { "请在列表中填写要隐藏的Tab页面", /*"JIT推单"*/ };
#if DEBUG
hideName.Remove("JIT推单");
#endif
foreach (var item in hideName)
{
var n = tv.Nodes[0].Nodes.Find(item, true);
if (n.Count() > 0)
n[0].Remove();
}
}
catch { }
}
private void tv_AfterSelect(object sender, TreeViewEventArgs e)
{
MainForm.sCurrentModule = e.Node.Name;
this.lblName.Text = e.Node.Text;
// 如果是一级菜单,不做任何动作
if (e.Node.Parent == null) return;
switch (e.Node.Name)
{
case "JIT卡密激活":
SetForm(jitShopActiveForm.Value);
break;
case "JIT商品选品":
dbProductListForm.Value.IsClientJit = true;
SetForm(dbProductListForm.Value);
break;
case "JIT商品上传":
dDbProductSelectListManageForm.Value.ClientMode = EnumClientMode.ClientJit;
SetForm(dDbProductSelectListManageForm.Value);
break;
case "JIT商品核价":
productPriceCheckForm.Value.ClientMode = EnumClientMode.ClientJit;
SetForm(productPriceCheckForm.Value);
break;
case "开通JIT":
temuJitForm.Value.IsClientJit = true;
SetForm(temuJitForm.Value);
break;
case "JIT推单":
jitPushOrder.Value.IsClientJit = true;
SetForm(jitPushOrder.Value);
break;
}
}
/// <summary>
/// 显示隐藏层
/// </summary>
/// <param name="f"></param>
private void SetForm(Form f)
{
if (f == null)
{
foreach (Control form in panel3.Controls)
{
form.Visible = false;
if (form is Form)
{
panel3.Controls.Remove(form as Form);
}
}
return;
}
bool had = false;
string sCurrentFormName = f.Name;
for (int i = 0; i < panel3.Controls.Count; i++)
{
if (sCurrentFormName == panel3.Controls[i].Name)
{
had = true;
panel3.Controls[i].Visible = true;
}
else
{
panel3.Controls[i].Visible = false;
}
}
if (had)
{
f = null;
return;
}
f.TopLevel = false;
f.Left = 0;
f.Top = 0;
f.FormBorderStyle = FormBorderStyle.None;
panel3.Controls.Add(f);
f.AutoSize = true;
f.Dock = DockStyle.Fill;
f.Show();
}
private void JITForm_Load(object sender, EventArgs e)
{
try
{
tv.SelectedNode = tv.Nodes[0].Nodes[0];
tv.ExpandGroup(tv.Nodes[0].Name);
}
catch { }
}
}
}