using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.Text;
|
using System.Windows.Forms;
|
using Pub_Class;
|
using SQLHelper;
|
|
namespace PlanM
|
{
|
public partial class Gy_DataIn_RoutingBill : BLL.Gy_DataInTmp
|
{
|
public Gy_DataIn_RoutingBill()
|
{
|
InitializeComponent();
|
}
|
|
public int HMaterNumberCol = 0; //²úÆ·´úÂë
|
public int HProcNoCol = 0; //¹¤ÐòÐòºÅ
|
public int HProcNameCol = 0; //¹¤Ðò
|
public int HWorkCenterNameCol = 0; //¹¤×÷ÖÐÐÄ
|
public int HWorkQtyCol = 0; //¼Ó¹¤ÊýÁ¿
|
public int HBeginDayQtyCol = 6; //¿ª¹¤¹ÌÌì
|
public int HBeginFixQtyCol = 7; //¿ª¹¤ÓàÁ¿
|
public int HFixPriceCol = 8; //¶¨¶î Сʱ¹¤×Ê
|
public int HProcPriceCol = 9; //¹¤¼Û
|
public int HTechnologyParameterCol = 0; //¹¤ÒÕ²ÎÊý
|
public int HPicNumCol = 0; //ͼֽ±àºÅ
|
public int HProcCheckNoteCol = 0; //±¾¹¤ÐòÈ·ÈϼǼ
|
|
public int HPicNumVerCol = 0; //ͼºÅ°æ±¾
|
public int HPicNumAssembleCol = 0; //×ÜװͼºÅ
|
public int HMaterTextureCol = 0; //²ÄÖÊ
|
public int HProductNumCol = 0; //³ÉÆ·±àºÅ
|
public int HVerNumCol = 0; //°æ±¾
|
public int HMouldNoCol = 0; //Ä£¾ß±àºÅ
|
public int HProcWorkNumCol = 0; //³ÌÐòºÅ
|
public int HPassRateCol = 0; //Á¼ÂÊ
|
//
|
public const int HBeginRow = 2; //ÓÐЧÊý¾Ý£¬¿ªÊ¼ÐÐÊý
|
//
|
public DAL.ClsGy_Process_View oProcHlp = new DAL.ClsGy_Process_View();
|
DAL.ClsGy_WorkCenter_View oCenHlp = new DAL.ClsGy_WorkCenter_View();
|
DAL.ClsIF_Material_View oMater = new DAL.ClsIF_Material_View();
|
DAL.ClsIF_Unit_View oUnit = new DAL.ClsIF_Unit_View();
|
public DAL.ClsGy_RoutingBill BillNew = new DAL.ClsGy_RoutingBill();
|
DAL.ClsIF_Material_View oMaterHlp = new DAL.ClsIF_Material_View();
|
long j = -1;
|
int c = 0;
|
|
public override bool OpenExcelData()
|
{
|
base.sSheetName = txtHSheetName.Text;
|
return base.OpenExcelData();
|
}
|
|
/// <summary>
|
/// ³õʼ»¯½çÃæ
|
/// </summary>
|
public override void initData()
|
{
|
base.initData();
|
base.sSheetName = txtHSheetName.Text;
|
base.ModRightName = "Gy_DataIn_RoutingBill";
|
base.ModRightNameCheck = base.ModRightName + base.ModRightNameCheck;
|
base.ModRightNameClose = base.ModRightName + base.ModRightNameClose;
|
base.ModRightNameDelete = base.ModRightName + base.ModRightNameDelete;
|
base.ModRightNameEdit = base.ModRightName + base.ModRightNameEdit;
|
base.ModRightNameMoney = base.ModRightName + base.ModRightNameMoney;
|
base.ModRightNameQty = base.ModRightName + base.ModRightNameQty;
|
base.ModCaption = "¹¤ÒÕ·Ïßµ¼Èë";
|
this.Text = base.ModCaption;
|
lblCaption.Text = base.ModCaption;
|
//
|
DBUtility.Gy_BaseFun.SetComboxYear(cmbHYear);
|
DBUtility.Gy_BaseFun.SetComboxPeriod(cmbHPeriod);
|
//
|
}
|
//µ¼Èë
|
public override void Sub_DataIn()
|
{
|
try
|
{
|
string hnumber = "";
|
string HBillNo = "";
|
//
|
HMaterNumberCol = DBUtility.Gy_BaseFun.Fun_GetCol("²úÆ·´úÂë", grdMain);
|
HProcNoCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤ÐòÐòºÅ", grdMain);
|
HProcNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤Ðò", grdMain);
|
HWorkCenterNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤×÷ÖÐÐÄ", grdMain);
|
HWorkQtyCol = DBUtility.Gy_BaseFun.Fun_GetCol("¼Ó¹¤ÊýÁ¿", grdMain);
|
HPicNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("ͼֽ±àºÅ", grdMain);
|
HTechnologyParameterCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤ÒÕ²ÎÊý", grdMain);
|
HProcCheckNoteCol = DBUtility.Gy_BaseFun.Fun_GetCol("±¾¹¤ÐòÈ·ÈϼǼ", grdMain);
|
HPicNumVerCol = DBUtility.Gy_BaseFun.Fun_GetCol("ͼºÅ°æ±¾", grdMain);
|
HPicNumAssembleCol = DBUtility.Gy_BaseFun.Fun_GetCol("×ÜװͼºÅ", grdMain);
|
HMaterTextureCol = DBUtility.Gy_BaseFun.Fun_GetCol("²ÄÖÊ", grdMain);
|
HProductNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("³ÉÆ·±àºÅ", grdMain);
|
HVerNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("°æ±¾", grdMain);
|
HMouldNoCol = DBUtility.Gy_BaseFun.Fun_GetCol("Ä£¾ß±àºÅ", grdMain);
|
HProcWorkNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("³ÌÐòºÅ", grdMain);
|
HBeginFixQtyCol = DBUtility.Gy_BaseFun.Fun_GetCol("¿ª¹¤ÓàÁ¿", grdMain);
|
HBeginDayQtyCol = DBUtility.Gy_BaseFun.Fun_GetCol("¿ª¹¤¹ÌÌì", grdMain);
|
HFixPriceCol = DBUtility.Gy_BaseFun.Fun_GetCol("Сʱ¹¤×Ê", grdMain);
|
HProcPriceCol = DBUtility.Gy_BaseFun.Fun_GetCol("µ¥¸ö¹¤¼Û", grdMain);
|
HPassRateCol = DBUtility.Gy_BaseFun.Fun_GetCol("Á¼ÂÊ", grdMain);
|
|
//ûÓÐÕÒµ½ÁÐ
|
if (HMaterNumberCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾²úÆ·´úÂë¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HProcNameCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾¹¤Ðò¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HWorkCenterNameCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾¹¤×÷ÖÐÐÄ¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HWorkQtyCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾¼Ó¹¤ÊýÁ¿¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HBeginFixQtyCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾¿ª¹¤ÓàÁ¿¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HBeginDayQtyCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾¿ª¹¤¹ÌÌì¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HFixPriceCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾Ð¡Ê±¹¤×Ê¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HProcPriceCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾µ¥¸ö¹¤¼Û¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HProcNoCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾¹¤ÐòÐòºÅ¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HTechnologyParameterCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾¹¤ÒÕ²ÎÊý¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HPicNumCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾Í¼Ö½±àºÅ¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HProcCheckNoteCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾±¾¹¤ÐòÈ·ÈϼǼ¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HPicNumVerCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾Í¼ºÅ°æ±¾¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HPicNumAssembleCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾×ÜװͼºÅ¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HMaterTextureCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾²ÄÖÊ¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HProductNumCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾³ÉÆ·±àºÅ¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HVerNumCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾°æ±¾¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HMouldNoCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾Ä£¾ß±àºÅ¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HProcWorkNumCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾³ÌÐòºÅ¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HPassRateCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾Á¼ÂÊ¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
//
|
if (!Checkdata())
|
{
|
return;
|
}
|
if (grdMain.Rows.Count > 0)
|
{
|
hnumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HMaterNumberCol].Value);
|
HBillNo = ClsPub.CreateBillCode(BillNew.BillType, ref ClsPub.sExeReturnInfo, true);
|
BillNew.omodel.HStandard = false;
|
BillNew.omodel.HMainTimeUnit = "Сʱ";
|
BillNew.omodel.HYear = 2011;
|
BillNew.omodel.HPeriod = 1;
|
BillNew.omodel.HBillNo = HBillNo;
|
BillNew.omodel.HDate = DateTime.Today.Date;
|
BillNew.omodel.HPicNumVer = "";
|
BillNew.omodel.HPicNumAssemble = "";
|
BillNew.omodel.HMaterTexture = "";
|
BillNew.omodel.HProductNum = "";
|
BillNew.omodel.HVerNum = "";
|
BillNew.DetailColl.Clear();
|
}
|
for (int i = 0; i <= grdMain.Rows.Count - 1; i++)
|
{
|
string sHNumber = "";
|
if (DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value) != "")
|
{
|
//
|
sHNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value);
|
//ÉóºË´úÂëÊÇ·ñºÏÀí
|
if (!DBUtility.ClsPub.AllowNumber(sHNumber))
|
{
|
MessageBox.Show("ÎïÁÏ´úÂëÖв»ÄܳöÏÖÁ¬Ðø¡®.¡¯²¢ÇÒÊ×λĩλ²»ÄÜΪ¡®.¡¯£¡", "Ìáʾ");
|
return;
|
}
|
|
if (hnumber == DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value))
|
{
|
//µÃµ½ÎïÁÏÄÚÂë
|
if (oMaterHlp.GetInfoByNumber(sHNumber))
|
{
|
if (BillNew.omodel.HMaterID != oMaterHlp.omodel.HItemID)
|
{
|
BillNew.omodel.HMaterID = oMaterHlp.omodel.HItemID;
|
BillNew.omodel.HMaterNumber = oMaterHlp.omodel.HNumber;
|
BillNew.omodel.HUnitID = oMaterHlp.omodel.HUnitID;
|
BillNew.omodel.HUnitNumber = oMaterHlp.omodel.HUnitNumber;
|
}
|
BillNew.omodel.HPicNumVer = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HPicNumVerCol].Value);
|
BillNew.omodel.HPicNumAssemble = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HPicNumAssembleCol].Value);
|
BillNew.omodel.HMaterTexture = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterTextureCol].Value);
|
BillNew.omodel.HProductNum = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HProductNumCol].Value);
|
BillNew.omodel.HVerNum = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HVerNumCol].Value);
|
}
|
else
|
{
|
BillNew.omodel.HMaterID = 0;
|
MessageBox.Show("µÚ" + i.ToString() + "ÐÐ," + sHNumber + "ûÓÐÕÒµ½¶ÔÓ¦µÄÎïÁÏ£¡");
|
return;
|
}
|
j++;
|
//дÈëÀà
|
WriteClass(i);
|
|
}
|
else
|
{
|
DataSet Ds;
|
ClsCN oCn = new ClsCN();
|
bool b = false;
|
// ÅжÏÊÇ·ñ´æÔÚ¹¤ÒÕ·Ïß
|
Ds = oCn.RunProcReturn("Select HMaterID from Gy_RoutingBillMain Where HMaterID=" + BillNew.omodel.HMaterID.ToString(), "Gy_RoutingBillMain");
|
if (checkadd.Checked == true)
|
{
|
//if (Ds.Tables[0].Rows.Count == 0)//×·¼Ó
|
//{
|
//ÐÂÔöǰ ÏÈɾ³ýÔÀ´¹¤ÒÕ
|
BillNew.DeleteByMaterID(BillNew.omodel.HMaterID);
|
b = BillNew.AddBill(ref ClsPub.sExeReturnInfo);
|
if (b == false)
|
{
|
MessageBox.Show("µÚ" + i.ToString() + "ÐÐ,ÎïÁÏ" + BillNew.omodel.HMaterNumber + "ÐÂÔö¹¤ÒÕ·Ïßʧ°Ü£¡´úÂë293ÐÐÖУ¬ÔÒò£º" + ClsPub.sExeReturnInfo);
|
return;
|
}
|
c++;
|
BillNew.CheckBill(BillNew.omodel.HInterID, ref ClsPub.sExeReturnInfo);
|
//}
|
//else
|
//{
|
|
//}
|
}
|
else
|
{
|
BillNew.DeleteByMaterID(BillNew.omodel.HMaterID);
|
b = BillNew.AddBill(ref ClsPub.sExeReturnInfo);
|
if (b == false)
|
{
|
MessageBox.Show("µÚ" + i.ToString() + "ÐÐ,ÎïÁÏ" + sHNumber + "ÐÂÔö¹¤ÒÕ·Ïßʧ°Ü£¡´úÂë310ÐÐÖÐ");
|
return;
|
}
|
c++;
|
BillNew.CheckBill(BillNew.omodel.HInterID, ref ClsPub.sExeReturnInfo);
|
}
|
|
|
BillNew.DetailColl.Clear();
|
hnumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value);
|
sHNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value);
|
|
//ÉóºË´úÂëÊÇ·ñºÏÀí
|
if (!DBUtility.ClsPub.AllowNumber(sHNumber))
|
{
|
MessageBox.Show("ÎïÁÏ´úÂëÖв»ÄܳöÏÖÁ¬Ðø¡®.¡¯²¢ÇÒÊ×λĩλ²»ÄÜΪ¡®.¡¯£¡", "Ìáʾ");
|
return;
|
}
|
//µÃµ½ÎïÁÏÄÚÂë
|
if (oMaterHlp.GetInfoByNumber(sHNumber))
|
{
|
if (BillNew.omodel.HMaterID != oMaterHlp.omodel.HItemID)
|
{
|
BillNew.omodel.HMaterID = oMaterHlp.omodel.HItemID;
|
BillNew.omodel.HMaterNumber = oMaterHlp.omodel.HNumber;
|
BillNew.omodel.HUnitID = oMaterHlp.omodel.HUnitID;
|
BillNew.omodel.HUnitNumber = oMaterHlp.omodel.HUnitNumber;
|
}
|
|
}
|
else
|
{
|
BillNew.omodel.HMaterID = 0;
|
MessageBox.Show("µÚ" + i.ToString() + "ÐÐ," + sHNumber + "ûÓÐÕÒµ½¶ÔÓ¦µÄÎïÁÏ£¡");
|
return;
|
}
|
j = 0;
|
HBillNo = ClsPub.CreateBillCode(BillNew.BillType, ref ClsPub.sExeReturnInfo, true);
|
BillNew.omodel.HBillNo = HBillNo;
|
//дÈëÀà
|
WriteClass(i);
|
}
|
}
|
else
|
{
|
MessageBox.Show("µÚ" + i.ToString() + "ÐÐ,ûÓÐÕÒµ½¶ÔÓ¦µÄÎïÁÏ£¡");
|
return;
|
}
|
}
|
//×îºóÒ»¸öÎïÁÏ´¦Àí
|
if (BillNew.DetailColl.Count > 0)
|
{
|
DataSet Ds;
|
ClsCN oCn = new ClsCN();
|
bool b = false;
|
//Ds = oCn.RunProcReturn("Select HMaterID from Gy_RoutingBillMain Where HMaterID=" + BillNew.omodel.HMaterID.ToString(), "Gy_RoutingBillMain");
|
//if (Ds.Tables[0].Rows.Count == 0)
|
//{
|
BillNew.DeleteByMaterID(BillNew.omodel.HMaterID);
|
b = BillNew.AddBill(ref ClsPub.sExeReturnInfo);
|
if (b == false) return;
|
c++;
|
BillNew.CheckBill(BillNew.omodel.HInterID, ref ClsPub.sExeReturnInfo);
|
//}
|
MessageBox.Show("µ¼ÈëÍê±Ï:¹²" + c.ToString() + "¸ö¹¤ÒÕ·Ïß");
|
grdMain.DataSource = null;
|
}
|
c = 0;
|
}
|
catch (Exception e)
|
{
|
MessageBox.Show("µ¼Èëʧ°Ü!ÔÒò:" + e.Message, "Ìáʾ");
|
}
|
}
|
|
//дÈëÀà ´Ó¿Ø¼þ
|
private bool WriteClass(int row)
|
{
|
string sHNumber = "";
|
string sHNamePoc = "";
|
string sHNumberCen = "";
|
Single sWorkQty = 0;
|
Single sBeginDayQty = 0;
|
Single sBeginFixQty = 0;
|
Single sHPassRate = 0;
|
//long HItemID = 0;
|
//
|
sHNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HMaterNumberCol].Value);
|
sHNumberCen = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HWorkCenterNameCol].Value);
|
sHNamePoc = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HProcNameCol].Value);
|
|
sWorkQty = DBUtility.ClsPub.isSingle(grdMain.Rows[row].Cells[HWorkQtyCol].Value);
|
sBeginDayQty = DBUtility.ClsPub.isSingle(grdMain.Rows[row].Cells[HBeginDayQtyCol].Value);
|
sBeginFixQty = DBUtility.ClsPub.isSingle(grdMain.Rows[row].Cells[HBeginFixQtyCol].Value);
|
sHPassRate = DBUtility.ClsPub.isSingle(grdMain.Rows[row].Cells[HPassRateCol].Value);
|
//ÅжÏÊÇ·ñÔÊÐí ±£´æ
|
|
Model.ClsGy_RoutingBillSub oSub = new Model.ClsGy_RoutingBillSub();
|
|
//µÃµ½¹¤ÐòÄÚÂë
|
if (oProcHlp.GetInfoByName(sHNamePoc))
|
{
|
oSub.HProcID = oProcHlp.omodel.HItemID;
|
}
|
|
//µÃµ½³µ¼äÄÚÂë
|
if (oCenHlp.GetInfoByName(sHNumberCen))
|
{
|
oSub.HCenterID = oCenHlp.omodel.HItemID;
|
}
|
//дÈëÐÅÏ¢
|
oSub.HEntryID = j;
|
|
oSub.HProcNo = DBUtility.ClsPub.isInt(grdMain.Rows[row].Cells[HProcNoCol].Value);
|
oSub.HUnitTime = 1;
|
oSub.HWorkQty = sWorkQty;
|
oSub.HPassRate = sHPassRate;
|
oSub.HRemark = "";
|
oSub.HTimeUnit = "Сʱ";
|
oSub.HReadyTime = 0;
|
oSub.HQueueTime = 0;
|
oSub.HMoveTime = 0;
|
//
|
|
//
|
oSub.HCloseMan = "";
|
oSub.HCloseType = false;
|
oSub.HSourceInterID = 0;
|
oSub.HSourceEntryID = 0;
|
oSub.HSourceBillType = "";
|
oSub.HSourceBillNo = "";
|
oSub.HRelationQty = 0;
|
oSub.HRelationMoney = 0;
|
|
oSub.HFixPrice = DBUtility.ClsPub.isSingle(grdMain.Rows[row].Cells[HFixPriceCol].Value);
|
oSub.HProcPrice = DBUtility.ClsPub.isSingle(grdMain.Rows[row].Cells[HProcPriceCol].Value);
|
oSub.HBadPrice = 0;
|
oSub.HWasterPrice = 0;
|
oSub.HStdFlag = false;
|
oSub.HBeginDayQty = sBeginDayQty;
|
oSub.HBeginFixQty = sBeginFixQty;
|
oSub.HTechnologyParameter = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HTechnologyParameterCol].Value);
|
oSub.HPicNum = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HPicNumCol].Value);
|
oSub.HProcCheckNote = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HProcCheckNoteCol].Value);
|
oSub.HMouldNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HMouldNoCol].Value);
|
oSub.HProcWorkNum = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HProcWorkNumCol].Value);
|
BillNew.DetailColl.Add(oSub);
|
return true;
|
}
|
|
//¼ì²éÎïÁÏ
|
private bool Checkdata()
|
{
|
bool b = false;
|
string sErrMsg = "";
|
string sMsg = "";
|
for (int i = 0; i <= grdMain.Rows.Count - 1; i++)
|
{
|
string sHNumber = "";
|
string sHNamePoc = "";
|
string sHNumberCen = "";
|
Single sWorkQty = 0;
|
Single sHPassRate = 0;
|
|
//
|
sHNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value);
|
sHNumberCen = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HWorkCenterNameCol].Value);
|
sHNamePoc = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HProcNameCol].Value);
|
sWorkQty = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HWorkQtyCol].Value);
|
sHPassRate = DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HPassRateCol].Value);
|
if (sHNumber != "")
|
{
|
//
|
int index = i + 1;
|
//¼Ó¹¤ÊýÁ¿²»ÄÜСÓÚµÈÓÚÁã
|
if (sWorkQty <= 0)
|
{
|
MessageBox.Show("µÚ" + index + "Ðмӹ¤ÊýÁ¿²»ÄÜСÓÚµÈÓÚÁ㣡", "Ìáʾ");
|
return false;
|
}
|
//Á¼Âʲ»ÄÜСÓÚµÈÓÚÁã
|
if (sHPassRate <= 0)
|
{
|
MessageBox.Show("µÚ" + index + "ÐÐÁ¼Âʲ»ÄÜСÓÚµÈÓÚÁ㣡", "Ìáʾ");
|
return false;
|
}
|
//ÉóºË´úÂëÊÇ·ñºÏÀí
|
if (!DBUtility.ClsPub.AllowNumber(sHNumber))
|
{
|
MessageBox.Show("ÎïÁÏ´úÂëÖв»ÄܳöÏÖÁ¬Ðø¡®.¡¯²¢ÇÒÊ×λĩλ²»ÄÜΪ¡®.¡¯£¡", "Ìáʾ");
|
return false;
|
}
|
//µÃµ½ÎïÁÏÄÚÂë
|
int j = i + HBeginRow;
|
if (!oMaterHlp.GetInfoByNumber(sHNumber))
|
{
|
sMsg = "[" + sHNumber + "]ÎïÁϲ»´æÔÚ";
|
if (sErrMsg.Contains(sMsg) == false)
|
{
|
sErrMsg = sErrMsg + "[" + sHNumber + "]ÎïÁϲ»´æÔÚ\r\n";
|
}
|
b = true;
|
}
|
//µÃµ½¹¤ÐòÄÚÂë
|
if (!oProcHlp.GetInfoByName(sHNamePoc))
|
{
|
sMsg = "[" + sHNamePoc + "]¹¤Ðò²»´æÔÚ";
|
if (sErrMsg.Contains(sMsg) == false)
|
{
|
sErrMsg = sErrMsg + "[" + sHNamePoc + "]¹¤Ðò²»´æÔÚ\r\n";
|
}
|
b = true;
|
}
|
|
//µÃµ½¹¤×÷ÖÐÐÄÄÚÂë
|
if (!oCenHlp.GetInfoByName(sHNumberCen))
|
{
|
sMsg = "[" + sHNumberCen + "]¹¤×÷ÖÐÐIJ»´æÔÚ";
|
if (sErrMsg.Contains(sMsg) == false)
|
{
|
sErrMsg = sErrMsg + "[" + sHNumberCen + "]¹¤×÷ÖÐÐIJ»´æÔÚ\r\n";
|
}
|
b = true;
|
|
}
|
|
}
|
}
|
if (b == true)
|
{
|
Pub_Control.ErrMsgBox oMsgbox = new Pub_Control.ErrMsgBox();
|
oMsgbox.txtHErrMsg.Text = sErrMsg;
|
oMsgbox.ShowDialog();
|
return false;
|
}
|
else
|
{
|
return true;
|
}
|
|
}
|
|
}
|
}
|