512 lines
17 KiB
C#
512 lines
17 KiB
C#
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;
|
|
using WMS.Business.Base;
|
|
using WMS.Business.RK;
|
|
using WMS.Common;
|
|
using WMS.Ctrl;
|
|
using WMS.Frm.Base;
|
|
using WMS.Model.Base;
|
|
using WMS.Model.RK;
|
|
|
|
namespace WMS.FrmRK
|
|
{
|
|
public partial class FrmCodeDisk : FormBase
|
|
{
|
|
public FrmCodeDisk()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
/// <summary>
|
|
/// 当前的码盘数据
|
|
/// </summary>
|
|
List<CodeDiskModel> listCtlData = new List<CodeDiskModel>();
|
|
private void FrmCodeDisk_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("正在加载数据,请等待....");
|
|
|
|
//BindData();
|
|
//bsDisk.DataSource = addListCtlData;
|
|
BinDataWareNote();
|
|
StorageInfoModel storageInfoModel = new StorageInfoModel();
|
|
List<StorageInfoModel> li_StorageInfoModel = IBussFactory<BussStorageInfo>.Instance().GetStorageInfoDS(storageInfoModel);
|
|
if (li_StorageInfoModel != null)
|
|
{
|
|
lue_Stprage.Properties.DisplayMember = "STORAGE_ID";
|
|
lue_Stprage.Properties.ValueMember = "STORAGE_ID";
|
|
lue_Stprage.Properties.DataSource = li_StorageInfoModel;
|
|
|
|
}
|
|
|
|
//DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询已经打印的入库通知单
|
|
/// </summary>
|
|
void BinDataWareNote()
|
|
{
|
|
try
|
|
{
|
|
|
|
WareNoticeModel model = new WareNoticeModel();
|
|
model.STATE = "1";
|
|
List<WareNoticeModel> listWareNoticeModel = IBussFactory<BussWareNotice>.Instance().GetWareNoticeList(model);
|
|
if(listWareNoticeModel!=null)
|
|
{
|
|
bsWareNotice.DataSource = listWareNoticeModel;
|
|
if(listWareNoticeModel.Count>0)
|
|
{
|
|
string docId = listWareNoticeModel[0].WAREHOUSING_ID;
|
|
GetDetailDoc(docId);
|
|
wareId = docId;
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
SystemCommon.ShowInfoMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|
}
|
|
|
|
}
|
|
#region 查询明细
|
|
/// <summary>
|
|
/// 查询明细
|
|
/// </summary>
|
|
/// <param name="docId"></param>
|
|
private void GetDetailDoc(string docId)
|
|
{
|
|
try
|
|
{
|
|
|
|
|
|
List<WareNoticeTabModel> list_wn_TabModel = IBussFactory<BussWareNoticeTab>.Instance().GetWareNoticeTabByList(docId);
|
|
|
|
if (list_wn_TabModel != null)
|
|
bdsDetail.DataSource = list_wn_TabModel;
|
|
//if (list_wn_TabModel!=null)
|
|
//{
|
|
// string goodsId = list_wn_TabModel[0].GOODS_ID;
|
|
// string orderId = list_wn_TabModel[0].WAREHOUSING_ID;
|
|
// BindBoxData(orderId, goodsId);
|
|
// selectNotice = list_wn_TabModel[0];
|
|
//}
|
|
//gdvDetail.RefreshData();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
SystemCommon.ShowInfoMessageBox("网络连接错误!");
|
|
return;
|
|
}
|
|
}
|
|
#endregion
|
|
void BindWarIdData(string warId)
|
|
{
|
|
|
|
|
|
if (addListCtlData.Count == 0)
|
|
{
|
|
CodeDiskModel cModel = new CodeDiskModel();
|
|
cModel.Warehousing_id = warId;
|
|
addListCtlData = IBussFactory<BussCodeDisk>.Instance().GetCodeDisk(cModel);
|
|
|
|
if (listCtlData != null)
|
|
{
|
|
|
|
bsDisk.DataSource = addListCtlData;
|
|
if(addListCtlData.Count>0)
|
|
{
|
|
t_ctl.TextBoxValue = addListCtlData[0].Pallet_id;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
void BindData(string ctl)
|
|
{
|
|
if (addListCtlData == null)
|
|
{
|
|
if (addListCtlData.Count == 0)
|
|
{
|
|
CodeDiskModel cModel = new CodeDiskModel();
|
|
cModel.Pallet_id = ctl;
|
|
addListCtlData = IBussFactory<BussCodeDisk>.Instance().GetCodeDisk(cModel);
|
|
if (listCtlData != null)
|
|
{
|
|
bsDisk.DataSource = addListCtlData;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
void BindData()
|
|
{
|
|
//LoadForm load = new LoadForm();
|
|
//DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(load, load.GetType(), false, true, false, 50);
|
|
//DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormDescription("正在加载数据,请等待....");
|
|
try
|
|
{
|
|
CodeDiskModel ctlData = new CodeDiskModel();
|
|
ctlData.STORAGE_ID = this.userData.STORAGE_ID;
|
|
listCtlData = IBussFactory<BussCodeDisk>.Instance().GetCodeDisk(ctlData);
|
|
if (listCtlData != null)
|
|
{
|
|
bs_CodeDisk.DataSource = listCtlData;
|
|
|
|
}
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
SystemCommon.ShowErrorMessageBox("未知错误,请检查网络连接!如仍无法解决问题请联系我们!");
|
|
}
|
|
//DevExpress.XtraSplashScreen.SplashScreenManager.CloseForm();
|
|
|
|
}
|
|
private void ctrlButtons4_Click(object sender, EventArgs e)
|
|
{
|
|
BindData();
|
|
bsDisk.DataSource = addListCtlData;
|
|
BinDataWareNote();
|
|
}
|
|
|
|
private void ctrlButtons3_Click(object sender, EventArgs e)
|
|
{
|
|
if(gdv_ctl.RowCount==0)
|
|
{
|
|
return;
|
|
}
|
|
if(ctl.Trim().Length==0)
|
|
{
|
|
return;
|
|
}
|
|
if (DialogResult.OK == SystemCommon.ShowMessageBoxResult("确定要删除该码盘信息"))
|
|
{
|
|
IBussFactory<BussCodeDisk>.Instance().DelCiskCtlGoodsId(ctl,orderWid,goodsId);
|
|
ctl = "";
|
|
BindData();
|
|
}
|
|
}
|
|
string ctl = "";
|
|
string orderWid = "";
|
|
string goodsId = "";
|
|
private void gdv_ctl_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
|
|
{
|
|
if(gdv_ctl.RowCount==0)
|
|
{
|
|
return;
|
|
}
|
|
if(gdv_ctl.FocusedRowHandle<0)
|
|
{
|
|
return;
|
|
}
|
|
ctl = gdv_ctl.GetFocusedRowCellValue("Pallet_id").ToString();
|
|
orderWid = gdv_ctl.GetFocusedRowCellValue("Warehousing_id").ToString();
|
|
goodsId = gdv_ctl.GetFocusedRowCellValue("Goods_id").ToString();
|
|
ct_WareData.TextBoxValue = ctl;
|
|
}
|
|
|
|
private void ctrlButtons1_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
List<CodeDiskModel> addListCtlData = new List<CodeDiskModel>();
|
|
private void ctrlButtons2_Click(object sender, EventArgs e)
|
|
{
|
|
if (gdv_ctl.RowCount == 0)
|
|
{
|
|
return;
|
|
}
|
|
if (ctl.Trim().Length == 0)
|
|
{
|
|
return;
|
|
}
|
|
if (DialogResult.OK == SystemCommon.ShowMessageBoxResult("确定要删除该码盘信息"))
|
|
{
|
|
IBussFactory<BussCodeDisk>.Instance().DelCiskCtl(ctl);
|
|
ctl = "";
|
|
BindData();
|
|
}
|
|
|
|
}
|
|
|
|
private void ctrlButtons6_Click(object sender, EventArgs e)
|
|
{
|
|
if (wareId.Trim().Length == 0)
|
|
{
|
|
SystemCommon.ShowInfoMessageBox("选择入库通知单");
|
|
return;
|
|
}
|
|
StorageLotModel stoLotModel = new StorageLotModel();
|
|
// stoLotModel.RECE_DATE = DateTime.Now;
|
|
stoLotModel.OPERATORID = userData.USER_ID;
|
|
stoLotModel.OPERATORNAME = userData.NAME;
|
|
stoLotModel.NOTICE_ID = wareId;
|
|
|
|
List<StorageLotInfoModel> infoList = new List<StorageLotInfoModel>();
|
|
CodeDiskModel cModel = new CodeDiskModel();
|
|
cModel.Warehousing_id = wareId;
|
|
addListCtlData = IBussFactory<BussCodeDisk>.Instance().GetCodeDisk(cModel);
|
|
if (addListCtlData.Count > 0)
|
|
{
|
|
foreach (CodeDiskModel code in addListCtlData)
|
|
{
|
|
|
|
if (infoList.Count(r => r.GOODS_ID == code.Goods_id) == 0)
|
|
{
|
|
StorageLotInfoModel model = new StorageLotInfoModel();
|
|
model.LOT_ID = stoLotModel.LOT_ID;
|
|
model.MADE_DATE = DateTime.Now;
|
|
model.OPERATORID = userData.USER_ID;
|
|
model.OPERATORNAME = userData.NAME;
|
|
model.ARR_NUM = code.Goods_Num;
|
|
model.STORAGE_ID = code.STORAGE_ID;
|
|
model.GOODS_ID = code.Goods_id;
|
|
model.UNIT = code.Unit;
|
|
model.ACC_NUM = model.ARR_NUM;
|
|
infoList.Add(model);
|
|
}
|
|
else
|
|
{
|
|
StorageLotInfoModel model = infoList.Find(r => r.GOODS_ID == code.Goods_id);
|
|
model.ARR_NUM = model.ARR_NUM + code.Goods_Num;
|
|
model.ACC_NUM = model.ARR_NUM;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
IBussFactory<BussStorageLot>.Instance().AddLotData(stoLotModel, infoList);
|
|
BindData();
|
|
tbdata.SelectedIndex = 0;
|
|
|
|
}
|
|
|
|
private void ctrlDictonary1_Button_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
string wareId = "";
|
|
private void gVWareNotice_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
|
|
{
|
|
if(gVWareNotice.RowCount<=0)
|
|
{
|
|
return;
|
|
}
|
|
wareId = gVWareNotice.GetFocusedRowCellValue("WAREHOUSING_ID").ToString();
|
|
|
|
|
|
this.txtPURCHASE_ID.Text = gVWareNotice.GetFocusedRowCellValue("PURCHASE_ID").ToString(); ;
|
|
|
|
GetDetailDoc(wareId);
|
|
BindWarIdData(wareId);
|
|
}
|
|
void BindBoxData(string orderId,string goodsId)
|
|
{
|
|
|
|
List<BoxCodeModel> boxModel= IBussFactory<BussWareNoticeTab>.Instance().GetPrintBoxData(orderId, goodsId);
|
|
if(boxModel!=null)
|
|
{
|
|
bgsBox.DataSource = boxModel;
|
|
|
|
}
|
|
}
|
|
WareNoticeTabModel selectNotice = new WareNoticeTabModel();
|
|
private void gdvDetail_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
|
|
{
|
|
if(gdvDetail.RowCount <= 0)
|
|
{
|
|
return;
|
|
}
|
|
//selectNotice = (WareNoticeTabModel)gdvDetail.GetFocusedRow();
|
|
txtPURCHASE_ID.Text = gdvDetail.GetFocusedRowCellValue("PURCHASE_ID").ToString();
|
|
this.txtWAREHOUSING_ID.Text = gdvDetail.GetFocusedRowCellValue("WAREHOUSING_ID").ToString();
|
|
this.txtLINE_NUM.Text = gdvDetail.GetFocusedRowCellValue("LINE_NUM").ToString();
|
|
this.txtAMOUNT.Text = gdvDetail.GetFocusedRowCellValue("AMOUNT").ToString();
|
|
this.txtARRAMOUNT.Text= gdvDetail.GetFocusedRowCellValue("ARRAMOUNT").ToString();
|
|
this.txtGOODS_ID.Text= gdvDetail.GetFocusedRowCellValue("GOODS_ID").ToString();
|
|
//BindBoxData(orderId, goodsId);
|
|
|
|
|
|
}
|
|
|
|
private void ctrlButtons5_Click(object sender, EventArgs e)
|
|
{
|
|
if(wareId.Trim().Length==0)
|
|
{
|
|
SystemCommon.ShowInfoMessageBox("选择入库通知单");
|
|
return;
|
|
}
|
|
if(txtPURCHASE_ID.Text.Trim().Length==0)
|
|
{
|
|
SystemCommon.ShowInfoMessageBox("箱码不能为空");
|
|
return;
|
|
}
|
|
if (t_ctl.TextBoxValue.Trim().Length == 0)
|
|
{
|
|
SystemCommon.ShowInfoMessageBox("托盘不能为空");
|
|
return;
|
|
}
|
|
if (selectNotice==null)
|
|
{
|
|
return;
|
|
}
|
|
CodeDiskModel barCode = new CodeDiskModel();
|
|
barCode.BarCode = txtPURCHASE_ID.Text;
|
|
barCode.Goods_id = selectNotice.GOODS_ID;
|
|
barCode.GOODS_MEASURE_ID = selectNotice.GOODS_MEASURE_ID;
|
|
barCode.Goods_Num = decimal.Parse( txtARRAMOUNT.Text);
|
|
barCode.OperatorID = userData.USER_ID;
|
|
barCode.Pallet_id = t_ctl.TextBoxValue;
|
|
barCode.Unit = selectNotice.UNIT;
|
|
barCode.Warehousing_id = wareId;
|
|
|
|
int a= IBussFactory<BussCodeDisk>.Instance().AddZCtlData(barCode);
|
|
if(a==0)
|
|
{
|
|
if(DialogResult.OK == SystemCommon.ShowMessageBoxResult("入库单已经收货码盘完成"))
|
|
{
|
|
ctrlButtons6_Click(null, null);
|
|
}
|
|
}
|
|
|
|
addListCtlData.Add(barCode);
|
|
gdvCtl.RefreshData();
|
|
tb_data.SelectedPageIndex = 1;
|
|
|
|
|
|
}
|
|
BoxCodeModel codeBox = new BoxCodeModel();
|
|
private void gridView1_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
|
|
{
|
|
if(gridView1.RowCount==0)
|
|
{
|
|
return;
|
|
}
|
|
txtPURCHASE_ID.Text = gridView1.GetFocusedRowCellValue("BARCODE").ToString();
|
|
txtAMOUNT.Text = gridView1.GetFocusedRowCellValue("BOXNUM").ToString();
|
|
txtARRAMOUNT.Text = gridView1.GetFocusedRowCellValue("BOXNUM").ToString();
|
|
|
|
string sts = gridView1.GetFocusedRowCellValue("STS").ToString();
|
|
if(sts=="1")
|
|
{
|
|
ct_bt.Enabled = false;
|
|
}
|
|
else
|
|
{ ct_bt.Enabled = true; }
|
|
lue_Stprage.EditValue = userData.STORAGE_ID;
|
|
|
|
|
|
}
|
|
|
|
private void t_code_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if(e.KeyCode == Keys.Enter)
|
|
{
|
|
string ctl = txtPURCHASE_ID.Text.Trim();
|
|
BindData(ctl);
|
|
}
|
|
}
|
|
|
|
private void gdvCtl_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
|
|
{
|
|
if (gdvCtl.RowCount == 0)
|
|
{
|
|
return;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
private void ctrlButtons7_Click(object sender, EventArgs e)
|
|
{
|
|
if (gdvCtl.RowCount == 0)
|
|
{
|
|
return;
|
|
}
|
|
if (gdvCtl.FocusedRowHandle <0)
|
|
{
|
|
return;
|
|
}
|
|
CodeDiskModel diskModel = gdvCtl.GetFocusedRow() as CodeDiskModel;
|
|
if(diskModel!=null)
|
|
{
|
|
addListCtlData.Remove(diskModel);
|
|
gdvCtl.RefreshData();
|
|
tb_data.SelectedPageIndex = 1;
|
|
}
|
|
}
|
|
|
|
private void ctrlButtons1_Click_1(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void gr_Code_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void gridView1_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
|
|
{
|
|
if (e.Column.FieldName == "STS")
|
|
{
|
|
switch (e.Value.ToString().Trim())
|
|
{
|
|
case "0":
|
|
e.DisplayText = "未码盘";
|
|
break;
|
|
case "1":
|
|
e.DisplayText = "已码盘";
|
|
break;
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
private void ctrlButtons5_Click_1(object sender, EventArgs e)
|
|
{
|
|
DevExpress.Utils.WaitDialogForm loadForm = new DevExpress.Utils.WaitDialogForm("请稍后...", "正在查询数据");
|
|
|
|
BinDataWareNote();
|
|
|
|
loadForm.Dispose();
|
|
loadForm.Close();
|
|
}
|
|
|
|
private void ctrlButtons7_Click_1(object sender, EventArgs e)
|
|
{
|
|
if (txtPURCHASE_ID.Text == "")
|
|
{
|
|
SystemCommon.ShowInfoMessageBox("请选择采购单号");
|
|
return;
|
|
}
|
|
|
|
if (SystemCommon.ShowMessageBoxResult("确定删除采购单:" + this.txtPURCHASE_ID.Text.ToString() + "入库信息吗?") == DialogResult.OK)
|
|
{
|
|
|
|
IBussFactory<BussWareNotice>.Instance().DelOrderData(this.txtPURCHASE_ID.Text);
|
|
BinDataWareNote();
|
|
SystemCommon.ShowInfoMessageBox("操作成功");
|
|
this.txtPURCHASE_ID.Text = "";
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|