using sunui.forms;
|
using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using System.Windows.Forms;
|
using WMS.EnumDefine;
|
using WMS.Model;
|
using WMS.UI.SynthesizeQuery;
|
using WMS.Untils;
|
using WMS.yunneiWCS;
|
|
namespace WMS.UI.WORK
|
{
|
public partial class inStockCode : Form
|
{
|
WMS.yunneiWCS.v_inStockOrder param = new yunneiWCS.v_inStockOrder();
|
BindingSource bs = new BindingSource();
|
string materialName = "";
|
string materialCode = "";
|
int orderStatus = 0;
|
int pagaSize = 20;//
|
paging paga = new paging();
|
public inStockCode()
|
{
|
InitializeComponent();
|
this.dataGridView1.AutoGenerateColumns = false;
|
}
|
|
private void inStockCode_Load(object sender, EventArgs e)
|
{
|
try
|
{
|
this.toolStripComboBox1.SelectedIndex = 1;
|
|
LoadSelectData();
|
//每页10条
|
//每页20条
|
//每页30条
|
//每页100条
|
btnReset_Click(null, null);
|
this.dataGridView1.ReadOnly = true;
|
this.dataGridView1.Columns["createDate"].DefaultCellStyle.Format = "yyyy-MM-dd HH:mm:ss";
|
FormHelper.DataGridViewSelfAdaptionWidth(this.dataGridView1);
|
}
|
catch (Exception ex)
|
{
|
WZ.Useful.Commons.LogTextHelper.WriteLine("AddUser", "btnSave_Click", ex.ToString());
|
|
}
|
}
|
|
/// <summary>
|
/// 加载下拉数据
|
/// </summary>
|
private void LoadSelectData()
|
{
|
var fr = FLogin.wcsWcf.GetSelectList("version");
|
var versionList = fr.resData;
|
this.uiComboBox_version.Items.Clear();
|
this.uiComboBox_version.Items.AddRange(versionList);
|
|
//物料编码
|
var fr_materialCode = FLogin.wcsWcf.GetSelectList("materialCode");
|
var materialCodeList = fr_materialCode.resData;
|
this.uiComboBox_materialCode.Items.Clear();
|
this.uiComboBox_materialCode.Items.AddRange(materialCodeList);
|
|
//物料名称
|
var fr_materialName = FLogin.wcsWcf.GetSelectList("materialName");
|
var materialNameList = fr_materialName.resData;
|
this.uiComboBox_materialName.Items.Clear();
|
this.uiComboBox_materialName.Items.AddRange(materialNameList);
|
|
IList<SelectItem> infoList = new List<SelectItem>();
|
SelectItem info1 = new SelectItem() { Id = "0", Name = "不筛选任务状态" };
|
SelectItem info2 = new SelectItem() { Id = "1", Name = "新建" };
|
SelectItem info3 = new SelectItem() { Id = "2", Name = "未下发" };
|
SelectItem info4 = new SelectItem() { Id = "3", Name = "已下发" };
|
SelectItem info5 = new SelectItem() { Id = "4", Name = "完成" };
|
SelectItem info6 = new SelectItem() { Id = "5", Name = "已作废" };
|
infoList.Add(info1);
|
infoList.Add(info2);
|
infoList.Add(info3);
|
infoList.Add(info4);
|
infoList.Add(info5);
|
infoList.Add(info6);
|
|
uiComboBox_status.ValueMember = "Id";
|
uiComboBox_status.DisplayMember = "Name";
|
uiComboBox_status.DataSource = infoList;
|
}
|
|
/// <summary>数据查找
|
///
|
/// </summary>
|
/// <param name="paga">分页</param>
|
/// <param name="name">物料名称</param>
|
/// <param name="code">物料编号</param>
|
/// <param name="status">入库单状态</param>
|
private void findData()
|
{
|
try
|
{
|
#region 判断有没有输入筛选条件 uiTextBox_positionName
|
//param.positionName = uiTextBox_positionName.Text.Trim() != "" ? uiTextBox_positionName.Text.Trim() : "";//库位名称
|
param.sourcePlace = uiTextBox_sourcePlace.Text.Trim() != "" ? uiTextBox_sourcePlace.Text.Trim() : "";//起点
|
param.toPlace = uiTextBox_toPlace.Text.Trim() != "" ? uiTextBox_toPlace.Text.Trim() : "";//目标点
|
param.productName = uiComboBox_materialName.Text.Trim() != "" ? uiComboBox_materialName.Text.Trim() : "";//物料名称
|
param.productCode = uiComboBox_materialCode.Text.Trim() != "" ? uiComboBox_materialCode.Text.Trim() : "";//物料编码
|
param.containerCode = uiTextBox_containerCode.Text.Trim() != "" ? uiTextBox_containerCode.Text.Trim() : "";//托盘号
|
param.version = uiComboBox_version.Text.Trim() != "" ? uiComboBox_version.Text.Trim() : "";//机型
|
param.supplier = uiTextBox_supplier.Text.Trim() != "" ? uiTextBox_supplier.Text.Trim() : "";//供应商
|
param.status = Convert.ToByte(uiComboBox_status.SelectedIndex);
|
#endregion
|
|
//时间
|
paga.startDateTime = string.IsNullOrEmpty(uiDatetimePicker_start.Text) ? new DateTime() : Convert.ToDateTime(uiDatetimePicker_start.Text);
|
paga.endDateTime = string.IsNullOrEmpty(uiDatetimePicker_end.Text) ? new DateTime() : Convert.ToDateTime(uiDatetimePicker_end.Text);
|
|
//var res = FLogin.wcsWcf.findInStock(paga, materialName, materialCode, orderStatus);
|
var res = FLogin.wcsWcf.findInStockNewVersion(paga, param);
|
if (res.status == 200)
|
{
|
this.dataGridView1.DataSource = res.date;
|
this.toolStripLabel5.Text = "/" + res.total;
|
if (res.total == 1)
|
{
|
toolStripLabel2.Enabled = false;
|
toolStripTextBox1.Enabled = false;
|
toolStripLabel1.Enabled = false;
|
toolStripLabel4.Enabled = false;
|
toolStripLabel3.Enabled = false;
|
}
|
else
|
{
|
toolStripLabel3.Enabled = true;
|
toolStripLabel2.Enabled = true;
|
toolStripTextBox1.Enabled = true;
|
toolStripLabel4.Enabled = paga.pagenum == 1 ? false : true;
|
}
|
|
}
|
else
|
{
|
this.dataGridView1.DataSource = new List<WMS.yunneiWCS.v_inStockOrder>();
|
MessageBox.Show("获取失败");
|
}
|
}
|
catch (Exception)
|
{
|
|
}
|
|
}
|
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
{
|
if (this.dataGridView1.DataSource != null)
|
{
|
DataGridView dgv = (DataGridView)sender;
|
if (dgv.Columns[e.ColumnIndex].Name == "status")
|
{
|
e.Value = Enum.GetName(typeof(codeStatus), Convert.ToInt32(e.Value));
|
// 应用该Format,Format完毕。
|
e.FormattingApplied = true;
|
}
|
}
|
|
}
|
|
private void btnFind_Click(object sender, EventArgs e)
|
{
|
//materialName = uiComboBox_materialName.Text.Trim();
|
//materialCode = uiComboBox_materialCode.Text.Trim();
|
orderStatus = (int)uiComboBox_status.SelectedIndex;
|
paga.pagenum = 1;
|
paga.pagesize = pagaSize;
|
findData();
|
toolStripTextBox1.Text = "1";
|
toolStripLabel1.Enabled = false;//上一页
|
toolStripLabel4.Enabled = false;//第一页
|
toolStripLabel2.Enabled = true;//下一页
|
toolStripLabel3.Enabled = true;//最后一页
|
|
}
|
|
private void btnReset_Click(object sender, EventArgs e)
|
{
|
|
this.uiTextBox_sourcePlace.Text = "";
|
this.uiTextBox_toPlace.Text = "";
|
this.uiTextBox_supplier.Text = "";
|
this.uiComboBox_version.Text = "";
|
this.uiTextBox_containerCode.Text = "";
|
|
//uiDatetimePicker_start.Value = startDateTime;
|
//uiDatetimePicker_end.Value = endDateTime;
|
materialName = uiComboBox_materialName.Text = "";
|
materialCode = uiComboBox_materialCode.Text = "";
|
orderStatus = uiComboBox_status.SelectedIndex = 0;
|
//paga.endDateTime = new DateTime();
|
//paga.startDateTime = new DateTime();
|
//uiDatetimePicker_end.Text = "截止日期";
|
//uiDatetimePicker_start.Text = "起始日期";
|
uiDatetimePicker_start.Text = DateTimeHelper.ConvertToString(DateTime.Now.AddDays(-30));
|
uiDatetimePicker_end.Text = DateTimeHelper.ConvertToString(DateTime.Now.AddDays(1));
|
|
paga.pagenum = 1;
|
paga.pagesize = pagaSize;
|
findData();
|
}
|
/// <summary>第几页回车
|
///
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void toolStripTextBox1_KeyDown(object sender, KeyEventArgs e)
|
{
|
try
|
{
|
if (e.KeyCode == Keys.Enter)
|
{
|
int numPapg = 0;
|
int.TryParse(toolStripTextBox1.Text.Trim(), out numPapg);
|
int sizetatol = 0;
|
int a = this.toolStripLabel5.Text.Trim().Length;
|
string size = this.toolStripLabel5.Text.Trim().Substring(1, a - 1);
|
int.TryParse(size, out sizetatol);
|
|
if (numPapg > 0 && numPapg <= sizetatol)
|
{
|
|
|
paga.pagenum = numPapg;
|
paga.pagesize = pagaSize;
|
findData();
|
|
}
|
else
|
{
|
toolStripTextBox1.Text = "1";
|
WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(2, "请输入数字,并大于1且不大于总页数");
|
ms.Show();
|
}
|
}
|
}
|
catch (Exception)
|
{
|
|
}
|
}
|
/// <summary>第一页
|
///
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void toolStripLabel4_Click(object sender, EventArgs e)
|
{
|
try
|
{
|
|
paga.pagenum = 1;
|
paga.pagesize = pagaSize;
|
findData();
|
toolStripLabel4.Enabled = false;
|
toolStripLabel3.Enabled = true;
|
toolStripTextBox1.Text = "1";
|
toolStripTextBox1.Enabled = true;
|
toolStripLabel1.Enabled = false;
|
toolStripLabel2.Enabled = true;
|
}
|
catch (Exception)
|
{
|
}
|
}
|
/// <summary>上一页
|
///
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void toolStripLabel1_Click(object sender, EventArgs e)
|
{
|
try
|
{
|
|
int numPapg = 0;
|
int.TryParse(toolStripTextBox1.Text.Trim(), out numPapg);
|
numPapg--;
|
toolStripTextBox1.Text = numPapg.ToString();
|
int sizetatol = 0;
|
int a = this.toolStripLabel5.Text.Trim().Length;
|
string size = this.toolStripLabel5.Text.Trim().Substring(1, a - 1);
|
int.TryParse(size, out sizetatol);
|
|
if (numPapg <= sizetatol)
|
{
|
|
|
paga.pagenum = numPapg;
|
paga.pagesize = pagaSize;
|
findData();
|
toolStripLabel2.Enabled = true;
|
toolStripLabel3.Enabled = true;
|
if (numPapg == 1)
|
{
|
toolStripLabel1.Enabled = false;
|
}
|
}
|
else
|
{
|
toolStripTextBox1.Text = "1";
|
WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(2, "请输入数字,并大于1且不大于总页数");
|
ms.Show();
|
}
|
|
}
|
catch (Exception)
|
{
|
|
}
|
}
|
/// <summary>下一页
|
///
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void toolStripLabel2_Click(object sender, EventArgs e)
|
{
|
try
|
{
|
|
int numPapg = 0;
|
int.TryParse(toolStripTextBox1.Text.Trim(), out numPapg);
|
numPapg++;
|
this.toolStripTextBox1.Text = numPapg.ToString();
|
int sizetatol = 0;
|
int a = this.toolStripLabel5.Text.Trim().Length;
|
string size = this.toolStripLabel5.Text.Trim().Substring(1, a - 1);
|
int.TryParse(size, out sizetatol);
|
toolStripLabel4.Enabled = true;
|
if (numPapg <= sizetatol)
|
{
|
|
paga.pagenum = numPapg;
|
paga.pagesize = pagaSize;
|
findData();
|
toolStripLabel1.Enabled = true;
|
if (numPapg == sizetatol)
|
{
|
toolStripLabel2.Enabled = false;
|
toolStripLabel3.Enabled = false;
|
}
|
}
|
else
|
{
|
toolStripTextBox1.Text = "1";
|
WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(2, "请输入数字,并大于1且不大于总页数");
|
ms.Show();
|
}
|
|
}
|
catch (Exception)
|
{
|
|
}
|
}
|
/// <summary>最后一页
|
///
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void toolStripLabel3_Click(object sender, EventArgs e)
|
{
|
|
try
|
{
|
int sizetatol = 0;
|
int a = this.toolStripLabel5.Text.Trim().Length;
|
string size = this.toolStripLabel5.Text.Trim().Substring(1, a - 1);
|
int.TryParse(size, out sizetatol);
|
|
paga.pagenum = sizetatol;
|
paga.pagesize = pagaSize;
|
findData();
|
toolStripLabel3.Enabled = false;
|
toolStripLabel4.Enabled = true;
|
toolStripTextBox1.Text = sizetatol.ToString();
|
toolStripTextBox1.Enabled = true;
|
toolStripLabel1.Enabled = true;
|
toolStripLabel2.Enabled = false;
|
|
}
|
catch (Exception)
|
{
|
|
}
|
}
|
/// <summary>每页数量改变
|
///
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void toolStripComboBox1_SelectedIndexChanged(object sender, EventArgs e)
|
{
|
try
|
{
|
pagaSize = (toolStripComboBox1.SelectedIndex + 1) * 10;
|
|
paga.pagenum = 1;
|
paga.pagesize = pagaSize;
|
findData();
|
toolStripTextBox1.Text = "1";
|
}
|
catch (Exception)
|
{
|
|
}
|
}
|
|
/// <summary>增加序号
|
///
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
|
{
|
SolidBrush b = new SolidBrush(this.dataGridView1.RowHeadersDefaultCellStyle.ForeColor);
|
e.Graphics.DrawString((e.RowIndex + 1).ToString(System.Globalization.CultureInfo.CurrentUICulture), this.dataGridView1.DefaultCellStyle.Font, b, e.RowBounds.Location.X + 20, e.RowBounds.Location.Y + 4);
|
|
}
|
/// <summary>编辑和删除
|
///
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
|
{
|
try
|
{
|
if (dataGridView1.Columns[e.ColumnIndex].Name == "edit")
|
{
|
int i = dataGridView1.CurrentRow.Index;
|
string codeName = dataGridView1.Rows[i].Cells["orderCode"].Value.ToString();
|
FrmPVClist listView = new FrmPVClist(codeName, 2, 0);
|
listView.ShowDialog();
|
}
|
if (dataGridView1.Columns[e.ColumnIndex].Name == "delete")
|
{
|
int i = dataGridView1.CurrentRow.Index;
|
string codeName = dataGridView1.Rows[i].Cells["orderCode"].Value.ToString();
|
DialogResult dr = MessageBox.Show("确认要作废此单吗", "入库单作废", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
|
if (dr == DialogResult.OK)
|
{
|
var res = FLogin.wcsWcf.deleteInStock(codeName);
|
int statu = res.status == 200 ? 1 : 2;
|
WMS.EnumDefine.messages ms = new WMS.EnumDefine.messages(statu, res.msg);
|
ms.Show();
|
int numPapg = 0;
|
int.TryParse(toolStripTextBox1.Text.Trim(), out numPapg);
|
paga.pagenum = numPapg == 0 ? 1 : numPapg;
|
paga.pagesize = pagaSize;
|
findData();
|
}
|
|
}
|
}
|
catch (Exception ex)
|
{
|
|
}
|
}
|
|
private void uiDatetimePicker_start_ValueChanged(object sender, DateTime value)
|
{
|
|
}
|
|
private void uiDatetimePicker_end_ValueChanged(object sender, DateTime value)
|
{
|
|
}
|
}
|
}
|