public int Add(R_BACKFLUSH_HISTORY NewHis, OleExec sfcdb) { Row_R_BACKFLUSH_HISTORY NewHisRow = (Row_R_BACKFLUSH_HISTORY)NewRow(); NewHisRow.WORKORDERNO = NewHis.WORKORDERNO; NewHisRow.SKUNO = NewHis.SKUNO; NewHisRow.SAP_STATION = NewHis.SAP_STATION; NewHisRow.WORKORDER_QTY = NewHis.WORKORDER_QTY; NewHisRow.BACKFLUSH_QTY = NewHis.BACKFLUSH_QTY; NewHisRow.SFC_QTY = NewHis.SFC_QTY; NewHisRow.DIFF_QTY = NewHis.DIFF_QTY; NewHisRow.SFC_STATION = NewHis.SFC_STATION; NewHisRow.HAND_QTY = NewHis.HAND_QTY; NewHisRow.LAST_SFC_QTY = NewHis.LAST_SFC_QTY; NewHisRow.DIFF_QTY1 = NewHis.DIFF_QTY1; NewHisRow.DIFF_QTY2 = NewHis.DIFF_QTY2; NewHisRow.HISTORY_HAND_QTY = NewHis.HISTORY_HAND_QTY; NewHisRow.MRB_QTY = NewHis.MRB_QTY; NewHisRow.REC_TYPE = NewHis.REC_TYPE; NewHisRow.BACK_DATE = NewHis.BACK_DATE; NewHisRow.RESULT = NewHis.RESULT; NewHisRow.TIMES = NewHis.TIMES; NewHisRow.TOSAP = NewHis.TOSAP; int result = sfcdb.ExecuteNonQuery(NewHisRow.GetInsertString(DBType), CommandType.Text); return(result); }
public R_BACKFLUSH_HISTORY GetDataObject() { R_BACKFLUSH_HISTORY DataObject = new R_BACKFLUSH_HISTORY(); DataObject.WORKORDERNO = this.WORKORDERNO; DataObject.SKUNO = this.SKUNO; DataObject.SAP_STATION = this.SAP_STATION; DataObject.WORKORDER_QTY = this.WORKORDER_QTY; DataObject.BACKFLUSH_QTY = this.BACKFLUSH_QTY; DataObject.SFC_QTY = this.SFC_QTY; DataObject.DIFF_QTY = this.DIFF_QTY; DataObject.SFC_STATION = this.SFC_STATION; DataObject.HAND_QTY = this.HAND_QTY; DataObject.LAST_SFC_QTY = this.LAST_SFC_QTY; DataObject.DIFF_QTY1 = this.DIFF_QTY1; DataObject.DIFF_QTY2 = this.DIFF_QTY2; DataObject.HISTORY_HAND_QTY = this.HISTORY_HAND_QTY; DataObject.MRB_QTY = this.MRB_QTY; DataObject.REC_TYPE = this.REC_TYPE; DataObject.BACK_DATE = this.BACK_DATE; DataObject.RESULT = this.RESULT; DataObject.TIMES = this.TIMES; DataObject.TOSAP = this.TOSAP; return(DataObject); }
public void CallRfcBackFlush() { if (!isRun) { sfcdb = new OleExec(DBName, false); //判斷是否有其他執行 TR_SYNC_LOCK = new T_R_SYNC_LOCK(sfcdb, MESDataObject.DB_TYPE_ENUM.Oracle); string lockIP = ""; string sapMessage = ""; bool isLock = TR_SYNC_LOCK.IsLock("BACKFLUSH", sfcdb, MESDataObject.DB_TYPE_ENUM.Oracle, out lockIP); if (isLock) { throw new Exception("BackFlush Is Running,Please Wait!"); } else { TR_SYNC_LOCK.SYNC_Lock(BU, IP, "HWD", "BACKFLUSH", "Interface", sfcdb, MESDataObject.DB_TYPE_ENUM.Oracle); isRun = true; } if (InterfacePublicValues.IsMonthly(sfcdb, MESDataObject.DB_TYPE_ENUM.Oracle)) { //月結不給拋賬 throw new Exception("This time is monthly,can't BackFlush"); } if (setCtrlEnableDelegate != null) { setCtrlEnableDelegate("btnCallRFC", false); setCtrlEnableDelegate("btnStart", false); } try { ZRFC_SFC_NSG_0009 RFC = new ZRFC_SFC_NSG_0009(_BU); ZRFC_SFC_NSG_0022 RW_RFC = new ZRFC_SFC_NSG_0022(_BU); string[] ReWorks = REWORK.Split(new char[] { ',' }); int curCount = 0; T_R_BACKFLUSH_HISTORY TR_BACKFLUSH_HISTORY = new T_R_BACKFLUSH_HISTORY(sfcdb, MESDataObject.DB_TYPE_ENUM.Oracle); string ConfigPostDate = InterfacePublicValues.GetPostDate(sfcdb); foreach (R_BACKFLUSH_CHECK item in bkList) { try { curCount++; if (processRateDelegate != null) { processRateDelegate("BackFlushProgressBar", "labBackFlushProgress", bkList.Count, curCount); } if (item.DIFF_QTY > 0) { bool isRework = false; for (int i = 0; i < ReWorks.Length; i++) { if (item.WORKORDERNO.IndexOf(ReWorks[i]) == 0) { isRework = true; break; } } if (isRework) { RW_RFC.SetValue(item.WORKORDERNO, ConfigPostDate, item.DIFF_QTY.ToString(), item.SAP_STATION); RW_RFC.CallRFC(); MESDataObject.Module.R_BACKFLUSH_HISTORY his = new MESDataObject.Module.R_BACKFLUSH_HISTORY(); his.WORKORDERNO = item.WORKORDERNO; his.WORKORDER_QTY = (double?)item.WORKORDER_QTY; his.SFC_QTY = (double?)item.SFC_QTY; his.SFC_STATION = item.SFC_STATION; his.SKUNO = item.SKUNO; his.SAP_STATION = item.SAP_STATION; his.LAST_SFC_QTY = (double?)item.LAST_SFC_QTY; his.DIFF_QTY = (double?)item.DIFF_QTY; his.DIFF_QTY1 = (double?)item.DIFF_QTY1; his.BACK_DATE = GetDBTime(sfcdb); his.TIMES = 0; his.DIFF_QTY2 = (double?)item.DIFF_QTY2; his.MRB_QTY = (double?)item.MRB_QTY; string resu = RW_RFC.GetValue("O_FLAG"); if (resu == "0") { his.RESULT = "Y"; resu = RW_RFC.GetValue("O_FLAG1"); if (resu == "1") { WriteLog.WriteIntoMESLog(sfcdb, _BU, "Interface", "MESInterface.HWD.BackFlush.BackFlushHelp", "CallRfcBackFlush", his.WORKORDERNO + "," + his.SAP_STATION + ",521 fail:" + RW_RFC.GetValue("O_MESSAGE1"), "", "System"); } } else { his.RESULT = "N"; } TR_BACKFLUSH_HISTORY.Add(his, sfcdb); } else { RFC.SetValue(item.WORKORDERNO, item.SAP_STATION, item.DIFF_QTY.ToString(), ConfigPostDate); RFC.CallRFC(); MESDataObject.Module.R_BACKFLUSH_HISTORY his = new MESDataObject.Module.R_BACKFLUSH_HISTORY(); his.WORKORDERNO = item.WORKORDERNO; his.WORKORDER_QTY = (double?)item.WORKORDER_QTY; his.SFC_QTY = (double?)item.SFC_QTY; his.SFC_STATION = item.SFC_STATION; his.SKUNO = item.SKUNO; his.SAP_STATION = item.SAP_STATION; his.LAST_SFC_QTY = (double?)item.LAST_SFC_QTY; his.DIFF_QTY = (double?)item.DIFF_QTY; his.DIFF_QTY1 = (double?)item.DIFF_QTY1; his.BACK_DATE = GetDBTime(sfcdb); his.TIMES = 0; his.DIFF_QTY2 = (double?)item.DIFF_QTY2; his.MRB_QTY = (double?)item.MRB_QTY; string resu = RFC.GetValue("O_FLAG"); if (resu == "0") { his.RESULT = "Y"; } else { his.RESULT = "N"; sapMessage = RFC.GetValue("O_MESSAGE"); WriteLog.WriteIntoMESLog(sfcdb, _BU, "Interface", "MESInterface.HWD.BackFlush.BackFlushHelp", "CallRfcBackFlush", item.WORKORDERNO + "," + item.SAP_STATION + ":" + sapMessage, "", "System"); } TR_BACKFLUSH_HISTORY.Add(his, sfcdb); } } } catch (Exception ex) { WriteLog.WriteIntoMESLog(sfcdb, _BU, "Interface", "MESInterface.HWD.BackFlush.BackFlushHelp", "CallRfcBackFlush", item.WORKORDERNO + "," + item.SAP_STATION + ":" + ex.Message, "", "System"); continue; } } isRun = false; TR_SYNC_LOCK.SYNC_UnLock(BU, IP, "HWD", "BACKFLUSH", "Interface", sfcdb, MESDataObject.DB_TYPE_ENUM.Oracle); if (setCtrlEnableDelegate != null) { setCtrlEnableDelegate("btnStart", true); } } catch (Exception ex) { WriteLog.WriteIntoMESLog(sfcdb, _BU, "Interface", "MESInterface.HWD.BackFlush.BackFlushHelp", "CallRfcBackFlush", ex.Message, "", "System"); isRun = false; TR_SYNC_LOCK.SYNC_UnLock(BU, IP, "HWD", "BACKFLUSH", "Interface", sfcdb, MESDataObject.DB_TYPE_ENUM.Oracle); if (setCtrlEnableDelegate != null) { setCtrlEnableDelegate("btnStart", true); } } } }