BaoKai_202508-Wms-Jingwang..../WMS.FrmSC/FormCUX_WMS_ISSUE_HEADER_ITF.cs

383 lines
14 KiB
C#
Raw Permalink Normal View History

2025-08-24 09:35:55 +08:00
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.Business.SC;
using WMS.Business;
using WMS.Frm.Base;
using WMS.Model.SC;
using WMS.Ctrl;
using WMS.Business.Stock;
using DevExpress.Printing.Utils.DocumentStoring;
using DevExpress.XtraPrinting.Export.Pdf;
using WMS.Business.CK;
using WMS.Common;
using WMS.Model.CK;
using DevExpress.XtraLayout.Converter;
namespace WMS.FrmSC
{
public partial class FormCUX_WMS_ISSUE_HEADER_ITF : FormBase
{
public FormCUX_WMS_ISSUE_HEADER_ITF()
{
InitializeComponent();
}
private void FormCUX_WMS_ISSUE_HEADER_ITF_Load(object sender, EventArgs e)
{
//LoadForm load = new LoadForm();
//DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(load, load.GetType(), false, true, false, 50);
//DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormDescription("正在处理数据,请等待....");
dt_Start.DateTime = System.DateTime.Now.AddDays(-3);
dt_End.DateTime = System.DateTime.Now.AddDays(0);
Get_CUX_WMS_ISSUE_HEADER_ITF(System.DateTime.Now.AddDays(-1).ToString(), System.DateTime.Now.ToString());
Get_CUX_WMS_COMPLETE_HEADERS_ITF();
//DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
}
public override void Refresh()
{
Get_CUX_WMS_ISSUE_HEADER_ITF(System.DateTime.Now.AddDays(-1).ToString(), System.DateTime.Now.ToString());
Get_CUX_WMS_COMPLETE_HEADERS_ITF();
}
private void Get_CUX_WMS_ISSUE_HEADER_ITF(string startTime,string endTime)
{
Mod_CUX_WMS_ISSUE_HEADER_ITF model = new Mod_CUX_WMS_ISSUE_HEADER_ITF();
DataTable listOrder = IBussFactory<BussCUX_WMS_ISSUE_HEADER_ITF>.Instance().Get_CUX_WMS_ISSUE_HEADER_ITF(model, startTime,endTime);
if (listOrder != null)
{
//bindingSource1.Clear();
gridControlCustom1.DataSource = listOrder;
}
}
private void Get_CUX_WMS_ISSUE_LINE_ITF (int MAT_REQ_HEADER_ID)
{
Mod_CUX_WMS_ISSUE_LINE_ITF model = new Mod_CUX_WMS_ISSUE_LINE_ITF();
model.MAT_REQ_HEADER_ID = MAT_REQ_HEADER_ID;
List<Mod_CUX_WMS_ISSUE_LINE_ITF> listOrder = IBussFactory<BussCUX_WMS_ISSUE_HEADER_ITF>.Instance().Get_CUX_WMS_ISSUE_LINE_ITF(model);
if (listOrder != null)
{
bindingSource2.Clear();
bindingSource2.DataSource = listOrder;
}
}
private void gridView1_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
{
try
{
if (gridView1.RowCount == 0)
{
return;
}
if (gridView1.FocusedRowHandle < 0)
{
return;
}
string MAT_REQ_HEADER_ID = gridView1.GetFocusedRowCellValue("MAT_REQ_HEADER_ID").ToString();
Get_CUX_WMS_ISSUE_LINE_ITF(int.Parse(MAT_REQ_HEADER_ID));
}
catch (Exception ex) { }
}
private void Get_CUX_WMS_COMPLETE_HEADERS_ITF()
{
Mod_CUX_WMS_COMPLETE_HEADERS_ITF model = new Mod_CUX_WMS_COMPLETE_HEADERS_ITF();
List<Mod_CUX_WMS_COMPLETE_HEADERS_ITF> listOrder = IBussFactory<BussCUX_WMS_ISSUE_HEADER_ITF>.Instance().Get_CUX_WMS_COMPLETE_HEADERS_ITF(model);
if (listOrder != null)
{
bindingSource3.Clear();
bindingSource3.DataSource = listOrder;
}
}
private void Get_CUX_WMS_COMPLETE_LINES_ITF (int MAT_REQ_HEADER_ID)
{
Mod_CUX_WMS_COMPLETE_LINES_ITF model = new Mod_CUX_WMS_COMPLETE_LINES_ITF();
model.MAT_REQ_HEADER_ID= MAT_REQ_HEADER_ID;
List<Mod_CUX_WMS_COMPLETE_LINES_ITF> listOrder = IBussFactory<BussCUX_WMS_ISSUE_HEADER_ITF>.Instance().Get_CUX_WMS_COMPLETE_LINES_ITF(model);
if (listOrder != null)
{
bindingSource4.Clear();
bindingSource4.DataSource = listOrder;
}
}
private void Get_CUX_WMS_COMPLETE_LOT_ITF(int MAT_REQ_HEADER_ID)
{
Mod_CUX_WMS_COMPLETE_LOT_ITF model = new Mod_CUX_WMS_COMPLETE_LOT_ITF();
model.MAT_REQ_HEADER_ID = MAT_REQ_HEADER_ID;
List<Mod_CUX_WMS_COMPLETE_LOT_ITF> listOrder = IBussFactory<BussCUX_WMS_ISSUE_HEADER_ITF>.Instance().Get_CUX_WMS_COMPLETE_LOT_ITF(model);
if (listOrder != null)
{
bindingSource5.Clear();
bindingSource5.DataSource = listOrder;
}
}
private void gridView3_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
{
if (gridView3.RowCount == 0)
{
return;
}
if (gridView3.FocusedRowHandle < 0)
{
return;
}
string MAT_REQ_HEADER_ID = gridView3.GetFocusedRowCellValue("MAT_REQ_HEADER_ID").ToString();
Get_CUX_WMS_COMPLETE_LINES_ITF (int.Parse(MAT_REQ_HEADER_ID));
Get_CUX_WMS_COMPLETE_LOT_ITF(int.Parse(MAT_REQ_HEADER_ID));
}
private void ctrlButtons3_Click(object sender, EventArgs e)
{
DevExpress.Utils.WaitDialogForm loadForm = new DevExpress.Utils.WaitDialogForm("请稍后...", "正在查询数据");
Get_CUX_WMS_ISSUE_HEADER_ITF(dt_Start.DateTime.ToString(), dt_End.DateTime.ToString());
loadForm.Dispose();
loadForm.Close();
}
private void ctrlButtons4_Click(object sender, EventArgs e)
{
if (SystemCommon.ShowMessageBoxResult("确定选择库位:" + this.txtLoction.Text.ToString() + "手动出库吗?") == DialogResult.OK)
{
string tasktype = string.Empty;
if (txtLoction.Text == "")
{
SystemCommon.ShowInfoMessageBox("库位不能为空");
return;
}
if (TXTTASKID.Text == "")
{
SystemCommon.ShowInfoMessageBox("领料单号不能为空");
return;
}
//if (TXTSTS.Text.Trim() != "0")
//{
// SystemCommon.ShowInfoMessageBox("不能出库,库存已经被占用");
// return;
//}
if (this.txtQTY_APPLY.Text == "")
{
SystemCommon.ShowInfoMessageBox("请输入出库数");
return;
}
if (Convert.ToDecimal(this.txtQTY_APPLY.Text.Trim()) > Convert.ToDecimal(this.txtKCNUM.Text.Trim()))
{
SystemCommon.ShowInfoMessageBox("出库数不能大于库存数");
return;
}
//if (this.txtGoodId.Text.Trim() == "00000")
//{
// SystemCommon.ShowInfoMessageBox("不能手动出空托盘");
// return;
//}
//if (this.comboBox1.Text.Trim() == "A1" || this.comboBox1.Text.Trim() == "A4")
//{
// if (SystemCommon.ShowMessageBoxResult("确定选择库位:" + this.txtLocation.Text.ToString() + "零拣出库吗?") == DialogResult.OK)
// {
// if (storid == "JXJWTH")
// {
// SystemCommon.ShowInfoMessageBox("退货存储不能生成零拣任务!");
// return;
// }
// if (ZjcheckB.Checked == true)
// {
// tasktype = "8";
// }
// else
// {
// tasktype = "7";
// }
// }
// else
// {
// comboBox1.Text = "A2";
// return;
// }
//}
//else
//{
// tasktype = "3";
// DataTable dt = IBussFactory<BussPickingWaveGoods>.Instance().getDecid(this.comboBox1.Text.Trim());
// string decidsts = dt.Rows[0]["STS"].ToString().Trim();
// if (decidsts != "2")
// {
// SystemCommon.ShowInfoMessageBox("该库口非出库模式!");
// return;
// }
//}
//if (IBussFactory<BussPickingWaveGoods>.Instance().getPickData(this.txtLoction.Text))
//{
// SystemCommon.ShowInfoMessageBox("该托盘已生成出库单!");
// return;
//}
if (IBussFactory<BussPickingWaveGoods>.Instance().getPickDataCount())
{
SystemCommon.ShowInfoMessageBox("出库任务不能多余10条");
return;
}
PickingWaveGoodsModel or_Model = new PickingWaveGoodsModel();
string status = "0";
DataTable dt2 = IBussFactory<BussPickingWaveGoods>.Instance().getYK(this.txtCTL.Text);
string locid = string.Empty;
string lockloc = string.Empty;
if (dt2.Rows.Count > 0)
{
status = dt2.Rows[0]["status"].ToString(); ;
}
else
{
status = "0";
}
//查询托盘是否正在执行出库任务
string orderstr = DateTime.Now.ToString("yyyyMMddHHmmssfff");
or_Model.PUTIN_ID = orderstr;
or_Model.PICKINGID = orderstr;
or_Model.OUT_ID = orderstr;
or_Model.DOCCTNUMBER = TXTTASKID.Text;
or_Model.GOOD_ID = this.txtGoodId.Text;
or_Model.LOC_ID = this.txtLoction.Text;
or_Model.WARE_DATE = Convert.ToDateTime(DateTime.Now.ToString());
or_Model.PICKING_NUM = Convert.ToDecimal(this.txtQTY_APPLY.Text.Trim());
or_Model.BARCODE = "";
or_Model.CTL = this.txtCTL.Text;
or_Model.status = status;
or_Model.outStand = "111";
or_Model.CK_TYPE = "1";
or_Model.typests = tasktype;
or_Model.PROVIDER_ID = "";
or_Model.MISTOCK_NUM = Convert.ToDecimal(txtKCNUM.Text.Trim());
or_Model.GOODS_NUM_SJ = Convert.ToDecimal(this.txtQTY_APPLY.Text.Trim());
string errText = "";
try
{
errText = IBussFactory<BussOrders>.Instance().InsSDOrder(or_Model);
if (errText.Length == 0)
{
SystemCommon.ShowInfoMessageBox("手动产生出库单成功!");
IBussFactory<BussOrders>.Instance().UpdateLock(this.txtLoction.Text.Trim());
LogWriteText.WriteLog(DateTime.Now.ToString() + " 手动产生出库单成功,库位:" + or_Model.LOC_ID + " 物料编号:" + or_Model.GOOD_ID + " 工单ID:" + or_Model.PROVIDER_ID);
}
else { SystemCommon.ShowInfoMessageBox("错误!" + errText); }
//getList();
//BindMiStockData();
}
catch (Exception ex)
{
SystemCommon.ShowInfoMessageBox("网络连接错误!");
return;
}
}
}
private void gridView2_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
{
try
{
if (gridView2.RowCount == 0)
{
return;
}
if (gridView2.FocusedRowHandle < 0)
{
return;
}
string SEGMENT1 = gridView2.GetFocusedRowCellValue("SEGMENT1").ToString();
txtQTY_APPLY.Text = gridView2.GetFocusedRowCellValue("QTY_APPLY").ToString();//领料单出库数量
TXTTASKID.Text= gridView2.GetFocusedRowCellValue("SEGMENT1").ToString();//领料单号
txtGoodId.Text= gridView2.GetFocusedRowCellValue("SEGMENT1").ToString();
DataTable tb = IBussFactory<BussMIStock>.Instance().GetLoctionGoodLtk(SEGMENT1);
if (tb != null)
{
gridControlCustom6.DataSource = tb;
}
}
catch (Exception ex) { }
}
private void gridView6_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
{
try
{
if (gridView6.RowCount == 0)
{
return;
}
if (gridView6.FocusedRowHandle < 0)
{
return;
}
this.txtLoction.Text = gridView6.GetFocusedRowCellValue("LOCATION_ID").ToString();
this.txtGoodId.Text = gridView6.GetFocusedRowCellValue("GOODS_ID").ToString();
this.txtKCNUM.Text = gridView6.GetFocusedRowCellValue("SHELVES_NUM").ToString();
this.TXTSTS.Text = gridView6.GetFocusedRowCellValue("STS").ToString();
this.txtCTL.Text= gridView6.GetFocusedRowCellValue("CTL").ToString();
}
catch (Exception ex) { }
}
private void ctrlButtons1_Click(object sender, EventArgs e)
{
}
}
}