private int CHECK_WOSTATUS() { DataTable dt = OperateDB.Get_WoInfo(My_MoNumber); if (dt.Rows.Count == 0) { return(99); } else { return(Convert.ToInt32(dt.Rows[0]["WOSTATE"].ToString())); } }
private bool CHECK_SAP() { bool AccessFlag = false; cdbAccess cdb = new cdbAccess(); DataTable dt = cdb.GetDatatable("select woId,partnumber,sum(data_qty) as QTY from T_CHECK_SAP group by woId,partnumber"); if (dt.Rows.Count == 0) { AccessFlag = true; dt.Rows.Add(InputData.Rows[0]["WOID"].ToString(), InputData.Rows[0]["partnumber"].ToString(), InputData.Rows.Count); } bool sFlag = false; string FactoryId = string.Empty; foreach (DataRow dr in dt.Rows) { int CHK_QTY = 0; if (dr["WOID"].ToString() == InputData.Rows[0]["WOID"].ToString() && !AccessFlag) { CHK_QTY = Convert.ToInt32(dr["QTY"].ToString()) + InputData.Rows.Count; } else { CHK_QTY = Convert.ToInt32(dr["QTY"].ToString()); } FactoryId = OperateDB.Get_WoInfo(dr["WOID"].ToString()).Rows[0]["FACTORYID"].ToString(); Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("PARTNUMBER", dr["PARTNUMBER"].ToString()); dic.Add("WOID", dr["WOID"].ToString()); dic.Add("QTY", CHK_QTY); dic.Add("EMP_NO", dr["QTY"].ToString()); dic.Add("EMP_NAME", dr["QTY"].ToString()); dic.Add("PLANT", string.IsNullOrEmpty(FactoryId) ? "2100" : FactoryId); string[] LsMsg = SapConn.CHK_STOCKIN_Z_RFC_AUFNR_MIGO(DictionaryToJson(dic)); if (LsMsg.Length < 5) { SendMsg(mLogMsgType.Error, "检查SAP 发生异常" + LsMsg[0].ToString()); sFlag = false; } else { string SAP_STOCKNO = LsMsg[0].ToString(); string SAP_TYPE = LsMsg[1].ToString(); string SAP_E_ID = LsMsg[2].ToString(); string SAP_E_NUM = LsMsg[3].ToString(); string SAP_MSG = LsMsg[4].ToString(); if (SAP_TYPE.ToUpper() == "S") { SendMsg(mLogMsgType.Incoming, string.Format("检查SAP 工单:[{0}] 数量:[{1}] OK", dr["WOID"].ToString(), CHK_QTY.ToString())); sFlag = true; } else { string sSAP_MSG = string.Format("工单:{0},料号:{1},数量:{2},MSG:{3}", dr["WOID"].ToString(), dr["PARTNUMBER"].ToString(), CHK_QTY.ToString(), SAP_TYPE + "-" + SAP_E_ID + "-" + SAP_E_NUM + "-" + SAP_MSG); SendMsg(mLogMsgType.Error, "SAP:" + sSAP_MSG); sFlag = false; break; } } } SendMsg(mLogMsgType.Incoming, "检查SAP数据完成...."); return(sFlag); }