You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
120 lines
4.6 KiB
120 lines
4.6 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using Microsoft.VisualBasic;
|
|
using DBFactory;
|
|
namespace SystemConfig
|
|
{
|
|
/// <summary>
|
|
/// Creator:Richard.liu
|
|
/// ϵͳ³õʼ»¯
|
|
/// </summary>
|
|
public partial class FrmSTCellInit : Form
|
|
{
|
|
DBOperator dbo = CStaticClass.dbo;
|
|
private static FrmSTCellInit _formInstance;
|
|
|
|
public static FrmSTCellInit FormInstance
|
|
{
|
|
get
|
|
{
|
|
if (_formInstance == null)
|
|
{
|
|
_formInstance = new FrmSTCellInit();
|
|
}
|
|
return _formInstance;
|
|
}
|
|
set { _formInstance = value; }
|
|
}
|
|
public FrmSTCellInit()
|
|
{
|
|
InitializeComponent();
|
|
_formInstance = this;
|
|
}
|
|
|
|
private void FrmSystemInit_Load(object sender, EventArgs e)
|
|
{
|
|
DataTable tableWareHouse = dbo.ExceSQL("SELECT distinct F_WarehouseIndex,F_Description FROM T_WAREHOUSE").Tables[0];
|
|
cmbWareHouse.DisplayMember = "F_Description";
|
|
cmbWareHouse.ValueMember = "F_WarehouseIndex";
|
|
|
|
cmbWareHouse.DataSource = tableWareHouse.DefaultView;
|
|
|
|
DataTable laneway = dbo.ExceSQL("SELECT distinct F_LaneDeviceIndex,F_StackIndex FROM T_Base_LaneInfo").Tables[0];
|
|
this.cbLaneway.DisplayMember = "F_LaneDeviceIndex";
|
|
cbLaneway.ValueMember = "F_StackIndex";
|
|
|
|
cbLaneway.DataSource = laneway.DefaultView;
|
|
}
|
|
|
|
private void button4_Click(object sender, EventArgs e)
|
|
{
|
|
if (MessageBox.Show("ÄúÈ·ÈÏÒªÉú³É»õλÐÅÏ¢Âð£¿", "²Ù×÷Ìáʾ£º", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
|
|
{
|
|
return;
|
|
}
|
|
if (this.cmbWareHouse.SelectedValue == null)
|
|
{
|
|
MessageBox.Show("¿â·¿Ë÷Òý²»ÄÜÊÇ¿ÕÖµ£¡", "Îó²Ù×÷Ìáʾ£º", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
cmbWareHouse.Focus();
|
|
return;
|
|
}
|
|
if (Information.IsNumeric(this.cbLaneway.SelectedValue ) == false)
|
|
{
|
|
MessageBox.Show("ÏïµÀÉ豸Ë÷ÒýÖ»ÄÜÊÇÊý×ÖÀàÐÍ£¡", "Îó²Ù×÷Ìáʾ£º", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
this.cbLaneway.Focus();
|
|
return;
|
|
}
|
|
string sql = string.Empty;
|
|
string warehouse = this.cmbWareHouse.SelectedValue.ToString();
|
|
int laneway =Convert.ToInt32( this.cbLaneway.Text);
|
|
int stackindex =Convert.ToInt32(lblStackIndex.Text);
|
|
int Z =Convert.ToInt32( nudZ.Value);
|
|
int Z1 = Convert.ToInt32(nudZ1.Value);
|
|
int X = Convert.ToInt32(nudX.Value);
|
|
int Y = Convert.ToInt32(nudY.Value);
|
|
|
|
int fid = 0;string cellcode=string.Empty;string cellname=string.Empty;
|
|
for (int z = Z; z <= Z1; z++)
|
|
{
|
|
for (int x = 1; x <= X; x++)
|
|
{
|
|
for (int y = 1; y <= Y; y++)
|
|
{
|
|
cellcode = (z.ToString().Length == 1 ? "0" + z.ToString() : z.ToString())
|
|
+ "-" + (x.ToString().Length == 1 ? "0" + x.ToString() : x.ToString()) + "-" + (y.ToString().Length == 1 ? "0" + y.ToString() : y.ToString());
|
|
sql = "SELECT FID FROM ST_CELL WHERE (FWAREHOUSE = '"+warehouse+"') AND (FLaneWay = "+laneway +") AND (FCELLCODE = '"+cellcode+"')";
|
|
if (dbo.Exists(sql) == false)
|
|
{
|
|
cellname = z.ToString() + "ÅÅ" + x.ToString() + "ÁÐ" + y.ToString() + "²ã";
|
|
fid = dbo.GetMaxID("FID", "ST_CELL");
|
|
sql = "INSERT INTO ST_CELL(FID, FWAREHOUSE, FLaneWay, FCELLCODE, F_Z, F_X, F_Y, " +
|
|
"FCELLNAME,FCELLSTATUS, FRUNSTATUS, FPALLETBARCODE, FStack)VALUES " +
|
|
"(" + fid + ",'" + warehouse + "'," + laneway + ",'" + cellcode + "'," + z + "," + x + "," + y + ",'" + cellname +
|
|
"',0,0,'-'," + stackindex + ")";
|
|
dbo.ExecuteSql(sql);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
private void cbLaneway_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
lblStackIndex.Text = this.cbLaneway.SelectedValue.ToString();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|