using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Text;
|
using System.Windows.Forms;
|
using gregn6Lib;
|
using Pub_Class;
|
using System.Threading;
|
|
namespace SCM
|
{
|
public partial class Gy_BarCodeBill : Form
|
{
|
public Gy_BarCodeBill()
|
{
|
InitializeComponent();
|
}
|
//定义
|
public const Int16 HTagCol = 0;
|
public const Int16 HSnoCol = 1;
|
public const Int16 HMainIDCol = 2;
|
public const Int16 HSubIDCol = 3;
|
public const Int16 HBillNoCol = 4;
|
public const Int16 HBillTypeCol = 5;
|
public const Int16 HMaterIDCol = 6;
|
public const Int16 HMaterNumberCol = 7;
|
public const Int16 HMaterNameCol = 8;
|
public const Int16 HPinfanCol = 9;
|
public const Int16 HMaterModelCol = 10;
|
public const Int16 HModelCol = 11;
|
public const Int16 HAuxPropIDCol = 12;
|
public const Int16 HAuxPropNumberCol = 13;
|
public const Int16 HAuxPropNameCol = 14;
|
public const Int16 HUnitIDCol = 15;
|
public const Int16 HUnitNumberCol = 16;
|
public const Int16 HUnitNameCol = 17;
|
public const Int16 HBarCodeTypeCol = 18;
|
public const Int16 HBatchManagerCol = 19;
|
public const Int16 HBatchNoCol = 20;
|
public const Int16 HGroupIDCol = 21;
|
public const Int16 HGroupNumberCol = 22;
|
public const Int16 HGroupNameCol = 23;
|
public const Int16 HCusModelCol = 24;
|
public const Int16 HQtyCol = 25;
|
public const Int16 HMinQtyCol = 26;
|
public const Int16 HBQtyCol = 27;
|
public const Int16 HLogoCol = 28;
|
public const Int16 HDeptIDCol = 29;
|
public const Int16 HDeptNumberCol = 30;
|
public const Int16 HDeptNameCol = 31;
|
public const Int16 HSourceIDCol = 32;
|
public const Int16 HSourceNumberCol = 33;
|
public const Int16 HSourceNameCol = 34;
|
public const Int16 HDateCol = 35;
|
public const Int16 HBeginDateCol = 36;
|
public const Int16 HEndDateCol = 37;
|
public const Int16 HSupIDCol = 38;
|
public const Int16 HSupNumberCol = 39;
|
public const Int16 HSupNameCol = 40;
|
public const Int16 HCusIDCol = 41;
|
public const Int16 HCusNumberCol = 42;
|
public const Int16 HCusNameCol = 43;
|
public const Int16 HCusTypeCol = 44;
|
public const Int16 HSourceInterIDCol = 45;
|
public const Int16 HSourceEntryIDCol = 46;
|
public const Int16 HSourceBillNoCol = 47;
|
public const Int16 HSourceBillTypeCol = 48;
|
public const Int16 HInstructIDCol = 49;
|
public const Int16 HInstructNoCol = 50;
|
public const Int16 HSeOrderBillIDCol = 51;
|
public const Int16 HSeOrderBillNoCol = 52;
|
public const Int16 HCustomBatchNoCol = 53;
|
public const Int16 HWhIDCol = 54;
|
public const Int16 HWhNumberCol = 55;
|
public const Int16 HWhNameCol = 56;
|
public const Int16 HSPIDCol = 57;
|
public const Int16 HSPNumberCol = 58;
|
public const Int16 HSPNameCol = 59;
|
public const Int16 HinitQtyCol = 60;
|
public const Int16 HRemarkCol = 61;
|
public const Int16 HPinfanBarCodeCol = 62;
|
public const Int16 HMTONoCol = 63;
|
public const Int16 HColorCol = 64;
|
public const Int16 HPressModelCol = 65;
|
public const Int16 HJiaYeCol = 66;
|
public const Int16 HPackageSizeCol = 67;
|
public const Int16 HJQtyCol = 68;
|
public const Int16 HMQtyCol = 69;
|
public const Int16 HGBBarCodeCol = 70;
|
public const Int16 HJiaYeLXCol = 71;
|
public const Int16 HJiaYeLCol = 72;
|
public const Int16 POOrderBillNoCol = 73;
|
public const Int16 HBarCode_PackCol = 74;
|
public const Int16 HCustomQty1Col = 75;
|
|
public Int16 HSelectCol = 0;
|
public Int16 HSno2Col = 1;
|
public Int16 HTMCol = 2;
|
public Int16 HBarCodeType2Col = 3;
|
public Int16 HMaterID2Col = 4;
|
public Int16 HMaterNumber2Col = 5;
|
public Int16 HMaterName2Col = 6;
|
public Int16 HPinfan2Col = 7;
|
public Int16 HMaterModel2Col = 8;
|
public Int16 HModel2Col = 9;
|
public Int16 HAuxPropID2Col = 10;
|
public Int16 HAuxPropNumber2Col = 11;
|
public Int16 HAuxPropName2Col = 12;
|
public Int16 HBatchNo2Col = 13;
|
public Int16 HUnitID2Col = 14;
|
public Int16 HUnitNumber2Col = 15;
|
public Int16 HUnitName2Col = 16;
|
public Int16 HGroupID2Col = 17;
|
public Int16 HGroupNumber2Col = 18;
|
public Int16 HGroupName2Col = 19;
|
public Int16 HCusModel2Col = 20;
|
public Int16 HQty2Col = 21;
|
public Int16 HWeiCol = 22;
|
public Int16 HPrintCol = 23;
|
public Int16 HLogo2Col = 24;
|
public Int16 HDeptID2Col = 25;
|
public Int16 HDeptNumber2Col = 26;
|
public Int16 HDeptName2Col = 27;
|
public Int16 HSourceID2Col = 28;
|
public Int16 HSourceNumber2Col = 29;
|
public Int16 HSourceName2Col = 30;
|
public Int16 HDate2Col = 31;
|
public Int16 HBeginDate2Col = 32;
|
public Int16 HEndDate2Col = 33;
|
public Int16 HBarcodeNoCol = 34;
|
public Int16 HBarcodeQtysCol = 35;
|
public Int16 HSupID2Col = 36;
|
public Int16 HSupNumber2Col = 37;
|
public Int16 HSupName2Col = 38;
|
public Int16 HCusID2Col = 39;
|
public Int16 HCusNumber2Col = 40;
|
public Int16 HCusName2Col = 41;
|
public Int16 HCusType2Col = 42;
|
public Int16 HSourceInterID2Col = 43;
|
public Int16 HSourceEntryID2Col = 44;
|
public Int16 HSourceBillNo2Col = 45;
|
public Int16 HSourceBillType2Col = 46;
|
public Int16 HInstructID2Col = 47;
|
public Int16 HInstructNo2Col = 48;
|
public Int16 HSeOrderBillID2Col = 49;
|
public Int16 HSeOrderBillNo2Col = 50;
|
public Int16 HCustomBatchNo2Col = 51;
|
public Int16 HWhID2Col = 52;
|
public Int16 HWhNumber2Col = 53;
|
public Int16 HWhName2Col = 54;
|
public Int16 HSPID2Col = 55;
|
public Int16 HSPNumber2Col = 56;
|
public Int16 HSPName2Col = 57;
|
public Int16 HRemark2Col = 58;
|
public Int16 HPinfanBarCode2Col = 59;
|
public Int16 HMTONo2Col = 60;
|
public Int16 HColor2Col = 61;
|
public Int16 HPressModel2Col = 62;
|
public Int16 HJiaYe2Col = 63;
|
public Int16 HPackageSize2Col = 64;
|
public Int16 HJQty2Col = 65;
|
public Int16 HMQty2Col = 66;
|
public Int16 HMakeDate2Col = 67;
|
public Int16 HGBBarCode2Col = 68;
|
public Int16 HJiaYeLX2Col = 69;
|
public Int16 HJiaYeL2Col = 70;
|
public Int16 POOrderBillNo2Col = 71;
|
public Int16 HBarCode_Pack2Col = 72;
|
public Int16 HCustomQty12Col = 73;
|
//
|
public string ModName = "85";
|
public string ModCaption = "条码生成";
|
public bool BillChange; //
|
|
public DBUtility.ClsPub.Enum_BillStatus BillStatus;
|
public SCM.WMSWeb.WebService1 oWeb = new SCM.WMSWeb.WebService1();
|
public Int64 KeyID;
|
public bool grdStatus;
|
ClsGridViewSum oSumGrid = new ClsGridViewSum();
|
public int selectRow = 0;
|
public int selectRow2 = 0;
|
public Int64 HInterID = 0; //内码
|
public Int64 HOrgID = -1;
|
public string HOrgNumber = "";
|
public string CampanyName = ""; //客户定制化名称
|
//-------------------------------------------------------------------------
|
#region 固定代码
|
|
//清空界面
|
public void Sub_ClearBill()
|
{
|
DataSet Ds1;
|
////表体清空
|
//grdMain.Rows.Clear();
|
//grdSub.Rows.Clear();
|
txtHGroupID.Text = "";
|
txtHCaseNo.Text = "";
|
cmbHBarCodeType.Items.Clear();
|
cmbSourceBillType.Items.Clear();
|
|
if (CampanyName == "韩电") //系统参数 客户定制化名称
|
{
|
cmbHBarCodeType.Items.Add("唯一条码");
|
cmbHBarCodeType.Items.Add("奥克斯条码");
|
cmbHBarCodeType.Items.Add("箱发条码");
|
cmbHBarCodeType.SelectedIndex = 0;
|
}
|
else
|
{
|
cmbHBarCodeType.Items.Add("唯一条码");
|
cmbHBarCodeType.Items.Add("品种条码");
|
cmbHBarCodeType.Items.Add("批次条码");
|
//cmbHBarCodeType.Items.Add("托盘条码");
|
cmbHBarCodeType.SelectedIndex = 0;
|
}
|
//
|
if (CampanyName == "森楷") //系统参数 客户定制化名称
|
{
|
cmbSourceBillType.Items.Add("入库申请单");
|
cmbSourceBillType.SelectedIndex = 0;
|
label6.Visible = true;
|
txtHGroupID.Visible = true;
|
cmdHGroupID.Visible = true;
|
label5.Visible = true;
|
txtHCaseNo.Visible = true;
|
chkAddModel.Visible = false;
|
spRow.Visible = false;
|
toolStripSeparator6.Visible = false;
|
}
|
else
|
{
|
cmbSourceBillType.Items.Add("生产订单");
|
cmbSourceBillType.Items.Add("生产汇报单");
|
cmbSourceBillType.Items.Add("采购订单");
|
cmbSourceBillType.Items.Add("收料通知单");
|
cmbSourceBillType.Items.Add("委外订单");
|
cmbSourceBillType.SelectedIndex = 0;
|
}
|
//
|
//DBUtility.Xt_BaseBillFun.Sub_ClearBill(gbUp);
|
|
Ds1 = oWeb.getDataSetBySQL("select * from Xt_ORGANIZATIONS with(nolock) where HItemID=" + ClsPub1.HOrgID, "Xt_ORGANIZATIONS", ref DBUtility.ClsPub.sExeReturnInfo);
|
if (Ds1.Tables[0].Rows.Count != 0)
|
{
|
cmbHOrgID.Text = DBUtility.ClsPub.isStrNull(Ds1.Tables[0].Rows[0]["HName"]);
|
}
|
//
|
dtpHDate.Value = DateTime.Today;
|
txtHMaker.Text = ClsPub.CurUserName;
|
txtHMakeDate.Text = "";
|
txtHChecker.Text = "";
|
txtHCheckDate.Text = "";
|
txtHCloseMan.Text = "";
|
txtHCloseDate.Text = "";
|
txtHDeleteMan.Text = "";
|
txtHDeleteDate.Text = "";
|
txtHUpDater.Text = "";
|
txtHUpDateDate.Text = "";
|
initGrid();
|
grdList.DataSource = null;
|
}
|
|
//保存列宽
|
private void bclk_Click(object sender, EventArgs e)
|
{
|
DBUtility.Xt_BaseBillFun.SaveGrid(grdMain, this.Name);
|
DBUtility.Xt_BaseBillFun.SaveGrid(grdSub, this.Name + "grdSub");
|
DBUtility.Xt_BaseBillFun.SaveGrid(grdList, this.Name + "grdList");
|
}
|
|
//默认列宽
|
private void mrlk_Click(object sender, EventArgs e)
|
{
|
DBUtility.Xt_BaseBillFun.DefaultGridView(grdMain, this.Name);
|
DBUtility.Xt_BaseBillFun.DefaultGridView(grdSub, this.Name + "grdSub");
|
DBUtility.Xt_BaseBillFun.DefaultGridView(grdList, this.Name + "grdList");
|
}
|
|
//增行按钮
|
private void AddRow_Click(object sender, EventArgs e)
|
{
|
DBUtility.Xt_BaseBillFun.AddRow(oSumGrid);
|
}
|
|
//删行按纽
|
private void DelRow_Click(object sender, EventArgs e)
|
{
|
DBUtility.Xt_BaseBillFun.DelRow(oSumGrid);
|
}
|
|
//保存按钮
|
private void bc_Click(object sender, EventArgs e)
|
{
|
this.Sub_SaveBill();
|
Display();
|
}
|
|
//重置按纽
|
private void cz_Click(object sender, EventArgs e)
|
{
|
if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew || BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify)
|
{
|
if (MessageBox.Show("确定要清空当前界面信息,重置界面?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
|
{
|
this.Sub_AddBill();
|
}
|
}
|
grdMain.Columns[HBillNoCol].ReadOnly = false;
|
tabControl1.SelectedIndex = 0;
|
}
|
|
//新增单据
|
private void Sub_AddBill()
|
{
|
this.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
|
this.Sub_OperStatus();//设置TOOLBAR
|
this.Sub_ClearBill();//清空界面
|
}
|
|
//退出按钮
|
private void tc_Click(object sender, EventArgs e)
|
{
|
this.Close();
|
}
|
|
//离开单元格
|
private void grdMain_LeaveCell(object sender, EventArgs e)
|
{
|
oSumGrid.LeaveCell();
|
}
|
|
//网格单元格变化事件
|
private void grdMain_RowColChange(object sender, EventArgs e)
|
{
|
if (!grdStatus)
|
{
|
return;
|
}
|
DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid);
|
//
|
//if (oSumGrid.Changelock)
|
// return;
|
//if(oSumGrid.EditStatus)
|
//{
|
if (!CheckGridRow(oSumGrid.OldCell.Row))
|
return;
|
//}
|
}
|
|
private void Gy_BarCodeBill_Paint(object sender, PaintEventArgs e)//画线
|
{
|
//Graphics g = this.panel2.CreateGraphics();
|
//Pen p = new Pen(Color.Gray);
|
//p.Width = 1;
|
//g.DrawLine(p, new Point(txtHMaker.Left, txtHMaker.Top + txtHMaker.Height), new Point(txtHMaker.Left + txtHMaker.Width, txtHMaker.Top + txtHMaker.Height));
|
//g.DrawLine(p, new Point(txtHMakeDate.Left, txtHMakeDate.Top + txtHMakeDate.Height), new Point(txtHMakeDate.Left + txtHMakeDate.Width, txtHMakeDate.Top + txtHMakeDate.Height));
|
////
|
//g.DrawLine(p, new Point(txtHChecker.Left, txtHChecker.Top + txtHChecker.Height), new Point(txtHChecker.Left + txtHChecker.Width, txtHChecker.Top + txtHChecker.Height));
|
//g.DrawLine(p, new Point(txtHCheckDate.Left, txtHCheckDate.Top + txtHCheckDate.Height), new Point(txtHCheckDate.Left + txtHCheckDate.Width, txtHCheckDate.Top + txtHCheckDate.Height));
|
////
|
//g.DrawLine(p, new Point(txtHCloseMan.Left, txtHCloseMan.Top + txtHCloseMan.Height), new Point(txtHCloseMan.Left + txtHCloseMan.Width, txtHCloseMan.Top + txtHCloseMan.Height));
|
//g.DrawLine(p, new Point(txtHCloseDate.Left, txtHCloseDate.Top + txtHCloseDate.Height), new Point(txtHCloseDate.Left + txtHCloseDate.Width, txtHCloseDate.Top + txtHCloseDate.Height));
|
////
|
//g.DrawLine(p, new Point(this.txtHDeleteMan.Left, txtHDeleteMan.Top + txtHDeleteMan.Height), new Point(txtHDeleteMan.Left + txtHDeleteMan.Width, txtHDeleteMan.Top + txtHDeleteMan.Height));
|
//g.DrawLine(p, new Point(txtHDeleteDate.Left, txtHDeleteDate.Top + txtHDeleteDate.Height), new Point(txtHDeleteDate.Left + txtHDeleteDate.Width, txtHDeleteDate.Top + txtHDeleteDate.Height));
|
////
|
//g.DrawLine(p, new Point(this.txtHUpDater.Left, txtHUpDater.Top + txtHUpDater.Height), new Point(txtHUpDater.Left + txtHUpDater.Width, txtHUpDater.Top + txtHUpDater.Height));
|
//g.DrawLine(p, new Point(txtHUpDateDate.Left, txtHUpDateDate.Top + txtHUpDateDate.Height), new Point(txtHUpDateDate.Left + txtHUpDateDate.Width, txtHUpDateDate.Top + txtHUpDateDate.Height));
|
////控件位置设置
|
|
}
|
|
//控件位置
|
private void Sub_ControlLocation()
|
{
|
//gbUp.Width = P1.Width - 20;
|
//gbUp.Left = 10;
|
//gbUp.Height = P1.Height - 35;
|
//gbUp.Top = 30;
|
}
|
|
//窗体加载
|
private void Gy_BarCodeBill_Load(object sender, EventArgs e)
|
{
|
//设置动态URL
|
oWeb.Url = SCM.ClsPub1.WEBSURL;
|
//
|
//打印初始化
|
oSumGrid.NoCol = HSnoCol;
|
oSumGrid.ogrdMain = grdMain;
|
oSumGrid.oGridsum = grdSum;
|
this.Text = ModCaption;
|
this.lblCaption.Text = ModCaption;
|
//加载组织信息
|
Sub_AddOrdList();
|
//加载工厂代码信息
|
Sub_AddWorksNumberList();
|
}
|
|
//加载组织信息
|
private void Sub_AddOrdList()
|
{
|
DataSet ds;
|
ds = oWeb.get_ORGANIZATIONSList();
|
if (ds == null || ds.Tables[0].Rows.Count == 0)
|
{
|
MessageBox.Show("获取组织失败");
|
return;
|
}
|
cmbHOrgID.Items.Clear();
|
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
{
|
cmbHOrgID.Items.Add(DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HName"]));
|
}
|
}
|
|
//加载工厂代码信息
|
private void Sub_AddWorksNumberList()
|
{
|
//获取系统参数 客户定制化名称
|
DataSet Ds = oWeb.getDataSetBySQL("select HValue from Xt_SystemParameter with(nolock) where HKey='WMS_CampanyName'", "Xt_SystemParameter", ref DBUtility.ClsPub.sExeReturnInfo);
|
if (Ds == null || Ds.Tables[0].Rows.Count == 0)
|
{
|
MessageBox.Show("获取系统参数失败!原因:" + DBUtility.ClsPub.sExeReturnInfo, "提示");
|
return;
|
}
|
else
|
{
|
CampanyName = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HValue"]);
|
}
|
|
cmbHWorksNumber.Items.Clear();
|
if (CampanyName == "飞龙") //系统参数 客户定制化名称
|
{
|
cmbHWorksNumber.Items.Add("ZL");
|
cmbHWorksNumber.Items.Add("ST1");
|
cmbHWorksNumber.Items.Add("ST2");
|
cmbHWorksNumber.Items.Add("ST3");
|
cmbHWorksNumber.Items.Add("ST4");
|
cmbHWorksNumber.Items.Add("ST5");
|
cmbHWorksNumber.Items.Add("ST6");
|
cmbHWorksNumber.Items.Add("SQ");
|
cmbHWorksNumber.Items.Add("MQ");
|
cmbHWorksNumber.SelectedIndex = 0;
|
}
|
else
|
{
|
cmbHWorksNumber.Items.Add("");
|
}
|
}
|
|
//窗体尺寸变化时
|
private void Gy_BarCodeBill_Resize(object sender, EventArgs e)
|
{
|
//Sub_ControlLocation();
|
}
|
|
//根据编辑状态 设置 控件是否允许录入
|
private void Sub_LrtextStatus(bool TextEnabled)
|
{
|
if (TextEnabled == true)
|
{
|
//控件全部有效
|
gbUp.Enabled = true;
|
grdMain.BackColor = ClsPub.EditColor;
|
}
|
else
|
{ //控件全部无效
|
gbUp.Enabled = false;
|
grdMain.BackColor = ClsPub.ViewColor;
|
}
|
}
|
|
//timer
|
private void timer1_Tick(object sender, EventArgs e)
|
{
|
timer1.Enabled = false;
|
Sub_ControlLocation();
|
if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_View)
|
{
|
//this.Sub_ShowBill();
|
}
|
else
|
{
|
this.Sub_AddBill();
|
}
|
DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid);
|
}
|
|
//窗体卸载
|
private void Gy_BarCodeBill_FormClosing(object sender, FormClosingEventArgs e)
|
{
|
BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
|
DBUtility.Xt_BaseBillFun.SaveGrid(grdMain, this.Name);
|
}
|
|
//TOOLBAR状态 按钮是否灰度
|
public void Sub_OperStatus()
|
{
|
switch (BillStatus)
|
{
|
case DBUtility.ClsPub.Enum_BillStatus.BillStatus_View:
|
//浏览状态
|
yl.Enabled = true;
|
AddRow.Enabled = false;
|
DelRow.Enabled = false;
|
bc.Enabled = false;
|
cz.Enabled = false;
|
tc.Enabled = true;
|
//未审核
|
if (txtHChecker.Text.Trim() == "")
|
{
|
//未审核
|
pic1.Visible = false;
|
pic1.Image = null;
|
//
|
}
|
else if (txtHCloseMan.Text.Trim() == "" && txtHChecker.Text.Trim() != "")//审核未关闭
|
{
|
//
|
pic1.Visible = true;
|
pic1.Image = System.Drawing.Image.FromFile(ClsPub.AppPath + @"/Pic/Checked.jpg");
|
//
|
}
|
else//已关闭
|
{
|
//
|
pic1.Visible = true;
|
pic1.Image = System.Drawing.Image.FromFile(ClsPub.AppPath + @"/Pic/Closed.jpg");
|
//
|
}
|
if (txtHDeleteMan.Text.Trim() == "")
|
{
|
}
|
else //已作废
|
{
|
AddRow.Enabled = false;
|
DelRow.Enabled = false;
|
bc.Enabled = false;
|
cz.Enabled = false;
|
//
|
pic1.Visible = true;
|
pic1.Image = System.Drawing.Image.FromFile(ClsPub.AppPath + @"/Pic/Deleted.jpg");
|
//
|
}
|
Sub_LrtextStatus(false);
|
grdStatus = false;
|
break;
|
case DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew:
|
//新增状态
|
yl.Enabled = true;
|
AddRow.Enabled = true;
|
DelRow.Enabled = true;
|
bc.Enabled = true;
|
cz.Enabled = true;
|
tc.Enabled = true;
|
Sub_LrtextStatus(true);
|
grdStatus = true;
|
//未审核
|
pic1.Visible = false;
|
pic1.Image = null;
|
//
|
break;
|
case DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify:
|
//修改状态
|
yl.Enabled = true;
|
AddRow.Enabled = true;
|
DelRow.Enabled = true;
|
bc.Enabled = true;
|
cz.Enabled = true;
|
tc.Enabled = true;
|
Sub_LrtextStatus(true);
|
grdStatus = true;
|
//未审核
|
pic1.Visible = false;
|
pic1.Image = null;
|
//
|
break;
|
}
|
|
}
|
|
#endregion
|
|
#region 读写类
|
|
//单据完整性判断 未完成
|
private bool Sub_AllowSave()
|
{
|
////必输项目是否为空
|
//if (txtHDeptID.Tag.ToString().Trim() == "0")
|
//{
|
// MessageBox.Show("生产车间没有选择!", "提示");
|
// return false;
|
//}
|
//if (txtHGroupID.Tag.ToString().Trim() == "0")
|
//{
|
// MessageBox.Show("班组没有选择!", "提示");
|
// return false;
|
//}
|
//单据号是否重复
|
//if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, txtHBillNo.Text.Trim(), BillStatus, BillOld.omodel.HInterID))
|
//{
|
// MessageBox.Show("单据号重复!", "提示");
|
// return false;
|
//}
|
//明细表是否为零行
|
bool b = false;
|
for (int i = 0; i < grdMain.RowCount; i++)
|
{
|
if (!IsNullRow(i))
|
{
|
b = true;
|
break;
|
}
|
}
|
if (b == false)
|
{
|
MessageBox.Show("明细行不存在!", "提示");
|
return false;
|
}
|
for (int j = 0; j < grdMain.Rows.Count; j++)
|
{
|
if (ClsPub.isLong(grdMain.Rows[j].Cells[HMaterIDCol].Value) != 0 && (ClsPub.isDoule(grdMain.Rows[j].Cells[HQtyCol].Value) == 0 || ClsPub.isDoule(grdMain.Rows[j].Cells[HMinQtyCol].Value) == 0 || ClsPub.isDoule(grdMain.Rows[j].Cells[HBQtyCol].Value) == 0))
|
{
|
MessageBox.Show(" 第" + ClsPub.isLong(grdMain.Rows[j].Cells[HSnoCol].Value) + "行,物料:" + ClsPub.isStrNull(grdMain.Rows[j].Cells[HMaterNameCol].Value) + " ,中存在数量、最小包装数、箱数为 0,不允许生成条码!");
|
return false;
|
}
|
if (CampanyName == "韩电") //系统参数 客户定制化名称
|
{
|
if (cmbHBarCodeType.Text == "箱发条码" && ClsPub.isLong(grdMain.Rows[j].Cells[HMaterIDCol].Value) != 0 && ClsPub.isStrNull(grdMain.Rows[j].Cells[HBillNoCol].Value) == "")
|
{
|
MessageBox.Show(" 第" + ClsPub.isLong(grdMain.Rows[j].Cells[HSnoCol].Value) + "行,不允许无源单生成条码!");
|
return false;
|
}
|
if (ClsPub.isLong(grdMain.Rows[j].Cells[HMaterIDCol].Value) != 0 && ClsPub.isLong(grdMain.Rows[j].Cells[HGroupIDCol].Value) == 0)
|
{
|
MessageBox.Show(" 第" + ClsPub.isLong(grdMain.Rows[j].Cells[HSnoCol].Value) + "行,物料:" + ClsPub.isStrNull(grdMain.Rows[j].Cells[HMaterNameCol].Value) + " ,必填项班线没有选择,不允许生成条码!");
|
return false;
|
}
|
}
|
else if (CampanyName == "四维尔")
|
{
|
if (BarCodeCheckAuxPropID(ClsPub.isLong(grdMain.Rows[j].Cells[HMaterIDCol].Value)) && ClsPub.isLong(grdMain.Rows[j].Cells[HAuxPropIDCol].Value) == 0)
|
{
|
MessageBox.Show(" 第" + ClsPub.isLong(grdMain.Rows[j].Cells[HSnoCol].Value) + "行,物料:" + ClsPub.isStrNull(grdMain.Rows[j].Cells[HMaterNameCol].Value) + " ,启用了辅助属性,辅助属性列不允许为空,请先选择对应辅助属性!");
|
return false;
|
}
|
}
|
|
}
|
if (CampanyName == "森楷") //系统参数 客户定制化名称
|
{
|
if (ClsPub.isInt(txtHCaseNo.Text) <= 0)
|
{
|
MessageBox.Show(" 箱号必须为大于 0 的整数!");
|
return false;
|
}
|
else if(ClsPub.isInt(txtHCaseNo.Text) <= ClsPub.isInt(txtHCaseNo.Tag))
|
{
|
MessageBox.Show(" 所输入箱号必须大于已生成过箱号数:" + txtHCaseNo.Tag.ToString() + "!");
|
return false;
|
}
|
}
|
return true;
|
}
|
|
private bool BarCodeCheckAuxPropID(Int64 sHMaterID)
|
{
|
//判断CLOUD物料辅助属性表里该物料是否启用了物料属性(1为启用)
|
DataSet DS = oWeb.getDataSetBySQL("exec h_p_Gy_BarCodeCheckAuxPropID_CLD " + sHMaterID, "h_p_Gy_BarCodeCheckAuxPropID_CLD", ref DBUtility.ClsPub.sExeReturnInfo);
|
//
|
if (DS == null || DS.Tables[0].Rows.Count == 0)
|
{
|
return false;
|
}
|
else if (DBUtility.ClsPub.isStrNull(DS.Tables[0].Rows[0]["FISENABLE"]) == "1")
|
{
|
return true;
|
}
|
|
return false;
|
}
|
|
|
//保存单据
|
private bool Sub_SaveBill()
|
{
|
//获取内码
|
if (!oWeb.get_MaxBillID(ModName, ref HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
|
{
|
MessageBox.Show("获取内码失败,请重新点击生成按钮生成条码!");
|
return false;
|
}
|
//获取组织信息
|
HOrgID = oWeb.get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
|
HOrgNumber = oWeb.get_ORGANIZATIONSNOByName(cmbHOrgID.Text);
|
if (HOrgID == -1)
|
{
|
MessageBox.Show("选择组织有错误!");
|
return false;
|
}
|
lblCaption.Focus();
|
if (!Sub_AllowSave())//单据完整性判断
|
{
|
return false;
|
}
|
bc.Enabled = false;
|
SaveBarCode();
|
return true;
|
}
|
|
//生成条码
|
private void SaveBarCode()
|
{
|
try
|
{
|
grdSub.Rows.Clear();
|
int LSHlen = 6; //流水号长度
|
int SumLen = 10; //总长度
|
string TM = ""; //条码
|
string HNumber = ""; //物料代码
|
double HSumQty = 0; //产品数量
|
double HMinQty = 0; //最小包装数
|
int HBQty = 0; //箱数
|
double HQty = 0; //数量
|
string WeiShu = ""; //尾数
|
int LSH = 0; //流水号
|
string LSH2 = ""; //流水号转换成字符
|
string sDate = ""; //日期
|
string sYear = ""; //年
|
string sPeriod = ""; //月
|
string sDay = ""; //日
|
string HBatchNo = ""; //批次
|
int k = 0;
|
int n = 0; //同一批生成条码中的第几条
|
string HJiaYe = ""; //注液代码
|
string HGroupNumber = ""; //班组代码
|
string sTMNumber = ""; //条码自定义前缀
|
string sSeOrderNo = ""; // 销售订单号
|
DataSet Ds;
|
pb1.Value = 0;
|
for (int j = 0; j < grdMain.Rows.Count; j++)
|
{
|
Application.DoEvents();
|
if (ClsPub.isLong(grdMain.Rows[j].Cells[HMaterIDCol].Value) != 0)
|
{
|
HNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HMaterIDCol].Value);
|
HBatchNo = ClsPub.isStrNull(grdMain.Rows[j].Cells[HBatchNoCol].Value);
|
sDate = dtpHDate.Value.ToShortDateString();
|
sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2);
|
sPeriod = "0" + ClsPub.isDate(sDate).Month.ToString();
|
sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2);
|
sDay = "0" + ClsPub.isDate(sDate).Day.ToString();
|
sDay = sDay.Substring(sDay.Length - 2, 2);
|
//==================================
|
if (cmbHBarCodeType.Text == "唯一条码")
|
{
|
if (CampanyName == "韩电") //系统参数 客户定制化名称
|
{
|
#region 韩电条码生成规则
|
|
LSHlen = 4; //流水号长度
|
HNumber = grdMain.Rows[j].Cells[HMaterNumberCol].Value.ToString();
|
HJiaYe = grdMain.Rows[j].Cells[HJiaYeCol].Value.ToString();
|
HGroupNumber = grdMain.Rows[j].Cells[HGroupNumberCol].Value.ToString();
|
sSeOrderNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HSeOrderBillNoCol].Value);
|
switch (sYear)
|
{
|
case "16":
|
sYear = "1";
|
break;
|
case "17":
|
sYear = "2";
|
break;
|
case "18":
|
sYear = "3";
|
break;
|
case "19":
|
sYear = "4";
|
break;
|
case "20":
|
sYear = "5";
|
break;
|
case "21":
|
sYear = "6";
|
break;
|
case "22":
|
sYear = "7";
|
break;
|
case "23":
|
sYear = "8";
|
break;
|
case "24":
|
sYear = "9";
|
break;
|
case "25":
|
sYear = "A";
|
break;
|
case "26":
|
sYear = "B";
|
break;
|
case "27":
|
sYear = "C";
|
break;
|
case "28":
|
sYear = "D";
|
break;
|
case "29":
|
sYear = "E";
|
break;
|
case "30":
|
sYear = "F";
|
break;
|
case "31":
|
sYear = "G";
|
break;
|
case "32":
|
sYear = "H";
|
break;
|
case "33":
|
sYear = "J";
|
break;
|
case "34":
|
sYear = "K";
|
break;
|
case "35":
|
sYear = "L";
|
break;
|
default:
|
sYear = "";
|
break;
|
}
|
if (sYear == "")
|
{
|
MessageBox.Show("错误的年份!");
|
return;
|
}
|
|
switch (sPeriod)
|
{
|
case "01":
|
sPeriod = "1";
|
break;
|
case "02":
|
sPeriod = "2";
|
break;
|
case "03":
|
sPeriod = "3";
|
break;
|
case "04":
|
sPeriod = "4";
|
break;
|
case "05":
|
sPeriod = "5";
|
break;
|
case "06":
|
sPeriod = "6";
|
break;
|
case "07":
|
sPeriod = "7";
|
break;
|
case "08":
|
sPeriod = "8";
|
break;
|
case "09":
|
sPeriod = "9";
|
break;
|
case "10":
|
sPeriod = "A";
|
break;
|
case "11":
|
sPeriod = "B";
|
break;
|
case "12":
|
sPeriod = "C";
|
break;
|
default:
|
sPeriod = "";
|
break;
|
}
|
if (sPeriod == "")
|
{
|
MessageBox.Show("错误的月份!");
|
return;
|
}
|
|
switch (sDay)
|
{
|
case "01":
|
sDay = "1";
|
break;
|
case "02":
|
sDay = "2";
|
break;
|
case "03":
|
sDay = "3";
|
break;
|
case "04":
|
sDay = "4";
|
break;
|
case "05":
|
sDay = "5";
|
break;
|
case "06":
|
sDay = "6";
|
break;
|
case "07":
|
sDay = "7";
|
break;
|
case "08":
|
sDay = "8";
|
break;
|
case "09":
|
sDay = "9";
|
break;
|
case "10":
|
sDay = "A";
|
break;
|
case "11":
|
sDay = "B";
|
break;
|
case "12":
|
sDay = "C";
|
break;
|
case "13":
|
sDay = "D";
|
break;
|
case "14":
|
sDay = "E";
|
break;
|
case "15":
|
sDay = "F";
|
break;
|
case "16":
|
sDay = "G";
|
break;
|
case "17":
|
sDay = "H";
|
break;
|
case "18":
|
sDay = "J";
|
break;
|
case "19":
|
sDay = "K";
|
break;
|
case "20":
|
sDay = "L";
|
break;
|
case "21":
|
sDay = "M";
|
break;
|
case "22":
|
sDay = "N";
|
break;
|
case "23":
|
sDay = "P";
|
break;
|
case "24":
|
sDay = "Q";
|
break;
|
case "25":
|
sDay = "R";
|
break;
|
case "26":
|
sDay = "S";
|
break;
|
case "27":
|
sDay = "T";
|
break;
|
case "28":
|
sDay = "U";
|
break;
|
case "29":
|
sDay = "V";
|
break;
|
case "30":
|
sDay = "W";
|
break;
|
case "31":
|
sDay = "X";
|
break;
|
default:
|
sDay = "";
|
break;
|
}
|
if (sDay == "")
|
{
|
MessageBox.Show("错误的日期!");
|
return;
|
}
|
|
//物料代码 + 注液代码 + 班线代码 + 年份代码 + 月份代码 + 日期代码
|
sTMNumber = HNumber + HJiaYe + HGroupNumber + sYear + sPeriod + sDay;
|
//物料代码+销售订单号
|
//sTMNumber = HNumber + sSeOrderNo;
|
|
Ds = oWeb.getDataSetBySQL("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo", ref DBUtility.ClsPub.sExeReturnInfo);//获取最大流水号
|
LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
|
|
#endregion
|
}
|
else if (CampanyName == "飞龙")
|
{
|
string HWorksNumber = "";
|
HWorksNumber = cmbHWorksNumber.Text;
|
if (HWorksNumber == "")
|
{
|
MessageBox.Show("工厂代码不能为空!");
|
return;
|
}
|
//条码前缀 = 工厂代码 + 物料内码 + 日期
|
sTMNumber = HWorksNumber + HNumber + sYear + sPeriod + sDay;
|
Ds = oWeb.getDataSetBySQL("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo", ref DBUtility.ClsPub.sExeReturnInfo);//获取最大流水号
|
LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
|
}
|
else if (CampanyName == "圣龙")
|
{
|
LSHlen = 3; //流水号长度
|
HNumber = grdMain.Rows[j].Cells[HMaterNumberCol].Value.ToString();
|
sSeOrderNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HBillNoCol].Value); // 生产订单号
|
if (DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HBillTypeCol].Value).ToString() != "3710")
|
{
|
MessageBox.Show("唯一条码必须为有源单条码,且源单类型为生产订单,请确认源单信息是否正确!");
|
return;
|
}
|
//条码前缀 = 生产订单 + 物料代码 + 批次
|
sTMNumber = sSeOrderNo + ";" + HNumber + ";" + HBatchNo;
|
Ds = oWeb.getDataSetBySQL("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo", ref DBUtility.ClsPub.sExeReturnInfo);//获取最大流水号
|
LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
|
}
|
else //通用方法
|
{
|
//条码前缀 = 组织代码 + 物料内码 + 年 + 月 + 日
|
sTMNumber = HOrgNumber + HNumber + sYear + sPeriod + sDay;
|
Ds = oWeb.getDataSetBySQL("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo", ref DBUtility.ClsPub.sExeReturnInfo);//获取最大流水号
|
LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
|
}
|
}
|
else if (cmbHBarCodeType.Text == "品种条码")
|
{
|
if (CampanyName == "五云") //系统参数 客户定制化名称
|
{
|
TM = HNumber + ";" + DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HMTONoCol].Value);
|
}
|
else if (CampanyName == "四维尔")
|
{
|
//条码编号 = 组织代码 + 物料内码 +辅助属性内码
|
TM = HOrgNumber + HNumber + ";" + DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HAuxPropIDCol].Value);
|
}
|
else
|
{
|
TM = HOrgNumber + HNumber;
|
}
|
}
|
else if (cmbHBarCodeType.Text == "批次条码")
|
{
|
if (CampanyName == "圣龙") //系统参数 客户定制化名称
|
{
|
//采购订单号为空,则取源单单号
|
string sPOOrderBillNo = "";
|
if (DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[POOrderBillNoCol].Value).ToString() == "")
|
{
|
sPOOrderBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HBillNoCol].Value).ToString();
|
}
|
else
|
{
|
sPOOrderBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[POOrderBillNoCol].Value).ToString();
|
}
|
HNumber = grdMain.Rows[j].Cells[HMaterNumberCol].Value.ToString();
|
|
//条码编号 = 采购订单号;物料代码;批次;数量
|
sTMNumber = sPOOrderBillNo + ";" + HNumber + ";" + HBatchNo;
|
}
|
else
|
{
|
TM = HOrgNumber + HNumber + HBatchNo;
|
}
|
}
|
else if (CampanyName == "韩电" && cmbHBarCodeType.Text == "奥克斯条码")
|
{
|
#region 韩电条码生成规则 奥克斯条码
|
|
LSHlen = 4; //流水号长度
|
HNumber = grdMain.Rows[j].Cells[HMaterNumberCol].Value.ToString();
|
HJiaYe = grdMain.Rows[j].Cells[HJiaYeCol].Value.ToString();
|
HGroupNumber = grdMain.Rows[j].Cells[HGroupNumberCol].Value.ToString();
|
switch (sYear)
|
{
|
case "20":
|
HNumber = HNumber.Substring(0, 1) + "000A" + HNumber.Substring(5);
|
break;
|
case "21":
|
HNumber = HNumber.Substring(0, 1) + "000B" + HNumber.Substring(5);
|
break;
|
case "22":
|
HNumber = HNumber.Substring(0, 1) + "000C" + HNumber.Substring(5);
|
break;
|
case "23":
|
HNumber = HNumber.Substring(0, 1) + "000D" + HNumber.Substring(5);
|
break;
|
case "24":
|
HNumber = HNumber.Substring(0, 1) + "000E" + HNumber.Substring(5);
|
break;
|
}
|
if (sYear == "")
|
{
|
MessageBox.Show("错误的年份!");
|
return;
|
}
|
|
sYear = "4";
|
switch (sPeriod)
|
{
|
case "01":
|
sPeriod = "1";
|
break;
|
case "02":
|
sPeriod = "2";
|
break;
|
case "03":
|
sPeriod = "3";
|
break;
|
case "04":
|
sPeriod = "4";
|
break;
|
case "05":
|
sPeriod = "5";
|
break;
|
case "06":
|
sPeriod = "6";
|
break;
|
case "07":
|
sPeriod = "7";
|
break;
|
case "08":
|
sPeriod = "8";
|
break;
|
case "09":
|
sPeriod = "9";
|
break;
|
case "10":
|
sPeriod = "A";
|
break;
|
case "11":
|
sPeriod = "B";
|
break;
|
case "12":
|
sPeriod = "C";
|
break;
|
default:
|
sPeriod = "";
|
break;
|
}
|
if (sPeriod == "")
|
{
|
MessageBox.Show("错误的月份!");
|
return;
|
}
|
|
switch (sDay)
|
{
|
case "01":
|
sDay = "1";
|
break;
|
case "02":
|
sDay = "2";
|
break;
|
case "03":
|
sDay = "3";
|
break;
|
case "04":
|
sDay = "4";
|
break;
|
case "05":
|
sDay = "5";
|
break;
|
case "06":
|
sDay = "6";
|
break;
|
case "07":
|
sDay = "7";
|
break;
|
case "08":
|
sDay = "8";
|
break;
|
case "09":
|
sDay = "9";
|
break;
|
case "10":
|
sDay = "A";
|
break;
|
case "11":
|
sDay = "B";
|
break;
|
case "12":
|
sDay = "C";
|
break;
|
case "13":
|
sDay = "D";
|
break;
|
case "14":
|
sDay = "E";
|
break;
|
case "15":
|
sDay = "F";
|
break;
|
case "16":
|
sDay = "G";
|
break;
|
case "17":
|
sDay = "H";
|
break;
|
case "18":
|
sDay = "J";
|
break;
|
case "19":
|
sDay = "K";
|
break;
|
case "20":
|
sDay = "L";
|
break;
|
case "21":
|
sDay = "M";
|
break;
|
case "22":
|
sDay = "N";
|
break;
|
case "23":
|
sDay = "P";
|
break;
|
case "24":
|
sDay = "Q";
|
break;
|
case "25":
|
sDay = "R";
|
break;
|
case "26":
|
sDay = "S";
|
break;
|
case "27":
|
sDay = "T";
|
break;
|
case "28":
|
sDay = "U";
|
break;
|
case "29":
|
sDay = "V";
|
break;
|
case "30":
|
sDay = "W";
|
break;
|
case "31":
|
sDay = "X";
|
break;
|
default:
|
sDay = "";
|
break;
|
}
|
if (sDay == "")
|
{
|
MessageBox.Show("错误的日期!");
|
return;
|
}
|
|
//物料代码 + 注液代码 + 班线代码 + 年份代码 + 月份代码 + 日期代码
|
sTMNumber = HNumber + HJiaYe + HGroupNumber + sYear + sPeriod + sDay;
|
//
|
|
|
Ds = oWeb.getDataSetBySQL("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo", ref DBUtility.ClsPub.sExeReturnInfo);//获取最大流水号
|
LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
|
|
#endregion
|
}
|
else if (CampanyName == "韩电" && cmbHBarCodeType.Text == "箱发条码")
|
{
|
#region 韩电条码生成规则 箱发条码
|
|
string HNewNumber = ""; //物料代码(去掉点)
|
LSHlen = 4; //流水号长度
|
HNumber = grdMain.Rows[j].Cells[HMaterNumberCol].Value.ToString();
|
HNewNumber = HNumber.Replace(".", "");
|
|
sDate = grdMain.Rows[j].Cells[HDateCol].Value.ToString();
|
sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2);
|
sPeriod = "0" + ClsPub.isDate(sDate).Month.ToString();
|
sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2);
|
sDay = "0" + ClsPub.isDate(sDate).Day.ToString();
|
sDay = sDay.Substring(sDay.Length - 2, 2);
|
|
switch (sYear)
|
{
|
case "16":
|
sYear = "1";
|
break;
|
case "17":
|
sYear = "2";
|
break;
|
case "18":
|
sYear = "3";
|
break;
|
case "19":
|
sYear = "4";
|
break;
|
case "20":
|
sYear = "5";
|
break;
|
case "21":
|
sYear = "6";
|
break;
|
case "22":
|
sYear = "7";
|
break;
|
case "23":
|
sYear = "8";
|
break;
|
case "24":
|
sYear = "9";
|
break;
|
case "25":
|
sYear = "A";
|
break;
|
case "26":
|
sYear = "B";
|
break;
|
case "27":
|
sYear = "C";
|
break;
|
case "28":
|
sYear = "D";
|
break;
|
case "29":
|
sYear = "E";
|
break;
|
case "30":
|
sYear = "F";
|
break;
|
case "31":
|
sYear = "G";
|
break;
|
case "32":
|
sYear = "H";
|
break;
|
case "33":
|
sYear = "J";
|
break;
|
case "34":
|
sYear = "K";
|
break;
|
case "35":
|
sYear = "L";
|
break;
|
default:
|
sYear = "";
|
break;
|
}
|
if (sYear == "")
|
{
|
MessageBox.Show("错误的年份!");
|
return;
|
}
|
|
switch (sPeriod)
|
{
|
case "01":
|
sPeriod = "1";
|
break;
|
case "02":
|
sPeriod = "2";
|
break;
|
case "03":
|
sPeriod = "3";
|
break;
|
case "04":
|
sPeriod = "4";
|
break;
|
case "05":
|
sPeriod = "5";
|
break;
|
case "06":
|
sPeriod = "6";
|
break;
|
case "07":
|
sPeriod = "7";
|
break;
|
case "08":
|
sPeriod = "8";
|
break;
|
case "09":
|
sPeriod = "9";
|
break;
|
case "10":
|
sPeriod = "A";
|
break;
|
case "11":
|
sPeriod = "B";
|
break;
|
case "12":
|
sPeriod = "C";
|
break;
|
default:
|
sPeriod = "";
|
break;
|
}
|
if (sPeriod == "")
|
{
|
MessageBox.Show("错误的月份!");
|
return;
|
}
|
|
switch (sDay)
|
{
|
case "01":
|
sDay = "1";
|
break;
|
case "02":
|
sDay = "2";
|
break;
|
case "03":
|
sDay = "3";
|
break;
|
case "04":
|
sDay = "4";
|
break;
|
case "05":
|
sDay = "5";
|
break;
|
case "06":
|
sDay = "6";
|
break;
|
case "07":
|
sDay = "7";
|
break;
|
case "08":
|
sDay = "8";
|
break;
|
case "09":
|
sDay = "9";
|
break;
|
case "10":
|
sDay = "A";
|
break;
|
case "11":
|
sDay = "B";
|
break;
|
case "12":
|
sDay = "C";
|
break;
|
case "13":
|
sDay = "D";
|
break;
|
case "14":
|
sDay = "E";
|
break;
|
case "15":
|
sDay = "F";
|
break;
|
case "16":
|
sDay = "G";
|
break;
|
case "17":
|
sDay = "H";
|
break;
|
case "18":
|
sDay = "J";
|
break;
|
case "19":
|
sDay = "K";
|
break;
|
case "20":
|
sDay = "L";
|
break;
|
case "21":
|
sDay = "M";
|
break;
|
case "22":
|
sDay = "N";
|
break;
|
case "23":
|
sDay = "P";
|
break;
|
case "24":
|
sDay = "Q";
|
break;
|
case "25":
|
sDay = "R";
|
break;
|
case "26":
|
sDay = "S";
|
break;
|
case "27":
|
sDay = "T";
|
break;
|
case "28":
|
sDay = "U";
|
break;
|
case "29":
|
sDay = "V";
|
break;
|
case "30":
|
sDay = "W";
|
break;
|
case "31":
|
sDay = "X";
|
break;
|
default:
|
sDay = "";
|
break;
|
}
|
if (sDay == "")
|
{
|
MessageBox.Show("错误的日期!");
|
return;
|
}
|
|
//条码编码 = 物料编码(去点)+ 任务单日期(同成品) + 4位流水号
|
sTMNumber = HNewNumber + sYear + sPeriod + sDay;
|
Ds = oWeb.getDataSetBySQL("exec h_p_WMS_GetMaxNo '" + sTMNumber + "'", "h_p_WMS_GetMaxNo", ref DBUtility.ClsPub.sExeReturnInfo);//获取最大流水号
|
LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
|
|
#endregion
|
}
|
else
|
{
|
MessageBox.Show("错误的条码类型,不能生成条码!");
|
return;
|
}
|
|
HBQty = HBQty + ClsPub.isInt(grdMain.Rows[j].Cells[HBQtyCol].Value);
|
HMinQty = ClsPub.isDoule(grdMain.Rows[j].Cells[HMinQtyCol].Value);
|
HSumQty = ClsPub.isDoule(grdMain.Rows[j].Cells[HQtyCol].Value);
|
n = 0;
|
pb1.Value = 0;
|
pb1.Maximum = HBQty;
|
//
|
string[] sSQLNoMul = new string[ClsPub.isInt(grdMain.Rows[j].Cells[HBQtyCol].Value)];
|
int nn = 0;
|
//
|
for (int i = k; i < HBQty; i++) //从K到总包数, 是累加的方式
|
{
|
Application.DoEvents();
|
pb1.Value = i;
|
Application.DoEvents();
|
if (HSumQty - HMinQty > 0)
|
{
|
WeiShu = "";
|
HSumQty = HSumQty - HMinQty;
|
}
|
else
|
{
|
if (HSumQty == HMinQty)
|
{
|
WeiShu = "";
|
}
|
else
|
{
|
WeiShu = "尾数";
|
}
|
HMinQty = HSumQty;
|
}
|
LSH = LSH + 1;
|
LSH2 = LSH.ToString();
|
while (LSH2.Length < LSHlen) //如果流水号小于6位数前面补0
|
{
|
LSH2 = "0" + LSH2;
|
}
|
|
if (CampanyName == "圣龙")
|
{
|
if (cmbHBarCodeType.Text == "唯一条码")
|
{
|
//条码编号 = 生产订单;物料代码;批次;托号;数量
|
TM = sTMNumber + ";" + LSH2 + ";" + HMinQty;
|
}
|
else if (cmbHBarCodeType.Text == "批次条码")
|
{
|
//条码编号 = 采购订单号;物料代码;批次;数量
|
TM = sTMNumber + ";" + HMinQty;
|
}
|
}
|
else if (cmbHBarCodeType.Text == "唯一条码" || cmbHBarCodeType.Text == "奥克斯条码" || cmbHBarCodeType.Text == "箱发条码")
|
{
|
//条码编号 = 条码前缀 + 流水号
|
TM = sTMNumber + LSH2;
|
}
|
|
if (CampanyName == "韩电" && cmbHBarCodeType.Text != "箱发条码") //系统参数 客户定制化名称
|
{
|
//条码编号一共24位,由产品代码(12位)、注液代码(4位)、班线代码(1位)、年份代码(1位)、月份代码(1位)、日期代码(1位)、顺序号(4位)七个部分组成
|
int TMbyteLen = System.Text.Encoding.Default.GetByteCount(TM);
|
if (TMbyteLen != 24)
|
{
|
MessageBox.Show("生成条码编号格式不正确,必须由24位组成!请确保产品代码(12位)、注液代码(4位)、班线代码(1位)位数正确后,再重新生成条码!");
|
return;
|
}
|
}
|
|
if (i + 1 > grdSub.Rows.Count)
|
{
|
grdSub.RowCount = grdSub.RowCount + 1;
|
}
|
grdSub.Rows[i].Cells[HSno2Col].Value = ClsPub.isStrNull(i + 1);
|
if (TM.Trim() == "")
|
{
|
MessageBox.Show("条形码不能为空,不能生成条码!");
|
return;
|
}
|
grdSub.Rows[i].Cells[HTMCol].Value = TM;
|
grdSub.Rows[i].Cells[HMaterID2Col].Value = grdMain.Rows[j].Cells[HMaterIDCol].Value;
|
grdSub.Rows[i].Cells[HMaterNumber2Col].Value = grdMain.Rows[j].Cells[HMaterNumberCol].Value;
|
grdSub.Rows[i].Cells[HMaterName2Col].Value = grdMain.Rows[j].Cells[HMaterNameCol].Value;
|
grdSub.Rows[i].Cells[HMaterModel2Col].Value = grdMain.Rows[j].Cells[HMaterModelCol].Value;
|
grdSub.Rows[i].Cells[HPinfan2Col].Value = grdMain.Rows[j].Cells[HPinfanCol].Value;
|
grdSub.Rows[i].Cells[HPinfanBarCode2Col].Value = grdMain.Rows[j].Cells[HPinfanBarCodeCol].Value;
|
|
grdSub.Rows[i].Cells[HAuxPropID2Col].Value = grdMain.Rows[j].Cells[HAuxPropIDCol].Value;
|
grdSub.Rows[i].Cells[HAuxPropNumber2Col].Value = grdMain.Rows[j].Cells[HAuxPropNumberCol].Value;
|
grdSub.Rows[i].Cells[HAuxPropName2Col].Value = grdMain.Rows[j].Cells[HAuxPropNameCol].Value;
|
|
grdSub.Rows[i].Cells[HUnitID2Col].Value = grdMain.Rows[j].Cells[HUnitIDCol].Value;
|
grdSub.Rows[i].Cells[HUnitNumber2Col].Value = grdMain.Rows[j].Cells[HUnitNumberCol].Value;
|
grdSub.Rows[i].Cells[HUnitName2Col].Value = grdMain.Rows[j].Cells[HUnitNameCol].Value;
|
|
grdSub.Rows[i].Cells[HGroupID2Col].Value = grdMain.Rows[j].Cells[HGroupIDCol].Value;
|
grdSub.Rows[i].Cells[HGroupNumber2Col].Value = grdMain.Rows[j].Cells[HGroupNumberCol].Value;
|
grdSub.Rows[i].Cells[HGroupName2Col].Value = grdMain.Rows[j].Cells[HGroupNameCol].Value;
|
|
grdSub.Rows[i].Cells[HQty2Col].Value = HMinQty;
|
grdSub.Rows[i].Cells[HBatchNo2Col].Value = grdMain.Rows[j].Cells[HBatchNoCol].Value;
|
grdSub.Rows[i].Cells[HSourceInterID2Col].Value = grdMain.Rows[j].Cells[HMainIDCol].Value;
|
grdSub.Rows[i].Cells[HSourceEntryID2Col].Value = grdMain.Rows[j].Cells[HSubIDCol].Value;
|
grdSub.Rows[i].Cells[HSourceBillNo2Col].Value = grdMain.Rows[j].Cells[HBillNoCol].Value;
|
grdSub.Rows[i].Cells[HSourceBillType2Col].Value = grdMain.Rows[j].Cells[HBillTypeCol].Value;
|
grdSub.Rows[i].Cells[HPrintCol].Value = "0";
|
grdSub.Rows[i].Cells[HWeiCol].Value = WeiShu;
|
grdSub.Rows[i].Cells[HBarcodeNoCol].Value = n + 1;
|
grdSub.Rows[i].Cells[HBarcodeQtysCol].Value = grdMain.Rows[j].Cells[HBQtyCol].Value;
|
grdSub.Rows[i].Cells[HSupID2Col].Value = grdMain.Rows[j].Cells[HSupIDCol].Value;
|
grdSub.Rows[i].Cells[HSupNumber2Col].Value = grdMain.Rows[j].Cells[HSupNumberCol].Value;
|
grdSub.Rows[i].Cells[HSupName2Col].Value = grdMain.Rows[j].Cells[HSupNameCol].Value;
|
grdSub.Rows[i].Cells[HDeptID2Col].Value = grdMain.Rows[j].Cells[HDeptIDCol].Value;
|
grdSub.Rows[i].Cells[HDeptNumber2Col].Value = grdMain.Rows[j].Cells[HDeptNumberCol].Value;
|
grdSub.Rows[i].Cells[HDeptName2Col].Value = grdMain.Rows[j].Cells[HDeptNameCol].Value;
|
grdSub.Rows[i].Cells[HRemark2Col].Value = grdMain.Rows[j].Cells[HRemarkCol].Value;
|
grdSub.Rows[i].Cells[HDate2Col].Value = grdMain.Rows[j].Cells[HDateCol].Value;
|
grdSub.Rows[i].Cells[HWhID2Col].Value = grdMain.Rows[j].Cells[HWhIDCol].Value;
|
grdSub.Rows[i].Cells[HWhNumber2Col].Value = grdMain.Rows[j].Cells[HWhNumberCol].Value;
|
grdSub.Rows[i].Cells[HWhName2Col].Value = grdMain.Rows[j].Cells[HWhNameCol].Value;
|
grdSub.Rows[i].Cells[HSPID2Col].Value = grdMain.Rows[j].Cells[HSPIDCol].Value;
|
grdSub.Rows[i].Cells[HSPNumber2Col].Value = grdMain.Rows[j].Cells[HSPNumberCol].Value;
|
grdSub.Rows[i].Cells[HSPName2Col].Value = grdMain.Rows[j].Cells[HSPNameCol].Value;
|
grdSub.Rows[i].Cells[HMTONo2Col].Value = grdMain.Rows[j].Cells[HMTONoCol].Value;
|
grdSub.Rows[i].Cells[HCusID2Col].Value = grdMain.Rows[j].Cells[HCusIDCol].Value;
|
grdSub.Rows[i].Cells[HCusNumber2Col].Value = grdMain.Rows[j].Cells[HCusNumberCol].Value;
|
grdSub.Rows[i].Cells[HCusName2Col].Value = grdMain.Rows[j].Cells[HCusNameCol].Value;
|
grdSub.Rows[i].Cells[HCusType2Col].Value = grdMain.Rows[j].Cells[HCusTypeCol].Value;
|
grdSub.Rows[i].Cells[HSourceID2Col].Value = grdMain.Rows[j].Cells[HSourceIDCol].Value;
|
grdSub.Rows[i].Cells[HSourceNumber2Col].Value = grdMain.Rows[j].Cells[HSourceNumberCol].Value;
|
grdSub.Rows[i].Cells[HSourceName2Col].Value = grdMain.Rows[j].Cells[HSourceNameCol].Value;
|
grdSub.Rows[i].Cells[HBeginDate2Col].Value = grdMain.Rows[j].Cells[HBeginDateCol].Value;
|
grdSub.Rows[i].Cells[HEndDate2Col].Value = grdMain.Rows[j].Cells[HEndDateCol].Value;
|
grdSub.Rows[i].Cells[HSeOrderBillNo2Col].Value = grdMain.Rows[j].Cells[HSeOrderBillNoCol].Value;
|
grdSub.Rows[i].Cells[HModel2Col].Value = grdMain.Rows[j].Cells[HModelCol].Value;
|
grdSub.Rows[i].Cells[HColor2Col].Value = grdMain.Rows[j].Cells[HColorCol].Value;
|
grdSub.Rows[i].Cells[HJiaYe2Col].Value = grdMain.Rows[j].Cells[HJiaYeCol].Value;
|
grdSub.Rows[i].Cells[HPackageSize2Col].Value = grdMain.Rows[j].Cells[HPackageSizeCol].Value;
|
grdSub.Rows[i].Cells[HJQty2Col].Value = grdMain.Rows[j].Cells[HJQtyCol].Value;
|
grdSub.Rows[i].Cells[HMQty2Col].Value = grdMain.Rows[j].Cells[HMQtyCol].Value;
|
grdSub.Rows[i].Cells[HLogo2Col].Value = grdMain.Rows[j].Cells[HLogoCol].Value;
|
grdSub.Rows[i].Cells[HCusModel2Col].Value = grdMain.Rows[j].Cells[HCusModelCol].Value;
|
grdSub.Rows[i].Cells[HPressModel2Col].Value = grdMain.Rows[j].Cells[HPressModelCol].Value;
|
grdSub.Rows[i].Cells[HMakeDate2Col].Value = sDate;
|
grdSub.Rows[i].Cells[HCustomBatchNo2Col].Value = grdMain.Rows[j].Cells[HCustomBatchNoCol].Value;
|
grdSub.Rows[i].Cells[HGBBarCode2Col].Value = grdMain.Rows[j].Cells[HGBBarCodeCol].Value;
|
grdSub.Rows[i].Cells[HJiaYeLX2Col].Value = grdMain.Rows[j].Cells[HJiaYeLXCol].Value;
|
grdSub.Rows[i].Cells[HJiaYeL2Col].Value = grdMain.Rows[j].Cells[HJiaYeLCol].Value;
|
grdSub.Rows[i].Cells[POOrderBillNo2Col].Value = grdMain.Rows[j].Cells[POOrderBillNoCol].Value;
|
grdSub.Rows[i].Cells[HBarCode_Pack2Col].Value = grdMain.Rows[j].Cells[HBarCode_PackCol].Value;
|
grdSub.Rows[i].Cells[HCustomQty12Col].Value = ClsPub.isLong(txtHCaseNo.Text) + i;
|
k = k + 1;
|
n = n + 1;
|
//oWeb.getRunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'", ref DBUtility.ClsPub.sExeReturnInfo);
|
sSQLNoMul[nn] = " exec h_p_WMS_SetMaxNo '" + sTMNumber + "' ";
|
nn = nn + 1;
|
}
|
//后台批量执行语句
|
if (oWeb.getRunProcByMul_Back(sSQLNoMul, ref DBUtility.ClsPub.sExeReturnInfo) == false)
|
{
|
MessageBox.Show("条码生成失败,批量生成流水号失败!");
|
return;
|
}
|
//
|
}
|
}
|
if (CampanyName == "森楷") //系统参数 客户定制化名称
|
{
|
string sHGroupID = ""; //班组
|
string sHBatchNo = ""; //批次
|
string HDate = ""; //日期
|
string sCaseNoNumber = ""; //箱号前缀
|
int sCaseNo = 0; //箱号
|
sHGroupID = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HGroupIDCol].Value);
|
sHBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HBatchNoCol].Value);
|
HDate = dtpHDate.Value.ToShortDateString();
|
sCaseNo = ClsPub.isInt(txtHCaseNo.Text) + grdSub.Rows.Count - 1;
|
|
//箱号前缀 = 班组ID + 批次 + 日期
|
sCaseNoNumber = sHGroupID + sHBatchNo + HDate;
|
oWeb.getRunProc("Exec h_p_WMS_SetBarCodeNoByEmp '" + sCaseNoNumber + "'," + sCaseNo, ref DBUtility.ClsPub.sExeReturnInfo);
|
}
|
|
string HWei = ""; //尾数
|
string HBarCode = "";
|
string HBarCode_Pack = "";
|
string HBarCodeType = "";
|
Int64 HMaterID = 0;
|
Int64 HAuxPropID = 0;
|
Int64 HUnitID = 0;
|
double HQty2 = 0;
|
string HBatchNo2 = "";
|
Int64 HSupID = 0;
|
Int64 HGroupID = 0;
|
int HPrintQty = 0;
|
Int64 HSourceInterID = 0;
|
Int64 HSourceEntryID = 0;
|
string HSourceBillNo = "";
|
string HSourceBillType = "";
|
Int64 HBarcodeNo = 0; //托号
|
Int64 HBarcodeQtys = 0; //总托数
|
Int64 HDeptID = 0;
|
Int64 HWhID = 0;
|
Int64 HSPID = 0;
|
string HRemark = "";
|
string HMaterName = "";
|
string HMaterModel = "";
|
string HPinfan = "";
|
string HMTONo = "";
|
Int64 HCusID = 0;
|
string HCusType = "";
|
DateTime HEndDate;
|
string HWorkLineName = "";
|
DateTime HBeginDate;
|
string HSeOrderBillNo = "";
|
string HJiaYe2 = "";
|
string HPressModel = "";
|
string HCusModel = "";
|
string HMaterialModel = "";
|
string HColor = "";
|
string HLogo = "";
|
string HPackageSize = "";
|
double HMaterialJQty = 0;
|
double HMaterialMQty = 0;
|
string HCustomBatchNo = "";
|
string HGBBarCode = "";
|
string POOrderBillNo = "";
|
long HCustomQty1 = 0;
|
|
string[] sSQLMul = new string[grdSub.Rows.Count];
|
|
pb1.Maximum = grdSub.Rows.Count;
|
int mm = 0;
|
for (int i = 0; i < grdSub.Rows.Count; i++)
|
{
|
Application.DoEvents();
|
pb1.Value = i + 1;
|
Application.DoEvents();
|
if (ClsPub.isLong(grdSub.Rows[i].Cells[HMaterID2Col].Value) != 0)
|
{
|
HWei = ClsPub.isStrNull(grdSub.Rows[i].Cells[HWeiCol].Value);
|
HBarCode = ClsPub.isStrNull(grdSub.Rows[i].Cells[HTMCol].Value);
|
if (cmbHBarCodeType.Text == "奥克斯条码")
|
{
|
HBarCodeType = "唯一条码";
|
HRemark = "奥克斯条码";
|
}
|
else if (cmbHBarCodeType.Text == "箱发条码")
|
{
|
HBarCodeType = "唯一条码";
|
HRemark = "箱发条码";
|
}
|
else
|
{
|
HBarCodeType = ClsPub.isStrNull(cmbHBarCodeType.Text);
|
HRemark = ClsPub.isStrNull(grdSub.Rows[i].Cells[HRemark2Col].Value);
|
}
|
|
HMaterID = ClsPub.isLong(grdSub.Rows[i].Cells[HMaterID2Col].Value);
|
HAuxPropID = ClsPub.isLong(grdSub.Rows[i].Cells[HAuxPropID2Col].Value);
|
HUnitID = ClsPub.isLong(grdSub.Rows[i].Cells[HUnitID2Col].Value);
|
HQty2 = ClsPub.isDoule(grdSub.Rows[i].Cells[HQty2Col].Value);
|
HBatchNo2 = ClsPub.isStrNull(grdSub.Rows[i].Cells[HBatchNo2Col].Value);
|
HSourceInterID = ClsPub.isLong(grdSub.Rows[i].Cells[HSourceInterID2Col].Value);
|
HSourceEntryID = ClsPub.isLong(grdSub.Rows[i].Cells[HSourceEntryID2Col].Value);
|
HSourceBillNo = ClsPub.isStrNull(grdSub.Rows[i].Cells[HSourceBillNo2Col].Value);
|
HSourceBillType = ClsPub.isStrNull(grdSub.Rows[i].Cells[HSourceBillType2Col].Value);
|
HBarcodeQtys = ClsPub.isLong(grdSub.Rows[i].Cells[HBarcodeQtysCol].Value);
|
HBarcodeNo = ClsPub.isLong(grdSub.Rows[i].Cells[HBarcodeNoCol].Value);
|
HSupID = ClsPub.isLong(grdSub.Rows[i].Cells[HSupID2Col].Value);
|
HDeptID = ClsPub.isLong(grdSub.Rows[i].Cells[HDeptID2Col].Value);
|
HWhID = ClsPub.isLong(grdSub.Rows[i].Cells[HWhID2Col].Value);
|
HSPID = ClsPub.isLong(grdSub.Rows[i].Cells[HSPID2Col].Value);
|
//HRemark = ClsPub.isStrNull(grdSub.Rows[i].Cells[HRemark2Col].Value);
|
HMaterName = ClsPub.isStrNull(grdSub.Rows[i].Cells[HMaterName2Col].Value);
|
HMaterModel = ClsPub.isStrNull(grdSub.Rows[i].Cells[HMaterModel2Col].Value);
|
HPinfan = ClsPub.isStrNull(grdSub.Rows[i].Cells[HPinfan2Col].Value);
|
HMTONo = ClsPub.isStrNull(grdSub.Rows[i].Cells[HMTONo2Col].Value);
|
HCusID = ClsPub.isLong(grdSub.Rows[i].Cells[HCusID2Col].Value);
|
HCusType = ClsPub.isStrNull(grdSub.Rows[i].Cells[HCusType2Col].Value);
|
HEndDate = ClsPub.isDate(grdSub.Rows[i].Cells[HEndDate2Col].Value);
|
HWorkLineName = ClsPub.isStrNull(grdSub.Rows[i].Cells[HSourceName2Col].Value);
|
HBeginDate = ClsPub.isDate(grdSub.Rows[i].Cells[HBeginDate2Col].Value);
|
HSeOrderBillNo = ClsPub.isStrNull(grdSub.Rows[i].Cells[HSeOrderBillNo2Col].Value);
|
HGroupID = ClsPub.isLong(grdSub.Rows[i].Cells[HGroupID2Col].Value);
|
HJiaYe2 = ClsPub.isStrNull(grdSub.Rows[i].Cells[HJiaYe2Col].Value);
|
HPressModel = ClsPub.isStrNull(grdSub.Rows[i].Cells[HPressModel2Col].Value);
|
HCusModel = ClsPub.isStrNull(grdSub.Rows[i].Cells[HCusModel2Col].Value);
|
HMaterialModel = ClsPub.isStrNull(grdSub.Rows[i].Cells[HModel2Col].Value);
|
HColor = ClsPub.isStrNull(grdSub.Rows[i].Cells[HColor2Col].Value);
|
HLogo = ClsPub.isStrNull(grdSub.Rows[i].Cells[HLogo2Col].Value);
|
HPackageSize = ClsPub.isStrNull(grdSub.Rows[i].Cells[HPackageSize2Col].Value);
|
HMaterialJQty = ClsPub.isDoule(grdSub.Rows[i].Cells[HJQty2Col].Value);
|
HMaterialMQty = ClsPub.isDoule(grdSub.Rows[i].Cells[HMQty2Col].Value);
|
HCustomBatchNo = ClsPub.isStrNull(grdSub.Rows[i].Cells[HCustomBatchNo2Col].Value);
|
HGBBarCode = ClsPub.isStrNull(grdSub.Rows[i].Cells[HGBBarCode2Col].Value);
|
POOrderBillNo = ClsPub.isStrNull(grdSub.Rows[i].Cells[POOrderBillNo2Col].Value);
|
HBarCode_Pack = ClsPub.isStrNull(grdSub.Rows[i].Cells[HBarCode_Pack2Col].Value);
|
HCustomQty1 = ClsPub.isLong(grdSub.Rows[i].Cells[HCustomQty12Col].Value);
|
sSQLMul[mm] = "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
|
",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
|
",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
|
",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
|
",HCusID,HCusType,HEndDate,HWorkLineName,HJiaYe " +
|
",HPressModel,HCusModel,HMaterialModel,HColor,HBarCodeDate " +
|
",HLogo,HPackageSize,HMaterialJQty,HMaterialMQty,HCustomBatchNo " +
|
",HSTOCKORGID,HOWNERID,HBeginDate,HSeOrderBillNo,HGBBarCode " +
|
",POOrderBillNo,HInterID,HInitSourceEntryID,HBarCode_Pack " +
|
",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo " +
|
",HCustomQty1 " +
|
") values ("
|
+ "'" + HBarCode + "','" + HBarCodeType + "'," + HMaterID.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString()
|
+ ",'" + HBatchNo2 + "'," + HSupID.ToString() + "," + HGroupID.ToString() + ",'" + ClsPub.CurUserName + "',getdate()," + HPrintQty.ToString() + "," + HQty2.ToString()
|
+ ", " + HSourceInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HSourceBillNo + "','" + HSourceBillType + "','" + HWei + "'"
|
+ ", " + HBarcodeQtys.ToString() + "," + HBarcodeNo.ToString() + "," + HDeptID.ToString() + "," + HWhID.ToString() + "," + HSPID.ToString() + ",'" + HRemark + "'"
|
+ ", " + HCusID.ToString() + ",'" + HCusType + "','" + HEndDate.ToShortDateString() + "','" + HWorkLineName + "','" + HJiaYe2 + "'"
|
+ ",'" + HPressModel + "','" + HCusModel + "','" + HMaterialModel + "','" + HColor + "','" + sDate + "'"
|
+ ",'" + HLogo + "','" + HPackageSize + "'," + HMaterialJQty.ToString() + "," + HMaterialMQty.ToString() + ",'" + HCustomBatchNo + "'"
|
+ ", " + HOrgID.ToString() + "," + HOrgID.ToString() + ",'" + HBeginDate.ToShortDateString() + "','" + HSeOrderBillNo + "','" + HGBBarCode + "'"
|
+ ",'" + POOrderBillNo + "'," + HInterID.ToString() + "," + HSourceEntryID.ToString() + ",'" + HBarCode_Pack + "'"
|
+ ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "'"
|
+ ", " + HCustomQty1.ToString() + ")";
|
//oCn.RunProc("exec setLSH '" + ClsPub.GetServerDate(0) + "'");
|
mm = mm + 1;
|
Application.DoEvents();
|
////oWeb.getRunProc("exec setLSH '" + sTMNumber + "'", ref DBUtility.ClsPub.sExeReturnInfo);
|
//sSQLMul[mm] = "exec h_p_WMS_SetMaxNo '" + sTMNumber + "'";
|
//mm = mm + 1;
|
Application.DoEvents();
|
}
|
}
|
//
|
if (CampanyName == "森楷") //系统参数 客户定制化名称
|
{
|
oWeb.getRunProc("exec h_p_WMS_BarCodeBackToOtherInRepuest " + HInterID.ToString() + "", ref DBUtility.ClsPub.sExeReturnInfo);
|
}
|
//
|
oWeb.Timeout = 200000;
|
if (oWeb.getRunProcByMul_Back(sSQLMul, ref DBUtility.ClsPub.sExeReturnInfo))
|
{
|
//查询最后一行条码是否存在于条码档案表中
|
int r = grdSub.Rows.Count - 1;
|
DataSet DS2 = oWeb.getDataSetBySQL("Select top 1 1 from Gy_BarCodeBill with(nolock) where HBarCode='" + DBUtility.ClsPub.isStrNull(grdSub.Rows[r].Cells[HTMCol].Value) + "'", "Gy_BarCodeBill", ref DBUtility.ClsPub.sExeReturnInfo);
|
if (DS2 == null || DS2.Tables[0].Rows.Count == 0)
|
{
|
MessageBox.Show("条码生成失败,请重新生成!" + DBUtility.ClsPub.sExeReturnInfo);
|
grdSub.RowCount = 0;
|
grdSub.RowCount = 20;
|
}
|
else
|
{
|
MessageBox.Show("条码生成完毕!");
|
}
|
}
|
else
|
{
|
MessageBox.Show("条码生成失败!" + DBUtility.ClsPub.sExeReturnInfo);
|
grdSub.RowCount = 0;
|
grdSub.RowCount = 20;
|
}
|
tabControl1.SelectedIndex = 2;
|
}
|
catch (Exception e)
|
{
|
//oCn.RollBack();
|
MessageBox.Show("条码生成失败!" + e.Message);
|
grdSub.RowCount = 0;
|
grdSub.RowCount = 20;
|
}
|
}
|
|
#endregion
|
|
|
#region 窗体处理方法
|
//初始化GRID
|
private void initGrid()
|
{
|
grdMain.RowCount = 0;
|
grdSub.RowCount = 0;
|
grdMain.ColumnCount = 76; //总列数
|
ClsPub1.initGridFst(grdMain, this.Name);
|
grdMain.Columns[HSnoCol].HeaderText = "序号";
|
grdMain.Columns[HMainIDCol].HeaderText = "源单主ID";
|
grdMain.Columns[HSubIDCol].HeaderText = "源单子ID";
|
grdMain.Columns[HBillNoCol].HeaderText = "源单单号";
|
grdMain.Columns[HBillTypeCol].HeaderText = "单据类型";
|
grdMain.Columns[HMaterIDCol].HeaderText = "物料ID";
|
grdMain.Columns[HMaterNumberCol].HeaderText = "物料代码";
|
grdMain.Columns[HMaterNameCol].HeaderText = "物料名称";
|
grdMain.Columns[HMaterModelCol].HeaderText = "规格型号";
|
grdMain.Columns[HModelCol].HeaderText = "产品型号";
|
grdMain.Columns[HPinfanCol].HeaderText = "品番";
|
grdMain.Columns[HPinfanBarCodeCol].HeaderText = "HPinfanBarCode";
|
grdMain.Columns[HAuxPropIDCol].HeaderText = "辅助属性ID";
|
grdMain.Columns[HAuxPropNumberCol].HeaderText = "辅助属性代码";
|
grdMain.Columns[HAuxPropNameCol].HeaderText = "辅助属性名称";
|
grdMain.Columns[HUnitIDCol].HeaderText = "计量单位ID";
|
grdMain.Columns[HUnitNumberCol].HeaderText = "计量单位代码";
|
grdMain.Columns[HUnitNameCol].HeaderText = "计量单位名称";
|
grdMain.Columns[HBarCodeTypeCol].HeaderText = "条码类型";
|
grdMain.Columns[HBatchManagerCol].HeaderText = "是否启用批次";
|
grdMain.Columns[HBatchNoCol].HeaderText = "批号2";
|
grdMain.Columns[HCustomBatchNoCol].HeaderText = "批号";
|
grdMain.Columns[HGroupIDCol].HeaderText = "班线ID";
|
grdMain.Columns[HGroupNumberCol].HeaderText = "班线代码";
|
grdMain.Columns[HGroupNameCol].HeaderText = "班线";
|
grdMain.Columns[HQtyCol].HeaderText = "数量";
|
grdMain.Columns[HMinQtyCol].HeaderText = "最小包装数";
|
grdMain.Columns[HBQtyCol].HeaderText = "箱数";
|
grdMain.Columns[HSupIDCol].HeaderText = "供应商ID";
|
grdMain.Columns[HSupNumberCol].HeaderText = "供应商代码";
|
grdMain.Columns[HSupNameCol].HeaderText = "供应商";
|
grdMain.Columns[HDeptIDCol].HeaderText = "车间ID";
|
grdMain.Columns[HDeptNumberCol].HeaderText = "车间代码";
|
grdMain.Columns[HDeptNameCol].HeaderText = "车间";
|
grdMain.Columns[HWhIDCol].HeaderText = "仓库ID";
|
grdMain.Columns[HWhNumberCol].HeaderText = "仓库代码";
|
grdMain.Columns[HWhNameCol].HeaderText = "仓库";
|
grdMain.Columns[HSPIDCol].HeaderText = "仓位ID";
|
grdMain.Columns[HSPNumberCol].HeaderText = "仓位代码";
|
grdMain.Columns[HSPNameCol].HeaderText = "仓位";
|
grdMain.Columns[HInstructNoCol].HeaderText = "指令单号";
|
grdMain.Columns[HSeOrderBillNoCol].HeaderText = "销售订单号";
|
grdMain.Columns[HDateCol].HeaderText = "进料日期";
|
grdMain.Columns[HRemarkCol].HeaderText = "备注";
|
grdMain.Columns[HMTONoCol].HeaderText = "计划跟踪号";
|
grdMain.Columns[HCusIDCol].HeaderText = "客户ID";
|
grdMain.Columns[HCusNumberCol].HeaderText = "客户代码";
|
grdMain.Columns[HCusNameCol].HeaderText = "客户";
|
grdMain.Columns[HCusTypeCol].HeaderText = "客户型号22";
|
grdMain.Columns[HBeginDateCol].HeaderText = "计划开工日期";
|
grdMain.Columns[HEndDateCol].HeaderText = "计划完工日期";
|
grdMain.Columns[HSourceIDCol].HeaderText = "生产线ID";
|
grdMain.Columns[HSourceNumberCol].HeaderText = "生产线代码";
|
grdMain.Columns[HSourceNameCol].HeaderText = "生产线";
|
grdMain.Columns[HColorCol].HeaderText = "颜色";
|
grdMain.Columns[HJiaYeCol].HeaderText = "注液代码";
|
grdMain.Columns[HPackageSizeCol].HeaderText = "包装尺寸";
|
grdMain.Columns[HJQtyCol].HeaderText = "净重";
|
grdMain.Columns[HMQtyCol].HeaderText = "毛重";
|
grdMain.Columns[HLogoCol].HeaderText = "品牌";
|
grdMain.Columns[HCusModelCol].HeaderText = "客户型号";
|
grdMain.Columns[HPressModelCol].HeaderText = "压机型号";
|
grdMain.Columns[HGBBarCodeCol].HeaderText = "国标码";
|
grdMain.Columns[HJiaYeLXCol].HeaderText = "制冷液类型";
|
grdMain.Columns[HJiaYeLCol].HeaderText = "加液量";
|
grdMain.Columns[POOrderBillNoCol].HeaderText = "采购订单号";
|
grdMain.Columns[HBarCode_PackCol].HeaderText = "托条码编号";
|
////
|
//格式化 隐藏列
|
grdMain.Columns[HTagCol].Visible = false;
|
grdMain.Columns[HMainIDCol].Visible = false;
|
grdMain.Columns[HSubIDCol].Visible = false;
|
grdMain.Columns[HBillTypeCol].Visible = false;
|
grdMain.Columns[HMaterIDCol].Visible = false;
|
grdMain.Columns[HPinfanCol].Visible = false;
|
grdMain.Columns[HModelCol].Visible = false;
|
grdMain.Columns[HAuxPropIDCol].Visible = false;
|
grdMain.Columns[HAuxPropNumberCol].Visible = false;
|
grdMain.Columns[HAuxPropNameCol].Visible = false;
|
grdMain.Columns[HUnitIDCol].Visible = false;
|
grdMain.Columns[HUnitNumberCol].Visible = false;
|
grdMain.Columns[HBarCodeTypeCol].Visible = false;
|
grdMain.Columns[HBatchManagerCol].Visible = false;
|
//grdMain.Columns[HBatchNoCol].Visible = false;
|
grdMain.Columns[HGroupIDCol].Visible = false;
|
grdMain.Columns[HGroupNumberCol].Visible = false;
|
grdMain.Columns[HGroupNameCol].Visible = false;
|
grdMain.Columns[HCusModelCol].Visible = false;
|
grdMain.Columns[HLogoCol].Visible = false;
|
grdMain.Columns[HDeptIDCol].Visible = false;
|
grdMain.Columns[HDeptNumberCol].Visible = false;
|
grdMain.Columns[HDeptNameCol].Visible = false;
|
grdMain.Columns[HSourceIDCol].Visible = false;
|
grdMain.Columns[HSourceNumberCol].Visible = false;
|
grdMain.Columns[HSourceNameCol].Visible = false;
|
grdMain.Columns[HDateCol].Visible = false;
|
grdMain.Columns[HBeginDateCol].Visible = false;
|
grdMain.Columns[HEndDateCol].Visible = false;
|
grdMain.Columns[HSupIDCol].Visible = false;
|
grdMain.Columns[HSupNumberCol].Visible = false;
|
grdMain.Columns[HSupNameCol].Visible = false;
|
grdMain.Columns[HCusIDCol].Visible = false;
|
grdMain.Columns[HCusNumberCol].Visible = false;
|
grdMain.Columns[HCusNameCol].Visible = false;
|
grdMain.Columns[HCusTypeCol].Visible = false;
|
grdMain.Columns[HSourceInterIDCol].Visible = false;
|
grdMain.Columns[HSourceEntryIDCol].Visible = false;
|
grdMain.Columns[HSourceBillNoCol].Visible = false;
|
grdMain.Columns[HSourceBillTypeCol].Visible = false;
|
grdMain.Columns[HInstructIDCol].Visible = false;
|
grdMain.Columns[HInstructNoCol].Visible = false;
|
grdMain.Columns[HSeOrderBillIDCol].Visible = false;
|
grdMain.Columns[HSeOrderBillNoCol].Visible = false;
|
grdMain.Columns[HCustomBatchNoCol].Visible = false;
|
grdMain.Columns[HWhIDCol].Visible = false;
|
grdMain.Columns[HWhNumberCol].Visible = false;
|
grdMain.Columns[HWhNameCol].Visible = false;
|
grdMain.Columns[HSPIDCol].Visible = false;
|
grdMain.Columns[HSPNumberCol].Visible = false;
|
grdMain.Columns[HSPNameCol].Visible = false;
|
grdMain.Columns[HinitQtyCol].Visible = false;
|
grdMain.Columns[HPinfanBarCodeCol].Visible = false;
|
grdMain.Columns[HMTONoCol].Visible = false;
|
grdMain.Columns[HColorCol].Visible = false;
|
grdMain.Columns[HPressModelCol].Visible = false;
|
grdMain.Columns[HJiaYeCol].Visible = false;
|
grdMain.Columns[HPackageSizeCol].Visible = false;
|
grdMain.Columns[HJQtyCol].Visible = false;
|
grdMain.Columns[HMQtyCol].Visible = false;
|
grdMain.Columns[HGBBarCodeCol].Visible = false;
|
grdMain.Columns[HJiaYeLXCol].Visible = false;
|
grdMain.Columns[HJiaYeLCol].Visible = false;
|
grdMain.Columns[POOrderBillNoCol].Visible = false;
|
grdMain.Columns[HBarCode_PackCol].Visible = false;
|
grdMain.Columns[HCustomQty1Col].Visible = false;
|
|
if (CampanyName == "韩电") //系统参数 客户定制化名称
|
{
|
grdMain.Columns[HBatchNoCol].Visible = false;
|
grdMain.Columns[HModelCol].Visible = true;
|
grdMain.Columns[HAuxPropNumberCol].Visible = true;
|
grdMain.Columns[HAuxPropNameCol].Visible = true;
|
grdMain.Columns[HGroupNumberCol].Visible = true;
|
grdMain.Columns[HGroupNameCol].Visible = true;
|
grdMain.Columns[HCusModelCol].Visible = true;
|
grdMain.Columns[HLogoCol].Visible = true;
|
grdMain.Columns[HBeginDateCol].Visible = true;
|
grdMain.Columns[HSeOrderBillNoCol].Visible = true;
|
grdMain.Columns[HCustomBatchNoCol].Visible = true;
|
grdMain.Columns[HMTONoCol].Visible = true;
|
grdMain.Columns[HColorCol].Visible = true;
|
grdMain.Columns[HPressModelCol].Visible = true;
|
grdMain.Columns[HJiaYeCol].Visible = true;
|
grdMain.Columns[HPackageSizeCol].Visible = true;
|
grdMain.Columns[HJQtyCol].Visible = true;
|
grdMain.Columns[HMQtyCol].Visible = true;
|
grdMain.Columns[HGBBarCodeCol].Visible = true;
|
grdMain.Columns[HJiaYeLXCol].Visible = true;
|
grdMain.Columns[HJiaYeLCol].Visible = true;
|
}
|
else if (CampanyName == "飞龙") //系统参数 客户定制化名称
|
{
|
grdMain.Columns[HBatchNoCol].Visible = false;
|
grdMain.Columns[HAuxPropNumberCol].Visible = false;
|
grdMain.Columns[HAuxPropNameCol].Visible = false;
|
grdMain.Columns[HCusNumberCol].Visible = true;
|
grdMain.Columns[HCusNameCol].Visible = true;
|
grdMain.Columns[HSeOrderBillNoCol].Visible = true;
|
}
|
else if (CampanyName == "四维尔") //系统参数 客户定制化名称
|
{
|
//grdMain.Columns[HBatchNoCol].Visible = false;
|
grdMain.Columns[HPinfanCol].Visible = true;
|
grdMain.Columns[HAuxPropNumberCol].Visible = true;
|
grdMain.Columns[HAuxPropNameCol].Visible = true;
|
}
|
else if (CampanyName == "圣龙") //系统参数 客户定制化名称
|
{
|
grdMain.Columns[HSupNumberCol].Visible = true;
|
grdMain.Columns[HSupNameCol].Visible = true;
|
grdMain.Columns[POOrderBillNoCol].Visible = true;
|
}
|
else if (CampanyName == "森楷") //系统参数 客户定制化名称
|
{
|
grdMain.Columns[HGroupNumberCol].Visible = true;
|
grdMain.Columns[HGroupNameCol].Visible = true;
|
}
|
|
|
//设置可编辑列
|
string sAllowCol = HQtyCol.ToString() +
|
"," + HMinQtyCol.ToString() +
|
"," + HMaterNumberCol.ToString() +
|
"," + HMaterNameCol.ToString() +
|
"," + HMaterModelCol.ToString() +
|
"," + HPinfanCol.ToString() +
|
"," + HAuxPropNumberCol.ToString() +
|
"," + HUnitNumberCol.ToString() +
|
"," + HSeOrderBillNoCol.ToString() +
|
"," + HCusNumberCol.ToString() +
|
"," + HDeptNumberCol.ToString() +
|
"," + HGroupNameCol.ToString() +
|
"," + HBatchNoCol.ToString() +
|
"," + HSupNumberCol.ToString() +
|
"," + POOrderBillNoCol.ToString() +
|
"," + HPressModelCol.ToString() +
|
"," + HGBBarCodeCol.ToString() +
|
"," + HRemarkCol.ToString();
|
//设置合计列
|
string sTotalCol = HQtyCol.ToString();
|
//
|
|
ClsPub1.initGridLast(sAllowCol, sTotalCol, oSumGrid);
|
//----------------------------
|
|
grdSub.ColumnCount = 74; //总列数
|
ClsPub1.initGridFst(grdSub, this.Name);
|
grdSub.Columns[HSelectCol].HeaderText = "选择";
|
grdSub.Columns[HTMCol].HeaderText = "条码编号";
|
grdSub.Columns[HBarCodeType2Col].HeaderText = "条码类型";
|
grdSub.Columns[HSno2Col].HeaderText = "序号";
|
grdSub.Columns[HMaterID2Col].HeaderText = "物料ID";
|
grdSub.Columns[HMaterNumber2Col].HeaderText = "物料代码";
|
grdSub.Columns[HMaterName2Col].HeaderText = "物料名称";
|
grdSub.Columns[HMaterModel2Col].HeaderText = "规格型号";
|
grdSub.Columns[HModel2Col].HeaderText = "产品型号";
|
grdSub.Columns[HAuxPropID2Col].HeaderText = "辅助属性ID";
|
grdSub.Columns[HAuxPropNumber2Col].HeaderText = "辅助属性代码";
|
grdSub.Columns[HAuxPropName2Col].HeaderText = "辅助属性";
|
grdSub.Columns[HPinfan2Col].HeaderText = "品番";
|
grdSub.Columns[HPinfanBarCode2Col].HeaderText = "HPinfanBarCode";
|
grdSub.Columns[HBatchNo2Col].HeaderText = "批号2";
|
grdSub.Columns[HCustomBatchNo2Col].HeaderText = "批号";
|
grdSub.Columns[HUnitID2Col].HeaderText = "计量单位ID";
|
grdSub.Columns[HUnitNumber2Col].HeaderText = "计量单位代码";
|
grdSub.Columns[HUnitName2Col].HeaderText = "计量单位";
|
grdSub.Columns[HGroupID2Col].HeaderText = "班线ID";
|
grdSub.Columns[HGroupNumber2Col].HeaderText = "班线代码";
|
grdSub.Columns[HGroupName2Col].HeaderText = "班线";
|
grdSub.Columns[HQty2Col].HeaderText = "数量";
|
grdSub.Columns[HWeiCol].HeaderText = "尾数";
|
grdSub.Columns[HPrintCol].HeaderText = "打印次数";
|
grdSub.Columns[HSourceInterID2Col].HeaderText = "源单主ID";
|
grdSub.Columns[HSourceEntryID2Col].HeaderText = "源单子ID";
|
grdSub.Columns[HSourceBillNo2Col].HeaderText = "源单单号";
|
grdSub.Columns[HSourceBillType2Col].HeaderText = "源单类型";
|
grdSub.Columns[HSeOrderBillNo2Col].HeaderText = "销售订单号";
|
grdSub.Columns[HBarcodeNoCol].HeaderText = "托号";
|
grdSub.Columns[HBarcodeQtysCol].HeaderText = "总托数";
|
grdSub.Columns[HSupID2Col].HeaderText = "供应商ID";
|
grdSub.Columns[HSupNumber2Col].HeaderText = "供应商代码";
|
grdSub.Columns[HSupName2Col].HeaderText = "供应商";
|
grdSub.Columns[HDeptID2Col].HeaderText = "车间ID";
|
grdSub.Columns[HDeptNumber2Col].HeaderText = "车间代码";
|
grdSub.Columns[HDeptName2Col].HeaderText = "车间";
|
grdSub.Columns[HWhID2Col].HeaderText = "仓库ID";
|
grdSub.Columns[HWhNumber2Col].HeaderText = "仓库代码";
|
grdSub.Columns[HWhName2Col].HeaderText = "仓库";
|
grdSub.Columns[HSPID2Col].HeaderText = "仓位ID";
|
grdSub.Columns[HSPNumber2Col].HeaderText = "仓位代码";
|
grdSub.Columns[HSPName2Col].HeaderText = "仓位";
|
grdSub.Columns[HInstructNo2Col].HeaderText = "指令单号";
|
grdSub.Columns[HDate2Col].HeaderText = "进料日期";
|
grdSub.Columns[HRemark2Col].HeaderText = "备注";
|
grdSub.Columns[HMTONo2Col].HeaderText = "计划跟踪号";
|
grdSub.Columns[HCusID2Col].HeaderText = "客户ID";
|
grdSub.Columns[HCusNumber2Col].HeaderText = "客户代码";
|
grdSub.Columns[HCusName2Col].HeaderText = "客户";
|
grdSub.Columns[HCusType2Col].HeaderText = "客户型号22";
|
grdSub.Columns[HBeginDate2Col].HeaderText = "计划开工日期";
|
grdSub.Columns[HEndDate2Col].HeaderText = "计划完工日期";
|
grdSub.Columns[HSourceID2Col].HeaderText = "生产线ID";
|
grdSub.Columns[HSourceNumber2Col].HeaderText = "生产线代码";
|
grdSub.Columns[HSourceName2Col].HeaderText = "生产线";
|
grdSub.Columns[HColor2Col].HeaderText = "颜色";
|
grdSub.Columns[HJiaYe2Col].HeaderText = "注液代码";
|
grdSub.Columns[HPackageSize2Col].HeaderText = "包装尺寸";
|
grdSub.Columns[HJQty2Col].HeaderText = "净重";
|
grdSub.Columns[HMQty2Col].HeaderText = "毛重";
|
grdSub.Columns[HLogo2Col].HeaderText = "品牌";
|
grdSub.Columns[HCusModel2Col].HeaderText = "客户型号";
|
grdSub.Columns[HPressModel2Col].HeaderText = "压机型号";
|
grdSub.Columns[HMakeDate2Col].HeaderText = "日期";
|
grdSub.Columns[HGBBarCode2Col].HeaderText = "国标码";
|
grdSub.Columns[HJiaYeLX2Col].HeaderText = "制冷液类型";
|
grdSub.Columns[HJiaYeL2Col].HeaderText = "加液量";
|
grdSub.Columns[POOrderBillNo2Col].HeaderText = "采购订单号";
|
grdSub.Columns[HBarCode_Pack2Col].HeaderText = "托条码编号";
|
|
//格式化 隐藏列
|
grdSub.Columns[HBarCodeType2Col].Visible = false;
|
grdSub.Columns[HMaterID2Col].Visible = false;
|
grdSub.Columns[HPinfan2Col].Visible = false;
|
grdSub.Columns[HModel2Col].Visible = false;
|
grdSub.Columns[HAuxPropID2Col].Visible = false;
|
grdSub.Columns[HAuxPropNumber2Col].Visible = false;
|
grdSub.Columns[HAuxPropName2Col].Visible = false;
|
//grdSub.Columns[HBatchNo2Col].Visible = false;
|
grdSub.Columns[HUnitID2Col].Visible = false;
|
grdSub.Columns[HUnitNumber2Col].Visible = false;
|
grdSub.Columns[HGroupID2Col].Visible = false;
|
grdSub.Columns[HGroupNumber2Col].Visible = false;
|
grdSub.Columns[HGroupName2Col].Visible = false;
|
grdSub.Columns[HCusModel2Col].Visible = false;
|
grdSub.Columns[HWeiCol].Visible = false;
|
grdSub.Columns[HPrintCol].Visible = false;
|
grdSub.Columns[HLogo2Col].Visible = false;
|
grdSub.Columns[HDeptID2Col].Visible = false;
|
grdSub.Columns[HDeptNumber2Col].Visible = false;
|
grdSub.Columns[HDeptName2Col].Visible = false;
|
grdSub.Columns[HSourceID2Col].Visible = false;
|
grdSub.Columns[HSourceNumber2Col].Visible = false;
|
grdSub.Columns[HSourceName2Col].Visible = false;
|
grdSub.Columns[HDate2Col].Visible = false;
|
grdSub.Columns[HBeginDate2Col].Visible = false;
|
grdSub.Columns[HEndDate2Col].Visible = false;
|
grdSub.Columns[HBarcodeNoCol].Visible = false;
|
grdSub.Columns[HBarcodeQtysCol].Visible = false;
|
grdSub.Columns[HSupID2Col].Visible = false;
|
grdSub.Columns[HSupNumber2Col].Visible = false;
|
grdSub.Columns[HSupName2Col].Visible = false;
|
grdSub.Columns[HCusID2Col].Visible = false;
|
grdSub.Columns[HCusNumber2Col].Visible = false;
|
grdSub.Columns[HCusName2Col].Visible = false;
|
grdSub.Columns[HCusType2Col].Visible = false;
|
grdSub.Columns[HSourceInterID2Col].Visible = false;
|
grdSub.Columns[HSourceEntryID2Col].Visible = false;
|
grdSub.Columns[HSourceBillType2Col].Visible = false;
|
grdSub.Columns[HInstructID2Col].Visible = false;
|
grdSub.Columns[HInstructNo2Col].Visible = false;
|
grdSub.Columns[HSeOrderBillID2Col].Visible = false;
|
grdSub.Columns[HSeOrderBillNo2Col].Visible = false;
|
grdSub.Columns[HCustomBatchNo2Col].Visible = false;
|
grdSub.Columns[HWhID2Col].Visible = false;
|
grdSub.Columns[HWhNumber2Col].Visible = false;
|
grdSub.Columns[HWhName2Col].Visible = false;
|
grdSub.Columns[HSPID2Col].Visible = false;
|
grdSub.Columns[HSPNumber2Col].Visible = false;
|
grdSub.Columns[HSPName2Col].Visible = false;
|
grdSub.Columns[HPinfanBarCode2Col].Visible = false;
|
grdSub.Columns[HMTONo2Col].Visible = false;
|
grdSub.Columns[HColor2Col].Visible = false;
|
grdSub.Columns[HPressModel2Col].Visible = false;
|
grdSub.Columns[HJiaYe2Col].Visible = false;
|
grdSub.Columns[HPackageSize2Col].Visible = false;
|
grdSub.Columns[HJQty2Col].Visible = false;
|
grdSub.Columns[HMQty2Col].Visible = false;
|
grdSub.Columns[HMakeDate2Col].Visible = false;
|
grdSub.Columns[HGBBarCode2Col].Visible = false;
|
grdSub.Columns[HJiaYeLX2Col].Visible = false;
|
grdSub.Columns[HJiaYeL2Col].Visible = false;
|
grdSub.Columns[POOrderBillNo2Col].Visible = false;
|
grdSub.Columns[HBarCode_Pack2Col].Visible = false;
|
grdSub.Columns[HCustomQty12Col].Visible = false;
|
|
if (CampanyName == "韩电") //系统参数 客户定制化名称
|
{
|
grdSub.Columns[HBatchNo2Col].Visible = false;
|
grdSub.Columns[HModel2Col].Visible = true;
|
grdSub.Columns[HAuxPropNumber2Col].Visible = true;
|
grdSub.Columns[HAuxPropName2Col].Visible = true;
|
grdSub.Columns[HUnitNumber2Col].Visible = true;
|
grdSub.Columns[HGroupNumber2Col].Visible = true;
|
grdSub.Columns[HGroupName2Col].Visible = true;
|
grdSub.Columns[HCusModel2Col].Visible = true;
|
grdSub.Columns[HLogo2Col].Visible = true;
|
grdSub.Columns[HBeginDate2Col].Visible = true;
|
grdSub.Columns[HSeOrderBillNo2Col].Visible = true;
|
grdSub.Columns[HCustomBatchNo2Col].Visible = true;
|
grdSub.Columns[HMTONo2Col].Visible = true;
|
grdSub.Columns[HColor2Col].Visible = true;
|
grdSub.Columns[HPressModel2Col].Visible = true;
|
grdSub.Columns[HJiaYe2Col].Visible = true;
|
grdSub.Columns[HPackageSize2Col].Visible = true;
|
grdSub.Columns[HJQty2Col].Visible = true;
|
grdSub.Columns[HMQty2Col].Visible = true;
|
grdSub.Columns[HGBBarCode2Col].Visible = true;
|
grdSub.Columns[HJiaYeLX2Col].Visible = true;
|
grdSub.Columns[HJiaYeL2Col].Visible = true;
|
}
|
else if (CampanyName == "飞龙") //系统参数 客户定制化名称
|
{
|
grdSub.Columns[HBatchNo2Col].Visible = false;
|
grdSub.Columns[HAuxPropNumber2Col].Visible = false;
|
grdSub.Columns[HAuxPropName2Col].Visible = false;
|
grdSub.Columns[HCusNumber2Col].Visible = true;
|
grdSub.Columns[HCusName2Col].Visible = true;
|
grdSub.Columns[HSeOrderBillNo2Col].Visible = true;
|
}
|
else if (CampanyName == "四维尔") //系统参数 客户定制化名称
|
{
|
grdSub.Columns[HBatchNo2Col].Visible = false;
|
grdSub.Columns[HPinfan2Col].Visible = true;
|
grdSub.Columns[HAuxPropNumber2Col].Visible = true;
|
grdSub.Columns[HAuxPropName2Col].Visible = true;
|
}
|
else if (CampanyName == "圣龙") //系统参数 客户定制化名称
|
{
|
grdSub.Columns[HSupNumber2Col].Visible = true;
|
grdSub.Columns[HSupName2Col].Visible = true;
|
grdSub.Columns[POOrderBillNo2Col].Visible = true;
|
}
|
|
DBUtility.Xt_BaseBillFun.GetGrid(grdMain, this.Name);
|
DBUtility.Xt_BaseBillFun.GetGrid(grdSub, this.Name + "grdSub");
|
grdSub.SelectionMode = DataGridViewSelectionMode.FullRowSelect; //选行模式
|
|
////
|
ClsPub1.initGridList(grdList, this.Name + "grdList");
|
////
|
}
|
|
private void Display()
|
{
|
DataSet DSet;
|
//过滤条件
|
//if (HInterID <= 0)
|
//{
|
// return;
|
//}
|
//
|
DSet = oWeb.getDataSetBySQL("select * from h_v_IF_BarCodeBillList Where HinterID=" + HInterID.ToString() + " order by HItemID", "h_v_IF_BarCodeBillList", ref DBUtility.ClsPub.sExeReturnInfo);
|
//生成首行标题
|
if (DSet == null)
|
{
|
MessageBox.Show("没有返回任何结果,条码不存在!" + DBUtility.ClsPub.sExeReturnInfo);
|
return;
|
}
|
//
|
grdList.DataSource = DSet.Tables[0].DefaultView;
|
//冻结
|
int FrCol = 0;
|
string s = "是";
|
ClsPub1.DisplayGrid(grdList, this.Name + "grdList", s, FrCol);
|
//画线
|
//GraphLine();
|
|
//
|
}
|
|
//公式重算
|
private void RowCount(int sRow, int sTag)
|
{
|
if (sTag == 0)
|
{
|
//箱数列=数量/最小包装数
|
double sMoney = 0;
|
if (ClsPub.isDoule(grdMain.Rows[sRow].Cells[HMinQtyCol].Value) == 0)
|
{
|
sMoney = 0;
|
}
|
else
|
{
|
sMoney = ClsPub.isDoule(grdMain.Rows[sRow].Cells[HQtyCol].Value) / ClsPub.isDoule(grdMain.Rows[sRow].Cells[HMinQtyCol].Value);
|
}
|
sMoney = Math.Ceiling(sMoney);
|
grdMain.Rows[sRow].Cells[HBQtyCol].Value = sMoney;
|
}
|
else
|
{
|
|
}
|
if (CampanyName == "四维尔") //系统参数 客户定制化名称
|
{
|
|
}
|
else
|
{
|
if (ClsPub.isDoule(grdMain.Rows[sRow].Cells[HQtyCol].Value) > ClsPub.isDoule(grdMain.Rows[sRow].Cells[HinitQtyCol].Value)
|
&& ClsPub.isStrNull(grdMain.Rows[sRow].Cells[HBillNoCol].Value) != "")
|
{
|
MessageBox.Show("所输入的产品总数量大于剩余可生成数量" + ClsPub.isDoule(grdMain.Rows[sRow].Cells[HinitQtyCol].Value) + ",请重新输入!");
|
grdMain.Rows[sRow].Cells[HQtyCol].Value = ClsPub.isDoule(grdMain.Rows[sRow].Cells[HinitQtyCol].Value);
|
return;
|
}
|
}
|
}
|
|
//核对选择的内容
|
public bool CheckGridCell(Cell oCell)
|
{
|
int Row;
|
int Col;
|
Row = oCell.Row;
|
Col = oCell.Col;
|
//if (ClsPub.isStrNull(grdMain.get_TextMatrix(Row, HTagCol)) != "*")
|
//{
|
// return true;
|
//}
|
//grdMain.Redraw = VSFlex7.RedrawSettings.flexRDNone;
|
//判断选中列
|
if (Col == HMaterNumberCol) //物料代码列
|
{
|
//ClsGy_MaterialHlp oMate = new ClsGy_MaterialHlp();
|
//if (oMate.GetInfoByID(ClsPub.isLong(grdMain.Rows[Row].Cells[HMaterIDCol].Value)))
|
//{
|
// grdMain.Rows[Row].Cells[HMaterIDCol].Value = oMate.HItemID.ToString();
|
// grdMain.Rows[Row].Cells[HMaterNumberCol].Value = oMate.HNumber;
|
// grdMain.Rows[Row].Cells[HMaterNameCol].Value = oMate.HName;
|
// //grdMain.Rows[Row].Cells[HMaterModelCol].Value = oMate.HModel;
|
//}
|
//else
|
//{
|
// grdMain.Rows[Row].Cells[HMaterIDCol].Value = "";
|
// grdMain.Rows[Row].Cells[HMaterNumberCol].Value = "";
|
// grdMain.Rows[Row].Cells[HMaterNameCol].Value = "";
|
// //grdMain.Rows[Row].Cells[HMaterModelCol].Value = "";
|
return false;
|
//}
|
}
|
else if (Col == HUnitIDCol) //单位ID列
|
{
|
//ClsGy_UnitHlp oUn = new ClsGy_UnitHlp();
|
//if (oUn.GetInfoByID(ClsPub.isLong(grdMain.Rows[Row].Cells[HUnitIDCol])))
|
//{
|
// grdMain.Rows[Row].Cells[HUnitIDCol].Value = oUn.HItemID.ToString();
|
// grdMain.Rows[Row].Cells[HUnitNameCol].Value = oUn.HName;
|
//}
|
//else
|
//{
|
// grdMain.Rows[Row].Cells[HUnitIDCol].Value = "";
|
// grdMain.Rows[Row].Cells[HUnitNameCol].Value = "";
|
return false;
|
//}
|
}
|
else //其他列
|
{
|
}
|
//
|
//
|
grdMain.Rows[Row].Cells[HTagCol].Value = "*";
|
oSumGrid.EditStatus = false;
|
return true;
|
}
|
//是否是空行
|
private bool IsNullRow(int Row)
|
{
|
return DBUtility.Xt_BaseBillFun.IsNullRow(Row, HMaterIDCol,grdMain);
|
}
|
//'判断网格行的录入是否正确
|
private bool CheckGridRow(int Row)
|
{
|
Cell oCell = new Cell();
|
int c = 0;
|
//if (ClsPub.isStrNull(grdMain.get_TextMatrix(Row, HTagCol)) != "*")
|
//{
|
// return true;
|
//}
|
//
|
for (c = 0; c < grdMain.ColumnCount; c++)
|
{
|
oCell.Row = Row;
|
oCell.Col = c;
|
//if (!CheckGridCell(oCell))
|
// return false;
|
|
}
|
return true;
|
}
|
//帮助函数
|
private void Sub_GridKey(int sKeyCode, int sRow, int sCol, DataGridViewTextBoxEditingControl oEdit)
|
{
|
DataSet oDs2 = new DataSet();
|
long sHMaterID = 0;
|
long sHOrgID=-1;
|
string sWhere = "";
|
sHOrgID = oWeb.get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
|
if (sHOrgID == -1)
|
{
|
MessageBox.Show("选择组织有错误!");
|
return;
|
}
|
|
SCM.ClsIF_Material_View oMater = new SCM.ClsIF_Material_View(); //物料
|
SCM.ClsIF_Unit_View oUnit = new SCM.ClsIF_Unit_View(); //计量单位
|
SCM.ClsIF_Customer_View oCus = new SCM.ClsIF_Customer_View(); //客户
|
SCM.ClsIF_Department_View oDep = new SCM.ClsIF_Department_View(); //部门
|
SCM.ClsGy_Group_View oGroup = new SCM.ClsGy_Group_View();
|
SCM.ClsIF_Property_View oProperty = new SCM.ClsIF_Property_View();
|
SCM.ClsIF_Supplier_View oSup = new SCM.ClsIF_Supplier_View(); //供应商
|
|
if (!grdStatus)
|
{
|
return;
|
}
|
oSumGrid.EditStatus = true;
|
switch (sKeyCode)
|
{
|
case 118: //F7
|
{
|
switch (sCol)
|
{
|
case HMaterNumberCol:
|
oMater.WherePart = "";
|
sWhere = " and HUSEORGID = " + sHOrgID;
|
if (oMater.RefreshViewForBig(sWhere))
|
{
|
grdMain.Rows[sRow].Cells[HMaterIDCol].Value = oMater.omodel.HItemID.ToString();
|
grdMain.Rows[sRow].Cells[HMaterNumberCol].Value = oMater.omodel.HNumber;
|
grdMain.Rows[sRow].Cells[HMaterNameCol].Value = oMater.omodel.HName;
|
grdMain.Rows[sRow].Cells[HMaterModelCol].Value = oMater.omodel.HModel;
|
grdMain.Rows[sRow].Cells[HUnitIDCol].Value = oMater.omodel.HUnitID.ToString();
|
grdMain.Rows[sRow].Cells[HUnitNumberCol].Value = oMater.omodel.HUnitNumber;
|
grdMain.Rows[sRow].Cells[HUnitNameCol].Value = oMater.omodel.HUnitName;
|
grdMain.Rows[sRow].Cells[HMinQtyCol].Value = oMater.omodel.HQtyMin;
|
grdMain.Rows[sRow].Cells[HAuxPropIDCol].Value = 0;
|
grdMain.Rows[sRow].Cells[HAuxPropNumberCol].Value = "";
|
grdMain.Rows[sRow].Cells[HAuxPropNameCol].Value = "";
|
oEdit.Text = oMater.omodel.HNumber;
|
}
|
else
|
{
|
grdMain.Rows[sRow].Cells[HMaterIDCol].Value = 0;
|
grdMain.Rows[sRow].Cells[HMaterNumberCol].Value = "";
|
grdMain.Rows[sRow].Cells[HMaterNameCol].Value = "";
|
grdMain.Rows[sRow].Cells[HMaterModelCol].Value = "";
|
grdMain.Rows[sRow].Cells[HUnitIDCol].Value = 0;
|
grdMain.Rows[sRow].Cells[HUnitNumberCol].Value = "";
|
grdMain.Rows[sRow].Cells[HUnitNameCol].Value = "";
|
grdMain.Rows[sRow].Cells[HMinQtyCol].Value = 0;
|
grdMain.Rows[sRow].Cells[HAuxPropIDCol].Value = 0;
|
grdMain.Rows[sRow].Cells[HAuxPropNumberCol].Value = "";
|
grdMain.Rows[sRow].Cells[HAuxPropNameCol].Value = "";
|
}
|
if (CampanyName == "四维尔") //系统参数 客户定制化名称
|
{
|
sHMaterID = DBUtility.ClsPub.isLong(grdMain.Rows[sRow].Cells[HMaterIDCol].Value);
|
//获取品番
|
oDs2 = oWeb.getDataSetBySQL("exec h_p_HMaterPinfan " + sHMaterID, "h_p_HMaterPinfan", ref DBUtility.ClsPub.sExeReturnInfo);
|
//
|
if (oDs2 != null && oDs2.Tables[0].Rows.Count > 0)
|
{
|
grdMain.Rows[sRow].Cells[HPinfanCol].Value = DBUtility.ClsPub.isStrNull(oDs2.Tables[0].Rows[0]["HPinfan"]);
|
grdMain.Rows[sRow].Cells[HPinfanBarCodeCol].Value = DBUtility.ClsPub.isStrNull(oDs2.Tables[0].Rows[0]["HPinfanBarCode"]);
|
}
|
else
|
{
|
grdMain.Rows[sRow].Cells[HPinfanCol].Value = "";
|
grdMain.Rows[sRow].Cells[HPinfanBarCodeCol].Value = "";
|
}
|
}
|
break;
|
|
case HUnitNumberCol:
|
oUnit.WherePart = "";
|
if (oUnit.RefreshView(sWhere))
|
{
|
grdMain.Rows[sRow].Cells[HUnitIDCol].Value = oUnit.oModel.HItemID.ToString();
|
grdMain.Rows[sRow].Cells[HUnitNumberCol].Value = oUnit.oModel.HNumber;
|
grdMain.Rows[sRow].Cells[HUnitNameCol].Value = oUnit.oModel.HName;
|
oEdit.Text = oUnit.oModel.HNumber;
|
}
|
else
|
{
|
grdMain.Rows[sRow].Cells[HUnitIDCol].Value = 0;
|
grdMain.Rows[sRow].Cells[HUnitNumberCol].Value = "";
|
grdMain.Rows[sRow].Cells[HUnitNameCol].Value = "";
|
}
|
break;
|
|
case HDeptNumberCol:
|
oDep.WherePart = "";
|
sWhere = " and HUSEORGID = " + sHOrgID;
|
if (oDep.RefreshView(sWhere))
|
{
|
grdMain.Rows[sRow].Cells[HDeptIDCol].Value = oDep.oModel.HItemID.ToString();
|
grdMain.Rows[sRow].Cells[HDeptNumberCol].Value = oDep.oModel.HNumber;
|
grdMain.Rows[sRow].Cells[HDeptNameCol].Value = oDep.oModel.HName;
|
oEdit.Text = oDep.oModel.HNumber;
|
}
|
else
|
{
|
grdMain.Rows[sRow].Cells[HDeptIDCol].Value = 0;
|
grdMain.Rows[sRow].Cells[HDeptNumberCol].Value = "";
|
grdMain.Rows[sRow].Cells[HDeptNameCol].Value = "";
|
}
|
break;
|
|
case HCusNumberCol:
|
oCus.WherePart = "";
|
sWhere = " and HUSEORGID = " + sHOrgID;
|
if (oCus.RefreshView(sWhere))
|
{
|
grdMain.Rows[sRow].Cells[HCusIDCol].Value = oCus.oModel.HItemID.ToString();
|
grdMain.Rows[sRow].Cells[HCusNumberCol].Value = oCus.oModel.HNumber;
|
grdMain.Rows[sRow].Cells[HCusNameCol].Value = oCus.oModel.HName;
|
oEdit.Text = oCus.oModel.HNumber;
|
}
|
else
|
{
|
grdMain.Rows[sRow].Cells[HCusIDCol].Value = 0;
|
grdMain.Rows[sRow].Cells[HCusNumberCol].Value = "";
|
grdMain.Rows[sRow].Cells[HCusNameCol].Value = "";
|
}
|
break;
|
|
case HSupNumberCol:
|
oSup.WherePart = "";
|
sWhere = " and HUSEORGID = " + sHOrgID;
|
if (oSup.RefreshView(sWhere))
|
{
|
grdMain.Rows[sRow].Cells[HSupIDCol].Value = oSup.oModel.HItemID.ToString();
|
grdMain.Rows[sRow].Cells[HSupNumberCol].Value = oSup.oModel.HNumber;
|
grdMain.Rows[sRow].Cells[HSupNameCol].Value = oSup.oModel.HName;
|
oEdit.Text = oSup.oModel.HNumber;
|
}
|
else
|
{
|
grdMain.Rows[sRow].Cells[HSupIDCol].Value = 0;
|
grdMain.Rows[sRow].Cells[HSupNumberCol].Value = "";
|
grdMain.Rows[sRow].Cells[HSupNameCol].Value = "";
|
}
|
break;
|
|
//case HDateCol:
|
// BLL.ClsPub_BLL.Sub_SelectDate(grdMain, sRow, HDateCol);
|
// oEdit.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[sRow].Cells[HDateCol].Value);
|
// break;
|
|
|
case HAuxPropNumberCol:
|
oProperty.WherePart = "";
|
if (CampanyName == "四维尔")
|
{
|
sWhere = " and HMaterNumber = '" + DBUtility.ClsPub.isStrNull(grdMain.Rows[grdMain.CurrentCell.RowIndex].Cells[HMaterNumberCol].Value) + "'";
|
}
|
else
|
{
|
sWhere = "";
|
}
|
if (oProperty.RefreshView(sWhere))
|
{
|
grdMain.Rows[sRow].Cells[HAuxPropIDCol].Value = oProperty.oModel.HItemID.ToString();
|
grdMain.Rows[sRow].Cells[HAuxPropNumberCol].Value = oProperty.oModel.HNumber;
|
grdMain.Rows[sRow].Cells[HAuxPropNameCol].Value = oProperty.oModel.HName;
|
oEdit.Text = oProperty.oModel.HNumber;
|
}
|
else
|
{
|
grdMain.Rows[sRow].Cells[HAuxPropIDCol].Value = 0;
|
grdMain.Rows[sRow].Cells[HAuxPropNumberCol].Value = "";
|
grdMain.Rows[sRow].Cells[HAuxPropNameCol].Value = "";
|
}
|
break;
|
|
|
case HGroupNameCol:
|
oGroup.WherePart = "";
|
sWhere = " and HUSEORGID = " + sHOrgID;
|
if (oGroup.RefreshView(sWhere))
|
{
|
grdMain.Rows[sRow].Cells[HGroupIDCol].Value = oGroup.oModel.HItemID.ToString();
|
grdMain.Rows[sRow].Cells[HGroupNumberCol].Value = oGroup.oModel.HNumber;
|
grdMain.Rows[sRow].Cells[HGroupNameCol].Value = oGroup.oModel.HName;
|
oEdit.Text = oGroup.oModel.HName;
|
}
|
else
|
{
|
grdMain.Rows[sRow].Cells[HGroupIDCol].Value = 0;
|
grdMain.Rows[sRow].Cells[HGroupNumberCol].Value = "";
|
grdMain.Rows[sRow].Cells[HGroupNameCol].Value = "";
|
}
|
break;
|
|
|
default:
|
break;
|
}
|
//bc.Enabled = true;
|
break;
|
}
|
case 117: //F6
|
{
|
switch (sCol)
|
{
|
|
|
default:
|
break;
|
}
|
break;
|
}
|
default:
|
break;
|
}
|
}
|
|
//选原单
|
private void cmdSourceBillNo_Click(object sender, EventArgs e)
|
{
|
long sHOrgID = -1;
|
string sWhere = "";
|
sHOrgID = oWeb.get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
|
if (sHOrgID == -1)
|
{
|
MessageBox.Show("选择组织有错误!");
|
return;
|
}
|
|
if (cmbSourceBillType.Text.Trim() == "生产订单")
|
{
|
sWhere = " and HOrgID =" + sHOrgID.ToString();
|
SCM.Cls_S_IFCLD_ICMOList oIFCLD_ICMOList = new SCM.Cls_S_IFCLD_ICMOList();
|
if (oIFCLD_ICMOList.Refresh(sWhere)) //选择原单
|
{
|
FillSelectData(oIFCLD_ICMOList.oBillSelectColl);
|
}
|
}
|
else if (cmbSourceBillType.Text.Trim() == "生产汇报单")
|
{
|
sWhere = " and HOrgID =" + sHOrgID.ToString();
|
SCM.Cls_S_IF_ICMOReportBillList oIF_ICMOReportBillList = new SCM.Cls_S_IF_ICMOReportBillList();
|
if (oIF_ICMOReportBillList.Refresh(sWhere)) //选择原单
|
{
|
FillSelectData(oIF_ICMOReportBillList.oBillSelectColl);
|
}
|
}
|
else if (cmbSourceBillType.Text.Trim() == "收料通知单")
|
{
|
sWhere = " and HOrgID =" + sHOrgID.ToString();
|
SCM.Cls_S_IF_POInStockBillList oIF_POInStockBillList = new SCM.Cls_S_IF_POInStockBillList();
|
if (oIF_POInStockBillList.Refresh(sWhere)) //选择原单
|
{
|
FillSelectData(oIF_POInStockBillList.oBillSelectColl);
|
}
|
}
|
else if (cmbSourceBillType.Text.Trim() == "采购订单")
|
{
|
sWhere = " and HOrgID =" + sHOrgID.ToString();
|
SCM.Cls_S_IF_POOrderBillList oIF_POOrderBillList = new SCM.Cls_S_IF_POOrderBillList();
|
if (oIF_POOrderBillList.Refresh(sWhere)) //选择原单
|
{
|
FillSelectData(oIF_POOrderBillList.oBillSelectColl);
|
}
|
}
|
else if (cmbSourceBillType.Text.Trim() == "委外订单")
|
{
|
sWhere = " and HOrgID =" + sHOrgID.ToString();
|
SCM.Cls_S_IF_EntrustOrderBillList oIF_EntrustOrderBillList = new SCM.Cls_S_IF_EntrustOrderBillList();
|
if (oIF_EntrustOrderBillList.Refresh(sWhere)) //选择原单
|
{
|
FillSelectData(oIF_EntrustOrderBillList.oBillSelectColl);
|
}
|
}
|
else if (cmbSourceBillType.Text.Trim() == "入库申请单")
|
{
|
sWhere = " and HOrgID =" + sHOrgID.ToString();
|
SCM.Cls_S_IF_StockInRequestBillList oIF_StockInRequestBillList = new SCM.Cls_S_IF_StockInRequestBillList();
|
if (oIF_StockInRequestBillList.Refresh(sWhere)) //选择原单
|
{
|
FillSelectData(oIF_StockInRequestBillList.oBillSelectColl);
|
}
|
}
|
else
|
{
|
|
}
|
}
|
//
|
private void FillSelectData(List<DBUtility.BillSelect> oList)
|
{
|
DataSet Ds;
|
oSumGrid.Changelock = true;
|
int i = -1;
|
if (chkAddModel.Checked == false)
|
{
|
initGrid();
|
i = -1;
|
}
|
else
|
{
|
for (int n = 0; n < grdMain.Rows.Count; n++)
|
{
|
if (DBUtility.ClsPub.isLong(grdMain.Rows[n].Cells[HMaterIDCol].Value) == 0)
|
{
|
i = n - 1;
|
break;
|
}
|
}
|
}
|
foreach (DBUtility.BillSelect oSelectRow in oList)
|
{
|
i = i + 1;
|
//生产订单
|
if (oSelectRow.BillType == "3710")
|
{
|
grdMain.Rows.Add();
|
grdMain.Rows[i].Cells[HTagCol].Value = "*";
|
//得到信息
|
Ds = oWeb.getDataSetBySQL("select * from h_v_IFCLD_ICMOList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IFCLD_ICMOList", ref DBUtility.ClsPub.sExeReturnInfo);
|
//写入信息
|
Sub_WriteInForm(Ds.Tables[0], i);
|
}
|
//生产汇报单
|
if (oSelectRow.BillType == "3711")
|
{
|
grdMain.Rows.Add();
|
grdMain.Rows[i].Cells[HTagCol].Value = "*";
|
//得到信息
|
Ds = oWeb.getDataSetBySQL("select * from h_v_IF_ICMOReportList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_ICMOReportList", ref DBUtility.ClsPub.sExeReturnInfo);
|
//写入信息
|
Sub_WriteInForm1(Ds.Tables[0], i);
|
}
|
//收料通知单
|
if (oSelectRow.BillType == "1103")
|
{
|
grdMain.Rows.Add();
|
grdMain.Rows[i].Cells[HTagCol].Value = "*";
|
//得到信息
|
Ds = oWeb.getDataSetBySQL("select * from h_v_IF_POInStockList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_POInStockList", ref DBUtility.ClsPub.sExeReturnInfo);
|
//写入信息
|
Sub_WriteInForm1(Ds.Tables[0], i);
|
}
|
//采购订单
|
if (oSelectRow.BillType == "1102")
|
{
|
grdMain.Rows.Add();
|
grdMain.Rows[i].Cells[HTagCol].Value = "*";
|
//得到信息
|
Ds = oWeb.getDataSetBySQL("select * from h_v_IF_POOrderList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_POOrderList", ref DBUtility.ClsPub.sExeReturnInfo);
|
//写入信息
|
Sub_WriteInForm1(Ds.Tables[0], i);
|
}
|
//委外订单
|
if (oSelectRow.BillType == "1601")
|
{
|
grdMain.Rows.Add();
|
grdMain.Rows[i].Cells[HTagCol].Value = "*";
|
//得到信息
|
Ds = oWeb.getDataSetBySQL("select * from h_v_IF_EntrustOrderList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_EntrustOrderList", ref DBUtility.ClsPub.sExeReturnInfo);
|
//写入信息
|
Sub_WriteInForm1(Ds.Tables[0], i);
|
}
|
//入库申请单
|
if (oSelectRow.BillType == "1241")
|
{
|
grdMain.Rows.Add();
|
grdMain.Rows[i].Cells[HTagCol].Value = "*";
|
//得到信息
|
Ds = oWeb.getDataSetBySQL("select * from h_v_IF_StockInRequestList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_IF_StockInRequestList", ref DBUtility.ClsPub.sExeReturnInfo);
|
//写入信息
|
Sub_WriteInForm_1241(Ds.Tables[0], i);
|
|
if (CampanyName == "森楷") //系统参数 客户定制化名称
|
{
|
//选源单后获取班组、箱号信息显示在界面上
|
SCM.ClsGy_Group_View oGroup = new SCM.ClsGy_Group_View();
|
txtHGroupID.Tag = DBUtility.ClsPub.isLong(grdMain.Rows[0].Cells[HGroupIDCol].Value);
|
if (oGroup.GetInfoByID(DBUtility.ClsPub.isLong(grdMain.Rows[0].Cells[HGroupIDCol].Value)))
|
{
|
txtHGroupID.Text = oGroup.omodel.HName;
|
}
|
else
|
{
|
txtHGroupID.Text = "";
|
}
|
|
string HGroupID = ""; //班组
|
string HBatchNo = ""; //批次
|
string HDate = ""; //日期
|
string sCaseNoNumber = ""; //箱号前缀
|
HGroupID = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HGroupIDCol].Value);
|
HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HBatchNoCol].Value);
|
HDate = dtpHDate.Value.ToShortDateString();
|
|
//箱号前缀 = 班组ID + 批次 + 日期
|
sCaseNoNumber = HGroupID + HBatchNo + HDate;
|
Ds = oWeb.getDataSetBySQL("exec h_p_WMS_GetMaxNo '" + sCaseNoNumber + "'", "h_p_WMS_GetMaxNo", ref DBUtility.ClsPub.sExeReturnInfo);//获取最大流水号
|
txtHCaseNo.Text = (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) + 1).ToString();
|
txtHCaseNo.Tag = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]).ToString();
|
}
|
}
|
//即时库存
|
if (oSelectRow.BillType == "JSKC")
|
{
|
grdMain.Rows.Add();
|
Application.DoEvents();
|
//得到信息
|
Ds = oWeb.getDataSetBySQL("select * from h_v_KF_ICInventoryList_IF where hmaterid=" + oSelectRow.BillMainID + " and hwhid=" + oSelectRow.BillSubID + " and hspid=" + oSelectRow.SPID + " and 批次='" + oSelectRow.BatchNo + "' and 计划跟踪号='" + oSelectRow.BillNo + "'", "h_v_KF_ICInventoryList_IF", ref DBUtility.ClsPub.sExeReturnInfo);
|
//写入信息
|
Sub_WriteInForm2(Ds.Tables[0], i);
|
}
|
|
}
|
//
|
oSumGrid.Changelock = false;
|
DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid);
|
}
|
//根据TABLE写入界面(生产任务单)
|
private void Sub_WriteInForm(DataTable oTable, int i)
|
{
|
if (CampanyName == "韩电") //系统参数 客户定制化名称
|
{
|
////加载表头
|
//this.txtHDeptID.Tag = oTable.Rows[0]["HDeptID"].ToString();
|
//this.txtHDeptID.Text = oTable.Rows[0]["部门名称"].ToString();
|
////加载表体
|
grdMain.Rows[i].Cells[HTagCol].Value = "*";
|
grdMain.Rows[i].Cells[HQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["未生成条码数量"]);
|
grdMain.Rows[i].Cells[HinitQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["未生成条码数量"]);
|
//
|
grdMain.Rows[i].Cells[HMainIDCol].Value = oTable.Rows[0]["hmainid"].ToString();
|
grdMain.Rows[i].Cells[HSubIDCol].Value = oTable.Rows[0]["hsubid"].ToString();
|
grdMain.Rows[i].Cells[HBillNoCol].Value = oTable.Rows[0]["单据号"].ToString();
|
grdMain.Rows[i].Cells[HBillTypeCol].Value = oTable.Rows[0]["HBillType"].ToString();
|
grdMain.Rows[i].Cells[HDateCol].Value = oTable.Rows[0]["日期"].ToString();
|
grdMain.Rows[i].Cells[HSupIDCol].Value = oTable.Rows[0]["hsupid"].ToString();
|
grdMain.Rows[i].Cells[HSupNumberCol].Value = oTable.Rows[0]["供应商代码"].ToString();
|
grdMain.Rows[i].Cells[HSupNameCol].Value = oTable.Rows[0]["供应商"].ToString();
|
grdMain.Rows[i].Cells[HDeptIDCol].Value = oTable.Rows[0]["HDeptID"].ToString();
|
grdMain.Rows[i].Cells[HDeptNumberCol].Value = oTable.Rows[0]["部门代码"].ToString();
|
grdMain.Rows[i].Cells[HDeptNameCol].Value = oTable.Rows[0]["部门"].ToString();
|
grdMain.Rows[i].Cells[HMaterIDCol].Value = oTable.Rows[0]["HMaterID"].ToString();
|
grdMain.Rows[i].Cells[HMaterNumberCol].Value = oTable.Rows[0]["物料代码"].ToString();
|
grdMain.Rows[i].Cells[HMaterNameCol].Value = oTable.Rows[0]["物料名称"].ToString();
|
grdMain.Rows[i].Cells[HMaterModelCol].Value = oTable.Rows[0]["规格型号"].ToString();
|
//grdMain.Rows[i].Cells[HBatchManagerCol].Value = oTable.Rows[0]["是否启用批次"].ToString();
|
grdMain.Rows[i].Cells[HCustomBatchNoCol].Value = oTable.Rows[0]["批次"].ToString();
|
grdMain.Rows[i].Cells[HUnitIDCol].Value = oTable.Rows[0]["HUnitID"].ToString();
|
grdMain.Rows[i].Cells[HUnitNumberCol].Value = oTable.Rows[0]["计量单位代码"].ToString();
|
grdMain.Rows[i].Cells[HUnitNameCol].Value = oTable.Rows[0]["计量单位"].ToString();
|
grdMain.Rows[i].Cells[HRemarkCol].Value = oTable.Rows[0]["备注"].ToString();
|
grdMain.Rows[i].Cells[HMTONoCol].Value = oTable.Rows[0]["计划跟踪号"].ToString();
|
grdMain.Rows[i].Cells[HAuxPropIDCol].Value = oTable.Rows[0]["HAuxPropID"].ToString();
|
grdMain.Rows[i].Cells[HAuxPropNumberCol].Value = oTable.Rows[0]["辅助属性代码"].ToString();
|
grdMain.Rows[i].Cells[HAuxPropNameCol].Value = oTable.Rows[0]["辅助属性"].ToString();
|
grdMain.Rows[i].Cells[HCusIDCol].Value = oTable.Rows[0]["HCusID"].ToString();
|
grdMain.Rows[i].Cells[HCusNumberCol].Value = oTable.Rows[0]["客户代码"].ToString();
|
grdMain.Rows[i].Cells[HCusNameCol].Value = oTable.Rows[0]["客户"].ToString();
|
grdMain.Rows[i].Cells[HCusTypeCol].Value = oTable.Rows[0]["客户型号"].ToString();
|
//grdMain.Rows[i].Cells[HSourceIDCol].Value = oTable.Rows[0]["HSourceID"].ToString();
|
//grdMain.Rows[i].Cells[HSourceNumberCol].Value = oTable.Rows[0]["生产线代码"].ToString();
|
grdMain.Rows[i].Cells[HSourceNameCol].Value = oTable.Rows[0]["生产线"].ToString();
|
grdMain.Rows[i].Cells[HBeginDateCol].Value = oTable.Rows[0]["计划完工日期"].ToString();
|
grdMain.Rows[i].Cells[HEndDateCol].Value = oTable.Rows[0]["计划完工日期"].ToString();
|
grdMain.Rows[i].Cells[HMinQtyCol].Value = oTable.Rows[0]["最小包装数"].ToString();
|
grdMain.Rows[i].Cells[HSeOrderBillNoCol].Value = oTable.Rows[0]["销售订单号"].ToString();
|
grdMain.Rows[i].Cells[HModelCol].Value = oTable.Rows[0]["产品型号"].ToString();
|
grdMain.Rows[i].Cells[HColorCol].Value = oTable.Rows[0]["颜色"].ToString();
|
grdMain.Rows[i].Cells[HJiaYeCol].Value = oTable.Rows[0]["加液代码"].ToString();
|
grdMain.Rows[i].Cells[HPackageSizeCol].Value = oTable.Rows[0]["包装尺寸"].ToString();
|
grdMain.Rows[i].Cells[HJQtyCol].Value = oTable.Rows[0]["净重"].ToString();
|
grdMain.Rows[i].Cells[HMQtyCol].Value = oTable.Rows[0]["毛重"].ToString();
|
grdMain.Rows[i].Cells[HLogoCol].Value = oTable.Rows[0]["品牌"].ToString();
|
grdMain.Rows[i].Cells[HPressModelCol].Value = oTable.Rows[0]["压机型号"].ToString();
|
grdMain.Rows[i].Cells[HCusModelCol].Value = oTable.Rows[0]["客户型号"].ToString();
|
grdMain.Rows[i].Cells[HGBBarCodeCol].Value = oTable.Rows[0]["国标码"].ToString();
|
grdMain.Rows[i].Cells[HJiaYeLXCol].Value = oTable.Rows[0]["制冷液类型"].ToString();
|
grdMain.Rows[i].Cells[HJiaYeLCol].Value = oTable.Rows[0]["加液量"].ToString();
|
//grdMain.Rows[i].Cells[HDateCol].Value = string.Format("{0:yyyyMMdd}", ClsPub.isDate(ClsPub.GetServerDate(0)));
|
//--
|
//设置可编辑列
|
string sAllowCol = HQtyCol.ToString() +
|
"," + HGroupNameCol.ToString() +
|
"," + HMaterNameCol.ToString() +
|
"," + HAuxPropNumberCol.ToString() +
|
"," + HPressModelCol.ToString() +
|
"," + HGBBarCodeCol.ToString() +
|
//"," + HCusModelCol.ToString() +
|
//"," + HLogoCol.ToString() +
|
"," + HMinQtyCol.ToString();
|
grdMain.Columns[HBillNoCol].ReadOnly = true;
|
//设置合计列
|
string sTotalCol = HQtyCol.ToString();
|
//
|
ClsPub1.initGridLast(sAllowCol, sTotalCol, oSumGrid);
|
tabControl1.SelectedIndex = 0;
|
bc.Enabled = true;
|
//
|
RowCount(i, 0);
|
}
|
else
|
{
|
////加载表头
|
//this.txtHDeptID.Tag = oTable.Rows[0]["HDeptID"].ToString();
|
//this.txtHDeptID.Text = oTable.Rows[0]["部门名称"].ToString();
|
////加载表体
|
grdMain.Rows[i].Cells[HTagCol].Value = "*";
|
grdMain.Rows[i].Cells[HQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["未生成条码数量"]);
|
grdMain.Rows[i].Cells[HinitQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["未生成条码数量"]);
|
//
|
grdMain.Rows[i].Cells[HMainIDCol].Value = oTable.Rows[0]["hmainid"].ToString();
|
grdMain.Rows[i].Cells[HSubIDCol].Value = oTable.Rows[0]["hsubid"].ToString();
|
grdMain.Rows[i].Cells[HBillNoCol].Value = oTable.Rows[0]["单据号"].ToString();
|
grdMain.Rows[i].Cells[HBillTypeCol].Value = oTable.Rows[0]["HBillType"].ToString();
|
grdMain.Rows[i].Cells[HDateCol].Value = oTable.Rows[0]["日期"].ToString();
|
grdMain.Rows[i].Cells[HSupIDCol].Value = oTable.Rows[0]["hsupid"].ToString();
|
grdMain.Rows[i].Cells[HSupNumberCol].Value = oTable.Rows[0]["供应商代码"].ToString();
|
grdMain.Rows[i].Cells[HSupNameCol].Value = oTable.Rows[0]["供应商"].ToString();
|
grdMain.Rows[i].Cells[HDeptIDCol].Value = oTable.Rows[0]["HDeptID"].ToString();
|
grdMain.Rows[i].Cells[HDeptNumberCol].Value = oTable.Rows[0]["部门代码"].ToString();
|
grdMain.Rows[i].Cells[HDeptNameCol].Value = oTable.Rows[0]["部门"].ToString();
|
grdMain.Rows[i].Cells[HMaterIDCol].Value = oTable.Rows[0]["HMaterID"].ToString();
|
grdMain.Rows[i].Cells[HMaterNumberCol].Value = oTable.Rows[0]["物料代码"].ToString();
|
grdMain.Rows[i].Cells[HMaterNameCol].Value = oTable.Rows[0]["物料名称"].ToString();
|
grdMain.Rows[i].Cells[HMaterModelCol].Value = oTable.Rows[0]["规格型号"].ToString();
|
//grdMain.Rows[i].Cells[HBatchManagerCol].Value = oTable.Rows[0]["是否启用批次"].ToString();
|
grdMain.Rows[i].Cells[HBatchNoCol].Value = oTable.Rows[0]["批次"].ToString();
|
grdMain.Rows[i].Cells[HAuxPropIDCol].Value = oTable.Rows[0]["HAuxPropID"].ToString();
|
grdMain.Rows[i].Cells[HAuxPropNumberCol].Value = oTable.Rows[0]["辅助属性代码"].ToString();
|
grdMain.Rows[i].Cells[HAuxPropNameCol].Value = oTable.Rows[0]["辅助属性"].ToString();
|
grdMain.Rows[i].Cells[HUnitIDCol].Value = oTable.Rows[0]["HUnitID"].ToString();
|
grdMain.Rows[i].Cells[HUnitNumberCol].Value = oTable.Rows[0]["计量单位代码"].ToString();
|
grdMain.Rows[i].Cells[HUnitNameCol].Value = oTable.Rows[0]["计量单位"].ToString();
|
grdMain.Rows[i].Cells[HRemarkCol].Value = oTable.Rows[0]["备注"].ToString();
|
grdMain.Rows[i].Cells[HMTONoCol].Value = oTable.Rows[0]["计划跟踪号"].ToString();
|
grdMain.Rows[i].Cells[HCusIDCol].Value = oTable.Rows[0]["HCusID"].ToString();
|
grdMain.Rows[i].Cells[HCusNumberCol].Value = oTable.Rows[0]["客户代码"].ToString();
|
grdMain.Rows[i].Cells[HCusNameCol].Value = oTable.Rows[0]["客户"].ToString();
|
grdMain.Rows[i].Cells[HCusTypeCol].Value = oTable.Rows[0]["客户型号"].ToString();
|
//grdMain.Rows[i].Cells[HSourceIDCol].Value = oTable.Rows[0]["HSourceID"].ToString();
|
//grdMain.Rows[i].Cells[HSourceNumberCol].Value = oTable.Rows[0]["生产线代码"].ToString();
|
grdMain.Rows[i].Cells[HSourceNameCol].Value = oTable.Rows[0]["生产线"].ToString();
|
grdMain.Rows[i].Cells[HEndDateCol].Value = oTable.Rows[0]["计划完工日期"].ToString();
|
grdMain.Rows[i].Cells[HMinQtyCol].Value = oTable.Rows[0]["最小包装数"].ToString();
|
grdMain.Rows[i].Cells[HPinfanCol].Value = oTable.Rows[0]["HPinfan"].ToString();
|
grdMain.Rows[i].Cells[HPinfanBarCodeCol].Value = oTable.Rows[0]["HPinfanBarCode"].ToString();
|
//grdMain.Rows[i].Cells[HDateCol].Value = string.Format("{0:yyyyMMdd}", ClsPub.isDate(ClsPub.GetServerDate(0)));
|
//--
|
//设置可编辑列
|
string sAllowCol;
|
if (CampanyName == "圣龙") //系统参数 客户定制化名称
|
{
|
sAllowCol = HQtyCol.ToString() +
|
"," + HMaterNameCol.ToString() +
|
"," + HMaterModelCol.ToString() +
|
"," + HPinfanCol.ToString() +
|
"," + HSupNumberCol.ToString() +
|
"," + POOrderBillNoCol.ToString() +
|
"," + HMinQtyCol.ToString();
|
}
|
else
|
{
|
sAllowCol = HQtyCol.ToString() +
|
"," + HMaterNameCol.ToString() +
|
"," + HMaterModelCol.ToString() +
|
"," + HPinfanCol.ToString() +
|
"," + HBatchNoCol.ToString() +
|
"," + HSupNumberCol.ToString() +
|
"," + POOrderBillNoCol.ToString() +
|
"," + HMinQtyCol.ToString();
|
}
|
grdMain.Columns[HBillNoCol].ReadOnly = true;
|
//设置合计列
|
string sTotalCol = HQtyCol.ToString();
|
//
|
ClsPub1.initGridLast(sAllowCol, sTotalCol, oSumGrid);
|
tabControl1.SelectedIndex = 0;
|
bc.Enabled = true;
|
//
|
RowCount(i, 0);
|
}
|
}
|
|
//根据TABLE写入界面
|
private void Sub_WriteInForm1(DataTable oTable, int i)
|
{
|
////加载表头
|
//this.txtHDeptID.Tag = oTable.Rows[0]["HDeptID"].ToString();
|
//this.txtHDeptID.Text = oTable.Rows[0]["部门名称"].ToString();
|
////加载表体
|
grdMain.Rows[i].Cells[HTagCol].Value = "*";
|
grdMain.Rows[i].Cells[HQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["未生成条码数量"]);
|
grdMain.Rows[i].Cells[HinitQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["未生成条码数量"]);
|
//
|
grdMain.Rows[i].Cells[HMainIDCol].Value = oTable.Rows[0]["hmainid"].ToString();
|
grdMain.Rows[i].Cells[HSubIDCol].Value = oTable.Rows[0]["hsubid"].ToString();
|
grdMain.Rows[i].Cells[HBillNoCol].Value = oTable.Rows[0]["单据号"].ToString();
|
grdMain.Rows[i].Cells[HBillTypeCol].Value = oTable.Rows[0]["HBillType"].ToString();
|
grdMain.Rows[i].Cells[HDateCol].Value = oTable.Rows[0]["日期"].ToString();
|
grdMain.Rows[i].Cells[HSupIDCol].Value = oTable.Rows[0]["hsupid"].ToString();
|
grdMain.Rows[i].Cells[HSupNumberCol].Value = oTable.Rows[0]["供应商代码"].ToString();
|
grdMain.Rows[i].Cells[HSupNameCol].Value = oTable.Rows[0]["供应商"].ToString();
|
grdMain.Rows[i].Cells[HDeptIDCol].Value = oTable.Rows[0]["HDeptID"].ToString();
|
grdMain.Rows[i].Cells[HDeptNumberCol].Value = oTable.Rows[0]["部门代码"].ToString();
|
grdMain.Rows[i].Cells[HDeptNameCol].Value = oTable.Rows[0]["部门"].ToString();
|
grdMain.Rows[i].Cells[HMaterIDCol].Value = oTable.Rows[0]["HMaterID"].ToString();
|
grdMain.Rows[i].Cells[HMaterNumberCol].Value = oTable.Rows[0]["物料代码"].ToString();
|
grdMain.Rows[i].Cells[HMaterNameCol].Value = oTable.Rows[0]["物料名称"].ToString();
|
grdMain.Rows[i].Cells[HMaterModelCol].Value = oTable.Rows[0]["规格型号"].ToString();
|
//grdMain.Rows[i].Cells[HBatchManagerCol].Value = oTable.Rows[0]["是否启用批次"].ToString();
|
grdMain.Rows[i].Cells[HBatchNoCol].Value = oTable.Rows[0]["批次"].ToString();
|
grdMain.Rows[i].Cells[HAuxPropIDCol].Value = oTable.Rows[0]["HAuxPropID"].ToString();
|
grdMain.Rows[i].Cells[HAuxPropNumberCol].Value = oTable.Rows[0]["辅助属性代码"].ToString();
|
grdMain.Rows[i].Cells[HAuxPropNameCol].Value = oTable.Rows[0]["辅助属性"].ToString();
|
grdMain.Rows[i].Cells[HUnitIDCol].Value = oTable.Rows[0]["HUnitID"].ToString();
|
grdMain.Rows[i].Cells[HUnitNumberCol].Value = oTable.Rows[0]["计量单位代码"].ToString();
|
grdMain.Rows[i].Cells[HUnitNameCol].Value = oTable.Rows[0]["计量单位"].ToString();
|
grdMain.Rows[i].Cells[HRemarkCol].Value = oTable.Rows[0]["备注"].ToString();
|
grdMain.Rows[i].Cells[HMTONoCol].Value = oTable.Rows[0]["计划跟踪号"].ToString();
|
grdMain.Rows[i].Cells[HMinQtyCol].Value = oTable.Rows[0]["最小包装数"].ToString();
|
|
if (CampanyName == "圣龙") //系统参数 客户定制化名称
|
{
|
grdMain.Rows[i].Cells[POOrderBillNoCol].Value = oTable.Rows[0]["采购订单号"].ToString();
|
}
|
//--
|
//设置可编辑列
|
string sAllowCol;
|
if (CampanyName == "圣龙") //系统参数 客户定制化名称
|
{
|
sAllowCol = HQtyCol.ToString() +
|
"," + HGroupNameCol.ToString() +
|
"," + HMaterNameCol.ToString() +
|
"," + HAuxPropNumberCol.ToString() +
|
"," + HMaterModelCol.ToString() +
|
"," + HPinfanCol.ToString() +
|
"," + HSupNumberCol.ToString() +
|
"," + POOrderBillNoCol.ToString() +
|
"," + HPressModelCol.ToString() +
|
"," + HGBBarCodeCol.ToString() +
|
"," + HMinQtyCol.ToString();
|
}
|
else
|
{
|
sAllowCol = HQtyCol.ToString() +
|
"," + HGroupNameCol.ToString() +
|
"," + HMaterNameCol.ToString() +
|
"," + HAuxPropNumberCol.ToString() +
|
"," + HMaterModelCol.ToString() +
|
"," + HPinfanCol.ToString() +
|
"," + HBatchNoCol.ToString() +
|
"," + HSupNumberCol.ToString() +
|
"," + POOrderBillNoCol.ToString() +
|
"," + HPressModelCol.ToString() +
|
"," + HGBBarCodeCol.ToString() +
|
"," + HMinQtyCol.ToString();
|
}
|
grdMain.Columns[HBillNoCol].ReadOnly = true;
|
//设置合计列
|
string sTotalCol = HQtyCol.ToString();
|
//
|
ClsPub1.initGridLast(sAllowCol, sTotalCol, oSumGrid);
|
tabControl1.SelectedIndex = 0;
|
bc.Enabled = true;
|
//
|
RowCount(i, 0);
|
}
|
|
//根据TABLE写入界面(入库申请单)
|
private void Sub_WriteInForm_1241(DataTable oTable, int i)
|
{
|
////加载表体
|
grdMain.Rows[i].Cells[HTagCol].Value = "*";
|
grdMain.Rows[i].Cells[HQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["未生成条码数量"]);
|
grdMain.Rows[i].Cells[HinitQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["未生成条码数量"]);
|
grdMain.Rows[i].Cells[HMinQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["最小包装数"]);
|
//
|
grdMain.Rows[i].Cells[HMainIDCol].Value = oTable.Rows[0]["hmainid"].ToString();
|
grdMain.Rows[i].Cells[HSubIDCol].Value = oTable.Rows[0]["hsubid"].ToString();
|
grdMain.Rows[i].Cells[HBillNoCol].Value = oTable.Rows[0]["单据号"].ToString();
|
grdMain.Rows[i].Cells[HBillTypeCol].Value = oTable.Rows[0]["HBillType"].ToString();
|
grdMain.Rows[i].Cells[HDateCol].Value = oTable.Rows[0]["日期"].ToString();
|
grdMain.Rows[i].Cells[HSupIDCol].Value = oTable.Rows[0]["hsupid"].ToString();
|
grdMain.Rows[i].Cells[HSupNumberCol].Value = oTable.Rows[0]["供应商代码"].ToString();
|
grdMain.Rows[i].Cells[HSupNameCol].Value = oTable.Rows[0]["供应商"].ToString();
|
grdMain.Rows[i].Cells[HDeptIDCol].Value = oTable.Rows[0]["HDeptID"].ToString();
|
grdMain.Rows[i].Cells[HDeptNumberCol].Value = oTable.Rows[0]["部门代码"].ToString();
|
grdMain.Rows[i].Cells[HDeptNameCol].Value = oTable.Rows[0]["部门"].ToString();
|
grdMain.Rows[i].Cells[HMaterIDCol].Value = oTable.Rows[0]["HMaterID"].ToString();
|
grdMain.Rows[i].Cells[HMaterNumberCol].Value = oTable.Rows[0]["物料代码"].ToString();
|
grdMain.Rows[i].Cells[HMaterNameCol].Value = oTable.Rows[0]["物料名称"].ToString();
|
grdMain.Rows[i].Cells[HMaterModelCol].Value = oTable.Rows[0]["规格型号"].ToString();
|
grdMain.Rows[i].Cells[HBatchNoCol].Value = oTable.Rows[0]["批次"].ToString();
|
grdMain.Rows[i].Cells[HUnitIDCol].Value = oTable.Rows[0]["HUnitID"].ToString();
|
grdMain.Rows[i].Cells[HUnitNumberCol].Value = oTable.Rows[0]["计量单位代码"].ToString();
|
grdMain.Rows[i].Cells[HUnitNameCol].Value = oTable.Rows[0]["计量单位"].ToString();
|
grdMain.Rows[i].Cells[HRemarkCol].Value = oTable.Rows[0]["备注"].ToString();
|
grdMain.Rows[i].Cells[HAuxPropIDCol].Value = oTable.Rows[0]["HAuxPropID"].ToString();
|
grdMain.Rows[i].Cells[HAuxPropNumberCol].Value = oTable.Rows[0]["辅助属性代码"].ToString();
|
grdMain.Rows[i].Cells[HAuxPropNameCol].Value = oTable.Rows[0]["辅助属性"].ToString();
|
grdMain.Rows[i].Cells[HJiaYeCol].Value = oTable.Rows[0]["品种"].ToString();
|
grdMain.Rows[i].Cells[HModelCol].Value = oTable.Rows[0]["规格型号"].ToString();
|
grdMain.Rows[i].Cells[HLogoCol].Value = oTable.Rows[0]["等级"].ToString();
|
grdMain.Rows[i].Cells[HPackageSizeCol].Value = oTable.Rows[0]["筒数"].ToString();
|
grdMain.Rows[i].Cells[HBarCode_PackCol].Value = oTable.Rows[0]["码单"].ToString();
|
grdMain.Rows[i].Cells[HColorCol].Value = oTable.Rows[0]["色泽"].ToString();
|
grdMain.Rows[i].Cells[HCusModelCol].Value = oTable.Rows[0]["管色"].ToString();
|
grdMain.Rows[i].Cells[HMQtyCol].Value = oTable.Rows[0]["毛重"].ToString();
|
grdMain.Rows[i].Cells[HJQtyCol].Value = oTable.Rows[0]["净重"].ToString();
|
grdMain.Rows[i].Cells[HPressModelCol].Value = oTable.Rows[0]["捻向"].ToString();
|
grdMain.Rows[i].Cells[HGroupIDCol].Value = oTable.Rows[0]["HGroupID"].ToString();
|
grdMain.Rows[i].Cells[HGroupNumberCol].Value = oTable.Rows[0]["班组代码"].ToString();
|
grdMain.Rows[i].Cells[HGroupNameCol].Value = oTable.Rows[0]["班组"].ToString();
|
//--
|
//设置可编辑列
|
string sAllowCol = HTagCol.ToString();
|
grdMain.Columns[HBillNoCol].ReadOnly = true;
|
//设置合计列
|
string sTotalCol = HQtyCol.ToString();
|
//
|
ClsPub1.initGridLast(sAllowCol, sTotalCol, oSumGrid);
|
tabControl1.SelectedIndex = 0;
|
bc.Enabled = true;
|
//
|
RowCount(i, 0);
|
}
|
|
//根据TABLE写入界面(即时库存)
|
private void Sub_WriteInForm2(DataTable oTable, int i)
|
{
|
////加载表头
|
//this.txtHDeptID.Tag = oTable.Rows[0]["HDeptID"].ToString();
|
//this.txtHDeptID.Text = oTable.Rows[0]["部门名称"].ToString();
|
////加载表体
|
grdMain.Rows[i].Cells[HTagCol].Value = "*";
|
grdMain.Rows[i].Cells[HQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["数量"]);
|
grdMain.Rows[i].Cells[HinitQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["数量"]);
|
//
|
//grdMain.Rows[i].Cells[HMainIDCol].Value = oTable.Rows[0]["hmainid"].ToString();
|
//grdMain.Rows[i].Cells[HBillNoCol].Value = oTable.Rows[0]["任务单号"].ToString();
|
//grdMain.Rows[i].Cells[HBillTypeCol].Value = oTable.Rows[0]["HBillType"].ToString();
|
grdMain.Rows[i].Cells[HMaterIDCol].Value = oTable.Rows[0]["HMaterID"].ToString();
|
grdMain.Rows[i].Cells[HMaterNumberCol].Value = oTable.Rows[0]["物料代码"].ToString();
|
grdMain.Rows[i].Cells[HMaterNameCol].Value = oTable.Rows[0]["物料名称"].ToString();
|
grdMain.Rows[i].Cells[HMaterModelCol].Value = oTable.Rows[0]["规格型号"].ToString();
|
grdMain.Rows[i].Cells[HAuxPropIDCol].Value = oTable.Rows[0]["HAuxPropID"].ToString();
|
grdMain.Rows[i].Cells[HAuxPropNumberCol].Value = oTable.Rows[0]["辅助属性代码"].ToString();
|
grdMain.Rows[i].Cells[HAuxPropNameCol].Value = oTable.Rows[0]["辅助属性名称"].ToString();
|
grdMain.Rows[i].Cells[HBatchNoCol].Value = oTable.Rows[0]["批次"].ToString();
|
grdMain.Rows[i].Cells[HUnitIDCol].Value = oTable.Rows[0]["HUnitID"].ToString();
|
grdMain.Rows[i].Cells[HUnitNumberCol].Value = oTable.Rows[0]["计量单位代码"].ToString();
|
grdMain.Rows[i].Cells[HUnitNameCol].Value = oTable.Rows[0]["计量单位"].ToString();
|
grdMain.Rows[i].Cells[HSupIDCol].Value = oTable.Rows[0]["HSupplyID"].ToString();
|
grdMain.Rows[i].Cells[HSupNumberCol].Value = oTable.Rows[0]["供应商代码"].ToString();
|
grdMain.Rows[i].Cells[HSupNameCol].Value = oTable.Rows[0]["供应商"].ToString();
|
grdMain.Rows[i].Cells[HWhIDCol].Value = oTable.Rows[0]["HWhID"].ToString();
|
grdMain.Rows[i].Cells[HWhNumberCol].Value = oTable.Rows[0]["仓库代码"].ToString();
|
grdMain.Rows[i].Cells[HWhNameCol].Value = oTable.Rows[0]["仓库"].ToString();
|
grdMain.Rows[i].Cells[HSPIDCol].Value = oTable.Rows[0]["HSPID"].ToString();
|
grdMain.Rows[i].Cells[HSPNumberCol].Value = oTable.Rows[0]["仓位代码"].ToString();
|
grdMain.Rows[i].Cells[HSPNameCol].Value = oTable.Rows[0]["仓位"].ToString();
|
grdMain.Rows[i].Cells[HDateCol].Value = ClsPub.GetServerDate(0);
|
grdMain.Rows[i].Cells[HRemarkCol].Value = "按库存生成";
|
grdMain.Rows[i].Cells[HMTONoCol].Value = oTable.Rows[0]["计划跟踪号"].ToString();
|
//--
|
//设置可编辑列
|
string sAllowCol = HQtyCol.ToString() +
|
"," + HMinQtyCol.ToString();
|
grdMain.Columns[HBillNoCol].ReadOnly = true;
|
//设置合计列
|
string sTotalCol = HQtyCol.ToString();
|
//
|
ClsPub1.initGridLast(sAllowCol, sTotalCol, oSumGrid);
|
tabControl1.SelectedIndex = 0;
|
bc.Enabled = true;
|
//
|
RowCount(i, 0);
|
}
|
|
//网格编辑前判断
|
private void grdMain_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
|
{
|
int i = grdMain.CurrentCell.ColumnIndex;
|
if (DBUtility.Xt_BaseBillFun.AllowEdit(grdStatus, oSumGrid,i))
|
{
|
e.Cancel = true;
|
}
|
}
|
|
//网格编辑后处理
|
private void grdMain_CellEndEdit(object sender, DataGridViewCellEventArgs e)
|
{
|
DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid);
|
if (e.ColumnIndex == HMinQtyCol)
|
{
|
RowCount(e.RowIndex, 0); //
|
}
|
else if (e.ColumnIndex == HQtyCol)
|
{
|
RowCount(e.RowIndex, 0); //
|
}
|
//
|
if (this.EditingControl != null) //释放事件
|
{
|
EditingControl.KeyDown -= new KeyEventHandler(this.EditingControl_KeyDown);
|
this.EditingControl = null;
|
}
|
}
|
DataGridViewTextBoxEditingControl EditingControl;
|
|
private void grdMain_CellLeave(object sender, DataGridViewCellEventArgs e)
|
{
|
//
|
if (!grdStatus)
|
{
|
return;
|
}
|
DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid);
|
//
|
//if (oSumGrid.Changelock)
|
// return;
|
//if(oSumGrid.EditStatus)
|
//{
|
if (!CheckGridRow(oSumGrid.OldCell.Row))
|
return;
|
//}
|
}
|
|
private void grdMain_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e)
|
{
|
DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid);
|
}
|
|
private void grdMain_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
|
{
|
if (grdMain.CurrentCell != null)
|
{
|
if (e.Control is DataGridViewTextBoxEditingControl)
|
{
|
this.EditingControl = (DataGridViewTextBoxEditingControl)e.Control;
|
//增加委托处理
|
this.EditingControl.KeyDown += new KeyEventHandler(this.EditingControl_KeyDown);
|
}
|
}
|
}
|
private void EditingControl_KeyDown(object sender, KeyEventArgs e)
|
{
|
//业务处理
|
Sub_GridKey(e.KeyValue, grdMain.CurrentRow.Index, grdMain.CurrentCell.ColumnIndex, EditingControl);
|
}
|
private void grdMain_RowHeadersWidthChanged(object sender, EventArgs e)
|
{
|
DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid);
|
}
|
|
private void grdMain_Scroll(object sender, ScrollEventArgs e)
|
{
|
DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid);
|
oSumGrid.DisplayCurRow();
|
}
|
|
#endregion
|
|
|
#region //打印设置
|
|
GridppReport Report;
|
string sBarCode = "";
|
|
//预览
|
int CurRows = 0;
|
private void yl_Click(object sender, EventArgs e)
|
{
|
//判断是否已经生成条码
|
if (DBUtility.ClsPub.isStrNull(grdSub.Rows[0].Cells[HTMCol].Value) == "")
|
{
|
MessageBox.Show("条码未生成,请先生成条码后再预览!");
|
return;
|
}
|
|
//打印前判断条码是否已打印过
|
if (ReportPrintBegin())
|
{
|
return;
|
}
|
|
//选择打印模板
|
SCM.Gy_OpenTmp oFrm = new SCM.Gy_OpenTmp();
|
oFrm.sBillName = ModName;
|
oFrm.sBillModel = ModCaption;
|
oFrm.ShowDialog();
|
if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK)
|
{
|
Sub_SetReport(oFrm.sOpenTmp);
|
Report.PrintPreview(false);
|
Thread.Sleep(1000);
|
}
|
}
|
|
//打印前判断条码是否已打印过
|
private bool ReportPrintBegin()
|
{
|
string sRelQty = "";
|
|
if (oWeb.Set_BPrintQtyBarCode(DBUtility.ClsPub.isStrNull(grdSub.Rows[0].Cells[HTMCol].Value), ref sRelQty))
|
{
|
MessageBox.Show("条码已经打印过,不可重复打印!");
|
return true;
|
}
|
else
|
{
|
return false;
|
}
|
}
|
|
//打印结束后回填条码打印次数
|
private void ReportPrintEnd()
|
{
|
try
|
{
|
//sBarCode = "";
|
//for (int i = 0; i < grdSub.Rows.Count; i++)
|
//{
|
// sBarCode = sBarCode + "," + DBUtility.ClsPub.isStrNull(grdSub.Rows[i].Cells[HTMCol].Value);
|
//}
|
|
//oWeb.getRunProc("exec h_p_Gy_BarCodePrintQty_Update '" + sBarCode + "'", ref DBUtility.ClsPub.sExeReturnInfo);
|
|
oWeb.getRunProc("update Gy_BarCodeBill set HPrintQty=isnull(HPrintQty,0)+1 where HInterID=" + HInterID, ref DBUtility.ClsPub.sExeReturnInfo);
|
}
|
catch (Exception e)
|
{
|
MessageBox.Show("打印失败!打印结束 :" + e.Message);
|
}
|
}
|
|
private void Sub_SetReport(string sOpenTmp)
|
{
|
//判断行数
|
for (int i = 0; i < grdList.Rows.Count; i++)
|
{
|
grdList.Rows[i].Cells[0].Value = "*";
|
//grdList.Rows[i].Cells[0].Value = "";
|
}
|
//for (int i = 0; i < grdList.SelectedRows.Count; i++)
|
//{
|
// grdList.Rows[grdList.SelectedRows[i].Index].Cells[0].Value = "*";
|
//}
|
//
|
Report = new GridppReport();
|
Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + sOpenTmp + ".grf"); //here .
|
Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord);
|
Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable);
|
Report.PrintEnd += new _IGridppReportEvents_PrintEndEventHandler(ReportPrintEnd);
|
}
|
|
//填入单据表头信息
|
private void ReportBeforePostRecord()//
|
{
|
try
|
{
|
//Report.FieldByName("物料代码").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HMaterNumber2Col].Value);
|
//Report.FieldByName("物料名称").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HMaterName2Col].Value);
|
//Report.FieldByName("规格型号").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HMaterModel2Col].Value);
|
////Report.FieldByName("自定义规格").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HModel2Col].Value);
|
//Report.FieldByName("条码编号").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HTMCol].Value);
|
//Report.FieldByName("数量").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HQty2Col].Value);
|
//Report.FieldByName("源单单号").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HSourceBillNoCol].Value);
|
//Report.FieldByName("销售订单号").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HSeOrderBillNo2Col].Value);
|
//Report.FieldByName("生产车间").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HDeptName2Col].Value);
|
//Report.FieldByName("备注").AsString = ClsPub.isStrNull(grdSub.Rows[CurRows].Cells[HRemark2Col].Value);
|
}
|
catch (Exception e)
|
{
|
MessageBox.Show("打印失败!表头:" + e.Message);
|
}
|
}
|
|
private Int32 Fun_GetCol(string sCol)
|
{
|
return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdList);
|
}
|
private void ReportFetchRecordByDataTable()
|
{
|
try
|
{
|
DataTable ds = new DataTable();
|
//BLL.Utility.FillRecordToReport(Report, grdSub, ds, HMaterIDCol);
|
SCM.Utility.FillRecordToReport(Report, grdList, ds, Fun_GetCol("选择"));
|
}
|
catch (Exception e)
|
{
|
MessageBox.Show("打印失败!表体:" + e.Message);
|
}
|
}
|
|
private void dy_Click(object sender, EventArgs e)
|
{
|
//判断是否已经生成条码
|
if (DBUtility.ClsPub.isStrNull(grdSub.Rows[0].Cells[HTMCol].Value) == "")
|
{
|
MessageBox.Show("条码未生成,请先生成条码后再打印!");
|
return;
|
}
|
|
//打印前判断条码是否已打印过
|
if (ReportPrintBegin())
|
{
|
return;
|
}
|
|
//选择打印模板
|
SCM.Gy_OpenTmp oFrm = new SCM.Gy_OpenTmp();
|
oFrm.sBillName = ModName;
|
oFrm.sBillModel = ModCaption;
|
oFrm.ShowDialog();
|
if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK)
|
{
|
//循环选中行
|
Sub_SetReport(oFrm.sOpenTmp);
|
Report.Print(true);
|
Thread.Sleep(1000);
|
}
|
}
|
|
#endregion
|
|
|
private void grdSub_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
|
{
|
int i = grdSub.CurrentCell.ColumnIndex;
|
if (DBUtility.Xt_BaseBillFun.AllowEdit(grdStatus, oSumGrid, i))
|
{
|
e.Cancel = true;
|
}
|
}
|
|
private void grdSub_CellEndEdit(object sender, DataGridViewCellEventArgs e)
|
{
|
DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid);
|
RowCount(e.RowIndex, 0); //计算 金额 单价
|
//
|
if (this.EditingControl != null) //释放事件
|
{
|
EditingControl.KeyDown -= new KeyEventHandler(this.EditingControl_KeyDown);
|
this.EditingControl = null;
|
}
|
}
|
|
//按库存生成条码
|
private void kc_Click(object sender, EventArgs e)
|
{
|
long sHOrgID = -1;
|
string sWhere = "";
|
sHOrgID = oWeb.get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
|
sWhere = " and HOrgID =" + sHOrgID.ToString();
|
SCM.Cls_S_KF_ICInventoryList_IF oadd = new SCM.Cls_S_KF_ICInventoryList_IF();
|
if (oadd.Refresh(sWhere)) //选择原单
|
//if (oadd.Refresh(" and HErpClsID in (1,2,3) ")) //选择原单
|
{
|
FillSelectData(oadd.oBillSelectColl);
|
}
|
}
|
|
|
//获取本月的第几周
|
private static int getWeekNumInMonth(DateTime daytime)
|
{
|
int dayInMonth = daytime.Day;
|
//本月第一天
|
DateTime firstDay = daytime.AddDays(1 - daytime.Day);
|
//本月第一天是周几
|
int weekday = (int)firstDay.DayOfWeek == 0 ? 7 : (int)firstDay.DayOfWeek;
|
//本月第一周有几天
|
int firstWeekEndDay = 7 - (weekday - 1);
|
//当前日期和第一周之差
|
int diffday = dayInMonth - firstWeekEndDay;
|
diffday = diffday > 0 ? diffday : 1;
|
//当前是第几周,如果整除7就减一天
|
int WeekNumInMonth = ((diffday % 7) == 0
|
? (diffday / 7 - 1)
|
: (diffday / 7)) + 1 + (dayInMonth > firstWeekEndDay ? 1 : 0);
|
return WeekNumInMonth;
|
}
|
|
//同步基础资料信息
|
private void tb_Click(object sender, EventArgs e)
|
{
|
try
|
{
|
oWeb.getRunProc("exec h_p_IFCLD_ERPDataToLocal", ref DBUtility.ClsPub.sExeReturnInfo);
|
MessageBox.Show("同步基础资料成功!");
|
}
|
catch (Exception sExeReturnInfo)
|
{
|
MessageBox.Show("同步基础资料失败!" + sExeReturnInfo.Message);
|
}
|
}
|
|
public Frm_Split oDlg = new Frm_Split();
|
|
private void spRow_Click(object sender, EventArgs e)
|
{
|
//DBUtility.Xt_BaseBillFun.AddRow(oSumGrid);
|
oDlg.ShowDialog();
|
if (oDlg.IsOk == 1)
|
{
|
grdMainData_CF(DBUtility.ClsPub.isInt(oDlg.txtHQ.Text), oDlg.cmbHAutoSNO.Text);
|
}
|
}
|
|
private void grdMainData_CF(int HQty, string HAutoSNO)
|
{
|
double hq = 0;
|
int Qty = HQty - 1;
|
int row = grdMain.CurrentCell.RowIndex;
|
string Sno = "";
|
grdMain.Rows.Insert(row + 1, Qty);
|
hq = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[HQtyCol].Value) / HQty;
|
grdMain.Rows[row].Cells[HQtyCol].Value = hq;
|
for (int i = 0; i < Qty; i++)
|
{
|
int r = i + 1;
|
grdMain.Rows[row + r].Cells[HMaterIDCol].Value = grdMain.Rows[row].Cells[HMaterIDCol].Value;
|
grdMain.Rows[row + r].Cells[HMaterNumberCol].Value = grdMain.Rows[row].Cells[HMaterNumberCol].Value;
|
grdMain.Rows[row + r].Cells[HMaterNameCol].Value = grdMain.Rows[row].Cells[HMaterNameCol].Value;
|
grdMain.Rows[row + r].Cells[HMaterModelCol].Value = grdMain.Rows[row].Cells[HMaterModelCol].Value;
|
grdMain.Rows[row + r].Cells[HUnitIDCol].Value = grdMain.Rows[row].Cells[HUnitIDCol].Value;
|
grdMain.Rows[row + r].Cells[HUnitNameCol].Value = grdMain.Rows[row].Cells[HUnitNameCol].Value;
|
grdMain.Rows[row + r].Cells[HSourceIDCol].Value = grdMain.Rows[row].Cells[HSourceIDCol].Value;
|
grdMain.Rows[row + r].Cells[HSourceNumberCol].Value = grdMain.Rows[row].Cells[HSourceNumberCol].Value;
|
grdMain.Rows[row + r].Cells[HSourceNameCol].Value = grdMain.Rows[row].Cells[HSourceNameCol].Value;
|
grdMain.Rows[row + r].Cells[HQtyCol].Value = DBUtility.ClsPub.isDoule(hq, 4);
|
grdMain.Rows[row + r].Cells[HinitQtyCol].Value = grdMain.Rows[row].Cells[HinitQtyCol].Value;
|
grdMain.Rows[row + r].Cells[HMinQtyCol].Value = 0;
|
|
grdMain.Rows[row + r].Cells[HTagCol].Value = grdMain.Rows[row].Cells[HTagCol].Value;
|
grdMain.Rows[row + r].Cells[HMainIDCol].Value = grdMain.Rows[row].Cells[HMainIDCol].Value;
|
grdMain.Rows[row + r].Cells[HSubIDCol].Value = grdMain.Rows[row].Cells[HSubIDCol].Value;
|
grdMain.Rows[row + r].Cells[HBillNoCol].Value = grdMain.Rows[row].Cells[HBillNoCol].Value;
|
grdMain.Rows[row + r].Cells[HBillTypeCol].Value = grdMain.Rows[row].Cells[HBillTypeCol].Value;
|
grdMain.Rows[row + r].Cells[HDateCol].Value = grdMain.Rows[row].Cells[HDateCol].Value;
|
grdMain.Rows[row + r].Cells[HSupIDCol].Value = grdMain.Rows[row].Cells[HSupIDCol].Value;
|
grdMain.Rows[row + r].Cells[HSupNumberCol].Value = grdMain.Rows[row].Cells[HSupNumberCol].Value;
|
grdMain.Rows[row + r].Cells[HSupNameCol].Value = grdMain.Rows[row].Cells[HSupNameCol].Value;
|
grdMain.Rows[row + r].Cells[HDeptIDCol].Value = grdMain.Rows[row].Cells[HDeptIDCol].Value;
|
grdMain.Rows[row + r].Cells[HDeptNumberCol].Value = grdMain.Rows[row].Cells[HDeptNumberCol].Value;
|
grdMain.Rows[row + r].Cells[HDeptNameCol].Value = grdMain.Rows[row].Cells[HDeptNameCol].Value;
|
if (DBUtility.ClsPub.isStrNull(HAutoSNO) == "是")
|
{
|
Sno = "00" + (r + 1).ToString();
|
Sno = Sno.Substring(Sno.Length - 2, 2);
|
grdMain.Rows[row + r].Cells[HBatchNoCol].Value = grdMain.Rows[row].Cells[HBatchNoCol].Value + Sno;
|
}
|
else
|
{
|
grdMain.Rows[row + r].Cells[HBatchNoCol].Value = grdMain.Rows[row].Cells[HBatchNoCol].Value;
|
}
|
grdMain.Rows[row + r].Cells[HAuxPropIDCol].Value = grdMain.Rows[row].Cells[HAuxPropIDCol].Value;
|
grdMain.Rows[row + r].Cells[HAuxPropNumberCol].Value = grdMain.Rows[row].Cells[HAuxPropNumberCol].Value;
|
grdMain.Rows[row + r].Cells[HAuxPropNameCol].Value = grdMain.Rows[row].Cells[HAuxPropNameCol].Value;
|
grdMain.Rows[row + r].Cells[HRemarkCol].Value = grdMain.Rows[row].Cells[HRemarkCol].Value;
|
grdMain.Rows[row + r].Cells[HMTONoCol].Value = grdMain.Rows[row].Cells[HMTONoCol].Value;
|
|
}
|
if (DBUtility.ClsPub.isStrNull(HAutoSNO) == "是")
|
{
|
grdMain.Rows[row].Cells[HBatchNoCol].Value = grdMain.Rows[row].Cells[HBatchNoCol].Value + "01";
|
}
|
DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid);
|
}
|
|
private void txtHSourceBillNo_KeyPress(object sender, KeyPressEventArgs e)
|
{
|
if (e.KeyChar == (char)Keys.Return)//回车带出源单信息
|
{
|
long sHOrgID = -1;
|
string sWhere = "";
|
sHOrgID = oWeb.get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
|
if (sHOrgID == -1)
|
{
|
MessageBox.Show("选择组织有错误!");
|
return;
|
}
|
|
if (txtHSourceBillNo.Text.Length < 4)
|
{
|
MessageBox.Show("请输入4位以上数据!");
|
return;
|
}
|
//根据源单类型 和源单号 获取信息
|
if (cmbSourceBillType.Text.Trim() == "生产订单")
|
{
|
SCM.Cls_S_IFCLD_ICMOList oIFCLD_ICMOList = new SCM.Cls_S_IFCLD_ICMOList();
|
if (oIFCLD_ICMOList.RefreshBySourceBillNo(" Where 单据号 like '%" + txtHSourceBillNo.Text + "' and HOrgID =" + sHOrgID.ToString())) //选择原单
|
{
|
FillSelectData(oIFCLD_ICMOList.oBillSelectColl);
|
txtHSourceBillNo.Text = "";
|
}
|
}
|
else if (cmbSourceBillType.Text.Trim() == "收料通知单")
|
{
|
SCM.Cls_S_IF_POInStockBillList oIF_POInStockBillList = new SCM.Cls_S_IF_POInStockBillList();
|
if (oIF_POInStockBillList.RefreshBySourceBillNo(" Where 单据号 like '%" + txtHSourceBillNo.Text + "' ")) //选择原单
|
{
|
FillSelectData(oIF_POInStockBillList.oBillSelectColl);
|
txtHSourceBillNo.Text = "";
|
}
|
}
|
else if (cmbSourceBillType.Text.Trim() == "采购订单")
|
{
|
SCM.Cls_S_IF_POOrderBillList oIF_POOrderBillList = new SCM.Cls_S_IF_POOrderBillList();
|
if (oIF_POOrderBillList.RefreshBySourceBillNo(" Where 单据号 like '%" + txtHSourceBillNo.Text + "' ")) //选择原单
|
{
|
FillSelectData(oIF_POOrderBillList.oBillSelectColl);
|
txtHSourceBillNo.Text = "";
|
}
|
}
|
else if (cmbSourceBillType.Text.Trim() == "委外订单")
|
{
|
SCM.Cls_S_IF_EntrustOrderBillList oIF_EntrustOrderBillList = new SCM.Cls_S_IF_EntrustOrderBillList();
|
if (oIF_EntrustOrderBillList.RefreshBySourceBillNo(" Where 单据号 like '%" + txtHSourceBillNo.Text + "' ")) //选择原单
|
{
|
FillSelectData(oIF_EntrustOrderBillList.oBillSelectColl);
|
txtHSourceBillNo.Text = "";
|
}
|
}
|
else if (cmbSourceBillType.Text.Trim() == "入库申请单")
|
{
|
SCM.Cls_S_IF_StockInRequestBillList oIF_StockInRequestBillList = new SCM.Cls_S_IF_StockInRequestBillList();
|
if (oIF_StockInRequestBillList.RefreshBySourceBillNo(" Where 单据号 like '%" + txtHSourceBillNo.Text + "' ")) //选择原单
|
{
|
FillSelectData(oIF_StockInRequestBillList.oBillSelectColl);
|
txtHSourceBillNo.Text = "";
|
}
|
else
|
{
|
MessageBox.Show("未查询到任务数据,请确认所选组织、源单类型与源单单号是否正确!");
|
return;
|
}
|
}
|
else
|
{
|
|
}
|
|
}
|
|
}
|
|
private void cmdHGroupID_Click(object sender, EventArgs e)
|
{
|
long sHOrgID = -1;
|
string sWhere = "";
|
sHOrgID = oWeb.get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
|
if (sHOrgID == -1)
|
{
|
MessageBox.Show("选择组织有错误!");
|
return;
|
}
|
|
sWhere = " and HUSEORGID = " + sHOrgID;
|
SCM.ClsGy_Group_View oGroup = new SCM.ClsGy_Group_View();
|
if (oGroup.RefreshView())
|
{
|
txtHGroupID.Text = oGroup.oModel.HName;
|
txtHGroupID.Tag = oGroup.oModel.HItemID.ToString();
|
|
if (CampanyName == "森楷") //系统参数 客户定制化名称
|
{
|
for (int i = 0; i < grdMain.Rows.Count; i++)
|
{
|
if (ClsPub.isLong(grdMain.Rows[i].Cells[HMaterIDCol].Value) != 0)
|
{
|
grdMain.Rows[i].Cells[HGroupIDCol].Value = oGroup.oModel.HItemID.ToString();
|
grdMain.Rows[i].Cells[HGroupNumberCol].Value = oGroup.oModel.HNumber;
|
grdMain.Rows[i].Cells[HGroupNameCol].Value = oGroup.oModel.HName;
|
}
|
}
|
|
string HGroupID = ""; //班组
|
string HBatchNo = ""; //批次
|
string HDate = ""; //日期
|
string sCaseNoNumber = ""; //箱号前缀
|
HGroupID = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HGroupIDCol].Value);
|
HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HBatchNoCol].Value);
|
HDate = dtpHDate.Value.ToShortDateString();
|
|
//箱号前缀 = 班组ID + 批次 + 日期
|
sCaseNoNumber = HGroupID + HBatchNo + HDate;
|
DataSet Ds = oWeb.getDataSetBySQL("exec h_p_WMS_GetMaxNo '" + sCaseNoNumber + "'", "h_p_WMS_GetMaxNo", ref DBUtility.ClsPub.sExeReturnInfo);//获取最大流水号
|
txtHCaseNo.Text = (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) + 1).ToString();
|
txtHCaseNo.Tag = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]).ToString();
|
}
|
}
|
else
|
{
|
txtHGroupID.Text = "";
|
|
if (CampanyName == "森楷") //系统参数 客户定制化名称
|
{
|
for (int i = 0; i < grdMain.Rows.Count; i++)
|
{
|
if (ClsPub.isLong(grdMain.Rows[i].Cells[HMaterIDCol].Value) != 0)
|
{
|
grdMain.Rows[i].Cells[HGroupIDCol].Value = 0;
|
grdMain.Rows[i].Cells[HGroupNumberCol].Value = "";
|
grdMain.Rows[i].Cells[HGroupNameCol].Value = "";
|
}
|
}
|
|
string HGroupID = ""; //班组
|
string HBatchNo = ""; //批次
|
string HDate = ""; //日期
|
string sCaseNoNumber = ""; //箱号前缀
|
HGroupID = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HGroupIDCol].Value);
|
HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HBatchNoCol].Value);
|
HDate = dtpHDate.Value.ToShortDateString();
|
|
//箱号前缀 = 班组ID + 批次 + 日期
|
sCaseNoNumber = HGroupID + HBatchNo + HDate;
|
DataSet Ds = oWeb.getDataSetBySQL("exec h_p_WMS_GetMaxNo '" + sCaseNoNumber + "'", "h_p_WMS_GetMaxNo", ref DBUtility.ClsPub.sExeReturnInfo);//获取最大流水号
|
txtHCaseNo.Text = (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) + 1).ToString();
|
txtHCaseNo.Tag = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]).ToString();
|
}
|
}
|
oGroup = null;
|
}
|
|
private void txtHGroupID_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHGroupID.Text.Trim() == "")
|
{
|
txtHGroupID.Tag = "0";
|
}
|
}
|
}
|
}
|