SVN-Revision: r731
This commit is contained in:
wyf
2025-06-14 14:08:58 +00:00
parent 4fab62b6be
commit 692adaade6
15 changed files with 6063 additions and 0 deletions
@@ -0,0 +1,103 @@
/******************************
* 说明:PubSpec 模块
* 创建人:龚宇超
* 创建日期:2018-01-02
* 修改人:
* 修改日期:
* 修改备注:
* 版本:1.0.0.0
******************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Lskj.Util;
using Lskj.Business;
using System.Windows.Forms;
using Lskj.Model;
using DevExpress.XtraGrid.Views.Grid;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using System.Data;
using Lskj.Business.Impl;
namespace Lskj.PubBomImportNew
{
/// <summary>
/// PubSpec 模块
/// </summary>
public class DllBaseClass : IForm
{
public DllBaseClass()
{
}
public DllBaseClass(string[] obj)
{
try
{
FrmMain main = new FrmMain();
this.SubForm = main;
main.Model = new DynamicBomImportNew(obj);
}
catch (Exception ex)
{
LogUtil.WriteError("Lskj.PubSpecialImport.dll--参数错误-->" + obj.ToString(), ex);
}
}
public Form SubForm { get; set; }
}
/// <summary>
/// PubSpecialImport入库参数
/// </summary>
public class DynamicBomImportNew : DynamicModel
{
/// <summary>
/// 标题行
/// </summary>
public string FirstRowIndex = "";
/// <summary>
/// 结束标识
/// </summary>
public string EndTableCond = "";
/// <summary>
/// sheet名称
/// </summary>
public string SheetName = "";
/// <summary>
/// 字段对照
/// </summary>
public string MainFieldDic = "";
/// <summary>
/// 读取筛选条件
/// </summary>
public string ReadTableCond = "";
/// <summary>
/// 忽略合并明细列标题行
/// </summary>
public bool CustomerServiceApp = false;
/// <summary>
/// 模块编码
/// </summary>
public string SaveModuleCode = "";
public DynamicBomImportNew(string[] args)
: base(args)
{
if (args.Length > 5 && !string.IsNullOrWhiteSpace(args[5]))
{
FirstRowIndex = args[5] + "";
}
if (args.Length > 6 && !string.IsNullOrWhiteSpace(args[6]))
{
EndTableCond = args[6] + "";
}
if (args.Length > 7 && !string.IsNullOrWhiteSpace(args[7]))
{
SheetName = args[7] + "";
}
if (args.Length > 8 && !string.IsNullOrWhiteSpace(args[8]))
{
MainFieldDic = args[8] + "";
}
if (args.Length > 9 && !string.IsNullOrWhiteSpace(args[9]))
{
+721
View File
@@ -0,0 +1,721 @@
namespace Lskj.PubBomImport
{
partial class FrmBillInfo
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.pl_main = new DevExpress.XtraEditors.PanelControl();
this.pl_main_center = new DevExpress.XtraEditors.PanelControl();
this.pl_main_center_detail = new DevExpress.XtraEditors.PanelControl();
this.gcMain = new Lskj.Control.GridControlEx();
this.pl_main_center_master = new DevExpress.XtraEditors.XtraScrollableControl();
this.pl_treeview_detault_search = new DevExpress.XtraEditors.PanelControl();
this.panelControl4 = new DevExpress.XtraEditors.PanelControl();
this.textEdit1 = new DevExpress.XtraEditors.TextEdit();
this.lceCombobox = new Lskj.Control.LabelComboxEdit();
this.panelControl3 = new DevExpress.XtraEditors.PanelControl();
this.btnTreeSearch = new DevExpress.XtraEditors.SimpleButton();
this.pl_main_bottom = new DevExpress.XtraEditors.PanelControl();
this.dbpFP = new DevExpress.XtraEditors.DropDownButton();
this.btnRefresh = new DevExpress.XtraEditors.SimpleButton();
this.btnHiding = new DevExpress.XtraEditors.SimpleButton();
this.btnHelp = new DevExpress.XtraEditors.SimpleButton();
this.pl_templete = new DevExpress.XtraEditors.PanelControl();
this.cb_templete = new DevExpress.XtraEditors.ComboBoxEdit();
this.lbl_templete = new DevExpress.XtraEditors.LabelControl();
this.pl_input = new DevExpress.XtraEditors.PanelControl();
this.cb_input = new DevExpress.XtraEditors.ComboBoxEdit();
this.txt_input = new DevExpress.XtraEditors.TextEdit();
this.labelControl2 = new DevExpress.XtraEditors.LabelControl();
this.btn_input = new DevExpress.XtraEditors.SimpleButton();
this.dpbImport = new DevExpress.XtraEditors.DropDownButton();
this.btnBillAdd = new DevExpress.XtraEditors.SimpleButton();
this.btnBillApply = new DevExpress.XtraEditors.SimpleButton();
this.dpCopyBill = new DevExpress.XtraEditors.DropDownButton();
this.btnPrint = new DevExpress.XtraEditors.DropDownButton();
this.dpbTools = new DevExpress.XtraEditors.DropDownButton();
this.btnDelete = new DevExpress.XtraEditors.SimpleButton();
this.btnBillSave = new DevExpress.XtraEditors.SimpleButton();
this.pl_main_top = new DevExpress.XtraEditors.PanelControl();
this.pl_main_top_center = new DevExpress.XtraEditors.PanelControl();
this.lbTitle = new System.Windows.Forms.Label();
this.pl_main_top_right = new DevExpress.XtraEditors.PanelControl();
this.lblOrderNo = new DevExpress.XtraEditors.LabelControl();
this.labelControl1 = new DevExpress.XtraEditors.LabelControl();
this.pl_main_top_left = new DevExpress.XtraEditors.PanelControl();
this.pl_red = new DevExpress.XtraEditors.PanelControl();
this.rdRed = new System.Windows.Forms.RadioButton();
this.pl_blue = new DevExpress.XtraEditors.PanelControl();
this.rdBlue = new System.Windows.Forms.RadioButton();
((System.ComponentModel.ISupportInitialize)(this.pl_main)).BeginInit();
this.pl_main.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_main_center)).BeginInit();
this.pl_main_center.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_main_center_detail)).BeginInit();
this.pl_main_center_detail.SuspendLayout();
this.pl_main_center_master.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_treeview_detault_search)).BeginInit();
this.pl_treeview_detault_search.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.panelControl4)).BeginInit();
this.panelControl4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.textEdit1.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.panelControl3)).BeginInit();
this.panelControl3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_main_bottom)).BeginInit();
this.pl_main_bottom.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_templete)).BeginInit();
this.pl_templete.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.cb_templete.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pl_input)).BeginInit();
this.pl_input.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.cb_input.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.txt_input.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pl_main_top)).BeginInit();
this.pl_main_top.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_main_top_center)).BeginInit();
this.pl_main_top_center.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_main_top_right)).BeginInit();
this.pl_main_top_right.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_main_top_left)).BeginInit();
this.pl_main_top_left.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_red)).BeginInit();
this.pl_red.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_blue)).BeginInit();
this.pl_blue.SuspendLayout();
this.SuspendLayout();
//
// pl_main
//
this.pl_main.Appearance.BackColor = System.Drawing.Color.Transparent;
this.pl_main.Appearance.Options.UseBackColor = true;
this.pl_main.Controls.Add(this.pl_main_center);
this.pl_main.Controls.Add(this.pl_main_bottom);
this.pl_main.Controls.Add(this.pl_main_top);
this.pl_main.Dock = System.Windows.Forms.DockStyle.Fill;
this.pl_main.Location = new System.Drawing.Point(0, 0);
this.pl_main.Name = "pl_main";
this.pl_main.Size = new System.Drawing.Size(666, 518);
this.pl_main.TabIndex = 2;
//
// pl_main_center
//
this.pl_main_center.Appearance.BackColor = System.Drawing.Color.Transparent;
this.pl_main_center.Appearance.Options.UseBackColor = true;
this.pl_main_center.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.pl_main_center.Controls.Add(this.pl_main_center_detail);
this.pl_main_center.Controls.Add(this.pl_main_center_master);
this.pl_main_center.Dock = System.Windows.Forms.DockStyle.Fill;
this.pl_main_center.Location = new System.Drawing.Point(2, 40);
this.pl_main_center.Name = "pl_main_center";
this.pl_main_center.Size = new System.Drawing.Size(662, 439);
this.pl_main_center.TabIndex = 2;
//
// pl_main_center_detail
//
this.pl_main_center_detail.Appearance.BackColor = System.Drawing.Color.Transparent;
this.pl_main_center_detail.Appearance.Options.UseBackColor = true;
this.pl_main_center_detail.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.pl_main_center_detail.Controls.Add(this.gcMain);
this.pl_main_center_detail.Dock = System.Windows.Forms.DockStyle.Fill;
this.pl_main_center_detail.Location = new System.Drawing.Point(0, 164);
this.pl_main_center_detail.Name = "pl_main_center_detail";
this.pl_main_center_detail.Size = new System.Drawing.Size(662, 275);
this.pl_main_center_detail.TabIndex = 5;
//
// gcMain
//
this.gcMain.AdapterObj = null;
this.gcMain.BackColor = System.Drawing.Color.Transparent;
this.gcMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.gcMain.Location = new System.Drawing.Point(0, 0);
this.gcMain.Margin = new System.Windows.Forms.Padding(5);
this.gcMain.Name = "gcMain";
this.gcMain.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.gcMain.Size = new System.Drawing.Size(662, 275);
this.gcMain.TabIndex = 0;
//
// pl_main_center_master
//
this.pl_main_center_master.AutoScroll = false;
this.pl_main_center_master.Controls.Add(this.pl_treeview_detault_search);
this.pl_main_center_master.Dock = System.Windows.Forms.DockStyle.Top;
this.pl_main_center_master.Location = new System.Drawing.Point(0, 0);
this.pl_main_center_master.Name = "pl_main_center_master";
this.pl_main_center_master.Size = new System.Drawing.Size(662, 164);
this.pl_main_center_master.TabIndex = 6;
//
// pl_treeview_detault_search
//
this.pl_treeview_detault_search.Appearance.BackColor = System.Drawing.Color.Transparent;
this.pl_treeview_detault_search.Appearance.Options.UseBackColor = true;
this.pl_treeview_detault_search.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.pl_treeview_detault_search.Controls.Add(this.panelControl4);
this.pl_treeview_detault_search.Controls.Add(this.panelControl3);
this.pl_treeview_detault_search.Location = new System.Drawing.Point(39, 104);
this.pl_treeview_detault_search.Margin = new System.Windows.Forms.Padding(5, 3, 5, 3);
this.pl_treeview_detault_search.Name = "pl_treeview_detault_search";
this.pl_treeview_detault_search.Size = new System.Drawing.Size(270, 28);
this.pl_treeview_detault_search.TabIndex = 24;
this.pl_treeview_detault_search.Visible = false;
//
// panelControl4
//
this.panelControl4.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.panelControl4.Controls.Add(this.textEdit1);
this.panelControl4.Controls.Add(this.lceCombobox);
this.panelControl4.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelControl4.Location = new System.Drawing.Point(0, 0);
this.panelControl4.Name = "panelControl4";
this.panelControl4.Padding = new System.Windows.Forms.Padding(2, 4, 2, 0);
this.panelControl4.Size = new System.Drawing.Size(206, 28);
this.panelControl4.TabIndex = 25;
//
// textEdit1
//
this.textEdit1.Dock = System.Windows.Forms.DockStyle.Fill;
this.textEdit1.Location = new System.Drawing.Point(113, 4);
this.textEdit1.Name = "textEdit1";
this.textEdit1.Properties.Appearance.Font = new System.Drawing.Font("宋体", 10F);
this.textEdit1.Properties.Appearance.Options.UseFont = true;
this.textEdit1.Size = new System.Drawing.Size(91, 20);
this.textEdit1.TabIndex = 5;
//
// lceCombobox
//
this.lceCombobox.BackColor = System.Drawing.SystemColors.Control;
this.lceCombobox.Dock = System.Windows.Forms.DockStyle.Left;
this.lceCombobox.EditText = "";
this.lceCombobox.Font = new System.Drawing.Font("宋体", 9F);
this.lceCombobox.FontSize = 0F;
this.lceCombobox.LabelText = "查询";
this.lceCombobox.Location = new System.Drawing.Point(2, 4);
this.lceCombobox.Margin = new System.Windows.Forms.Padding(4);
this.lceCombobox.Model = null;
this.lceCombobox.Name = "lceCombobox";
this.lceCombobox.NullText = "";
this.lceCombobox.ReadOnly = false;
this.lceCombobox.Required = false;
this.lceCombobox.Size = new System.Drawing.Size(111, 24);
this.lceCombobox.TabIndex = 4;
//
// panelControl3
//
this.panelControl3.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.panelControl3.Controls.Add(this.btnTreeSearch);
this.panelControl3.Dock = System.Windows.Forms.DockStyle.Right;
this.panelControl3.Location = new System.Drawing.Point(206, 0);
this.panelControl3.Name = "panelControl3";
this.panelControl3.Padding = new System.Windows.Forms.Padding(3);
this.panelControl3.Size = new System.Drawing.Size(64, 28);
this.panelControl3.TabIndex = 25;
//
// btnTreeSearch
//
this.btnTreeSearch.AllowFocus = false;
this.btnTreeSearch.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnTreeSearch.Appearance.Options.UseFont = true;
this.btnTreeSearch.Dock = System.Windows.Forms.DockStyle.Right;
this.btnTreeSearch.Location = new System.Drawing.Point(1, 3);
this.btnTreeSearch.Name = "btnTreeSearch";
this.btnTreeSearch.Size = new System.Drawing.Size(60, 22);
this.btnTreeSearch.TabIndex = 21;
this.btnTreeSearch.Text = "查询";
//
// pl_main_bottom
//
this.pl_main_bottom.Appearance.BackColor = System.Drawing.Color.Transparent;
this.pl_main_bottom.Appearance.Options.UseBackColor = true;
this.pl_main_bottom.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.pl_main_bottom.Controls.Add(this.dbpFP);
this.pl_main_bottom.Controls.Add(this.btnRefresh);
this.pl_main_bottom.Controls.Add(this.btnHiding);
this.pl_main_bottom.Controls.Add(this.btnHelp);
this.pl_main_bottom.Controls.Add(this.pl_templete);
this.pl_main_bottom.Controls.Add(this.pl_input);
this.pl_main_bottom.Controls.Add(this.dpbImport);
this.pl_main_bottom.Controls.Add(this.btnBillAdd);
this.pl_main_bottom.Controls.Add(this.btnBillApply);
this.pl_main_bottom.Controls.Add(this.dpCopyBill);
this.pl_main_bottom.Controls.Add(this.btnPrint);
this.pl_main_bottom.Controls.Add(this.dpbTools);
this.pl_main_bottom.Controls.Add(this.btnDelete);
this.pl_main_bottom.Controls.Add(this.btnBillSave);
this.pl_main_bottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pl_main_bottom.Location = new System.Drawing.Point(2, 479);
this.pl_main_bottom.Name = "pl_main_bottom";
this.pl_main_bottom.Size = new System.Drawing.Size(662, 37);
this.pl_main_bottom.TabIndex = 1;
//
// dbpFP
//
this.dbpFP.AllowFocus = false;
this.dbpFP.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.dbpFP.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.dbpFP.Appearance.Options.UseFont = true;
this.dbpFP.Location = new System.Drawing.Point(-199, 7);
this.dbpFP.Name = "dbpFP";
this.dbpFP.Size = new System.Drawing.Size(58, 26);
this.dbpFP.TabIndex = 34;
this.dbpFP.Text = "分配";
//
// btnRefresh
//
this.btnRefresh.AllowFocus = false;
this.btnRefresh.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnRefresh.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnRefresh.Appearance.Options.UseFont = true;
this.btnRefresh.Location = new System.Drawing.Point(-135, 7);
this.btnRefresh.Name = "btnRefresh";
this.btnRefresh.Size = new System.Drawing.Size(74, 26);
this.btnRefresh.TabIndex = 33;
this.btnRefresh.Text = "刷新列数据";
//
// btnHiding
//
this.btnHiding.AllowFocus = false;
this.btnHiding.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnHiding.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnHiding.Appearance.Options.UseFont = true;
this.btnHiding.Location = new System.Drawing.Point(-59, 7);
this.btnHiding.Name = "btnHiding";
this.btnHiding.Size = new System.Drawing.Size(67, 26);
this.btnHiding.TabIndex = 32;
this.btnHiding.Text = "隐藏主表";
this.btnHiding.Visible = false;
//
// btnHelp
//
this.btnHelp.AllowFocus = false;
this.btnHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnHelp.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnHelp.Appearance.Options.UseFont = true;
this.btnHelp.Location = new System.Drawing.Point(10, 7);
this.btnHelp.Name = "btnHelp";
this.btnHelp.Size = new System.Drawing.Size(67, 26);
this.btnHelp.TabIndex = 30;
this.btnHelp.Text = "帮助文档";
//
// pl_templete
//
this.pl_templete.Controls.Add(this.cb_templete);
this.pl_templete.Controls.Add(this.lbl_templete);
this.pl_templete.Location = new System.Drawing.Point(3, 3);
this.pl_templete.LookAndFeel.SkinName = "VS2010";
this.pl_templete.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Style3D;
this.pl_templete.Name = "pl_templete";
this.pl_templete.Size = new System.Drawing.Size(195, 29);
this.pl_templete.TabIndex = 29;
this.pl_templete.Visible = false;
//
// cb_templete
//
this.cb_templete.Location = new System.Drawing.Point(58, 4);
this.cb_templete.Name = "cb_templete";
this.cb_templete.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.cb_templete.Properties.DropDownRows = 8;
this.cb_templete.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
this.cb_templete.Size = new System.Drawing.Size(133, 20);
this.cb_templete.TabIndex = 19;
//
// lbl_templete
//
this.lbl_templete.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lbl_templete.Location = new System.Drawing.Point(5, 8);
this.lbl_templete.Name = "lbl_templete";
this.lbl_templete.Size = new System.Drawing.Size(48, 12);
this.lbl_templete.TabIndex = 16;
this.lbl_templete.Text = "选择模版";
//
// pl_input
//
this.pl_input.Controls.Add(this.cb_input);
this.pl_input.Controls.Add(this.txt_input);
this.pl_input.Controls.Add(this.labelControl2);
this.pl_input.Controls.Add(this.btn_input);
this.pl_input.Location = new System.Drawing.Point(3, 3);
this.pl_input.LookAndFeel.SkinName = "VS2010";
this.pl_input.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.Style3D;
this.pl_input.Name = "pl_input";
this.pl_input.Size = new System.Drawing.Size(280, 29);
this.pl_input.TabIndex = 27;
this.pl_input.Visible = false;
//
// cb_input
//
this.cb_input.Location = new System.Drawing.Point(58, 4);
this.cb_input.Name = "cb_input";
this.cb_input.Properties.Buttons.AddRange(new DevExpress.XtraEditors.Controls.EditorButton[] {
new DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)});
this.cb_input.Properties.DropDownRows = 8;
this.cb_input.Properties.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.DisableTextEditor;
this.cb_input.Size = new System.Drawing.Size(79, 20);
this.cb_input.TabIndex = 19;
//
// txt_input
//
this.txt_input.Location = new System.Drawing.Point(149, 4);
this.txt_input.Name = "txt_input";
this.txt_input.Properties.Appearance.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txt_input.Properties.Appearance.Options.UseFont = true;
this.txt_input.Size = new System.Drawing.Size(98, 20);
this.txt_input.TabIndex = 18;
//
// labelControl2
//
this.labelControl2.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.labelControl2.Location = new System.Drawing.Point(5, 8);
this.labelControl2.Name = "labelControl2";
this.labelControl2.Size = new System.Drawing.Size(48, 12);
this.labelControl2.TabIndex = 16;
this.labelControl2.Text = "快速录入";
//
// btn_input
//
this.btn_input.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btn_input.Appearance.Options.UseFont = true;
this.btn_input.Location = new System.Drawing.Point(249, 4);
this.btn_input.Name = "btn_input";
this.btn_input.Size = new System.Drawing.Size(27, 21);
this.btn_input.TabIndex = 13;
this.btn_input.Text = ">>";
//
// dpbImport
//
this.dpbImport.AllowFocus = false;
this.dpbImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.dpbImport.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.dpbImport.Appearance.Options.UseFont = true;
this.dpbImport.DropDownArrowStyle = DevExpress.XtraEditors.DropDownArrowStyle.Show;
this.dpbImport.Location = new System.Drawing.Point(155, 7);
this.dpbImport.Name = "dpbImport";
this.dpbImport.Size = new System.Drawing.Size(74, 26);
this.dpbImport.TabIndex = 26;
this.dpbImport.Text = "导入导出";
//
// btnBillAdd
//
this.btnBillAdd.AllowFocus = false;
this.btnBillAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnBillAdd.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnBillAdd.Appearance.Options.UseFont = true;
this.btnBillAdd.Location = new System.Drawing.Point(307, 7);
this.btnBillAdd.Name = "btnBillAdd";
this.btnBillAdd.Size = new System.Drawing.Size(67, 26);
this.btnBillAdd.TabIndex = 19;
this.btnBillAdd.Text = "新建单据";
//
// btnBillApply
//
this.btnBillApply.AllowFocus = false;
this.btnBillApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnBillApply.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnBillApply.Appearance.Options.UseFont = true;
this.btnBillApply.Location = new System.Drawing.Point(514, 7);
this.btnBillApply.Name = "btnBillApply";
this.btnBillApply.Size = new System.Drawing.Size(67, 26);
this.btnBillApply.TabIndex = 25;
this.btnBillApply.Text = "保存提交";
//
// dpCopyBill
//
this.dpCopyBill.AllowFocus = false;
this.dpCopyBill.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.dpCopyBill.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.dpCopyBill.Appearance.Options.UseFont = true;
this.dpCopyBill.DropDownArrowStyle = DevExpress.XtraEditors.DropDownArrowStyle.Show;
this.dpCopyBill.Location = new System.Drawing.Point(231, 7);
this.dpCopyBill.Name = "dpCopyBill";
this.dpCopyBill.Size = new System.Drawing.Size(74, 26);
this.dpCopyBill.TabIndex = 24;
this.dpCopyBill.Text = "复制单据";
//
// btnPrint
//
this.btnPrint.AllowFocus = false;
this.btnPrint.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnPrint.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnPrint.Appearance.Options.UseFont = true;
this.btnPrint.DropDownArrowStyle = DevExpress.XtraEditors.DropDownArrowStyle.Show;
this.btnPrint.Location = new System.Drawing.Point(583, 7);
this.btnPrint.Name = "btnPrint";
this.btnPrint.Size = new System.Drawing.Size(74, 26);
this.btnPrint.TabIndex = 23;
this.btnPrint.Text = "打印单据";
//
// dpbTools
//
this.dpbTools.AllowFocus = false;
this.dpbTools.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.dpbTools.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.dpbTools.Appearance.Options.UseFont = true;
this.dpbTools.DropDownArrowStyle = DevExpress.XtraEditors.DropDownArrowStyle.Show;
this.dpbTools.Location = new System.Drawing.Point(79, 7);
this.dpbTools.Name = "dpbTools";
this.dpbTools.Size = new System.Drawing.Size(74, 26);
this.dpbTools.TabIndex = 22;
this.dpbTools.Text = "常用工具";
//
// btnDelete
//
this.btnDelete.AllowFocus = false;
this.btnDelete.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnDelete.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnDelete.Appearance.Options.UseFont = true;
this.btnDelete.Location = new System.Drawing.Point(376, 7);
this.btnDelete.Name = "btnDelete";
this.btnDelete.Size = new System.Drawing.Size(67, 26);
this.btnDelete.TabIndex = 20;
this.btnDelete.Text = "删除记录";
//
// btnBillSave
//
this.btnBillSave.AllowFocus = false;
this.btnBillSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnBillSave.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnBillSave.Appearance.Options.UseFont = true;
this.btnBillSave.Location = new System.Drawing.Point(445, 7);
this.btnBillSave.Name = "btnBillSave";
this.btnBillSave.Size = new System.Drawing.Size(67, 26);
this.btnBillSave.TabIndex = 21;
this.btnBillSave.Text = "保存单据";
//
// pl_main_top
//
this.pl_main_top.Appearance.BackColor = System.Drawing.SystemColors.Control;
this.pl_main_top.Appearance.Options.UseBackColor = true;
this.pl_main_top.Controls.Add(this.pl_main_top_center);
this.pl_main_top.Controls.Add(this.pl_main_top_right);
this.pl_main_top.Controls.Add(this.pl_main_top_left);
this.pl_main_top.Dock = System.Windows.Forms.DockStyle.Top;
this.pl_main_top.Location = new System.Drawing.Point(2, 2);
this.pl_main_top.Name = "pl_main_top";
this.pl_main_top.Size = new System.Drawing.Size(662, 38);
this.pl_main_top.TabIndex = 0;
//
// pl_main_top_center
//
this.pl_main_top_center.Appearance.BackColor = System.Drawing.Color.Transparent;
this.pl_main_top_center.Appearance.Options.UseBackColor = true;
this.pl_main_top_center.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.pl_main_top_center.Controls.Add(this.lbTitle);
this.pl_main_top_center.Dock = System.Windows.Forms.DockStyle.Fill;
this.pl_main_top_center.Location = new System.Drawing.Point(162, 2);
this.pl_main_top_center.Name = "pl_main_top_center";
this.pl_main_top_center.Size = new System.Drawing.Size(315, 34);
this.pl_main_top_center.TabIndex = 3;
//
// lbTitle
//
this.lbTitle.BackColor = System.Drawing.Color.Transparent;
this.lbTitle.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbTitle.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lbTitle.ForeColor = System.Drawing.Color.Blue;
this.lbTitle.Location = new System.Drawing.Point(0, 0);
this.lbTitle.Name = "lbTitle";
this.lbTitle.Size = new System.Drawing.Size(315, 34);
this.lbTitle.TabIndex = 1;
this.lbTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// pl_main_top_right
//
this.pl_main_top_right.Appearance.BackColor = System.Drawing.Color.Transparent;
this.pl_main_top_right.Appearance.Options.UseBackColor = true;
this.pl_main_top_right.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.pl_main_top_right.Controls.Add(this.lblOrderNo);
this.pl_main_top_right.Controls.Add(this.labelControl1);
this.pl_main_top_right.Dock = System.Windows.Forms.DockStyle.Right;
this.pl_main_top_right.Location = new System.Drawing.Point(477, 2);
this.pl_main_top_right.Name = "pl_main_top_right";
this.pl_main_top_right.Size = new System.Drawing.Size(183, 34);
this.pl_main_top_right.TabIndex = 2;
//
// lblOrderNo
//
this.lblOrderNo.Appearance.BackColor = System.Drawing.Color.Transparent;
this.lblOrderNo.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Underline);
this.lblOrderNo.Appearance.ForeColor = System.Drawing.Color.Blue;
this.lblOrderNo.Location = new System.Drawing.Point(67, 19);
this.lblOrderNo.Name = "lblOrderNo";
this.lblOrderNo.Size = new System.Drawing.Size(90, 12);
this.lblOrderNo.TabIndex = 1;
this.lblOrderNo.Text = "XTC170112010001";
//
// labelControl1
//
this.labelControl1.Appearance.BackColor = System.Drawing.Color.Transparent;
this.labelControl1.Appearance.Font = new System.Drawing.Font("宋体", 9F);
this.labelControl1.Appearance.ForeColor = System.Drawing.Color.Blue;
this.labelControl1.Location = new System.Drawing.Point(7, 19);
this.labelControl1.Name = "labelControl1";
this.labelControl1.Size = new System.Drawing.Size(54, 12);
this.labelControl1.TabIndex = 0;
this.labelControl1.Text = "单据编号:";
//
// pl_main_top_left
//
this.pl_main_top_left.Appearance.BackColor = System.Drawing.Color.Transparent;
this.pl_main_top_left.Appearance.Options.UseBackColor = true;
this.pl_main_top_left.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.pl_main_top_left.Controls.Add(this.pl_red);
this.pl_main_top_left.Controls.Add(this.pl_blue);
this.pl_main_top_left.Dock = System.Windows.Forms.DockStyle.Left;
this.pl_main_top_left.Location = new System.Drawing.Point(2, 2);
this.pl_main_top_left.Name = "pl_main_top_left";
this.pl_main_top_left.Size = new System.Drawing.Size(160, 34);
this.pl_main_top_left.TabIndex = 1;
//
// pl_red
//
this.pl_red.Appearance.BackColor = System.Drawing.Color.Transparent;
this.pl_red.Appearance.Options.UseBackColor = true;
this.pl_red.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.pl_red.Controls.Add(this.rdRed);
this.pl_red.Dock = System.Windows.Forms.DockStyle.Left;
this.pl_red.Location = new System.Drawing.Point(80, 0);
this.pl_red.Name = "pl_red";
this.pl_red.Size = new System.Drawing.Size(80, 34);
this.pl_red.TabIndex = 3;
//
// rdRed
//
this.rdRed.AutoSize = true;
this.rdRed.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.rdRed.ForeColor = System.Drawing.Color.Red;
this.rdRed.Location = new System.Drawing.Point(6, 12);
this.rdRed.Name = "rdRed";
this.rdRed.Size = new System.Drawing.Size(71, 16);
this.rdRed.TabIndex = 3;
this.rdRed.Text = "红字单据";
this.rdRed.UseVisualStyleBackColor = true;
//
// pl_blue
//
this.pl_blue.Appearance.BackColor = System.Drawing.Color.Transparent;
this.pl_blue.Appearance.Options.UseBackColor = true;
this.pl_blue.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.pl_blue.Controls.Add(this.rdBlue);
this.pl_blue.Dock = System.Windows.Forms.DockStyle.Left;
this.pl_blue.Location = new System.Drawing.Point(0, 0);
this.pl_blue.Name = "pl_blue";
this.pl_blue.Size = new System.Drawing.Size(80, 34);
this.pl_blue.TabIndex = 2;
//
// rdBlue
//
this.rdBlue.AutoSize = true;
this.rdBlue.Checked = true;
this.rdBlue.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.rdBlue.ForeColor = System.Drawing.Color.Blue;
this.rdBlue.Location = new System.Drawing.Point(7, 12);
this.rdBlue.Name = "rdBlue";
this.rdBlue.Size = new System.Drawing.Size(71, 16);
this.rdBlue.TabIndex = 2;
this.rdBlue.TabStop = true;
this.rdBlue.Text = "蓝字单据";
this.rdBlue.UseVisualStyleBackColor = true;
//
// FrmBillInfo
//
this.Controls.Add(this.pl_main);
this.Name = "FrmBillInfo";
this.Size = new System.Drawing.Size(666, 518);
((System.ComponentModel.ISupportInitialize)(this.pl_main)).EndInit();
this.pl_main.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pl_main_center)).EndInit();
this.pl_main_center.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pl_main_center_detail)).EndInit();
this.pl_main_center_detail.ResumeLayout(false);
this.pl_main_center_master.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pl_treeview_detault_search)).EndInit();
this.pl_treeview_detault_search.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.panelControl4)).EndInit();
this.panelControl4.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.textEdit1.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.panelControl3)).EndInit();
this.panelControl3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pl_main_bottom)).EndInit();
this.pl_main_bottom.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pl_templete)).EndInit();
this.pl_templete.ResumeLayout(false);
this.pl_templete.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.cb_templete.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pl_input)).EndInit();
this.pl_input.ResumeLayout(false);
this.pl_input.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.cb_input.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.txt_input.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pl_main_top)).EndInit();
this.pl_main_top.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pl_main_top_center)).EndInit();
this.pl_main_top_center.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pl_main_top_right)).EndInit();
this.pl_main_top_right.ResumeLayout(false);
this.pl_main_top_right.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_main_top_left)).EndInit();
this.pl_main_top_left.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pl_red)).EndInit();
this.pl_red.ResumeLayout(false);
this.pl_red.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_blue)).EndInit();
this.pl_blue.ResumeLayout(false);
this.pl_blue.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private DevExpress.XtraEditors.PanelControl pl_main;
private DevExpress.XtraEditors.PanelControl pl_main_center;
private DevExpress.XtraEditors.PanelControl pl_main_center_detail;
private Control.GridControlEx gcMain;
private DevExpress.XtraEditors.XtraScrollableControl pl_main_center_master;
private DevExpress.XtraEditors.PanelControl pl_treeview_detault_search;
private DevExpress.XtraEditors.PanelControl panelControl4;
private DevExpress.XtraEditors.TextEdit textEdit1;
private Control.LabelComboxEdit lceCombobox;
private DevExpress.XtraEditors.PanelControl panelControl3;
private DevExpress.XtraEditors.SimpleButton btnTreeSearch;
public DevExpress.XtraEditors.PanelControl pl_main_bottom;
private DevExpress.XtraEditors.DropDownButton dbpFP;
private DevExpress.XtraEditors.SimpleButton btnRefresh;
private DevExpress.XtraEditors.SimpleButton btnHiding;
private DevExpress.XtraEditors.SimpleButton btnHelp;
private DevExpress.XtraEditors.PanelControl pl_templete;
private DevExpress.XtraEditors.ComboBoxEdit cb_templete;
private DevExpress.XtraEditors.LabelControl lbl_templete;
private DevExpress.XtraEditors.PanelControl pl_input;
private DevExpress.XtraEditors.ComboBoxEdit cb_input;
private DevExpress.XtraEditors.TextEdit txt_input;
private DevExpress.XtraEditors.LabelControl labelControl2;
private DevExpress.XtraEditors.SimpleButton btn_input;
private DevExpress.XtraEditors.DropDownButton dpbImport;
private DevExpress.XtraEditors.SimpleButton btnBillAdd;
private DevExpress.XtraEditors.SimpleButton btnBillApply;
private D
@@ -0,0 +1,609 @@
using DevExpress.XtraGrid.Columns;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraTreeList.Columns;
using Lskj.Business;
using Lskj.Business.Impl;
using Lskj.Control;
using Lskj.Control.Model;
using Lskj.Core;
using Lskj.Data;
using Lskj.Model;
using Lskj.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Lskj.PubBomImport
{
public partial class FrmBillInfo : UserControl
{
public DynamicBomImport Model;
public DynamicBillModel SysModel;
public BillModel billModel;
public MyControl ControlObj;
public event EventHandler OnControlSourceBind;
/// <summary>
/// 单据明细列
/// </summary>
private DataTable _detailColumns;
private string guidField = "xxxxx_guid";
/// <summary>
/// 保存或修改时报错信息
/// </summary>
public string SaveErrorMessage = string.Empty;
public GridView GcMainView
{
get { return gcMain.GridView; }
}
public FrmBillInfo()
{
InitializeComponent();
}
public void OnLoad(DynamicBomImport mainModel)
{
Model = mainModel;
GetControlData(mainModel);
InitControlView();
SetControlData();
}
public void GetControlData(DynamicBomImport Model)
{
string[] args = new[] { Model.FormText, Model.UserId, Model.UserName, Model.Privilege, Model.ModuleCode, "", Model.ModuleCode };
SysModel = new DynamicBillModel(args);
SysModel.BillMasterSql = Model.BillMasterSql;
SysModel.BillDetailSql = "";
DataRow modelRow = BillImpl.GetBillInfo(SysModel.ModuleCode);//获取单个模块信息
billModel = new BillModel(modelRow);//初始化类的新实例。
if (billModel != null)
{
billModel.TypeName = string.IsNullOrEmpty(SysModel.BillMasterSql) ? SysModel.FormText : billModel.TypeName;// 模块名称
string masterPreFix = BaseImpl.GetColumnPrefix(billModel.MasterTable);// 主表列前缀
billModel.MasterPreFix = masterPreFix;
string detailPreFix = BaseImpl.GetColumnPrefix(billModel.DetailTable);// 明细表列前缀
billModel.DetailPreFix = detailPreFix;
billModel.DetailOrderField = billModel.DetailPreFix + "lsidx_id";// 单据来源id
if (SystemInfo.Instance.IsNotBillDetailOrder)//禁用排序
{
billModel.DetailOrderField = string.Empty;
}
}
DataRow menuRow = BaseImpl.GetMenuConfigTab(SysModel.ModuleId);//获取菜单其他配置
if (menuRow != null)
{
billModel.BillSourceIds = menuRow.Table.Columns.Contains("BillSourceIds") ? (menuRow["BillSourceIds"] + "").Trim(',') : string.Empty;
billModel.BillFlag = menuRow.Table.Columns.Contains("BillFlag") && !string.IsNullOrEmpty(menuRow["BillFlag"] + "") ? Convert.ToInt32(menuRow["BillFlag"] + "") : -1;
}
DataTable controls = BaseModuleImpl.GetControlLocation(billModel.FormKey, SysModel.ModuleCode);
DataTable groups = BaseModuleImpl.GetAddGroupData(billModel.FormKey);//获取主信息分组数据
ControlObj = new MyControl() { Model = SysModel };//主表控件
ControlObj.OtherParams = SysModel.OtherParams();
ControlObj.OnDataSourceBindCallBack += (s, e) =>
{
if (OnControlSourceBind != null)
{
OnControlSourceBind(null, null);
}
};
ControlObj.InitControl(controls, this.pl_main_center_master, groups);
if (SysModel.GridEnumObj == GridEnum.BandedGridView || billModel.AutoMultiHeader == 1)
{
this.pl_main_center_detail.Controls.Clear();
this.gcMain = new BandedGridControlEx();
this.gcMain.Model = SysModel;
this.gcMain.Dock = DockStyle.Fill;
this.pl_main_center_detail.Controls.Add(this.gcMain);
}
_detailColumns = BillImpl.GetDetailColumns(SysModel.ModuleCode);//初始化单据明细列
if (SysModel.GridEnumObj == GridEnum.BandedGridView || billModel.AutoMultiHeader == 1)
{
//多表头sql要增加一个判断,否则多表头会出错
_detailColumns = BillImpl.GetDetailColumns(SysModel.ModuleCode, true);//初始化单据明细列
}
this.gcMain.DisableFieldSources = billModel.DisableFieldSources;
this.gcMain.Model = SysModel;
this.gcMain.ParentControl = ControlObj;//把主表控件赋给 单据主表控件、基础档案查询条件控件等等
this.gcMain.SetEditColumns(_detailColumns, GridCustomColumnStruct.BillDetailGridView + billModel.FormKey);//设置可编辑列
}
public void InitControlView()
{
}
public void SetControlData()
{
}
public void InitializeHeader(DataRow parentRow, string controlSql)
{
// 新增
if (!string.IsNullOrEmpty(controlSql))
{
string billMasterSql = controlSql;
billMasterSql = ReplaceHelper.ReplaceRowParam(parentRow, billMasterSql);
// 处理单据表头数据
DataRow row = BillImpl.GetDataRowResult(billMasterSql);
if (row != null)
{
ControlObj.SetAllControlValue(row, true);
}
}
}
public void InitializeHeader(DataRow rowItem)
{
// 新增
if (rowItem != null)
{
ControlObj.SetAllControlValue(rowItem, true);
}
}
public bool BillSave(ref string billNo, int comfirm = 0, bool canTipMsg = true)
{
bool saveResult = false;
if (ControlObj.VerifyNull())
{
// 保存之前先进行表格更新
if (billModel.DetailTreeTable)
{
(this.gcMain as TreeGridControlEx).TreeListObj.PostEditor();
}
else
{
this.gcMain.GridView.PostEditor();
this.gcMain.GridView.UpdateCurrentRow();
}
try
{
if (this.gcMain.VerifyNull())
{
if (this.gcMain.RepeatedVerificationNames.Count > 0 && this.gcMain.VerifyDuplicateColumns())
{
//MessageUtil.Show("表格中数据内容重复,保存失败!");
return saveResult;
}
billNo = this.lblOrderNo.Text.Trim();
string detailGuid = Guid.NewGuid().ToString();
string masterSql = billModel.SaveState ? GetUpdateRecord(billNo) : GetAddRecord(ref billNo);
string detailSql = GetDetailRecord(detailGuid, billNo).ToString();
// 检查单据头数据合法性
if (string.IsNullOrEmpty(masterSql)) return false;
// 验证明细合法性
if (string.IsNullOrEmpty(detailSql) && !billModel.SaveNullDetail)
{
MessageUtil.Show(ResourceKeys.BillDetailIsNotNull);
return false;
}
string tipMsg = string.Empty;
int result = BillImpl.BillSave(masterSql, detailSql, billModel.DetailTable, ref billNo, detailGuid, billModel.BillSeq, billModel.SaveState ? 2 : 1, comfirm, out tipMsg, 0, billModel.NewVer);
if (result == 1)
{
saveResult = true;
}
else
{
throw new Exception($"保存Bom失败\r\n{tipMsg}");
}
}
}
catch (Exception ex)
{
throw new Exception($"保存Bom失败\r\n{ex.Message}");
}
}
return saveResult;
}
public bool BillSaveSql(string guid, int comfirm = 0, bool canTipMsg = true)
{
bool saveResult = false;
if (ControlObj.VerifyNull())
{
// 保存之前先进行表格更新
if (billModel.DetailTreeTable)
{
(this.gcMain as TreeGridControlEx).TreeListObj.PostEditor();
}
else
{
this.gcMain.GridView.PostEditor();
this.gcMain.GridView.UpdateCurrentRow();
}
try
{
if (this.gcMain.VerifyNull())
{
if (this.gcMain.RepeatedVerificationNames.Count > 0 && this.gcMain.VerifyDuplicateColumns())
{
//MessageUtil.Show("表格中数据内容重复,保存失败!");
return saveResult;
}
string billNo = billModel.SaveState ? this.lblOrderNo.Text.Trim() : Guid.NewGuid() + "";
string detailGuid = Guid.NewGuid().ToString();
string masterSql = billModel.SaveState ? GetUpdateRecord(billNo) : GetAddRecord(ref billNo);
string detailSql = GetDetailRecord(detailGuid, billNo).ToString();
// 检查单据头数据合法性
if (string.IsNullOrEmpty(masterSql)) return false;
// 验证明细合法性
if (string.IsNullOrEmpty(detailSql) && !billModel.SaveNullDetail)
{
MessageUtil.Show(ResourceKeys.BillDetailIsNotNull);
return false;
}
string tipMsg = string.Empty;
//param[0].Value = masterSql;
//param[1].Value = billNo;
//param[2].Value = detailGuid;
//param[3].Value = ERPInfo.Instance.UserId;
//param[4].Value = billWay;// --1新增,2为修改,3为删除
//param[5].Value = billSeq;
//param[6].Value = "";
//param[7].Value = auditFlag;
//param[8].Value = comfirm;
SqlHelper.ExecuteNonQuery($"delete p_bomImportExecTab where guid = '{guid}'");
SqlHelper.ExecuteNonQuery($"insert into p_bomImportExecTab (guid,detailTable,masterSql,detailSql,billNo,detailGuid,UserId,billWay,billSeq,auditFlag,comfirm,newVer) " +
$"values ('{guid}','{billModel.DetailTable}','{masterSql.Replace("'", "''")}','{detailSql.Replace("'", "''")}','{billNo}','{detailGuid.Replace("'", "''")}','{ERPInfo.Instance.UserId}','{(billModel.SaveState ? 2 : 1)}','{billModel.BillSeq}','0','{comfirm}','{billModel.NewVer}')");
//int result = BillImpl.BillSave(masterSql, detailSql, billModel.DetailTable, ref billNo, detailGuid, billModel.BillSeq, billModel.SaveState ? 2 : 1, comfirm, out tipMsg, 0, billModel.NewVer);
//if (result == 1)
//{
// saveResult = true;
//}
//else
//{
// throw new Exception($"保存Bom失败\r\n{tipMsg}");
//}
}
}
catch (Exception ex)
{
throw new Exception($"保存Bom失败\r\n{ex.Message}");
}
}
return saveResult;
}
private string GetUpdateRecord(string parmaryValue)
{
StringBuilder updateBuilder = new StringBuilder();
DataTable DetailedProperties = BaseImpl.GetDataTableResult(string.Format("select COLUMN_NAME,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH from information_schema.columns where table_name = '{0}'", billModel.MasterTable));
string errorMessage = string.Empty;//数据不符合数据库规范的信息
// 修改单据
foreach (ControlModel model in this.ControlObj.ControlModels)
{
if (!model.IsSave ||
model.FieldName.Equals(billModel.RtagidKey, StringComparison.OrdinalIgnoreCase) ||
model.FieldType == ControlType.LabPic ||
model.FieldType == ControlType.LabPicEx)
continue;
BaseUserControl userControl = this.ControlObj.FindControl(model);
if (userControl != null)
{
string fieldValue = this.ControlObj.GetControlValue(model);
if (SystemInfo.Instance.TrimWhiteSpace)
fieldValue = fieldValue.Trim();
if (fieldValue == "****") continue;
errorMessage = errorMessage + DatabaseFormatJudgment.SaveOrModifyBalidation(DetailedProperties, model, fieldValue);
if (string.IsNullOrEmpty(fieldValue) && model.Isintordecimal) fieldValue = "0";//数值保存时为空的话默认保存为0;
updateBuilder.Append(string.IsNullOrEmpty(fieldValue) ? string.Format("{0}={1}", model.FieldName, this.ControlObj.GetNullValue(model)) : string.Format("{0}=N'{1}',", model.FieldName, fieldValue.Contains("'") ? fieldValue.Replace("'", "''") : fieldValue));
}
}
if (!string.IsNullOrWhiteSpace(errorMessage)) SaveErrorMessage = "表头错误:" + errorMessage;
return string.Format("update {0} set {1} where {2}='{3}'", billModel.MasterTable, updateBuilder.ToString().TrimEnd(','), billModel.PrimaryKey, parmaryValue);
}
private string GetAddRecord(ref string parmaryValue)
{
if (billModel.NewVer == 0)
{
// 检查当前的单据号是否已被占用.
string newBillNo = BillImpl.GetBillNo(billModel.BillSeq);
if (!parmaryValue.Equals(newBillNo))
{
if (MessageUtil.Show(ResourceKeys.BillRecordRepeat, MessageBoxButtons.YesNo) == DialogResult.No)
{
return string.Empty;
}
else
{
this.lblOrderNo.Text = newBillNo;
parmaryValue = newBillNo;
}
}
}
StringBuilder fieldBuilder = new StringBuilder();
StringBuilder valueBuilder = new StringBuilder();
DataTable DetailedProperties = BaseImpl.GetDataTableResult(string.Format("select COLUMN_NAME,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH from information_schema.columns where table_name = '{0}'", billModel.MasterTable));
string errorMessage = string.Empty;//数据不符合数据库规范的信息
foreach (ControlModel model in this.ControlObj.ControlModels)
{
if (!model.IsSave ||
model.FieldName.Equals(billModel.PrimaryKey, StringComparison.OrdinalIgnoreCase) ||
model.FieldName.Equals(billModel.RtagidKey, StringComparison.OrdinalIgnoreCase) ||
model.FieldType == ControlType.LabPic ||
model.FieldType == ControlType.LabPicEx)
continue;
string fieldValue = this.ControlObj.GetControlValue(model);
if (SystemInfo.Instance.TrimWhiteSpace)
fieldValue = fieldValue.Trim();
if (fieldValue == "****") continue;
errorMessage = errorMessage + DatabaseFormatJudgment.SaveOrModifyBalidation(DetailedProperties, model, fieldValue);
if (string.IsNullOrEmpty(fieldValue) && model.Isintordecimal) fieldValue = "0";//数值保存时为空的话默认保存为0;
fieldBuilder.Append(model.FieldName + ",");
valueBuilder.Append(string.IsNullOrEmpty(fieldValue) ? this.ControlObj.GetNullValue(model) : string.Format("N'{0}',", fieldValue));
}
if (!string.IsNullOrWhiteSpace(errorMessage)) SaveErrorMessage = "表头错误:" + errorMessage;
// 增加主键
fieldBuilder.Append(billModel.PrimaryKey);
//valueBuilder.Append("N'" + parmaryValue + "'");
valueBuilder.Append("N'" + parmaryValue + "'");
// 增加红蓝字单标记
fieldBuilder.Append("," + billModel.RtagidKey);
valueBuilder.Append(",N'" + (rdRed.Checked ? 1 : 0) + "'");
return string.Format("insert into {0}({1}) values ({2})", billModel.MasterTable, fieldBuilder.ToString().TrimEnd(','), valueBuilder.ToString().TrimEnd(','));
}
private StringBuilder GetDetailRecord(string guid, string billNo)
{
// 构造明细
StringBuilder detailBuilder = new StringBuilder();
DataTable detailTable = this.gcMain.GridControl.DataSourceTable().TrimDeleteRows();
if (billModel.DetailTreeTable)
{
detailTable = ((this.gcMain as TreeGridControlEx).TreeListObj.DataSource as DataTable).TrimDeleteRows();
}
DataTable DetailedProperties = BaseImpl.GetDataTableResult(string.Format("select COLUMN_NAME,DATA_TYPE,CHARACTER_MAXIMUM_LENGTH from information_schema.columns where table_name = '{0}'", billModel.DetailTable + "_temp"));//单据明细性表
if (detailTable.Rows.Count > 0)
{
int lineNumber = 1;
DataTable BillColumns = BaseImpl.GetDataTableResult(string.Format("select * from {0} where 1<>1", billModel.DetailTable));
DataTable BillTempColumns = BaseImpl.GetDataTableResult(string.Format("select * from {0} where 1<>1", billModel.DetailTable + "_temp"));
foreach (DataRow dataRow in detailTable.Rows)
{
string errorMessage = string.Empty;//数据不符合数据库规范的信息
StringBuilder fields = new StringBuilder();
StringBuilder values = new StringBuilder();
string detailSql = @"insert into " + billModel.DetailTable + "_temp" + "({0}) values({1})";
fields.Append("sysstr,");
values.Append("'" + guid + "',");
foreach (DataColumn item in BillColumns.Columns)
{
if (item.ColumnName.Equals(guidField) || item.ColumnName.Equals(ERPInfo.Instance.isAddRows)) continue;
if (!BillTempColumns.Columns.Contains(item.ColumnName))
{
string type = "varchar(100)";
if (item.DataType == typeof(DateTime))
{
type = "datetime";
}
BaseImpl.ExecSqlValue(string.Format("alter table {0} add {1} {2}", billModel.DetailTable + "_temp", item.ColumnName, type));
}
if (billModel.DetailTreeTable)
{
TreeListColumn[] TreeListColumns = (this.gcMain as TreeGridControlEx).TreeListObj.Columns.Cast<TreeListColumn>().Where(x => x.FieldName.Equals(item.Caption, StringComparison.OrdinalIgnoreCase)).ToArray();
if (TreeListColumns.Count() == 0 && item.Caption.Equals(billModel.PrimaryDetailKey))
{
string primaryValues = dataRow[billModel.PrimaryDetailKey] + "";
if (!string.IsNullOrWhiteSpace(primaryValues))
{
fields.Append(item.ColumnName + ",");
values.Append("N'" + primaryValues.Replace("'", "''") + "',");
}
}
if (TreeListColumns.Count() == 0) continue;
}
else
{
GridColumn[] gridColumns = gcMain.GridView.Columns.Cast<GridColumn>().Where(x => x.FieldName.Equals(item.Caption, StringComparison.OrdinalIgnoreCase)).ToArray();
if (gridColumns.Count() == 0 && item.Caption.Equals(billModel.PrimaryDetailKey))
{
string primaryValues = dataRow[billModel.PrimaryDetailKey] + "";
if (!string.IsNullOrWhiteSpace(primaryValues))
{
fields.Append(item.ColumnName + ",");
values.Append("N'" + primaryValues.Replace("'", "''") + "',");
}
}
if (gridColumns.Count() == 0) continue;
}
fields.Append(item.ColumnName + ",");
string fieldValue = dataRow.Table.Columns.Contains(item.ColumnName) ? dataRow[item.ColumnName] + "" : string.Empty;
//if (SystemInfo.Instance.TrimWhiteSpace)
// fieldValue = fieldValue.Trim();
if (item.ColumnName.Equals(billModel.PrimaryDetailKey, StringComparison.OrdinalIgnoreCase))
fieldValue = billNo;
if (!string.IsNullOrWhiteSpace(fieldValue))
{
values.Append(item.DataType == typeof(DateTime) ? "'" + Convert.ToDateTime(fieldValue).ToString("yyyy-MM-dd HH:mm:ss") + "'," : fieldValue.Contains("'") ? "N'" + fieldValue.Replace("'", "''") + "'," : "N'" + fieldValue + "',");
}
else
{
if (item.DataType == typeof(Decimal) ||
item.DataType == typeof(Double) ||
item.DataType == typeof(Int16) ||
item.DataType == typeof(Int32) ||
item.DataType == typeof(Int64))
values.Append("0,");
else if (item.DataType == typeof(DateTime))
{
values.Append("NULL,");
}
else
{
values.Append("'',");
}
}
errorMessage = errorMessage + DatabaseFormatJudgment.SaveOrModifyBalidation(_detailColumns, DetailedProperties, dataRow, item, fieldValue);
}
detailBuilder.AppendFormat(detailSql, fields.ToString().Trim(','), values.ToString().Trim(','));
if (!string.IsNullOrWhiteSpace(errorMessage)) errorMessage = "第" + lineNumber + "行:" + errorMessage;
lineNumber++;
}
}
return detailBuilder;
}
private void SetBillStatus(DataRow rowItem)
{
if (rowItem != null)
{
// 单据为修改状态,无需设置赋值时不需要计算面板属性
bool isReadOnly = !string.IsNullOrEmpty(billModel.ModifyCond) && !ReplaceHelper.ReplaceRowParamCond(rowItem, billModel.ModifyCond);
this.ControlObj.CanExecControl = false; // 单据为修改状态时,无需计算面板属性
this.lbTitle.Text = billModel.TypeName + "(修改)";
this.lblOrderNo.Text = rowItem[billModel.PrimaryKey] + "";
this.rdBlue.Checked = "0".Equals(rowItem[billModel.RtagidKey] + "");
this.rdRed.Checked = "1".Equals(rowItem[billModel.RtagidKey] + "");
billModel.SaveState = true;
this.rdBlue.Enabled = this.rdRed.Enabled = false;
this.ControlObj.SetReadOnlyAllControl(isReadOnly);
this.ControlObj.SetAllControlValue(rowItem);
this.dbpFP.Enabled = this.btnDelete.Enabled = this.btnBillSave.Enabled = this.btnBillApply.Enabled = !isReadOnly;
this.ControlObj.CanExecControl = true;
this.cb_input.Enabled = this.btn_input.Enabled = this.txt_input.Enabled = !isReadOnly;
this.labelControl1.ForeColor = this.lblOrderNo.ForeColor = this.lbTitle.ForeColor = rdBlue.Checked ? Color.Blue : Color.Red;
this.gcMain.GridView.OptionsBehavior.Editable = !isReadOnly;
// 上一次查询
int oldRowHandle = this.gcMain.GridView.FocusedRowHandle;
//获取数据源并排序
DataTable dt = BillImpl.GetDataTableResult(ReplaceHelper.ReplaceRowParam(rowItem, billModel.DetailSql));
if (dt.Columns.Contains(billModel.DetailOrderField))
{
DataView dataView = dt.AsDataView();
dataView.Sort = billModel.DetailOrderField;
dt = dataView.ToTable();
}
if (billModel.DetailTreeTable)
{
//判断是否有tap_id和tap_pid
(this.gcMain as TreeGridControlEx).SetGridViewDataSourceGenerateID(dt);
this.gcMain.GridView.SelectRowHandler(oldRowHandle);
}
else
{
this.gcMain.GridControl.DataSource = dt;
this.gcMain.GridView.SelectRowHandler(oldRowHandle);
if (billModel.SelectLast && dt.Rows.Count > 0)
{
this.gcMain.GridView.SelectRowHandler(dt.Rows.Count - 1);
}
}
BaseUserControl userControl = this.ControlObj.FindControl(billModel.RtagidKey);
if (userControl != null)
{
userControl.EditText = this.rdRed.Checked ? "1" : "0";
}
}
else
{
// 单据为新增状态
this.dbpFP.Enabled = this.btnDelete.Enabled = this.btnBillSave.Enabled = this.btnBillApply.Enabled = true;
this.lbTitle.Text = billModel.TypeName + "(新增)";
this.lblOrderNo.Text = BillImpl.GetBillNo(billModel.BillSeq);
this.cb_input.Enabled = this.btn_input.Enabled = this.txt_input.Enabled = true;
this.cb_templete.Enabled = true;
billModel.SaveState = false;
this.ControlObj.SetReadOnlyAllControl(false);
this.rdBlue.Enabled = this.rdRed.Enabled = true;
// 通过右键菜单打开单据,假如明细有数据则在初始化时使用传入数据.
if (billModel.DetailTreeTable)
{
(this.gcMain as TreeGridControlEx).TreeListObj.OptionsBehavior.Editable = true;
(this.gcMain as TreeGridControlEx).SetGridViewDataSourceGenerateID(BillImpl.GetDataTableResult(billModel.DetailSql));
}
else
{
this.gcMain.GridView.OptionsBehavior.Editable = true;
this.gcMain.GridControl.DataSource = BillImpl.GetDataTableResult(billModel.DetailSql);
}
BaseUserControl userControl = this.ControlObj.FindControl(billModel.RtagidKey);
if (userControl != null)
{
userControl.EditText = this.rdRed.Checked ? "1" : "0";
}
}
this.lbTitle.Invalidate();
}
public void OnBillAdd()
{
this.SetBillStatus(null);
this.ControlObj.ResetControlValue(billModel.ManuallyTriggerCorrelation, true);
}
public void AddOrUpdateBill(DataRow rowItem, DataTable newSource)
{
string masterSql = rowItem == null ? billModel.MasterSql.Replace("{" + billModel.PrimaryKey + "}", this.lblOrderNo.Text) : ReplaceHelper.ReplaceRowParam(rowItem, billModel.MasterSql);
// 加载单据信息
DataRow mainRow = BillImpl.GetDataRowResult(masterSql);
this.SetBillStatus(mainRow);
if (!billModel.SaveState)
{
this.InitializeHeader(rowItem);
}
else
{
if (rowItem != null)
{
DataRow dataRow = BaseImpl.GetDataRowResult($"select '{rowItem["bak"] + ""}' as bak,'{rowItem["bombb"] + ""}' as bombb,'{rowItem["bombc"] + ""}' as bombc");
this.InitializeHeader(dataRow);
}
}
if (mainRow != null)
{
//更新
DataTable source = this.gcMain.GridControl.DataSourceTable();
List<DataRow> deleteRows = new List<DataRow>();
foreach (DataRow sourceRow in source.Rows)
{
string productId = sourceRow["ProductId"] + "";
DataRow newSourceRow = newSource.Rows.Cast<DataRow>().Where(n => (n["ProductId"] + "").Equals(productId)).FirstOrDefault();
if (newSourceRow != null)
{
sourceRow["tamount"] = newSourceRow["tamount"];
sourceRow["amount"] = newSourceRow["amount"];
sourceRow["bak"] = newSourceRow["bak"];
sourceRow["bombb"] = newSourceRow["bombb"];
sourceRow["bombc"] = newSourceRow["bombc"];
newSource.Rows.Remove(newSourceRow);
}
else
{
deleteRows.Add(sourceRow);
}
}
foreach (DataRow deleteRow in deleteRows)
{
source.Rows.Remove(deleteRow);
}
foreach (DataRow newSourceRow in newSource.Rows)
{
DataRow newRow = source.NewRow();
newRow.ItemArray = newSourceRow.ItemArray;
source.Rows.Add(newRow);
}
}
else
{
//新增
this.gcMain.GridControl.DataSource = newSource;
}
}
public void AddOrUpdateBillByZZQD(DataRow rowItem, DataTable newSource)
{
string masterSql = rowItem == null ? billModel.MasterSql.Replace("{" + billModel.PrimaryKey + "}", this.lblOrderNo.Text) : ReplaceHelper.ReplaceRowParam(rowItem, billModel.MasterSql);
// 加载单据信息
DataRow mainRow = BillImpl.GetDataRowResult(masterSql);
this.SetBillStatus(mainRow);
if (!billModel.SaveState)
{
this.InitializeHeader(rowItem);
}
string controlSql = "select '' as billdocument_id,'0' affirmer,'0' rtagid,'{材料代码}' as productid";
if (mainRow != null)
{
//更新
DataTable source = this.gcMain.GridC
@@ -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>
+291
View File
@@ -0,0 +1,291 @@
namespace Lskj.PubBomImportNew
{
partial class FrmMain
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.btnImport = new DevExpress.XtraEditors.SimpleButton();
this.btnRead = new DevExpress.XtraEditors.SimpleButton();
this.pl_bottom = new DevExpress.XtraEditors.PanelControl();
this.btnCancel = new DevExpress.XtraEditors.SimpleButton();
this.btnOk = new DevExpress.XtraEditors.SimpleButton();
this.pl_cond = new DevExpress.XtraEditors.PanelControl();
this.condTxtEdit = new DevExpress.XtraEditors.TextEdit();
this.lb_cond = new System.Windows.Forms.Label();
this.pl_purview = new DevExpress.XtraEditors.PanelControl();
this.purview_Mulit = new Lskj.Control.LabelMultiAutoTextEdit();
this.lb_purview = new System.Windows.Forms.Label();
this.tips = new DevExpress.XtraEditors.PanelControl();
this.tipsEdit = new DevExpress.XtraEditors.TextEdit();
this.splitMainContainer = new DevExpress.XtraEditors.SplitContainerControl();
this.gcMain = new Lskj.Control.GridControlEx();
this.gc_Right = new Lskj.Control.GridControlEx();
((System.ComponentModel.ISupportInitialize)(this.pl_bottom)).BeginInit();
this.pl_bottom.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_cond)).BeginInit();
this.pl_cond.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.condTxtEdit.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pl_purview)).BeginInit();
this.pl_purview.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.tips)).BeginInit();
this.tips.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.tipsEdit.Properties)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.splitMainContainer)).BeginInit();
this.splitMainContainer.SuspendLayout();
this.SuspendLayout();
//
// btnImport
//
this.btnImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnImport.Location = new System.Drawing.Point(764, 10);
this.btnImport.Margin = new System.Windows.Forms.Padding(4);
this.btnImport.Name = "btnImport";
this.btnImport.Size = new System.Drawing.Size(97, 31);
this.btnImport.TabIndex = 11;
this.btnImport.Text = "导入数据";
//
// btnRead
//
this.btnRead.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnRead.Location = new System.Drawing.Point(656, 10);
this.btnRead.Margin = new System.Windows.Forms.Padding(4);
this.btnRead.Name = "btnRead";
this.btnRead.Size = new System.Drawing.Size(97, 31);
this.btnRead.TabIndex = 10;
this.btnRead.Text = "读取Excel";
//
// pl_bottom
//
this.pl_bottom.Appearance.BackColor = System.Drawing.Color.Transparent;
this.pl_bottom.Appearance.Options.UseBackColor = true;
this.pl_bottom.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.pl_bottom.Controls.Add(this.btnImport);
this.pl_bottom.Controls.Add(this.btnCancel);
this.pl_bottom.Controls.Add(this.btnRead);
this.pl_bottom.Controls.Add(this.btnOk);
this.pl_bottom.Dock = System.Windows.Forms.DockStyle.Bottom;
this.pl_bottom.Location = new System.Drawing.Point(0, 549);
this.pl_bottom.Margin = new System.Windows.Forms.Padding(4);
this.pl_bottom.Name = "pl_bottom";
this.pl_bottom.Size = new System.Drawing.Size(872, 50);
this.pl_bottom.TabIndex = 2;
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(120, 10);
this.btnCancel.Margin = new System.Windows.Forms.Padding(4);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(97, 31);
this.btnCancel.TabIndex = 11;
this.btnCancel.Text = "清除绑定";
//
// btnOk
//
this.btnOk.Location = new System.Drawing.Point(12, 10);
this.btnOk.Margin = new System.Windows.Forms.Padding(4);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(97, 31);
this.btnOk.TabIndex = 10;
this.btnOk.Text = "保存绑定";
//
// pl_cond
//
this.pl_cond.Appearance.BackColor = System.Drawing.Color.White;
this.pl_cond.Appearance.Options.UseBackColor = true;
this.pl_cond.Controls.Add(this.condTxtEdit);
this.pl_cond.Controls.Add(this.lb_cond);
this.pl_cond.Dock = System.Windows.Forms.DockStyle.Top;
this.pl_cond.Location = new System.Drawing.Point(0, 0);
this.pl_cond.Margin = new System.Windows.Forms.Padding(4);
this.pl_cond.Name = "pl_cond";
this.pl_cond.Size = new System.Drawing.Size(872, 42);
this.pl_cond.TabIndex = 12;
//
// condTxtEdit
//
this.condTxtEdit.Dock = System.Windows.Forms.DockStyle.Fill;
this.condTxtEdit.Location = new System.Drawing.Point(87, 2);
this.condTxtEdit.Name = "condTxtEdit";
this.condTxtEdit.Properties.Appearance.BackColor = System.Drawing.Color.White;
this.condTxtEdit.Properties.Appearance.Options.UseBackColor = true;
this.condTxtEdit.Properties.AutoHeight = false;
this.condTxtEdit.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.condTxtEdit.Size = new System.Drawing.Size(783, 38);
this.condTxtEdit.TabIndex = 5;
//
// lb_cond
//
this.lb_cond.BackColor = System.Drawing.Color.White;
this.lb_cond.Dock = System.Windows.Forms.DockStyle.Left;
this.lb_cond.Location = new System.Drawing.Point(2, 2);
this.lb_cond.Name = "lb_cond";
this.lb_cond.Size = new System.Drawing.Size(85, 38);
this.lb_cond.TabIndex = 3;
this.lb_cond.Text = "筛选条件:";
this.lb_cond.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// pl_purview
//
this.pl_purview.Appearance.BackColor = System.Drawing.Color.White;
this.pl_purview.Appearance.Options.UseBackColor = true;
this.pl_purview.Controls.Add(this.purview_Mulit);
this.pl_purview.Controls.Add(this.lb_purview);
this.pl_purview.Cursor = System.Windows.Forms.Cursors.Default;
this.pl_purview.Dock = System.Windows.Forms.DockStyle.Top;
this.pl_purview.Location = new System.Drawing.Point(0, 42);
this.pl_purview.Margin = new System.Windows.Forms.Padding(4);
this.pl_purview.Name = "pl_purview";
this.pl_purview.Size = new System.Drawing.Size(872, 21);
this.pl_purview.TabIndex = 13;
//
// purview_Mulit
//
this.purview_Mulit.BackColor = System.Drawing.Color.White;
this.purview_Mulit.Dock = System.Windows.Forms.DockStyle.Fill;
this.purview_Mulit.EditText = "";
this.purview_Mulit.FontSize = 0F;
this.purview_Mulit.LabelText = "名称";
this.purview_Mulit.Location = new System.Drawing.Point(135, 2);
this.purview_Mulit.Margin = new System.Windows.Forms.Padding(4);
this.purview_Mulit.Model = null;
this.purview_Mulit.Name = "purview_Mulit";
this.purview_Mulit.NullText = "";
this.purview_Mulit.ReadOnly = false;
this.purview_Mulit.Required = false;
this.purview_Mulit.Size = new System.Drawing.Size(735, 17);
this.purview_Mulit.TabIndex = 4;
this.purview_Mulit.TextBoxProhibition = false;
//
// lb_purview
//
this.lb_purview.BackColor = System.Drawing.Color.White;
this.lb_purview.Dock = System.Windows.Forms.DockStyle.Left;
this.lb_purview.Location = new System.Drawing.Point(2, 2);
this.lb_purview.Name = "lb_purview";
this.lb_purview.Size = new System.Drawing.Size(133, 17);
this.lb_purview.TabIndex = 3;
this.lb_purview.Text = "条件可编辑人员:";
this.lb_purview.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// tips
//
this.tips.Appearance.BackColor = System.Drawing.Color.White;
this.tips.Appearance.Options.UseBackColor = true;
this.tips.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Office2003;
this.tips.Controls.Add(this.tipsEdit);
this.tips.Dock = System.Windows.Forms.DockStyle.Top;
this.tips.Location = new System.Drawing.Point(0, 63);
this.tips.Margin = new System.Windows.Forms.Padding(4);
this.tips.Name = "tips";
this.tips.Size = new System.Drawing.Size(872, 42);
this.tips.TabIndex = 14;
//
// tipsEdit
//
this.tipsEdit.Dock = System.Windows.Forms.DockStyle.Fill;
this.tipsEdit.EditValue = "请导入Excel模板";
this.tipsEdit.Location = new System.Drawing.Point(2, 2);
this.tipsEdit.Name = "tipsEdit";
this.tipsEdit.Properties.Appearance.BackColor = System.Drawing.Color.White;
this.tipsEdit.Properties.Appearance.ForeColor = System.Drawing.Color.Red;
this.tipsEdit.Properties.Appearance.Options.UseBackColor = true;
this.tipsEdit.Properties.Appearance.Options.UseForeColor = true;
this.tipsEdit.Properties.AutoHeight = false;
this.tipsEdit.Properties.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.tipsEdit.Properties.ReadOnly = true;
this.tipsEdit.Size = new System.Drawing.Size(868, 38);
this.tipsEdit.TabIndex = 6;
//
// splitMainContainer
//
this.splitMainContainer.Appearance.BackColor = System.Drawing.Color.Transparent;
this.splitMainContainer.Appearance.Options.UseBackColor = true;
this.splitMainContainer.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.Default;
this.splitMainContainer.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitMainContainer.Location = new System.Drawing.Point(0, 105);
this.splitMainContainer.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.splitMainContainer.Name = "splitMainContainer";
this.splitMainContainer.Panel1.Controls.Add(this.gcMain);
this.splitMainContainer.Panel1.Text = "Panel1";
this.splitMainContainer.Panel2.Controls.Add(this.gc_Right);
this.splitMainContainer.Panel2.Text = "Panel2";
this.splitMainContainer.Size = new System.Drawing.Size(872, 444);
this.splitMainContainer.SplitterPosition = 500;
this.splitMainContainer.TabIndex = 17;
this.splitMainContainer.Text = "splitContainerControl1";
//
// gcMain
//
this.gcMain.AdapterObj = null;
this.gcMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.gcMain.Location = new System.Drawing.Point(0, 0);
this.gcMain.Margin = new System.Windows.Forms.Padding(4);
this.gcMain.Name = "gcMain";
this.gcMain.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.gcMain.Size = new System.Drawing.Size(500, 444);
this.gcMain.TabIndex = 16;
//
// gc_Right
//
this.gc_Right.AdapterObj = null;
this.gc_Right.Dock = System.Windows.Forms.DockStyle.Fill;
this.gc_Right.Location = new System.Drawing.Point(0, 0);
this.gc_Right.Margin = new System.Windows.Forms.Padding(4);
this.gc_Right.Name = "gc_Right";
this.gc_Right.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.gc_Right.Size = new System.Drawing.Size(367, 444);
this.gc_Right.TabIndex = 18;
//
// FrmMain
//
this.Appearance.BackColor = System.Drawing.SystemColors.Control;
this.Appearance.Options.UseBackColor = true;
this.Appearance.Options.UseFont = true;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(872, 599);
this.Controls.Add(this.splitMainContainer);
this.Controls.Add(this.tips);
this.Controls.Add(this.pl_purview);
this.Controls.Add(this.pl_cond);
this.Controls.Add(this.pl_bottom);
this.Name = "FrmMain";
this.Opacity = 0D;
this.Text = "表格导入";
((System.ComponentModel.ISupportInitialize)(this.pl_bottom)).EndInit();
this.pl_bottom.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pl_cond)).EndInit();
this.pl_cond.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.condTxtEdit.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pl_purview)).EndInit();
this.pl_purview.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.tips)).EndInit();
this.tips.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.tipsEdit.Properties)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.splitMainContainer)).EndInit();
this.splitMainContainer.ResumeLayout(false);
this.ResumeLayout(f
File diff suppressed because it is too large Load Diff
+120
View File
@@ -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>
+143
View File
@@ -0,0 +1,143 @@
namespace Lskj.PubBomImport
{
partial class FrmProgress
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmProgress));
this.label3 = new System.Windows.Forms.Label();
this.splitter1 = new System.Windows.Forms.Splitter();
this.progressBarTotal = new System.Windows.Forms.ProgressBar();
this.panel2 = new System.Windows.Forms.Panel();
this.labelCurrentItem = new System.Windows.Forms.Label();
this.progressBarCurrent = new System.Windows.Forms.ProgressBar();
this.lblAll = new System.Windows.Forms.Label();
this.panel1 = new System.Windows.Forms.Panel();
this.splitter2 = new System.Windows.Forms.Splitter();
this.panel2.SuspendLayout();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(11, 8);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(104, 12);
this.label3.TabIndex = 0;
this.label3.Text = "系统正在导入Bom";
//
// splitter1
//
this.splitter1.BackColor = System.Drawing.SystemColors.InactiveBorder;
this.splitter1.Dock = System.Windows.Forms.DockStyle.Top;
this.splitter1.Location = new System.Drawing.Point(0, 31);
this.splitter1.Name = "splitter1";
this.splitter1.Size = new System.Drawing.Size(462, 2);
this.splitter1.TabIndex = 10;
this.splitter1.TabStop = false;
//
// progressBarTotal
//
this.progressBarTotal.Location = new System.Drawing.Point(16, 71);
this.progressBarTotal.Name = "progressBarTotal";
this.progressBarTotal.Size = new System.Drawing.Size(438, 12);
this.progressBarTotal.Step = 1;
this.progressBarTotal.TabIndex = 4;
//
// panel2
//
this.panel2.Controls.Add(this.progressBarTotal);
this.panel2.Controls.Add(this.labelCurrentItem);
this.panel2.Controls.Add(this.progressBarCurrent);
this.panel2.Controls.Add(this.lblAll);
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.ForeColor = System.Drawing.SystemColors.ControlDark;
this.panel2.Location = new System.Drawing.Point(0, 31);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(462, 101);
this.panel2.TabIndex = 8;
//
// labelCurrentItem
//
this.labelCurrentItem.AutoSize = true;
this.labelCurrentItem.Location = new System.Drawing.Point(14, 16);
this.labelCurrentItem.Name = "labelCurrentItem";
this.labelCurrentItem.Size = new System.Drawing.Size(65, 12);
this.labelCurrentItem.TabIndex = 0;
this.labelCurrentItem.Text = "正在导入:";
//
// progressBarCurrent
//
this.progressBarCurrent.Location = new System.Drawing.Point(15, 33);
this.progressBarCurrent.Name = "progressBarCurrent";
this.progressBarCurrent.Size = new System.Drawing.Size(438, 12);
this.progressBarCurrent.Step = 1;
this.progressBarCurrent.TabIndex = 5;
//
// lblAll
//
this.lblAll.AutoSize = true;
this.lblAll.Location = new System.Drawing.Point(14, 55);
this.lblAll.Name = "lblAll";
this.lblAll.Size = new System.Drawing.Size(53, 12);
this.lblAll.TabIndex = 2;
this.lblAll.Text = "总进度:";
//
// panel1
//
this.panel1.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.panel1.Controls.Add(this.label3);
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(462, 31);
this.panel1.TabIndex = 7;
//
// splitter2
//
this.splitter2.BackColor = System.Drawing.SystemColors.InactiveBorder;
this.splitter2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.splitter2.Location = new System.Drawing.Point(0, 132);
this.splitter2.Name = "splitter2";
this.splitter2.Size = new System.Drawing.Size(462, 2);
this.splitter2.TabIndex = 11;
this.splitter2.TabStop = false;
//
// FrmProgress
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(462, 134);
this.Controls.Add(this.splitter1);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.Controls.Add(this.splitter2);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
@@ -0,0 +1,958 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Threading;
using System.Net;
using Lskj.Control;
using System.Threading.Tasks;
using Lskj.Core;
using DevExpress.XtraGrid.Columns;
using NPOI.SS.UserModel;
using NPOI.SS.Util;
using NPOI.XSSF.UserModel;
using NPOI.HSSF.UserModel;
using Lskj.Model;
using Lskj.Control.BrowserSetting;
using Lskj.Business;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using Lskj.Business.Impl;
using System.Text.RegularExpressions;
using Lskj.Util;
using System.Web;
using Lskj.Control.Model;
using System.Data.SqlClient;
namespace Lskj.PubBomImportNew
{
/// <summary>
/// 下载进度窗口
/// </summary>
public partial class FrmProgress : Form
{
public FrmMain frmMain;
public DynamicBomImportNew Model;
public System.Windows.Forms.Timer ImportTimer = new System.Windows.Forms.Timer();
public FrmProgress()
{
InitializeComponent();
this.ControlBox = false;
}
/// <summary>
/// bom结构上传(总部)
/// </summary>
/// <param name="dirPaths"></param>
public void StartImportInFileByZB(List<DataRow> selectRows)
{
try
{
if (Directory.Exists("BomImportTemp"))
{
Directory.Delete("BomImportTemp", true);
}
Directory.CreateDirectory("BomImportTemp");
int execOrder = 1;
if (selectRows.Count > 1)
{
throw new Exception($"不允许选择多个文件");
}
DataRow mxRow = selectRows[0];
if (mxRow != null)
{
string mxDirPath = mxRow["BomFieldNameDir"] + "";
string productId = mxRow["BomMxMainProduct"] + "";
string addState = mxRow["BomMxAddState"] + "";
if (string.IsNullOrEmpty(Model.MainFieldDic))
{
throw new Exception($"字段对应关系配置异常");
}
if (string.IsNullOrEmpty(productId))
{
throw new Exception($"保存失败\r\n请重新进行BOM上传后保存");
}
if (addState.Equals("新增"))
{
DataRow billRow = BaseImpl.GetDataRowResult($"select qms_maddf_billdocument_id from qms_BillFileAddMaintab where qms_maddf_productid = '{productId}' and isnull(qms_maddf_addMode,'0') = '0'");
if (billRow != null)
{
throw new Exception($"物料编码{productId}的BOM新增单已存在审批流\r\n请进行审批");
}
DataRow billbomRow = BaseImpl.GetDataRowResult($"select top 1 billdocument_id from bom_BillTab where productid='{productId}'");
if (billRow != null)
{
throw new Exception($"物料编码{productId}的BOM建立单已存在\r\n请进行修改操作");
}
}
else
{
DataRow billbomRow = BaseImpl.GetDataRowResult($"select top 1 billdocument_id from bom_BillTab where productid='{productId}' and stepover = '1'");
if (billbomRow != null)
{
throw new Exception($"物料编码{productId}的BOM建立单已终审\r\n禁止修改操作");
}
}
FileInfo mxInfo = null;
if (!string.IsNullOrEmpty(mxDirPath))
{
mxInfo = new FileInfo(mxDirPath);
}
if (mxInfo != null)
{
DataTable mxfiletable = BaseImpl.GetDataTableResult($"select sname,fileId,webpath from p_fm_filetab where parentid in (select dirid from P_fm_DirectoryTab where pid = '{productId}' and dllcoid = '1000202') and speciesno = '010106' and sname = '{mxInfo.Name}'");
if (mxfiletable.Rows.Count > 0)
{
throw new Exception($"该文件已存在,请确认后再创建BOM");
}
FrmBillInfo frmBillInfo = new FrmBillInfo();
int.TryParse(Model.FirstRowIndex + "", out int firstRowIndex);
DataTable parentTable = ExcelToDatatable(mxInfo.FullName, Model, Model.SheetName, firstRowIndex);
parentTable = parentTable.Rows.Cast<DataRow>().Where(n => int.TryParse(n["序号"] + "", out _) && !string.IsNullOrEmpty(n["物料编码"] + "")).ToList().CopyToDataTable();
//StringBuilder stringBuilder = new StringBuilder();
//foreach (DataRow dataRow in parentTable.Rows)
//{
// string code = (dataRow["图号"] + "").Trim();
// if (code.StartsWith("QD"))
// {
// int createCode = ProductSaveUnique(code.Replace("'", "''"), (dataRow["名称"] + "").Replace("'", "''"), (dataRow["备注"] + "").Replace("'", "''"), "1000202_1", out string pid, out string msg);
// if ((createCode + "").Equals("-1"))
// {
// throw new Exception($"虚拟物料创建失败\r\n{msg}");
// }
// }
//}
//if (!string.IsNullOrEmpty(stringBuilder.ToString()))
//{
// SqlHelper.ExecuteNonQuery(stringBuilder.ToString());
//}
frmBillInfo.OnControlSourceBind += (s, args) =>
{
Task task = new Task(() =>
{
try
{
int.TryParse(Model.FirstRowIndex, out int index);
frmMain.FirstRowIndex = index;
bool isUpload = false;
string msg = "";
Dictionary<string, DataRow> maxBcFileDic = new Dictionary<string, DataRow>();
Dictionary<string, DataTable> fileTableDic = new Dictionary<string, DataTable>();
#region MX
frmBillInfo.OnBillAdd();
SetProcessBar(0, 0);
SetProcessMsg($"正在导入:{Path.GetFileName(mxInfo.FullName)}");
DataTable childTable = frmBillInfo.GcMainView.GridControl.DataSourceTable().Clone();
var mxCodeRows = parentTable.AsEnumerable();
string[] fieldDic = Model.MainFieldDic.Split(',');
foreach (DataRow parentRow in parentTable.Rows)
{
string code = (parentRow["物料编码"] + "").Trim();
int codeCount = mxCodeRows.Where(n => (n["物料编码"] + "").Trim().StartsWith(code)).Count();
if (codeCount > 1)//只允许存在一个
{
throw new Exception($"文件中的物料编码{code}重复,请修改");
}
DataRow childRow = childTable.NewRow();
foreach (string item in fieldDic)
{
string[] fieldArray = item.Split('^');
string key0 = fieldArray[0];
string key1 = fieldArray[1];
childRow[key0] = parentRow[key1] + "";
}
//childRow["ProductId"] = parentRow["物料编码"] + "";
//childRow["appellation"] = parentRow["名称"] + "";
//childRow["bak"] = parentRow["备注"] + "";
//childRow["tamount"] = parentRow["数量"] + "";
//childRow["amount"] = parentRow["数量"] + "";
childTable.Rows.Add(childRow);
}
SetProcessBar(20, 0);
if (childTable.Rows.Count == 0)
{
throw new Exception($"明细数据不能空");
}
SetProcessBar(40, 0);
string billMasterSql = $"select (select top 1 billdocument_id from bom_BillTab where productid='{productId}') as billdocument_id,'0' affirmer,'0' rtagid,'{productId}' as productid,'' as bak,'' as bombb,'' as bombc";
// 处理单据表头数据
DataRow masterRow = BillImpl.GetDataRowResult(billMasterSql);
SetProcessBar(60, 0);
frmBillInfo.AddOrUpdateBill(masterRow, childTable);
string guid = Guid.NewGuid() + "";
frmBillInfo.BillSaveSql(guid);
SetProcessBar(80, 0);
//上传文件
string uploadMxFileId = "";
if (mxfiletable.Rows.Count == 0)
{
isUpload = UploadFileToAudit(mxInfo.FullName, productId, "010106", out msg, out uploadMxFileId);
if (!isUpload)
{
throw new Exception($"{mxInfo.Name}附件上传失败\r\n{msg}");
}
}
StaticControl.RightMenuGridView.GridControl.Invoke(new Action(() =>
{
if (mxRow.Table.Columns.Contains("qms_laddf_FileId"))
{
int.TryParse(uploadMxFileId, out int qms_laddf_FileId);
mxRow["qms_laddf_FileId"] = qms_laddf_FileId;
}
if (mxRow.Table.Columns.Contains("qms_laddf_Exec"))
{
mxRow["qms_laddf_Exec"] = guid;
}
if (mxRow.Table.Columns.Contains("qms_laddf_ExecOrder"))
{
mxRow["qms_laddf_ExecOrder"] = execOrder;
}
}));
execOrder += 1;
#endregion
SetProcessBar(100, (1 / (parentTable.Rows.Count + 1)) * 100);
SetProcessLabelAllMsg($"总进度:{1}/{parentTable.Rows.Count + 1}");
this.Invoke(new Action(() =>
{
this.DialogResult = DialogResult.OK;
Close();
ImportTimer?.Dispose();
}));
}
catch (Exception ex)
{
MessageUtil.Show(ex.Message);
this.Invoke(new Action(() =>
{
this.DialogResult = DialogResult.Cancel;
Close();
ImportTimer?.Dispose();
}));
}
});
task.Start();
};
frmBillInfo.OnLoad(Model);
frmMain.ParentView = frmBillInfo.GcMainView;
}
else
{
throw new Exception("文件不存在");
}
}
}
catch (Exception ex)
{
MessageUtil.Show(ex.Message);
this.Invoke(new Action(() =>
{
this.DialogResult = DialogResult.Cancel;
Close();
ImportTimer?.Dispose();
}));
}
}
public int ProductSaveUnique(string spec, string appellation, string bak, string billSeq, out string productId, out string tipMsg)
{
productId = string.Empty;
tipMsg = string.Empty;
try
{
/*----------------------------------------------------
* 1) 组装存储过程参数
*--------------------------------------------------*/
// ProductId OUTPUT
SqlParameter pProductId = new SqlParameter("@ProductId", SqlDbType.VarChar, 100)
{
Direction = ParameterDirection.Output
};
// 存储过程 RETURN 值
SqlParameter pReturn = new SqlParameter("@return", SqlDbType.Int)
{
Direction = ParameterDirection.ReturnValue
};
// 中文字段可根据服务器排序规则切换参数类型
bool useNVar = ERPInfo.Instance.ChangeParameterType;
SqlParameter[] param =
{
new SqlParameter("@Spec", SqlDbType.VarChar, 50),
useNVar
? new SqlParameter("@Appellation", SqlDbType.NVarChar, 200)
: new SqlParameter("@Appellation", SqlDbType.VarChar, 200),
useNVar
? new SqlParameter("@Bak", SqlDbType.NVarChar, 200)
: new SqlParameter("@Bak", SqlDbType.VarChar, 200),
new SqlParameter("@BillSeq", SqlDbType.VarChar, 40),
pProductId,
pReturn
};
param[0].Value = spec;
param[1].Value = appellation ?? string.Empty;
param[2].Value = bak ?? string.Empty;
param[3].Value = string.IsNullOrWhiteSpace(billSeq) ? (object)DBNull.Value : billSeq;
SqlHelper.ExecuteNonQuery(
CommandType.StoredProcedure,
"sp_InsertProductUnique",
param);
/*----------------------------------------------------
* 3) 处理返回值与提示信息
*--------------------------------------------------*/
productId = pProductId.Value == DBNull.Value ? string.Empty
: pProductId.Value.ToString();
int retCode = (pReturn.Value == DBNull.Value) ? -1
: Convert.ToInt32(pReturn.Value);
// 根据返回值给出业务提示
switch (retCode)
{
case 0:
tipMsg = "保存成功!";
break;
case 1:
tipMsg = "规格已存在,直接返回现有编码。";
break;
default:
tipMsg = "发生异常,请查看日志!";
break;
}
return retCode;
}
catch (Exception ex)
{
tipMsg = ex.Message;
throw; // 继续向外抛,让调用层捕获日志
}
}
/// <summary>
/// 显示当前文件
/// </summary>
/// <param name="text"></param>
private void SetProcessMsg(string text)
{
this.labelCurrentItem.Invoke(new Action(() =>
{
this.labelCurrentItem.Text = text;
}));
}
private void SetProcessLabelAllMsg(string text)
{
this.lblAll.Invoke(new Action(() =>
{
this.lblAll.Text = text;
}));
}
/// <summary>
/// 显示当前进度
/// </summary>
/// <param name="current"></param>
/// <param name="total"></param>
private void SetProcessBar(int current, int total)
{
this.Invoke(new Action(() =>
{
this.progressBarCurrent.Value = current;
this.progressBarTotal.Value = total;
}));
}
/// <summary>
/// 获取表格数据
/// </summary>
/// <param name="fileName"></param>
/// <param name="sheetName"></param>
/// <param name="isFirstRowColumn"></param>
/// <returns></returns>
public DataTable ExcelToDatatable(string fileName, DynamicBomImportNew Model, string sheetName = "", int firstRowIndex = 0)
{
DataTable data = new DataTable();
FileStream fs;
IWorkbook workbook = null;
try
{
fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
if (fileName.IndexOf(".xlsx") > 0) // 2007版本
{
workbook = new XSSFWorkbook(fs);
}
else if (fileName.IndexOf(".xls") > 0) // 2003版本
{
workbook = new HSSFWorkbook(fs);
}
ISheet sheet;
if (!string.IsNullOrEmpty(sheetName))
{
sheet = workbook.GetSheet(sheetName);//根据给定的sheet名称获取数据
}
else
{
//也可以根据sheet编号来获取数据
sheet = workbook.GetSheetAt(0);//获取第几个sheet表(此处表示如果没有给定sheet名称,默认是第一个sheet表)
}
if (sheet != null)
{
int startRow = firstRowIndex + 1;
IRow firstRow = sheet.GetRow(firstRowIndex);
IRow bandRow = null;
int cellCount = firstRow.LastCellNum;
for (int i = firstRow.FirstCellNum; i < firstRow.LastCellNum; i++)//第一行列数循环
{
ICell titleCell = firstRow.GetCell(i);
ICell bandCell = null;
bool isBandTitle = false;
if (titleCell.IsMergedCell)
{
CellRangeAddress mergrRange = FindMergedRegion(sheet, firstRowIndex, i);
startRow = mergrRange.LastRow + 1;
if (mergrRange != null)
{
if (mergrRange.FirstColumn < mergrRange.LastColumn && !Model.CustomerServiceApp)
{
isBandTitle = true;
bandRow = sheet.GetRow(mergrRange.LastRow + 1);
titleCell = firstRow.GetCell(mergrRange.FirstColumn);
bandCell = bandRow.GetCell(i);
CellRangeAddress bandMergrRange = FindMergedRegion(sheet, mergrRange.LastRow + 1, i);
if (bandMergrRange != null)
{
startRow = bandMergrRange.LastRow + 1;
}
else
{
startRow = mergrRange.LastRow + 2;
}
}
else
{
startRow = mergrRange.LastRow + 1;
}
}
}
string fieldName = "";
if (!isBandTitle || bandRow == null)
{
fieldName = GetCellValue(titleCell);
}
else
{
fieldName = $"{GetCellValue(titleCell)}|{GetCellValue(bandCell)}";
}
if (string.IsNullOrEmpty(fieldName) && titleCell.IsMergedCell)
{
cellCount -= 1;
continue;
}
DataColumn column = new DataColumn(fieldName);//获取标题
data.Columns.Add(column);//添加列
}
//最后一行的标号
int rowCount = sheet.LastRowNum;
for (int i = startRow; i <= rowCount; i++)//循环遍历所有行
{
IRow row = sheet.GetRow(i);//第几行
if (row == null)
{
continue; //没有数据的行默认是null;
}
//将excel表每一行的数据添加到datatable的行中
DataRow dataRow = data.NewRow();
int dataRowIndex = 0;
for (int j = firstRow.FirstCellNum; j < cellCount; j++)
{
ICell cell = row.GetCell(j);
if (cell != null && cell.IsMergedCell)
{
CellRangeAddress mergrRange = FindMergedRegion(sheet, i, j);
if (j == mergrRange.FirstColumn)
{
dataRow[dataRowIndex] = GetCellValue(row.GetCell(j));
dataRowIndex += 1;
}
else
{
cellCount += 1;
continue;
}
}
else
{
if (row.GetCell(j) != null) //同理,没有数据的单元格都默认是null
{
dataRow[dataRowIndex] = GetCellValue(row.GetCell(j));
dataRowIndex += 1;
}
}
}
data.Rows.Add(dataRow);
}
}
return data;
}
catch (IOException ex)
{
throw new IOException(string.Format("读取模板内容失败,原因:{0}", ex.Message));
}
catch (Exception ex)
{
throw new Exception(string.Format("读取模板内容失败,原因:{0}", ex.Message));
}
}
/// <summary>
/// 获取单元格值
/// </summary>
/// <param name="cell"></param>
/// <returns></returns>
public static string GetCellValue(ICell cell)
{
string cellValue = "";
try
{
if (cell != null)
{
// 根据单元格类型获取值
switch (cell.CellType)
{
case CellType.String:
cellValue = cell.StringCellValue;
break;
case CellType.Numeric:
cellValue = cell.NumericCellValue.ToString();
break;
case CellType.Boolean:
cellValue = cell.BooleanCellValue.ToString();
break;
case CellType.Formula://单元格中带有公式,根据类型继续判断
switch (cell.CachedFormulaResultType)
{
case CellType.String:
cellValue = cell.StringCellValue;
break;
case CellType.Numeric:
cellValue = cell.NumericCellValue.ToString();
break;
case CellType.Boolean:
cellValue = cell.BooleanCellValue.ToString();
break;
case CellType.Blank:
break;
default:
cellValue.ToString();
break;
}
break;
default:
cellValue = cell.ToString();
break;
}
}
}
catch (Exception)
{
}
return cellValue;
}
/// <summary>
/// 获取合并区域
/// </summary>
/// <param name="sheet"></param>
/// <param name="rowIndex"></param>
/// <param name="columnIndex"></param>
/// <returns></returns>
private CellRangeAddress FindMergedRegion(ISheet sheet, int rowIndex, int columnIndex)
{
int mergedRegionsCount = sheet.NumMergedRegions;
for (int i = 0; i < mergedRegionsCount; i++)
{
CellRangeAddress mergedRegion = sheet.GetMergedRegion(i);
if (mergedRegion.IsInRange(rowIndex, columnIndex))
{
return mergedRegion; // 返回合并区域
}
}
return null; // 未找到合并区域
}
/// <summary>
/// 上传文件
/// </summary>
/// <param name="filePath"></param>
/// <param name="msg"></param>
/// <returns></returns>
private bool UploadFile(string filePath, string idValue, out string msg, out string outFileId)
{
bool isUpload = false;
string File = filePath;
string returnMsg = "";
string fileId = "";
string postUrl = "";
try
{
//获取文件信息
FileInfo fileInfo = new FileInfo(File);
string suffix = Path.GetExtension(File);
string name = fileInfo.Name;
DateTime creationTime = fileInfo.CreationTime;
byte[] fileBytes = ConvertFileToBytes(File);
string fileStream = Convert.ToBase64String(fileBytes);
string userId = ERPInfo.Instance.UserId;
DateTime uploadTime = DateTime.Now;
string speciesno = "010102";
// 检查扩展名是否为 .xlsx 或 .xls
if (suffix.Equals(".xlsx", StringComparison.OrdinalIgnoreCase) ||
suffix.Equals(".xls", StringComparison.OrdinalIgnoreCase))
{
speciesno = "010101";
}
//上传文件到服务器目录
postUrl = "{0}Api/FileUploadApi.ashx?moduleId={1}&idValue={2}&speciesno={8}&folder={3}&totsize={4}&position={5}&filename={6}&method={7}&confirm=1";
if (!string.IsNullOrEmpty(idValue))
{
string token = "";
string loginUrl = $"{SystemInfo.Instance.OAUrl}/Api/SysUserAjaxApi.ashx";
HttpTools.setting("application/x-www-form-urlencoded", null, null, HttpTools.Encode.UTF8);
Dictionary<string, string> loginPmsDic = new Dictionary<string, string>();
loginPmsDic.Add("method", "Login");
loginPmsDic.Add("username", HttpUtility.UrlEncode(ERPInfo.Instance.UserName));
loginPmsDic.Add("password", HttpUtility.UrlEncode(ERPInfo.Instance.InPassWord));
HttpWebResponse loginResponse = HttpTools.Post(loginUrl, "", loginPmsDic, HttpTools.Method.POST, out CookieCollection loginCookie, out string loginResult);
if (loginResponse != null && !string.IsNullOrEmpty(loginResult))
{
JObject jObject = JsonConvert.DeserializeObject<JObject>(loginResult);
if (jObject.ContainsKey("success"))
{
if ((jObject["success"] + "").Equals("True"))
{
if (jObject.ContainsKey("token"))
{
token = jObject["token"] + "";
}
}
}
}
if (!string.IsNullOrEmpty(token))
{
//string selectSql = $"select * from P_fm_FileTab where parentid in (select dirid from P_fm_DirectoryTab where pid = '{idValue}' and dllcoid = '1000202') and speciesno = '{speciesno}' and sname = '{name.Replace(" ", "")}'";
//DataTable deleteTable = BaseImpl.GetDataTableResult(selectSql);
//if (deleteTable != null && deleteTable.Rows.Count > 0)
//{
// foreach (DataRow deleteRow in deleteTable.Rows)
// {
// string field = HttpUtility.UrlEncode(deleteRow["fileId"] + "");
// string webpath = HttpUtility.UrlEncode(deleteRow["webpath"] + "");
// //删除文件
// string deleteUrl = "{0}Api/FileUploadApi.ashx?fileId={1}&filename={2}&method={3}";
// deleteUrl = string.Format(deleteUrl, SystemInfo.Instance.OAUrl, field, webpath, "DoDelete");
// HttpHelper.Setting("application/x-www-form-urlencoded", null, null);
// Dictionary<string, string> deleteHeaderDic = new Dictionary<string, string>();
// deleteHeaderDic.Add("Authorization", $"Bearer {token}");
// HttpWebResponse deleteWebResponse = HttpHelper.Post(deleteUrl, fileStream, null, deleteHeaderDic, out string deleteResult);
// }
//}
postUrl = string.Format(postUrl, SystemInfo.Instance.OAUrl, "1000202", HttpUtility.UrlEncode(idValue), "file", fileBytes.Length, 0, HttpUtility.UrlEncode(name), "DoWebUpload", speciesno);
HttpTools.setting("application/x-www-form-urlencoded", null, null);
string result = "";
CookieCollection cookieCollection = null;
Dictionary<string, string> headerDic = new Dictionary<string, string>();
headerDic.Add("Authorization", $"Bearer {token}");
HttpWebResponse webResponse = HttpTools.Post(postUrl, fileStream, null, headerDic, HttpTools.Method.POST, out cookieCollection, out result);
if (webResponse != null && !string.IsNullOrEmpty(result))
{
JObject jsonObject = (JObject)JsonConvert.DeserializeObject(result);
string isSuccess = jsonObject["success"] + "";
if (isSuccess.Equals("True", StringComparison.CurrentCultureIgnoreCase))
{
if (jsonObject.ContainsKey("other"))
{
fileId = jsonObject["other"] + "";
}
isUpload = true;
}
else
{
if (jsonObject.ContainsKey("msg"))
{
returnMsg = jsonObject["msg"] + "";
}
isUpload = false;
}
}
else
{
returnMsg = "上传请求失败";
isUpload = false;
}
}
else
{
returnMsg = loginResult;
isUpload = false;
}
}
else
{
returnMsg = "上传节点值不能为空";
isUpload = false;
}
}
catch (Exception ex)
{
returnMsg = ex.Message;
throw new Exception($"文件{Path.GetFileName(filePath)}上传失败\r\n{ex.Message}");
isUpload = false;
}
msg = returnMsg;
outFileId = fileId;
return isUpload;
}
private bool UploadFileToAudit(string filePath, string idValue, string speciesno, out string msg, out string outFileId)
{
bool isUpload = false;
string File = filePath;
string returnMsg = "";
string fileId = "";
string postUrl = "";
try
{
//获取文件信息
FileInfo fileInfo = new FileInfo(File);
string suffix = Path.GetExtension(File);
string name = fileInfo.Name;
DateTime creationTime = fileInfo.CreationTime;
byte[] fileBytes = ConvertFileToBytes(File);
string fileStream = Convert.ToBase64String(fileBytes);
string userId = ERPInfo.Instance.UserId;
DateTime uploadTime = DateTime.Now;
string code = "";
string namepattern = @"^(.*-S[A-Z]\d*)(.*)$";
Match namematch = Regex.Match(Path.GetFileNameWithoutExtension(fileInfo.Name).Trim(), namepattern);
if (namematch.Success)
{
code = namematch.Groups[1].Value;
}
//上传文件到服务器目录
postUrl = "{0}Api/FileUploadApi.ashx?moduleId={1}&idValue={2}&speciesno={8}&folder={3}&totsize={4}&position={5}&filename={6}&method={7}&confirm=1";
if (!string.IsNullOrEmpty(idValue))
{
string token = "";
string loginUrl = $"{SystemInfo.Instance.OAUrl}/Api/SysUserAjaxApi.ashx";
HttpTools.setting("application/x-www-form-urlencoded", null, null, HttpTools.Encode.UTF8);
Dictionary<string, string> loginPmsDic = new Dictionary<string, string>();
loginPmsDic.Add("method", "Login");
loginPmsDic.Add("username", HttpUtility.UrlEncode(ERPInfo.Instance.UserName));
loginPmsDic.Add("password", HttpUtility.UrlEncode(ERPInfo.Instance.InPassWord));
HttpWebResponse loginResponse = HttpTools.Post(loginUrl, "", loginPmsDic, HttpTools.Method.POST, out CookieCollection loginCookie, out string loginResult);
if (loginResponse != null && !string.IsNullOrEmpty(loginResult))
{
JObject jObject = JsonConvert.DeserializeObject<JObject>(loginResult);
if (jObject.ContainsKey("success"))
{
if ((jObject["success"] + "").Equals("True"))
{
if (jObject.ContainsKey("token"))
{
token = jObject["token"] + "";
}
}
}
}
if (!string.IsNullOrEmpty(token))
{
//string selectSql = $"select * from P_fm_FileTab where parentid in (select dirid from P_fm_DirectoryTab where pid = '{idValue}' and dllcoid = '1000202') and speciesno = '{speciesno}' and sname = '{name.Replace(" ", "")}'";
//DataTable deleteTable = BaseImpl.GetDataTableResult(selectSql);
//if (deleteTable != null && deleteTable.Rows.Count > 0)
//{
// foreach (DataRow deleteRow in deleteTable.Rows)
// {
// string field = HttpUtility.UrlEncode(deleteRow["fileId"] + "");
// string webpath = HttpUtility.UrlEncode(deleteRow["webpath"] + "");
// //删除文件
// string deleteUrl = "{0}Api/FileUploadApi.ashx?fileId={1}&filename={2}&method={3}";
// deleteUrl = string.Format(deleteUrl, SystemInfo.Instance.OAUrl, field, webpath, "DoDelete");
// HttpHelper.Setting("application/x-www-form-urlencoded", null, null);
// Dictionary<string, string> deleteHeaderDic = new Dictionary<string, string>();
// deleteHeaderDic.Add("Authorization", $"Bearer {token}");
// HttpWebResponse deleteWebResponse = HttpHelper.Post(deleteUrl, fileStream, null, deleteHeaderDic, out string deleteResult);
// }
//}
postUrl = string.Format(postUrl, SystemInfo.Instance.OAUrl, "1000202", HttpUtility.UrlEncode(idValue), "file", fileBytes.Length, 0, HttpUtility.UrlEncode(name), "DoWebUpload", speciesno);
HttpTools.setting("application/x-www-form-urlencoded", null, null);
string result = "";
CookieCollection cookieCollection = null;
Dictionary<string, string> headerDic = new Dictionary<string, string>();
headerDic.Add("Authorization", $"Bearer {token}");
HttpWebResponse webResponse = HttpTools.Post(postUrl, fileStream, null, headerDic, HttpTools.Method.POST, out cookieCollection, out result);
if (webResponse != null && !string.IsNullOrEmpty(result))
{
JObject jsonObject = (JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(result);
string isSuccess = jsonObject["success"] + "";
if (isSuccess.Equals("True", StringComparison.CurrentCultureIgnoreCase))
{
if (jsonObject.ContainsKey("other"))
{
fileId = jsonObject["other"] + "";
BaseImpl.ExecSqlValue($"update p_fm_filetab set isdisabled = 2 where fileid = '{fileId}'");
}
isUpload = true;
}
else
{
if (jsonObject.ContainsKey("msg"))
{
returnMsg = jsonObject["msg"] + "";
}
isUpload = false;
}
}
else
{
returnMsg = "上传请求失败";
isUpload = false;
}
}
else
{
returnMsg = loginResult;
isUpload = false;
}
}
else
{
returnMsg = "上传节点值不能为空";
isUpload = false;
}
}
catch (Exception ex)
{
returnMsg = ex.Message;
throw new Exception($"文件{Path.GetFileName(filePath)}上传失败\r\n{ex.Message}");
isUpload = false;
}
msg = returnMsg;
outFileId = fileId;
return isUpload;
}
/// <summary>
/// 记录附件变更数据
/// </summary>
/// <param name="dt"></param>
/// <returns></returns>
public string BuildBomFileTabSql(DataTable dt, string billno)
{
if (dt == null || dt.Rows.Count == 0) return string.Empty;
var sb = new StringBuilder();
sb.AppendLine("BEGIN TRANSACTION;");
foreach (DataRow row in dt.Rows)
{
int fileId = Convert.ToInt32(row["文件ID"]);
string fileName = row["附件名称"].ToString().Replace("'", "''");// 单引号转义
string speciesNo = row["目录ID"].ToString().Replace("'", "''");// → speciesno
string dirName = row["目录名称"].ToString().Trim();// → pid
int pid = 0;
int.TryParse(dirName, out pid); //目录名称若为数字则转换,否则默认为 0
sb.AppendFormat(
@"IF NOT EXISTS (
SELECT 1 FROM bom_filetab
WHERE fileid = {0}
AND speciesno = '{1}'
AND pid = {2})
INSERT INTO bom_filetab (billno, fileid, filename, speciesno, pid)
VALUES ('{4}',{0}, N'{3}', '{1}', {2});
", fileId, speciesNo, pid, fileName, billno);
}
sb.AppendLine("COMMIT TRANSACTION;");
return sb.ToString();
}
/// <summary>
/// 附件转换byte[]
/// </summary>
/// <param name="filePath">附件路径</param>
/// <returns>二进制</returns>
private byte[] ConvertFileToBytes(string filePath)
{
byte[] bytContent = null;
System.IO.FileStream fs = null;
System.IO.BinaryReader br = null;
try
{
fs = new FileStream(filePath, System.IO.FileMode.Open);
}
catch (Exception)
{
throw;
}
finally
{
if (fs != null)
br = new BinaryReader((Stream)fs);
if (br != null)
bytContent = br.ReadBytes((Int32)fs.Length);
if (fs != null)
fs.Dispose();
}
return bytContent;
}
/// <summary>
/// 解析code信息
/// </summary>
/// <param name="sourceCode"></param>
/// <param name="code"></param>
/// <param name="name"></param>
/// <param name="bb"></param>
/// <param name="bc"></param>
private void GetFileCodeInfo(string sourceCode, out string code, out string name, out string bb, out int bc)
{
string namepattern = @"^(.*-S[A-Z]\d*)(.*)$";
string pattern = @"^(.*?)(\d+)?$";
string childcode = "";
string childname = "";
string childsourceCode = "";
string childsourceBB = "";
int childsourceBC = 0;
Match namematch = Regex.Match(Path.GetFileNameWithoutExtension(sourceCode).Trim(), namepattern);
if (namematch.Success)
{
childcode = namematch.Groups[1].Value.Trim();
childname = namematch.Groups[2].Value.Trim();
}
Match match = Regex.Match(childcode, pattern);
if (match.Success)
{
childsourceCode = match.Groups[1].Value;
int.TryParse(match.Groups[2].Value, out childsourceBC);//版次
Match bbMatch = Regex.Match(childsourceCode, @"^.*?([A-Za-z]+)(\d*)$");
if (bbMatch.Success)
{
childsourceBB = bbMatch.Groups[1].Value.Trim();
}
}
code = childsourceCode;
name = childname;
bb = childsourceBB;
bc = childsourceBC;
}
/// <summary>
/// 解析code信息
/// </summary>
/// <param name="sourceCode"></param>
/// <param name="code"></param>
/// <param name="name"></param>
/// <param name="bb"></param>
/// <param name="bc"></param>
private bool GetOtherFileCodeInfo(string fileName, out string code, out string spec, out string name, out string extension, out string bb, out int bc)
{
string namepattern = @"^(\S+)\s+(\S*-S[A-Z][0-9]*)\s+(.+)(\.[^.]+)$";
string pattern = @"^(.*?)(\d+)?$";
var match = Regex.Match(fileName, namepattern);
code = "";
spec = "";
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{8C507C31-8C19-46C9-82F8-85DDCAE69190}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>Lskj.PubBomImport</RootNamespace>
<AssemblyName>Lskj.PubBomImport</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Debug\Lib\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="DevExpress.Data.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.Utils.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraEditors.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="DevExpress.XtraPrinting.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraGrid.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
<Reference Include="DevExpress.XtraTreeList.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\引用DLL\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NPOI">
<HintPath>..\..\..\引用DLL\NPOI.dll</HintPath>
</Reference>
<Reference Include="NPOI.OOXML">
<HintPath>..\..\..\引用DLL\NPOI.OOXML.dll</HintPath>
</Reference>
<Reference Include="NPOI.OpenXml4Net">
<HintPath>D:\工作\lserp_cs_6.0\引用DLL\NPOI.OpenXml4Net.dll</HintPath>
</Reference>
<Reference Include="NPOI.OpenXmlFormats">
<HintPath>D:\工作\lserp_cs_6.0\引用DLL\NPOI.OpenXmlFormats.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DllBaseClass.cs" />
<Compile Include="FrmBillInfo.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="FrmBillInfo.Designer.cs">
<DependentUpon>FrmBillInfo.cs</DependentUpon>
</Compile>
<Compile Include="FrmMain.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmMain.Designer.cs">
<DependentUpon>FrmMain.cs</DependentUpon>
</Compile>
<Compile Include="FrmProgress.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FrmProgress.Designer.cs">
<DependentUpon>FrmProgress.cs</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Service Include="{94E38DFF-614B-4cbd-B67C-F211BB35CE8B}" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="FrmBillInfo.resx">
<DependentUpon>FrmBillInfo.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmMain.resx">
<DependentUpon>FrmMain.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="FrmProgress.resx">
<DependentUpon>FrmProgress.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\licenses.licx" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Lskj.Business\Lskj.Business.csproj">
<Project>{7EAFCCC2-A18F-49E9-85C6-A984966CFD01}</Project>
<Name>Lskj.Business</Name>
</ProjectReference>
<ProjectReference Include="..\Lskj.Control\Lskj.Control.csproj">
<Project>{447CDC40-659F-4CCA-9ED6-8E818B4CF8BF}</Project>
<Name>Lskj.Control</Name>
</ProjectReference>
<ProjectReference Include="..\Lskj.Core\Lskj.Core.csproj">
<Project>{2A1BE6AC-1077-491B-A754-C5822FE8121E}</Project>
<Name>Lskj.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Lskj.Data\Lskj.Data.csproj">
<Project>{308B9B18-9BE2-495C-9C64-EED81D567813}</Project>
<Name>Lskj.Data</Name>
</ProjectReference>
<ProjectReference Include="..\Lskj.Model\Lskj.Model.csproj">
<Project>{52BC40E0-C0C6-4F78-996B-CAE028D209CA}</Project>
<Name>Lskj.Model</Name>
</ProjectReference>
<ProjectReference Include="..\Lskj.Util\Lskj.Util.csproj">
<Project>{A51BF642-6543-4DE3-8948-83F558B72BD4}</Project>
<Name>Lskj.Util</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@@ -0,0 +1,9 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("Lskj.PubBomImport")]
[assembly: AssemblyDe
@@ -0,0 +1,14 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Lskj.PubBomImport.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttrib
@@ -0,0 +1,9 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Lskj.PubBomImport.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="LastSelectFolder" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="Lskj.PubBomImport.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<userSettings>
<Lskj.PubBomImport.Properties.Settings>
<setting name="LastSelectFolder" serializeAs="String">
<value />
</setting>
</Lskj.PubBomImport.Properties.Settings>
</userSettings>
</configuration>