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_New :BLL.Gy_DataInTmp
|
{
|
public Gy_DataIn_RoutingBill_New()
|
{
|
InitializeComponent();
|
}
|
|
public int HMaterNumberCol = 0; //²úÆ·´úÂë
|
public int HWorkTypeNameCol = 0; //¹¤ÖÖ
|
public int HProcNameCol = 0; //¹¤Ðò
|
public int HWorkCenterNameCol = 0; //¹¤×÷ÖÐÐÄ
|
public int HProcMulNameCol = 0; //¹¤¶Î
|
public int HWorkCenterName_SCol = 0; //²úÏß
|
public int HWorkQtyCol = 0; //²úÄÜ
|
public int HSubStdEmpQtyCol = 0; //ÈËÊý
|
public int HWorkQty_SCol = 0; //²úÏß²úÄÜ
|
public int HSubStdEmpQty_SCol = 0; //²úÏßÈËÊý
|
|
public int HMouldNoCol = 0; //Ä£¾ß±àºÅ
|
public int HChangeMouldCol = 0; //»»Ä£Ê±¼ä
|
public int HPackStdCol = 0; //ÖÜתÏä±ê×¼
|
public int HPackCol = 0; //ÖÜתÏä
|
public int HPutAreaCol = 0; //ÔÝ·ÅÇø
|
//
|
public int HMyWorkDaysCol = 0; //Éú²úÖÜÆÚ
|
public int HMyFixWorkDaysCol = 0; //¹Ì¶¨Éú²úÌìÊý
|
|
public int HBeginDayQtyCol = 6; //¿ª¹¤¹ÌÌì
|
public int HBeginFixQtyCol = 7; //¿ª¹¤ÓàÁ¿
|
public int HFixPriceCol = 8; //¶¨¶î Сʱ¹¤×Ê
|
public int HProcPriceCol = 9; //¹¤¼Û
|
public int HProcTypeCol = 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_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();
|
//DAL.ClsGy_WorkType_View oWorkType = new DAL.ClsGy_WorkType_View();
|
DAL.ClsGy_ProcMul_View oProcMul = new DAL.ClsGy_ProcMul_View();
|
DAL.ClsGy_LineCenter_View oLineCen = new DAL.ClsGy_LineCenter_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()
|
{
|
string hnumber = "";
|
string HBillNo = "";
|
//
|
HMaterNumberCol = DBUtility.Gy_BaseFun.Fun_GetCol("²úÆ·´úÂë", grdMain);
|
//HWorkTypeNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤ÖÖ", grdMain);
|
HProcNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤Ðò", grdMain);
|
HWorkCenterNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤×÷ÖÐÐÄ", grdMain);
|
HProcMulNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤¶Î", grdMain);
|
HWorkCenterName_SCol = DBUtility.Gy_BaseFun.Fun_GetCol("²úÏß", grdMain);
|
HWorkQtyCol = DBUtility.Gy_BaseFun.Fun_GetCol("²úÄÜ", grdMain);
|
HSubStdEmpQtyCol = DBUtility.Gy_BaseFun.Fun_GetCol("ÈËÊý", grdMain);
|
HWorkQty_SCol = DBUtility.Gy_BaseFun.Fun_GetCol("²úÏß²úÄÜ", grdMain);
|
HSubStdEmpQty_SCol = DBUtility.Gy_BaseFun.Fun_GetCol("²úÏßÈËÊý", grdMain);
|
HMouldNoCol = DBUtility.Gy_BaseFun.Fun_GetCol("Ä£¾ß±àºÅ", grdMain);
|
HChangeMouldCol = DBUtility.Gy_BaseFun.Fun_GetCol("»»Ä£Ê±¼ä", grdMain);
|
HPackStdCol = DBUtility.Gy_BaseFun.Fun_GetCol("ÖÜתÏä±ê×¼", grdMain);
|
HPackCol = DBUtility.Gy_BaseFun.Fun_GetCol("ÖÜתÏä", grdMain);
|
HPutAreaCol = DBUtility.Gy_BaseFun.Fun_GetCol("ÔÝ·ÅÇø", grdMain);
|
HMyWorkDaysCol = DBUtility.Gy_BaseFun.Fun_GetCol("Éú²úÖÜÆÚ", grdMain);
|
HMyFixWorkDaysCol = 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);
|
HProcTypeCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤ÐòÀàÐÍ", grdMain);
|
|
//ûÓÐÕÒµ½ÁÐ
|
if (HMaterNumberCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾²úÆ·´úÂë¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HProcNameCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾¹¤Ðò¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
//if (HWorkTypeNameCol == -1)
|
//{
|
// MessageBox.Show("ûÓÐÕÒµ½¡¾¹¤ÖÖ¡¿µÄ±êÌâ", "Ìáʾ");
|
// return;
|
//}
|
if (HWorkCenterNameCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾¹¤×÷ÖÐÐÄ¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HProcMulNameCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾¹¤¶Î¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HWorkCenterName_SCol == -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 (HWorkQty_SCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾²úÏß²úÄÜ¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HSubStdEmpQty_SCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾²úÏßÈËÊý¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HMouldNoCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾Ä£¾ß±àºÅ¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HChangeMouldCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾»»Ä£Ê±¼ä¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HPackStdCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾ÖÜתÏä±ê×¼¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HPackCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾ÖÜתÏä¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HPutAreaCol == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾ÔÝ·ÅÇø¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HProcTypeCol == -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.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;
|
}
|
|
}
|
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) 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) 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;
|
BillNew.omodel.HUseMan = DBUtility.ClsPub.CurUserName;
|
//дÈëÀà
|
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;
|
}
|
|
//дÈëÀà ´Ó¿Ø¼þ
|
private bool WriteClass(int row)
|
{
|
string sHNumber = "";
|
string sHNamePoc = "";
|
string sHNumberCen = "";
|
string sHNumberProcMul = "";
|
//string sHNumberWorkType = "";
|
string sHNumberLineCen = "";
|
|
|
Single sWorkQty = 0;
|
Single sBeginDayQty = 0;
|
Single sBeginFixQty = 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);
|
sHNumberProcMul = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HProcMulNameCol].Value);
|
//sHNumberWorkType = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HWorkTypeNameCol].Value);
|
sHNumberLineCen = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HWorkCenterName_SCol].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);
|
//ÅжÏÊÇ·ñÔÊÐí ±£´æ
|
|
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;
|
}
|
//µÃµ½²úÏßÄÚÂë
|
if (oLineCen.GetInfoByName(sHNumberLineCen))
|
{
|
oSub.HCenterID_S = oLineCen.omodel.HItemID;
|
}
|
else
|
{
|
oSub.HCenterID_S = 0;
|
}
|
//µÃµ½¹¤¶ÎÄÚÂë
|
if (oProcMul.GetInfoByName(sHNumberProcMul))
|
{
|
oSub.HProcID_S = oProcMul.omodel.HItemID;
|
}
|
else
|
{
|
oSub.HProcID_S = 0;
|
}
|
//дÈëÐÅÏ¢
|
oSub.HEntryID = j;
|
|
oSub.HProcNo = 0;
|
oSub.HUnitTime = 1;
|
oSub.HWorkQty = sWorkQty;
|
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.HMouldNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HMouldNoCol].Value);
|
oSub.HPackStd = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HPackStdCol].Value);
|
oSub.HPack = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HPackCol].Value);
|
oSub.HPutArea = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HPutAreaCol].Value);
|
oSub.HWorkQty_S = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[HWorkQty_SCol].Value);
|
oSub.HSubStdEmpQty_S = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[HSubStdEmpQty_SCol].Value);
|
oSub.HChangeMould = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[HChangeMouldCol].Value);
|
oSub.HMyWorkDays = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[HMyWorkDaysCol].Value);
|
oSub.HMyFixWorkDays = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[HMyFixWorkDaysCol].Value);
|
oSub.HSubStdEmpQty = DBUtility.ClsPub.isDoule(grdMain.Rows[row].Cells[HSubStdEmpQtyCol].Value);
|
|
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.HProcType = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HProcTypeCol].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 = "";
|
//string sHNumberWorkType = "";
|
string sHNumberProcMul = "";
|
string sHNumberLineCen = "";
|
|
//
|
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);
|
//sHNumberWorkType = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HWorkTypeNameCol].Value);
|
sHNumberProcMul = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HProcMulNameCol].Value);
|
sHNumberLineCen = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HWorkCenterName_SCol].Value);
|
if (sHNumber != "" )
|
{
|
//
|
//ÉóºË´úÂëÊÇ·ñºÏÀí
|
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 (!oWorkType.GetInfoByName(sHNumberWorkType))
|
//{
|
// sMsg = "[" + sHNumberWorkType + "]¹¤ÖÖ²»´æÔÚ";
|
// if (sErrMsg.Contains(sMsg) == false)
|
// {
|
// sErrMsg = sErrMsg + "[" + sHNumberWorkType + "]¹¤ÖÖ²»´æÔÚ\r\n";
|
// }
|
// b = true;
|
//}
|
//µÃµ½¹¤¶ÎÄÚÂë
|
if (sHNumberProcMul.Trim() != "")
|
{
|
if (!oProcMul.GetInfoByName(sHNumberProcMul))
|
{
|
sMsg = "[" + sHNumberProcMul + "]¹¤¶Î²»´æÔÚ";
|
if (sErrMsg.Contains(sMsg) == false)
|
{
|
sErrMsg = sErrMsg + "[" + sHNumberProcMul + "]¹¤¶Î²»´æÔÚ\r\n";
|
}
|
b = true;
|
}
|
}
|
//µÃµ½²úÏßÄÚÂë
|
if (sHNumberLineCen.Trim() != "")
|
{
|
if (!oLineCen.GetInfoByName(sHNumberLineCen))
|
{
|
sMsg = "[" + sHNumberLineCen + "]²úÏß²»´æÔÚ";
|
if (sErrMsg.Contains(sMsg) == false)
|
{
|
sErrMsg = sErrMsg + "[" + sHNumberLineCen + "]²úÏß²»´æÔÚ\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;
|
}
|
}
|
|
|
|
|
|
|
|
|
|
|
}
|
}
|