liulb@mesnac.com 1 year ago
parent 9c758ec2ff
commit 54d11d5599

@ -1,4 +1,5 @@
using Mesnac.Action.ChemicalWeighing.Entity;
using DevExpress.Xpo.Helpers;
using Mesnac.Action.ChemicalWeighing.Entity;
using Mesnac.Action.ChemicalWeighing.Entity.material;
using Mesnac.Codd.Session;
using System;
@ -35,8 +36,6 @@ namespace Mesnac.Action.ChemicalWeighing.BinManage
#endregion
#region 获取物料名与ID对象集合
/// <summary>
/// 获取所有物料对象集合
@ -127,5 +126,31 @@ namespace Mesnac.Action.ChemicalWeighing.BinManage
}
#endregion
#region 获取物料
public static DataTable GetBinMaterial()
{
string sql = @"select distinct m.ID MaterialID,m.Material_code MaterialCode, m.Material_name MaterialName
FROM Pmt_Bin b inner join xl_material m ON b.Material_ID= m.ID";
IFreeSql fsql = DBHelper.FreeHelper.Instance;
DataTable dt = fsql.Select<object>().WithSql(sql).ToDataTable("*");
return dt;
}
#endregion
#region 获取物料
public static DataTable GetBinMaterial2()
{
string sql = @"select distinct m.ID MaterialID,m.Material_code MaterialCode, m.Material_name MaterialName
FROM Pmt_Bin b inner join xl_material m ON b.Material_ID= m.ID";
IFreeSql fsql = DBHelper.FreeHelper.Instance;
DataTable dt = fsql.Select<object>().WithSql(sql).ToDataTable("*");
return dt;
}
#endregion
}
}

@ -1,4 +1,5 @@
using System;
using FreeSql.DataAnnotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -6,13 +7,39 @@ using System.Threading.Tasks;
namespace Mesnac.Action.ChemicalWeighing.Entity
{
/// <summary>
/// 反应釜子表
/// </summary>
public class Hw_WareHouse_Sub
{
/// <summary>
/// 主键Id
/// </summary>
[Column(IsIdentity =true,IsPrimary =true)]
public int ID { get; set; }
/// <summary>
/// 父类主键ID
/// </summary>
public int MainId { get; set; }
/// <summary>
/// 计划编码
/// </summary>
public string PId { get; set; }
/// <summary>
/// 物料ID
/// </summary>
public string MaterialID { get; set; }
/// <summary>
/// 物料名称
/// </summary>
public string MaterialName { get; set; }
/// <summary>
/// 与物料ID
/// </summary>
public string Material_Code { get; set; }
/// <summary>
/// 设置重量
/// </summary>
public string SetWeight { get; set; }
}
}

@ -31,104 +31,156 @@
this.btnCancel = new System.Windows.Forms.Button();
this.btnOk = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.cmbMaterial = new System.Windows.Forms.ComboBox();
this.txtSetWeight = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.txtMaterialCode = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.txtSetWeight = new System.Windows.Forms.TextBox();
this.cmbMaterial = new System.Windows.Forms.ComboBox();
this.txtMaterialCode = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.txtPlanId = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCancel.Location = new System.Drawing.Point(227, 179);
this.btnCancel.Location = new System.Drawing.Point(370, 299);
this.btnCancel.Margin = new System.Windows.Forms.Padding(4);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(108, 48);
this.btnCancel.Size = new System.Drawing.Size(147, 48);
this.btnCancel.TabIndex = 23;
this.btnCancel.Text = "取消(&C)";
this.btnCancel.Text = "取消";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnOk
//
this.btnOk.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnOk.Location = new System.Drawing.Point(96, 179);
this.btnOk.Location = new System.Drawing.Point(190, 299);
this.btnOk.Margin = new System.Windows.Forms.Padding(4);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(108, 48);
this.btnOk.Size = new System.Drawing.Size(145, 48);
this.btnOk.TabIndex = 22;
this.btnOk.Text = "确定(&O)";
this.btnOk.Text = "确定";
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(37, 50);
this.label1.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold);
this.label1.Location = new System.Drawing.Point(37, 92);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(89, 18);
this.label1.Size = new System.Drawing.Size(149, 29);
this.label1.TabIndex = 19;
this.label1.Text = "物料名称:";
//
// cmbMaterial
// label3
//
this.cmbMaterial.FormattingEnabled = true;
this.cmbMaterial.Location = new System.Drawing.Point(133, 41);
this.cmbMaterial.Name = "cmbMaterial";
this.cmbMaterial.Size = new System.Drawing.Size(202, 26);
this.cmbMaterial.TabIndex = 24;
this.cmbMaterial.SelectedIndexChanged += new System.EventHandler(this.cmbMaterial_SelectedIndexChanged);
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold);
this.label3.Location = new System.Drawing.Point(34, 237);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(149, 29);
this.label3.TabIndex = 20;
this.label3.Text = "设置重量:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold);
this.label2.Location = new System.Drawing.Point(94, 164);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(89, 29);
this.label2.TabIndex = 20;
this.label2.Text = "条码:";
//
// txtSetWeight
//
this.txtSetWeight.Location = new System.Drawing.Point(133, 130);
this.txtSetWeight.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.txtSetWeight.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtSetWeight.Location = new System.Drawing.Point(190, 231);
this.txtSetWeight.Margin = new System.Windows.Forms.Padding(4);
this.txtSetWeight.Name = "txtSetWeight";
this.txtSetWeight.Size = new System.Drawing.Size(202, 28);
this.txtSetWeight.TabIndex = 18;
this.txtSetWeight.Size = new System.Drawing.Size(327, 40);
this.txtSetWeight.TabIndex = 25;
//
// label3
// cmbMaterial
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(34, 135);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(89, 18);
this.label3.TabIndex = 20;
this.label3.Text = "设置重量:";
this.cmbMaterial.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbMaterial.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.cmbMaterial.FormattingEnabled = true;
this.cmbMaterial.Items.AddRange(new object[] {
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12",
"13",
"14",
"14",
"15",
"17",
"18",
"19",
"20"});
this.cmbMaterial.Location = new System.Drawing.Point(190, 87);
this.cmbMaterial.Margin = new System.Windows.Forms.Padding(4);
this.cmbMaterial.Name = "cmbMaterial";
this.cmbMaterial.Size = new System.Drawing.Size(327, 37);
this.cmbMaterial.TabIndex = 26;
this.cmbMaterial.SelectedIndexChanged += new System.EventHandler(this.cmbMaterial_SelectedIndexChanged_1);
//
// txtMaterialCode
//
this.txtMaterialCode.Location = new System.Drawing.Point(133, 84);
this.txtMaterialCode.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.txtMaterialCode.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtMaterialCode.Location = new System.Drawing.Point(190, 158);
this.txtMaterialCode.Margin = new System.Windows.Forms.Padding(4);
this.txtMaterialCode.Name = "txtMaterialCode";
this.txtMaterialCode.ReadOnly = true;
this.txtMaterialCode.Size = new System.Drawing.Size(202, 28);
this.txtMaterialCode.TabIndex = 18;
this.txtMaterialCode.Size = new System.Drawing.Size(327, 40);
this.txtMaterialCode.TabIndex = 25;
//
// label2
// label4
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(70, 87);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(53, 18);
this.label2.TabIndex = 20;
this.label2.Text = "条码:";
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold);
this.label4.Location = new System.Drawing.Point(37, 22);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(149, 29);
this.label4.TabIndex = 19;
this.label4.Text = "计划编码:";
//
// txtPlanId
//
this.txtPlanId.Font = new System.Drawing.Font("宋体", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.txtPlanId.Location = new System.Drawing.Point(190, 17);
this.txtPlanId.Margin = new System.Windows.Forms.Padding(4);
this.txtPlanId.Name = "txtPlanId";
this.txtPlanId.Size = new System.Drawing.Size(327, 40);
this.txtPlanId.TabIndex = 25;
//
// FrmNewMaterial
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(380, 257);
this.ClientSize = new System.Drawing.Size(553, 381);
this.Controls.Add(this.cmbMaterial);
this.Controls.Add(this.txtPlanId);
this.Controls.Add(this.txtMaterialCode);
this.Controls.Add(this.txtSetWeight);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.label2);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label1);
this.Controls.Add(this.txtMaterialCode);
this.Controls.Add(this.txtSetWeight);
this.Name = "FrmNewMaterial";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "物料信息";
@ -143,10 +195,12 @@
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox cmbMaterial;
private System.Windows.Forms.TextBox txtSetWeight;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtMaterialCode;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox txtSetWeight;
private System.Windows.Forms.ComboBox cmbMaterial;
private System.Windows.Forms.TextBox txtMaterialCode;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox txtPlanId;
}
}

@ -1,5 +1,7 @@
using ICSharpCode.Core;
using Mesnac.Action.ChemicalWeighing.BinManage;
using Mesnac.Action.ChemicalWeighing.Entity;
using Mesnac.Action.ChemicalWeighing.Entity.material;
using System;
using System.Collections;
using System.Collections.Generic;
@ -15,7 +17,7 @@ namespace Mesnac.Action.ChemicalWeighing.Warehouse
{
public partial class FrmNewMaterial : Form
{
private List<Pmt_material> pmt_Materials = new List<Pmt_material>(); //所有物料集合
private List<xl_material> xl_Materials = new List<xl_material>(); //所有物料集合
public ActionType _actionType;
public Hw_WareHouse_Sub _sub = null;
@ -43,10 +45,25 @@ namespace Mesnac.Action.ChemicalWeighing.Warehouse
/// </summary>
public void InitCombox()
{
pmt_Materials = Product.PptPlan.PlanHelper.GetAllPmt_material();
cmbMaterial.DataSource = pmt_Materials;
cmbMaterial.DisplayMember = "Material_name";
cmbMaterial.ValueMember = "ID";
xl_Materials = Product.XlPlan.PlanHelper.GetAllMaterial();
//cmbMaterial.DataSource = pmt_Materials;
//cmbMaterial.DisplayMember = "Material_name";
//cmbMaterial.ValueMember = "ID";
var table = BinHelper.GetBinMaterial();
if (table != null)
{
//以下向下拉列表框中插入“请选择”
DataRow dr = table.NewRow();
dr[0] = "0";
dr[1] = "请选择";
dr[2] = "请选择";
table.Rows.InsertAt(dr, 0);
this.cmbMaterial.DataSource = table;
cmbMaterial.DisplayMember = "MaterialName";
cmbMaterial.ValueMember = "MaterialID";//仓库编码
}
}
private void FrmNewMaterial_Load(object sender, EventArgs e)
@ -70,15 +87,23 @@ namespace Mesnac.Action.ChemicalWeighing.Warehouse
this.txtSetWeight.Text = _sub.SetWeight;
this.Text = "修改物料";
}
this.btnOk.Text = StringParser.Parse(ResourceService.GetString("Mesnac_Dialog_btnOK"));
this.btnCancel.Text = StringParser.Parse(ResourceService.GetString("Mesnac_Dialog_btnCancel"));
}
private void btnOk_Click(object sender, EventArgs e)
{
if (String.IsNullOrEmpty(this.txtPlanId.Text))
{
MessageBox.Show("请输入计划编码!", Mesnac.Basic.LanguageHelper.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
this.txtPlanId.Focus();
return;
}
if (String.IsNullOrEmpty(this.cmbMaterial.Text))
{
MessageBox.Show("请选择物料的名称!", Mesnac.Basic.LanguageHelper.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
this.cmbMaterial.Focus();
return;
}
if (_actionType == ActionType.Add && WarehouseHelper.IsExistsName((string)this.cmbMaterial.SelectedValue, this.cmbMaterial.Text, _sub.MainId))
@ -91,7 +116,8 @@ namespace Mesnac.Action.ChemicalWeighing.Warehouse
MessageBox.Show("选择物料重复!", Mesnac.Basic.LanguageHelper.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
_sub.MaterialID = (string)this.cmbMaterial.SelectedValue;
_sub.PId = this.txtPlanId.Text;
_sub.MaterialID = txtMaterialCode.Text; //(string)this.cmbMaterial.SelectedValue;
_sub.MaterialName = this.cmbMaterial.Text;
_sub.Material_Code = txtMaterialCode.Text;
_sub.SetWeight = this.txtSetWeight.Text;
@ -102,14 +128,41 @@ namespace Mesnac.Action.ChemicalWeighing.Warehouse
public void SetComboBoxSelected(ComboBox comboBox, Pmt_material key)
{
for (int i = 0; i < comboBox.Items.Count; i++)
//for (int i = 0; i < comboBox.Items.Count; i++)
//{
// dynamic obj = comboBox.Items[i];
// if (obj.ID.ToString() == key.ID)
// {
// string text = obj.Material_name.ToString();
// comboBox.SelectedIndex = comboBox.FindString(text);
// }
//}
var table = BinHelper.GetBinMaterial();
if (table != null)
{
dynamic obj = comboBox.Items[i];
if (obj.ID.ToString() == key.ID)
{
string text = obj.Material_name.ToString();
comboBox.SelectedIndex = comboBox.FindString(text);
}
//以下向下拉列表框中插入“请选择”
DataRow dr = table.NewRow();
dr[0] = "0";
dr[1] = "请选择";
dr[2] = "请选择";
dr[3] = "请选择";
dr[4] = "请选择";
dr[5] = "0";
table.Rows.InsertAt(dr, 0);
this.cmbMaterial.DataSource = table;
cmbMaterial.DisplayMember = "MaterialName";
cmbMaterial.ValueMember = "MaterialID";//仓库编码
}
if (_actionType == ActionType.Modify)
{
cmbMaterial.SelectedValue = key.ID;
}
if (_actionType == ActionType.Add)
{
cmbMaterial.SelectedValue = 0;
}
}
@ -118,20 +171,46 @@ namespace Mesnac.Action.ChemicalWeighing.Warehouse
this.Dispose();
}
private void cmbMaterial_SelectedIndexChanged(object sender, EventArgs e)
private void cmbMaterial_SelectedIndexChanged_1(object sender, EventArgs e)
{
if (_actionType == ActionType.Add)
{
var name = this.cmbMaterial.Text;
txtMaterialCode.Text = pmt_Materials.SingleOrDefault(d => d.Material_name == name).Material_code;
string name = this.cmbMaterial.Text.ToString();
if (string.IsNullOrEmpty(name))
{
txtMaterialCode.Text = "";
return;
}
string id = this.cmbMaterial.SelectedValue.ToString();
if (string.IsNullOrEmpty(id))
{
txtMaterialCode.Text = "";
return;
}
var obj = xl_Materials.SingleOrDefault(d => d.ID.Equals(id));
if (obj == null) return;
txtMaterialCode.Text = obj.Material_code;
}
if (_actionType == ActionType.Modify)
{
var name = this.cmbMaterial.Text;
txtMaterialCode.Text = pmt_Materials.FirstOrDefault(d => d.Material_name == name).Material_code;
string name = this.cmbMaterial.Text.ToString();
if (string.IsNullOrEmpty(name))
{
txtMaterialCode.Text = "";
return;
}
string id = this.cmbMaterial.SelectedValue.ToString();
if (string.IsNullOrEmpty(id))
{
txtMaterialCode.Text = "";
return;
}
var obj = xl_Materials.SingleOrDefault(d => d.ID.Equals(id));
if (obj == null) return;
txtMaterialCode.Text = obj.Material_code;
}
}
}
}

@ -66,22 +66,30 @@ namespace Mesnac.Action.ChemicalWeighing.Warehouse
DbMCControl gridControl = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Hw_Warehouse").FirstOrDefault();
if (gridControl == null || !(gridControl.BaseControl is DataGridView))
{
ICSharpCode.Core.LoggingService<InsertAction>.Error("投料管理—添加物料}缺少物料控件...");
ICSharpCode.Core.LoggingService<InsertAction>.Error("反应釜管理—添加物料}缺少物料控件...");
return;
}
DataGridView subridView = gridControl.BaseControl as DataGridView;
if (subridView.SelectedRows.Count == 1)
{
int selectId = (int)subridView.SelectedRows[0].Cells["ID"].Value;
FrmNewMaterial frmNewMaterial = new FrmNewMaterial(ActionType.Add, selectId);
frmNewMaterial.ShowDialog(this._runtime.BaseControl.MCRoot as Control);
if (frmNewMaterial.DialogResult == DialogResult.OK)
{
var ware = frmNewMaterial._sub;
WarehouseHelper.InsertWareHouseSub(ware);
bool result = WarehouseHelper.InsertWareHouseSub(ware);
if (result)
{
frmNewMaterial.Dispose();
MessageBox.Show("新物料添加成功!");
}
else
{
MessageBox.Show("保存失败!");
}
#region 触发事件
if (OnInsert != null)
@ -90,8 +98,7 @@ namespace Mesnac.Action.ChemicalWeighing.Warehouse
}
#endregion
frmNewMaterial.Dispose();
MessageBox.Show("新物料添加成功!");
}
else
{

@ -7,6 +7,7 @@ using System.Data;
using Mesnac.Codd.Session;
using Mesnac.Action.ChemicalWeighing.Entity;
using System.Windows.Forms;
using Mesnac.Action.ChemicalWeighing.DBHelper;
namespace Mesnac.Action.ChemicalWeighing.Warehouse
{
@ -161,9 +162,9 @@ namespace Mesnac.Action.ChemicalWeighing.Warehouse
throw new Exception(Mesnac.Basic.LanguageHelper.DataBaseConnectError);
}
dbHelper.CommandType = CommandType.Text;
string strSql = "SELECT ID,MaterialID,MaterialName,SetWeight FROM Hw_WareHouse_Sub where MainId=@MainId";
string strSql = "SELECT ID,PId,MaterialID,MaterialName,SetWeight FROM Hw_WareHouse_Sub where MainId=@MainId";
dbHelper.CommandText = strSql;
dbHelper.ClearParameter();
dbHelper.ClearParameter();
dbHelper.AddParameter("@MainId", MId);
DataTable table = dbHelper.ToDataTable();
if (table != null && table.Rows.Count > 0)
@ -245,7 +246,6 @@ namespace Mesnac.Action.ChemicalWeighing.Warehouse
#endregion
#region 判断是否存在条码
/// <summary>
@ -283,10 +283,6 @@ namespace Mesnac.Action.ChemicalWeighing.Warehouse
}
#endregion
/// <summary>
/// 保存物料信息
/// </summary>
@ -294,27 +290,33 @@ namespace Mesnac.Action.ChemicalWeighing.Warehouse
/// <returns></returns>
public static bool InsertWareHouseSub(Hw_WareHouse_Sub sub)
{
DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
if (dbHelper == null)
//DbHelper dbHelper = Mesnac.Basic.DataSourceFactory.Instance.GetDbHelper(Mesnac.Basic.DataSourceFactory.MCDbType.Local);
//if (dbHelper == null)
//{
// throw new Exception(Mesnac.Basic.LanguageHelper.DataBaseConnectError);
//}
//dbHelper.CommandType = CommandType.Text;
//string sqlstr = @"INSERT INTO Hw_WareHouse_Sub(MainId,MaterialID,MaterialName,Material_Code,SetWeight)VALUES(@MainId,@MaterialID,@MaterialName,@Material_Code,@SetWeight)";
//dbHelper.ClearParameter();
//dbHelper.CommandText = sqlstr;
//dbHelper.AddParameter("@ID", sub.ID);
//dbHelper.AddParameter("@MainId", sub.MainId);
//dbHelper.AddParameter("@MaterialID", sub.MaterialID);
//dbHelper.AddParameter("@MaterialName", sub.MaterialName);
//dbHelper.AddParameter("@Material_Code", sub.Material_Code);
//dbHelper.AddParameter("@SetWeight", sub.SetWeight);
//dbHelper.ExecuteNonQuery();
sub.ID = 0;
IFreeSql fsql = FreeHelper.Instance;
var result = fsql.Insert<Hw_WareHouse_Sub>(sub).ExecuteAffrows();
if (result>0)
{
throw new Exception(Mesnac.Basic.LanguageHelper.DataBaseConnectError);
return true;
}
dbHelper.CommandType = CommandType.Text;
string sqlstr = @"INSERT INTO Hw_WareHouse_Sub(MainId,MaterialID,MaterialName,Material_Code,SetWeight)VALUES(@MainId,@MaterialID,@MaterialName,@Material_Code,@SetWeight)";
dbHelper.ClearParameter();
dbHelper.CommandText = sqlstr;
dbHelper.AddParameter("@ID", sub.ID);
dbHelper.AddParameter("@MainId", sub.MainId);
dbHelper.AddParameter("@MaterialID", sub.MaterialID);
dbHelper.AddParameter("@MaterialName", sub.MaterialName);
dbHelper.AddParameter("@Material_Code", sub.Material_Code);
dbHelper.AddParameter("@SetWeight", sub.SetWeight);
dbHelper.ExecuteNonQuery();
return true;
return false;
}
/// <summary>

@ -28,12 +28,11 @@
<Property name="DbOptionType">Query</Property>
<Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property>
<Property name="AutoGenerateColumns">False</Property>
<Property name="MultiSelect">False</Property>
<Property name="Dock">Fill</Property>
<Property name="Location">3, 25</Property>
<Property name="Name">MCDataGridView1</Property>
<Property name="Size">636, 633</Property>
<Property name="Size">523, 633</Property>
<Property name="TabIndex">3</Property>
</Object>
<Property name="TabStop">False</Property>
@ -42,20 +41,20 @@
<Property name="Font">宋体, 14.25pt</Property>
<Property name="Location">0, 0</Property>
<Property name="Name">GroupBox1</Property>
<Property name="Size">642, 661</Property>
<Property name="TabIndex">9</Property>
<Property name="Size">529, 661</Property>
<Property name="TabIndex">11</Property>
</Object>
<Property name="Dock">Fill</Property>
<Property name="Location">0, 0</Property>
<Property name="Name">Panel4</Property>
<Property name="Size">642, 661</Property>
<Property name="Size">529, 661</Property>
</Object>
<Object type="System.Windows.Forms.Panel, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="Panel3" children="Controls">
<Object type="System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" name="GroupBox2" children="Controls">
<Object type="Mesnac.Controls.Default.MCDataGridView, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="MCDataGridView2" children="Controls">
<Property name="DisplayAllColumn">False</Property>
<Property name="DgvColumn">
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJoBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EYXRhR3JpZFZpZXdDb2x1bW5zLCBNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGxdXQMAAAAGX2l0ZW1zBV9zaXplCF92ZXJzaW9uBAAAKk1lc25hYy5Db250cm9scy5CYXNlLkRhdGFHcmlkVmlld0NvbHVtbnNbXQIAAAAICAkDAAAABAAAAD8AAAAHAwAAAAABAAAABAAAAAQoTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGF0YUdyaWRWaWV3Q29sdW1ucwIAAAAJBAAAAAkFAAAACQYAAAAJBwAAAAUEAAAAKE1lc25hYy5Db250cm9scy5CYXNlLkRhdGFHcmlkVmlld0NvbHVtbnMCAAAACl9maWxlZERhdGEMX2Rpc3BsYXlOYW1lAQECAAAABggAAAACSUQGCQAAAAbluo/lj7cBBQAAAAQAAAAGCgAAAAxNYXRlcmlhbE5hbWUGCwAAAAznianmlpnlkI3np7ABBgAAAAQAAAAGDAAAAApNYXRlcmlhbElEBg0AAAAM54mp5paZ57yW56CBAQcAAAAEAAAABg4AAAAJU2V0V2VpZ2h0Bg8AAAAM54mp5paZ6YeN6YePCw==</Binary>
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJoBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EYXRhR3JpZFZpZXdDb2x1bW5zLCBNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGxdXQMAAAAGX2l0ZW1zBV9zaXplCF92ZXJzaW9uBAAAKk1lc25hYy5Db250cm9scy5CYXNlLkRhdGFHcmlkVmlld0NvbHVtbnNbXQIAAAAICAkDAAAABAAAAFYAAAAHAwAAAAABAAAACAAAAAQoTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGF0YUdyaWRWaWV3Q29sdW1ucwIAAAAJBAAAAAkFAAAACQYAAAAJBwAAAA0EBQQAAAAoTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGF0YUdyaWRWaWV3Q29sdW1ucwIAAAAKX2ZpbGVkRGF0YQxfZGlzcGxheU5hbWUBAQIAAAAGCAAAAANQSWQGCQAAAAzorqHliJLnvJbnoIEBBQAAAAQAAAAGCgAAAAxNYXRlcmlhbE5hbWUGCwAAAAznianmlpnlkI3np7ABBgAAAAQAAAAGDAAAAApNYXRlcmlhbElEBg0AAAAM54mp5paZ57yW56CBAQcAAAAEAAAABg4AAAAJU2V0V2VpZ2h0Bg8AAAAM54mp5paZ6YeN6YePCw==</Binary>
</Property>
<Property name="ClickActionList">
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAAAAAAAAAAABwMAAAAAAQAAAAAAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAL</Binary>
@ -77,12 +76,11 @@
<Property name="DbOptionType">None</Property>
<Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property>
<Property name="AutoGenerateColumns">False</Property>
<Property name="MultiSelect">False</Property>
<Property name="Dock">Fill</Property>
<Property name="Location">3, 25</Property>
<Property name="Name">MCDataGridView2</Property>
<Property name="Size">434, 633</Property>
<Property name="Size">547, 633</Property>
<Property name="TabIndex">4</Property>
</Object>
<Property name="TabStop">False</Property>
@ -91,13 +89,13 @@
<Property name="Font">宋体, 14.25pt</Property>
<Property name="Location">0, 0</Property>
<Property name="Name">GroupBox2</Property>
<Property name="Size">440, 661</Property>
<Property name="Size">553, 661</Property>
<Property name="TabIndex">8</Property>
</Object>
<Property name="Dock">Right</Property>
<Property name="Location">642, 0</Property>
<Property name="Location">529, 0</Property>
<Property name="Name">Panel3</Property>
<Property name="Size">440, 661</Property>
<Property name="Size">553, 661</Property>
</Object>
<Property name="Dock">Fill</Property>
<Property name="Location">0, 40</Property>
@ -125,11 +123,36 @@
<Property name="OldFillColor">DarkGray</Property>
<Property name="Text">导入物料</Property>
<Property name="Font">宋体, 14.25pt</Property>
<Property name="Location">325, 5</Property>
<Property name="Location">423, 5</Property>
<Property name="Name">MCButton7</Property>
<Property name="Size">100, 30</Property>
<Property name="TabIndex">15</Property>
</Object>
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="MCButton3" children="Controls">
<Property name="ClickActionList">
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAEAAAAOAAAABwMAAAAAAQAAAAQAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAJBAAAAA0DBQQAAAAhTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uAwAAABU8R1VJRD5rX19CYWNraW5nRmllbGQVPE5hbWU+a19fQmFja2luZ0ZpZWxkFzxSZW1hcms+a19fQmFja2luZ0ZpZWxkAQEBAgAAAAYFAAAAIDZBM0E5N0M5NzNGNEU0OEFCNzdCOTkwQUIwQTQ2RUUzBgYAAAAG5re75YqgBgcAAAAG5re75YqgCw==</Binary>
</Property>
<Property name="MCKey" />
<Property name="MCDataSourceID" />
<Property name="IsDbControl">False</Property>
<Property name="InitDataSource" />
<Property name="ActionDataSource" />
<Property name="BindDataSource" />
<Property name="DbOptionType">None</Property>
<Property name="MCVisible">True</Property>
<Property name="MCEnabled">True</Property>
<Property name="MCPurview">False</Property>
<Property name="Format" />
<Property name="TextName" />
<Property name="NewFillColor">Red</Property>
<Property name="OldFillColor">DarkGray</Property>
<Property name="Text">新增物料</Property>
<Property name="Font">宋体, 14.25pt</Property>
<Property name="Location">126, 5</Property>
<Property name="Name">MCButton3</Property>
<Property name="Size">100, 30</Property>
<Property name="TabIndex">15</Property>
</Object>
<Object type="Mesnac.Controls.Default.MCButton, Mesnac.Controls.Default, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" name="MCButton5" children="Controls">
<Property name="ClickActionList">
<Binary>AAEAAAD/////AQAAAAAAAAAMAgAAAEtNZXNuYWMuQ29udHJvbHMuQmFzZSwgVmVyc2lvbj0xLjAuMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPW51bGwEAQAAAJMBU3lzdGVtLkNvbGxlY3Rpb25zLkdlbmVyaWMuTGlzdGAxW1tNZXNuYWMuQ29udHJvbHMuQmFzZS5EZXNpZ25BY3Rpb24sIE1lc25hYy5Db250cm9scy5CYXNlLCBWZXJzaW9uPTEuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49bnVsbF1dAwAAAAZfaXRlbXMFX3NpemUIX3ZlcnNpb24EAAAjTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uW10CAAAACAgJAwAAAAEAAAAMAAAABwMAAAAAAQAAAAQAAAAEIU1lc25hYy5Db250cm9scy5CYXNlLkRlc2lnbkFjdGlvbgIAAAAJBAAAAA0DBQQAAAAhTWVzbmFjLkNvbnRyb2xzLkJhc2UuRGVzaWduQWN0aW9uAwAAABU8R1VJRD5rX19CYWNraW5nRmllbGQVPE5hbWU+a19fQmFja2luZ0ZpZWxkFzxSZW1hcms+a19fQmFja2luZ0ZpZWxkAQEBAgAAAAYFAAAAIEZCMzc1MkMwNDg0OEM3QkY1M0UzRTIzMDUxOUM4RTNFBgYAAAAG5Yi35pawBgcAAAAG5Yi35pawCw==</Binary>
@ -150,7 +173,7 @@
<Property name="OldFillColor">DarkGray</Property>
<Property name="Text">刷新</Property>
<Property name="Font">宋体, 14.25pt</Property>
<Property name="Location">224, 5</Property>
<Property name="Location">324, 5</Property>
<Property name="Name">MCButton5</Property>
<Property name="Size">100, 30</Property>
<Property name="TabIndex">15</Property>
@ -176,7 +199,7 @@
<Property name="BackColor">Transparent</Property>
<Property name="Text">删除</Property>
<Property name="Font">宋体, 14.25pt</Property>
<Property name="Location">126, 5</Property>
<Property name="Location">225, 5</Property>
<Property name="Name">MCButton4</Property>
<Property name="Size">100, 30</Property>
<Property name="TabIndex">12</Property>

Loading…
Cancel
Save