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.IO;
|
|
namespace WarM
|
{
|
public partial class Sc_MESNowWorkBill_Fast : Form
|
{
|
//BLL.BardCodeHooK BarCode = new BLL.BardCodeHooK();
|
public Sc_MESNowWorkBill_Fast()
|
{
|
InitializeComponent();
|
//BarCode.BarCodeEvent += new BLL.BardCodeHooK.BardCodeDeletegate(BarCode_BarCodeEvent);
|
}
|
//定义列
|
public const Int16 HTagCol = 0;
|
public const Int16 HSnoCol = 1;
|
public const Int16 HProcIDCol = 2;
|
public const Int16 HProcNumberCol = 3;
|
public const Int16 HProcNameCol = 4;
|
public const Int16 HMaterIDCol = 5;
|
public const Int16 HMaterNumberCol = 6;
|
public const Int16 HMaterNameCol = 7;
|
public const Int16 HEmpIDCol = 8;
|
public const Int16 HEmpNumberCol = 9;
|
public const Int16 HEmpNameCol = 10;
|
public const Int16 HGroupIDCol = 11;
|
public const Int16 HGroupNumberCol = 12;
|
public const Int16 HGroupNameCol = 13;
|
public const Int16 HSourceIDCol = 14;
|
public const Int16 HSourceNumberCol = 15;
|
public const Int16 HSourceNameCol = 16;
|
public const Int16 HBadBarCodeCol = 17;
|
public const Int16 HBadReasonIDCol = 18;
|
public const Int16 HBadReasonNumberCol = 19;
|
public const Int16 HBadReasonNameCol = 20;
|
public const Int16 HBadCountCol = 21;
|
public const Int16 HBadPrirceCol = 22;
|
public const Int16 HBadMoneyCol = 23;
|
public const Int16 HCheckEmpIDCol = 24;
|
public const Int16 HCheckEmpNumberCol = 25;
|
public const Int16 HCheckEmpNameCol = 26;
|
public const Int16 HICMOInterIDCol = 27;
|
public const Int16 HICMOBillNoCol = 28;
|
public const Int16 HWWOrderInterIDCol = 29;
|
public const Int16 HWWOrderEntryIDCol = 30;
|
public const Int16 HWWOrderBillNoCol = 31;
|
public const Int16 HSeOrderInterIDCol = 32;
|
public const Int16 HSeOrderEntryIDCol = 33;
|
public const Int16 HSeOrderBillNoCol = 34;
|
public const Int16 HProcExchInterIDCol = 35;
|
public const Int16 HProcExchEntryIDCol = 36;
|
public const Int16 HProcExchBillNoCol = 37;
|
public const Int16 HProcExchReportInterIDCol = 38;
|
public const Int16 HProcExchReportEntryIDCol = 39;
|
public const Int16 HProcExchReportBillNoCol = 40;
|
|
public const Int16 HEntryIDCol = 41;
|
public const Int16 HCloseManCol = 42;
|
public const Int16 HEntryCloseDateCol = 43;
|
public const Int16 HCloseTypeCol = 44;
|
public const Int16 HRemarkCol = 45;
|
public const Int16 HSourceInterIDCol = 46;
|
public const Int16 HSourceEntryIDCol = 47;
|
public const Int16 HSourceBillNoCol = 48;
|
public const Int16 HSourceBillTypeCol = 49;
|
public const Int16 HRelationQtyCol = 50;
|
public const Int16 HRelationMoneyCol = 51;
|
//
|
//
|
//表2
|
public const Int16 SecHTagCol = 0;
|
public const Int16 SecHSnoCol = 1;
|
public const Int16 SecHMaterIDCol = 2;
|
public const Int16 SecHMaterNumberCol = 3;
|
public const Int16 SecHMaterNameCol = 4;
|
public const Int16 SecHMaterModelCol = 5;
|
public const Int16 SecHBarCodeCol = 6;
|
public const Int16 SecHQtyCol = 7;
|
public const Int16 SecHWhIDCol = 8;
|
public const Int16 SecHWhNumberCol = 9;
|
public const Int16 SecHWhNameCol = 10;
|
public const Int16 SecHSourceInterIDCol = 11;
|
public const Int16 SecHSourceEntryIDCol = 12;
|
public const Int16 SecHSourceBillTypeCol = 13;
|
public const Int16 SecHSourceBillNoCol = 14;
|
//
|
public const string ModName = "3787"; //单据类型
|
public string ModCaption = "工位作业指导书"; //单据名称
|
public const string ModRightName = "Sc_MESBeginWorkBill";
|
public const string ModRightNameEdit = ModRightName + "_Edit";
|
public const string ModRightNameCheck = ModRightName + "_Check";
|
public const string ModRightNameClose = ModRightName + "_Close";
|
public const string ModRightNameDelete = ModRightName + "_Delete";
|
public const string ModRightNameMoney = ModRightName + "_Money";
|
public const string ModRightNameQty = ModRightName + "_Qty";
|
public bool BillChange; //单据修改状态
|
//
|
public DBUtility.ClsPub.Enum_BillStatus BillStatus; //单据状态(新增,修改,浏览,更新单价,变更)
|
public Int64 KeyID; //单据主内码
|
public bool grdStatus; //网格状态(不可编辑,可编辑)
|
public long HICMOInterID = 0;
|
public string HICMOBillNo = "";
|
public long HMaterID = 0;
|
public string HBatchNo = "";
|
public DAL.ClsSc_MESBeginWorkBill BillNew =new DAL.ClsSc_MESBeginWorkBill(); //对应单据类
|
public DAL.ClsSc_MESBeginWorkBill BillOld = new DAL.ClsSc_MESBeginWorkBill(); //对应单据类
|
Pub_Class.ClsGridListSum oSumGrid = new Pub_Class.ClsGridListSum();
|
//-------------------------------------------------------------------------
|
|
#region 固定代码
|
|
|
//清空界面
|
public void Sub_ClearBill()
|
{
|
DBUtility.Xt_BaseBillFun.Sub_ClearBill(gbUp);
|
//
|
}
|
|
//窗体加载
|
private void Sc_MESNowWorkBill_Fast_Load(object sender, EventArgs e)
|
{
|
//打印初始化
|
//
|
//oSumGrid_Sub.NoCol = SecHSnoCol;
|
//oSumGrid_Sub.ogrdMain = grdSub;
|
//oSumGrid_Sub.oGridsum = grdSumSub;
|
this.Text = ModCaption; //命名窗体标题
|
this.lblCaption.Text = ModCaption;//命名单据标题
|
//
|
//BarCode.Start();
|
}
|
|
//首张
|
private void Sub_First()
|
{
|
BillStatus =DBUtility.ClsPub.Enum_BillStatus.BillStatus_View;
|
BillOld = new DAL.ClsSc_MESBeginWorkBill();
|
if (BillOld.GetFirstBill(ref ClsPub.sExeReturnInfo))
|
{
|
this.Sub_ShowBill();
|
}
|
else //没有找到则 变为新增状态
|
{
|
this.Sub_AddBill();
|
}
|
}
|
|
//上张
|
private void Sub_Prev()
|
{
|
BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View;
|
if (BillOld.GetPrevousBill(ref ClsPub.sExeReturnInfo,txtHBillNo.Text))
|
{
|
this.Sub_ShowBill();
|
}
|
}
|
|
//下张
|
private void Sub_Next()
|
{
|
BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View;
|
if (BillOld.GetNextBill(ref ClsPub.sExeReturnInfo, txtHBillNo.Text))
|
{
|
this.Sub_ShowBill();
|
}
|
}
|
|
//末张
|
private void Sub_Last()
|
{
|
BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View;
|
BillOld = new DAL.ClsSc_MESBeginWorkBill();
|
if (BillOld.GetLastBill(ref ClsPub.sExeReturnInfo))
|
{
|
this.Sub_ShowBill();
|
}
|
}
|
|
//审核单据
|
private void Sub_CheckBill()
|
{
|
//判断权限
|
if (!ClsPub.Security_Log(ModRightNameCheck, 1, true,DBUtility.ClsPub.CurUserName))
|
{
|
return;
|
}
|
|
string s = "";
|
if (!DBUtility.Xt_BaseBillFun.Fun_AllowCheckBill(BillOld, ref s))
|
{
|
MessageBox.Show(s + ",不允许审核", "提示");
|
return;
|
}
|
if (BillOld.CheckBill(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
|
{
|
BillChange = true;
|
this.Sub_ShowBill();
|
}
|
else
|
{
|
MessageBox.Show("审核失败!原因:" + ClsPub.sExeReturnInfo, "提示");
|
}
|
}
|
//反审单据
|
private void Sub_AbandonCheck()
|
{
|
//判断权限
|
if (!ClsPub.Security_Log(ModRightNameCheck, 1, true, DBUtility.ClsPub.CurUserName))
|
{
|
return;
|
}
|
//
|
string s = "";
|
if (DBUtility.Xt_BaseBillFun.Fun_AllowAbandonCheckBill(BillOld.omodel.HChecker, ref s) == false)
|
{
|
MessageBox.Show("当前操作员与审核人不一致,不允许反审核!", "提示");
|
return;
|
}
|
if (BillOld.AbandonCheck(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
|
{
|
BillChange = true;
|
this.Sub_ShowBill();
|
}
|
else
|
{
|
MessageBox.Show("反审核失败!原因:" + ClsPub.sExeReturnInfo, "提示");
|
}
|
}
|
//关闭单据
|
private void Sub_CloseBill()
|
{
|
//判断权限
|
if (!ClsPub.Security_Log(ModRightNameClose, 1, true, DBUtility.ClsPub.CurUserName))
|
{
|
return;
|
}
|
string s = "";
|
if (!DBUtility.Xt_BaseBillFun.Fun_AllowCloseBill(BillOld, ref s))
|
{
|
MessageBox.Show(s + ",不允许关闭", "提示");
|
return;
|
}
|
if (BillOld.CloseBill(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
|
{
|
BillChange = true;
|
this.Sub_ShowBill();
|
}
|
else
|
{
|
MessageBox.Show("关闭失败!原因:" + ClsPub.sExeReturnInfo, "提示");
|
}
|
}
|
//反关闭单据
|
private void Sub_Cancel()
|
{
|
//判断权限
|
if (!ClsPub.Security_Log(ModRightNameClose, 1, true, DBUtility.ClsPub.CurUserName))
|
{
|
return;
|
}
|
string s = "";
|
if (!DBUtility.Xt_BaseBillFun.Fun_AllowCancelBill(BillOld, ref s))
|
{
|
MessageBox.Show(s + ",不允许恢复", "提示");
|
return;
|
}
|
if (BillOld.CancelClose(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
|
{
|
BillChange = true;
|
this.Sub_ShowBill();
|
}
|
else
|
{
|
MessageBox.Show("恢复失败!原因:" + ClsPub.sExeReturnInfo, "提示");
|
}
|
}
|
//作废单据
|
private void Sub_Cancelltion()
|
{
|
//判断权限
|
if (!ClsPub.Security_Log(ModRightNameDelete, 1, true, DBUtility.ClsPub.CurUserName))
|
{
|
return;
|
}
|
string s = "";
|
if (!DBUtility.Xt_BaseBillFun.Fun_AllowCancelltionBill(BillOld, ref s))
|
{
|
MessageBox.Show(s + ",不允许作废", "提示");
|
return;
|
}
|
if (BillOld.Cancelltion(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
|
{
|
BillChange = true;
|
this.Sub_ShowBill();
|
}
|
else
|
{
|
MessageBox.Show("作废失败!原因:" + ClsPub.sExeReturnInfo, "提示");
|
}
|
}
|
//反作废
|
private void Sub_AbandonCancelltion()
|
{
|
//判断权限
|
if (!ClsPub.Security_Log(ModRightNameDelete, 1, true, DBUtility.ClsPub.CurUserName))
|
{
|
return;
|
}
|
string s = "";
|
if (!DBUtility.Xt_BaseBillFun.Fun_AllowAbandonCancelltionBill(BillOld, ref s))
|
{
|
MessageBox.Show(s + ",不允许恢复正常", "提示");
|
return;
|
}
|
if (BillOld.AbandonCancelltion(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
|
{
|
BillChange = true;
|
this.Sub_ShowBill();
|
}
|
else
|
{
|
MessageBox.Show("作废失败!原因:" + ClsPub.sExeReturnInfo, "提示");
|
}
|
}
|
//新增按纽
|
private void xz_Click(object sender, EventArgs e)
|
{
|
//cmbSourceBillType.Items.Clear();
|
//cmbSourceBillType.Items.Add("发货通知单");
|
//cmbSourceBillType.Items.Add("手工录入");
|
//cmbSourceBillType.SelectedIndex = 0;
|
redblue.Checked = false;
|
this.Sub_AddBill();
|
}
|
//修改按纽
|
private void xg_Click(object sender, EventArgs e)
|
{
|
|
}
|
//删除按钮
|
private void sc_Click(object sender, EventArgs e)
|
{
|
|
}
|
//保存按钮
|
private void bc_Click(object sender, EventArgs e)
|
{
|
|
}
|
//放弃按钮
|
private void fq_Click(object sender, EventArgs e)
|
{
|
|
}
|
//审核按钮
|
private void sh_Click(object sender, EventArgs e)
|
{
|
|
}
|
//放弃审核按钮
|
private void qsh_Click(object sender, EventArgs e)
|
{
|
|
}
|
//关闭按钮
|
private void gb_Click(object sender, EventArgs e)
|
{
|
|
}
|
//恢复按钮
|
private void hf_Click(object sender, EventArgs e)
|
{
|
|
}
|
//作废按钮
|
private void zf_Click(object sender, EventArgs e)
|
{
|
|
}
|
//反作废按钮
|
private void zc_Click(object sender, EventArgs e)
|
{
|
|
}
|
//首张单据按钮
|
private void sz_Click(object sender, EventArgs e)
|
{
|
|
}
|
//上一张按钮
|
private void syz_Click(object sender, EventArgs e)
|
{
|
|
}
|
//下一张按钮
|
private void xyz_Click(object sender, EventArgs e)
|
{
|
|
}
|
//末张按钮
|
private void mz_Click(object sender, EventArgs e)
|
{
|
|
}
|
//退出按钮
|
private void tc_Click(object sender, EventArgs e)
|
{
|
this.Close();
|
}
|
|
//根据编辑状态 设置 控件是否允许录入
|
private void Sub_LrtextStatus(bool TextEnabled)
|
{
|
if (TextEnabled == true)
|
{
|
//控件全部有效
|
gbUp.Enabled = true;
|
|
|
}
|
else
|
{ //控件全部无效
|
gbUp.Enabled = false;
|
|
}
|
}
|
//复制单据
|
private void Sub_CopyBill()
|
{
|
this.BillStatus =DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
|
this.Sub_OperStatus();//设置TOOLBAR
|
this.txtHBillNo.Text = ClsPub.CreateBillCode(BillNew.BillType, ref ClsPub.sExeReturnInfo, true);//得到新单号
|
this.txtHBillNo.Enabled = true;
|
//this.txtHBillNo.Focus();
|
|
//清空GIRD 源单信息
|
//DBUtility.Xt_BaseBillFun.SetDataGrid(grdMain, 0, HPOOrderEntryIDCol, grdMain.Rows.Count - 1, HCloseTypeCol, "");
|
}
|
//复制按钮
|
private void fz_Click(object sender, EventArgs e)
|
{
|
Sub_CopyBill();
|
}
|
//timer
|
private void timer1_Tick(object sender, EventArgs e)
|
{
|
timer1.Enabled = false;
|
//DAL.ClsK3_Material_View oMater = new DAL.ClsK3_Material_View();
|
this.Sub_AddBill();
|
this.ShowPic();
|
//txtHICMOBillNo.Text = HICMOBillNo;
|
//txtHBatchNo.Text = HBatchNo;
|
//if (oMater.GetInfoByID(HMaterID))
|
//{
|
// txtHMaterID.Text = oMater.omodel.HNumber;
|
// txtHName.Text = oMater.omodel.HName;
|
// txtHModel.Text = oMater.omodel.HModel;
|
//}
|
}
|
|
//窗体卸载
|
private void Sc_MESNowWorkBill_Fast_FormClosing(object sender, FormClosingEventArgs e)
|
{
|
BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
|
|
}
|
//新增单据
|
private void Sub_AddBill()
|
{
|
//this.BillNew = new DAL.ClsSc_MESBeginWorkBill();
|
//this.BillOld = new DAL.ClsSc_MESBeginWorkBill();
|
this.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
|
this.Sub_OperStatus();//设置TOOLBAR
|
this.Sub_ClearBill();//清空界面
|
//this.txtHBillNo.Text = ClsPub.CreateBillCode(BillNew.BillType, ref ClsPub.sExeReturnInfo, true);//得到新单号
|
//this.txtHBillNo.Enabled = true;
|
this.txtHICMOBillNo.Focus();
|
//灰度源单类型
|
//cmbSourceBillType.Enabled = true;
|
//txtHBeginWorkTime.Text = DBUtility.ClsPub.GetServerDate(-1);
|
}
|
//TOOLBAR状态 按钮是否灰度
|
public void Sub_OperStatus()
|
{
|
switch (BillStatus)
|
{
|
case DBUtility.ClsPub.Enum_BillStatus.BillStatus_View:
|
//浏览状态
|
dy.Enabled = true;
|
yl.Enabled = true;
|
xz.Enabled = true;
|
xg.Enabled = true;
|
sc.Enabled = true;
|
AddRow.Enabled = false;
|
DelRow.Enabled = false;
|
bc.Enabled = false;
|
fq.Enabled = false;
|
sz.Enabled = true;
|
syz.Enabled = true;
|
xyz.Enabled = true;
|
mz.Enabled = true;
|
tc.Enabled = true;
|
redblue.Enabled = false;
|
//未审核
|
|
Sub_LrtextStatus(false);
|
grdStatus = false;
|
break;
|
case DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew:
|
//新增状态
|
dy.Enabled = false;
|
yl.Enabled = false;
|
xz.Enabled = false;
|
xg.Enabled = false;
|
sc.Enabled = false;
|
AddRow.Enabled = true;
|
DelRow.Enabled = true;
|
bc.Enabled = true;
|
fq.Enabled = true;
|
sh.Enabled = false;
|
qsh.Enabled = false;
|
//gb.Enabled = false;
|
//hf.Enabled = false;
|
//zf.Enabled = false;
|
//zc.Enabled = false;
|
sz.Enabled = false;
|
syz.Enabled = false;
|
xyz.Enabled = false;
|
mz.Enabled = false;
|
tc.Enabled = true;
|
Sub_LrtextStatus(true);
|
grdStatus = true;
|
redblue.Enabled = true;
|
//未审核
|
pic1.Visible = false;
|
pic1.Image = null;
|
//
|
break;
|
case DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify:
|
//修改状态
|
dy.Enabled = false;
|
yl.Enabled = false;
|
xz.Enabled = false;
|
xg.Enabled = false;
|
sc.Enabled = false;
|
AddRow.Enabled = true;
|
DelRow.Enabled = true;
|
bc.Enabled = true;
|
fq.Enabled = true;
|
sh.Enabled = false;
|
qsh.Enabled = false;
|
//gb.Enabled = false;
|
//hf.Enabled = false;
|
//zf.Enabled = false;
|
//zc.Enabled = false;
|
sz.Enabled = false;
|
syz.Enabled = false;
|
xyz.Enabled = false;
|
mz.Enabled = false;
|
tc.Enabled = true;
|
Sub_LrtextStatus(true);
|
grdStatus = true;
|
redblue.Enabled = true;
|
//未审核
|
pic1.Visible = false;
|
pic1.Image = null;
|
//
|
break;
|
}
|
|
}
|
#endregion
|
|
#region 读写类
|
//显示单据
|
public void Sub_ShowBill()
|
{
|
//DAL.ClsK3_Department_View oDept = new DAL.ClsK3_Department_View();
|
//DAL.ClsGy_Group_View oGroup = new DAL.ClsGy_Group_View();//班组
|
//DAL.ClsK3_Unit_View oUnit = new DAL.ClsK3_Unit_View();
|
//DAL.ClsK3_Process_View oPro = new DAL.ClsK3_Process_View();//工序
|
//DAL.ClsK3_Material_View oMater = new DAL.ClsK3_Material_View();
|
//DAL.ClsK3_Employee_View oEmp = new DAL.ClsK3_Employee_View();
|
//DAL.ClsGy_Source_View oSource = new DAL.ClsGy_Source_View();//生产资源
|
////判断是否存在单据
|
//if (BillOld.ShowBill(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == false)
|
//{
|
// MessageBox.Show(ClsPub.sExeReturnInfo, "提示");
|
// return;
|
//}
|
////清空
|
//Sub_ClearBill();
|
////加载表头
|
//if (oDept.GetInfoByID(BillOld.omodel.HDeptID))
|
//{
|
// this.txtHDeptID.Tag = oDept.omodel.HItemID.ToString().Trim();
|
// this.txtHDeptID.Text = oDept.omodel.HName;
|
// //this.txtHDeptNumber.Text = oDept.omodel.HNumber;
|
//}
|
//else
|
//{
|
// this.txtHDeptID.Text = "";
|
// //this.txtHDeptNumber.Text = "";
|
//}
|
////
|
//if (oMater.GetInfoByID(BillOld.omodel.HMaterID))
|
//{
|
// this.txtHMaterID.Tag = oMater.omodel.HItemID.ToString().Trim();
|
// this.txtHMaterID.Text = oMater.omodel.HNumber;
|
// this.txtHName.Text = oMater.omodel.HName;
|
// this.txtHModel.Text = oMater.omodel.HModel;
|
//}
|
//else
|
//{
|
// this.txtHMaterID.Text = "";
|
// this.txtHName.Text = "";
|
// this.txtHModel.Text = "";
|
//}
|
////
|
////if (oUnit.GetInfoByID(BillOld.omodel.HUnitID))
|
////{
|
//// this.txtHUnitID.Tag = oUnit.omodel.HItemID.ToString().Trim();
|
//// this.txtHUnitID.Text = oUnit.omodel.HName;
|
//// //this.txtHUnitNumber.Text = oUnit.omodel.HNumber;
|
////}
|
////else
|
////{
|
//// this.txtHUnitID.Text = "";
|
//// //this.txtHUnitNumber.Text = "";
|
////}
|
////
|
//if (oPro.GetInfoByID(BillOld.omodel.HProcID))
|
//{
|
// this.txtHProcID.Tag = oPro.omodel.HItemID.ToString().Trim();
|
// this.txtHProcID.Text = oPro.omodel.HName;
|
//}
|
//else
|
//{
|
// this.txtHProcID.Text = "";
|
//}
|
////
|
//if (oSource.GetInfoByID(BillOld.omodel.HSourceID))
|
//{
|
// this.txtHSourceID.Tag = oSource.omodel.HItemID.ToString().Trim();
|
// this.txtHSourceID.Text = oSource.omodel.HName;
|
//}
|
//else
|
//{
|
// this.txtHSourceID.Text = "";
|
//}
|
////
|
//if (oEmp.GetInfoByID(BillOld.omodel.HEmpID))
|
//{
|
// this.txtHWorkEmpID.Tag = oEmp.omodel.HItemID.ToString().Trim();
|
// this.txtHWorkEmpID.Text = oEmp.omodel.HName;
|
//}
|
//else
|
//{
|
// this.txtHWorkEmpID.Text = "";
|
//}
|
////
|
//if (oGroup.GetInfoByID(BillOld.omodel.HGroupID))
|
//{
|
// this.txtHGroupID.Tag = oGroup.omodel.HItemID.ToString().Trim();
|
// this.txtHGroupID.Text = oGroup.omodel.HName;
|
//}
|
//else
|
//{
|
// this.txtHGroupID.Text = "";
|
//}
|
////============================================================
|
////单据固定赋值
|
//this.dtpHDate.Value = BillOld.omodel.HDate;
|
//this.txtHBillNo.Text = BillOld.omodel.HBillNo;
|
//this.txtHRemark.Text = BillOld.omodel.HRemark;
|
|
////
|
//this.txtHICMOBillNo.Tag = BillOld.omodel.HICMOInterID.ToString();
|
//this.txtHICMOBillNo.Text = BillOld.omodel.HICMOBillNo;
|
//this.txtHBatchNo.Text = BillOld.omodel.HBatchNo;
|
//this.txtHBeginWorkTime.Text = BillOld.omodel.HBeginWorkTime.ToString();
|
////this.txtHProcExchInterID.Text = BillOld.omodel.HProcExchInterID.ToString().Trim();
|
////this.txtHProcExchEntryID.Text = BillOld.omodel.HProcExchEntryID.ToString().Trim();
|
////this.txtHProcExchBillNo.Text = BillOld.omodel.HProcExchBillNo;
|
|
//////加载表体
|
////initGrid();
|
//////initGrid_Sub();
|
////int i = 0;
|
////foreach (Model.ClsSc_MESBeginWorkBillSub oSub in BillOld.DetailColl)
|
////{
|
//// if (i >= grdMain.RowCount - 1)
|
//// grdMain.Rows.Add();
|
//// //单据固定赋值
|
//// grdMain.Rows[i].Cells[HTagCol].Value = "*";
|
//// grdMain.Rows[i].Cells[HEntryIDCol].Value = oSub.HEntryID.ToString();
|
//// grdMain.Rows[i].Cells[HRemarkCol].Value = oSub.HRemark;
|
//// grdMain.Rows[i].Cells[HCloseManCol].Value = oSub.HCloseMan;
|
//// grdMain.Rows[i].Cells[HEntryCloseDateCol].Value = oSub.HEntryCloseDate;
|
//// grdMain.Rows[i].Cells[HCloseTypeCol].Value = oSub.HCloseType;
|
//// grdMain.Rows[i].Cells[HSourceBillNoCol].Value = oSub.HSourceBillNo;
|
//// grdMain.Rows[i].Cells[HSourceInterIDCol].Value = oSub.HSourceInterID.ToString();
|
//// grdMain.Rows[i].Cells[HSourceEntryIDCol].Value = oSub.HSourceEntryID.ToString();
|
//// grdMain.Rows[i].Cells[HSourceBillTypeCol].Value = oSub.HSourceBillType.Trim();
|
//// grdMain.Rows[i].Cells[HRelationQtyCol].Value = oSub.HRelationQty.ToString();
|
//// grdMain.Rows[i].Cells[HRelationMoneyCol].Value = oSub.HRelationMoney.ToString();
|
//// //======================================================================================
|
//// //
|
//// grdMain.Rows[i].Cells[HProcIDCol].Value = oSub.HProcID.ToString();
|
//// if (oPro.GetInfoByID(oSub.HProcID))
|
//// {
|
//// grdMain.Rows[i].Cells[HProcNumberCol].Value = oPro.omodel.HNumber;
|
//// grdMain.Rows[i].Cells[HProcNameCol].Value = oPro.omodel.HName;
|
|
//// }
|
//// else
|
//// {
|
//// grdMain.Rows[i].Cells[HProcNumberCol].Value = "";
|
//// grdMain.Rows[i].Cells[HProcNameCol].Value = "";
|
//// }
|
//// //
|
//// grdMain.Rows[i].Cells[HMaterIDCol].Value = oSub.HMaterID.ToString();
|
//// if (oMater.GetInfoByID(oSub.HMaterID))
|
//// {
|
//// grdMain.Rows[i].Cells[HMaterNumberCol].Value = oMater.omodel.HNumber;
|
//// grdMain.Rows[i].Cells[HMaterNameCol].Value = oMater.omodel.HName;
|
|
//// }
|
//// else
|
//// {
|
//// grdMain.Rows[i].Cells[HMaterNumberCol].Value = "";
|
//// grdMain.Rows[i].Cells[HMaterNameCol].Value = "";
|
//// }
|
//// //
|
//// grdMain.Rows[i].Cells[HEmpIDCol].Value = oSub.HEmpID.ToString();
|
//// if (oEmp.GetInfoByID(oSub.HEmpID))
|
//// {
|
//// grdMain.Rows[i].Cells[HEmpNumberCol].Value = oEmp.omodel.HNumber;
|
//// grdMain.Rows[i].Cells[HEmpNameCol].Value = oEmp.omodel.HName;
|
|
//// }
|
//// else
|
//// {
|
//// grdMain.Rows[i].Cells[HEmpNumberCol].Value = "";
|
//// grdMain.Rows[i].Cells[HEmpNameCol].Value = "";
|
//// }
|
//// //
|
//// grdMain.Rows[i].Cells[HGroupIDCol].Value = oSub.HGroupID.ToString();
|
//// if (oGroup.GetInfoByID(oSub.HGroupID))
|
//// {
|
//// grdMain.Rows[i].Cells[HGroupNumberCol].Value = oGroup.omodel.HNumber;
|
//// grdMain.Rows[i].Cells[HGroupNameCol].Value = oGroup.omodel.HName;
|
|
//// }
|
//// else
|
//// {
|
//// grdMain.Rows[i].Cells[HGroupNumberCol].Value = "";
|
//// grdMain.Rows[i].Cells[HGroupNameCol].Value = "";
|
//// }
|
//// //
|
//// grdMain.Rows[i].Cells[HSourceIDCol].Value = oSub.HSourceID.ToString();
|
//// if (oSource.GetInfoByID(oSub.HSourceID))
|
//// {
|
//// grdMain.Rows[i].Cells[HSourceNumberCol].Value = oSource.omodel.HNumber;
|
//// grdMain.Rows[i].Cells[HSourceNameCol].Value = oSource.omodel.HName;
|
|
//// }
|
//// else
|
//// {
|
//// grdMain.Rows[i].Cells[HSourceNumberCol].Value = "";
|
//// grdMain.Rows[i].Cells[HSourceNameCol].Value = "";
|
//// }
|
//// //
|
//// grdMain.Rows[i].Cells[HBadReasonIDCol].Value = oSub.HBadReasonID.ToString();
|
//// if (oBad.GetInfoByID(oSub.HBadReasonID))
|
//// {
|
//// grdMain.Rows[i].Cells[HBadReasonNumberCol].Value = oBad.omodel.HNumber;
|
//// grdMain.Rows[i].Cells[HBadReasonNameCol].Value = oBad.omodel.HName;
|
|
//// }
|
//// else
|
//// {
|
//// grdMain.Rows[i].Cells[HBadReasonNumberCol].Value = "";
|
//// grdMain.Rows[i].Cells[HBadReasonNameCol].Value = "";
|
//// }
|
//// //
|
//// grdMain.Rows[i].Cells[HCheckEmpIDCol].Value = oSub.HCheckEmpID.ToString();
|
//// if (oEmp.GetInfoByID(oSub.HCheckEmpID))
|
//// {
|
//// grdMain.Rows[i].Cells[HCheckEmpNumberCol].Value = oEmp.omodel.HNumber;
|
//// grdMain.Rows[i].Cells[HCheckEmpNameCol].Value = oEmp.omodel.HName;
|
|
//// }
|
//// else
|
//// {
|
//// grdMain.Rows[i].Cells[HCheckEmpNumberCol].Value = "";
|
//// grdMain.Rows[i].Cells[HCheckEmpNameCol].Value = "";
|
//// }
|
//// //
|
//// grdMain.Rows[i].Cells[HBadBarCodeCol].Value = oSub.HBadBarCode.ToString();
|
//// grdMain.Rows[i].Cells[HBadCountCol].Value = oSub.HBadCount.ToString();
|
//// grdMain.Rows[i].Cells[HBadPrirceCol].Value = oSub.HBadPrirce.ToString();
|
//// grdMain.Rows[i].Cells[HBadMoneyCol].Value = oSub.HBadMoney.ToString();
|
//// grdMain.Rows[i].Cells[HICMOInterIDCol].Value = oSub.HICMOInterID.ToString();
|
//// grdMain.Rows[i].Cells[HICMOBillNoCol].Value = oSub.HICMOBillNo;
|
//// grdMain.Rows[i].Cells[HWWOrderInterIDCol].Value = oSub.HWWOrderInterID.ToString();
|
//// grdMain.Rows[i].Cells[HWWOrderEntryIDCol].Value = oSub.HWWOrderEntryID.ToString();
|
//// grdMain.Rows[i].Cells[HWWOrderBillNoCol].Value = oSub.HWWOrderBillNo;
|
//// grdMain.Rows[i].Cells[HSeOrderInterIDCol].Value = oSub.HSeOrderInterID.ToString();
|
//// grdMain.Rows[i].Cells[HSeOrderEntryIDCol].Value = oSub.HSeOrderEntryID.ToString();
|
//// grdMain.Rows[i].Cells[HSeOrderBillNoCol].Value = oSub.HSeOrderBillNo;
|
//// grdMain.Rows[i].Cells[HProcExchInterIDCol].Value = oSub.HProcExchInterID.ToString();
|
//// grdMain.Rows[i].Cells[HProcExchEntryIDCol].Value = oSub.HProcExchEntryID.ToString();
|
//// grdMain.Rows[i].Cells[HProcExchBillNoCol].Value = oSub.HProcExchBillNo;
|
//// grdMain.Rows[i].Cells[HProcExchReportInterIDCol].Value = oSub.HProcExchReportInterID.ToString();
|
//// grdMain.Rows[i].Cells[HProcExchReportEntryIDCol].Value = oSub.HProcExchReportEntryID.ToString();
|
//// grdMain.Rows[i].Cells[HProcExchReportBillNoCol].Value = oSub.HProcExchReportBillNo;
|
|
//// i = i + 1;
|
//}
|
////GRID允许刷新
|
//DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid);
|
////
|
//Sub_OperStatus();
|
////灰度源单类型
|
////cmbSourceBillType.Enabled = false;
|
}
|
|
//单据完整性判断 未完成
|
private bool Sub_AllowSave()
|
{
|
//必输项目是否为空
|
//if (DBUtility.ClsPub.isDoule(txtHQty.Text) <= 0)
|
//{
|
// MessageBox.Show("实做数量不能为0!", "提示");
|
// return false;
|
//}
|
if (DBUtility.ClsPub.isLong(txtHProcID.Tag) == 0)
|
{
|
MessageBox.Show("工序没有选择!", "提示");
|
return false;
|
}
|
if (DBUtility.ClsPub.isLong(txtHMaterID.Tag) == 0)
|
{
|
MessageBox.Show("产品没有选择!", "提示");
|
return false;
|
}
|
//if (DBUtility.ClsPub.isLong(txtHUnitID.Tag) == 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;
|
//}
|
return true;
|
}
|
//保存单据
|
private bool Sub_SaveBill()
|
{
|
//Model.ClsSc_MESBeginWorkBillSub oBillSub = new Model.ClsSc_MESBeginWorkBillSub();
|
////判断权限
|
////if (!ClsPub.Security_Log(ModRightNameEdit, 1, true, DBUtility.ClsPub.CurUserName))
|
////{
|
return false;
|
////}
|
////
|
//Int32 i;
|
//bool bResult;
|
//BillNew = new DAL.ClsSc_MESBeginWorkBill();
|
////失去焦点
|
//lblCaption.Focus();
|
//if (!Sub_AllowSave())//单据完整性判断
|
// return false;
|
////赋值ID
|
//if (BillStatus ==DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify)
|
// BillNew.omodel.HInterID = BillOld.omodel.HInterID;
|
//else if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_UpdatePrice)
|
// BillNew.omodel.HInterID = BillOld.omodel.HInterID;
|
////主类赋值
|
////判断会计期是否合理
|
//string s = "";
|
//int sYear = 0;
|
//int sPeriod = 0;
|
//if (DBUtility.Xt_BaseBillFun.Fun_AllowYearPeriod(dtpHDate.Value, ref sYear, ref sPeriod, ref s)==false)
|
//{
|
// MessageBox.Show(s, "提示");
|
// return false;
|
//}
|
////源单信息
|
////BillNew.omodel.HMainSourceBillType = cmbSourceBillType.Text;
|
////
|
//BillNew.omodel.HYear = sYear;
|
//BillNew.omodel.HPeriod = sPeriod;
|
////固定赋值=================================
|
//BillNew.omodel.HBillNo = this.txtHBillNo.Text.Trim(); //在赋值类前就处理好字符串和数字
|
//BillNew.omodel.HDate = this.dtpHDate.Value;
|
//BillNew.omodel.HRemark = this.txtHRemark.Text.Trim();
|
////====================================================
|
//BillNew.omodel.HICMOInterID = ClsPub.isLong(this.txtHICMOBillNo.Tag);
|
//BillNew.omodel.HICMOBillNo = ClsPub.isStrNull(this.txtHICMOBillNo.Text);
|
//BillNew.omodel.HDeptID = ClsPub.isLong(this.txtHDeptID.Tag);
|
//BillNew.omodel.HGroupID = ClsPub.isLong(this.txtHGroupID.Tag);
|
//BillNew.omodel.HSourceID = ClsPub.isLong(this.txtHSourceID.Tag);
|
//BillNew.omodel.HProcID = ClsPub.isLong(this.txtHProcID.Tag);
|
//BillNew.omodel.HMaterID = ClsPub.isLong(this.txtHMaterID.Tag);
|
//BillNew.omodel.HBatchNo = ClsPub.isStrNull(this.txtHBatchNo.Text);
|
//BillNew.omodel.HBeginWorkTime = ClsPub.isDate(this.txtHBeginWorkTime.Text);
|
//BillNew.omodel.HBarCodeMakeDate = ClsPub.isDate("1900-01-01");
|
////BillNew.omodel.HPlanQty = ClsPub.isDoule(this.txtHPlanQty.Text);
|
////明细类赋值
|
////BillNew.DetailColl=new List<Model.ClsSc_MESBeginWorkBillSub>();
|
////Model.ClsSc_MESBeginWorkBillSub oSub = new Model.ClsSc_MESBeginWorkBillSub();
|
//////固定赋值========================================
|
////oSub.HEntryID = 1;
|
////oSub.HRemark = this.txtHRemark.Text.Trim();
|
////oSub.HSourceInterID = 0;
|
////oSub.HSourceEntryID = 0;
|
////oSub.HSourceBillType = "";
|
////oSub.HSourceBillNo = "";
|
////oSub.HRelationQty = 0;
|
////oSub.HRelationMoney = 0;
|
////oSub.HCloseMan = "";
|
////oSub.HEntryCloseDate = ClsPub.isDate("1900-10-10");
|
////oSub.HCloseType = false;
|
//////=============================
|
////BillNew.DetailColl.Add(oSub);
|
////保存完毕后处理
|
//if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew)
|
//{
|
// bResult = BillNew.AddBill(ref ClsPub.sExeReturnInfo );
|
//}
|
//else
|
//{
|
// bResult = BillNew.ModifyBill(BillNew.omodel.HInterID, ref ClsPub.sExeReturnInfo);
|
//}
|
////提示
|
//if (bResult == true)
|
//{
|
// BillChange = true;
|
// //MessageBox.Show("单据存盘完毕!单据号:" + this.txtHBillNo.Text.Trim(), "提示");
|
// if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew)
|
// {
|
// BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View;
|
// BillOld.omodel.HInterID = BillNew.omodel.HInterID;
|
// this.Sub_ShowBill();
|
// }
|
// else if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify)
|
// {
|
// BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View;
|
// this.Sub_ShowBill();
|
// }
|
// this.Sub_OperStatus();
|
// return true;
|
//}
|
//else
|
//{
|
// MessageBox.Show("保存失败!原因:" + ClsPub.sExeReturnInfo, "提示");
|
// return false;
|
//}
|
}
|
#endregion
|
|
|
#region 窗体处理方法
|
//初始化GRID
|
|
|
private void cmdHDeptID_Click(object sender, EventArgs e)
|
{
|
//DAL.ClsK3_Department_View oDep = new DAL.ClsK3_Department_View();
|
//if (oDep.RefreshView())
|
//{
|
// this.txtHDeptID.Text = oDep.oModel.HName;
|
// this.txtHDeptID.Tag = oDep.oModel.HItemID.ToString();
|
// //this.txtHDeptNumber.Text = oDep.oModel.HNumber;
|
//}
|
//else
|
//{
|
// this.txtHDeptID.Text = "";
|
// //this.txtHDeptNumber.Text = "";
|
//}
|
|
}
|
|
private void txtHDeptID_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHDeptID.Text.Trim() == "")
|
{
|
txtHDeptID.Tag = "0";
|
}
|
}
|
|
|
|
#endregion
|
|
|
|
#region 源单处理
|
//
|
private void FillSelectData(List<DBUtility.BillSelect> oList)
|
{
|
DataSet Ds;
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
oSumGrid.Changelock = true;
|
//initGrid();
|
int i = -1;
|
foreach (DBUtility.BillSelect oSelectRow in oList)
|
{
|
i = i + 1;
|
if (oSelectRow.BillType == "3710")//生产任务单
|
{
|
//grdMain.Rows.Add();
|
//grdMain.Rows[i].Cells[HTagCol].Value = "*";
|
//得到信息
|
Ds = oCn.RunProcReturn("select * from h_v_K3_ICMOBillList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID, "h_v_K3_ICMOBillList");
|
//写入信息
|
Sub_WriteInForm_SM(Ds.Tables[0], i);
|
}
|
}
|
//
|
oSumGrid.Changelock = false;
|
//DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid);
|
}
|
|
|
//private void Sub_ChangeSourceBill()
|
//{
|
// if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew || BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify)
|
// {
|
// if (MessageBox.Show("单据尚未保存,确定要更换红蓝字?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
|
// {
|
// if (redblue.Checked == true)
|
// {
|
// redblue.Checked = false;
|
// }
|
// else
|
// {
|
// redblue.Checked = true;
|
// }
|
// return;
|
// }
|
// if (redblue.Checked == false)//当蓝字被选中
|
// {
|
// //得到对应源单信息
|
// BLL.ClsPub_BLL.GetBillSource(ModName, redblue.Checked, cmbSourceBillType);
|
// cmbSourceBillType.SelectedIndex = 0;
|
|
|
// }
|
// else if (redblue.Checked == true)
|
// {
|
// //得到对应源单信息
|
// BLL.ClsPub_BLL.GetBillSource(ModName, redblue.Checked, cmbSourceBillType);
|
// cmbSourceBillType.SelectedIndex = 0;
|
|
// }
|
// else
|
// {
|
|
// }
|
// Sub_AddBill();
|
// }
|
//}
|
|
//private void redblue_Click(object sender, EventArgs e)
|
//{
|
// if (redblue.Checked == true)
|
// {
|
// redblue.Checked = false;
|
// }
|
// else
|
// {
|
// redblue.Checked = true;
|
// }
|
// Sub_ChangeSourceBill();
|
//}
|
|
#endregion
|
|
private void yc_Click(object sender, EventArgs e)
|
{
|
|
}
|
|
private void 反审核ToolStripMenuItem_Click(object sender, EventArgs e)
|
{
|
this.Sub_AbandonCheck();
|
}
|
|
private void 关闭ToolStripMenuItem_Click(object sender, EventArgs e)
|
{
|
this.Sub_CloseBill();
|
}
|
|
private void 审核ToolStripMenuItem_Click(object sender, EventArgs e)
|
{
|
this.Sub_CheckBill();
|
}
|
|
private void 反关闭ToolStripMenuItem_Click(object sender, EventArgs e)
|
{
|
this.Sub_Cancel();
|
}
|
|
private void 作废ToolStripMenuItem_Click(object sender, EventArgs e)
|
{
|
this.Sub_Cancelltion();
|
}
|
|
private void 撤销作废ToolStripMenuItem_Click(object sender, EventArgs e)
|
{
|
this.Sub_AbandonCancelltion();
|
}
|
private void 隐藏列设置ToolStripMenuItem_Click(object sender, EventArgs e)
|
{
|
|
}
|
|
private void cmdHProcID_Click(object sender, EventArgs e)
|
{
|
//DAL.ClsK3_Process_View oProc = new DAL.ClsK3_Process_View();
|
//if (oProc.RefreshView())
|
//{
|
// this.txtHProcNo.Text = oProc.oModel.HNumber;
|
// this.txtHProcID.Text = oProc.oModel.HName;
|
// this.txtHProcID.Tag = oProc.oModel.HItemID.ToString();
|
// //this.txtHICMOBillNo.Focus();
|
//}
|
//else
|
//{
|
// this.txtHProcNo.Text = "";
|
// this.txtHProcID.Text = "";
|
// this.txtHProcID.Tag = 0;
|
//}
|
}
|
|
private void txtHProcID_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHProcID.Text.Trim() == "")
|
{
|
txtHProcID.Tag = "0";
|
}
|
}
|
|
private void cmdSM_Click(object sender, EventArgs e)
|
{
|
//if (DBUtility.ClsPub.isInt(txtHProcID.Tag) == 0)
|
//{
|
// MessageBox.Show("请先选择汇报工序!");
|
// return;
|
//}
|
//DataSet Ds;
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//long HInterID = 19623;
|
|
////得到信息
|
//Ds = oCn.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillList where hmainid=" + HInterID + " and HProcID=" + txtHProcID.Tag, "h_v_Sc_ProcessExchangeBillList");
|
////写入信息
|
//if (Ds == null || Ds.Tables[0].Rows.Count == 0)
|
//{
|
// return;
|
//}
|
//for (int i = 0; i < Ds.Tables[0].Rows.Count; i++)
|
//{
|
// Sub_WriteInForm_SM(Ds.Tables[0], i);
|
//}
|
}
|
|
|
|
//根据TABLE写入界面
|
private void Sub_WriteInForm_SM(DataTable oTable, int i)
|
{
|
//
|
//this.txtHICMOBillNo.Tag = oTable.Rows[0]["HMainID"].ToString();
|
//this.txtHICMOBillNo.Text = oTable.Rows[0]["单据号"].ToString();
|
//this.txtHMaterID.Tag = oTable.Rows[0]["HMaterID"].ToString();
|
//this.txtHMaterID.Text = oTable.Rows[0]["物料代码"].ToString();
|
//this.txtHName.Text = oTable.Rows[0]["物料名称"].ToString();
|
//this.txtHModel.Text = oTable.Rows[0]["规格型号"].ToString();
|
//this.txtHBatchNo.Text = oTable.Rows[0]["批号"].ToString();
|
//this.txtHUnitID.Tag = oTable.Rows[0]["HUnitID"].ToString();
|
//this.txtHUnitID.Text = oTable.Rows[0]["计量单位"].ToString();
|
//this.txtHDeptID.Tag = oTable.Rows[0]["HDeptID"].ToString();
|
//this.txtHDeptID.Text = oTable.Rows[0]["部门"].ToString();
|
////this.txtHQty.Text = DBUtility.ClsPub.isDoule(oTable.Rows[0]["计划数量"], 0);
|
////this.txtHPlanQty.Text = DBUtility.ClsPub.isDoule(oTable.Rows[0]["计划数量"], 0);
|
////this.txtHWorkEmpID.Tag = oTable.Rows[0]["HWorkerID"].ToString();
|
////this.txtHWorkEmpID.Text = oTable.Rows[0]["操作工"].ToString();
|
//this.dtpHPlanBeginDate.Value = ClsPub.isDate(oTable.Rows[0]["计划开工日期"]);
|
//this.dtpHPlanEndDate.Value = ClsPub.isDate(oTable.Rows[0]["计划完工日期"]);
|
////
|
//long sProcID = 0;
|
//string sProcNo = "";
|
//string sProcName = "";
|
//if (BillOld.GetICMOProc(DBUtility.ClsPub.isLong(oTable.Rows[0]["HMainID"]), ref sProcID, ref sProcNo, ref sProcName, ref ClsPub.sExeReturnInfo))
|
//{
|
// txtHProcID.Tag = sProcID.ToString();
|
// txtHProcID.Text = sProcName;
|
// txtHProcNo.Text = sProcNo;
|
//}
|
}
|
|
//根据TABLE写入界面
|
private void Sub_WriteInForm_SM2(DataTable oTable, int i)
|
{
|
//DAL.ClsK3_Material_View oMater = new DAL.ClsK3_Material_View();
|
|
//this.txtHProcExchInterID.Text = oTable.Rows[0]["hmainid"].ToString();
|
//this.txtHProcExchEntryID.Text = oTable.Rows[0]["hsubid"].ToString();
|
////
|
//this.txtHProcID.Tag = oTable.Rows[0]["HProcID"].ToString();
|
//this.txtHProcID.Text = oTable.Rows[0]["工序"].ToString();
|
//this.txtHDeptID.Tag = oTable.Rows[0]["HDeptID"].ToString();
|
//this.txtHDeptID.Text = oTable.Rows[0]["加工车间"].ToString();
|
//this.txtHGroupID.Tag = oTable.Rows[0]["HGroupID"].ToString();
|
//this.txtHGroupID.Text = oTable.Rows[0]["班组"].ToString();
|
////this.txtHWorkEmpID.Tag = oTable.Rows[0]["HWorkerID"].ToString();
|
////this.txtHWorkEmpID.Text = oTable.Rows[0]["操作工"].ToString();
|
//this.txtHSourceID.Tag = oTable.Rows[0]["HSourceID"].ToString();
|
//this.txtHSourceID.Text = oTable.Rows[0]["生产资源"].ToString();
|
}
|
|
private void cmdHGroupID_Click(object sender, EventArgs e)
|
{
|
//DAL.ClsK3_Group_View oGroup = new DAL.ClsK3_Group_View();
|
//if (oGroup.RefreshView())
|
//{
|
// this.txtHGroupID.Text = oGroup.oModel.HName;
|
// this.txtHGroupID.Tag = oGroup.oModel.HItemID.ToString();
|
//}
|
//else
|
//{
|
// this.txtHGroupID.Text = "";
|
// this.txtHGroupID.Tag = 0;
|
//}
|
}
|
|
private void txtHGroupID_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHGroupID.Text.Trim() == "")
|
{
|
txtHGroupID.Tag = "0";
|
}
|
}
|
|
private void cmdHWorkEmpID_Click(object sender, EventArgs e)
|
{
|
//DAL.ClsK3_Employee_View oEmp = new DAL.ClsK3_Employee_View();
|
//if (oEmp.RefreshView())
|
//{
|
// this.txtHWorkEmpID.Text = oEmp.oModel.HName;
|
// this.txtHWorkEmpID.Tag = oEmp.oModel.HItemID.ToString();
|
//}
|
//else
|
//{
|
// this.txtHWorkEmpID.Text = "";
|
// this.txtHWorkEmpID.Tag = 0;
|
//}
|
}
|
|
private void txtHWorkEmpID_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHWorkEmpID.Text.Trim() == "")
|
{
|
txtHWorkEmpID.Tag = "0";
|
}
|
}
|
|
private void cmdHSourceID_Click(object sender, EventArgs e)
|
{
|
DAL.ClsGy_Source_View oSource = new DAL.ClsGy_Source_View();
|
if (oSource.RefreshView())
|
{
|
this.txtHSourceID.Text = oSource.oModel.HName;
|
this.txtHSourceID.Tag = oSource.oModel.HItemID.ToString();
|
}
|
else
|
{
|
this.txtHSourceID.Text = "";
|
this.txtHSourceID.Tag = 0;
|
}
|
}
|
|
private void txtHSourceID_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHSourceID.Text.Trim() == "")
|
{
|
txtHSourceID.Tag = "0";
|
}
|
}
|
|
private void txtHProcExchBillNo_KeyDown(object sender, KeyEventArgs e)
|
{
|
if (e.KeyCode == Keys.Return)
|
{
|
if (txtHProcExchBillNo.Text.Trim() == "")
|
{
|
MessageBox.Show("工序流转卡卡号,不能为空!");
|
return;
|
}
|
//if (DBUtility.ClsPub.isLong(txtHProcID.Tag) == 0)
|
//{
|
// MessageBox.Show("请先选择汇报工序!");
|
// return;
|
//}
|
|
DataSet Ds;
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
string sBillNo = txtHProcExchBillNo.Text.Trim();
|
|
//得到信息
|
Ds = oCn.RunProcReturn("select top 1 * from h_v_Sc_ProcessExchangeBillList where 单据号= '" + sBillNo + "'", "h_v_Sc_ProcessExchangeBillList");
|
//写入信息
|
if (Ds == null || Ds.Tables[0].Rows.Count == 0)
|
{
|
txtHProcExchBillNo.Text = "";
|
MessageBox.Show("未查询到流转卡信息!");
|
return;
|
}
|
for (int i = 0; i < Ds.Tables[0].Rows.Count; i++)
|
{
|
Sub_WriteInForm_SM(Ds.Tables[0], i);
|
}
|
Sub_ShowBill();
|
txtHProcNo.Focus();
|
}
|
}
|
|
//private delegate void ShowInfoDelegate(BLL.BardCodeHooK.BarCodes barCode);
|
//private void ShowInfo(BLL.BardCodeHooK.BarCodes barCode)
|
//{
|
// if (this.InvokeRequired)
|
// {
|
// this.BeginInvoke(new ShowInfoDelegate(ShowInfo), new object[] { barCode });
|
// }
|
// else
|
// {
|
// if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_View)
|
// {
|
// if (barCode.KeyName == "Enter")
|
// {
|
// this.Sub_AddBill();
|
// }
|
// }
|
// txtHProcExchBillNo.Text = barCode.IsValid ? barCode.BarCode : txtHProcExchBillNo.Text;//是否为扫描枪输入,如果为true则是 否则为键盘输入
|
// }
|
//}
|
|
//void BarCode_BarCodeEvent(BLL.BardCodeHooK.BarCodes barCode)
|
//{
|
// ShowInfo(barCode);
|
//}
|
|
private void txtHQty_KeyDown(object sender, KeyEventArgs e)
|
{
|
if (e.KeyCode == Keys.Return)
|
{
|
Sub_SaveBill();
|
}
|
}
|
|
private void txtHProcNo_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHProcNo.Text.Trim() == "")
|
{
|
txtHProcID.Tag = "0";
|
txtHProcID.Text = "";
|
}
|
}
|
|
private void txtHWorkEmpNo_TextChanged(object sender, EventArgs e)
|
{
|
if (txtHWorkEmpNo.Text.Trim() == "")
|
{
|
txtHWorkEmpID.Tag = "0";
|
txtHWorkEmpID.Text = "";
|
}
|
}
|
|
private void txtHProcNo_KeyDown(object sender, KeyEventArgs e)
|
{
|
//DataSet Ds;
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//string sProcNo = txtHProcNo.Text.Trim();
|
//string sBillNo = txtHProcExchBillNo.Text.Trim();
|
//if (e.KeyCode == Keys.Return)
|
//{
|
// //得到信息
|
// Ds = oCn.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillList where 单据号= '" + sBillNo + "' and 工序号='" + sProcNo + "'", "h_v_Sc_ProcessExchangeBillList");
|
// //写入信息
|
// if (Ds == null || Ds.Tables[0].Rows.Count == 0)
|
// {
|
// txtHProcNo.Text = "";
|
// MessageBox.Show("工序号错误,请重新输入!");
|
// return;
|
// }
|
// for (int i = 0; i < Ds.Tables[0].Rows.Count; i++)
|
// {
|
// Sub_WriteInForm_SM2(Ds.Tables[0], i);
|
// }
|
// txtHWorkEmpNo.Focus();
|
//}
|
}
|
|
private void txtHWorkEmpNo_KeyDown(object sender, KeyEventArgs e)
|
{
|
//DAL.ClsK3_Employee_View oEmp = new DAL.ClsK3_Employee_View();
|
//string sEmp = txtHWorkEmpNo.Text.Trim();
|
//if (e.KeyCode == Keys.Return)
|
//{
|
// if (oEmp.GetInfoByEmpNo(sEmp))
|
// {
|
// txtHWorkEmpID.Tag = oEmp.omodel.HItemID;
|
// txtHWorkEmpID.Text = oEmp.omodel.HName;
|
// }
|
// else
|
// {
|
// txtHWorkEmpNo.Text = "";
|
// MessageBox.Show("员工工号错误,请重新输入!");
|
// return;
|
// }
|
//}
|
}
|
|
private void tabControl1_KeyDown(object sender, KeyEventArgs e)
|
{
|
if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_View)
|
{
|
if (e.KeyCode == Keys.Return)
|
{
|
this.Sub_AddBill();
|
txtHProcExchBillNo.Focus();
|
}
|
}
|
}
|
|
private void timer2_Tick(object sender, EventArgs e)
|
{
|
//if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_View)
|
//{
|
// tabControl1.Focus();
|
//}
|
//else
|
//{
|
// if (txtHProcExchBillNo.Text.Trim() == "")
|
// {
|
// txtHProcExchBillNo.Focus();
|
// }
|
//}
|
}
|
|
private void cmdHICMOBillNo_Click(object sender, EventArgs e)
|
{
|
//DAL.Cls_S_K3_ICMOBill oICMOBill = new DAL.Cls_S_K3_ICMOBill();
|
//string sWhere = " ";
|
//if (oICMOBill.Refresh(sWhere)) //选择原单
|
//{
|
// FillSelectData(oICMOBill.oBillSelectColl);
|
//}
|
}
|
|
private void txtHICMOBillNo_KeyDown(object sender, KeyEventArgs e)
|
{
|
//DataSet Ds;
|
//SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
//long sICMOInterID = DBUtility.ClsPub.isLong(txtHICMOBillNo.Text.Trim());
|
//if (e.KeyCode == Keys.Return)
|
//{
|
// //得到信息
|
// Ds = oCn.RunProcReturn("select * from h_v_K3_ICMOBillList where hmainid=" + sICMOInterID.ToString() + " and hsubid=0", "h_v_K3_ICMOBillList");
|
// //写入信息
|
// if (Ds == null || Ds.Tables[0].Rows.Count == 0)
|
// {
|
// txtHICMOBillNo.Text = "";
|
// MessageBox.Show("任务单内码错误,请重新扫描!");
|
// return;
|
// }
|
// for (int i = 0; i < Ds.Tables[0].Rows.Count; i++)
|
// {
|
// Sub_WriteInForm_SM(Ds.Tables[0], i);
|
// }
|
//}
|
}
|
private int ImageCount;
|
private List<string> ImagePaths;
|
private int nowCount = 0;
|
|
private void ShowPic()
|
{
|
//FolderBrowserDialog oDialog = new FolderBrowserDialog();
|
//oDialog.SelectedPath = Pub_Class.ClsPub.AppPath + @"\" + "PT" + @"\";
|
ImagePaths = new List<string>();
|
nowCount = 0;
|
//if (oDialog.ShowDialog() == DialogResult.OK)
|
//{
|
foreach (string Path in Directory.GetFiles(Pub_Class.ClsPub.AppPath + @"\" + "PT" + @"\EV30G-7"))
|
{
|
ImagePaths.Add(Path);
|
}
|
if (ImagePaths.Count != 0)
|
{
|
ImageCount = ImagePaths.Count;
|
}
|
//}
|
if (nowCount < ImageCount)
|
{
|
this.pictureBox1.Image = Bitmap.FromFile(ImagePaths[nowCount]);
|
}
|
}
|
|
private void Select_Click(object sender, EventArgs e)
|
{
|
FolderBrowserDialog oDialog = new FolderBrowserDialog();
|
oDialog.SelectedPath = Pub_Class.ClsPub.AppPath + @"\" + "PT" + @"\";
|
ImagePaths = new List<string>();
|
nowCount = 0;
|
if (oDialog.ShowDialog() == DialogResult.OK)
|
{
|
foreach (string Path in Directory.GetFiles(oDialog.SelectedPath))
|
{
|
ImagePaths.Add(Path);
|
}
|
if (ImagePaths.Count != 0)
|
{
|
ImageCount = ImagePaths.Count;
|
}
|
}
|
if (nowCount < ImageCount)
|
{
|
this.pictureBox1.Image = Bitmap.FromFile(ImagePaths[nowCount]);
|
}
|
}
|
|
private void cmbBack_Click(object sender, EventArgs e)
|
{
|
nowCount--;
|
if (nowCount < 0)
|
{
|
nowCount = 0;
|
}
|
if (nowCount < ImageCount && nowCount>=0)
|
{
|
this.pictureBox1.Image = Bitmap.FromFile(ImagePaths[nowCount]);
|
}
|
}
|
|
private void cmdNext_Click(object sender, EventArgs e)
|
{
|
nowCount++;
|
if (nowCount > ImageCount)
|
{
|
nowCount = ImageCount - 1;
|
}
|
if (nowCount < ImageCount && nowCount >= 0)
|
{
|
this.pictureBox1.Image = Bitmap.FromFile(ImagePaths[nowCount]);
|
}
|
}
|
|
|
|
}
|
}
|