模板上传

This commit is contained in:
14278/caihao 2024-01-18 17:47:59 +08:00
parent af7d978fe2
commit e9f9b0c63e
4 changed files with 945 additions and 100 deletions

View File

@ -57,6 +57,31 @@
<OptionInfer>On</OptionInfer> <OptionInfer>On</OptionInfer>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="iMESWIPReleaseLogHandler, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\MES_S_DLL\iMESWIPReleaseLogHandler.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="kcOE, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\MES_S_DLL\kcOE.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="kcSPC, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\MES_S_DLL\kcSPC.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="kcSYS, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\MES_S_DLL\kcSYS.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="kcWIP, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\MES_S_DLL\kcWIP.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualBasic" /> <Reference Include="Microsoft.VisualBasic" />
<Reference Include="data_access_service, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="data_access_service, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
@ -84,7 +109,7 @@
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="iMESException"> <Reference Include="iMESException">
<HintPath>..\..\MESSeries_2016\MES_S_DLL\iMESException.dll</HintPath> <HintPath>..\MES_S_DLL\iMESException.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="iMESLog, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="iMESLog, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
@ -99,6 +124,14 @@
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="udReverse, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\MES_S_DLL\udReverse.dll</HintPath>
</Reference>
<Reference Include="udWIP, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\MES_S_DLL\udWIP.dll</HintPath>
</Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Import Include="Microsoft.VisualBasic" /> <Import Include="Microsoft.VisualBasic" />

View File

@ -7,6 +7,8 @@ using static iMESCore.Base.iMESComXML;
using static iMESCore.Base.iMESConst; using static iMESCore.Base.iMESConst;
using static iMESCore.DataBase.iMESSql; using static iMESCore.DataBase.iMESSql;
using iMESCore.Settings; using iMESCore.Settings;
using Microsoft.VisualBasic.CompilerServices;
using System.Linq;
namespace MEStc_ABC namespace MEStc_ABC
{ {
@ -21,15 +23,40 @@ namespace MEStc_ABC
* ,使iMESConst.dll * ,使iMESConst.dll
* ,使iMESComSubroutine.dll * ,使iMESComSubroutine.dll
*/ */
private udReverse.clsReverse objReverse = new udReverse.clsReverse();
// 2006/05/10,sammi
private AppSettings objSetting = new AppSettings(); private AppSettings objSetting = new AppSettings();
private clsDBCom objDBCom = new clsDBCom();
private kcSYS.clsSYSUserLog objSYS = new kcSYS.clsSYSUserLog(); // 宣告Sys的物件
private kcWIP.clsLot objLot = new kcWIP.clsLot();
public iMESWIPReleaseLogHandler.clsLotReleaseLogHandle objLotLog;
private string strConnectionString; // Connection string private string strConnectionString; // Connection string
private string strDataBaseType; // DataBase Type:oracle, mysql, access private string strDataBaseType; // DataBase Type:oracle, mysql, access
private string strMQType; // MessageQueue Type:TIBCO, MQSeries, MSMQ private string strMQType; // MessageQueue Type:TIBCO, MQSeries, MSMQ
private bool disposed = false; // To detect redundant calls private bool disposed = false; // To detect redundant calls
private string strSQL = ""; private string strSQL = "";
private const int ActiveId_CI = 1;
private const int ActiveId_CO = 2;
private string strReportConnectionString;
private string strReportDataBaseType;
private string strSQLAddField;
private string strSQLAddValue;
private string strUploadPath; // WebServer放置上傳檔案的實體路徑
private string cModuleNodeId = "N/A";
private string cModuleNo = "N/A";
private string cModuleVersion = "N/A";
private string cStageNo = "N/A";
private int cOPReference = 0;
public string MaxWaitNo = defString;
private string MNewLotSerial;
private string strConnectionString_ERP; // 2016-03-14, Joe, Add
private string strDataBaseType_ERP; // 2016-03-14, Joe, Add
private string strConnectionString_eSOP; // 2016-03-14, Joe, Add
private string strDataBaseType_eSOP; // 2016-03-14, Joe, Add
#region --- Initial Object --- #region --- Initial Object ---
public clsLot() public clsLot()
@ -262,9 +289,7 @@ namespace MEStc_ABC
} }
public string BR_CheckIn(long LotStamp, string LotNo, string LinkName, DataTable dtAttrib, DataTable dtEquipment, string UserNo, string ShiftNo, public string BR_CheckIn(long LotStamp, string LotNo, string LinkName, DataTable dtAttrib, DataTable dtEquipment, string UserNo, string ShiftNo, string LotRecord = defString, DateTime CheckInTime = default(DateTime), string RuleNo = "", DataTable dtLoginState = null, DataTable dtAccessory = null, DataTable dtMTLLot = null, string LanguageMode = defString, DataTable dtEquipmentChamber = null)
string LotRecord = defString, DateTime CheckInTime = default(DateTime), string RuleNo = "", DataTable dtLoginState = null, DataTable dtAccessory = null,
DataTable dtMTLLot = null, string LanguageMode = defString)
{ {
string BR_CheckInRet = default(string); string BR_CheckInRet = default(string);
// 此 Function 將更新CheckIn Data // 此 Function 將更新CheckIn Data
@ -277,7 +302,7 @@ namespace MEStc_ABC
var CollectionSQL_Rows = new Collection(); var CollectionSQL_Rows = new Collection();
string strSQL = ""; string strSQL = "";
string LotSerial, OPNo, BRNo, SerialNo, LogGroupSerial, BaseLotNo, CurQTY; string LotSerial, OPNo, BRNo, SerialNo, LogGroupSerial, BaseLotNo, CurQTY, NodeId;
int PhaseNo; int PhaseNo;
DateTime datEventTime; DateTime datEventTime;
long lngLotStamp; long lngLotStamp;
@ -288,21 +313,21 @@ namespace MEStc_ABC
cnnTemp = CreateConnection(strConnectionString); cnnTemp = CreateConnection(strConnectionString);
// 1.取出Temp LotState的資料 // 1.取出Temp LotState的資料
strSQL = "Select A.LotSerial,A.OPNo,A.SerialNo,B.BRNo,B.LogGroupSerial,B.LotStamp,B.BaseLotNo,B.CurQTY,B.PhaseNo " + strSQL = "Select A.LotSerial,A.OPNo,A.SerialNo,B.BRNo,B.LogGroupSerial,B.LotStamp,B.BaseLotNo,B.CurQTY,B.PhaseNo,B.NodeId " + " From tblWIPTemp_LotState A, tblWIPLotState B " + " Where A.LotNo ='" + LotNo + "'" + " And A.LotNo = B.LotNo ";
" From tblWIPTemp_LotState A, tblWIPLotState B " + " Where A.LotNo ='" + LotNo + "'" + " And A.LotNo = B.LotNo ";
// cmmTemp = New OleDb.OleDbCommand(strSQL, cnnTemp) // cmmTemp = New OleDb.OleDbCommand(strSQL, cnnTemp)
drTemp = ExecuteSQLQuery_Reader(strSQL, cnnTemp); drTemp = ExecuteSQLQuery_Reader(strSQL, cnnTemp);
if (drTemp.Read()) if (drTemp.Read())
{ {
LotSerial = drTemp["LotSerial"].ToString(); LotSerial = Conversions.ToString(drTemp["LotSerial"]);
OPNo = drTemp["OPNo"].ToString(); OPNo = Conversions.ToString(drTemp["OPNo"]);
SerialNo = drTemp["SerialNo"].ToString(); SerialNo = Conversions.ToString(drTemp["SerialNo"]);
BRNo = drTemp["BRNo"].ToString(); BRNo = Conversions.ToString(drTemp["BRNo"]);
LogGroupSerial = drTemp["LogGroupSerial"].ToString(); LogGroupSerial = Conversions.ToString(drTemp["LogGroupSerial"]);
lngLotStamp = Convert.ToInt64(drTemp["LotStamp"]); lngLotStamp = Conversions.ToLong(drTemp["LotStamp"]);
BaseLotNo = drTemp["BaseLotNo"].ToString(); BaseLotNo = Conversions.ToString(drTemp["BaseLotNo"]);
CurQTY = drTemp["CurQTY"].ToString(); CurQTY = Conversions.ToString(drTemp["CurQTY"]);
PhaseNo = Convert.ToInt32(drTemp["PhaseNo"]); // 2020/11/20 Steven Mantis: 0082084: [PAD]eRunCard_調整 BR 生產記錄 PhaseNo = Conversions.ToInteger(drTemp["PhaseNo"]); // 2020/11/20 Steven Mantis: 0082084: [PAD]eRunCard_調整 BR 生產記錄
NodeId = drTemp["NodeId"].ToString(); // 2023/06/05, 0135702: [6.0.7] SDD220425_01-03_進站設備派工查核調整, 19245
} }
else else
{ {
@ -311,13 +336,471 @@ namespace MEStc_ABC
drTemp.Close(); drTemp.Close();
datEventTime = DateTime.Now;
// 若無指定CheckInTime,則同datEventTime.因機時、工時使用CheckInTime,必須一定要有資料.
if (CheckInTime == defDateTime)
{
CheckInTime = datEventTime;
}
// 20210909 13871,生產批下線歷程,add parameter
if (objLotLog == null)
objLotLog = new iMESWIPReleaseLogHandler.clsLotReleaseLogHandle(ActiveId_CI, UserNo, CheckInTime);
if (objLotLog.ColSQL == null)
objLotLog.ColSQL = CollectionSQL;
if (objLotLog.ColSQL_Rows == null)
objLotLog.ColSQL_Rows = CollectionSQL_Rows;
// 寫入管制時間
udWIP.clsWIP objUdWIP;
objUdWIP = new udWIP.clsWIP();
objUdWIP.SHR_LimitedTimeControl_ByBR(ref objReverse, LotNo, LogGroupSerial, LotSerial, UserNo, CheckInTime, ref cnnTemp, ref CollectionSQL);
// 2.Update Temp/Content LotAttrib
objLot.SHR_UpdAttrib(LotNo, LogGroupSerial, ref dtAttrib, ref CollectionSQL, datEventTime);
// 3.Equipment CheckIn
objLot. SHR_CIEquipment(LotNo, LogGroupSerial, LotSerial, LotSerial, UserNo, datEventTime, ref cnnTemp, ref CollectionSQL, ref dtEquipment, SerialNo, dtAccessory: dtAccessory, dtAttrib: dtAttrib, CheckInTime: CheckInTime, EquipmentChamber: dtEquipmentChamber);
// 4.Lot Record
if (!string.IsNullOrEmpty(LotRecord) && (LotRecord ?? "") != defString)
{
strSQL = "Insert into tblWIPCont_LotRecord(LogGroupSerial,BaseLotNo,LotNo,LotSerial,OPNo,LotRecord,UserNo,EventTime)" + " Values('" + LogGroupSerial + "','" + BaseLotNo + "','" + LotNo + "','" + LotSerial + "','" + OPNo + "','" + LotRecord + "','" + UserNo + "'," + "To_Date('" + Strings.Format(datEventTime, "yyyy/MM/dd H:mm:ss") + "','YYYY/MM/DD HH24:MI:SS'))";
CollectionSQL.Add(strSQL);
// Reverse
strSQL = "Delete From tblWIPCont_LotRecord Where LotSerial='" + LotSerial + "'";
Collection argcolSQL_Rows = null;
objReverse.AddReverseUpdateContent(ref LotSerial, ref strSQL, CollectionSQL, colSQL_Rows: argcolSQL_Rows);
}
// 2019/09/06 Eric 存入tblWIPTemp_MaterialLot
if (dtMTLLot != null && dtMTLLot.Rows.Count > 0)
{
foreach (DataRow r in dtMTLLot.Rows)
{
strSQL = "Insert into tblWIPTemp_MaterialLot(LotNo,MaterialNo,MaterialLotNo)" + " Values('" + LotNo + "','" + r["MaterialNo"].ToString() + "','" + r["MaterialLotNo"].ToString() + "')";
CollectionSQL.Add(strSQL);
// Reverse
strSQL = "Delete From tblWIPTemp_MaterialLot Where LotNo='" + LotNo + "' and MaterialNo='" + r["MaterialNo"].ToString() + "' and MaterialLotNo='" + r["MaterialLotNo"].ToString() + "'";
Collection argcolSQL_Rows1 = null;
objReverse.AddReverseUpdateContent(ref LotSerial, ref strSQL, CollectionSQL, colSQL_Rows: argcolSQL_Rows1);
}
}
// 4.5 UPDate tblWIPEQPConsumeState.CurQTY & tblWIPEQPConsumeState.CurPeriod (Undo必須為同一料批才可Undo)
if (dtEquipment != null && dtEquipment.Rows.Count > 0)
{
objLot. SHR_UpdWIPEQPConsumeState(LotSerial, Conversions.ToDecimal(CurQTY), dtEquipment, ref CollectionSQL);
}
// 2020/02/26 Grace Mantis 67753, 取得生產批於作業站中, check in 日期的設備派工資料
if (dtEquipment != null && dtEquipment.Rows.Count > 0)
{
foreach (DataRow dr in dtEquipment.Rows)
{
DataSet dsEQPTemp;
using (var objWIP = new kcWIP.clsWIP())
{
dsEQPTemp = objWIP.ShowWIPEQPDispatchState(dr["EquipmentNo"].ToString(), LotNo, OPNo, CheckInTime);
}
if (!(dsEQPTemp == null))
{
foreach (DataRow drEQP in dsEQPTemp.Tables[0].Rows)
{
using (var objWIP = new kcWIP.clsWIP())
{
// 寫Log
objWIP.AddWIPEQPDispatchLog(dr["EquipmentNo"].ToString(), LotNo, OPNo, CheckInTime, Convert.ToInt32(drEQP["DispatchOrder"]), CollectionSQL);
// Reverse
strSQL = "Delete From tblWIPEQPDispatchLog " + " Where EquipmentNo='" + dr["EquipmentNo"].ToString() + "' " + " And OPNO='" + OPNo + "' " + " And LotNo='" + LotNo + "' " + " And DispatchDate=To_Date('" + Strings.Format(CheckInTime, "yyyy/MM/dd") + "','YYYY/MM/DD') ";
// 2020/04/08 Grace 增加SQL置換, 避免使用MSSQL執行Reverse時報錯
strSQL = SQLCommandTuning(strDataBaseType, ref strSQL);
Collection argcolSQL_Rows2 = null;
objReverse.AddReverseUpdateContent(ref LotSerial, ref strSQL, CollectionSQL, colSQL_Rows: argcolSQL_Rows2);
// 刪除派工 & 調整排序
objWIP.DelWIPEQPDispatchState(dr["EquipmentNo"].ToString(), LotNo, OPNo, CheckInTime, CollectionSQL);
// 取得刪除前的資料
strSQL = "Select * " + " From tblWIPEQPDispatchState Where EquipmentNo='" + dr["EquipmentNo"].ToString() + "' " + " And OPNO='" + OPNo + "' " + " And LotNo='" + LotNo + "' " + " And DispatchDate=To_Date('" + Strings.Format(CheckInTime, "yyyy/MM/dd") + "','YYYY/MM/DD') ";
strSQL = SQLCommandTuning(strDataBaseType, ref strSQL);
// cmmTemp = New OleDb.OleDbCommand(strSQL, cnnTemp)
drTemp = ExecuteSQLQuery_Reader(strSQL, cnnTemp);
if (drTemp.Read())
{
// Reverse
strSQL = Conversions.ToString(" Insert into tblWIPEQPDispatchState(EquipmentNo,LotNo,OPNO,DispatchDate,DispatchOrder,EventUser,EventDate) " + " Values('" + drTemp["EquipmentNo"].ToString() + "','" + LotNo + "','" + OPNo + "',To_Date('" + Strings.Format(drTemp["DispatchDate"], "yyyy/MM/dd") + "','YYYY/MM/DD')," +
drTemp["DispatchOrder"] + "," + " '" + drTemp["EventUser"] + "',To_Date('" + Strings.Format(drTemp["EventDate"], "yyyy/MM/dd H:mm:ss") +
"','YYYY/MM/DD HH24:MI:SS')) ");
// 2020/04/08 Grace 增加SQL置換, 避免使用MSSQL執行Reverse時報錯
strSQL = SQLCommandTuning(strDataBaseType, ref strSQL);
Collection argcolSQL_Rows3 = null;
objReverse.AddReverseUpdateContent(ref LotSerial, ref strSQL, CollectionSQL, colSQL_Rows: argcolSQL_Rows3);
// Reverse
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(drTemp["DispatchOrder"], 1, false)))
{
// <1 找不到資料
strSQL = Conversions.ToString("Update tblWIPEQPDispatchState set DispatchOrder = DispatchOrder + 1 " + " Where EquipmentNo='" + dr["EquipmentNo"].ToString() + "' " + " And OPNo='" + OPNo + "' " + " And DispatchDate=To_Date('" + Strings.Format(CheckInTime, "yyyy/MM/dd") + "','YYYY/MM/DD') " + " And DispatchOrder = " +
drTemp["DispatchOrder"] + "");
// 2020/04/08 Grace 增加SQL置換, 避免使用MSSQL執行Reverse時報錯
strSQL = SQLCommandTuning(strDataBaseType, ref strSQL);
Collection argcolSQL_Rows4 = null;
objReverse.AddReverseUpdateContent(ref LotSerial, ref strSQL, CollectionSQL, colSQL_Rows: argcolSQL_Rows4);
}
else
{
strSQL = Conversions.ToString("Update tblWIPEQPDispatchState set DispatchOrder = DispatchOrder + 1 " + " Where EquipmentNo='" + dr["EquipmentNo"].ToString() + "' " + " And OPNo='" + OPNo + "' " + " And DispatchDate=To_Date('" + Strings.Format(CheckInTime, "yyyy/MM/dd") + "','YYYY/MM/DD') " + " And DispatchOrder < " +
drTemp["DispatchOrder"] + "");
// 2020/04/08 Grace 增加SQL置換, 避免使用MSSQL執行Reverse時報錯
strSQL = SQLCommandTuning(strDataBaseType, ref strSQL);
Collection argcolSQL_Rows5 = null;
objReverse.AddReverseUpdateContent(ref LotSerial, ref strSQL, CollectionSQL, colSQL_Rows: argcolSQL_Rows5);
}
}
drTemp.Close();
}
}
}
}
}
//2023/07/24, 0141393: [SA QA]RTD生产批进站成功后删除派工现况表方式调整 ,19245
////2023/06/05, 0135702: [6.0.7] SDD220425_01-03_進站設備派工查核調整, 19245
//if (dtEquipment != null && dtEquipment.Rows.Count > 0)
//{
// foreach (DataRow dr in dtEquipment.Rows)
// {
// DataSet dsEQPTemp;
// using (var objWIP = new kcWIP.clsWIP())
// {
// dsEQPTemp = objWIP.ShowWIPEQPLOTDISPATCH(dr["EquipmentNo"].ToString(), LotNo, OPNo, NodeId, CheckInTime);
// }
// if (dsEQPTemp != null && dsEQPTemp.Tables[0].Rows.Count > 0)
// {
// foreach (DataRow drEQP in dsEQPTemp.Tables[0].Rows)
// {
// using (var objWIP = new kcWIP.clsWIP())
// {
// // 寫Log
// objWIP.AddWIPEQPLOTDISPATCHLOG(dr["EquipmentNo"].ToString(), LotNo, OPNo, NodeId, CheckInTime, CollectionSQL);
// // Reverse
// strSQL = "Delete From tblWIPEQPLotDispatchLog " +
// " Where EquipmentNo='" + dr["EquipmentNo"].ToString() + "' " +
// " And OPNO='" + OPNo + "' " +
// " And LotNo='" + LotNo + "' " +
// " And NodeId='" + NodeId + "' " +
// " And DispatchDate=To_Date('" + Strings.Format(CheckInTime, "yyyy/MM/dd") + "','YYYY/MM/DD') ";
// strSQL = SQLCommandTuning(strDataBaseType, ref strSQL);
// objReverse.AddReverseUpdateContent(ref LotSerial, ref strSQL, CollectionSQL);
// // 刪除派工
// objWIP.DelWIPEQPLOTDISPATCHSTATE(dr["EquipmentNo"].ToString(), LotNo, OPNo, NodeId, CheckInTime, CollectionSQL);
// // 取得刪除前的資料
// strSQL = "Select * " +
// " From tblWIPEQPLotDispatchState Where EquipmentNo='" + dr["EquipmentNo"].ToString() + "' " +
// " And OPNO='" + OPNo + "' " +
// " And LotNo='" + LotNo + "' " +
// " And NodeId='" + NodeId + "' " +
// " And DispatchDate=To_Date('" + Strings.Format(CheckInTime, "yyyy/MM/dd") + "','YYYY/MM/DD') ";
// strSQL = SQLCommandTuning(strDataBaseType, ref strSQL);
// drTemp = ExecuteSQLQuery_Reader(strSQL, cnnTemp);
// if (drTemp.Read())
// {
// // Reverse
// strSQL = " Insert into tblWIPEQPLotDispatchState(EquipmentNo,LotNo,OPNO,NodeId,DispatchDate,DispatchOrder,DispatchType,DispatchShift,EventUser,EventDate) " +
// " Values('" + drTemp["EquipmentNo"].ToString() + "','" + LotNo + "','" + OPNo + "','" + NodeId +
// "',To_Date('" + Strings.Format(drTemp["DispatchDate"], "yyyy/MM/dd") + "','YYYY/MM/DD'),'" +
// drTemp["DispatchOrder"] + "','" + drTemp["DispatchType"] + "','" + drTemp["DispatchShift"] +
// "','" + drTemp["EventUser"] + "',To_Date('" +
// Strings.Format(drTemp["EventDate"], "yyyy/MM/dd H:mm:ss") + "','YYYY/MM/DD HH24:MI:SS')) ";
// strSQL = SQLCommandTuning(strDataBaseType, ref strSQL);
// objReverse.AddReverseUpdateContent(ref LotSerial, ref strSQL, CollectionSQL);
// }
// drTemp.Close();
// }
// }
// }
// else // 與現況的設備不符合 仍進站
// {
// using (var objWIP = new kcWIP.clsWIP())
// {
// // 寫Log
// objWIP.AddWIPEQPLOTDISPATCHLOG(dr["EquipmentNo"].ToString(), LotNo, OPNo, NodeId, CheckInTime, CollectionSQL, true);
// // Reverse
// strSQL = "Delete From tblWIPEQPLotDispatchLog " +
// " Where EquipmentNo='" + dr["EquipmentNo"].ToString() + "' " +
// " And OPNO='" + OPNo + "' " +
// " And LotNo='" + LotNo + "' " +
// " And NodeId='" + NodeId + "' ";
// strSQL = SQLCommandTuning(strDataBaseType, ref strSQL);
// objReverse.AddReverseUpdateContent(ref LotSerial, ref strSQL, CollectionSQL);
// // 刪除派工,,不須傳入設備
// objWIP.DelWIPEQPLOTDISPATCHSTATE(defString, LotNo, OPNo, NodeId, CheckInTime, CollectionSQL, true);
// // 取得刪除前的資料
// strSQL = "Select * " +
// " From tblWIPEQPLotDispatchState Where OPNO='" + OPNo + "' " +
// " And LotNo='" + LotNo + "' " +
// " And NodeId='" + NodeId + "' ";
// strSQL = SQLCommandTuning(strDataBaseType, ref strSQL);
// drTemp = ExecuteSQLQuery_Reader(strSQL, cnnTemp);
// DataTable dtTemp = new DataTable();
// dtTemp.Load(drTemp);
// drTemp.Close();
// if (dtTemp.Rows.Count > 0)
// {
// foreach (DataRow drData in dtTemp.Rows)
// {
// // Reverse
// strSQL = " Insert into tblWIPEQPLotDispatchState(EquipmentNo,LotNo,OPNO,NodeId,DispatchDate,DispatchOrder,DispatchType,DispatchShift,EventUser,EventDate) " +
// " Values('" + drData["EquipmentNo"].ToString() + "','" + LotNo + "','" + OPNo + "','" + NodeId +
// "',To_Date('" + Strings.Format(drData["DispatchDate"], "yyyy/MM/dd") + "','YYYY/MM/DD'),'" +
// drData["DispatchOrder"] + "','" + drData["DispatchType"] + "','" + drData["DispatchShift"] +
// "','" + drData["EventUser"] + "',To_Date('" +
// Strings.Format(drData["EventDate"], "yyyy/MM/dd H:mm:ss") + "','YYYY/MM/DD HH24:MI:SS')) ";
// strSQL = SQLCommandTuning(strDataBaseType, ref strSQL);
// objReverse.AddReverseUpdateContent(ref LotSerial, ref strSQL, CollectionSQL);
// }
// }
// }
// }
// }
//}
// 5.變更LotState--------------------------------------------------------------------------------------------------
if (LinkName == "HOLD")
{
// 因BR已執行完成,故Hold解除的續Go狀態為Complete(4)
int argGoStatus = 4;
objLot.funSetLotStateToERFCreate(ref LotNo, ref argGoStatus, ref datEventTime, ref CollectionSQL, EventUserNo: UserNo);
}
else if (LinkName == "WAIT")
{
// 因BR已執行完成,故Wait解除的續Go狀態為Complete(4)
// RuleNo Added by Jialing 2011/02/18 將RuleNo填入WAIT說明
// 已登錄之多人加工必須登出.
int argGoStatus1 = 4;
objLot.funSetLotStateToWait(ref LotNo, ref argGoStatus1, ref datEventTime, ref CollectionSQL, EventUserNo: UserNo, LotStamp: lngLotStamp, WaitDescription: RuleNo, COMultiUser: true);
}
else
{
// 4代表成功完成BR,紀錄LinkName若TransferLot失敗可以重新再執行TransferLot
int argStatus = 4;
objLot.funSetLotStateToOther(ref LotNo, ref argStatus, ref datEventTime, ref CollectionSQL, LinkName, EventUserNo: UserNo);
}
// 6.變更LotLog & Add Cont_Employee--------------------------------------------------------------------------------
objLot.SHR_UpdLog(LotNo, LotSerial, LogGroupSerial, OPNo, BRNo, "BR_CheckIn", ShiftNo, UserNo, datEventTime, LinkName, ref CollectionSQL, Check_In_Out_Time: CheckInTime, PhaseNo: PhaseNo);
// 7.變更LotLog_Report
objLot.SHR_UpdLogReport(ref cnnTemp, ref CollectionSQL, LogGroupSerial, LotSerial, CheckInTime);
// 2015-12-11, Joe, SPC
using (var objSPC = new kcSPC.clsSPC())
{
objSPC.UpdSPCContorl_Var(LotNo, UserNo, ref dtAttrib, ref CollectionSQL);
}
// 2017/10/28,Sammi.取消舊的多人加工機制,改用新的上工下工.
// 2017/12/01,Sammi.人時AutoRun平攤需求,將上工下工資料,整合入舊的多人加工機制.
using (var obj = new kcWIP.clsOperatorState())
{
obj.SHR_CI_EMP(ref cnnTemp, ref CollectionSQL, ref objReverse, 1, 1, UserNo, datEventTime, CheckInTime, LotNo, OPNo, LogGroupSerial, LotSerial, dtEquipment);
}
// If LinkName = "WAIT" Then
// Call SHR_CIMultiUser_CO(CollectionSQL, 1, 1, LotNo, BaseLotNo, OPNo, LogGroupSerial, LotSerial, UserNo, datEventTime, dtLoginState)
// Else
// Call SHR_CIMultiUser(CollectionSQL, 1, 1, LotNo, BaseLotNo, OPNo, LogGroupSerial, LotSerial, UserNo, datEventTime, dtLoginState)
// End If
// 2017/09/25 YF, 叫用工單達交率處理者,判斷是否回寫實際開工日
// 2020/03/17 OwenLiu, Mantis:0068929 工單實際開工日/工單實際完工日 調整還原機制的共用處理
new kcOE.WorkOrderRateHandler().ActualStartDateProcess(pLotNo: LotNo, pLotSerial: LotSerial, pEventTime: CheckInTime, pCollectionSQL: CollectionSQL, objReverse: objReverse);
// 20200424 Edison 70441: [605標準版]L_CI_GEN 品檢卡控
// ======================================= 70441 Start =======================================
// 81459 新增品檢結果資料表
string strQCFormNo = ""; // 檢驗單號
var ErrorMsg = new Collection();
string strExpMsg = "";
string MailErrorMsg = "";
var dtInspResult = new DataTable("InspResult");
dtInspResult.Columns.Add("EquipmentNo", Type.GetType("System.String"));
dtInspResult.Columns.Add("EquipmentName", Type.GetType("System.String"));
dtInspResult.Columns.Add("QCItemNo", Type.GetType("System.String"));
dtInspResult.Columns.Add("QCItemName", Type.GetType("System.String"));
dtInspResult.Columns.Add("QCItemType", Type.GetType("System.String"));
dtInspResult.Columns.Add("InspType", Type.GetType("System.String"));
dtInspResult.Columns.Add("InspTypeName", Type.GetType("System.String"));
dtInspResult.Columns.Add("MailGroupNo", Type.GetType("System.String"));
dtInspResult.Columns.Add("CCMailGroupNo", Type.GetType("System.String"));
foreach (DataRow rEQP in dtEquipment.Rows)
{
objLot.ChkQCInspection(ref MailErrorMsg, LotNo, OPNo, Conversions.ToString(rEQP["EquipmentNo"]), ref CollectionSQL, UserNo: UserNo, EventTime: datEventTime, ErrorMsg: ErrorMsg, dtInspResult: dtInspResult, LanguageMode: LanguageMode);
if (ErrorMsg.Count > 0)
{
strExpMsg = Conversions.ToString("[%EquipmentNo%]: " + rEQP["EquipmentNo"] + " " + Constants.vbCrLf + " ");
break;
}
}
if (ErrorMsg.Count > 0)
{
// ===== 自動開立PQC檢驗單
string QCFormNo;
var ds = new DataSet();
DataTable dt;
DataTable chkdt;
ds = objLot.ShowLotBasisJoinState(LotNo: LotNo);
DataRow[] drSel;
drSel = ds.Tables[0].Select("LotNo = '" + LotNo + "'");
if (drSel.Length > 0)
{
string ProductNo = drSel[0]["ProductNo"].ToString();
string ProductVersion = drSel[0]["ProductVersion"].ToString();
string CustomerNo = drSel[0]["CustomerNo"].ToString();
string Qty = drSel[0]["CurQty"].ToString();
string strIsValid = "1";
using (var objSPC = new kcSPC.clsSPC())
{
dt = dtInspResult.DefaultView.ToTable(true, "QCItemNo", "QCItemName", "QCItemType", "InspType");
chkdt = dtInspResult.DefaultView.ToTable(true, "QCItemNo", "QCItemName");
string strQCItemNo_Exis;
var dtChkQCFormNo = new DataTable("ChkQCFormNo");
dtChkQCFormNo.Columns.Add("QCFormNo", Type.GetType("System.String"));
for (int k = 0, loopTo = chkdt.Rows.Count - 1; k <= loopTo; k++)
{
strSQL = " Select Distinct A.*,B.STATUS From tblSPCIPQCFormQCItemMap A ";
strSQL = strSQL + " Left Join TBLSPCIPQCFORM B on A.QCFORMNO=B.QCFORMNO ";
strSQL = strSQL + " where A.QCItemNo = '" + chkdt.Rows[k]["QCItemNo"].ToString() + "' AND B.STATUS IN (0,1,2) AND B.LOTNO = '" + LotNo + "'";
strSQL = SQLCommandTuning(strDataBaseType, ref strSQL);
// cmmTemp = New OleDb.OleDbCommand(strSQL, cnnTemp)
drTemp = ExecuteSQLQuery_Reader(strSQL, cnnTemp);
if (drTemp.HasRows)
{
string chkStr = string.Empty;
while (drTemp.Read()) // 找出未確認,待驗,已驗中項目所屬單號
{
var dr = dtChkQCFormNo.NewRow();
dr["QCFormNo"] = drTemp["QCFormNo"].ToString();
dtChkQCFormNo.Rows.Add(dr);
}
DataRow[] delRow;
delRow = dt.Select("QCItemNo = '" + chkdt.Rows[k]["QCItemNo"].ToString() + "'"); // 已存在項目不需重複開單,移除
if (delRow.Count() > 0)
{
for (int CntRow = 0, loopTo1 = delRow.Count() - 1; CntRow <= loopTo1; CntRow++)
dt.Rows.Remove(delRow[CntRow]);
}
strQCItemNo_Exis = chkdt.Rows[k]["QCItemNo"].ToString() + ",";
}
drTemp.Close();
}
dtChkQCFormNo = dtChkQCFormNo.DefaultView.ToTable(true); // 過濾重複單號,供前端顯示
foreach (DataRow drRow in dtChkQCFormNo.Rows)
{
QCFormNo = Conversions.ToString(drRow["QCFormNo"]);
strQCFormNo += QCFormNo + ",";
}
if (dt.Rows.Count > 0)
{
for (int j = 0; j <= 8; j++)
{
DataRow[] drSel_A;
drSel_A = dt.Select("InspType = " + j + ""); // 找出檢驗頻率,一種頻率開出一張單
if (drSel_A.Count() > 0)
{
using (var objSYSEng = new kcSYS.clsSYSEng())
{
QCFormNo = objSYSEng.GetIPQCFormNo(true);
strQCFormNo += QCFormNo + ",";
}
objSPC.AddIPQCForm(QCFormNo, ProductNo, Conversions.ToDecimal(Qty), CustomerNo, LotNo, UserNo, OPNo: OPNo, ProductVersion: ProductVersion, S_OffLineHold: Conversions.ToInteger(false));
for (int i = 0, loopTo2 = drSel_A.Count() - 1; i <= loopTo2; i++)
{
objSPC.AddIPQCFormQCItemMap(QCFormNo, drSel_A[i]["QCItemNo"].ToString(), drSel_A[i]["QCItemName"].ToString(), drSel_A[i]["QCItemType"].ToString());
DataRow[] delRow;
delRow = dt.Select("QCItemNo = '" + drSel_A[i]["QCItemNo"].ToString() + "'");
if (delRow.Count() > 0)
{
for (int CntRow = 0, loopTo3 = delRow.Count() - 1; CntRow <= loopTo3; CntRow++)
dt.Rows.Remove(delRow[CntRow]);
}
}
}
}
}
}
}
strQCFormNo = strQCFormNo.TrimEnd(',');
// =====
if (!string.IsNullOrEmpty(MailErrorMsg))
{
strExpMsg += MailErrorMsg + Constants.vbCrLf;
}
strExpMsg = "[%QC Inspection Items Has Not been Completed%],[%Please Execute PQC Inspection%]" + Constants.vbCrLf;
// For i As Integer = 1 To ErrorMsg.Count
strExpMsg += "[%IPQCNO%]: " + strQCFormNo;
// Next
throw new iMESException.MESException("IPQCNO", strExpMsg);
}
// 2020/11/20 Reo Mantis 82084 [PAD]eRunCard_調整 BR 生產記錄
objLot.UpdWIPRuleCheckLog(LogGroupSerial, datEventTime, colSQL: CollectionSQL);
// ======================================= 70441 End =======================================
// 8.檢查是否允許執行
for (int i = 1, loopTo4 = CollectionSQL.Count; i <= loopTo4; i++)
CollectionSQL_Rows.Add(-1);
// 12.檢查是否允許執行
objLot.ChkLotStamp_RowCount(ref cnnTemp, ref CollectionSQL, ref CollectionSQL_Rows, LotNo, LotStamp);
// 20210909 13871,生產批下線歷程
objLotLog.funCreateSQL(LotNo: LotNo, SysActiveId: ActiveId_CI, ReferenceLotNo: LotNo);
if (LinkName == "WAIT")
{
var objWaitData = new iMESWIPReleaseLogHandler.clsLotReleaseLogHandle.clsLotData.clsWait()
{ WaitType = 0, WaitNo = MaxWaitNo };
objLotLog.funCreateSQL(WaitData: objWaitData, LotNo: LotNo, SysActiveId: 11, ReferenceLotNo: LotNo);
}
// 呼叫執行SQL指令 // 呼叫執行SQL指令
ExecuteSQLNoneQuery_ChkRowCount(strDataBaseType, strConnectionString, CollectionSQL, CollectionSQL_Rows); ExecuteSQLNoneQuery_ChkRowCount(strDataBaseType, strConnectionString, CollectionSQL, CollectionSQL_Rows);
// //Return success // //Return success
BR_CheckInRet = "success"; BR_CheckInRet = "success";
} }
catch (Exception e1) catch (Exception e1)
{ {
BR_CheckInRet = "fail"; BR_CheckInRet = "fail";
@ -331,7 +814,5 @@ namespace MEStc_ABC
return BR_CheckInRet; return BR_CheckInRet;
} }
} }
} }

View File

@ -54,6 +54,14 @@
<OptionInfer>On</OptionInfer> <OptionInfer>On</OptionInfer>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="kcWIP, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\MES_S_DLL\kcWIP.dll</HintPath>
</Reference>
<Reference Include="MEStc_ABC, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\MES_S_DLL\MEStc_ABC.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualBasic" /> <Reference Include="Microsoft.VisualBasic" />
<Reference Include="iMESAppSetting, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="iMESAppSetting, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>

View File

@ -4,6 +4,9 @@ using static iMESCore.Base.iMESComSubroutine;
using static iMESCore.Base.iMESComXML; using static iMESCore.Base.iMESComXML;
using static iMESCore.Base.iMESConst; using static iMESCore.Base.iMESConst;
using iMESCore.Settings; using iMESCore.Settings;
using System.Web.Services;
using System.Data;
using Microsoft.VisualBasic.CompilerServices;
namespace wsABC namespace wsABC
{ {
@ -21,8 +24,9 @@ namespace wsABC
private string strMessage; // Message XML字串 private string strMessage; // Message XML字串
private string strServiceName = "wsWIP_ABC"; // ServiceName private string strServiceName = "wsWIP_ABC"; // ServiceName
private string strResourceDir = "Resources"; private string strResourceDir = "Resources";
private kcWIP.clsLot objLot = new kcWIP.clsLot();
private kcSYS.clsSYSUserLog objSYS = new kcSYS.clsSYSUserLog(); // 宣告Sys的物件 private kcSYS.clsSYSUserLog objSYS = new kcSYS.clsSYSUserLog(); // 宣告Sys的物件
private MEStc_ABC.clsLot clsLot = new MEStc_ABC.clsLot(); // 宣告Sys的物件
public wsWIP() public wsWIP()
{ {
@ -39,93 +43,412 @@ namespace wsABC
return "HelloWorld"; return "HelloWorld";
} }
[WebMethod(Description = "Execute Check In by LotNo")]
public string Exe_CheckIn(string InXml)
{
string Exe_CheckInRet = default(string);
//public string LoadOPMaterialState(string InXml) long LotStamp;
//{ string LotNo = default(string), LinkName, UserNo = default(string);
// string LoadOPMaterialStateRet = null;
// // 先給預設值,以判斷是否有傳入該參數 DataTable dtAttrib;
// string OPNo = defString; DataTable dtEquipment;
// string MaterialNo = defString; DataTable dtEquipmentChamber;
// string MaterialLotNo = defString; DataRow drData;
// string UnitNo = defString;
// string MaterialType = defString;
// ArriveTime = DateTime.Now; DataTable dtMTLLot;
// try System.Xml.XmlNodeList xmlList;
// { string ShiftNo = "N/A";
// // 讀取InXml字串 string LotRecord = defString;
// xmlDoc.LoadXml(InXml); int i;
// // 組Identity字串 var CheckInTime = defDateTime;
// strIdentity = CombineXMLIdentity(Environment.MachineName, GetXMLCurUserNo(xmlDoc), ArriveTime.ToString(defDateTimeFormat)); string RuleNo = ""; // Added by Jialing 2011/02/18
// // 判斷是否有傳入OPNo,若有,表示要依OPNo查詢 ArriveTime = DateTime.Now;
// if (xmlDoc.DocumentElement.GetElementsByTagName("opno").Count > 0)
// {
// if (xmlDoc.GetElementsByTagName("opno").Item(0).SelectNodes("value").Count > 0)
// {
// OPNo = xmlDoc.DocumentElement.GetElementsByTagName("opno").Item(0).SelectNodes("value").Item(0).InnerText;
// }
// }
// // 判斷是否有傳入MaterialNo,若有,表示要依MaterialNo查詢
// if (xmlDoc.DocumentElement.GetElementsByTagName("materialno").Count > 0)
// {
// if (xmlDoc.GetElementsByTagName("materialno").Item(0).SelectNodes("value").Count > 0)
// {
// MaterialNo = xmlDoc.DocumentElement.GetElementsByTagName("materialno").Item(0).SelectNodes("value").Item(0).InnerText;
// }
// }
// // 判斷是否有傳入MaterialLotNo,若有,表示要依MaterialLotNo查詢
// if (xmlDoc.DocumentElement.GetElementsByTagName("materiallotno").Count > 0)
// {
// if (xmlDoc.GetElementsByTagName("materiallotno").Item(0).SelectNodes("value").Count > 0)
// {
// MaterialLotNo = xmlDoc.DocumentElement.GetElementsByTagName("materiallotno").Item(0).SelectNodes("value").Item(0).InnerText;
// }
// }
// if (xmlDoc.DocumentElement.GetElementsByTagName("unitno").Count > 0)
// {
// if (xmlDoc.GetElementsByTagName("unitno").Item(0).SelectNodes("value").Count > 0)
// {
// UnitNo = xmlDoc.DocumentElement.GetElementsByTagName("unitno").Item(0).SelectNodes("value").Item(0).InnerText;
// }
// }
// if (xmlDoc.DocumentElement.GetElementsByTagName("materialtype").Count > 0)
// {
// if (xmlDoc.GetElementsByTagName("materialtype").Item(0).SelectNodes("value").Count > 0)
// {
// MaterialType = xmlDoc.DocumentElement.GetElementsByTagName("materialtype").Item(0).SelectNodes("value").Item(0).InnerText;
// }
// }
// // 呼叫Dll執行 try
// //strReturnValue = objWIP.LoadOPMaterialState(OPNo, MaterialNo, MaterialLotNo, UnitNo, MaterialType); {
// strException = ""; // 讀取InXml字串
// strResult = "success"; xmlDoc.LoadXml(InXml);
// } UserNo = GetXMLCurUserNo(xmlDoc);
// catch (iMESException.MESException ex) // 組Identity字串
// { strIdentity = CombineXMLIdentity(Environment.MachineName, UserNo, Conversions.ToString(ArriveTime));
// strReturnValue = "";
// strException = CombineXMLException(ex.ErrorCode.ToString(), TranslateMsg(ex.Message, GetXMLLanguageMode(xmlDoc), strResourceDir), "Load OP Material State Fail!!", ex.StackTrace);
// strResult = "fail";
// }
// catch (Exception ex) // 開始解譯InXml字串
// { if (xmlDoc.DocumentElement.GetElementsByTagName("lotstamp").Count > 0)
// strReturnValue = ""; {
// strException = CombineXMLException(defWSErrCode, ex.Message, "Load OP Material State Fail!!", ex.StackTrace); if (xmlDoc.GetElementsByTagName("lotstamp").Item(0).SelectNodes("value").Count > 0)
// strResult = "fail"; {
// } LotStamp = Conversions.ToLong(xmlDoc.DocumentElement.GetElementsByTagName("lotstamp").Item(0).SelectNodes("value").Item(0).InnerText);
}
else
{
throw new iMESException.MESException("0000-200002", "[%LotStamp%] [%Not Found%]");
}
}
else
{
throw new iMESException.MESException("0000-200002", "[%LotStamp%] [%Not Found%]");
}
if (xmlDoc.DocumentElement.GetElementsByTagName("lotno").Count > 0)
{
if (xmlDoc.GetElementsByTagName("lotno").Item(0).SelectNodes("value").Count > 0)
{
LotNo = xmlDoc.DocumentElement.GetElementsByTagName("lotno").Item(0).SelectNodes("value").Item(0).InnerText;
}
else
{
throw new iMESException.MESException("0000-200002", "[%LotNo%] [%Not Found%]");
}
}
else
{
throw new iMESException.MESException("0000-200002", "[%LotNo%] [%Not Found%]");
}
if (xmlDoc.DocumentElement.GetElementsByTagName("linkname").Count > 0)
{
if (xmlDoc.GetElementsByTagName("linkname").Item(0).SelectNodes("value").Count > 0)
{
LinkName = xmlDoc.DocumentElement.GetElementsByTagName("linkname").Item(0).SelectNodes("value").Item(0).InnerText;
}
else
{
throw new iMESException.MESException("0000-200002", "[%LinkName%] [%Not Found%]");
}
}
else
{
throw new iMESException.MESException("0000-200002", "[%LinkName%] [%Not Found%]");
}
// Added by Jialing 2011/02/18
if (xmlDoc.DocumentElement.GetElementsByTagName("ruleno").Count > 0)
{
if (xmlDoc.GetElementsByTagName("ruleno").Item(0).SelectNodes("value").Count > 0)
{
RuleNo = xmlDoc.DocumentElement.GetElementsByTagName("ruleno").Item(0).SelectNodes("value").Item(0).InnerText;
}
}
if (xmlDoc.DocumentElement.GetElementsByTagName("shiftno").Count > 0)
{
if (xmlDoc.GetElementsByTagName("shiftno").Item(0).SelectNodes("value").Count > 0)
{
ShiftNo = xmlDoc.DocumentElement.GetElementsByTagName("shiftno").Item(0).SelectNodes("value").Item(0).InnerText;
}
}
if (xmlDoc.DocumentElement.GetElementsByTagName("lotrecord").Count > 0)
{
if (xmlDoc.GetElementsByTagName("lotrecord").Item(0).SelectNodes("value").Count > 0)
{
LotRecord = xmlDoc.DocumentElement.GetElementsByTagName("lotrecord").Item(0).SelectNodes("value").Item(0).InnerText;
}
}
// finally // 加入CheckIntime By carl 2007/06/04
// { if (xmlDoc.DocumentElement.GetElementsByTagName("checkintime").Count > 0)
// // 將各部份之XML字串組起來並傳出 {
// LoadOPMaterialStateRet = CombineXMLResponse(strIdentity, strReturnValue, strException, strResult, ""); if (xmlDoc.GetElementsByTagName("checkintime").Item(0).SelectNodes("value").Count > 0)
// } {
// return LoadOPMaterialStateRet; CheckInTime = Conversions.ToDate(xmlDoc.DocumentElement.GetElementsByTagName("checkintime").Item(0).SelectNodes("value").Item(0).InnerText);
}
}
//} // 1.取出CheckIn Data, Attrib --------------------------------------------------------------------------------------------
// <attrib>
// <name>..</name> <type>..</type>
// <value>
// <attribno>..</attribno>
// <attribtype>..</attribtype>
// <attribsequence>..</attribsequence>
// <attribsource>..</attribsource>
// <attribphase>..</attribphase>
// <attribvalue>..</attribvalue>
// </value>
// <desc></desc>
// </attrib>
dtAttrib = new DataTable("Attrib");
dtAttrib.Columns.Add("AttribNo", Type.GetType("System.String"));
dtAttrib.Columns.Add("AttribType", Type.GetType("System.Int32"));
dtAttrib.Columns.Add("AttribSequence", Type.GetType("System.Int32"));
dtAttrib.Columns.Add("AttribSource", Type.GetType("System.Int32"));
dtAttrib.Columns.Add("AttribPhase", Type.GetType("System.Int32"));
dtAttrib.Columns.Add("AttribValue", Type.GetType("System.String"));
dtAttrib.Columns.Add("SaveToLotPropertyNo", Type.GetType("System.String"));
// 2015-12-16, Joe, Add
dtAttrib.Columns.Add("TestValue", Type.GetType("System.String"));
dtAttrib.Columns.Add("QCItemNo", Type.GetType("System.String"));
dtAttrib.Columns.Add("Result", Type.GetType("System.String"));
dtAttrib.Columns.Add("Result_INT", Type.GetType("System.Int32"));
dtAttrib.Columns.Add("FactorSerial", Type.GetType("System.String"));
dtAttrib.Columns.Add("SerialNo", Type.GetType("System.Int32"));
dtAttrib.Columns.Add("MEMO", Type.GetType("System.String"));
dtAttrib.Columns.Add("ComponentNo", Type.GetType("System.String"));
if (xmlDoc.DocumentElement.GetElementsByTagName("attrib").Count > 0)
{
if (xmlDoc.GetElementsByTagName("attrib").Item(0).SelectNodes("value").Count > 0)
{
xmlList = xmlDoc.GetElementsByTagName("attrib").Item(0).SelectNodes("value");
var loopTo = xmlList.Count - 1;
for (i = 0; i <= loopTo; i++)
{
if (xmlList[i].SelectNodes("attribno").Count == 0 | xmlList[i].SelectNodes("attribtype").Count == 0 | xmlList[i].SelectNodes("attribsequence").Count == 0 | xmlList[i].SelectNodes("attribsource").Count == 0 | xmlList[i].SelectNodes("attribphase").Count == 0 | xmlList[i].SelectNodes("attribvalue").Count == 0)
{
throw new iMESException.MESException("0000-200002", "[%AttribNo%], [%AttribType%], [%AttribSequence%], [%AttribSource%], [%AttribPhase%], [%AttribValue%] [%cannotbeempty%]");
}
// 將資料存入暫存Table
drData = dtAttrib.NewRow();
drData["AttribNo"] = xmlList[i].SelectNodes("attribno").Item(0).InnerText;
drData["AttribType"] = xmlList[i].SelectNodes("attribtype").Item(0).InnerText;
drData["AttribSequence"] = xmlList[i].SelectNodes("attribsequence").Item(0).InnerText;
drData["AttribSource"] = xmlList[i].SelectNodes("attribsource").Item(0).InnerText;
drData["AttribPhase"] = xmlList[i].SelectNodes("attribphase").Item(0).InnerText;
drData["AttribValue"] = xmlList[i].SelectNodes("attribvalue").Item(0).InnerText;
if (xmlList[i].SelectNodes("savetolotpropertyno").Count > 0)
{
drData["SaveToLotPropertyNo"] = xmlList[i].SelectNodes("savetolotpropertyno").Item(0).InnerText;
}
else
{
drData["SaveToLotPropertyNo"] = "";
}
// 2015-12-16, Joe, Add
drData["TestValue"] = xmlList[i].SelectNodes("attribvalue").Item(0).InnerText;
if (xmlList[i].SelectNodes("qcitemno").Count > 0)
{
drData["QCItemNo"] = xmlList[i].SelectNodes("qcitemno").Item(0).InnerText;
}
if (xmlList[i].SelectNodes("result").Count > 0)
{
drData["Result"] = xmlList[i].SelectNodes("result").Item(0).InnerText;
}
if (xmlList[i].SelectNodes("result_int").Count > 0 && !string.IsNullOrEmpty(xmlList[i].SelectNodes("result_int").Item(0).InnerText))
{
if (Information.IsNumeric(xmlList[i].SelectNodes("result_int").Item(0).InnerText))
{
drData["Result_INT"] = xmlList[i].SelectNodes("result_int").Item(0).InnerText;
}
else
{
throw new iMESException.MESException("0000-200011", "Result_INT must be numeric");
}
}
if (xmlList[i].SelectNodes("factorserial").Count > 0)
{
drData["FactorSerial"] = xmlList[i].SelectNodes("factorserial").Item(0).InnerText;
}
if (xmlList[i].SelectNodes("serialno").Count > 0 && !string.IsNullOrEmpty(xmlList[i].SelectNodes("serialno").Item(0).InnerText))
{
drData["SerialNo"] = xmlList[i].SelectNodes("serialno").Item(0).InnerText;
}
dtAttrib.Rows.Add(drData);
}
}
}
// 2.取出CheckIn Data, Equipment --------------------------------------------------------------------------------------------
// <equipment>
// <name>..</name> <type>..</type>
// <value>
// <equipmentno>..</equipmentno>
// <loadport>..</loadport>
// </value>
// <desc></desc>
// </equipment>
dtEquipment = new DataTable("Equipment");
dtEquipment.Columns.Add("EquipmentNo", Type.GetType("System.String"));
dtEquipment.Columns.Add("LoadPort", Type.GetType("System.Int16"));
if (xmlDoc.DocumentElement.GetElementsByTagName("equipment").Count > 0)
{
if (xmlDoc.GetElementsByTagName("equipment").Item(0).SelectNodes("value").Count > 0)
{
xmlList = xmlDoc.GetElementsByTagName("equipment").Item(0).SelectNodes("value");
var loopTo1 = xmlList.Count - 1;
for (i = 0; i <= loopTo1; i++)
{
if (xmlList[i].SelectNodes("equipmentno").Count == 0)
{
throw new iMESException.MESException("0000-200002", "[%EquipmentNo%] [%cannotbeempty%]");
}
// 將資料存入暫存Table
drData = dtEquipment.NewRow();
drData["EquipmentNo"] = xmlList[i].SelectNodes("equipmentno").Item(0).InnerText;
if (xmlList[i].SelectNodes("loadport").Count > 0)
{
drData["LoadPort"] = xmlList[i].SelectNodes("loadport").Item(0).InnerText;
}
dtEquipment.Rows.Add(drData);
}
}
}
//TsungyYu 2021/06/10取出 Chamber--------------------------------------------------------------------------------------------
dtEquipmentChamber = new DataTable("EquipmentChamber");
dtEquipmentChamber.Columns.Add("EquipmentNo", System.Type.GetType("System.String"));
dtEquipmentChamber.Columns.Add("BelongEquipmentNo", System.Type.GetType("System.String"));
if (xmlDoc.DocumentElement.GetElementsByTagName("equipmentchamber").Count > 0)
{
if (xmlDoc.GetElementsByTagName("equipmentchamber").Item(0).SelectNodes("value").Count > 0)
{
xmlList = xmlDoc.GetElementsByTagName("equipmentchamber").Item(0).SelectNodes("value");
var loopTo1 = xmlList.Count - 1;
for (i = 0; i <= loopTo1; i++)
{
if (xmlList[i].SelectNodes("equipmentno").Count == 0)
{
throw new iMESException.MESException("0000-200002", "[%EquipmentNo%] [%cannotbeempty%]");
}
//將資料存入暫存Table
drData = dtEquipmentChamber.NewRow();
drData["EquipmentNo"] = xmlList[i].SelectNodes("equipmentno").Item(0).InnerText;
drData["BelongEquipmentNo"] = xmlList[i].SelectNodes("belongequipmentno").Item(0).InnerText;
dtEquipmentChamber.Rows.Add(drData);
}
}
}
// 多人加工
DataTable dtLoginState;
dtLoginState = new DataTable("tblLoginState");
dtLoginState.Columns.Add("UserNo", Type.GetType("System.String"));
dtLoginState.Columns.Add("UserName", Type.GetType("System.String"));
dtLoginState.Columns.Add("CheckInTime", Type.GetType("System.DateTime"));
if (xmlDoc.DocumentElement.GetElementsByTagName("loginstate").Count > 0)
{
if (xmlDoc.GetElementsByTagName("loginstate").Item(0).SelectNodes("value").Count > 0)
{
xmlList = xmlDoc.GetElementsByTagName("loginstate").Item(0).SelectNodes("value");
var loopTo2 = xmlList.Count - 1;
for (i = 0; i <= loopTo2; i++)
{
if (xmlList[i].SelectNodes("userno").Count == 0 || xmlList[i].SelectNodes("username").Count == 0 || xmlList[i].SelectNodes("checkintime").Count == 0)
{
throw new iMESException.MESException("0000-200002", "[%userno%], [%username%], [%checkintime%] [%not found%]");
}
// 將資料存入暫存Table
drData = dtLoginState.NewRow();
drData["UserNo"] = xmlList[i].SelectNodes("userno").Item(0).InnerText;
drData["UserName"] = xmlList[i].SelectNodes("username").Item(0).InnerText;
drData["CheckInTime"] = xmlList[i].SelectNodes("checkintime").Item(0).InnerText;
dtLoginState.Rows.Add(drData);
}
}
}
// 模治具
DataTable dtAccessory;
dtAccessory = new DataTable("Accessory");
dtAccessory.Columns.Add("EquipmentNo", Type.GetType("System.String"));
dtAccessory.Columns.Add("AccessoryNo", Type.GetType("System.String"));
dtAccessory.Columns.Add("AccessoryVersion", Type.GetType("System.String"));
dtAccessory.Columns.Add("AccessoryType", Type.GetType("System.String"));
dtAccessory.Columns.Add("AccumulateQty", Type.GetType("System.Decimal"));
if (xmlDoc.DocumentElement.GetElementsByTagName("accessory").Count > 0)
{
if (xmlDoc.GetElementsByTagName("accessory").Item(0).SelectNodes("value").Count > 0)
{
xmlList = xmlDoc.GetElementsByTagName("accessory").Item(0).SelectNodes("value");
var loopTo3 = xmlList.Count - 1;
for (i = 0; i <= loopTo3; i++)
{
if (xmlList[i].SelectNodes("equipmentno").Count == 0 || xmlList[i].SelectNodes("accessoryno").Count == 0 || xmlList[i].SelectNodes("accessoryversion").Count == 0 || xmlList[i].SelectNodes("accessorytype").Count == 0 || xmlList[i].SelectNodes("accumulateqty").Count == 0)
{
throw new iMESException.MESException("0000-200002", "[%equipmentno%], [%accessoryno%], [%accessoryversion%], [%accessorytype%],[%accumulateqty%] [%not found%]");
}
// 將資料存入暫存Table
drData = dtAccessory.NewRow();
drData["EquipmentNo"] = xmlList[i].SelectNodes("equipmentno").Item(0).InnerText;
drData["AccessoryNo"] = xmlList[i].SelectNodes("accessoryno").Item(0).InnerText;
drData["AccessoryVersion"] = xmlList[i].SelectNodes("accessoryversion").Item(0).InnerText;
drData["AccessoryType"] = xmlList[i].SelectNodes("accessorytype").Item(0).InnerText;
drData["AccumulateQty"] = xmlList[i].SelectNodes("accumulateqty").Item(0).InnerText;
dtAccessory.Rows.Add(drData);
}
}
}
else
{
// Kevin 20140106,區分沒選模治具與沒顯示模治具,介面沒顯示模治具則設為Nothing
dtAccessory = null;
}
dtMTLLot = new DataTable("Temp_MaterialLot");
dtMTLLot.Columns.Add("MaterialNo", Type.GetType("System.String"));
dtMTLLot.Columns.Add("MaterialLotNo", Type.GetType("System.String"));
if (xmlDoc.DocumentElement.GetElementsByTagName("temp_materiallot").Count > 0)
{
if (xmlDoc.GetElementsByTagName("temp_materiallot").Item(0).SelectNodes("value").Count > 0)
{
xmlList = xmlDoc.GetElementsByTagName("temp_materiallot").Item(0).SelectNodes("value");
var loopTo4 = xmlList.Count - 1;
for (i = 0; i <= loopTo4; i++)
{
// 將資料存入暫存Table
drData = dtMTLLot.NewRow();
drData["MaterialNo"] = xmlList[i].SelectNodes("materialno").Item(0).InnerText;
drData["MaterialLotNo"] = xmlList[i].SelectNodes("materiallotno").Item(0).InnerText;
dtMTLLot.Rows.Add(drData);
}
}
}
// 3.檢查投料點在機台的料是否足夠 -------------------------------------------------------------------------------------------
objLot.ChkMaterialOnEquipment(LotNo, dtEquipment);
// 4.Update CheckIn----------------------------------------------------------------------------------------------------------
string LanguageMode = GetXMLLanguageMode(xmlDoc);
objLot.BR_CheckIn(LotStamp, LotNo, LinkName, dtAttrib, dtEquipment, UserNo, ShiftNo, LotRecord, CheckInTime, RuleNo, dtLoginState, dtAccessory, dtMTLLot, LanguageMode, dtEquipmentChamber);
// 5.Return Value------------------------------------------------------------------------------------------------------------
strException = "";
strResult = "success";
objSYS.AddEventLog(strServiceName, UserNo, "LotNo", LotNo, DateTime.Now, "Exe_CheckIn", ComputerName: GetXMLCurComputer(xmlDoc));
}
catch (iMESException.MESException ex)
{
strReturnValue = "";
switch (ex.ErrorCode.ToString() ?? "")
{
case "IPQCNO":
{
strException = CombineXMLException(ex.ErrorCode.ToString(), TranslateMsg(ex.Message, GetXMLLanguageMode(xmlDoc), strResourceDir), "IPQCNO", ex.StackTrace);
break;
}
default:
{
strException = CombineXMLException(Conversions.ToString(ex.ErrorCode), TranslateMsg(ex.Message, GetXMLLanguageMode(xmlDoc), strResourceDir), "Exe_CheckIn fail!", ex.StackTrace);
break;
}
}
strResult = "fail";
objSYS.AddErrorLog_ErrorCode(strServiceName, UserNo, "LotNo", LotNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc), ErrorCode: Conversions.ToString(ex.ErrorCode));
}
catch (Exception ex)
{
strReturnValue = "";
strException = CombineXMLException(defWSErrCode, ex.Message, "Exe_CheckIn fail!", ex.StackTrace);
strResult = "fail";
objSYS.AddErrorLog_ErrorCode(strServiceName, UserNo, "LotNo", LotNo, DateTime.Now, strException, ComputerName: GetXMLCurComputer(xmlDoc));
}
finally
{
// 將各部份之XML字串組起來並傳出
Exe_CheckInRet = CombineXMLResponse(strIdentity, strReturnValue, strException, strResult, "");
}
return Exe_CheckInRet;
}
} }
} }