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_Cus : Form
|
{
|
public Gy_BarCodeBill_Cus()
|
{
|
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 HMaterIDCol = 5;
|
public const Int16 HCusModelCol = 6;
|
public const Int16 HCusModelNameCol = 7;
|
public const Int16 HCode1Col = 8;
|
public const Int16 HSupNumberCol = 9;
|
public const Int16 HSupNameCol = 10;
|
public const Int16 HCode2Col = 11;
|
public const Int16 HWorkLineNameCol = 12;
|
public const Int16 HBarCodeDateCol = 13;
|
public const Int16 HCode3Col = 14;
|
public const Int16 HBackDataFlagCol = 15;
|
public const Int16 HQtyCol = 16;
|
public const Int16 HMinQtyCol = 17;
|
public const Int16 HBQtyCol = 18;
|
public const Int16 HDateCol = 19;
|
public const Int16 HinitQtyCol = 20;
|
public const Int16 HRemarkCol = 21;
|
public const Int16 HBillTypeCol = 22;
|
public const Int16 HLSSnoCol = 23;
|
public const Int16 HBoxNoCol = 24;
|
|
public Int16 HSelectCol = 0;
|
public Int16 HSno2Col = 1;
|
public Int16 HTMCol = 2;
|
public Int16 HMaterID2Col = 3;
|
public Int16 HCusModel2Col = 4;
|
public Int16 HCusModelName2Col = 5;
|
public Int16 HCode1_SecCol = 6;
|
public Int16 HSupNumber2Col = 7;
|
public Int16 HSupName2Col = 8;
|
public Int16 HCode2_SecCol = 9;
|
public Int16 HWorkLineName2Col = 10;
|
public Int16 HBarCodeDate2Col = 11;
|
public Int16 HCode3_SecCol = 12;
|
public Int16 HBackDataFlag2Col = 13;
|
public Int16 HQty2Col = 14;
|
public Int16 HWeiCol = 15;
|
public Int16 HPrintCol = 16;
|
public Int16 HDate2Col = 17;
|
public Int16 HBeginDate2Col = 18;
|
public Int16 HEndDate2Col = 19;
|
public Int16 HRemark2Col = 20;
|
public Int16 HBarCodeType2Col = 21;
|
public Int16 HLSSno2Col = 22;
|
public Int16 HBoxNo2Col = 23;
|
//
|
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();
|
|
|
//
|
//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_Cus_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_Cus_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();
|
cmbHBarCodeType.SelectedIndex = 0;
|
}
|
|
//加载组织信息
|
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_Cus_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_Cus_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;
|
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 //已作废
|
{
|
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;
|
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;
|
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 (DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HCusModelCol].Value) !="")
|
{
|
b = true;
|
break;
|
}
|
}
|
if (b == false)
|
{
|
MessageBox.Show("明细行不存在!", "提示");
|
return false;
|
}
|
for (int j = 0; j < grdMain.Rows.Count; j++)
|
{
|
if (ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusModelCol].Value) != "" && (ClsPub.isStrNull(grdMain.Rows[j].Cells[HWorkLineNameCol].Value) == "" || 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[HCusModelCol].Value) + " ,中存在数量、最小包装数、箱数为 0,不允许生成条码!");
|
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;
|
}
|
const string X34 = "0123456789ABCDEFGHJKLMNPQRSTUVWXYZ";
|
|
//34进制
|
private string set_SNoBy10To34Type(int iSno)
|
{
|
var a = X34.Length;
|
//if(iSno==35)
|
//{
|
// iSno = iSno;
|
//}
|
string Result = "";
|
while (iSno >= 34)
|
{
|
Result = X34[(iSno % 34) == 0 ? 0 : (iSno % 34) ] + Result;
|
iSno /= 34;
|
}
|
if (iSno >= 0)
|
Result = X34[iSno] + Result;
|
|
return Result;
|
}
|
|
//生成条码
|
private void SaveBarCode()
|
{
|
try
|
{
|
grdSub.Rows.Clear();
|
int LSHlen = 4; //流水号长度
|
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 sTMNumber_b = ""; //条码自定义后缀
|
string sSeOrderNo = ""; // 销售订单号
|
///////////////////////////////////////////////////////////
|
string sCusModel = "";
|
string sSupNumber = "";
|
string sLineNumber = "";
|
string sCode1 = "";
|
string sCode2 = "";
|
string sCode3 = "";
|
string sBarCodeDate = "";
|
string sBackDataFlag = "";
|
DataSet Ds;
|
pb1.Value = 0;
|
for (int j = 0; j < grdMain.Rows.Count; j++)
|
{
|
Application.DoEvents();
|
if (ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusModelCol].Value) != "")
|
{
|
sCusModel = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCusModelCol].Value); //客户零件号
|
sSupNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HSupNumberCol].Value); //
|
sLineNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HWorkLineNameCol].Value); //
|
sBackDataFlag = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HBackDataFlagCol].Value); //
|
sCode1 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode1Col].Value); //
|
sCode2 = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode2Col].Value); //
|
sCode3= DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[HCode3Col].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);
|
|
//==================================
|
//条码前缀 = 零件号17 + 扩展位1 2 + 供应商编码7 + 扩展位2 3+ 产线1 + 年00 + 月00 + 日00 + 扩展位3 4 + 追溯标识
|
sCusModel = (sCusModel + "*****************").Substring(0, 17);
|
sSupNumber = (sSupNumber + "*******").Substring(0, 7);
|
sTMNumber = sCusModel + sCode1 + sSupNumber + sCode2 + sLineNumber + sYear + sPeriod + sDay ;
|
sTMNumber_b = sCode3 + sBackDataFlag;
|
Ds = oWeb.getDataSetBySQL("exec h_p_WMS_GetMaxNo_Cus '" + sTMNumber + sTMNumber_b + "'", "h_p_WMS_GetMaxNo_Cus", ref DBUtility.ClsPub.sExeReturnInfo);//获取最大流水号
|
LSH = ClsPub.isInt(Ds.Tables[0].Rows[0][0]);
|
|
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 = set_SNoBy10To34Type(LSH);
|
while (LSH2.Length < LSHlen) //如果流水号小于6位数前面补0
|
{
|
LSH2 = "0" + LSH2;
|
}
|
|
TM = sTMNumber + LSH2 + sTMNumber_b;
|
|
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[HQty2Col].Value = HMinQty;
|
grdSub.Rows[i].Cells[HMaterID2Col].Value = grdMain.Rows[j].Cells[HMaterIDCol].Value;
|
grdSub.Rows[i].Cells[HLSSno2Col].Value = LSH2;
|
grdSub.Rows[i].Cells[HCusModel2Col].Value = grdMain.Rows[j].Cells[HCusModelCol].Value;
|
grdSub.Rows[i].Cells[HCusModelName2Col].Value = grdMain.Rows[j].Cells[HCusModelNameCol].Value;
|
grdSub.Rows[i].Cells[HCode1_SecCol].Value = grdMain.Rows[j].Cells[HCode1Col].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[HCode2_SecCol].Value = grdMain.Rows[j].Cells[HCode2Col].Value;
|
grdSub.Rows[i].Cells[HWorkLineName2Col].Value = grdMain.Rows[j].Cells[HWorkLineNameCol].Value;
|
grdSub.Rows[i].Cells[HCode3_SecCol].Value = grdMain.Rows[j].Cells[HCode3Col].Value;
|
grdSub.Rows[i].Cells[HBarCodeDate2Col].Value = grdMain.Rows[j].Cells[HBarCodeDateCol].Value;
|
grdSub.Rows[i].Cells[HBackDataFlag2Col].Value = grdMain.Rows[j].Cells[HBackDataFlagCol].Value;
|
grdSub.Rows[i].Cells[HPrintCol].Value = "0";
|
grdSub.Rows[i].Cells[HWeiCol].Value = WeiShu;
|
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[HCusModel2Col].Value = grdMain.Rows[j].Cells[HCusModelCol].Value;
|
k = k + 1;
|
n = n + 1;
|
sSQLNoMul[nn] = " exec h_p_WMS_SetMaxNo_Cus '" + sTMNumber + sTMNumber_b + "' ";
|
nn = nn + 1;
|
}
|
//后台批量执行语句
|
if (oWeb.getRunProcByMul_Back(sSQLNoMul, ref DBUtility.ClsPub.sExeReturnInfo) == false)
|
{
|
MessageBox.Show("条码生成失败,批量生成流水号失败!");
|
return;
|
}
|
//
|
}
|
}
|
|
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;
|
DateTime HBeginDate;
|
string HSeOrderBillNo = "";
|
string HJiaYe2 = "";
|
string HPressModel = "";
|
string HMaterialModel = "";
|
string HColor = "";
|
string HLogo = "";
|
string HPackageSize = "";
|
double HMaterialJQty = 0;
|
double HMaterialMQty = 0;
|
string HCustomBatchNo = "";
|
string HGBBarCode = "";
|
string POOrderBillNo = "";
|
//
|
string HCusModel = "";
|
string HWorkLineName = "";
|
string HCode1 = "";
|
string HSupNumber = "";
|
string HCode2 = "";
|
string HBarCodeDate = "";
|
string HCode3 = "";
|
string HBackDataFlag = "";
|
string HCusModelName = "";
|
string HSupName = "";
|
string HLSSNO = "";
|
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.isStrNull(grdSub.Rows[i].Cells[HCusModel2Col].Value) != "")
|
{
|
HLSSNO = ClsPub.isStrNull(grdSub.Rows[i].Cells[HLSSno2Col].Value);
|
HMaterID = ClsPub.isLong(grdSub.Rows[i].Cells[HMaterID2Col].Value);
|
HCusModel = ClsPub.isStrNull(grdSub.Rows[i].Cells[HCusModel2Col].Value);
|
HCusModelName = ClsPub.isStrNull(grdSub.Rows[i].Cells[HCusModelName2Col].Value);
|
HWorkLineName = ClsPub.isStrNull(grdSub.Rows[i].Cells[HWorkLineName2Col].Value);
|
HCode1 = ClsPub.isStrNull(grdSub.Rows[i].Cells[HCode1_SecCol].Value);
|
HSupNumber = ClsPub.isStrNull(grdSub.Rows[i].Cells[HSupNumber2Col].Value);
|
HSupName = ClsPub.isStrNull(grdSub.Rows[i].Cells[HSupName2Col].Value);
|
HCode2 = ClsPub.isStrNull(grdSub.Rows[i].Cells[HCode2Col].Value);
|
HBarCodeDate = ClsPub.isStrNull(grdSub.Rows[i].Cells[HBarCodeDate2Col].Value);
|
HCode3 = ClsPub.isStrNull(grdSub.Rows[i].Cells[HCode3_SecCol].Value);
|
HBackDataFlag = ClsPub.isStrNull(grdSub.Rows[i].Cells[HBackDataFlag2Col].Value);
|
|
HWei = ClsPub.isStrNull(grdSub.Rows[i].Cells[HWeiCol].Value);
|
HBarCode = ClsPub.isStrNull(grdSub.Rows[i].Cells[HTMCol].Value);
|
|
HBarCodeType = ClsPub.isStrNull(cmbHBarCodeType.Text);
|
HRemark = ClsPub.isStrNull(grdSub.Rows[i].Cells[HRemark2Col].Value);
|
|
HQty2 = ClsPub.isDoule(grdSub.Rows[i].Cells[HQty2Col].Value);
|
//HRemark = ClsPub.isStrNull(grdSub.Rows[i].Cells[HRemark2Col].Value);
|
HEndDate = ClsPub.isDate(grdSub.Rows[i].Cells[HEndDate2Col].Value);
|
HBeginDate = ClsPub.isDate(grdSub.Rows[i].Cells[HBeginDate2Col].Value);
|
HCusModel = ClsPub.isStrNull(grdSub.Rows[i].Cells[HCusModel2Col].Value);
|
sSQLMul[mm] = "insert into Gy_BarCodeBill_Cus (HBarCode,HBarCodeType,HCusModel,HWorkLineName,HQty" +
|
",HCode1,HSupNumber,HCode2,HMaker,HMakeDate,HPrintQty" +
|
",HBarCodeDate,HCode3,HBackDataFlag,HRemark " +
|
",HInterID,HCusModelName,HSupName,HMaterID,HSNO " +
|
") values ("
|
+ "'" + HBarCode + "','" + HBarCodeType + "','" + HCusModel.ToString() + "','" + HWorkLineName.ToString() + "'," + HQty2.ToString()
|
+ ",'" + HCode1 + "','" + HSupNumber.ToString() + "','" + HCode2.ToString() + "','" + ClsPub.CurUserName + "',getdate()," + HPrintQty.ToString()
|
+ ", '" + HBarCodeDate.ToString() + "','" + HCode3.ToString() + "','" + HBackDataFlag + "', '" + HRemark + "'"
|
+ "," + HInterID.ToString() + " ,'" + HCusModelName + "'" + " ,'" + HSupName + "'" + "," + HMaterID.ToString() + ",'" + HLSSNO + "')";
|
//oCn.RunProc("exec setLSH '" + ClsPub.GetServerDate(0) + "'");
|
mm = mm + 1;
|
Application.DoEvents();
|
Application.DoEvents();
|
}
|
}
|
//
|
|
//
|
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_Cus with(nolock) where HBarCode='" + DBUtility.ClsPub.isStrNull(grdSub.Rows[r].Cells[HTMCol].Value) + "'", "Gy_BarCodeBill_Cus", 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
|
|
|
public string SetDateStr(DateTime sDateTime)
|
{
|
string sDate = sDateTime.ToShortDateString();
|
string sYear = ClsPub.isDate(sDate).Year.ToString().Substring(2, 2);
|
string sPeriod = "0" + ClsPub.isDate(sDate).Month.ToString();
|
sPeriod = sPeriod.Substring(sPeriod.Length - 2, 2);
|
string sDay = "0" + ClsPub.isDate(sDate).Day.ToString();
|
sDay = sDay.Substring(sDay.Length - 2, 2);
|
return sYear+ sPeriod+ sDay;
|
}
|
|
#region 窗体处理方法
|
//初始化GRID
|
private void initGrid()
|
{
|
grdMain.RowCount = 0;
|
grdSub.RowCount = 0;
|
grdMain.ColumnCount = 25; //总列数
|
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[HQtyCol].HeaderText = "数量";
|
grdMain.Columns[HMinQtyCol].HeaderText = "最小包装数";
|
grdMain.Columns[HBQtyCol].HeaderText = "箱数";
|
grdMain.Columns[HCode1Col].HeaderText = "扩展位1";
|
grdMain.Columns[HCode2Col].HeaderText = "扩展位2";
|
grdMain.Columns[HCode3Col].HeaderText = "扩展位3";
|
grdMain.Columns[HBarCodeDateCol].HeaderText = "条码日期";
|
grdMain.Columns[HBackDataFlagCol].HeaderText = "追溯标识";
|
grdMain.Columns[HWorkLineNameCol].HeaderText = "产线";
|
grdMain.Columns[HSupNumberCol].HeaderText = "供应商编码";
|
grdMain.Columns[HSupNameCol].HeaderText = "供应商名称";
|
grdMain.Columns[HDateCol].HeaderText = "进料日期";
|
grdMain.Columns[HRemarkCol].HeaderText = "备注";
|
grdMain.Columns[HCusModelCol].HeaderText = "客户零件号";
|
grdMain.Columns[HCusModelNameCol].HeaderText = "客户零件名称";
|
grdMain.Columns[HMaterIDCol].HeaderText = "物料代码";
|
grdMain.Columns[HLSSnoCol].HeaderText = "流水号";
|
grdMain.Columns[HBoxNoCol].HeaderText = "箱号";
|
////
|
//格式化 隐藏列
|
grdMain.Columns[HTagCol].Visible = false;
|
grdMain.Columns[HMainIDCol].Visible = false;
|
grdMain.Columns[HSubIDCol].Visible = false;
|
grdMain.Columns[HBillTypeCol].Visible = false;
|
//grdMain.Columns[HBatchNoCol].Visible = false;
|
//grdMain.Columns[HCusModelCol].Visible = false;
|
grdMain.Columns[HDateCol].Visible = false;
|
//grdMain.Columns[HSupNumberCol].Visible = false;
|
grdMain.Columns[HinitQtyCol].Visible = false;
|
|
|
|
|
//设置可编辑列
|
string sAllowCol;
|
sAllowCol = HQtyCol.ToString() +
|
"," + HCusModelCol.ToString() +
|
"," + HMaterIDCol.ToString() +
|
"," + HCusModelNameCol.ToString() +
|
"," + HWorkLineNameCol.ToString() +
|
"," + HSupNumberCol.ToString() +
|
"," + HSupNameCol.ToString() +
|
"," + HCode1Col.ToString() +
|
"," + HCode2Col.ToString() +
|
"," + HCode3Col.ToString() +
|
"," + HBarCodeDateCol.ToString() +
|
"," + HBackDataFlagCol.ToString() +
|
"," + HMinQtyCol.ToString();
|
//设置合计列
|
string sTotalCol = HQtyCol.ToString();
|
//
|
|
ClsPub1.initGridLast(sAllowCol, sTotalCol, oSumGrid);
|
//----------------------------
|
|
grdSub.ColumnCount = 25; //总列数
|
ClsPub1.initGridFst(grdSub, this.Name);
|
grdSub.Columns[HSelectCol].HeaderText = "选择";
|
grdSub.Columns[HCusModel2Col].HeaderText = "客户零件号";
|
grdSub.Columns[HCode1_SecCol].HeaderText = "扩展位1";
|
grdSub.Columns[HSupNumber2Col].HeaderText = "供应商编码";
|
grdSub.Columns[HCode2_SecCol].HeaderText = "扩展位2";
|
grdSub.Columns[HWorkLineName2Col].HeaderText = "产线";
|
grdSub.Columns[HCode3_SecCol].HeaderText = "扩展位3";
|
grdSub.Columns[HBackDataFlag2Col].HeaderText = "追溯标识";
|
grdSub.Columns[HTMCol].HeaderText = "条码编号";
|
grdSub.Columns[HBarCodeType2Col].HeaderText = "条码类型";
|
grdSub.Columns[HSno2Col].HeaderText = "序号";
|
grdSub.Columns[HQty2Col].HeaderText = "数量";
|
grdSub.Columns[HWeiCol].HeaderText = "尾数";
|
grdSub.Columns[HPrintCol].HeaderText = "打印次数";
|
grdSub.Columns[HSupNumber2Col].HeaderText = "供应商编码";
|
grdSub.Columns[HSupName2Col].HeaderText = "供应商编码";
|
grdSub.Columns[HDate2Col].HeaderText = "进料日期";
|
grdSub.Columns[HRemark2Col].HeaderText = "备注";
|
grdSub.Columns[HBeginDate2Col].HeaderText = "计划开工日期";
|
grdSub.Columns[HEndDate2Col].HeaderText = "计划完工日期";
|
grdSub.Columns[HCusModel2Col].HeaderText = "客户型号";
|
grdSub.Columns[HCusModelName2Col].HeaderText = "客户型号名称";
|
grdSub.Columns[HMaterID2Col].HeaderText = "物料代码";
|
grdSub.Columns[HLSSno2Col].HeaderText = "流水号";
|
grdSub.Columns[HBoxNo2Col].HeaderText = "箱号";
|
|
//格式化 隐藏列
|
grdSub.Columns[HBarCodeType2Col].Visible = false;
|
//grdSub.Columns[HBatchNo2Col].Visible = false;
|
grdSub.Columns[HCusModel2Col].Visible = false;
|
grdSub.Columns[HWeiCol].Visible = false;
|
grdSub.Columns[HPrintCol].Visible = false;
|
grdSub.Columns[HDate2Col].Visible = false;
|
grdSub.Columns[HBeginDate2Col].Visible = false;
|
grdSub.Columns[HEndDate2Col].Visible = false;
|
grdSub.Columns[HSupNumber2Col].Visible = false;
|
|
|
|
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("exec h_p_IF_BarCodeBill_CusList " + HInterID.ToString() + " ", "h_p_IF_BarCodeBill_CusList", 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, HCusModelCol ,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_Supplier_View oSup = new SCM.ClsIF_Supplier_View(); //供应商
|
SCM.ClsIF_Material_View oMater = new SCM.ClsIF_Material_View(); //
|
|
if (!grdStatus)
|
{
|
return;
|
}
|
oSumGrid.EditStatus = true;
|
switch (sKeyCode)
|
{
|
case 118: //F7
|
{
|
switch (sCol)
|
{
|
|
|
case HMaterIDCol:
|
oMater.WherePart = "";
|
sWhere = " and HUSEORGID = " + sHOrgID;
|
if (oMater.RefreshViewForBig(sWhere))
|
{
|
grdMain.Rows[sRow].Cells[HMaterIDCol].Value = oMater.omodel.HItemID.ToString();
|
grdMain.Rows[sRow].Cells[HMinQtyCol].Value = 1;
|
grdMain.Rows[sRow].Cells[HCusModelNameCol].Value = oMater.omodel.HName.ToString();
|
grdMain.Rows[sRow].Cells[HCode1Col].Value = "00";
|
grdMain.Rows[sRow].Cells[HCode2Col].Value ="000";
|
grdMain.Rows[sRow].Cells[HCode3Col].Value = "0000";
|
grdMain.Rows[sRow].Cells[HSupNumberCol].Value = "VG509";
|
grdMain.Rows[sRow].Cells[HWorkLineNameCol].Value = "1";
|
grdMain.Rows[sRow].Cells[HBarCodeDateCol].Value = dtpHDate.Value.ToShortDateString();
|
grdMain.Rows[sRow].Cells[HBackDataFlagCol].Value = "%";
|
oEdit.Text = oMater.omodel.HItemID.ToString();
|
}
|
else
|
{
|
grdMain.Rows[sRow].Cells[HMaterIDCol].Value = 0;
|
grdMain.Rows[sRow].Cells[HMinQtyCol].Value = 0;
|
}
|
//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[HCusModelCol].Value = DBUtility.ClsPub.isStrNull(oDs2.Tables[0].Rows[0]["HPinfan"]);
|
|
}
|
else
|
{
|
grdMain.Rows[sRow].Cells[HCusModelCol].Value = "";
|
|
}
|
//}
|
break;
|
|
//case HDateCol:
|
// BLL.ClsPub_BLL.Sub_SelectDate(grdMain, sRow, HDateCol);
|
// oEdit.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[sRow].Cells[HDateCol].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 = ""; //箱号前缀
|
// string sMaterNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HMaterNumberCol].Value);
|
// string sAuxItemName = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HAuxPropNameCol].Value);
|
// HGroupID = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HGroupIDCol].Value);
|
// HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HBatchNoCol].Value);
|
// HDate = SetDateStr(dtpHDate.Value);
|
|
// //箱号前缀 = 班组ID + 批次 + 日期 + 物料代码 + 辅助属性
|
// sCaseNoNumber = HGroupID + HBatchNo + HDate + sMaterNumber + sAuxItemName;
|
// 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[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;
|
// sAllowCol = HQtyCol.ToString() +
|
// "," + HCusModelCol.ToString() +
|
// "," + HWorkLineNameCol.ToString() +
|
// "," + HSupNumberCol.ToString() +
|
// "," + HCode1Col.ToString() +
|
// "," + HCode2Col.ToString() +
|
// "," + HCode3Col.ToString() +
|
// "," + HBarCodeDateCol.ToString() +
|
// "," + HBackDataFlagCol.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[HSupNumberCol].Value = oTable.Rows[0]["供应商代码"].ToString();
|
//grdMain.Rows[i].Cells[HWorkLineNameCol].Value = oTable.Rows[0]["供应商"].ToString();
|
//grdMain.Rows[i].Cells[HCode1Col].Value = oTable.Rows[0]["HDeptID"].ToString();
|
//grdMain.Rows[i].Cells[HCode2Col].Value = oTable.Rows[0]["部门代码"].ToString();
|
//grdMain.Rows[i].Cells[HCode3Col].Value = oTable.Rows[0]["部门"].ToString();
|
//grdMain.Rows[i].Cells[HCusModelCol].Value = oTable.Rows[0]["HMaterID"].ToString();
|
//grdMain.Rows[i].Cells[HBarCodeDateCol].Value = oTable.Rows[0]["物料代码"].ToString();
|
//grdMain.Rows[i].Cells[HBackDataFlagCol].Value = oTable.Rows[0]["物料名称"].ToString();
|
//grdMain.Rows[i].Cells[HRemarkCol].Value = oTable.Rows[0]["备注"].ToString();
|
//grdMain.Rows[i].Cells[HMinQtyCol].Value = oTable.Rows[0]["最小包装数"].ToString();
|
|
//--
|
//设置可编辑列
|
string sAllowCol;
|
sAllowCol = HQtyCol.ToString() +
|
"," + HCusModelCol.ToString() +
|
"," + HWorkLineNameCol.ToString() +
|
"," + HSupNumberCol.ToString() +
|
"," + HCode1Col.ToString() +
|
"," + HCode2Col.ToString() +
|
"," + HCode3Col.ToString() +
|
"," + HBarCodeDateCol.ToString() +
|
"," + HBackDataFlagCol.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_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_Cus 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();
|
}
|
else
|
{
|
txtHGroupID.Text = "";
|
}
|
oGroup = null;
|
}
|
|
private void txtHGroupID_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHGroupID.Text.Trim() == "")
|
{
|
txtHGroupID.Tag = "0";
|
}
|
}
|
}
|
}
|