51 lines
1.6 KiB
C#
51 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using WPFWCSDemo.StateCode;
|
|
|
|
namespace WPFWCSDemo.Utilities
|
|
{
|
|
/// <summary>
|
|
/// 初始化货位信息表
|
|
/// </summary>
|
|
public class CargoTableInitialize
|
|
{
|
|
/// <summary>
|
|
/// 向库表中添加货位
|
|
/// </summary>
|
|
/// <param name="row">排</param>
|
|
/// <param name="column">列</param>
|
|
/// <param name="floor">层</param>
|
|
public static void CargoSpaceInit(int row, int column, int floor)
|
|
{
|
|
string s = "00";
|
|
|
|
if (MessageBox.Show("此操作会删除货位信息表中所有数据(可能会导致数据丢失),是否继续?","警告",MessageBoxButton.OKCancel)==MessageBoxResult.OK)
|
|
{
|
|
//删除
|
|
SqlHelper.ExecuteNonQuery("TRUNCATE TABLE CARGOSPACE");
|
|
|
|
//生成
|
|
for (int i = 1; i < row; i++)
|
|
{
|
|
for (int j = 1; j < column; j++)
|
|
{
|
|
for (int k = 1; k < floor; k++)
|
|
{
|
|
SqlHelper.ExecuteNonQuery($"INSERT INTO CARGOSPACE VALUES(" +
|
|
$"'{i.ToString(s)}{j.ToString(s)}{k.ToString(s)}','0{i}排{j.ToString(s)}列{k.ToString(s)}层',{null},'1','{i}','{j}','{k}',{null},'1',{DateTime.Now.ToString(TimeFormat.stringFormat)},'')");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|