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;
|
|
namespace WarM
|
{
|
public partial class Kf_SellOutBill_Weight : Form
|
{
|
public Kf_SellOutBill_Weight()
|
{
|
InitializeComponent();
|
}
|
//定义
|
public const Int16 HTagCol = 0;
|
public const Int16 HSnoCol = 1;
|
public const Int16 FItemIDCol = 2;
|
public const Int16 FItemNumberCol = 3;
|
public const Int16 FItemNameCol = 4;
|
public const Int16 FItemModelCol = 5;
|
public const Int16 FUnitIDCol = 6;
|
public const Int16 FUnitNumberCol = 7;
|
public const Int16 FUnitNameCol = 8;
|
public const Int16 FSecUnitIDCol = 9;
|
public const Int16 FSecUnitNumberCol = 10;
|
public const Int16 FSecUnitNameCol = 11;
|
public const Int16 FSecCoefficientCol = 12;
|
public const Int16 FBatchNoCol = 13;
|
|
public const Int16 FQtyCol = 14;
|
public const Int16 FQty1Col = 15;
|
public const Int16 FQtyMustCol = 16;
|
public const Int16 FAuxQtyCol = 17;
|
public const Int16 FAuxQtyMustCol = 18;
|
public const Int16 FSecQtyCol = 19;
|
public const Int16 FAuxPriceCol = 20;
|
public const Int16 FAuxPlanPriceCol = 21;
|
public const Int16 FAmountCol = 22;
|
public const Int16 FPlanAmountCol = 23;
|
|
public const Int16 FDCStockIDCol = 24;
|
public const Int16 FDCStockNumberCol = 25;
|
public const Int16 FDCStockNameCol = 26;
|
|
public const Int16 FDCSPIDCol = 27;
|
public const Int16 FDCSPNumberCol = 28;
|
public const Int16 FDCSPNameCol = 29;
|
|
public const Int16 FNoteCol = 30;
|
public const Int16 FSourceInterIDCol = 31;
|
public const Int16 FSourceEntryIDCol = 32;
|
public const Int16 FSourceBillNoCol = 33;
|
public const Int16 FSourceTranTypeCol = 34;
|
//表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 = "21";
|
public const string ModCaption = "客户称重编辑";
|
public bool BillChange; //
|
public string FDCStockNumber;
|
public SQLHelper.ClsCNK3 oCnK3 = new SQLHelper.ClsCNK3();
|
public Int64 FInterID;
|
|
public DBUtility.ClsPub.Enum_BillStatus BillStatus;
|
public Int64 KeyID;
|
public bool grdStatus;
|
public DAL.ClsKf_SellOutBill_K3 BillNew = new DAL.ClsKf_SellOutBill_K3();
|
public DAL.ClsKf_SellOutBill_K3 BillOld = new DAL.ClsKf_SellOutBill_K3();
|
ClsGridViewSum oSumGrid = new ClsGridViewSum();
|
ClsGridViewSum oSumGrid_Sub = new ClsGridViewSum();
|
//-------------------------------------------------------------------------
|
#region 固定代码
|
|
private void Total()
|
{
|
oSumGrid.Total();
|
}
|
//清空界面
|
public void Sub_ClearBill()
|
{
|
//清空界面控件 for 控件
|
foreach (Control ct in gbUp.Controls)
|
{
|
switch (ct.GetType().Name)
|
{
|
case "ListBox":
|
((ListBox)ct).Items.Clear();
|
break;
|
case "CheckBox":
|
((CheckBox)ct).Checked = false;
|
break;
|
case "RadioButton":
|
|
break;
|
case "ComboBox":
|
((ComboBox)ct).SelectedIndex = 0;
|
break;
|
case "TextBox":
|
((TextBox)ct).Text = "";
|
break;
|
case "DateTimePicker":
|
((DateTimePicker)ct).Value = DateTime.Today;
|
break;
|
default:
|
break;
|
}
|
}
|
//
|
txtFMaker.Text = ClsPub.CurUserName;
|
txtFMakeDate.Text = "";
|
txtFChecker.Text = "";
|
txtFCheckDate.Text = "";
|
txtFCloseMan.Text = "";
|
txtFCloseDate.Text = "";
|
txtFDeleteMan.Text = "";
|
txtFDeleteDate.Text = "";
|
txtFUpDater.Text = "";
|
txtFUpDateDate.Text = "";
|
initGrid();
|
initGrid_Sub();
|
}
|
//编辑单据
|
private void Sub_EditBill()
|
{
|
string s = "";
|
if (BillOld.ShowBill(BillOld.omodel.HInterID, ref s) == false)
|
{
|
MessageBox.Show("此单据有错误!", "提示");
|
return;
|
}
|
if (BillOld.omodel.HChecker != "")
|
{
|
MessageBox.Show("此单据已经被审核,不允许修改", "提示");
|
return;
|
}
|
this.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify;
|
this.Sub_OperStatus();
|
|
txtFUpDater.Text = ClsPub.CurUserName;
|
txtFBillNo.Enabled = false;
|
}
|
//删除单据
|
private void Sub_DeleteBill()
|
{
|
////编辑权限
|
//if (!DBUtility.ClsPub.Security_Log(ModRightNameEdit, 1, true, DBUtility.ClsPub.CurUserName))
|
//{
|
// return;
|
//}
|
//
|
if (BillOld.omodel.HChecker != "")
|
{
|
MessageBox.Show("此单据已经被审核,不允许删除", "提示");
|
return;
|
}
|
//string a = BillOld.FMaker.ToLower;
|
//string b = ClsPub.CurUserName.ToLower;
|
if (BillOld.omodel.HMaker != ClsPub.CurUserName)
|
//if (a != b)
|
{
|
MessageBox.Show("只能删除自己的单据", "提示");
|
return;
|
}
|
if (MessageBox.Show("确定要删除当前单据?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
|
{
|
if (BillOld.DeleteBill(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) != true)
|
{
|
BillChange = true;
|
MessageBox.Show("删除失败,原因:" + ClsPub.sExeReturnInfo, "提示");
|
return;
|
}
|
MessageBox.Show("删除成功", "提示");
|
BillOld = new DAL.ClsKf_SellOutBill_K3();
|
this.Sub_Next(); //显示下一张单据
|
if (BillOld.omodel.HInterID == 0)//若找不到下一张,则显示上一张
|
{
|
this.Sub_Prev();
|
}
|
if (BillOld.omodel.HInterID == 0)//若找不到上一张,清空
|
{
|
this.Sub_ClearBill();
|
}
|
BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View;
|
this.Sub_OperStatus();
|
}
|
|
}
|
private void bclk_Click(object sender, EventArgs e)
|
{
|
//保存列宽
|
DBUtility.Xt_BaseBillFun.SaveGrid(grdMain, this.Name);
|
}
|
//增行按钮 未完成
|
private void AddRow_Click(object sender, EventArgs e)
|
{
|
oSumGrid.Sub_AddRow();
|
}
|
//删行按纽 未完成
|
private void DelRow_Click(object sender, EventArgs e)
|
{
|
oSumGrid.Sub_DelRow();
|
}
|
private void mrlk_Click(object sender, EventArgs e)
|
{
|
DBUtility.Xt_BaseBillFun.DefaultGridView(grdMain, this.Name);
|
}
|
//离开单元格
|
|
private void grdMain_LeaveCell(object sender, EventArgs e)
|
{
|
oSumGrid.LeaveCell();
|
}
|
|
//放弃 编辑
|
private void Sub_AbandonBill()
|
{
|
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_First();
|
}
|
}
|
}
|
private void Kf_SellOutBill_K3_Paint(object sender, PaintEventArgs e)//画线
|
{
|
Graphics g = this.panel2.CreateGraphics();
|
Pen p = new Pen(Color.Gray);
|
p.Width = 1;
|
g.DrawLine(p, new Point(txtFMaker.Left, txtFMaker.Top + txtFMaker.Height), new Point(txtFMaker.Left + txtFMaker.Width, txtFMaker.Top + txtFMaker.Height));
|
g.DrawLine(p, new Point(txtFMakeDate.Left, txtFMakeDate.Top + txtFMakeDate.Height), new Point(txtFMakeDate.Left + txtFMakeDate.Width, txtFMakeDate.Top + txtFMakeDate.Height));
|
//
|
g.DrawLine(p, new Point(txtFChecker.Left, txtFChecker.Top + txtFChecker.Height), new Point(txtFChecker.Left + txtFChecker.Width, txtFChecker.Top + txtFChecker.Height));
|
g.DrawLine(p, new Point(txtFCheckDate.Left, txtFCheckDate.Top + txtFCheckDate.Height), new Point(txtFCheckDate.Left + txtFCheckDate.Width, txtFCheckDate.Top + txtFCheckDate.Height));
|
//
|
g.DrawLine(p, new Point(txtFCloseMan.Left, txtFCloseMan.Top + txtFCloseMan.Height), new Point(txtFCloseMan.Left + txtFCloseMan.Width, txtFCloseMan.Top + txtFCloseMan.Height));
|
g.DrawLine(p, new Point(txtFCloseDate.Left, txtFCloseDate.Top + txtFCloseDate.Height), new Point(txtFCloseDate.Left + txtFCloseDate.Width, txtFCloseDate.Top + txtFCloseDate.Height));
|
//
|
g.DrawLine(p, new Point(this.txtFDeleteMan.Left, txtFDeleteMan.Top + txtFDeleteMan.Height), new Point(txtFDeleteMan.Left + txtFDeleteMan.Width, txtFDeleteMan.Top + txtFDeleteMan.Height));
|
g.DrawLine(p, new Point(txtFDeleteDate.Left, txtFDeleteDate.Top + txtFDeleteDate.Height), new Point(txtFDeleteDate.Left + txtFDeleteDate.Width, txtFDeleteDate.Top + txtFDeleteDate.Height));
|
//
|
g.DrawLine(p, new Point(this.txtFUpDater.Left, txtFUpDater.Top + txtFUpDater.Height), new Point(txtFUpDater.Left + txtFUpDater.Width, txtFUpDater.Top + txtFUpDater.Height));
|
g.DrawLine(p, new Point(txtFUpDateDate.Left, txtFUpDateDate.Top + txtFUpDateDate.Height), new Point(txtFUpDateDate.Left + txtFUpDateDate.Width, txtFUpDateDate.Top + txtFUpDateDate.Height));
|
//控件位置设置
|
|
}
|
//控件位置
|
private void Sub_ControlLocation()
|
{
|
//
|
}
|
//窗体加载
|
private void Kf_SellOutBill_K3_Load(object sender, EventArgs e)
|
{
|
//打印初始化
|
dtpFDate.Value = DateTime.Today;
|
oSumGrid.NoCol = HSnoCol;
|
oSumGrid.ogrdMain = grdMain;
|
oSumGrid.oGridsum = grdSum;
|
//
|
oSumGrid_Sub.NoCol = SecHSnoCol;
|
oSumGrid_Sub.ogrdMain = grdSub;
|
oSumGrid_Sub.oGridsum = grdSumSub;
|
this.Text = ModCaption;
|
this.lblCaption.Text = ModCaption;
|
}
|
//首张
|
private void Sub_First()
|
{
|
BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View;
|
BillOld = new DAL.ClsKf_SellOutBill_K3();
|
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, txtFBillNo.Text))
|
{
|
this.Sub_ShowBill();
|
}
|
}
|
//下张
|
private void Sub_Next()
|
{
|
BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View;
|
if (BillOld.GetNextBill(ref ClsPub.sExeReturnInfo, txtFBillNo.Text))
|
{
|
this.Sub_ShowBill();
|
}
|
}
|
//末张
|
private void Sub_Last()
|
{
|
BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View;
|
BillOld = new DAL.ClsKf_SellOutBill_K3();
|
if (BillOld.GetLastBill(ref ClsPub.sExeReturnInfo))
|
{
|
this.Sub_ShowBill();
|
}
|
}
|
//审核单据
|
private void Sub_CheckBill()
|
{
|
////审核权限
|
//if (!ClsPub.Security_Log(ModRightNameCheck, 1, true))
|
//{
|
// return;
|
//}
|
//
|
|
if (BillOld.CheckBill(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
|
{
|
BillChange = true;
|
txtFChecker.Text = ClsPub.CurUserName;
|
txtFCheckDate.Text = BillOld.omodel.HCheckDate;
|
this.Sub_OperStatus();//刷新TOOL按钮
|
}
|
else
|
{
|
MessageBox.Show("审核失败!原因:" + ClsPub.sExeReturnInfo, "提示");
|
}
|
}
|
//反审单据
|
private void Sub_AbandonCheck()
|
{
|
////审核权限
|
//if (!ClsPub.Security_Log(ModRightNameCheck, 1, true))
|
//{
|
// return;
|
//}
|
//
|
|
if (BillOld.AbandonCheck(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
|
{
|
BillChange = true;
|
txtFChecker.Text = "";
|
txtFCheckDate.Text = "";
|
this.Sub_OperStatus();//刷新TOOL按钮
|
}
|
else
|
{
|
MessageBox.Show("反审核失败!原因:" + ClsPub.sExeReturnInfo, "提示");
|
}
|
}
|
//关闭单据
|
private void Sub_CloseBill()
|
{
|
////关闭权限
|
//if (!ClsPub.Security_Log(ModRightNameClose, 1, true))
|
//{
|
// return;
|
//}
|
//
|
|
|
if (BillOld.CloseBill(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
|
{
|
BillChange = true;
|
txtFCloseMan.Text = ClsPub.CurUserName;
|
txtFCloseDate.Text = BillOld.omodel.HCloseDate;
|
this.Sub_OperStatus();//刷新TOOL按钮
|
}
|
else
|
{
|
MessageBox.Show("关闭失败!原因:" + ClsPub.sExeReturnInfo, "提示");
|
}
|
}
|
//反关闭单据
|
private void Sub_Cancel()
|
{
|
////关闭权限
|
//if (!ClsPub.Security_Log(ModRightNameClose, 1, true))
|
//{
|
// return;
|
//}
|
//
|
|
if (BillOld.CancelClose(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
|
{
|
BillChange = true;
|
txtFCloseMan.Text = "";
|
txtFCloseDate.Text = "";
|
this.Sub_OperStatus();//刷新TOOL按钮
|
}
|
else
|
{
|
MessageBox.Show("恢复失败!原因:" + ClsPub.sExeReturnInfo, "提示");
|
}
|
}
|
//作废单据
|
private void Sub_Cancelltion()
|
{
|
////作废权限
|
//if (!ClsPub.Security_Log(ModRightNameDelete, 1, true))
|
//{
|
// return;
|
//}
|
//
|
|
|
if (BillOld.Cancelltion(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
|
{
|
BillChange = true;
|
this.txtFDeleteMan.Text = ClsPub.CurUserName;
|
this.txtFDeleteDate.Text = BillOld.omodel.HDeleteDate;
|
this.Sub_OperStatus();//刷新TOOL按钮
|
}
|
else
|
{
|
MessageBox.Show("作废失败!原因:" + ClsPub.sExeReturnInfo, "提示");
|
}
|
}
|
//反作废
|
private void Sub_AbandonCancelltion()
|
{
|
////作废权限
|
//if (!ClsPub.Security_Log(ModRightNameDelete, 1, true))
|
//{
|
// return;
|
//}
|
//
|
|
|
if (BillOld.AbandonCancelltion(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
|
{
|
BillChange = true;
|
this.txtFDeleteMan.Text = "";
|
this.txtFDeleteDate.Text = "";
|
this.Sub_OperStatus();//刷新TOOL按钮
|
}
|
else
|
{
|
MessageBox.Show("作废失败!原因:" + ClsPub.sExeReturnInfo, "提示");
|
}
|
}
|
//新增按纽
|
private void xz_Click(object sender, EventArgs e)
|
{
|
this.Sub_AddBill();
|
}
|
//修改按纽
|
private void xg_Click(object sender, EventArgs e)
|
{
|
this.Sub_EditBill();
|
}
|
//删除按钮
|
private void sc_Click(object sender, EventArgs e)
|
{
|
this.Sub_DeleteBill();
|
}
|
//保存按钮
|
private void bc_Click(object sender, EventArgs e)
|
{
|
this.Sub_SaveBill();
|
}
|
//放弃按钮
|
private void fq_Click(object sender, EventArgs e)
|
{
|
this.Sub_AbandonBill();
|
}
|
//审核按钮
|
private void sh_Click(object sender, EventArgs e)
|
{
|
this.Sub_CheckBill();
|
}
|
//放弃审核按钮
|
private void qsh_Click(object sender, EventArgs e)
|
{
|
this.Sub_AbandonCheck();
|
}
|
//关闭按钮
|
private void gb_Click(object sender, EventArgs e)
|
{
|
this.Sub_CloseBill();
|
}
|
//恢复按钮
|
private void hf_Click(object sender, EventArgs e)
|
{
|
this.Sub_Cancel();
|
}
|
//作废按钮
|
private void zf_Click(object sender, EventArgs e)
|
{
|
this.Sub_Cancelltion();
|
}
|
//反作废按钮
|
private void zc_Click(object sender, EventArgs e)
|
{
|
this.Sub_AbandonCancelltion();
|
}
|
//首张单据按钮
|
private void sz_Click(object sender, EventArgs e)
|
{
|
this.Sub_First();
|
}
|
//上一张按钮
|
private void syz_Click(object sender, EventArgs e)
|
{
|
this.Sub_Prev();
|
}
|
//下一张按钮
|
private void xyz_Click(object sender, EventArgs e)
|
{
|
this.Sub_Next();
|
}
|
//末张按钮
|
private void mz_Click(object sender, EventArgs e)
|
{
|
this.Sub_Last();
|
}
|
//退出按钮
|
private void tc_Click(object sender, EventArgs e)
|
{
|
this.Close();
|
}
|
//窗体尺寸变化时
|
private void Kf_SellOutBill_K3_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;
|
}
|
}
|
//复制单据
|
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);//得到新单号
|
//
|
SQLHelper.ClsCNK3 oCnK3 = new SQLHelper.ClsCNK3();
|
this.txtFBillNo.Text = DBUtility.Xt_BaseBillFun.get_MaxBillNo_K3(BillNew.BillType, oCnK3);
|
//
|
this.txtFBillNo.Enabled = true;
|
this.txtFBillNo.Focus();
|
this.txtFMaker.Text = ClsPub.CurUserName;
|
this.txtFMakeDate.Text = ClsPub.GetServerDate(-1);
|
this.txtFChecker.Text = "";
|
this.txtFCloseDate.Text = "";
|
this.txtFCloseMan.Text = "";
|
this.txtFCloseDate.Text = "";
|
this.txtFDeleteMan.Text = "";
|
this.txtFDeleteDate.Text = "";
|
this.txtFUpDater.Text = "";
|
this.txtFUpDateDate.Text = "";
|
}
|
//复制按钮
|
private void fz_Click(object sender, EventArgs e)
|
{
|
//Sub_CopyBill();
|
}
|
//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 Kf_SellOutBill_K3_FormClosing(object sender, FormClosingEventArgs e)
|
{
|
BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
|
DBUtility.Xt_BaseBillFun.SaveGrid(grdMain, this.Name);
|
}
|
//新增单据
|
private void Sub_AddBill()
|
{
|
this.BillNew = new DAL.ClsKf_SellOutBill_K3();
|
this.BillOld = new DAL.ClsKf_SellOutBill_K3();
|
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);//得到新单号(缺少函数) 未完成
|
|
SQLHelper.ClsCNK3 oCnK3 = new SQLHelper.ClsCNK3();
|
this.txtFBillNo.Text = DBUtility.Xt_BaseBillFun.get_MaxBillNo_K3(BillNew.BillType, oCnK3);
|
this.txtFBillNo.Enabled = true;
|
this.txtFBillNo.Focus();
|
|
}
|
//TOOLBAR状态 按钮是否灰度
|
public void Sub_OperStatus()
|
{
|
switch (BillStatus)
|
{
|
case DBUtility.ClsPub.Enum_BillStatus.BillStatus_View:
|
//浏览状态
|
yl.Enabled = true;
|
xz.Enabled = true;
|
xg.Enabled = true;
|
sc.Enabled = true;
|
AddRow.Enabled = false;
|
DelRow.Enabled = false;
|
bc.Enabled = true;
|
fq.Enabled = false;
|
|
tc.Enabled = true;
|
fz.Enabled = true;
|
//未审核
|
if (txtFChecker.Text.Trim() == "")
|
{
|
sh.Enabled = true;
|
qsh.Enabled = false;
|
gb.Enabled = false;
|
hf.Enabled = false;
|
xg.Enabled = true;
|
sc.Enabled = true;
|
//未审核
|
pic1.Visible = false;
|
pic1.Image = null;
|
//
|
}
|
else if (txtFCloseMan.Text.Trim() == "" && txtFChecker.Text.Trim() != "")//审核未关闭
|
{
|
sh.Enabled = false;
|
qsh.Enabled = true;
|
gb.Enabled = true;
|
hf.Enabled = false;
|
xg.Enabled = false;
|
sc.Enabled = false;
|
//
|
pic1.Visible = true;
|
pic1.Image = System.Drawing.Image.FromFile(ClsPub.AppPath + @"/Pic/Checked.jpg");
|
//
|
}
|
else//已关闭
|
{
|
sh.Enabled = false;
|
qsh.Enabled = false;
|
gb.Enabled = false;
|
hf.Enabled = true;
|
xg.Enabled = false;
|
sc.Enabled = false;
|
//
|
pic1.Visible = true;
|
pic1.Image = System.Drawing.Image.FromFile(ClsPub.AppPath + @"/Pic/Closed.jpg");
|
//
|
}
|
if (txtFDeleteMan.Text.Trim() == "")
|
{
|
zf.Enabled = true;
|
zc.Enabled = false;
|
}
|
else //已作废
|
{
|
zf.Enabled = false;
|
zc.Enabled = true;
|
xg.Enabled = false;
|
sc.Enabled = false;
|
AddRow.Enabled = false;
|
DelRow.Enabled = false;
|
bc.Enabled = false;
|
fq.Enabled = false;
|
sh.Enabled = false;
|
qsh.Enabled = false;
|
gb.Enabled = false;
|
hf.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 = 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;
|
|
tc.Enabled = true;
|
Sub_LrtextStatus(true);
|
grdStatus = true;
|
fz.Enabled = false;
|
//未审核
|
pic1.Visible = false;
|
pic1.Image = null;
|
//
|
break;
|
case DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify:
|
//修改状态
|
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;
|
|
tc.Enabled = true;
|
Sub_LrtextStatus(true);
|
grdStatus = true;
|
fz.Enabled = false;
|
//未审核
|
pic1.Visible = false;
|
pic1.Image = null;
|
//
|
break;
|
}
|
|
}
|
#endregion
|
|
|
#region 读写类
|
|
//
|
public void Sub_ShowBarCode(DataSet ds)
|
{
|
DAL.ClsK3_Employee_View oEmp = new DAL.ClsK3_Employee_View();
|
DAL.ClsK3_Department_View oDept = new DAL.ClsK3_Department_View();
|
DAL.ClsK3_Supplier_View oSup = new DAL.ClsK3_Supplier_View();
|
DAL.ClsK3_Warehouse_View oWh = new DAL.ClsK3_Warehouse_View();
|
DAL.ClsK3_Material_View oMater = new DAL.ClsK3_Material_View();
|
DAL.ClsK3_Unit_View oUnit = new DAL.ClsK3_Unit_View();
|
DAL.ClsK3_Unit_View oUnit2 = new DAL.ClsK3_Unit_View();
|
DAL.ClsGy_Property_View oProperty = new DAL.ClsGy_Property_View();
|
|
//加载表体
|
int i = 0;
|
initGrid();
|
initGrid_Sub();
|
//i = grdMain.FixedRows;
|
for (i = 0; i < ds.Tables[0].Rows.Count; i++)
|
{
|
if (i >= grdMain.RowCount - 1)
|
grdMain.Rows.Add();
|
grdMain.Rows[i].Cells[HTagCol].Value = "*";
|
grdMain.Rows[i].Cells[FItemIDCol].Value = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HMaterID"]);
|
if (oMater.GetInfoByID(DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HMaterID"])))
|
{
|
grdMain.Rows[i].Cells[FItemNumberCol].Value = oMater.omodel.HNumber;
|
grdMain.Rows[i].Cells[FItemNameCol].Value = oMater.omodel.HName;
|
grdMain.Rows[i].Cells[FItemModelCol].Value = oMater.omodel.HModel;
|
grdMain.Rows[i].Cells[FUnitIDCol].Value = oMater.omodel.HUnitID;
|
}
|
else
|
{
|
grdMain.Rows[i].Cells[FItemNumberCol].Value = "";
|
grdMain.Rows[i].Cells[FItemNameCol].Value = "";
|
grdMain.Rows[i].Cells[FItemModelCol].Value = "";
|
}
|
//
|
//grdMain.Rows[i].Cells[HPropertyIDCol].Value = oSub.HPropertyID.ToString();
|
//if (oProperty.GetInfoByID(oSub.HPropertyID))
|
//{
|
// grdMain.Rows[i].Cells[HPropertyNumberCol].Value = oProperty.oModel.HNumber;
|
// grdMain.Rows[i].Cells[HPropertyNameCol].Value = oProperty.oModel.HName;
|
//}
|
//else
|
//{
|
// grdMain.Rows[i].Cells[HPropertyNumberCol].Value = "";
|
// grdMain.Rows[i].Cells[HPropertyNameCol].Value = "";
|
//}
|
//
|
|
if (oUnit.GetInfoByID(DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[FUnitIDCol].Value)))
|
{
|
grdMain.Rows[i].Cells[FUnitNumberCol].Value = oUnit.omodel.HNumber;
|
grdMain.Rows[i].Cells[FUnitNameCol].Value = oUnit.omodel.HName;
|
}
|
else
|
{
|
grdMain.Rows[i].Cells[FUnitNumberCol].Value = "";
|
grdMain.Rows[i].Cells[FUnitNameCol].Value = "";
|
}
|
//
|
grdMain.Rows[i].Cells[FDCStockIDCol].Value = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HWHID"]);
|
if (oWh.GetInfoByID(DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[FDCStockIDCol].Value)))
|
{
|
grdMain.Rows[i].Cells[FDCStockNumberCol].Value = oWh.omodel.HNumber;
|
grdMain.Rows[i].Cells[FDCStockNameCol].Value = oWh.omodel.HName;
|
//grdMain.Rows[i].Cells[HSPGroupIDCol].Value = oWh.HSPGroupID.ToString();
|
//grdMain.Rows[i].Cells[HSPGroupNumberCol].Value = oWh.HSPGroupNumber;
|
//grdMain.Rows[i].Cells[HSPGroupNameCol].Value = oWh.HSPGroupName;
|
}
|
else
|
{
|
grdMain.Rows[i].Cells[FDCStockNumberCol].Value = "";
|
grdMain.Rows[i].Cells[FDCStockNameCol].Value = "";
|
//grdMain.Rows[i].Cells[HSPGroupIDCol].Value = 0;
|
//grdMain.Rows[i].Cells[HSPGroupNumberCol].Value = "";
|
//grdMain.Rows[i].Cells[HSPGroupNameCol].Value = "";
|
}
|
//
|
//
|
//grdMain.Rows[i].Cells[HSecUnitIDCol].Value = oSub.HSecUnitID.ToString();
|
//if (oUnit2.GetInfoByID(oSub.HSecUnitID))
|
//{
|
// grdMain.Rows[i].Cells[HSecUnitNumberCol].Value = oUnit2.omodel.HNumber;
|
// grdMain.Rows[i].Cells[HSecUnitNameCol].Value = oUnit2.omodel.HName;
|
//}
|
//else
|
//{
|
// grdMain.Rows[i].Cells[HSecUnitNumberCol].Value = "";
|
// grdMain.Rows[i].Cells[HSecUnitNameCol].Value = "";
|
//}
|
|
grdMain.Rows[i].Cells[FBatchNoCol].Value = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HBatchNo"]);
|
//grdMain.Rows[i].Cells[HSecUnitRateCol].Value = 0;
|
grdMain.Rows[i].Cells[FNoteCol].Value = "";
|
grdMain.Rows[i].Cells[FAuxPriceCol].Value = 0;
|
grdMain.Rows[i].Cells[FAuxQtyCol].Value = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[i]["HQty"]);
|
grdMain.Rows[i].Cells[FQtyCol].Value = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[i]["HQty"]);
|
grdMain.Rows[i].Cells[FQty1Col].Value = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[i]["HQty1"]);
|
//grdMain.Rows[i].Cells[HQtyMustCol].Value = DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[i]["HQty"]);
|
grdMain.Rows[i].Cells[FAmountCol].Value = 0;
|
grdMain.Rows[i].Cells[FSourceBillNoCol].Value = DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HSourceBillNo"]);
|
grdMain.Rows[i].Cells[FSourceInterIDCol].Value = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSourceInterID"]);
|
grdMain.Rows[i].Cells[FSourceEntryIDCol].Value = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSourceEntryID"]);
|
grdMain.Rows[i].Cells[FSourceTranTypeCol].Value = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[i]["HSourceBillType"]);
|
|
//grdMain.Rows[i].Cells[HPOOrderInterIDCol].Value = oSub.HPOOrderInterID.ToString();
|
//grdMain.Rows[i].Cells[HPOOrderEntryIDCol].Value = oSub.HPOOrderEntryID.ToString();
|
//grdMain.Rows[i].Cells[HPOOrderBillNoCol].Value = oSub.HPOOrderBillNo.Trim();
|
//grdMain.Rows[i].Cells[].Value = 0;
|
i = i + 1;
|
}
|
//合计
|
//Total();
|
//
|
Sub_OperStatus();
|
}
|
|
//显示单据
|
public void Sub_ShowBill()
|
{
|
DAL.ClsK3_Customer_View oCus = new DAL.ClsK3_Customer_View();
|
DAL.ClsK3_Department_View oDept = new DAL.ClsK3_Department_View();
|
DAL.ClsK3_Employee_View oEmp = new DAL.ClsK3_Employee_View();
|
DAL.ClsK3_Warehouse_View oWh = new DAL.ClsK3_Warehouse_View();
|
DAL.ClsK3_Material_View oMater = new DAL.ClsK3_Material_View();
|
DAL.ClsK3_Unit_View oUnit = new DAL.ClsK3_Unit_View();
|
//ClsK3_UserHlp oUser = new ClsK3_UserHlp();
|
//判断是否存在单据
|
if (BillOld.ShowBill(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == false)
|
{
|
MessageBox.Show(ClsPub.sExeReturnInfo, "提示");
|
return;
|
}
|
//清空
|
Sub_ClearBill();
|
//grid禁止刷新
|
//grdMain.Redraw = VSFlex7.RedrawSettings.flexRDNone;
|
//加载表头
|
if (oDept.GetInfoByID(BillOld.omodel.HDeptID))
|
{
|
this.txtFDeptID.Tag = oDept.omodel.HItemID.ToString().Trim();
|
this.txtFDeptID.Text = oDept.omodel.HName;
|
}
|
else
|
{
|
this.txtFDeptID.Text = "";
|
}
|
//
|
if (oCus.GetInfoByID(BillOld.omodel.HSupID))
|
{
|
this.txtFSupplyID.Tag = oCus.omodel.HItemID.ToString().Trim();
|
this.txtFSupplyID.Text = oCus.omodel.HName;
|
}
|
else
|
{
|
this.txtFSupplyID.Text = "";
|
}
|
//
|
if (oEmp.GetInfoByID(BillOld.omodel.HKeeperID))
|
{
|
this.txtFSManagerID.Tag = oEmp.omodel.HItemID.ToString().Trim();
|
this.txtFSManagerID.Text = oEmp.omodel.HName;
|
}
|
else
|
{
|
this.txtFSManagerID.Text = "";
|
}
|
//
|
if (oEmp.GetInfoByID(BillOld.omodel.HSecManagerID))
|
{
|
this.txtFFManagerID.Tag = oEmp.omodel.HItemID.ToString().Trim();
|
this.txtFFManagerID.Text = oEmp.omodel.HName;
|
}
|
else
|
{
|
this.txtFFManagerID.Text = "";
|
}
|
//
|
if (oWh.GetInfoByID(BillOld.omodel.HWHID))
|
{
|
this.txtFDCStockID.Tag = oWh.omodel.HItemID.ToString().Trim();
|
this.txtFDCStockID.Text = oWh.omodel.HName;
|
}
|
else
|
{
|
this.txtFDCStockID.Text = "";
|
}
|
//
|
if (oEmp.GetInfoByID(BillOld.omodel.HManagerID))
|
{
|
this.txtFManagerID.Tag = oEmp.omodel.HItemID.ToString().Trim();
|
this.txtFManagerID.Text = oEmp.omodel.HName;
|
}
|
else
|
{
|
this.txtFManagerID.Text = "";
|
}
|
//
|
if (oEmp.GetInfoByID(BillOld.omodel.HEmpID))
|
{
|
this.txtFEmpID.Tag = oEmp.omodel.HItemID.ToString().Trim();
|
this.txtFEmpID.Text = oEmp.omodel.HName;
|
}
|
else
|
{
|
this.txtFEmpID.Text = "";
|
}
|
//
|
|
//
|
this.dtpFDate.Value = BillOld.omodel.HDate;
|
this.txtFBillNo.Text = BillOld.omodel.HBillNo;
|
this.txtFNote.Text = BillOld.omodel.HRemark;
|
this.txtFFetchAdd.Text = BillOld.omodel.HAddress;
|
this.txtFExplanation.Text = BillOld.omodel.HExplanation;
|
//
|
//if (oUser.GetInfoByID(ClsPub.isLong(BillOld.omodel.HMaker)))
|
//{
|
// this.txtFMaker.Text = oUser.HName;
|
//}
|
////
|
//if (oUser.GetInfoByID(ClsPub.isLong(BillOld.omodel.HChecker)))
|
//{
|
// this.txtFChecker.Text = oUser.HName;
|
//}
|
//
|
this.txtFMaker.Text = BillOld.omodel.HMaker;
|
this.txtFMakeDate.Text = BillOld.omodel.HMakeDate;
|
this.txtFChecker.Text = BillOld.omodel.HChecker;
|
this.txtFCheckDate.Text = BillOld.omodel.HCheckDate;
|
this.txtFCloseMan.Text = BillOld.omodel.HCloseMan;
|
this.txtFCloseDate.Text = BillOld.omodel.HCloseDate;
|
this.txtFDeleteMan.Text = BillOld.omodel.HDeleteMan;
|
this.txtFDeleteDate.Text = BillOld.omodel.HDeleteDate;
|
this.txtFUpDater.Text = BillOld.omodel.HUpDater;
|
this.txtFUpDateDate.Text = BillOld.omodel.HUpDateDate;
|
//加载表体
|
int i = 0;
|
foreach (Model.ClsKf_SellOutBillSub_K3 oSub in BillOld.DetailColl)
|
{
|
if (i >= grdMain.RowCount - 1)
|
grdMain.Rows.Add();
|
grdMain.Rows[i].Cells[HTagCol].Value = "*";
|
|
grdMain.Rows[i].Cells[FItemIDCol].Value = oSub.HMaterID.ToString();
|
if (oMater.GetInfoByID(oSub.HMaterID))
|
{
|
grdMain.Rows[i].Cells[FItemNumberCol].Value = oMater.omodel.HNumber;
|
grdMain.Rows[i].Cells[FItemNameCol].Value = oMater.omodel.HName;
|
grdMain.Rows[i].Cells[FItemModelCol].Value = oMater.omodel.HModel;
|
}
|
else
|
{
|
grdMain.Rows[i].Cells[FItemNumberCol].Value = "";
|
grdMain.Rows[i].Cells[FItemNameCol].Value = "";
|
grdMain.Rows[i].Cells[FItemModelCol].Value = "";
|
}
|
//
|
grdMain.Rows[i].Cells[FUnitIDCol].Value = oSub.HUnitID.ToString();
|
if (oUnit.GetInfoByID(oSub.HUnitID))
|
{
|
grdMain.Rows[i].Cells[FUnitNumberCol].Value = oUnit.omodel.HNumber;
|
grdMain.Rows[i].Cells[FUnitNameCol].Value = oUnit.omodel.HName;
|
}
|
else
|
{
|
grdMain.Rows[i].Cells[FUnitNumberCol].Value = "";
|
grdMain.Rows[i].Cells[FUnitNameCol].Value = "";
|
}
|
//
|
grdMain.Rows[i].Cells[FSecUnitIDCol].Value = oSub.HSecUnitID.ToString();
|
if (oUnit.GetInfoByID(oSub.HSecUnitID))
|
{
|
grdMain.Rows[i].Cells[FSecUnitNumberCol].Value = oUnit.omodel.HNumber;
|
grdMain.Rows[i].Cells[FSecUnitNameCol].Value = oUnit.omodel.HName;
|
}
|
else
|
{
|
grdMain.Rows[i].Cells[FSecUnitNumberCol].Value = "";
|
grdMain.Rows[i].Cells[FSecUnitNameCol].Value = "";
|
}
|
//
|
grdMain.Rows[i].Cells[FDCStockIDCol].Value = oSub.HWhID.ToString();
|
if (oWh.GetInfoByID(oSub.HWhID))
|
{
|
grdMain.Rows[i].Cells[FDCStockNumberCol].Value = oWh.omodel.HNumber;
|
grdMain.Rows[i].Cells[FDCStockNameCol].Value = oWh.omodel.HName;
|
}
|
else
|
{
|
grdMain.Rows[i].Cells[FDCStockNumberCol].Value = "";
|
grdMain.Rows[i].Cells[FDCStockNameCol].Value = "";
|
}
|
//
|
grdMain.Rows[i].Cells[FDCSPIDCol].Value = oSub.HSPID.ToString();
|
if (oWh.GetInfoByID(oSub.HSPID))
|
{
|
grdMain.Rows[i].Cells[FDCSPNumberCol].Value = oWh.omodel.HNumber;
|
grdMain.Rows[i].Cells[FDCSPNameCol].Value = oWh.omodel.HName;
|
}
|
else
|
{
|
grdMain.Rows[i].Cells[FDCSPNumberCol].Value = "";
|
grdMain.Rows[i].Cells[FDCSPNameCol].Value = "";
|
}
|
//
|
grdMain.Rows[i].Cells[FSecCoefficientCol].Value = oSub.HSecCoefficient.ToString().Trim();
|
grdMain.Rows[i].Cells[FBatchNoCol].Value = oSub.HBatchNo.ToString().Trim();
|
grdMain.Rows[i].Cells[FQtyCol].Value = oSub.HQty.ToString().Trim();
|
grdMain.Rows[i].Cells[FQty1Col].Value = oSub.HQty1.ToString().Trim();
|
grdMain.Rows[i].Cells[FQtyMustCol].Value = oSub.HQtyMust.ToString().Trim();
|
grdMain.Rows[i].Cells[FAuxQtyCol].Value = oSub.HAuxQty.ToString().Trim();
|
grdMain.Rows[i].Cells[FAuxQtyMustCol].Value = oSub.HAuxQtyMust.ToString().Trim();
|
grdMain.Rows[i].Cells[FSecQtyCol].Value = oSub.HSecQty.ToString().Trim();
|
|
|
grdMain.Rows[i].Cells[FAuxPriceCol].Value = oSub.HAuxPrice.ToString().Trim();
|
grdMain.Rows[i].Cells[FAuxPlanPriceCol].Value = oSub.HAuxPlanPrice.ToString().Trim();
|
grdMain.Rows[i].Cells[FAmountCol].Value = oSub.HAmount.ToString().Trim();
|
grdMain.Rows[i].Cells[FPlanAmountCol].Value = oSub.HPlanAmount.ToString().Trim();
|
grdMain.Rows[i].Cells[FNoteCol].Value = oSub.HRemark.ToString().Trim();
|
|
grdMain.Rows[i].Cells[FSourceBillNoCol].Value = oSub.HSourceBillNo.ToString().Trim();
|
grdMain.Rows[i].Cells[FSourceInterIDCol].Value = oSub.HSourceInterID.ToString();
|
grdMain.Rows[i].Cells[FSourceEntryIDCol].Value = oSub.HSourceEntryID.ToString();
|
grdMain.Rows[i].Cells[FSourceTranTypeCol].Value = oSub.HSourceTranType.ToString().Trim();
|
|
|
i = i + 1;
|
}
|
//GRID允许刷新
|
//grdMain.Redraw = VSFlex7.RedrawSettings.flexRDBuffered;
|
//合计
|
Total();
|
//
|
Sub_OperStatus();
|
}
|
|
//单据完整性判断 未完成
|
private bool Sub_AllowSave()
|
{
|
//必输项目是否为空
|
if (DBUtility.ClsPub.isLong(txtFDeptID.Tag) == 0)
|
{
|
MessageBox.Show("部门没有选择!", "提示");
|
return false;
|
}
|
if (DBUtility.ClsPub.isLong(txtFSupplyID.Tag) == 0)
|
{
|
MessageBox.Show("客户没有选择!", "提示");
|
return false;
|
}
|
if (DBUtility.ClsPub.isLong(txtFSManagerID.Tag) == 0)
|
{
|
MessageBox.Show("保管员没有选择!", "提示");
|
return false;
|
}
|
if (DBUtility.ClsPub.isLong(txtFFManagerID.Tag) == 0)
|
{
|
MessageBox.Show("发货员没有选择!", "提示");
|
return false;
|
}
|
//if (ClsPub.isLong(txtFDCStockID.Tag) == 0)
|
//{
|
// MessageBox.Show("发料仓库没有选择!", "提示");
|
// return false;
|
//}
|
//Ds = oCn.RunProcReturn("GetFBillNo29 29", "t_billcodeby");
|
|
//this.txtFBillNo.Text = Ds.Tables[0].Rows[0][0].ToString().Trim();
|
//单据号是否重复
|
if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, txtFBillNo.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()
|
{
|
////编辑权限
|
//if (!ClsPub.Security_Log(ModRightNameEdit, 1, true))
|
//{
|
// return false;
|
//}
|
//
|
Model.ClsKf_SellOutBillSub_K3 oBillSub = new Model.ClsKf_SellOutBillSub_K3();
|
Int32 i;
|
bool bResult;
|
BillNew = new DAL.ClsKf_SellOutBill_K3();
|
lblCaption.Focus();
|
if (!Sub_AllowSave())//单据完整性判断
|
return false;
|
//是否是合理的会计期间
|
int sYear = 0;
|
int sPeriod = 0;
|
//if (ClsPub.Sub_GetPeriodByDate(ClsPub.isDate(dtpFDate.Value, 0), ref sYear, ref sPeriod))
|
//{
|
// if (!(sYear * 100 + sPeriod >= ClsPub.CurYear * 100 + ClsPub.CurPeriod))
|
// {
|
// MessageBox.Show("您选择的日期的会计期间已结账!请与管理员联系", "提示");
|
// return false;
|
// }
|
//}
|
//else
|
//{
|
// MessageBox.Show("您选择的日期不属于合理的会计期间!请与管理员联系", "提示");
|
// return false;
|
//}
|
|
//赋值ID
|
if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify)
|
BillNew.omodel.HInterID = BillOld.omodel.HInterID;
|
//主类赋值
|
//Ds = oCn.RunProcReturn("select czybm from gy_czygl where czymc='" + ClsPub.CurUserName + "'", "gy_czygl");
|
//BillNew.FBillerID =ClsPub.isLong( Ds.Tables[0].Rows[0][0]);
|
//BillNew.HYear = sYear;
|
//BillNew.HPeriod = sPeriod;
|
//BillNew.omodel.HBillNo = this.txtFBillNo.Text.Trim(); //在赋值类前就处理好字符串和数字
|
//BillNew.omodel.HDate = this.dtpFDate.Value;
|
//BillNew.omodel.HDeptID = ClsPub.isLong(this.txtFDeptID.Tag);
|
//BillNew.omodel.HSupID = ClsPub.isLong(this.txtFSupplyID.Tag);
|
//BillNew.omodel.HEmpID = ClsPub.isLong(this.txtFEmpID.Tag);
|
//BillNew.omodel.HKeeperID = ClsPub.isLong(this.txtFSManagerID.Tag);
|
//BillNew.omodel.HSecManagerID = ClsPub.isLong(this.txtFFManagerID.Tag);
|
//BillNew.omodel.HManagerID = ClsPub.isLong(this.txtFManagerID.Tag);
|
//BillNew.omodel.HWHID = ClsPub.isLong(this.txtFDCStockID.Tag);
|
//BillNew.omodel.HExplanation = this.txtFExplanation.Text.Trim();
|
//BillNew.omodel.HRemark = this.txtFNote.Text.Trim();
|
//BillNew.omodel.HAddress = this.txtFFetchAdd.Text.Trim();
|
//BillNew.HExRate = ClsPub.isDoule(this.txtFItemName.Text.ToString());
|
//明细类赋值
|
BillNew.DetailColl = new List<Model.ClsKf_SellOutBillSub_K3>();
|
|
for (i = 0; i <= grdMain.RowCount - 1; i++)
|
{
|
if (ClsPub.isLong(grdMain.Rows[i].Cells[FItemIDCol].Value) != 0)
|
{
|
Model.ClsKf_SellOutBillSub_K3 oSub = new Model.ClsKf_SellOutBillSub_K3();
|
oSub.HEntryID = i + 1;
|
// //
|
// //验证
|
// if (BLL.ClsCheckGridView.Fun_CheckQty(grdMain, FAuxQtyCol, i) == false)
|
// {
|
// MessageBox.Show("第" + Convert.ToString(i + 1) + "行,数量小于等于0!不允许保存");
|
// return false;
|
// }
|
// if (BLL.ClsCheckGridView.Fun_CheckUnit(grdMain, FUnitIDCol, i) == false)
|
// {
|
// MessageBox.Show("第" + Convert.ToString(i + 1) + "行,计量单位为空!不允许保存");
|
// return false;
|
// }
|
// if (BLL.ClsCheckGridView.Fun_CheckWareHouse(grdMain, FDCStockIDCol, i) == false)
|
// {
|
// MessageBox.Show("第" + Convert.ToString(i + 1) + "行,仓库为空!不允许保存");
|
// return false;
|
// }
|
// //
|
// oSub.HMaterID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[FItemIDCol].Value);
|
// oSub.HUnitID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[FUnitIDCol].Value);
|
// oSub.HSecUnitID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[FSecUnitIDCol].Value);
|
// oSub.HWhID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[FDCStockIDCol].Value);
|
|
// oSub.HSecCoefficient = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[FSecCoefficientCol].Value);
|
// oSub.HQty = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[FQtyCol].Value);
|
// oSub.HQty1 = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[FQty1Col].Value);
|
// oSub.HQtyMust = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[FQtyMustCol].Value);
|
// oSub.HAuxQty = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[FAuxQtyCol].Value);
|
// oSub.HAuxQtyMust = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[FAuxQtyMustCol].Value);
|
// oSub.HSecQty = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[FSecQtyCol].Value);
|
// oSub.HAuxPrice = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[FAuxPriceCol].Value);
|
// oSub.HAuxPlanPrice = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[FAuxPlanPriceCol].Value);
|
// oSub.HAmount = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[FAmountCol].Value);
|
// oSub.HPlanAmount = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[FPlanAmountCol].Value);
|
// oSub.HEntrySupply = 0;
|
// oSub.HBatchNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[FBatchNoCol].Value);
|
// //
|
// oSub.HRemark = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[FNoteCol].Value);
|
// oSub.HSourceInterID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[FSourceInterIDCol].Value);
|
// oSub.HSourceEntryID = DBUtility.ClsPub.isLong(grdMain.Rows[i].Cells[FSourceEntryIDCol].Value);
|
// oSub.HSourceTranType = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[FSourceTranTypeCol].Value);
|
// oSub.HSourceBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[FSourceBillNoCol].Value);
|
// oSub.HOrderInterID = 0;
|
// oSub.HOrderEntryID = 0;
|
// oSub.HOrderBillNo = "";
|
// oSub.HSEOutInterID = 0;
|
// oSub.HSEOutEntryID = 0;
|
// oSub.HSEOutBillNo = "";
|
// //
|
// BillNew.omodel.HSourceTranType = ClsPub.isStrNull(grdMain.Rows[i].Cells[FSourceTranTypeCol].Value);
|
// BillNew.DetailColl.Add(oSub);
|
DataSet Ds;
|
double a = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[FQty1Col].Value);
|
long b = FInterID;
|
long c = i+1;
|
Ds = oCnK3.RunProcReturn("update ICStockBillEntry set FQty1 =" + a.ToString()+" where FInterID='"+b+"' and FEntryID = '"+c+"'", "ICStockBillEntry");
|
}
|
}
|
MessageBox.Show("单据存盘完毕!单据号:" + this.txtFBillNo.Text.Trim(), "提示");
|
return true;
|
//保存完毕后处理
|
//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.txtFBillNo.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_OperStatus();
|
// return true;
|
//}
|
//else
|
//{
|
// MessageBox.Show("保存失败!原因:" + ClsPub.sExeReturnInfo, "提示");
|
// return false;
|
//}
|
}
|
#endregion
|
|
|
#region 窗体处理方法
|
//初始化GRID
|
private void initGrid()
|
{
|
//
|
grdMain.RowCount = 0;
|
|
grdMain.ColumnCount = 35; //总列数
|
DBUtility.Xt_BaseBillFun.initGridFst(grdMain, this.Name);
|
|
//设置 标题
|
grdMain.Columns[FItemIDCol].HeaderText = "物料ID"; //标题列 显示名
|
grdMain.Columns[FItemNumberCol].HeaderText = "物料代码";
|
grdMain.Columns[FItemNameCol].HeaderText = "物料名称";
|
grdMain.Columns[FItemModelCol].HeaderText = "规格型号";
|
grdMain.Columns[FUnitNumberCol].HeaderText = "计量单位代码";
|
grdMain.Columns[FUnitNameCol].HeaderText = "计量单位名称";
|
grdMain.Columns[FSecUnitNumberCol].HeaderText = "辅助计量单位代码";
|
grdMain.Columns[FSecUnitNameCol].HeaderText = "辅助计量单位名称";
|
grdMain.Columns[FSecCoefficientCol].HeaderText = "换算率";
|
grdMain.Columns[FBatchNoCol].HeaderText = "批号";
|
|
grdMain.Columns[FQtyCol].HeaderText = "重量";
|
grdMain.Columns[FQty1Col].HeaderText = "客户称重重量";
|
grdMain.Columns[FQtyMustCol].HeaderText = "基本单位应发数量";
|
grdMain.Columns[FAuxQtyCol].HeaderText = "实发数量";
|
grdMain.Columns[FAuxQtyMustCol].HeaderText = "应发数量";
|
grdMain.Columns[FSecQtyCol].HeaderText = "辅助数量";
|
grdMain.Columns[FAuxPriceCol].HeaderText = "单价";
|
grdMain.Columns[FAuxPlanPriceCol].HeaderText = "计划单价";
|
grdMain.Columns[FAmountCol].HeaderText = "金额";
|
grdMain.Columns[FPlanAmountCol].HeaderText = "计划价金额";
|
|
grdMain.Columns[FDCStockNumberCol].HeaderText = "发货仓库代码";
|
grdMain.Columns[FDCStockNameCol].HeaderText = "发货仓库名称";
|
grdMain.Columns[FDCSPNumberCol].HeaderText = "仓位代码";
|
grdMain.Columns[FDCSPNameCol].HeaderText = "仓位名称";
|
////
|
grdMain.Columns[HSnoCol].HeaderText = "序号";
|
grdMain.Columns[FNoteCol].HeaderText = "备注";
|
grdMain.Columns[FSourceInterIDCol].HeaderText = "源单主内码";
|
grdMain.Columns[FSourceBillNoCol].HeaderText = "源单单号";
|
grdMain.Columns[FSourceEntryIDCol].HeaderText = "源单子内码";
|
grdMain.Columns[FSourceTranTypeCol].HeaderText = "源单类型";
|
|
//格式化
|
//隐藏列
|
grdMain.Columns[HTagCol].Visible = false; //隐藏列
|
grdMain.Columns[FItemIDCol].Visible = false;
|
grdMain.Columns[FUnitIDCol].Visible = false;
|
grdMain.Columns[FSecUnitIDCol].Visible = false;
|
grdMain.Columns[FSecUnitNumberCol].Visible = false;
|
grdMain.Columns[FSecUnitNameCol].Visible = false;
|
grdMain.Columns[FDCStockIDCol].Visible = false;
|
grdMain.Columns[FDCSPIDCol].Visible = false;
|
grdMain.Columns[FAuxQtyCol].Visible = false;
|
grdMain.Columns[FQtyMustCol].Visible = false;
|
grdMain.Columns[FAuxQtyMustCol].Visible = false;
|
grdMain.Columns[FAuxPlanPriceCol].Visible = false;
|
grdMain.Columns[FPlanAmountCol].Visible = false;
|
grdMain.Columns[FSecQtyCol].Visible = false;
|
grdMain.Columns[FSecCoefficientCol].Visible = false;
|
grdMain.Columns[FDCSPNumberCol].Visible = false;
|
grdMain.Columns[FDCSPNameCol].Visible = false;
|
|
//设置可编辑列和合计列
|
string sAllowCol =FQty1Col.ToString();
|
|
|
//设置合计列
|
string sTotalCol = FAmountCol.ToString() +
|
"," + FAuxQtyCol.ToString() +
|
"," + FQtyCol.ToString();
|
//
|
DBUtility.Xt_BaseBillFun.initGridLast(sAllowCol, sTotalCol, oSumGrid);
|
}
|
|
//初始化GRID Sub
|
private void initGrid_Sub()
|
{
|
grdSub.ColumnCount = 15; //总列数
|
DBUtility.Xt_BaseBillFun.initGridFst(grdSub, this.Name + "1");
|
grdSub.ReadOnly = true;
|
//=
|
grdSub.Columns[SecHMaterNumberCol].HeaderText = "物料代码";
|
grdSub.Columns[SecHMaterNameCol].HeaderText = "物料名称";
|
grdSub.Columns[SecHMaterModelCol].HeaderText = "规格型号";
|
grdSub.Columns[SecHBarCodeCol].HeaderText = "条码";
|
grdSub.Columns[SecHQtyCol].HeaderText = "数量";
|
grdSub.Columns[SecHWhNumberCol].HeaderText = "仓库代码";
|
grdSub.Columns[SecHWhNameCol].HeaderText = "仓库名称";
|
////固定赋值=====================================================
|
grdSub.Columns[SecHSnoCol].HeaderText = "序号";
|
grdSub.Columns[SecHSourceInterIDCol].HeaderText = "源单主内码";
|
grdSub.Columns[SecHSourceBillNoCol].HeaderText = "源单单号";
|
grdSub.Columns[SecHSourceEntryIDCol].HeaderText = "源单子内码";
|
grdSub.Columns[SecHSourceBillTypeCol].HeaderText = "源单类型";
|
//=============================================================================
|
//格式化
|
////隐藏列
|
grdSub.Columns[SecHTagCol].Visible = false;
|
grdSub.Columns[SecHMaterIDCol].Visible = false;
|
grdSub.Columns[SecHWhIDCol].Visible = false;
|
//隐藏源单信息
|
grdSub.Columns[SecHSourceInterIDCol].Visible = false;
|
grdSub.Columns[SecHSourceEntryIDCol].Visible = false;
|
grdSub.Columns[SecHSourceBillNoCol].Visible = false;
|
grdSub.Columns[SecHSourceBillTypeCol].Visible = false;
|
//设置可编辑列
|
string sAllowCol = "";
|
//设置合计列
|
string sTotalCol = SecHQtyCol.ToString();
|
//格式化网格
|
DBUtility.Xt_BaseBillFun.initGridLast(sAllowCol, sTotalCol, oSumGrid_Sub);
|
}
|
|
//公式重算
|
private void RowCount(int sRow, int sTag)
|
{
|
if (sTag == 0)
|
{
|
//金额列=数量*单价
|
double sMoney = 0;
|
sMoney = ClsPub.isDoule(grdMain.Rows[sRow].Cells[FAuxQtyCol].Value) * ClsPub.isDoule(grdMain.Rows[sRow].Cells[FAuxPriceCol].Value);
|
grdMain.Rows[sRow].Cells[FAmountCol].Value = sMoney.ToString();
|
}
|
else
|
{
|
//单价列=金额/数量
|
double sMoney = 0;
|
}
|
}
|
|
|
//核对选择的内容
|
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;
|
//}
|
//判断选中列
|
if (Col == FItemNumberCol) //物料代码列
|
{
|
//ClsK3_MaterialHlp oMate = new ClsK3_MaterialHlp();
|
//if (oMate.GetInfoByID(ClsPub.isLong(grdMain.Rows[Row].Cells[FItemIDCol].Value)))
|
//{
|
// grdMain.Rows[Row].Cells[FItemIDCol].Value= oMate.HItemID.ToString();
|
// grdMain.Rows[Row].Cells[FItemNumberCol].Value= oMate.HNumber;
|
// grdMain.Rows[Row].Cells[FItemNameCol].Value= oMate.HName;
|
// grdMain.Rows[Row].Cells[FItemModelCol].Value = oMate.HModel;
|
//}
|
//else
|
//{
|
// grdMain.Rows[Row].Cells[FItemIDCol].Value= "";
|
// grdMain.Rows[Row].Cells[FItemNumberCol].Value= "";
|
// grdMain.Rows[Row].Cells[FItemNameCol].Value= "";
|
// grdMain.Rows[Row].Cells[FItemModelCol].Value = "";
|
// return false;
|
//}
|
}
|
else if (Col == FUnitIDCol) //单位ID列
|
{
|
//ClsGy_UnitHlp oUn = new ClsGy_UnitHlp();
|
//if (oUn.GetInfoByID(ClsPub.isLong(grdMain.Rows[Row].Cells[FUnitIDCol])))
|
//{
|
// grdMain.Rows[Row].Cells[FUnitIDCol].Value= oUn.HItemID.ToString();
|
// grdMain.Rows[Row].Cells[FUnitNameCol].Value= oUn.HName;
|
//}
|
//else
|
//{
|
// grdMain.Rows[Row].Cells[FUnitIDCol].Value= "";
|
// grdMain.Rows[Row].Cells[FUnitNameCol].Value= "";
|
// return false;
|
//}
|
}
|
else //其他列
|
{
|
}
|
//
|
lblCaption.Text = lblCaption.Text + "1";
|
//
|
grdMain.Rows[Row].Cells[HTagCol].Value = "*";
|
oSumGrid.EditStatus = false;
|
return true;
|
}
|
//是否是空行
|
private bool IsNullRow(int Row)
|
{
|
if (ClsPub.isLong(grdMain.Rows[Row].Cells[FItemIDCol].Value) == 0)
|
{
|
return true;
|
}
|
return false;
|
}
|
//'判断网格行的录入是否正确
|
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)
|
{
|
DAL.ClsK3_Material_View oMater = new DAL.ClsK3_Material_View();
|
DAL.ClsK3_Unit_View oUnit = new DAL.ClsK3_Unit_View();
|
DAL.ClsK3_Warehouse_View oWh = new DAL.ClsK3_Warehouse_View();
|
//ClsK3_BatchNoHlp oBatch = new ClsK3_BatchNoHlp();
|
if (!grdStatus)
|
{
|
return;
|
}
|
//if (oSumGrid.FindAllowEditCol(sCol))
|
//{
|
oSumGrid.EditStatus = true;
|
//}
|
//else
|
//{
|
// return;
|
//}
|
switch (sKeyCode)
|
{
|
case 118: //F7
|
{
|
switch (sCol)
|
{
|
|
case FItemNumberCol:
|
BLL.ClsBaseSelect_K3.SetGridByMater_K3(grdMain, sRow, FItemIDCol, FItemNumberCol, FItemNameCol, FItemModelCol, FUnitIDCol, FUnitNumberCol, FUnitNameCol);
|
oEdit.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[sRow].Cells[FItemNumberCol].Value);
|
break;
|
//
|
case FUnitNumberCol:
|
BLL.ClsBaseSelect_K3.SetGridByUnit_K3(grdMain, sRow, FUnitIDCol, FUnitNumberCol, FUnitNameCol);
|
oEdit.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[sRow].Cells[FUnitNumberCol].Value);
|
break;
|
//
|
case FSecUnitNumberCol:
|
BLL.ClsBaseSelect_K3.SetGridByUnit_K3(grdMain, sRow, FSecUnitIDCol, FSecUnitNumberCol, FSecUnitNameCol);
|
oEdit.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[sRow].Cells[FSecUnitNumberCol].Value);
|
break;
|
//
|
case FDCStockNumberCol:
|
BLL.ClsBaseSelect_K3.SetGridByWareHouse_K3(grdMain, sRow, FDCStockIDCol, FDCStockNumberCol, FDCStockNameCol);
|
oEdit.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[sRow].Cells[FDCStockNumberCol].Value);
|
break;
|
//
|
case FDCSPNumberCol:
|
oWh.WherePart = "";
|
if (oWh.RefreshView())
|
{
|
grdMain.Rows[sRow].Cells[FDCSPIDCol].Value = oWh.oModel.HItemID.ToString();
|
grdMain.Rows[sRow].Cells[FDCSPNumberCol].Value = oWh.oModel.HNumber;
|
grdMain.Rows[sRow].Cells[FDCSPNameCol].Value = oWh.oModel.HName;
|
oEdit.Text = oWh.oModel.HNumber;
|
}
|
else
|
{
|
grdMain.Rows[sRow].Cells[FDCSPIDCol].Value = 0;
|
grdMain.Rows[sRow].Cells[FDCSPNumberCol].Value = "";
|
grdMain.Rows[sRow].Cells[FDCSPNameCol].Value = "";
|
oEdit.Text = "";
|
}
|
break;
|
default:
|
break;
|
}
|
break;
|
}
|
|
case 117: //F6
|
{
|
switch (sCol)
|
{
|
|
|
default:
|
break;
|
}
|
break;
|
}
|
default:
|
break;
|
}
|
}
|
|
//选原单
|
//private void cmdSourceBillNo_Click(object sender, EventArgs e)
|
//{
|
// if (cmbSourceBillType.Text.Trim() == "工序派工单")
|
// {
|
// Cls_S_Sc_ProcessSendWork oSc_ProcessSendWork = new Cls_S_Sc_ProcessSendWork();
|
// if (oSc_ProcessSendWork.Refresh()) //选择原单
|
// {
|
// FillSelectData(oSc_ProcessSendWork.oBillSelectColl);
|
// }
|
// }
|
// else
|
// {
|
|
// }
|
//}
|
//
|
private void FillSelectData(List<DBUtility.BillSelect> oList)
|
{
|
DataSet Ds;
|
SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
|
oSumGrid.Changelock = true;
|
initGrid();
|
initGrid_Sub();
|
int i = -1;
|
foreach (DBUtility.BillSelect oSelectRow in oList)
|
{
|
i = i + 1;
|
//生产任务单
|
if (oSelectRow.BillType == "3003")
|
{
|
grdMain.Rows.Add();
|
grdMain.Rows[i].Cells[HTagCol].Value = "*";
|
//得到信息
|
Ds = oCn.RunProcReturn("select * from h_v_Sec_ServiceSendWorkBillList where hmainid=" + oSelectRow.BillMainID + " and hsubid=" + oSelectRow.BillSubID + " and isnull(领用行关闭,'')=''", "h_v_Sec_ServiceSendWorkBillList");
|
//写入信息
|
Sub_WriteInForm(Ds.Tables[0], i);
|
}
|
//
|
|
}
|
//
|
oSumGrid.Changelock = false;
|
oSumGrid.Total();
|
//grdMain.Redraw = VSFlex7.RedrawSettings.flexRDBuffered;
|
}
|
//根据TABLE写入界面
|
private void Sub_WriteInForm(DataTable oTable, int i)
|
{
|
////加载表头
|
this.txtFSupplyID.Tag = oTable.Rows[0]["HCusID"].ToString();
|
this.txtFSupplyID.Text = oTable.Rows[0]["客户名称"].ToString();
|
this.txtFDeptID.Tag = oTable.Rows[0]["HDeptID"].ToString();
|
this.txtFDeptID.Text = oTable.Rows[0]["部门"].ToString();
|
this.txtFSManagerID.Tag = oTable.Rows[0]["HEmpID"].ToString();
|
this.txtFSManagerID.Text = oTable.Rows[0]["服务人员"].ToString();
|
//this.txtFFManagerID.Tag = oTable.Rows[0]["FFManagerID"].ToString();
|
//this.txtFFManagerID.Text = oTable.Rows[0]["发料员名称"].ToString();
|
this.txtFDCStockID.Tag = oTable.Rows[0]["HWHID"].ToString();
|
this.txtFDCStockID.Text = oTable.Rows[0]["仓库名称"].ToString();
|
//this.txtFExplanation.Text = oTable.Rows[0]["领料用途"].ToString();
|
this.txtFNote.Text = oTable.Rows[0]["表头备注"].ToString();
|
////加载表体
|
grdMain.Rows[i].Cells[HTagCol].Value = "*";
|
//grdMain.Rows[i].Cells[HQtyCol].Value= ClsPub.isDoule(oTable.Rows[0]["数量"].ToString(), 2);
|
grdMain.Rows[i].Cells[FItemIDCol].Value = oTable.Rows[0]["HMaterID1"].ToString();
|
grdMain.Rows[i].Cells[FItemNumberCol].Value = oTable.Rows[0]["物料代码"].ToString();
|
grdMain.Rows[i].Cells[FItemNameCol].Value = oTable.Rows[0]["物料名称"].ToString();
|
grdMain.Rows[i].Cells[FItemModelCol].Value = oTable.Rows[0]["规格型号"].ToString();
|
grdMain.Rows[i].Cells[FUnitIDCol].Value = oTable.Rows[0]["HUnitID1"].ToString();
|
grdMain.Rows[i].Cells[FUnitNumberCol].Value = oTable.Rows[0]["计量单位代码"].ToString();
|
grdMain.Rows[i].Cells[FUnitNameCol].Value = oTable.Rows[0]["计量单位"].ToString();
|
grdMain.Rows[i].Cells[FBatchNoCol].Value = oTable.Rows[0]["批号"].ToString();
|
grdMain.Rows[i].Cells[FAuxQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["数量"].ToString()) - ClsPub.isDoule(oTable.Rows[0]["领用关联数量"].ToString());
|
grdMain.Rows[i].Cells[FAuxPriceCol].Value = oTable.Rows[0]["单价"].ToString();
|
grdMain.Rows[i].Cells[FAmountCol].Value = oTable.Rows[0]["金额"].ToString();
|
grdMain.Rows[i].Cells[FDCStockIDCol].Value = oTable.Rows[0]["HWHID"].ToString();
|
grdMain.Rows[i].Cells[FDCStockNumberCol].Value = oTable.Rows[0]["仓库代码"].ToString();
|
grdMain.Rows[i].Cells[FDCStockNameCol].Value = oTable.Rows[0]["仓库名称"].ToString();
|
grdMain.Rows[i].Cells[FNoteCol].Value = oTable.Rows[0]["备注"].ToString();
|
//
|
//grdMain.Rows[i].Cells[FRelationQtyCol].Value = oTable.Rows[0]["领用关联数量"].ToString();
|
//
|
grdMain.Rows[i].Cells[FSourceInterIDCol].Value = oTable.Rows[0]["hmainid"].ToString();
|
grdMain.Rows[i].Cells[FSourceEntryIDCol].Value = oTable.Rows[0]["hsubid"].ToString();
|
grdMain.Rows[i].Cells[FSourceTranTypeCol].Value = oTable.Rows[0]["hbilltype"].ToString();
|
grdMain.Rows[i].Cells[FSourceBillNoCol].Value = oTable.Rows[0]["单据号"].ToString();
|
//---------------判断有没有批号
|
//ClsCN oCn = new ClsCN();
|
//DataSet Ds3;
|
//Ds3 = oCn.RunProcReturn("exec h_p_k3_fqty " + ClsPub.isLong(oTable.Rows[0]["HMaterID1"]) + "", "h_p_k3_fqty");
|
//if (Ds3.Tables[0].Rows.Count != 0)
|
//{
|
// if (ClsPub.isInt(Ds3.Tables[0].Rows[0]["fbatchmanager"]) == 0)
|
// {
|
// grdMain.Rows[i].Cells[FBatchNoCol].ReadOnly = true;
|
// }
|
//}
|
//------------------
|
}
|
#endregion
|
|
|
private void grdMain_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
|
{
|
//if (!grdStatus)
|
//{
|
// e.Cancel = true;
|
//}
|
//if (oSumGrid.FindAllowEditCol(grdMain.CurrentCell.ColumnIndex) == false)
|
//{
|
// e.Cancel = true;
|
//}
|
//else
|
//{
|
// //
|
//}
|
if(e.ColumnIndex != FQty1Col)
|
{
|
e.Cancel = true;
|
}
|
|
}
|
|
private void grdMain_CellEndEdit(object sender, DataGridViewCellEventArgs e)
|
{
|
oSumGrid.SetGridsum();
|
oSumGrid.Total();
|
RowCount(e.RowIndex, 0);
|
//
|
if (this.EditingControl != null)
|
{
|
EditingControl.KeyDown -= new KeyEventHandler(this.EditingControl_KeyDown);
|
this.EditingControl = null;
|
}
|
}
|
|
private void grdMain_CellLeave(object sender, DataGridViewCellEventArgs e)
|
{
|
//
|
if (!grdStatus)
|
{
|
return;
|
}
|
oSumGrid.SetGridsum();
|
oSumGrid.Total();
|
//
|
//if (oSumGrid.Changelock)
|
// return;
|
//if(oSumGrid.EditStatus)
|
//{
|
if (!CheckGridRow(oSumGrid.OldCell.Row))
|
return;
|
//}
|
}
|
|
private void grdMain_Scroll(object sender, ScrollEventArgs e)
|
{
|
//oSumGrid.SetGridsum();
|
//oSumGrid.Total();
|
oSumGrid.DisplayCurRow();
|
}
|
|
private void grdMain_RowHeadersWidthChanged(object sender, EventArgs e)
|
{
|
oSumGrid.SetGridsum();
|
oSumGrid.Total();
|
}
|
|
private void grdMain_KeyDown(object sender, KeyEventArgs e)
|
{
|
//Sub_GridKey(e.KeyValue, grdMain.CurrentRow.Index, grdMain.CurrentCell.ColumnIndex);
|
}
|
|
DataGridViewTextBoxEditingControl EditingControl;
|
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_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e)
|
{
|
oSumGrid.SetGridsum();
|
|
}
|
|
private void cmdSourceBillNo_Click(object sender, EventArgs e)
|
{
|
//if (cmbSourceBillType.Text.Trim() == "服务派工单")
|
//{
|
// Cls_S_Sec_ServiceSendWorkBill oServiceSendWorkBill = new Cls_S_Sec_ServiceSendWorkBill();
|
// if (oServiceSendWorkBill.Refresh1()) //选择原单
|
// {
|
// FillSelectData(oServiceSendWorkBill.oBillSelectColl);
|
// }
|
//}
|
}
|
|
private void yl_Click(object sender, EventArgs e)
|
{
|
Sub_SetReport();
|
Report.PrintPreview(true);
|
}
|
|
private void dy_Click(object sender, EventArgs e)
|
{
|
Sub_SetReport();
|
Report.Print(true);
|
}
|
//打印设置
|
GridppReport Report;
|
//设置打印模版路径
|
private void Sub_SetReport()
|
{
|
Report = new GridppReport();
|
Report.LoadFromFile(ClsPub.AppPath + @"\服务配件领用单.grf"); //here .
|
Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord);
|
Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable);
|
}
|
//填入单据表头信息
|
private void ReportBeforePostRecord()//your report?kao
|
{
|
try
|
{
|
Report.FieldByName("领料人").AsString = txtFSManagerID.Text;
|
Report.FieldByName("日期").AsString = dtpFDate.Value.ToShortDateString();
|
Report.FieldByName("HBillNo").AsString = txtFBillNo.Text;
|
Report.FieldByName("HMaker").AsString = txtFMaker.Text;
|
Report.FieldByName("发料人").AsString = txtFFManagerID.Text;
|
}
|
catch (Exception e)
|
{
|
MessageBox.Show("打印失败!表头:" + e.Message);
|
}
|
}
|
//填入单据明细信息
|
private void ReportFetchRecordByDataTable()
|
{
|
//try
|
//{
|
// Utility.FillRecordToReport(Report, grdMain, grdPrint, 0);
|
//}
|
//catch (Exception e)
|
//{
|
// MessageBox.Show("打印失败!表体:" + e.Message);
|
//}
|
}
|
|
|
private void file_Click(object sender, EventArgs e)
|
{
|
FileList();
|
}
|
|
//附件列表
|
private void FileList()
|
{
|
//Xt_File oFile = new Xt_File();
|
//oFile.HBillType = ModName;
|
//oFile.HBillNo = this.txtFBillNo.Text;
|
//oFile.ShowDialog();
|
}
|
|
private void tm_Click(object sender, EventArgs e)
|
{
|
DAL.ClsGy_BarCodeEdit_Ctl oGy_BarCodeEdit_Ctl = new DAL.ClsGy_BarCodeEdit_Ctl();
|
DataSet ds;
|
if (DBUtility.ClsPub.isLong(txtFDCStockID.Tag) == 0)
|
{
|
MessageBox.Show("请选择仓库!");
|
return;
|
}
|
if (grdMain.CurrentRow == null)
|
{
|
//MessageBox.Show("!");
|
//return;
|
}
|
Gy_BarCodeEdit oBarCodeEdit = new Gy_BarCodeEdit();
|
oBarCodeEdit.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
|
oBarCodeEdit.HInterID = 0;
|
oBarCodeEdit.HEntryID = 1;
|
oBarCodeEdit.HBillType = txtFBillNo.Text.Trim();
|
oBarCodeEdit.HWhID = DBUtility.ClsPub.isLong(txtFDCStockID.Tag);
|
oBarCodeEdit.ShowDialog();
|
//返回
|
ds = oGy_BarCodeEdit_Ctl.SetGridViewByBillNo(txtFBillNo.Text.Trim());
|
//
|
if (ds == null)
|
{
|
return;
|
}
|
if (ds.Tables[0].Rows.Count == 0)
|
{
|
return;
|
}
|
//设置网格
|
Sub_ShowBarCode(ds);
|
}
|
|
|
private void cmdFEmpID_Click(object sender, EventArgs e)
|
{
|
BLL.ClsBaseSelect_K3.SetTextByEmp_K3(txtFEmpID);
|
}
|
|
private void txtFEmpID_TextChanged(object sender, EventArgs e)
|
{
|
BLL.ClsPub_BLL.Sub_ClearText(txtFEmpID);
|
}
|
|
private void cmdFDeptID_Click(object sender, EventArgs e)
|
{
|
BLL.ClsBaseSelect_K3.SetTextByDept_K3(txtFDeptID, false);
|
}
|
|
private void txtFDeptID_TextChanged(object sender, EventArgs e)
|
{
|
BLL.ClsPub_BLL.Sub_ClearText(txtFDeptID);
|
}
|
|
private void cmdFSupplyID_Click(object sender, EventArgs e)
|
{
|
BLL.ClsBaseSelect_K3.SetTextByCus_K3(txtFSupplyID);
|
}
|
|
private void txtFSupplyID_TextChanged(object sender, EventArgs e)
|
{
|
BLL.ClsPub_BLL.Sub_ClearText(txtFSupplyID);
|
}
|
|
private void cmdFDCStockID_Click(object sender, EventArgs e)
|
{
|
DAL.ClsK3_Warehouse_View oWh = new DAL.ClsK3_Warehouse_View();
|
if (oWh.RefreshView())
|
{
|
this.txtFDCStockID.Text = oWh.oModel.HName;
|
this.txtFDCStockID.Tag = oWh.oModel.HItemID.ToString();
|
FDCStockNumber = oWh.oModel.HNumber;
|
//带出明细仓库
|
for (int r = 0; r < grdMain.Rows.Count; r++)
|
{
|
if (ClsPub.isLong(grdMain.Rows[r].Cells[FItemIDCol].Value) != 0)
|
{
|
grdMain.Rows[r].Cells[FDCStockIDCol].Value = oWh.oModel.HItemID.ToString();
|
grdMain.Rows[r].Cells[FDCStockNumberCol].Value = oWh.oModel.HNumber;
|
grdMain.Rows[r].Cells[FDCStockNameCol].Value = oWh.oModel.HName;
|
}
|
}
|
}
|
else
|
{
|
this.txtFDCStockID.Text = "";
|
FDCStockNumber = "";
|
}
|
}
|
|
private void txtFDCStockID_TextChanged(object sender, EventArgs e)
|
{
|
BLL.ClsPub_BLL.Sub_ClearText(txtFDCStockID);
|
}
|
|
private void cmbFSManagerID_Click(object sender, EventArgs e)
|
{
|
BLL.ClsBaseSelect_K3.SetTextByEmp_K3(txtFSManagerID);
|
}
|
|
private void txtFSManagerID_TextChanged(object sender, EventArgs e)
|
{
|
BLL.ClsPub_BLL.Sub_ClearText(txtFSManagerID);
|
}
|
|
private void cmbFFManagerID_Click(object sender, EventArgs e)
|
{
|
BLL.ClsBaseSelect_K3.SetTextByEmp_K3(txtFFManagerID);
|
}
|
|
private void txtFFManagerID_TextChanged(object sender, EventArgs e)
|
{
|
BLL.ClsPub_BLL.Sub_ClearText(txtFFManagerID);
|
}
|
|
private void cmdFManagerID_Click(object sender, EventArgs e)
|
{
|
BLL.ClsBaseSelect_K3.SetTextByEmp_K3(txtFManagerID);
|
}
|
|
private void txtFManagerID_TextChanged(object sender, EventArgs e)
|
{
|
BLL.ClsPub_BLL.Sub_ClearText(txtFManagerID);
|
}
|
|
|
#region 回车 选择基础资料功能
|
|
|
//表头基础资料 按键时间
|
|
private void txtFEmpID_KeyDown(object sender, KeyEventArgs e)
|
{
|
if (e.KeyCode == Keys.Enter)
|
{
|
//获取控件位置
|
int x = 0; int y = 0;
|
BLL.ClsPub_BLL.SetXY(this, P1, gbUp, txtFEmpID, ref x, ref y);
|
//选择基础
|
BLL.ClsBaseDownSelect_K3.SetTextByEmployee_K3(txtFEmpID, x, y);
|
}
|
}
|
|
private void txtFDeptID_KeyDown(object sender, KeyEventArgs e)
|
{
|
if (e.KeyCode == Keys.Enter)
|
{
|
//获取控件位置
|
int x = 0; int y = 0;
|
BLL.ClsPub_BLL.SetXY(this, P1, gbUp, txtFDeptID, ref x, ref y);
|
//选择基础
|
BLL.ClsBaseDownSelect_K3.SetTextByDept_K3(txtFDeptID, x, y);
|
}
|
}
|
|
private void txtFSupplyID_KeyDown(object sender, KeyEventArgs e)
|
{
|
if (e.KeyCode == Keys.Enter)
|
{
|
//获取控件位置
|
int x = 0; int y = 0;
|
BLL.ClsPub_BLL.SetXY(this, P1, gbUp, txtFSupplyID, ref x, ref y);
|
//选择基础
|
BLL.ClsBaseDownSelect_K3.SetTextByCustomer_K3(txtFSupplyID, x, y);
|
}
|
}
|
|
private void txtFDCStockID_KeyDown(object sender, KeyEventArgs e)
|
{
|
if (e.KeyCode == Keys.Enter)
|
{
|
//获取控件位置
|
int x = 0; int y = 0;
|
BLL.ClsPub_BLL.SetXY(this, P1, gbUp, txtFDCStockID, ref x, ref y);
|
//选择基础
|
BLL.ClsBaseDownSelect_K3.SetTextByWareHouse_K3(txtFDCStockID, x, y);
|
}
|
}
|
|
private void txtFSManagerID_KeyDown(object sender, KeyEventArgs e)
|
{
|
if (e.KeyCode == Keys.Enter)
|
{
|
//获取控件位置
|
int x = 0; int y = 0;
|
BLL.ClsPub_BLL.SetXY(this, P1, gbUp, txtFSManagerID, ref x, ref y);
|
//选择基础
|
BLL.ClsBaseDownSelect_K3.SetTextByEmployee_K3(txtFSManagerID, x, y);
|
}
|
}
|
|
private void txtFFManagerID_KeyDown(object sender, KeyEventArgs e)
|
{
|
if (e.KeyCode == Keys.Enter)
|
{
|
//获取控件位置
|
int x = 0; int y = 0;
|
BLL.ClsPub_BLL.SetXY(this, P1, gbUp, txtFFManagerID, ref x, ref y);
|
//选择基础
|
BLL.ClsBaseDownSelect_K3.SetTextByEmployee_K3(txtFFManagerID, x, y);
|
}
|
}
|
|
private void txtFManagerID_KeyDown(object sender, KeyEventArgs e)
|
{
|
if (e.KeyCode == Keys.Enter)
|
{
|
//获取控件位置
|
int x = 0; int y = 0;
|
BLL.ClsPub_BLL.SetXY(this, P1, gbUp, txtFManagerID, ref x, ref y);
|
//选择基础
|
BLL.ClsBaseDownSelect_K3.SetTextByEmployee_K3(txtFManagerID, x, y);
|
}
|
}
|
|
|
//下拉式 选择框 GRID
|
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
|
{
|
DAL.ClsK3_Material_View oMater = new DAL.ClsK3_Material_View();//K3物料
|
DAL.ClsK3_Unit_View oUnit = new DAL.ClsK3_Unit_View();//K3计量单位
|
DAL.ClsK3_Warehouse_View oWh = new DAL.ClsK3_Warehouse_View();//K3仓库
|
DAL.ClsK3_StockPlace_View oSP = new DAL.ClsK3_StockPlace_View();//K3仓位
|
|
bool enterkey;
|
enterkey = false;
|
if (keyData == Keys.Enter) //监听回车事件
|
{
|
if (this.grdMain.IsCurrentCellInEditMode) //如果当前单元格处于编辑模式
|
{
|
enterkey = true; //把是否点击按钮设置为真
|
if (grdMain.CurrentCell.RowIndex == grdMain.Rows.Count - 1)
|
{
|
}
|
else
|
{
|
}
|
if (grdMain.CurrentCell.ColumnIndex != grdMain.CurrentCell.ColumnIndex)
|
{
|
return true;
|
}
|
//获取定位
|
int sh = 40;
|
int ch = 40;
|
for (int i = grdMain.CurrentCell.RowIndex; i > 0; i--)
|
{
|
if (grdMain.Rows[i].Displayed)
|
{
|
sh = sh + grdMain.Rows[i].Height;
|
}
|
}
|
for (int i = grdMain.CurrentCell.ColumnIndex; i > 0; i--)
|
{
|
if (grdMain.Columns[i].Displayed)
|
{
|
ch = ch + grdMain.Columns[i].Width;
|
}
|
}
|
int x = this.Location.X + this.tabControl1.Location.X + ch;
|
int y = this.Location.Y + this.tabControl1.Location.Y + sh + 60;
|
//------------------------------------
|
grdMain.Rows[grdMain.CurrentRow.Index].Cells[grdMain.CurrentCell.ColumnIndex].Value = EditingControl.Text;
|
string sWhere = Pub_Class.ClsPub.isStrNull(grdMain.Rows[grdMain.CurrentRow.Index].Cells[grdMain.CurrentCell.ColumnIndex].Value);
|
|
switch (grdMain.CurrentCell.ColumnIndex)
|
{
|
case FItemNumberCol:
|
BLL.ClsBaseDownSelect_K3.SetGridByMater_K3(grdMain, sWhere, grdMain.CurrentRow.Index, FItemIDCol, x, y);
|
if (DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[FItemIDCol].Value) != 0)
|
{
|
if (oMater.GetInfoByID(DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[FItemIDCol].Value)))
|
{
|
grdMain.Rows[grdMain.CurrentRow.Index].Cells[FItemNumberCol].Value = oMater.omodel.HNumber;
|
grdMain.Rows[grdMain.CurrentRow.Index].Cells[FItemNameCol].Value = oMater.omodel.HName;
|
grdMain.Rows[grdMain.CurrentRow.Index].Cells[FItemModelCol].Value = oMater.omodel.HModel;
|
grdMain.Rows[grdMain.CurrentRow.Index].Cells[FUnitIDCol].Value = oMater.omodel.HUnitID.ToString();
|
if (oUnit.GetInfoByID(oMater.omodel.HUnitID))
|
{
|
grdMain.Rows[grdMain.CurrentRow.Index].Cells[FUnitIDCol].Value = oUnit.omodel.HItemID;
|
grdMain.Rows[grdMain.CurrentRow.Index].Cells[FUnitNameCol].Value = oUnit.omodel.HName;
|
grdMain.Rows[grdMain.CurrentRow.Index].Cells[FUnitNumberCol].Value = oUnit.omodel.HNumber;
|
}
|
|
EditingControl.Text = grdMain.Rows[grdMain.CurrentRow.Index].Cells[grdMain.CurrentCell.ColumnIndex].Value.ToString();
|
}
|
}
|
break;
|
//
|
case FSecUnitNumberCol:
|
BLL.ClsBaseDownSelect_K3.SetGridByUnit_K3(grdMain, sWhere, grdMain.CurrentRow.Index, FSecUnitIDCol, x, y);
|
if (DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[FSecUnitIDCol].Value) != 0)
|
{
|
if (oUnit.GetInfoByID(DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[FSecUnitIDCol].Value)))
|
{
|
grdMain.Rows[grdMain.CurrentRow.Index].Cells[FSecUnitNumberCol].Value = oUnit.omodel.HNumber;
|
grdMain.Rows[grdMain.CurrentRow.Index].Cells[FSecUnitNameCol].Value = oUnit.omodel.HName;
|
EditingControl.Text = grdMain.Rows[grdMain.CurrentRow.Index].Cells[grdMain.CurrentCell.ColumnIndex].Value.ToString();
|
}
|
}
|
break;
|
//
|
case FUnitNumberCol:
|
BLL.ClsBaseDownSelect_K3.SetGridByUnit_K3(grdMain, sWhere, grdMain.CurrentRow.Index, FUnitIDCol, x, y);
|
if (DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[FUnitIDCol].Value) != 0)
|
{
|
if (oUnit.GetInfoByID(DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[FUnitIDCol].Value)))
|
{
|
grdMain.Rows[grdMain.CurrentRow.Index].Cells[FUnitNumberCol].Value = oUnit.omodel.HNumber;
|
grdMain.Rows[grdMain.CurrentRow.Index].Cells[FUnitNameCol].Value = oUnit.omodel.HName;
|
EditingControl.Text = grdMain.Rows[grdMain.CurrentRow.Index].Cells[grdMain.CurrentCell.ColumnIndex].Value.ToString();
|
}
|
}
|
break;
|
//
|
case FDCStockNumberCol:
|
BLL.ClsBaseDownSelect_K3.SetGridByWareHouse_K3(grdMain, sWhere, grdMain.CurrentRow.Index, FDCStockIDCol, x, y);
|
if (DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[FDCStockIDCol].Value) != 0)
|
{
|
if (oWh.GetInfoByID(DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[FDCStockIDCol].Value)))
|
{
|
grdMain.Rows[grdMain.CurrentRow.Index].Cells[FDCStockNumberCol].Value = oWh.omodel.HNumber;
|
grdMain.Rows[grdMain.CurrentRow.Index].Cells[FDCStockNameCol].Value = oWh.omodel.HName;
|
EditingControl.Text = grdMain.Rows[grdMain.CurrentRow.Index].Cells[grdMain.CurrentCell.ColumnIndex].Value.ToString();
|
}
|
}
|
break;
|
//
|
case FDCSPNumberCol:
|
BLL.ClsBaseDownSelect_K3.SetGridByStockPlace_K3(grdMain, sWhere, grdMain.CurrentRow.Index, FDCSPIDCol, x, y);
|
if (DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[FDCSPIDCol].Value) != 0)
|
{
|
if (oSP.GetInfoByID(DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[FDCSPIDCol].Value)))
|
{
|
grdMain.Rows[grdMain.CurrentRow.Index].Cells[FDCSPNumberCol].Value = oSP.omodel.HNumber;
|
grdMain.Rows[grdMain.CurrentRow.Index].Cells[FDCSPNameCol].Value = oSP.omodel.HName;
|
EditingControl.Text = grdMain.Rows[grdMain.CurrentRow.Index].Cells[grdMain.CurrentCell.ColumnIndex].Value.ToString();
|
}
|
}
|
break;
|
|
default:
|
break;
|
}
|
//SendKeys.Send("{Right}");
|
return true;
|
}
|
}
|
//继续原来base.ProcessCmdKey中的处理
|
return base.ProcessCmdKey(ref msg, keyData);
|
}
|
|
|
#endregion
|
|
|
|
private void tim_Click(object sender, EventArgs e)
|
{
|
Sub_ShowBill_Sub();
|
tabControl1.SelectedIndex = 1;
|
}
|
|
|
//显示单据 条码
|
public void Sub_ShowBill_Sub()
|
{
|
DAL.ClsGy_Warehouse_View oWare = new DAL.ClsGy_Warehouse_View();
|
DAL.ClsGy_Material_View oMater = new DAL.ClsGy_Material_View();
|
//判断是否存在单据
|
if (BillOld.ShowBill_Scheme(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == false)
|
{
|
MessageBox.Show(ClsPub.sExeReturnInfo, "提示");
|
return;
|
}
|
//加载表体
|
initGrid_Sub();
|
int i = 0;
|
foreach (Model.ClsKf_SellOutBillScheme_K3 oSub in BillOld.DetailSubColl)
|
{
|
if (i >= grdSub.RowCount - 1)
|
grdSub.Rows.Add();
|
//单据固定赋值
|
grdSub.Rows[i].Cells[SecHTagCol].Value = "*";
|
grdSub.Rows[i].Cells[SecHSourceBillNoCol].Value = oSub.HSourceBillNo;
|
grdSub.Rows[i].Cells[SecHSourceInterIDCol].Value = oSub.HSourceInterID.ToString();
|
grdSub.Rows[i].Cells[SecHSourceEntryIDCol].Value = oSub.HSourceEntryID.ToString();
|
grdSub.Rows[i].Cells[SecHSourceBillTypeCol].Value = oSub.HSourceBillType.Trim();
|
//======================================================================================
|
//
|
grdSub.Rows[i].Cells[SecHMaterIDCol].Value = oSub.HMaterID.ToString();
|
if (oMater.GetInfoByID(oSub.HMaterID))
|
{
|
grdSub.Rows[i].Cells[SecHMaterNumberCol].Value = oMater.omodel.HNumber;
|
grdSub.Rows[i].Cells[SecHMaterNameCol].Value = oMater.omodel.HName;
|
grdSub.Rows[i].Cells[SecHMaterModelCol].Value = oMater.omodel.HModel;
|
|
}
|
else
|
{
|
grdSub.Rows[i].Cells[SecHMaterNumberCol].Value = "";
|
grdSub.Rows[i].Cells[SecHMaterNameCol].Value = "";
|
grdSub.Rows[i].Cells[SecHMaterModelCol].Value = "";
|
}
|
//
|
grdSub.Rows[i].Cells[SecHWhIDCol].Value = oSub.HWhID.ToString();
|
if (oWare.GetInfoByID(oSub.HWhID))
|
{
|
grdSub.Rows[i].Cells[SecHWhNumberCol].Value = oWare.omodel.HNumber;
|
grdSub.Rows[i].Cells[SecHWhNameCol].Value = oWare.omodel.HName;
|
}
|
else
|
{
|
grdSub.Rows[i].Cells[SecHWhNameCol].Value = "";
|
grdSub.Rows[i].Cells[SecHWhNumberCol].Value = "";
|
}
|
grdSub.Rows[i].Cells[SecHBarCodeCol].Value = oSub.HBarCode;
|
grdSub.Rows[i].Cells[SecHQtyCol].Value = oSub.HQty.ToString();
|
|
i = i + 1;
|
}
|
//GRID允许刷新
|
DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid_Sub);
|
}
|
|
|
|
|
|
}
|
}
|