Esempio n. 1
0
        public string GetMeasureID()
        {
            JGDBOP dbop         = new JGDBOP();
            string strErr       = string.Empty;
            string strMeasureID = string.Empty;
            string strQText     = string.Empty;
            string strUText     = string.Empty;
            string ZD           = string.Empty;
            string I_SiteID     = string.Empty;

            //获得当前时间
            string    strText = "Select Convert(varchar,getdate(),120)";
            DataTable dt      = dbop.GetTable(strText);
            string    objDate = dt.Rows[0][0].ToString();

            //string IP = dbop.LocalIP;

            //string sqlZD = "select C_SiteNo,I_SiteID from CM_MeaSiteInfo where C_SiteIP='" + IP + "'";
            //DataTable dtZD = dbop.GetTable(sqlZD);
            //ZD = dtZD.Rows[0]["C_SiteNo"].ToString();
            //I_SiteID = dtZD.Rows[0]["I_SiteID"].ToString();
            if (objDate != null)
            {
                List <string> lstSQL = new List <string>();
                strQText = "Select I_MeasureDocID from CM_MeasureID where C_MeaDate='" + objDate.ToString().Substring(0, 10) + "'";
                dt       = dbop.GetTable(strQText);

                if (dt.Rows.Count < 1)
                {
                    strMeasureID = ZD + DateTime.Parse(objDate.ToString()).ToString("yyMMdd") + "0001";  //计量单号
                }
                else
                {
                    string objMeasureID = dt.Rows[0]["I_MeasureDocID"].ToString();
                    strMeasureID = ZD + DateTime.Parse(objDate.ToString()).ToString("yyMMdd") + objMeasureID.ToString().ToString().PadLeft(4, '0');  //计量单号
                }
                if (dt.Rows.Count < 1)
                {
                    string strDText = "Delete from CM_MeasureID";
                    dbop.getsqlcom(strDText);

                    strUText = "Insert into CM_MeasureID(I_MeasureDocID,C_MeaDate,C_User,C_TimeStamp) Values("
                               + "2"
                               + ",'" + objDate.ToString().Substring(0, 10) + "'"
                               + ",'自动'"
                               + ",'" + objDate.ToString() + "')";
                    dbop.getsqlcom(strUText);
                }
                else
                {
                    strUText = "Update CM_MeasureID set I_MeasureDocID=I_MeasureDocID+1,C_User='******',C_TimeStamp='" + objDate.ToString() + "'";
                    dbop.getsqlcom(strUText);
                }
            }
            return(strMeasureID);
        }
Esempio n. 2
0
        public static void insertDoorMain(string MeasureDocID, string carNO)
        {
            JGDBOP su     = new JGDBOP();
            string upLock = "insert into CM_DoorControlMain " +
                            " (MeasureDocID,MsgTime,ModifyTime,CarNO,BusinessType,AccessTime,AccessIP,pk_stordoc,I_SiteID) " +
                            " values ('" + MeasureDocID + "','" + getdate() + "','" + getdate() + "','" + carNO + "',null, '" + getdate() + "','" + GetIP() + "',null,null)";

            su.getsqlcom(upLock);
        }
Esempio n. 3
0
        public static void updateLock(string MeasureDocID, string carNO, string c_RefenceTime, int strLimte)//更新超时锁定和原因 参数(计量单号,车号,净重时间,限制时间)
        {
            string LockReason = "车号:" + carNO + " 净重时间:" + c_RefenceTime + ",当前时间:" + getdate() + ",允许时间:" + strLimte + "分钟,车辆从计量到打票用时超时!";;
            JGDBOP su         = new JGDBOP();
            string upLock     = "update CM_DoorControlMain set OverTimeFlag='2',OverTimeMinute='" + cMinCha + "',LockTime='" + getdate() + "'," +
                                " PrintLock='1',LockSite='" + GetIP() + "',LockReason='" + LockReason + "' where MeasureDocID ='" + MeasureDocID + "' ";

            su.getsqlcom(upLock);
        }