You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
187 lines
5.6 KiB
C#
187 lines
5.6 KiB
C#
using Mesnac.Action.Base;
|
|
using Mesnac.Controls.Base;
|
|
using Mesnac.Controls.Default;
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
using System.Data;
|
|
using System.Linq;
|
|
using Mesnac.Action.ChemicalWeighing.FreeDb;
|
|
|
|
namespace Mesnac.Action.ChemicalWeighing.Su
|
|
{
|
|
public class SuSongInit: ChemicalWeighingAction, IAction
|
|
{
|
|
|
|
|
|
|
|
MCDateTimePicker startDate;
|
|
MCDateTimePicker startTime;
|
|
MCDateTimePicker endDate;
|
|
MCDateTimePicker endTime;
|
|
|
|
MCButton SelectButton;
|
|
|
|
MCDataGridView MoreData;
|
|
|
|
MCCombobox mCCombobox;
|
|
|
|
public void Run(RuntimeParameter runtime)
|
|
{
|
|
base.RunIni(runtime); //必须要调用的
|
|
|
|
var control = GetAllControls();
|
|
startDate = control.FirstOrDefault(x => x.Name == "startDate") as MCDateTimePicker;
|
|
startTime = control.FirstOrDefault(x => x.Name == "startTime") as MCDateTimePicker;
|
|
endDate = control.FirstOrDefault(x => x.Name == "endDate") as MCDateTimePicker;
|
|
endTime = control.FirstOrDefault(x => x.Name == "endTime") as MCDateTimePicker;
|
|
SelectButton = control.FirstOrDefault(x => x.Name == "WhiteWork") as MCButton;
|
|
|
|
SelectButton.Click += SelectButton_Click; ;
|
|
|
|
MoreData = control.FirstOrDefault(x => x.Name == "MoreData") as MCDataGridView;
|
|
|
|
MoreData.AutoGenerateColumns = true;
|
|
|
|
startTime.MCValue = DateTime.Now.AddHours(-5);
|
|
|
|
|
|
mCCombobox = control.FirstOrDefault(x => x.Name == "MCCombobox1") as MCCombobox;
|
|
DataTable dataTable = new DataTable();
|
|
|
|
dataTable.Columns.Add("CmbValue", typeof(string));
|
|
dataTable.Columns.Add("CmbDisplay", typeof(string));
|
|
|
|
|
|
var dr = dataTable.NewRow();
|
|
dr[0] = 1;
|
|
dr[1] = "输送A";
|
|
dataTable.Rows.Add(dr);
|
|
|
|
dr = dataTable.NewRow();
|
|
dr[0] = 2;
|
|
dr[1] = "输送B";
|
|
dataTable.Rows.Add(dr);
|
|
|
|
dr = dataTable.NewRow();
|
|
dr[0] = 3;
|
|
dr[1] = "输送C";
|
|
dataTable.Rows.Add(dr);
|
|
|
|
|
|
mCCombobox.DataSource = dataTable;
|
|
|
|
Sel();
|
|
|
|
}
|
|
|
|
private void SelectButton_Click(object sender, EventArgs e)
|
|
{
|
|
Sel();
|
|
}
|
|
|
|
string[] destinations = new string[] {
|
|
"大仓A(小料1)", "大仓B(碳酸钙)", "大仓C(木粉)", "大仓D(碳粉9)", "大仓E(木薯粉)", "大仓F(玉米粉)", "大仓G(碳粉1)", "大仓H(碳粉2)",
|
|
"大仓I(碳粉3)", "大仓J(碳粉4)", "大仓K(碳粉5)", "大仓L(碳粉6)", "大仓M(碳粉7)", "大仓N(碳粉8)", "大仓O(回收罐)", "大仓P",
|
|
"大仓Q", "大仓R", "大仓S", "大仓T", "大仓U", "大仓V", "大仓W", "大仓X",
|
|
"大仓Y", "大仓Z"
|
|
};
|
|
private void Sel()
|
|
{
|
|
var ssss= DateTime.Now.ToString("HH:mm:ss");
|
|
endTime.MCValue=ssss;
|
|
|
|
var a = Convert.ToDateTime(GetA());
|
|
var b = Convert.ToDateTime(GetB());
|
|
|
|
int ab= Convert.ToInt32(mCCombobox.MCValue);
|
|
|
|
|
|
var list = FreeDb.FreeSqlUnit.Instance.Queryable<SuSong>().Where(x => x.CreateTime > a)
|
|
.Where(x => x.CreateTime < b)
|
|
.Where(x=>x.No==ab)
|
|
.Take(1000).OrderByDescending(x => x.UpdateTime).ToList();
|
|
|
|
|
|
var dt = new DataTable();
|
|
dt.Columns.Add("输送线路", typeof(string));
|
|
dt.Columns.Add("源仓", typeof(string));
|
|
dt.Columns.Add("方式", typeof(string));
|
|
dt.Columns.Add("目标仓", typeof(string));
|
|
dt.Columns.Add("数量", typeof(string));
|
|
dt.Columns.Add("开始时间", typeof(string));
|
|
dt.Columns.Add("更新时间", typeof(string));
|
|
dt.Columns.Add("状态", typeof(string));
|
|
|
|
foreach (var x in list)
|
|
{
|
|
var dr = dt.NewRow();
|
|
|
|
String aa = "";
|
|
if (x.No == 1) aa = "A";
|
|
if (x.No == 2) aa = "B";
|
|
if (x.No == 3) aa = "C";
|
|
|
|
dr[0] = "输送线路"+aa;
|
|
dr[1] = x.Soure;
|
|
|
|
|
|
|
|
dr[2] = x.Model;
|
|
string shu = "";
|
|
if (x.Model == 1)
|
|
{
|
|
shu = "A";
|
|
}
|
|
if (x.Model == 2)
|
|
{
|
|
shu = "B";
|
|
}
|
|
if (x.Model == 3)
|
|
{
|
|
shu = "A+B";
|
|
}
|
|
dr[2] = shu;
|
|
|
|
dr[3] = x.Destination;
|
|
|
|
if (x.Destination >= 0)
|
|
{
|
|
string info = destinations[x.Destination];
|
|
dr[3] = info;
|
|
}
|
|
|
|
|
|
|
|
dr[4] = x.Number;
|
|
dr[5] = Convert.ToDateTime(x.CreateTime).ToString("yyyy-MM-dd HH:mm:ss");
|
|
dr[6] = Convert.ToDateTime(x.UpdateTime).ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
dr[7] = x.Remark;
|
|
|
|
dt.Rows.Add(dr);
|
|
}
|
|
|
|
MoreData.AutoGenerateColumns = true;
|
|
MoreData.DataSource = null;
|
|
MoreData.DataSource = dt;
|
|
|
|
}
|
|
|
|
private string GetA()
|
|
{
|
|
return Convert.ToDateTime(startDate.MCValue).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(startTime.MCValue).ToString("HH:mm:ss");
|
|
}
|
|
|
|
private string GetB()
|
|
{
|
|
return Convert.ToDateTime(endDate.MCValue).AddHours(0).ToString("yyyy-MM-dd") + " " + Convert.ToDateTime(endTime.MCValue).ToString("HH:mm:ss");
|
|
}
|
|
}
|
|
}
|
|
|