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_StdWorkTimes_RoutingBill : BLL.Gy_DataInTmp
|
{
|
public Gy_StdWorkTimes_RoutingBill()
|
{
|
InitializeComponent();
|
}
|
public int HItemID =0;
|
public int HMaker = 0; //ÖÆµ¥ÈË
|
public int HMakeDate = 0; //ÖÆµ¥ÈÕÆÚ
|
public int HChecker = 0; //ÉóºËÈË
|
public int HCheckDate = 0; //ÉóºËÈÕÆÚ
|
public int HStopflag = 0;
|
public int HRemark = 0;
|
public int HUSEORGName = 0; //×éÖ¯ID
|
public int HProcName = 0; //
|
public int HMaterName = 0; //ÎïÁÏID
|
public int HProcNum = 0; //
|
public int HMaterNum = 0; //ÎïÁÏID
|
public int HStdWorkTimes = 0; //±ê×¼¹¤Ê±
|
public int HUpperlimit = 0; //ÉÏÏÞ±ÈÀý
|
public int HLowerlimit = 0; //ÏÂÏÞ±ÈÀý
|
|
//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; //ÓÐЧÊý¾Ý£¬¿ªÊ¼ÐÐÊý
|
//
|
//DAL.ClsGy_RoutingBill;
|
public DAL.ClsGy_Process_View oProcHlp = new DAL.ClsGy_Process_View();
|
public DAL.ClsGy_StdWorkTimes_Ctl BillNew = new DAL.ClsGy_StdWorkTimes_Ctl();
|
DAL.ClsIF_Material_View oMaterHlp = new DAL.ClsIF_Material_View();
|
//DAL.ClsGy_WorkType_View oWorkType = new DAL.ClsGy_WorkType_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_StdWorkTimes_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 = "";
|
//
|
HStdWorkTimes = DBUtility.Gy_BaseFun.Fun_GetCol("±ê×¼¹¤Ê±", grdMain);
|
HProcNum = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤Ðò´úÂë", grdMain);
|
HProcName = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤Ðò", grdMain);
|
HMaterNum = DBUtility.Gy_BaseFun.Fun_GetCol("ÎïÁÏ´úÂë", grdMain);
|
HMaterName = DBUtility.Gy_BaseFun.Fun_GetCol("ÎïÁÏ", grdMain);
|
HUpperlimit = DBUtility.Gy_BaseFun.Fun_GetCol("ÉÏÏß±ÈÀý", grdMain);
|
HLowerlimit = DBUtility.Gy_BaseFun.Fun_GetCol("ÏÂÏß±ÈÀý", grdMain);
|
HUSEORGName = DBUtility.Gy_BaseFun.Fun_GetCol("×éÖ¯", grdMain);
|
HMaker = DBUtility.Gy_BaseFun.Fun_GetCol("ÖÆµ¥ÈË", grdMain);
|
HMakeDate = DBUtility.Gy_BaseFun.Fun_GetCol("ÖÆµ¥ÈÕÆÚ", grdMain);
|
|
//ûÓÐÕÒµ½ÁÐ
|
if (HStdWorkTimes == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾±ê×¼¹¤Ê±¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HProcName == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾¹¤Ðò¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HMaterName == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾ÎïÁÏ¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HUpperlimit == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾ÉÏÏß±ÈÀý¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HLowerlimit == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾ÏÂÏß±ÈÀý¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HUSEORGName == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾×éÖ¯¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HMaker == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾ÖƵ¥ÈË¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
if (HMakeDate == -1)
|
{
|
MessageBox.Show("ûÓÐÕÒµ½¡¾ÖƵ¥ÈÕÆÚ¡¿µÄ±êÌâ", "Ìáʾ");
|
return;
|
}
|
//
|
if (!Checkdata())
|
{
|
return;
|
}
|
if (grdMain.Rows.Count > 0)
|
{
|
hnumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells[HMaterNum].Value);
|
BillNew.omodel.HMakeDate = (DateTime.Today.Date).ToString();
|
BillNew.omodel.HUSEORGID = DBUtility.ClsPub.HOrgID;
|
BillNew.omodel.HStopflag = false;
|
BillNew.DetailColl.Clear();
|
}
|
for (int i = 0; i <= grdMain.Rows.Count - 1; i++)
|
{
|
if (DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HProcNum].Value) != "" && DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNum].Value) != "")
|
{
|
//дÈëÀà
|
if (WriteClass(i))
|
{
|
//±£´æ¼Ç¼
|
if (!BillNew.AddNew())
|
{
|
MessageBox.Show("µ¼Èëʧ°Ü!ÔÒò:" + DBUtility.ClsPub.sExeReturnInfo, "Ìáʾ");
|
return;
|
}
|
}
|
}
|
else
|
{
|
MessageBox.Show("¹¤Ðò´úÂë»òÎïÁÏ´úÂëΪ¿Õ!ÔÒò:" + DBUtility.ClsPub.sExeReturnInfo, "Ìáʾ");
|
return;
|
}
|
}
|
MessageBox.Show("µ¼ÈëÍê±Ï");
|
grdMain.DataSource = null;
|
}
|
|
//дÈëÀà ´Ó¿Ø¼þ
|
private bool WriteClass(int row)
|
{
|
string sHNumber = "";
|
string sHNamePoc = "";
|
string HStopflag = "";
|
string HUSEORGID = "";
|
//string sHNumberWorkType = "";
|
string HStdWorkTimes = "";
|
string HUpperlimit=""; //ÉÏÏÞ±ÈÀý
|
string HLowerlimit=""; //ÏÂÏÞ±ÈÀý
|
|
int HMaterNum = DBUtility.Gy_BaseFun.Fun_GetCol("²úÆ·´úÂë", grdMain);
|
int sMaterNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("²úÆ·Ãû³Æ", grdMain);
|
int sModelCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹æ¸ñÐͺÅ", grdMain);
|
int HProcNum = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤Ðò´úÂë", grdMain);
|
int sProcNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("¹¤Ðò", grdMain);
|
int sSourceNumberCol = DBUtility.Gy_BaseFun.Fun_GetCol("×ÊÔ´´úÂë", grdMain);
|
int sSourceNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("Éú²ú×ÊÔ´", grdMain);
|
int sPriceCol = DBUtility.Gy_BaseFun.Fun_GetCol("µ¥¼Û", grdMain);
|
//long HItemID = 0;
|
//
|
sHNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HMaterNum].Value);
|
sHNamePoc = DBUtility.ClsPub.isStrNull(grdMain.Rows[row].Cells[HProcNum].Value);
|
//
|
//
|
HStopflag = DBUtility.ClsPub.isBool(grdMain.Rows[row].Cells[HStopflag].Value).ToString();
|
HUSEORGID = DBUtility.ClsPub.HOrgID.ToString();
|
HStdWorkTimes = DBUtility.ClsPub.isSingle(grdMain.Rows[row].Cells[HStdWorkTimes].Value).ToString();
|
HUpperlimit = DBUtility.ClsPub.isSingle(grdMain.Rows[row].Cells[HUpperlimit].Value).ToString();
|
HLowerlimit = DBUtility.ClsPub.isSingle(grdMain.Rows[row].Cells[HLowerlimit].Value).ToString();
|
|
//ÅжÏÊÇ·ñÔÊÐí ±£´æ
|
if (!DBUtility.ClsPub.AllowNumber(sHNumber))
|
{
|
MessageBox.Show("²úÆ·´úÂëÖв»ÄܳöÏÖÁ¬Ðø¡®.¡¯²¢ÇÒÊ×λĩλ²»ÄÜΪ¡®.¡¯£¡", "Ìáʾ");
|
return false;
|
}
|
if (!DBUtility.ClsPub.AllowNumber(sHNamePoc))
|
{
|
MessageBox.Show("¹¤Ðò´úÂëÖв»ÄܳöÏÖÁ¬Ðø¡®.¡¯²¢ÇÒÊ×λĩλ²»ÄÜΪ¡®.¡¯£¡", "Ìáʾ");
|
return false;
|
}
|
|
Model.ClsGy_StdWorkTimes_Model oSub = new Model.ClsGy_StdWorkTimes_Model();
|
|
//µÃµ½¹¤ÐòÄÚÂë
|
if (oProcHlp.GetInfoByName(sHNamePoc))
|
{
|
oSub.HProcID = oProcHlp.omodel.HItemID;
|
}
|
//µÃµ½ÎïÁÏÄÚÂë
|
if (oMaterHlp.GetInfoByName(sHNumber))
|
{
|
oSub.HMaterID = oMaterHlp.omodel.HItemID;
|
}
|
|
|
//дÈëÐÅÏ¢
|
oSub.HEntryID = j;
|
|
oSub.HMaker = DBUtility.ClsPub.CurUserName;
|
oSub.HMakeDate = (DateTime.Today.Date).ToString();
|
oSub.HStdWorkTimes = double.Parse(HStdWorkTimes);
|
oSub.HRemark = "";
|
oSub.HUpperlimit = double.Parse(HUpperlimit);
|
oSub.HLowerlimit = double.Parse(HLowerlimit);
|
oSub.HStopflag = bool.Parse(HStopflag);
|
|
|
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 = "";
|
|
//
|
sHNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNum].Value);
|
sHNamePoc = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HProcNum].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 (b == true)
|
{
|
Pub_Control.ErrMsgBox oMsgbox = new Pub_Control.ErrMsgBox();
|
oMsgbox.txtHErrMsg.Text = sErrMsg;
|
oMsgbox.ShowDialog();
|
return false;
|
}
|
else
|
{
|
return true;
|
}
|
}
|
|
private void Gy_StdWorkTimes_RoutingBill_Load(object sender, EventArgs e)
|
{
|
|
}
|
}
|
}
|