using System;
|
using System.Collections.Generic;
|
using System.Text;
|
using System.Data;
|
using System.Data.SqlClient;
|
using System.Windows.Forms;
|
|
namespace BLL
|
{
|
public class Sc_ICMOSortBillFun
|
{
|
//ÖØÐ·ÖÅä²ð·Öµ¥ºÅ
|
public static void RefreshCfBillNo(AxVSFlex7.AxVSFlexGrid grdMain, Int16 HICMoBillNoCol, Int16 HSplitNOCol)
|
{
|
List<string> sBillNo = new List<string>();
|
if (grdMain.Rows == grdMain.FixedRows)
|
{
|
return;
|
}
|
//ÈÎÎñµ¥ ´æÈë
|
sBillNo.Clear();
|
for (int i = grdMain.FixedRows; i < grdMain.Rows; i++)
|
{
|
if (!sBillNo.Contains(DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(i, HICMoBillNoCol))))//ÅжÏÊÇ·ñÖØ¸´
|
{
|
sBillNo.Add(DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(i, HICMoBillNoCol)));
|
}
|
}
|
//¸øÈÎÎñµ¥²ð·Ö
|
int n = 0;
|
foreach (string s in sBillNo)
|
{
|
n = 0;
|
for (int r = grdMain.FixedRows; r < grdMain.Rows; r++)
|
{
|
if (DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(r, HICMoBillNoCol)) == s.Trim())
|
{
|
n++;
|
grdMain.set_TextMatrix(r, HSplitNOCol, DBUtility.ClsPub.AscToChr(DBUtility.ClsPub.ChrToAsc("A") + (n - 1)));
|
}
|
}
|
}
|
}
|
//ÊÇ·ñÑ¡ÔñÁË µ¥Ôª¸ñ
|
public static bool IsSelectCell(AxVSFlex7.AxVSFlexGrid grdMain ,int iRow, int iCol)
|
{
|
int iSelR = 0;
|
int iSelC = 0;
|
iSelR = grdMain.RowSel;
|
iSelC = grdMain.ColSel;
|
if (iRow >= grdMain.Row && iRow <= iSelR && iCol >= grdMain.Col && iCol <= iSelC)
|
{
|
return true;
|
}
|
if (iRow >= iSelR && iRow <= grdMain.Row && iCol >= iSelC && iCol <= grdMain.Col)
|
{
|
return true;
|
}
|
return false;
|
}
|
|
//ÁÐÊÇ·ñÔÊÐí±à¼
|
public static bool IsAllowEdit(AxVSFlex7.AxVSFlexGrid grdMain, int FixCols, int iRow, int iCol)
|
{
|
if (iRow < grdMain.FixedRows || iRow > (grdMain.Rows - 1))
|
{
|
return false;
|
}
|
if (iCol < grdMain.FixedCols || iCol > (grdMain.Cols - 1))
|
{
|
return false;
|
}
|
if (iCol >= FixCols && iCol <= (grdMain.Cols - 1))
|
{
|
return true;
|
}
|
return false;
|
}
|
|
//¼ÓÔØ µ±ÔÂÈÕÆÚ
|
public static void LoadDateCol(AxVSFlex7.AxVSFlexGrid grdMain, int FixCols, int iDates)
|
{
|
string bDate, eDate, dDate;
|
grdMain.Cols = FixCols;
|
bDate = DBUtility.ClsPub.GetServerDate(0);
|
eDate = (DBUtility.ClsPub.isDate(bDate).AddDays(iDates)).ToShortDateString();
|
dDate = bDate;
|
//
|
grdMain.Cols = grdMain.Cols + 1;
|
dDate = (DBUtility.ClsPub.isDate(bDate).AddDays(0)).ToShortDateString();
|
//
|
grdMain.set_TextMatrix(0, grdMain.Cols - 1, Convert.ToDateTime(dDate).ToString("MM-dd"));
|
grdMain.set_TextMatrix(1, grdMain.Cols - 1, Convert.ToDateTime(dDate).ToString("yyyy-MM-dd"));
|
grdMain.set_ColData(grdMain.Cols - 1, Convert.ToDateTime(dDate).ToString("yyyy-MM-dd"));
|
//
|
for (int i = 1; i < iDates; i++)
|
{
|
if (dDate.CompareTo(eDate) > 0)
|
return;
|
grdMain.Cols = grdMain.Cols + 1;
|
grdMain.set_ColWidth(grdMain.Cols - 1, 800);
|
dDate = (DBUtility.ClsPub.isDate(bDate).AddDays(i)).ToShortDateString();
|
grdMain.set_TextMatrix(0, grdMain.Cols - 1, Convert.ToDateTime(dDate).ToString("MM-dd"));
|
grdMain.set_TextMatrix(1, grdMain.Cols - 1, Convert.ToDateTime(dDate).ToString("yyyy-MM-dd"));
|
}
|
grdMain.set_FixedAlignment(-1, VSFlex7.AlignmentSettings.flexAlignCenterCenter);
|
}
|
|
//¼ÓÔØ µ±ÔÂÈÕÆÚ
|
public static void LoadDateCol(DataGridView grdMain, int FixCols, int iDates)
|
{
|
string bDate, eDate, dDate;
|
//grdMain.Cols = FixCols;
|
bDate = DBUtility.ClsPub.GetServerDate(0);
|
eDate = (DBUtility.ClsPub.isDate(bDate).AddDays(iDates)).ToShortDateString();
|
dDate = bDate;
|
//
|
grdMain.ColumnCount = grdMain.ColumnCount + 1;
|
dDate = (DBUtility.ClsPub.isDate(bDate).AddDays(0)).ToShortDateString();
|
grdMain.Columns[grdMain.ColumnCount - 1].Width =40;
|
//
|
grdMain.Columns[grdMain.ColumnCount - 1].HeaderText = Convert.ToDateTime(dDate).ToString("yyyy-MM-dd");
|
//grdMain.set_ColData(grdMain.Cols - 1, Convert.ToDateTime(dDate).ToString("yyyy-MM-dd"));
|
//
|
for (int i = 1; i < iDates; i++)
|
{
|
if (dDate.CompareTo(eDate) > 0)
|
return;
|
grdMain.ColumnCount = grdMain.ColumnCount + 1;
|
grdMain.Columns[grdMain.ColumnCount - 1].Width =40;
|
dDate = (DBUtility.ClsPub.isDate(bDate).AddDays(i)).ToShortDateString();
|
grdMain.Columns[grdMain.ColumnCount - 1].HeaderText = Convert.ToDateTime(dDate).ToString("yyyy-MM-dd");
|
//grdMain.set_TextMatrix(1, grdMain.Cols - 1, Convert.ToDateTime(dDate).ToString("yyyy-MM-dd"));
|
}
|
|
}
|
//³õʼ»¯
|
public static void initGrid(AxVSFlex7.AxVSFlexGrid grdMain, int FixCols)
|
{
|
grdMain.Rows = 2;
|
grdMain.FixedRows = 2;
|
grdMain.Cols = FixCols;
|
grdMain.AllowBigSelection = true;
|
grdMain.AllowSelection = true;
|
grdMain.RowHeightMin = 300;
|
grdMain.FixedCols = 0;
|
grdMain.Editable = VSFlex7.EditableSettings.flexEDKbdMouse;
|
grdMain.SelectionMode = VSFlex7.SelModeSettings.flexSelectionFree;
|
grdMain.FocusRect = VSFlex7.FocusRectSettings.flexFocusSolid;
|
grdMain.AllowUserResizing = VSFlex7.AllowUserResizeSettings.flexResizeColumns;
|
grdMain.AllowUserFreezing = VSFlex7.AllowUserFreezeSettings.flexFreezeColumns;
|
grdMain.set_FixedAlignment(-1, VSFlex7.AlignmentSettings.flexAlignCenterCenter);
|
grdMain.ScrollTrack = true;
|
grdMain.set_RowHeight(0, 650);
|
grdMain.set_RowHidden(1, true);
|
grdMain.WordWrap = true;
|
}
|
//¼ì²é²ð·ÖÊýÁ¿µÄºÏÀíÐÔ
|
public static bool CheckJHS(AxVSFlex7.AxVSFlexGrid grdMain, int HICMoBillNoCol, int HSplitPlanQtyCol, int HPlanQtyCol, int iRow)
|
{
|
string sBillNo;
|
long iCount = 0;
|
if (IsCf(grdMain, HICMoBillNoCol, iRow))
|
{
|
sBillNo = DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(iRow, HICMoBillNoCol));
|
for (int i = grdMain.FixedRows; i < grdMain.Rows; i++)
|
{
|
if (sBillNo.Trim() == DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(i, HICMoBillNoCol)))
|
{
|
iCount = iCount + DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HSplitPlanQtyCol));
|
}
|
}
|
if (iCount > DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(iRow, HPlanQtyCol)))
|
{
|
return false;
|
}
|
}
|
return true;
|
}
|
|
//ÊÇ·ñÑ¡Ôñ×ÊÔ´
|
public static bool IsSelectZY(AxVSFlex7.AxVSFlexGrid grdMain, int HSourceIDCol)
|
{
|
for (int i = grdMain.FixedRows; i < grdMain.Rows; i++)
|
{
|
if (DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(i, HSourceIDCol)) == "")
|
{
|
return false;
|
}
|
}
|
return true;
|
}
|
|
//ÊÇ·ñÊǺÏÀíÐÐ
|
public static bool AllowRow(AxVSFlex7.AxVSFlexGrid grdMain)
|
{
|
if (grdMain.Row >= grdMain.FixedRows && grdMain.Row <= grdMain.Rows - 1)
|
{
|
return true;
|
}
|
else
|
{
|
return false;
|
}
|
}
|
//ÅÅÐò
|
public static bool SortData(AxVSFlex7.AxVSFlexGrid grdMain, int HSplitNOCol, int HICMoBillNoCol, int HPlanEndDateCol, int HPlanBeginDateCol, int HYXCol, int HSourceIDCol)
|
{
|
if (grdMain.Rows == grdMain.FixedRows)
|
{
|
return false;
|
}
|
grdMain.set_ColSort(HSplitNOCol, VSFlex7.SortSettings.flexSortStringAscending);
|
grdMain.Select(grdMain.FixedRows, HSplitNOCol, grdMain.Rows - 1, HICMoBillNoCol);
|
grdMain.Sort = VSFlex7.SortSettings.flexSortUseColSort;
|
//
|
grdMain.set_ColSort(HPlanEndDateCol, VSFlex7.SortSettings.flexSortStringAscending);
|
grdMain.Select(grdMain.FixedRows, HPlanEndDateCol, grdMain.Rows - 1, HPlanEndDateCol);
|
grdMain.Sort = VSFlex7.SortSettings.flexSortUseColSort;
|
//
|
grdMain.set_ColSort(HPlanBeginDateCol, VSFlex7.SortSettings.flexSortStringAscending);
|
grdMain.Select(grdMain.FixedRows, HPlanBeginDateCol, grdMain.Rows - 1, HPlanBeginDateCol);
|
grdMain.Sort = VSFlex7.SortSettings.flexSortUseColSort;
|
//
|
grdMain.set_ColSort(HYXCol, VSFlex7.SortSettings.flexSortNumericAscending);
|
grdMain.Select(grdMain.FixedRows, HYXCol, grdMain.Rows - 1, HYXCol);
|
grdMain.Sort = VSFlex7.SortSettings.flexSortUseColSort;
|
//
|
grdMain.set_ColSort(HSourceIDCol, VSFlex7.SortSettings.flexSortStringAscending);
|
grdMain.Select(grdMain.FixedRows, HSourceIDCol, grdMain.Rows - 1, HSourceIDCol);
|
grdMain.Sort = VSFlex7.SortSettings.flexSortUseColSort;
|
grdMain.Select(0, 0);
|
//
|
return true;
|
}
|
|
//»Ïß
|
public static void GraphLine(AxVSFlex7.AxVSFlexGrid grdMain, int HSourceIDCol)
|
{
|
string stmp = "";
|
int i = 0;
|
int NextRow = 0;
|
for (i = grdMain.FixedRows; i <= grdMain.Rows - grdMain.FixedRows; i++)
|
{
|
grdMain.Select(i, 0, i, grdMain.Cols - 1);
|
grdMain.CellBorder(Convert.ToUInt32(DBUtility.ClsPub.Enum_Color.hx_Blue), 0, 0, 0, 1, 0, 0);
|
}
|
i = 0;
|
stmp = DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(i, HSourceIDCol));
|
if (grdMain.FixedRows == grdMain.Rows)
|
{
|
return;
|
}
|
stmp = DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(grdMain.FixedRows, HSourceIDCol));
|
for (i = grdMain.FixedRows; i < grdMain.Rows; i++)
|
{
|
NextRow = GetNextRow(grdMain,i);
|
if (NextRow == -1)
|
{
|
return;
|
}
|
if (i >= grdMain.FixedRows && i < grdMain.Rows - 1)
|
{
|
if (DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(NextRow, HSourceIDCol)) != stmp)
|
{
|
grdMain.Select(i, 0, i, grdMain.Cols - 1);
|
grdMain.CellBorder(Convert.ToUInt32(DBUtility.ClsPub.Enum_Color.hx_Blue), 0, 0, 0, 2, 0, 0);
|
}
|
else
|
{
|
grdMain.Select(i, 0, i, grdMain.Cols - 1);
|
grdMain.CellBorder(Convert.ToUInt32(DBUtility.ClsPub.Enum_Color.hx_Blue), 0, 0, 0, 0, 0, 0);
|
}
|
stmp = DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(NextRow, HSourceIDCol));
|
}
|
}
|
}
|
|
//µÃµ½ÏÂÒ»¸ö ²»Òþ²ØµÄ ÐÐ
|
public static int GetNextRow(AxVSFlex7.AxVSFlexGrid grdMain,int iRow)
|
{
|
for (int i = iRow + 1; i < grdMain.Rows; i++)
|
{
|
if (grdMain.get_RowHidden(i) == false)
|
{
|
return i;
|
}
|
}
|
return -1;
|
}
|
//Çå¿Õµ±ÈÕ
|
public static void ClearCol(AxVSFlex7.AxVSFlexGrid grdMain,int FixCols, bool bAuto)
|
{
|
int i = 0;
|
int m = 0;
|
if (bAuto == false)
|
{
|
grdMain.Select(grdMain.FixedRows, FixCols, grdMain.Rows - 1, grdMain.Cols - 1);
|
grdMain.Clear(VSFlex7.ClearWhereSettings.flexClearSelection, VSFlex7.ClearWhatSettings.flexClearText);
|
grdMain.set_Cell(VSFlex7.CellPropertySettings.flexcpForeColor, grdMain.FixedRows, FixCols, grdMain.Rows - 1, grdMain.Cols - 1, DBUtility.ClsPub.Enum_Color.hx_Black);
|
grdMain.set_Cell(VSFlex7.CellPropertySettings.flexcpBackColor, grdMain.FixedRows, FixCols, grdMain.Rows - 1, grdMain.Cols - 1, DBUtility.ClsPub.Enum_Color.hx_Write);
|
grdMain.Select(0, 0);
|
}
|
else
|
{
|
for (i = grdMain.FixedRows; i < grdMain.Rows; i++)
|
{
|
for (m = FixCols; m <= grdMain.Cols - 1; m++)
|
{
|
if (DBUtility.ClsPub.GridToColor(grdMain.get_Cell(VSFlex7.CellPropertySettings.flexcpForeColor, i, m, i, m)) != DBUtility.ClsPub.Enum_Color.hx_Red)
|
{
|
grdMain.set_Cell(VSFlex7.CellPropertySettings.flexcpBackColor, i, m, i, m, DBUtility.ClsPub.Enum_Color.hx_Write);
|
grdMain.set_Cell(VSFlex7.CellPropertySettings.flexcpForeColor, i, m, i, m, DBUtility.ClsPub.Enum_Color.hx_Black);
|
grdMain.set_TextMatrix(i, m, "");
|
}
|
}
|
}
|
}
|
}
|
//Çå¿ÕÈÕÆÚÁÐ
|
public static void ClearDateCol(AxVSFlex7.AxVSFlexGrid grdMain,int FixCols, bool bClear)
|
{
|
int i = 0;
|
if (!(grdMain.Col >= FixCols && grdMain.Col <= grdMain.Cols - 1))
|
{
|
return;
|
}
|
if (bClear == true)
|
{
|
for (i = grdMain.FixedRows; i < grdMain.Rows; i++)
|
{
|
grdMain.set_TextMatrix(i, grdMain.Col, "0");
|
grdMain.set_Cell(VSFlex7.CellPropertySettings.flexcpForeColor, i, grdMain.Col, i, grdMain.Col, DBUtility.ClsPub.Enum_Color.hx_Red);
|
}
|
}
|
else
|
{
|
for (i = grdMain.FixedRows; i < grdMain.Rows; i++)
|
{
|
grdMain.set_TextMatrix(i, grdMain.Col, "");
|
grdMain.set_Cell(VSFlex7.CellPropertySettings.flexcpForeColor, i, grdMain.Col, i, grdMain.Col, DBUtility.ClsPub.Enum_Color.hx_Black);
|
}
|
}
|
}
|
|
//ÉèÖÃÊÖ¹¤Ð޸ıê¼Ç
|
public static void Sub_SetHandChangeFlag(AxVSFlex7.AxVSFlexGrid grdMain,int sCol,int sRow)
|
{
|
|
grdMain.set_Cell(VSFlex7.CellPropertySettings.flexcpForeColor, sRow, sCol, sRow, sCol, DBUtility.ClsPub.Enum_Color.hx_Red);
|
|
}
|
|
//Ëø¶¨ÈÕÆÚÁÐ
|
public static void LockDateCol(AxVSFlex7.AxVSFlexGrid grdMain, int FixCols, bool bClear)
|
{
|
int i = 0;
|
if (!(grdMain.Col >= FixCols && grdMain.Col <= grdMain.Cols - 1))
|
{
|
return;
|
}
|
if (grdMain.Row < grdMain.FixedCols || grdMain.RowSel < grdMain.FixedCols)
|
{
|
return;
|
}
|
int BRow = 0;
|
int ERow = 0;
|
if (grdMain.Row < grdMain.RowSel)
|
{
|
BRow = grdMain.Row;
|
ERow = grdMain.RowSel;
|
}
|
else
|
{
|
BRow = grdMain.RowSel;
|
ERow = grdMain.Row;
|
}
|
if (bClear == true)
|
{
|
for (i = BRow; i <= ERow; i++)
|
{
|
grdMain.set_Cell(VSFlex7.CellPropertySettings.flexcpForeColor, i, grdMain.Col, i, grdMain.Col, DBUtility.ClsPub.Enum_Color.hx_Red);
|
}
|
}
|
else
|
{
|
for (i = BRow; i <= ERow; i++)
|
{
|
grdMain.set_Cell(VSFlex7.CellPropertySettings.flexcpForeColor, i, grdMain.Col, i, grdMain.Col, DBUtility.ClsPub.Enum_Color.hx_Black);
|
}
|
}
|
}
|
//ÔÊÐí±à¼
|
public static bool AllowEdit(int FixCols, int sCol, string sAllowCol)
|
{
|
if (sCol < FixCols)
|
{
|
if (sAllowCol.Contains("," + sCol.ToString() + ",") != true)
|
{
|
return true;
|
}
|
}
|
return false;
|
}
|
//¼ì²é×ÊÔ´ºÏÀíÐÔ
|
public static bool CheckSource(AxVSFlex7.AxVSFlexGrid grdMain, int HICMoBillNoCol, int HSourceIDCol,ref int n)
|
{
|
for (int i = grdMain.FixedRows; i <= grdMain.Rows; i++)
|
{
|
for (int j = i + 1; j <= grdMain.Rows - 1; j++)
|
{
|
if (DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(i, HICMoBillNoCol)) == DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(j, HICMoBillNoCol)))
|
{
|
if (DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(i, HSourceIDCol)) == DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(j, HSourceIDCol)))
|
{
|
n = j;
|
return false;
|
}
|
}
|
}
|
}
|
return true;
|
}
|
//µÃµ½µÃµ½±¾¹¤Ðò µ±ÈÕÉϰàʱ¼ä
|
public static double GetWorkNumber(string FDate, long SourceID, SQLHelper.ClsCN oCn)
|
{
|
double lWorkNumber = 0;
|
DataSet oDs;
|
//
|
oDs = oCn.RunProcReturn("exec h_p_Sc_GetSourceWorkTimes '" + FDate + "'," + SourceID.ToString(), "Gy_PlanShifts");
|
if (oDs == null || oDs.Tables[0].Rows.Count == 0)
|
{
|
lWorkNumber = 8;
|
}
|
else
|
{
|
lWorkNumber = DBUtility.ClsPub.isDoule(oDs.Tables[0].Rows[0]["¹¤Ê±"]);
|
}
|
//
|
return lWorkNumber;
|
}
|
//ÅжϲÎÊýÐÐÊÇ·ñ²ð·Ö¹ý
|
public static bool IsCf(AxVSFlex7.AxVSFlexGrid grdMain, int HICMoBillNoCol, int iRow)
|
{
|
string sBillNo = DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(iRow, HICMoBillNoCol));
|
int intCount = 0;
|
int i = 0;
|
for (i = grdMain.FixedRows; i < grdMain.Rows; i++)
|
{
|
if (sBillNo.Trim().ToUpper() == DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(i, HICMoBillNoCol)).Trim().ToUpper())
|
{
|
intCount++;
|
}
|
}
|
if (intCount > 1)
|
{
|
return true;
|
}
|
return false;
|
}
|
//½»»õÆÚ ³¬ÆÚʱ ±äÉ«
|
public static void AddColor(AxVSFlex7.AxVSFlexGrid grdMain, int HPlanEndDateCol, int FixCols)
|
{
|
for (int i = grdMain.FixedRows; i < grdMain.Rows; i++)
|
{
|
grdMain.set_Cell(VSFlex7.CellPropertySettings.flexcpForeColor, i, HPlanEndDateCol, i, HPlanEndDateCol, DBUtility.ClsPub.Enum_Color.hx_Black);
|
for (int m = grdMain.Cols - 1; m >= FixCols; m--)
|
{
|
if (DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(i, m)) != "")
|
{
|
if (DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(1, m)).CompareTo(DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(i, HPlanEndDateCol))) > 0)
|
{
|
grdMain.set_Cell(VSFlex7.CellPropertySettings.flexcpForeColor, i, HPlanEndDateCol, i, HPlanEndDateCol, DBUtility.ClsPub.Enum_Color.hx_Red);
|
}
|
|
}
|
}
|
}
|
}
|
//¼ÓÔØ×Ó±í
|
public static void SetSubGrid(AxVSFlex7.AxVSFlexGrid grdMain, Model.ClsSc_ICMOSortBillMain oModel,ref int c,ref int i, int FixCols)
|
{
|
c = FixCols - 1;
|
foreach (Model.ClsSc_ICMOSortBillSub oSub in oModel.DetailColl)
|
{
|
if (c <= grdMain.Cols - 1)
|
{
|
for (c = c; c < grdMain.Cols; c++)
|
{
|
if (DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(1, c)) == oSub.HDate.ToShortDateString())
|
{
|
grdMain.set_Cell(VSFlex7.CellPropertySettings.flexcpBackColor, i, c, i, c, oSub.HiBackColor);
|
grdMain.set_Cell(VSFlex7.CellPropertySettings.flexcpForeColor, i, c, i, c, oSub.HiForeColor);
|
if (oSub.HQty != 0)
|
{
|
grdMain.set_TextMatrix(i, c, oSub.HQty.ToString());
|
}
|
else
|
{
|
grdMain.set_TextMatrix(i, c, "");
|
}
|
break;
|
}
|
}
|
}
|
}
|
}
|
|
//¼ÓÔØ×Ó±í
|
public static void SetSubGrid(AxVSFlex7.AxVSFlexGrid grdMain, Model.ClsSc_ProcPlanSortBillMain oModel, ref int c, ref int i, int FixCols)
|
{
|
c = FixCols - 1;
|
foreach (Model.ClsSc_ProcPlanSortBillSub oSub in oModel.DetailColl)
|
{
|
if (c <= grdMain.Cols - 1)
|
{
|
for (c = c; c < grdMain.Cols; c++)
|
{
|
if (DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(1, c)) == oSub.HDate.ToShortDateString())
|
{
|
grdMain.set_Cell(VSFlex7.CellPropertySettings.flexcpBackColor, i, c, i, c, oSub.HiBackColor);
|
grdMain.set_Cell(VSFlex7.CellPropertySettings.flexcpForeColor, i, c, i, c, oSub.HiForeColor);
|
if (oSub.HQty != 0)
|
{
|
grdMain.set_TextMatrix(i, c, oSub.HQty.ToString());
|
}
|
else
|
{
|
grdMain.set_TextMatrix(i, c, "");
|
}
|
break;
|
}
|
}
|
}
|
}
|
}
|
|
|
|
//¼ÓÔØ×Ó±í
|
public static void SetSubGrid(DataGridView grdMain, DAL.ClsSc_WorkBillAutoSortBill oMain, ref int c, ref int i, int FixCols)
|
{
|
c = FixCols - 1;
|
foreach (Model.ClsSc_WorkBillAutoSortBillSub oSub in oMain.DetailColl)
|
{
|
if (c <= grdMain.ColumnCount - 1)
|
{
|
for (int m = c; m < grdMain.ColumnCount; m++)
|
{
|
if (DBUtility.ClsPub.isStrNull(grdMain.Columns[m].HeaderText) == oSub.HDate.ToShortDateString())
|
{
|
//grdMain.set_Cell(VSFlex7.CellPropertySettings.flexcpBackColor, i, c, i, c, oSub.HiBackColor);
|
//grdMain.set_Cell(VSFlex7.CellPropertySettings.flexcpForeColor, i, c, i, c, oSub.HiForeColor);
|
if (oSub.HQty != 0)
|
{
|
grdMain.Rows[i].Cells[m].Value = oSub.HQty.ToString();
|
}
|
else
|
{
|
grdMain.Rows[i].Cells[m].Value = "";
|
}
|
break;
|
}
|
}
|
}
|
}
|
}
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////
|
|
//±£´æ×Ó±í
|
public static void SaveGridSub(DataGridView grdMain, int FixCols, DAL.ClsSc_WorkBillAutoSortBill oBill, DateTime sDate,double dWorkQty, ref int i)
|
{
|
for (int c = FixCols; c <= grdMain.ColumnCount - 1; c++)
|
{
|
if (DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[c].Value) != 0)
|
{
|
//×Ó±í¸³Öµ
|
Model.ClsSc_WorkBillAutoSortBillSub oSub = new Model.ClsSc_WorkBillAutoSortBillSub();
|
oSub.HEntryID = c;
|
oSub.HMasterDate = sDate;
|
oSub.HDate = DBUtility.ClsPub.isDate(grdMain.Columns[c].HeaderText);
|
oSub.HQty = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[c].Value);
|
oSub.HTimes = 0;
|
oSub.HUseTimes = oSub.HQty/dWorkQty;
|
oSub.HStatusTag = 0;
|
//oSub.HiForeColor = grdMain.get_Cell(VSFlex7.CellPropertySettings.flexcpForeColor, i, c, i, c).ToString();
|
//oSub.HiBackColor = grdMain.get_Cell(VSFlex7.CellPropertySettings.flexcpBackColor, i, c, i, c).ToString();
|
oSub.HRemark = "";
|
//
|
oBill.DetailColl.Add(oSub);
|
}
|
}
|
}
|
|
//ºÏ²¢ÈÎÎñµ¥
|
public static void HBData(AxVSFlex7.AxVSFlexGrid grdMain, int HSelectCol, int lngCol, int HMaterIDCol, int HSourceIDCol, Int64 HProcID, int HWorkQtyCol, DAL.ClsSc_ICMOSortBill oMain)
|
{
|
int i;
|
int SelectRow = 0;
|
string s = "";
|
//
|
for (i = grdMain.FixedRows; i < grdMain.Rows; i++)
|
{
|
if (DBUtility.ClsPub.GridToBool(grdMain.get_TextMatrix(i, HSelectCol)) == true)
|
{
|
SelectRow = i;
|
RefreshWorkQty(grdMain, HMaterIDCol,HSourceIDCol, HProcID, HWorkQtyCol,oMain);
|
break;
|
}
|
}
|
for (i = grdMain.Rows - 1; i >= grdMain.FixedRows; i--)
|
{
|
if (DBUtility.ClsPub.GridToBool(grdMain.get_TextMatrix(i, HSelectCol)) == true
|
&& i != SelectRow)
|
{
|
s = Convert.ToString(DBUtility.ClsPub.isDoule(grdMain.get_TextMatrix(SelectRow, lngCol)) + DBUtility.ClsPub.isDoule(grdMain.get_TextMatrix(i, lngCol)));
|
grdMain.set_TextMatrix(SelectRow, lngCol, s);
|
grdMain.RemoveItem(i);
|
break;
|
}
|
}
|
return;
|
}
|
|
//ºÏ²¢ÈÎÎñµ¥
|
public static void HBData(AxVSFlex7.AxVSFlexGrid grdMain, int HSelectCol, int lngCol, int HMaterIDCol, int HSourceIDCol, Int64 HProcID, int HWorkQtyCol, DAL.ClsSc_ProcPlanSortBill oMain)
|
{
|
int i;
|
int SelectRow = 0;
|
string s = "";
|
//
|
for (i = grdMain.FixedRows; i < grdMain.Rows; i++)
|
{
|
if (DBUtility.ClsPub.GridToBool(grdMain.get_TextMatrix(i, HSelectCol)) == true)
|
{
|
SelectRow = i;
|
RefreshWorkQty(grdMain, HMaterIDCol, HSourceIDCol, HProcID, HWorkQtyCol, oMain);
|
break;
|
}
|
}
|
for (i = grdMain.Rows - 1; i >= grdMain.FixedRows; i--)
|
{
|
if (DBUtility.ClsPub.GridToBool(grdMain.get_TextMatrix(i, HSelectCol)) == true
|
&& i != SelectRow)
|
{
|
s = Convert.ToString(DBUtility.ClsPub.isDoule(grdMain.get_TextMatrix(SelectRow, lngCol)) + DBUtility.ClsPub.isDoule(grdMain.get_TextMatrix(i, lngCol)));
|
grdMain.set_TextMatrix(SelectRow, lngCol, s);
|
grdMain.RemoveItem(i);
|
break;
|
}
|
}
|
return;
|
}
|
//Ë¢ÐÂÈ«²¿×ÊÔ´ ²úÄÜ
|
public static void RefreshWorkQty(AxVSFlex7.AxVSFlexGrid grdMain, int HMaterIDCol, int HSourceIDCol, Int64 HProcID, int HWorkQtyCol,DAL.ClsSc_ICMOSortBill oMain)
|
{
|
for (int i = grdMain.FixedRows; i < grdMain.Rows; i++)
|
{
|
if (DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HSourceIDCol)) != 0)
|
{
|
SetSourceWorkQty(grdMain, HMaterIDCol, HSourceIDCol, HProcID, HWorkQtyCol, i,oMain);
|
}
|
}
|
}
|
//Ë¢ÐÂÈ«²¿×ÊÔ´ ²úÄÜ
|
public static void RefreshWorkQty(AxVSFlex7.AxVSFlexGrid grdMain, int HMaterIDCol, int HSourceIDCol, Int64 HProcID, int HWorkQtyCol, DAL.ClsSc_ProcPlanSortBill oMain)
|
{
|
for (int i = grdMain.FixedRows; i < grdMain.Rows; i++)
|
{
|
if (DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HSourceIDCol)) != 0)
|
{
|
SetSourceWorkQty(grdMain, HMaterIDCol, HSourceIDCol, HProcID, HWorkQtyCol, i, oMain);
|
}
|
}
|
}
|
|
//ÉèÖñ¾ÐÐ ×ÊÔ´£¬²úÄÜ£¬²ð·Ö»ã±¨ÊýÁ¿
|
public static void SetSourceWorkQty(AxVSFlex7.AxVSFlexGrid grdMain, int HMaterIDCol, int HSourceIDCol, Int64 HProcID, int HWorkQtyCol, int iRow,DAL.ClsSc_ICMOSortBill oMain)
|
{
|
Single WorkQty = 0;
|
WorkQty = oMain.GetSourceWorkQty(DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(iRow, HMaterIDCol))
|
, HProcID
|
, DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(iRow, HSourceIDCol)));
|
//
|
grdMain.set_TextMatrix(iRow, HWorkQtyCol, WorkQty.ToString());
|
}
|
|
|
//ÉèÖñ¾ÐÐ ×ÊÔ´£¬²úÄÜ£¬²ð·Ö»ã±¨ÊýÁ¿
|
public static void SetSourceWorkQty(DataGridView grdMain, int HMaterIDCol, int HSourceIDCol, Int64 HProcID, int HWorkQtyCol, int iRow, DAL.ClsSc_WorkBillAutoSortBill oMain)
|
{
|
Single WorkQty = 0;
|
WorkQty = oMain.GetSourceWorkQty(DBUtility.ClsPub.isLong(grdMain.Rows[iRow].Cells[HMaterIDCol].Value)
|
, HProcID
|
, DBUtility.ClsPub.isLong(grdMain.Rows[iRow].Cells[HSourceIDCol].Value),true);
|
//
|
grdMain.Rows[iRow].Cells[HWorkQtyCol].Value = WorkQty.ToString();
|
}
|
|
//ÉèÖñ¾ÐÐ ×ÊÔ´£¬²úÄÜ£¬²ð·Ö»ã±¨ÊýÁ¿
|
public static void SetSourceWorkQty(AxVSFlex7.AxVSFlexGrid grdMain, int HMaterIDCol, int HSourceIDCol, Int64 HProcID, int HWorkQtyCol, int iRow, DAL.ClsSc_ProcPlanSortBill oMain)
|
{
|
Single WorkQty = 0;
|
WorkQty = oMain.GetSourceWorkQty(DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(iRow, HMaterIDCol))
|
, HProcID
|
, DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(iRow, HSourceIDCol)));
|
//
|
grdMain.set_TextMatrix(iRow, HWorkQtyCol, WorkQty.ToString());
|
}
|
|
//ÉèÖñ¾ÐÐ ×ÊÔ´ £¬²ð·Ö»ã±¨ÊýÁ¿
|
public static void SetSourceRelationQty(AxVSFlex7.AxVSFlexGrid grdMain, int iRow, int HICMOInterIDCol, int HSourceIDCol, int HRelationQtyCol, int HSplitRelationQtyCol, DAL.ClsSc_ICMOSortBill oMain)
|
{
|
Single RelationQty = 0;
|
Single SplitRelationQty = 0;
|
oMain.GetSourceRelationQty(DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(iRow, HICMOInterIDCol))
|
, DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(iRow, HSourceIDCol)), ref RelationQty, ref SplitRelationQty);
|
//
|
grdMain.set_TextMatrix(iRow, HRelationQtyCol, RelationQty.ToString());
|
grdMain.set_TextMatrix(iRow, HSplitRelationQtyCol, SplitRelationQty.ToString());
|
}
|
|
//ÉèÖñ¾ÐÐ ×ÊÔ´ £¬²ð·Ö»ã±¨ÊýÁ¿
|
public static void SetSourceRelationQty(DataGridView grdMain, int iRow, int HICMOInterIDCol, int HSourceIDCol, int HRelationQtyCol, int HSplitRelationQtyCol, DAL.ClsSc_WorkBillAutoSortBill oMain)
|
{
|
Single RelationQty = 0;
|
Single SplitRelationQty = 0;
|
oMain.GetSourceRelationQty(DBUtility.ClsPub.isLong(grdMain.Rows[iRow].Cells[HICMOInterIDCol].Value)
|
, DBUtility.ClsPub.isLong(grdMain.Rows[iRow].Cells[HSourceIDCol].Value), ref RelationQty, ref SplitRelationQty);
|
//
|
grdMain.Rows[iRow].Cells[HRelationQtyCol].Value = RelationQty.ToString();
|
//grdMain.set_TextMatrix(iRow, HSplitRelationQtyCol, SplitRelationQty.ToString());
|
}
|
|
//ÉèÖñ¾ÐÐ ×ÊÔ´ £¬²ð·Ö»ã±¨ÊýÁ¿
|
public static void SetSourceRelationQty(AxVSFlex7.AxVSFlexGrid grdMain, int iRow, int HICMOInterIDCol, int HSourceIDCol, int HRelationQtyCol, int HSplitRelationQtyCol, DAL.ClsSc_ProcPlanSortBill oMain)
|
{
|
Single RelationQty = 0;
|
Single SplitRelationQty = 0;
|
oMain.GetSourceRelationQty(DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(iRow, HICMOInterIDCol))
|
, DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(iRow, HSourceIDCol)), ref RelationQty, ref SplitRelationQty);
|
//
|
grdMain.set_TextMatrix(iRow, HRelationQtyCol, RelationQty.ToString());
|
grdMain.set_TextMatrix(iRow, HSplitRelationQtyCol, SplitRelationQty.ToString());
|
}
|
|
|
//ÊÇ·ñÑ¡ÖÐÐÐ ºÏ²¢
|
public static bool ExistCell(AxVSFlex7.AxVSFlexGrid grdMain, int HSelectCol)
|
{
|
int i = 0, SelectRows = 0;
|
for (i = grdMain.FixedRows; i < grdMain.Rows; i++)
|
{
|
if (DBUtility.ClsPub.GridToBool(grdMain.get_TextMatrix(i, HSelectCol)) == true)
|
{
|
SelectRows++;
|
}
|
}
|
if (SelectRows > 0)
|
{
|
return true;
|
}
|
return false;
|
}
|
//ÊÇ·ñÔÊÐí ²ð·Ö
|
public static bool AllowCF(AxVSFlex7.AxVSFlexGrid grdMain, int HSelectCol)
|
{
|
int SelectRows = 0;
|
for (int i = grdMain.FixedRows; i < grdMain.Rows; i++)
|
{
|
if (DBUtility.ClsPub.GridToBool(grdMain.get_TextMatrix(i, HSelectCol)) == true)
|
{
|
SelectRows++;
|
}
|
}
|
if (SelectRows == 1)
|
{
|
return true;
|
}
|
return false;
|
}
|
//ÊÇ·ñ ÔÊÐíºÏ²¢
|
public static bool AllowHB(AxVSFlex7.AxVSFlexGrid grdMain, int HSelectCol, int HICMoBillNoCol)
|
{
|
string sICBillNo = "";
|
int i = 0, SelectRows = 0;
|
bool b = false;
|
if (ExistCell(grdMain,HSelectCol))
|
{
|
for (i = grdMain.FixedRows; i < grdMain.Rows; i++)
|
{
|
if (DBUtility.ClsPub.GridToBool(grdMain.get_TextMatrix(i, HSelectCol)))
|
{
|
SelectRows++;
|
}
|
}
|
//
|
if (SelectRows > 1)
|
{
|
for (i = grdMain.FixedRows; i < grdMain.Rows; i++)
|
{
|
if (DBUtility.ClsPub.GridToBool(grdMain.get_TextMatrix(i, HSelectCol)) == true)
|
{
|
if (b == false)
|
{
|
sICBillNo = DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(i, HICMoBillNoCol));
|
b = true;
|
}
|
if (sICBillNo.Trim().ToUpper() != DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(i, HICMoBillNoCol).ToUpper())
|
&& b == true)
|
{
|
return false;
|
}
|
|
}
|
}
|
return true;
|
}
|
}
|
|
return false;
|
}
|
//±£´æ×Ó±í
|
public static void SaveGridSub(AxVSFlex7.AxVSFlexGrid grdMain, int FixCols, Model.ClsSc_ICMOSortBillMain oModel,DateTime sDate,ref int i)
|
{
|
for (int c = FixCols; c <= grdMain.Cols - 1; c++)
|
{
|
if (DBUtility.ClsPub.isDoule(grdMain.get_ValueMatrix(i, c)) != 0)
|
{
|
//×Ó±í¸³Öµ
|
Model.ClsSc_ICMOSortBillSub oSub = new Model.ClsSc_ICMOSortBillSub();
|
oSub.HEntryID = c;
|
oSub.HMasterDate = sDate;
|
oSub.HDate = DBUtility.ClsPub.isDate(grdMain.get_TextMatrix(grdMain.FixedRows - 2, c));
|
oSub.HQty = DBUtility.ClsPub.isDoule(grdMain.get_ValueMatrix(i, c));
|
oSub.HStatusTag = 0;
|
oSub.HiForeColor = grdMain.get_Cell(VSFlex7.CellPropertySettings.flexcpForeColor, i, c, i, c).ToString();
|
oSub.HiBackColor = grdMain.get_Cell(VSFlex7.CellPropertySettings.flexcpBackColor, i, c, i, c).ToString();
|
oSub.HRemark = "";
|
//
|
oModel.DetailColl.Add(oSub);
|
}
|
}
|
}
|
//±£´æ×Ó±í
|
public static void SaveGridSub(AxVSFlex7.AxVSFlexGrid grdMain, int FixCols, Model.ClsSc_ProcPlanSortBillMain oModel, DateTime sDate, ref int i)
|
{
|
for (int c = FixCols; c <= grdMain.Cols - 1; c++)
|
{
|
if (DBUtility.ClsPub.isDoule(grdMain.get_ValueMatrix(i, c)) != 0)
|
{
|
//×Ó±í¸³Öµ
|
Model.ClsSc_ProcPlanSortBillSub oSub = new Model.ClsSc_ProcPlanSortBillSub();
|
oSub.HEntryID = c;
|
oSub.HMasterDate = sDate;
|
oSub.HDate = DBUtility.ClsPub.isDate(grdMain.get_TextMatrix(grdMain.FixedRows - 2, c));
|
oSub.HQty = DBUtility.ClsPub.isDoule(grdMain.get_ValueMatrix(i, c));
|
oSub.HStatusTag = 0;
|
oSub.HiForeColor = grdMain.get_Cell(VSFlex7.CellPropertySettings.flexcpForeColor, i, c, i, c).ToString();
|
oSub.HiBackColor = grdMain.get_Cell(VSFlex7.CellPropertySettings.flexcpBackColor, i, c, i, c).ToString();
|
oSub.HRemark = "";
|
//
|
oModel.DetailColl.Add(oSub);
|
}
|
}
|
}
|
//¼ÆËãÿÈÕ¼Ó¹¤Ê±¼ä
|
public static double CountDayHours(AxVSFlex7.AxVSFlexGrid grdMain, int iRow, int iCol, int HMaterIDCol, int HSourceIDCol, int HYXCol, int HReadyTimesCol,SQLHelper.ClsCN oCn)
|
{
|
double cTimes = 0;
|
if (DBUtility.ClsPub.isDoule(grdMain.get_ColData(iCol)) > 0)
|
{
|
if (DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(iRow, HMaterIDCol)) == DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(iRow - 1, HMaterIDCol))
|
&& DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(iRow, HSourceIDCol)) == DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(iRow - 1, HSourceIDCol))
|
&& DBUtility.ClsPub.isDoule(grdMain.get_ColData(iCol)) != GetWorkNumber(DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(1, iCol)), DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(iRow, HSourceIDCol)), oCn)
|
&& (DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(iRow, HYXCol)) != DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(iRow - 1, HYXCol))
|
|| DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(iRow, HYXCol)) == 0))
|
{
|
cTimes = DBUtility.ClsPub.isDoule(grdMain.get_ColData(iCol)) - DBUtility.ClsPub.isDoule(grdMain.get_TextMatrix(iRow, HReadyTimesCol));
|
grdMain.set_ColData(iCol, cTimes.ToString());
|
}
|
else if (DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(iRow, HSourceIDCol)) != DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(iRow - 1, HSourceIDCol))
|
&& DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(iRow, HYXCol)) != DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(iRow - 1, HYXCol)))
|
{
|
cTimes = DBUtility.ClsPub.isDoule(grdMain.get_ColData(iCol)) - DBUtility.ClsPub.isDoule(grdMain.get_TextMatrix(iRow, HReadyTimesCol));
|
grdMain.set_ColData(iCol, cTimes.ToString());
|
}
|
else
|
{
|
cTimes = DBUtility.ClsPub.isDoule(grdMain.get_ColData(iCol));
|
}
|
}
|
//
|
if (cTimes < 0)
|
{
|
return 0;
|
}
|
else
|
{
|
return cTimes;
|
}
|
}
|
|
//ÅųÌ2
|
public static bool CountDateSetup(AxVSFlex7.AxVSFlexGrid grdMain, int iBeginRow, int iEndRow, int FixCols, int HSourceIDCol, int HWorkQtyCol, int HSplitPlanQtyCol, int HSplitRelationQtyCol, int HPlanQtyCol, int HRelationQtyCol, int HICMoBillNoCol, int HPlanBeginDateCol, int HKTQCol, int HYXCol, int HPlanEndDateCol, int HMaterIDCol, int HReadyTimesCol,long HSourceID,SQLHelper.ClsCN oCn)
|
{
|
double HourQuan = 0, SYHours = 0;
|
double SYQuan = 0;
|
string bDate = "", CurDate = "";
|
int i = 0, m;
|
string s;
|
int lJHSCol, lWGSCol;
|
for (m = FixCols; m < grdMain.Cols; m++)
|
{
|
grdMain.set_ColData(m, GetWorkNumber(DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(1, m)), DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(iBeginRow, HSourceIDCol)),oCn));//ÉèÖà ×ÜÉϰàʱ¼ä
|
}
|
for (i = iBeginRow; i <= iEndRow; i++)//ÉèÖà Éϰàʱ¼ä
|
{
|
for (m = FixCols; m < grdMain.Cols; m++)
|
{
|
HourQuan = CountHourQuantity(grdMain,i, m,HWorkQtyCol);//µÃµ½ Сʱ ²úÄÜ
|
if (DBUtility.ClsPub.GridToColor(grdMain.get_Cell(VSFlex7.CellPropertySettings.flexcpForeColor, i, m, i, m)) == DBUtility.ClsPub.Enum_Color.hx_Red && DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, m)) != 0)
|
{
|
if (HourQuan != 0)//·ÀÖ¹ ³ýÊý Ϊ0
|
{
|
s = Convert.ToString(DBUtility.ClsPub.isDoule(grdMain.get_ColData(m)) - DBUtility.ClsPub.isDoule(grdMain.get_TextMatrix(i, m)) / HourQuan);
|
grdMain.set_ColData(m, s);
|
}
|
}
|
|
}
|
}
|
//
|
for (i = iBeginRow; i <= iEndRow; i++)
|
{
|
if (grdMain.get_RowHidden(i) == false)
|
{
|
if (IsCf(grdMain,HICMoBillNoCol, i))//¸ù¾ÝÊÇ·ñ²ð·Ö À´µÃµ½ ¶ÔÓ¦ÁÐ
|
{
|
lJHSCol = HSplitPlanQtyCol;
|
lWGSCol = HSplitRelationQtyCol;
|
}
|
else
|
{
|
lJHSCol = HPlanQtyCol;
|
lWGSCol = HRelationQtyCol;
|
}
|
SYQuan = DBUtility.ClsPub.isDoule(grdMain.get_TextMatrix(i, lJHSCol)) - DBUtility.ClsPub.isDoule(grdMain.get_TextMatrix(i, lWGSCol));//µÃµ½ Ê£ÓàÊýÁ¿
|
//
|
for (m = FixCols; m < grdMain.Cols; m++)
|
{
|
HourQuan = CountHourQuantity(grdMain,i, m,HWorkQtyCol);
|
if (SYQuan <= 0)
|
{
|
break;
|
}
|
bDate = DBUtility.ClsPub.isDate(grdMain.get_TextMatrix(i, HPlanBeginDateCol)).ToString("yyyy-MM-dd");//µÃµ½¿ª¹¤ÈÕÆÚ
|
CurDate = DBUtility.ClsPub.isDate(grdMain.get_TextMatrix(1, m)).ToString("yyyy-MM-dd");//µÃµ½ µÚÒ»ÐÐ ÈÕÆÚ
|
SYHours = CountDayHours(grdMain,i, m,HMaterIDCol,HSourceIDCol,HYXCol,HReadyTimesCol,oCn);//µÃµ½ Ê£Óàʱ¼ä
|
//µ±Ç°ÈÕÆÚСÓÚ¿ª¹¤ÈÕÆÚÇÒ¿ÉÌáǰÇÒÓÐÊ£Óàʱ¼ä
|
if (SYHours > 0 && SYQuan > 0 && DBUtility.ClsPub.GridToColor(grdMain.get_Cell(VSFlex7.CellPropertySettings.flexcpForeColor, i, m, i, m)) != DBUtility.ClsPub.Enum_Color.hx_Red)
|
{
|
if (DBUtility.ClsPub.GridToStr(grdMain.get_TextMatrix(i, HKTQCol)) != "0" || bDate.CompareTo(CurDate) < 0)
|
{
|
if (SYQuan < Convert.ToInt64(SYHours * HourQuan))
|
{
|
grdMain.set_TextMatrix(i, m, DBUtility.ClsPub.isDoule(SYQuan, 0));
|
SYQuan = 0;
|
if (i != iEndRow)
|
{
|
if (DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HYXCol)) != DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i + 1, HYXCol))
|
|| DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i + 1, HYXCol)) == 0)
|
{
|
s = Convert.ToString(DBUtility.ClsPub.isDoule(grdMain.get_ColData(m)) - DBUtility.ClsPub.isDoule(grdMain.get_TextMatrix(i, m)) / HourQuan);
|
grdMain.set_ColData(m, s);
|
}
|
}
|
else
|
{
|
s = Convert.ToString(DBUtility.ClsPub.isDoule(grdMain.get_ColData(m)) - SYHours);
|
grdMain.set_ColData(m, s);
|
}
|
}
|
else
|
{
|
s = DBUtility.ClsPub.isDoule(SYHours * HourQuan, 0);
|
grdMain.set_TextMatrix(i, m, s);
|
SYQuan = SYQuan - DBUtility.ClsPub.isDoule((SYHours * HourQuan));
|
if (i != iEndRow)
|
{
|
if (DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HYXCol)) != DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i + 1, HYXCol))
|
|| DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i + 1, HYXCol)) == 0)
|
{
|
s = Convert.ToString(DBUtility.ClsPub.isDoule(grdMain.get_ColData(m)) - SYHours);
|
grdMain.set_ColData(m, s);
|
}
|
}
|
else
|
{
|
s = Convert.ToString(DBUtility.ClsPub.isDoule(grdMain.get_ColData(m)) - SYHours);
|
grdMain.set_ColData(m, s);
|
}
|
}
|
}
|
}
|
else if (DBUtility.ClsPub.GridToColor(grdMain.get_Cell(VSFlex7.CellPropertySettings.flexcpForeColor, i, m, i, m)) == DBUtility.ClsPub.Enum_Color.hx_Red)
|
{
|
SYQuan = SYQuan - DBUtility.ClsPub.isDoule(grdMain.get_TextMatrix(i, m));
|
}
|
} // for m
|
}
|
}// for i
|
//
|
AddColor(grdMain, HPlanEndDateCol, FixCols);
|
return true;
|
|
}
|
|
|
//¹¤ÐòÅųÌ2
|
public static bool CountDateSetupProc(AxVSFlex7.AxVSFlexGrid grdMain, int iBeginRow, int iEndRow, int FixCols, int HSourceIDCol, int HWorkQtyCol, int HSplitPlanQtyCol, int HSplitRelationQtyCol, int HPlanQtyCol, int HRelationQtyCol, int HICMoBillNoCol, int HPlanBeginDateCol, int HKTQCol, int HYXCol, int HPlanEndDateCol, int HMaterIDCol, int HReadyTimesCol, long HSourceID, SQLHelper.ClsCN oCn)
|
{
|
double HourQuan = 0, SYHours = 0;
|
double SYQuan = 0;
|
string bDate = "", CurDate = "";
|
int i = 0, m;
|
string s;
|
int lJHSCol, lWGSCol;
|
for (m = FixCols; m < grdMain.Cols; m++)
|
{
|
grdMain.set_ColData(m, GetWorkNumber(DBUtility.ClsPub.isStrNull(grdMain.get_TextMatrix(1, m)), DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(iBeginRow, HSourceIDCol)), oCn));
|
//ÉèÖà ×ÜÉϰàʱ¼ä£¬½«×ÜÉϰàʱ¼ä±£´æÓÚ COlData
|
}
|
for (i = iBeginRow; i <= iEndRow; i++)//¸ù¾ÝÊÖ¹¤Åų̣¬¿Û¼õ ºÄʱ
|
{
|
for (m = FixCols; m < grdMain.Cols; m++)
|
{
|
HourQuan = CountHourQuantity(grdMain, i, m, HWorkQtyCol);//µÃµ½ Сʱ ²úÄÜ
|
//Èç¹ûºìÉ«×Ö²¢ÇÒÊýÁ¿²»Îª0ÔòΪ ÊÖ¹¤ÅųÌ
|
if (DBUtility.ClsPub.GridToColor(grdMain.get_Cell(VSFlex7.CellPropertySettings.flexcpForeColor, i, m, i, m)) == DBUtility.ClsPub.Enum_Color.hx_Red && DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, m)) != 0)
|
{
|
if (HourQuan != 0)//·ÀÖ¹ ³ýÊý Ϊ0
|
{
|
//¸ù¾ÝÊÖ¹¤Åų̼ÆËã ºÄʱ
|
s = Convert.ToString(DBUtility.ClsPub.isDoule(grdMain.get_ColData(m)) - DBUtility.ClsPub.isDoule(grdMain.get_TextMatrix(i, m)) / HourQuan);
|
grdMain.set_ColData(m, s);//½«Ê£Óàʱ¼ä±£´æÓÚCOLDATA
|
}
|
}
|
|
}
|
}
|
//¸ù¾Ý ÉϵÀ¹¤Ðò £¬¿Û¼õºÄʱ
|
|
//
|
for (i = iBeginRow; i <= iEndRow; i++)
|
{
|
if (grdMain.get_RowHidden(i) == false)
|
{
|
if (IsCf(grdMain, HICMoBillNoCol, i))//¸ù¾ÝÊÇ·ñ²ð·Ö À´µÃµ½ ¶ÔÓ¦ÁÐ
|
{
|
lJHSCol = HSplitPlanQtyCol;
|
lWGSCol = HSplitRelationQtyCol;
|
}
|
else
|
{
|
lJHSCol = HPlanQtyCol;
|
lWGSCol = HRelationQtyCol;
|
}
|
SYQuan = DBUtility.ClsPub.isDoule(grdMain.get_TextMatrix(i, lJHSCol)) - DBUtility.ClsPub.isDoule(grdMain.get_TextMatrix(i, lWGSCol));//µÃµ½ Ê£ÓàÊýÁ¿
|
//
|
for (m = FixCols; m < grdMain.Cols; m++)
|
{
|
HourQuan = CountHourQuantity(grdMain, i, m, HWorkQtyCol);
|
if (SYQuan <= 0)
|
{
|
break;
|
}
|
bDate = DBUtility.ClsPub.isDate(grdMain.get_TextMatrix(i, HPlanBeginDateCol)).ToString("yyyy-MM-dd");//µÃµ½¿ª¹¤ÈÕÆÚ
|
CurDate = DBUtility.ClsPub.isDate(grdMain.get_TextMatrix(1, m)).ToString("yyyy-MM-dd");//µÃµ½ µÚÒ»ÐÐ ÈÕÆÚ
|
SYHours = CountDayHours(grdMain, i, m, HMaterIDCol, HSourceIDCol, HYXCol, HReadyTimesCol, oCn);//µÃµ½ Ê£Óàʱ¼ä
|
//µ±Ç°ÈÕÆÚСÓÚ¿ª¹¤ÈÕÆÚÇÒ¿ÉÌáǰÇÒÓÐÊ£Óàʱ¼ä
|
if (SYHours > 0 && SYQuan > 0 && DBUtility.ClsPub.GridToColor(grdMain.get_Cell(VSFlex7.CellPropertySettings.flexcpForeColor, i, m, i, m)) != DBUtility.ClsPub.Enum_Color.hx_Red)
|
{
|
if (DBUtility.ClsPub.GridToStr(grdMain.get_TextMatrix(i, HKTQCol)) != "0" || bDate.CompareTo(CurDate) < 0)
|
{
|
if (SYQuan < Convert.ToInt64(SYHours * HourQuan))
|
{
|
grdMain.set_TextMatrix(i, m, DBUtility.ClsPub.isDoule(SYQuan, 0));
|
SYQuan = 0;
|
if (i != iEndRow)
|
{
|
if (DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HYXCol)) != DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i + 1, HYXCol))
|
|| DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i + 1, HYXCol)) == 0)
|
{
|
s = Convert.ToString(DBUtility.ClsPub.isDoule(grdMain.get_ColData(m)) - DBUtility.ClsPub.isDoule(grdMain.get_TextMatrix(i, m)) / HourQuan);
|
grdMain.set_ColData(m, s);
|
}
|
}
|
else
|
{
|
s = Convert.ToString(DBUtility.ClsPub.isDoule(grdMain.get_ColData(m)) - SYHours);
|
grdMain.set_ColData(m, s);
|
}
|
}
|
else
|
{
|
s = DBUtility.ClsPub.isDoule(SYHours * HourQuan, 0);
|
grdMain.set_TextMatrix(i, m, s);
|
SYQuan = SYQuan - DBUtility.ClsPub.isDoule((SYHours * HourQuan));
|
if (i != iEndRow)
|
{
|
if (DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HYXCol)) != DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i + 1, HYXCol))
|
|| DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i + 1, HYXCol)) == 0)
|
{
|
s = Convert.ToString(DBUtility.ClsPub.isDoule(grdMain.get_ColData(m)) - SYHours);
|
grdMain.set_ColData(m, s);
|
}
|
}
|
else
|
{
|
s = Convert.ToString(DBUtility.ClsPub.isDoule(grdMain.get_ColData(m)) - SYHours);
|
grdMain.set_ColData(m, s);
|
}
|
}
|
}
|
}
|
else if (DBUtility.ClsPub.GridToColor(grdMain.get_Cell(VSFlex7.CellPropertySettings.flexcpForeColor, i, m, i, m)) == DBUtility.ClsPub.Enum_Color.hx_Red)
|
{
|
SYQuan = SYQuan - DBUtility.ClsPub.isDoule(grdMain.get_TextMatrix(i, m));
|
}
|
} // for m
|
}
|
}// for i
|
//
|
AddColor(grdMain, HPlanEndDateCol, FixCols);
|
return true;
|
|
}
|
|
//µÃµ½Ð¡Ê±²úÄÜ
|
public static double CountHourQuantity(AxVSFlex7.AxVSFlexGrid grdMain, int iRow, int iCol, int HWorkQtyCol)
|
{
|
return DBUtility.ClsPub.isDoule(grdMain.get_TextMatrix(iRow, HWorkQtyCol));
|
}
|
|
//ÅųÌ
|
public static void DateSetup(AxVSFlex7.AxVSFlexGrid grdMain, bool bAuto,ref int m, ref bool b, ref long lSourceID, ref int e, ref bool bEdit, int FixCols, int HSourceIDCol, int HWorkQtyCol, int HSplitPlanQtyCol, int HSplitRelationQtyCol, int HPlanQtyCol, int HRelationQtyCol, int HICMoBillNoCol, int HPlanBeginDateCol, int HKTQCol, int HYXCol, int HPlanEndDateCol, int HMaterIDCol, int HReadyTimesCol,SQLHelper.ClsCN oCn)
|
{
|
b = true;
|
for (int i = grdMain.FixedRows; i < grdMain.Rows; i++)
|
{
|
if (b == true)//³õʼ»¯
|
{
|
lSourceID = DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HSourceIDCol));
|
m = i;
|
e = 0;
|
b = false;
|
}
|
//
|
if (i + 1 >= grdMain.Rows)//×îºóÒ»ÐÐ
|
{
|
CountDateSetup(grdMain, m, i, FixCols, HSourceIDCol, HWorkQtyCol, HSplitPlanQtyCol, HSplitRelationQtyCol, HPlanQtyCol, HRelationQtyCol, HICMoBillNoCol, HPlanBeginDateCol, HKTQCol, HYXCol, HPlanEndDateCol, HMaterIDCol, HReadyTimesCol, lSourceID, oCn);
|
|
}
|
else
|
{
|
if (lSourceID != DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i + 1, HSourceIDCol)))
|
{
|
CountDateSetup(grdMain, m, m + e, FixCols, HSourceIDCol, HWorkQtyCol, HSplitPlanQtyCol, HSplitRelationQtyCol, HPlanQtyCol, HRelationQtyCol, HICMoBillNoCol, HPlanBeginDateCol, HKTQCol, HYXCol, HPlanEndDateCol, HMaterIDCol, HReadyTimesCol, lSourceID, oCn);
|
b = true;
|
}
|
}
|
e++;
|
}
|
bEdit = false;
|
}
|
|
//¹¤ÐòÅųÌ
|
public static void DateSetupProc(AxVSFlex7.AxVSFlexGrid grdMain, bool bAuto, ref int m, ref bool b, ref long lSourceID, ref int e, ref bool bEdit, int FixCols, int HSourceIDCol, int HWorkQtyCol, int HSplitPlanQtyCol, int HSplitRelationQtyCol, int HPlanQtyCol, int HRelationQtyCol, int HICMoBillNoCol, int HPlanBeginDateCol, int HKTQCol, int HYXCol, int HPlanEndDateCol, int HMaterIDCol, int HReadyTimesCol, SQLHelper.ClsCN oCn)
|
{
|
b = true;
|
for (int i = grdMain.FixedRows; i < grdMain.Rows; i++) //´ÓµÚÒ»ÐÐ µ½×îºóÒ»ÐÐ
|
{
|
if (b == true)//³õʼ»¯
|
{
|
lSourceID = DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HSourceIDCol)); //µÃµ½×ÊÔ´ID
|
m = i;
|
e = 0;
|
b = false;
|
}
|
//
|
if (i + 1 >= grdMain.Rows)//×îºóÒ»ÐÐ
|
{
|
CountDateSetupProc(grdMain, m, i, FixCols, HSourceIDCol, HWorkQtyCol, HSplitPlanQtyCol, HSplitRelationQtyCol, HPlanQtyCol, HRelationQtyCol, HICMoBillNoCol, HPlanBeginDateCol, HKTQCol, HYXCol, HPlanEndDateCol, HMaterIDCol, HReadyTimesCol, lSourceID, oCn);
|
|
}
|
else
|
{
|
if (lSourceID != DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i + 1, HSourceIDCol))) //µ±×ÊÔ´ ±ä»¯Ê±
|
{
|
CountDateSetupProc(grdMain, m, m + e, FixCols, HSourceIDCol, HWorkQtyCol, HSplitPlanQtyCol, HSplitRelationQtyCol, HPlanQtyCol, HRelationQtyCol, HICMoBillNoCol, HPlanBeginDateCol, HKTQCol, HYXCol, HPlanEndDateCol, HMaterIDCol, HReadyTimesCol, lSourceID, oCn);
|
b = true;
|
}
|
}
|
e++;
|
}
|
bEdit = false;
|
}
|
|
|
//²é¿´¿ÉÅųÌ×ÊÔ´
|
public static void GetSourceByMater(SQLHelper.ClsCN oCn, DataGridView grd, Int64 sMaterID)
|
{
|
DataSet oDs;
|
//
|
oDs = oCn.RunProcReturn("select ĬÈϱê¼Ç=case HStandard when 1 then 'Y' else '' end,Éú²ú×ÊÔ´´úÂë=Hnumber,Éú²ú×ÊÔ´=Hname,ÀàÐÍ=HType,[²úÄÜ(Сʱ)]=HWorkQty,±¸×¢=HRemark " +
|
"from h_v_Sc_GetSource2 where Hmaterid=" + sMaterID.ToString(), "h_v_Sc_GetSource2");
|
if (oDs == null || oDs.Tables[0].Rows.Count == 0)
|
{
|
grd.DataSource = null;
|
}
|
else
|
{
|
grd.DataSource = oDs.Tables[0].DefaultView;
|
}
|
//
|
}
|
|
//²é¿´ÈÎÎñµ¥ÐÅÏ¢
|
public static void GetICMOInfoByID(SQLHelper.ClsCN oCn, DataGridView grd, Int64 sHInterID)
|
{
|
DataSet oDs;
|
//
|
oDs = oCn.RunProcReturn("select ״̬,¹¤×÷ÖÐÐÄ,ÏúÊÛ¶©µ¥ºÅ,ÒµÎñÔ±,ÈÎÎñµ¥ºÅ,Éú²ú³µ¼ä,²úÆ·´úÂë,²úÆ·Ãû³Æ " +
|
" ,¹æ¸ñÐͺÅ,¼ÆÁ¿µ¥Î»,ÈÎÎñµ¥ÊýÁ¿,¼Æ»®¿ª¹¤,¼Æ»®Í깤,×î³Ù¿ª¹¤ÈÕÆÚ,×î³ÙÍ깤ÈÕÆÚ from h_v_Sc_ICMOBillInfo Where finterid=" + sHInterID.ToString(), "h_v_Sc_ICMOBillInfo");
|
if (oDs == null || oDs.Tables[0].Rows.Count == 0)
|
{
|
grd.DataSource = null;
|
}
|
else
|
{
|
grd.DataSource = oDs.Tables[0].DefaultView;
|
}
|
//
|
}
|
|
////¸ù¾ÝÈÎÎñµ¥ºÍÎïÁÏ£¬·µ»Ø¿ÉÉú²ú×ÊÔ´
|
/// <summary>
|
/// ¸ù¾ÝÈÎÎñµ¥ºÍÎïÁÏ£¬·µ»Ø¿ÉÉú²ú×ÊÔ´ Ê£Ó๤ʱ
|
/// </summary>
|
/// <param name="oCn"></param>
|
/// <param name="lMainID"></param>
|
/// <param name="EndDate"></param>
|
/// <param name="SProdTimes"></param>
|
/// <returns></returns>
|
public static DataSet GetWorkSourceByICMO(SQLHelper.ClsCN oCn,Int64 lMainID,DateTime EndDate,Single SProdTimes)
|
{
|
DataSet oDs;
|
//
|
oDs = oCn.RunProcReturn("exec h_p_Sc_ICMOGetWorkSource " + lMainID.ToString() + ",'" + EndDate.ToShortDateString() + "'," + SProdTimes.ToString(), "h_p_Sc_ICMOGetWorkSource");
|
if (oDs == null || oDs.Tables[0].Rows.Count == 0)
|
{
|
return null;
|
}
|
else
|
{
|
return oDs;
|
}
|
//
|
}
|
|
|
////¸ù¾Ý¹¤Ðòµ¥ºÍÎïÁÏ£¬·µ»Ø¿ÉÉú²ú×ÊÔ´
|
/// <summary>
|
/// ¸ù¾Ý¹¤Ðòµ¥ºÍÎïÁÏ£¬·µ»Ø¿ÉÉú²ú×ÊÔ´ Ê£Ó๤ʱ ÕÒµ½¹¤ÐòÉϵÀ½áÊøÊ±¼ä ¼° ±¾µÀÔÊÐí¿ªÊ¼Ê±¼ä
|
/// </summary>
|
/// <param name="oCn"></param>
|
/// <param name="lMainID"></param>
|
/// <param name="EndDate"></param>
|
/// <param name="SProdTimes"></param>
|
/// <returns></returns>
|
public static DataSet GetWorkSourceByProc(SQLHelper.ClsCN oCn, Int64 lMainID, DateTime EndDate, Single SProdTimes,Int64 lProcPlanInterID,Int64 lProcPlanEntryID)
|
{
|
DataSet oDs;
|
//
|
oDs = oCn.RunProcReturn("exec h_p_Sc_ProcGetWorkSource " + lMainID.ToString() + ",'" + EndDate.ToShortDateString() + "'," + SProdTimes.ToString() + "," + lProcPlanInterID.ToString() + "," + lProcPlanEntryID.ToString() , "h_p_Sc_ProcGetWorkSource");
|
if (oDs == null || oDs.Tables[0].Rows.Count == 0)
|
{
|
return null;
|
}
|
else
|
{
|
return oDs;
|
}
|
//
|
}
|
|
/// <summary>
|
/// ¸ù¾ÝÈÎÎñµ¥ºÍÎïÁÏ£¬·µ»Ø¿ÉÉú²ú×ÊÔ´ Ê£Ó๤ʱ
|
/// </summary>
|
/// <param name="oCn"></param>
|
/// <param name="lMainID"></param>
|
/// <param name="EndDate"></param>
|
/// <param name="lSourceID"></param>
|
/// <param name="SProdTimes"></param>
|
/// <returns></returns>
|
public static DataSet GetWorkSourceByICMO(SQLHelper.ClsCN oCn, Int64 lMainID, DateTime EndDate,Int64 lSourceID, Single SProdTimes)
|
{
|
DataSet oDs;
|
//
|
oDs = oCn.RunProcReturn("exec h_p_Sc_ICMOGetWorkSource2 " + lMainID.ToString() + ",'" + EndDate.ToShortDateString() + "'," + SProdTimes.ToString() + "," +lSourceID.ToString(), "h_p_Sc_ICMOGetWorkSource");
|
if (oDs == null || oDs.Tables[0].Rows.Count == 0)
|
{
|
return null;
|
}
|
else
|
{
|
return oDs;
|
}
|
//
|
}
|
|
////¸ù¾ÝÉú²ú×ÊÔ´£¬·µ»ØÊ£Ó๤ʱ
|
/// <summary>
|
/// ¸ù¾ÝÉú²ú×ÊÔ´£¬·µ»ØÊ£Ó๤ʱ
|
/// </summary>
|
/// <param name="oCn"></param>
|
/// <param name="lMainID"></param>
|
/// <param name="EndDate"></param>
|
/// <param name="SProdTimes"></param>
|
/// <returns></returns>
|
public static DataSet GetWorkSourceTimeBySource(SQLHelper.ClsCN oCn, Int64 lSourceID)
|
{
|
DataSet oDs;
|
//
|
oDs = oCn.RunProcReturn("exec h_p_Sc_ICMOGetWorkSourceTime " + lSourceID.ToString(), "h_p_Sc_ICMOGetWorkSourceTime");
|
if (oDs == null || oDs.Tables[0].Rows.Count == 0)
|
{
|
return null;
|
}
|
else
|
{
|
return oDs;
|
}
|
//
|
}
|
|
////¸ù¾ÝÉú²ú×ÊÔ´£¬·µ»ØÊ£Ó๤ʱ ¹¤Ðò
|
/// <summary>
|
/// ¸ù¾ÝÉú²ú×ÊÔ´£¬·µ»ØÊ£Ó๤ʱ ¹¤Ðò
|
/// </summary>
|
/// <param name="oCn"></param>
|
/// <param name="lMainID"></param>
|
/// <param name="EndDate"></param>
|
/// <param name="SProdTimes"></param>
|
/// <returns></returns>
|
public static DataSet GetWorkSourceTimeBySource_Proc(SQLHelper.ClsCN oCn, Int64 lSourceID, Int64 lProcPlanInterID, Int64 lProcPlanEntryID)
|
{
|
DataSet oDs;
|
//
|
oDs = oCn.RunProcReturn("exec h_p_Sc_ICMOGetWorkSourceTime_Proc " + lSourceID.ToString() +","+ lProcPlanInterID.ToString() + "," +lProcPlanEntryID.ToString(), "h_p_Sc_ICMOGetWorkSourceTime_Proc");
|
if (oDs == null || oDs.Tables[0].Rows.Count == 0)
|
{
|
return null;
|
}
|
else
|
{
|
return oDs;
|
}
|
//
|
}
|
|
//¸ù¾ÝÎïÁÏ ×ÊÔ´ ¼ÆË㹤ʱ
|
public static void GetWorkTimeByID(SQLHelper.ClsCN oCn, Label slblWorkTime, AxVSFlex7.AxVSFlexGrid grdMain, int HMaterIDCol, int HSorceIDCol, int FixCols)
|
{
|
DataSet oDs;
|
long HMaterID = 0;
|
long HSourceID = 0;
|
double HQty = 0;
|
double HWorkQty = 0;
|
double HWorkTime = 0;
|
int Row = -1;
|
int Rows = -1;
|
int Col = -1;
|
int Cols = -1;
|
//
|
if (grdMain.Row > grdMain.RowSel)
|
{
|
Row = grdMain.RowSel;
|
Rows = grdMain.Row;
|
}
|
else
|
{
|
Row = grdMain.Row;
|
Rows = grdMain.RowSel;
|
}
|
if (grdMain.Col > grdMain.ColSel)
|
{
|
Col = grdMain.ColSel;
|
Cols = grdMain.Col;
|
}
|
else
|
{
|
Col = grdMain.Col;
|
Cols = grdMain.ColSel;
|
}
|
//
|
for (int i = Row; i <= Rows; i++)
|
{
|
HMaterID = DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HMaterIDCol));
|
HSourceID = DBUtility.ClsPub.isLong(grdMain.get_TextMatrix(i, HSorceIDCol));
|
for (int j = Col; j <= Cols; j++)
|
{
|
if (j >= FixCols)
|
{
|
HQty = DBUtility.ClsPub.isDoule(grdMain.get_TextMatrix(i, j));
|
oDs = oCn.RunProcReturn("exec h_p_Gy_GetWorkTime " + HMaterID.ToString() + "," + HSourceID.ToString(), "h_p_Gy_GetWorkTime");
|
if (oDs == null || oDs.Tables[0].Rows.Count == 0)
|
{
|
HWorkTime = HWorkTime;
|
}
|
else
|
{
|
HWorkQty = DBUtility.ClsPub.isDoule(oDs.Tables[0].Rows[0][0]);
|
if (HWorkQty != 0)
|
{
|
HWorkTime = HWorkTime + (HQty / HWorkQty);
|
}
|
else
|
{
|
HWorkTime = HWorkTime;
|
}
|
}
|
}
|
}
|
}
|
//
|
slblWorkTime.Text = DBUtility.ClsPub.isDoule(HWorkTime, 2).ToString();
|
}
|
|
|
|
|
|
|
//½«Êý¾ÝÅų̵½Íø¸ñ
|
public static void SetInfoToGrid(DataGridView grd,DataSet ds,int iRow,ref Single sLeftQty,Single sWorkQty,bool bAddFlag)
|
{
|
//Ñ»·Íø¸ñÁÐ
|
if (bAddFlag)
|
{
|
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
{
|
//ÕÒµ½¶ÔÓ¦µÄÁÐ
|
for (int j = 8; j < grd.ColumnCount; j++)
|
{
|
if (sLeftQty > 0)
|
{
|
if (DBUtility.ClsPub.isDate(ds.Tables[0].Rows[i]["ÈÕÆÚ"]) == DBUtility.ClsPub.isDate(grd.Columns[j].HeaderText))
|
{
|
if (sLeftQty > sWorkQty * DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[i]["×î´óÊ£Ó๤ʱ"]))
|
{
|
grd.Rows[iRow].Cells[j].Value =DBUtility.ClsPub.isLong(sWorkQty * DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[i]["×î´óÊ£Ó๤ʱ"]));
|
sLeftQty = sLeftQty - (DBUtility.ClsPub.isLong(sWorkQty * DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[i]["×î´óÊ£Ó๤ʱ"])));
|
}
|
else
|
{
|
grd.Rows[iRow].Cells[j].Value = sLeftQty;
|
sLeftQty = 0;
|
}
|
}
|
}
|
}
|
|
}
|
|
}
|
else
|
{
|
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
{
|
//ÕÒµ½¶ÔÓ¦µÄÁÐ
|
for (int j = 8; j < grd.ColumnCount; j++)
|
{
|
if (sLeftQty > 0)
|
{
|
if (DBUtility.ClsPub.isDate(ds.Tables[0].Rows[i]["ÈÕÆÚ"]) == DBUtility.ClsPub.isDate(grd.Columns[j].HeaderText))
|
{
|
if (sLeftQty > sWorkQty * DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[i]["Ê£Ó๤ʱ"]))
|
{
|
grd.Rows[iRow].Cells[j].Value = DBUtility.ClsPub.isLong(sWorkQty * DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[i]["Ê£Ó๤ʱ"]));
|
sLeftQty = sLeftQty - (DBUtility.ClsPub.isLong(sWorkQty * DBUtility.ClsPub.isSingle(ds.Tables[0].Rows[i]["Ê£Ó๤ʱ"])));
|
}
|
else
|
{
|
grd.Rows[iRow].Cells[j].Value = sLeftQty;
|
sLeftQty = 0;
|
}
|
}
|
}
|
}
|
}
|
}
|
}
|
|
|
//½»»»ÐÐÄÚÈÝ(Ͻµ)
|
public static void ChangeGridItem(DataGridView grd, int j)
|
{
|
for (int m = 0; m < grd.ColumnCount; m++)
|
{
|
grd.Rows[grd.RowCount - 1].Cells[m].Value = grd.Rows[j].Cells[m].Value;
|
}
|
for (int m = 0; m < grd.ColumnCount; m++)
|
{
|
grd.Rows[j].Cells[m].Value = grd.Rows[j + 1].Cells[m].Value;
|
}
|
for (int m = 0; m < grd.ColumnCount; m++)
|
{
|
grd.Rows[j + 1].Cells[m].Value = grd.Rows[grd.RowCount - 1].Cells[m].Value;
|
}
|
}
|
|
//½»»»ÐÐÄÚÈÝ(ÉÏÉý)
|
public static void ChangeGridItemUp(DataGridView grd, int j)
|
{
|
for (int m = 0; m < grd.ColumnCount; m++)
|
{
|
grd.Rows[grd.RowCount - 1].Cells[m].Value = grd.Rows[j].Cells[m].Value;
|
}
|
for (int m = 0; m < grd.ColumnCount; m++)
|
{
|
grd.Rows[j].Cells[m].Value = grd.Rows[j - 1].Cells[m].Value;
|
}
|
for (int m = 0; m < grd.ColumnCount; m++)
|
{
|
grd.Rows[j - 1].Cells[m].Value = grd.Rows[grd.RowCount - 1].Cells[m].Value;
|
}
|
}
|
|
|
//Ëø¶¨ ½âËø ÈÎÎñµ¥
|
public static void LockICMOBill(bool b, long HICMOInterID, SQLHelper.ClsCN oCn)
|
{
|
if (b)
|
{
|
try
|
{
|
oCn.RunProc("update Sc_WorkBillAutoSortBillMain set HLocked=1 where HICMOInterID=" + HICMOInterID.ToString());
|
return;
|
}
|
catch (Exception e)
|
{
|
return;
|
}
|
}
|
else
|
{
|
try
|
{
|
oCn.RunProc("update Sc_WorkBillAutoSortBillMain set HLocked=0 where HICMOInterID=" + HICMOInterID.ToString());
|
return;
|
}
|
catch (Exception e)
|
{
|
return;
|
}
|
}
|
}
|
|
//
|
|
}
|
}
|