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.FrmPrint; using WMS.Model.Base; using WMS.Model.RK; using System.Drawing.Printing; namespace WMS.FrmRK { public partial class FrmPrint : Form { public FrmPrint(WareNoticeModel wareNoticeModel) { InitializeComponent(); orderId = wareNoticeModel; } WareNoticeModel orderId = new WareNoticeModel(); /// /// 绑定数据 /// void BindData() { } private void gdvDetail_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { if(gdvDetail.RowCount==0) { return; } t_goodsId.Tag = gdvDetail.GetFocusedRowCellValue("GOODS_ID").ToString(); t_goodsId.Text = gdvDetail.GetFocusedRowCellValue("GOODS_NAME").ToString(); t_cgNum.Text = gdvDetail.GetFocusedRowCellValue("AMOUNT").ToString(); t_zxs.Text = gdvDetail.GetFocusedRowCellValue("GOODSVOLUME").ToString(); t_boxNum.Text = gdvDetail.GetFocusedRowCellValue("BOXCT").ToString(); BinDMeasure(t_goodsId.Tag.ToString()); string mid = gdvDetail.GetFocusedRowCellValue("GOODS_MEASURE_ID").ToString(); lookUpEdit1.EditValue = gdvDetail.GetFocusedRowCellValue("GOODS_MEASURE_ID").ToString(); string sts = gdvDetail.GetFocusedRowCellValue("PrintSts").ToString(); if (sts=="3" ) { ct_print.Enabled = true; } else { ct_print.Enabled = false; } } private void ctrlButtons4_Click(object sender, EventArgs e) { if (gdvDetail.RowCount == 0) { return; } if (t_goodsId.Text.Trim().Length == 0) { return; } if (t_cgNum.Text.Trim() == "0") { return; } if (t_zxs.Text.Trim()=="0") { SystemCommon.ShowInfoMessageBox("装箱数不能为0"); return; } string goodsId = t_goodsId.Tag.ToString(); int prsts= IBussFactory.Instance().GetCtPringCs(orderId.WAREHOUSING_ID, goodsId); if(prsts==1) { if(DialogResult.OK!= SystemCommon.ShowMessageBoxResult("已经打印,是否重打印")) { return; } IBussFactory.Instance().DelPrintBoxData(orderId.WAREHOUSING_ID, goodsId); } string code = ""; string ecode = ""; DataTable ptTable= IBussFactory.Instance().GetPrintData(orderId.WAREHOUSING_ID, goodsId); if (ptTable != null) { if (ptTable.Rows.Count > 0) { for (int i = 0; i < int.Parse(t_boxNum.Text); i++) { string seqval= IBussFactory.Instance().GetSeq("SEQ_BASE_BOXCDE"); code = ptTable.Rows[0]["类型"].ToString()+ ptTable.Rows[0]["物料编号"].ToString() + ptTable.Rows[0]["供应商编号"].ToString()+SystemCommon.GetNowYear(DateTime.Now.Year.ToString())+ SystemCommon.GetNowMonth(DateTime.Now.Month.ToString()) + DateTime.Now.Day.ToString().PadLeft(2,'0')+ seqval; ptTable.Rows[0]["箱码"] = code; ptTable.Rows[0]["二维码"] = ecode; BoxCodeModel boxModel = new BoxCodeModel(); boxModel.BARCODE = code; boxModel.WAREHOUSING_ID = orderId.WAREHOUSING_ID; boxModel.GOODS_ID = goodsId; boxModel.BOXNUM = decimal.Parse(t_zxs.Text); boxModel.GOODS_MEASURE_ID = lookUpEdit1.EditValue.ToString(); boxModel.UNIT = ptTable.Rows[0]["GVOLUME"].ToString(); IBussFactory.Instance().AddPrintBoxData(boxModel); RkBoxCode boxCode = new RkBoxCode(); boxCode.SetBindData(ptTable); // boxCode.pr // boxCode.PrintData(); } } } IBussFactory.Instance().UpdatePrint(orderId.WAREHOUSING_ID, goodsId); IBussFactory.Instance().UpdateSeq("SEQ_BASE_BOXCDE"); string wareId = orderId.WAREHOUSING_ID; GetDetailDoc(wareId); } /// /// 物料的周转箱规格 /// /// void BinDMeasure(string strGoodsID) { List ListGoodsMeasureModel = IBussFactory.Instance().GetGoodsMeasureDataTable(strGoodsID); if (ListGoodsMeasureModel != null) bdsMeasure.DataSource = ListGoodsMeasureModel; } private void ctrlButtons1_Click(object sender, EventArgs e) { DialogResult= DialogResult.Cancel; } private void ctrlButtons2_Click(object sender, EventArgs e) { if (gdvDetail.RowCount == 0) { return; } if (t_goodsId.Text.Trim().Length == 0) { return; } if (t_cgNum.Text.Trim() == "0") { return; } if (t_zxs.Text.Trim() == "0") { SystemCommon.ShowInfoMessageBox("装箱数不能为0"); return; } string goodsId = t_goodsId.Tag.ToString(); string volume = t_zxs.Text; int boxct = int.Parse(t_boxNum.Text); string measureId = lookUpEdit1.EditValue.ToString(); IBussFactory.Instance().UpdatePrintSts(measureId,orderId.WAREHOUSING_ID, goodsId, volume, boxct); string wareId = orderId.WAREHOUSING_ID; GetDetailDoc(wareId); gdvDetail_RowClick(null, null); } private void FrmPrint_Load(object sender, EventArgs e) { if(orderId != null) { bsWareNotice.DataSource = orderId; string wareId = orderId.WAREHOUSING_ID; GetDetailDoc(wareId); } } private void GetDetailDoc(string docId) { try { List list_wn_TabModel = IBussFactory.Instance().GetWareNoticeTabByList(docId); if (list_wn_TabModel != null) bdsDetail.DataSource = list_wn_TabModel; gdvDetail.RefreshData(); } catch (Exception ex) { SystemCommon.ShowInfoMessageBox("网络连接错误!"); return; } } private void t_zxs_Leave(object sender, EventArgs e) { if(t_zxs.Text.Trim().Length==0) { return; } if (t_zxs.Text.Trim().Length == 0) { return; } if(t_cgNum.Text.Trim().Length==0) { return; } if (t_goodsId.Text.Trim().Length == 0) { return; } if(t_zxs.Text.Trim()=="0") { return; } decimal a = Math.Ceiling(decimal.Parse(t_cgNum.Text) / decimal.Parse(t_zxs.Text)); t_boxNum.Text = a.ToString(); } private void lookUpEdit1_EditValueChanged(object sender, EventArgs e) { if (lookUpEdit1.EditValue.ToString() != "") { t_zxs.Text = lookUpEdit1.GetColumnValue("CONVERSION_RATIO").ToString(); t_zxs_Leave(null, null); } } private void checkBox1_CheckedChanged(object sender, EventArgs e) { if(checkBox1.Checked) { lookUpEdit1.EditValue = ""; t_zxs.Focus(); t_zxs.Text = "0"; lookUpEdit1.Enabled = false; t_boxNum.Text = "0"; t_zxs.ReadOnly = false; } else { lookUpEdit1.Enabled = true; lookUpEdit1.Focus(); t_zxs.ReadOnly = true; } } private void panel1_Paint(object sender, PaintEventArgs e) { } } }