Beispiel #1
0
        public void transITJ()
        {
            try
            {
                DataSet ds       = getResourse();
                string  transXML = makeXml(ds);

                if (string.IsNullOrEmpty(transXML))
                {
                    return;//没有数据需要发送
                }
                DB.PreserveLog("Debug", "发送给英特吉的xml数据:" + transXML);
                string s = upin.LabelInfo(transXML);
                DB.PreserveLog("Debug", "英特吉返回的xml数据:" + s);

                DataSet       dsxml   = new DataSet();
                StringReader  read    = new StringReader(s);
                XmlTextReader readxml = new XmlTextReader(read);
                dsxml.ReadXml(readxml);
                DataTable dt1 = dsxml.Tables[0];
                int       i   = int.Parse(dt1.Rows[0]["code"].ToString());
                if (i == 1)
                {
                    //将瓶签批次的保存时间保存到英特吉瓶签表
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        foreach (DataRow r in ds.Tables[0].Rows)
                        {
                            //因BatchSavedDT在IVRecord中格式是YYYYMMDDHHmm.fff,直接用ToString丢失毫秒
                            string strBatchSavedDT = (Convert.ToDateTime(r["BatchSavedDT"])).ToString("yyyy-MM-dd HH:mm:ss.fff");
                            updateDB(r["LabelNo"].ToString().Trim(), strBatchSavedDT);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Beispiel #2
0
        //记录已经传给韦乐海茨的瓶签批次号以及更新后面更改
        private void timer4_Tick(object sender, EventArgs e)
        {
            try
            {
                string insertSQL = " insert into TransBatch(LabelNo,Batch) select LabelNo,Batch from " +
                                   "IVRecord(nolock) where LabelNo in (select top 1000 LabelNo from IVRecordToFC(nolock) fc " +
                                   "where DATEDIFF(DD,fc.FCDT,GETDATE()) < 2 and not exists(select 1 from TransBatch(nolock) tb " +
                                   "where tb.LabelNo = fc.LabelNo)) ";

                DB.GetPIVAsDB(insertSQL);
            }
            catch (Exception ex)
            {
                DB.PreserveLog("error", "韦乐海茨的接口出错:" + ex.Message);
            }
        }