Esempio n. 1
0
        private List <string> ParsDateBill(string xml, string billType, List <string> list)
        {
            XmlDocument doc = new XmlDocument();
            DataSet     ds  = GenerateEmptyTables();

            try
            {
                doc.LoadXml(xml);
                if (doc.GetElementsByTagName("bb_result_info")[0].InnerText == "1")
                {
                    foreach (XmlNode billdata in doc.GetElementsByTagName("data"))
                    {
                        if (billType == billdata.FirstChild.InnerText)
                        {
                            foreach (XmlNode orderlist in billdata.ChildNodes[1])
                            {
                                DataRow billTableRow = ds.Tables["BILLTABLE"].NewRow();
                                billTableRow["bb_order_id"] = orderlist.InnerText;
                                list.Add(orderlist.InnerText);
                                ds.Tables["BILLTABLE"].Rows.Add(billTableRow);
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                THOKUtil.ShowError("从浪潮下载数据出错,原因:" + e.Message);
            }
            return(list);
        }
Esempio n. 2
0
        public DataSet ImportData(string billString, string orderId)
        {
            DataSet ds = GenerateEmptyTables();

            try
            {
                DzInspurWarehouseOperationService.WarehouseOperationServiceService ops = new DzInspurWarehouseOperationService.WarehouseOperationServiceService();
                string xml = "";
                switch (billString)
                {
                case "HITSHELF":     //上架
                    xml = ops.HitShelf(orderId);
                    break;

                case "STOCKTAKE":     //盘点
                    xml = ops.StockTake(orderId);
                    break;

                case "STOCKMOVE":     //下架
                    xml = ops.StockOut(orderId);
                    break;

                case "STOCKOUT":     //移位
                    xml = ops.StockMove(orderId);
                    break;
                }
                ds = ParseData(xml, ds);
            }
            catch (Exception e)
            {
                THOKUtil.ShowError("从浪潮下载数据出错,原因:" + e.Message);
            }
            return(ds);
        }
Esempio n. 3
0
        private DataSet ParseData(string xml, DataSet ds)
        {
            XmlDocument doc = new XmlDocument();

            try
            {
                doc.LoadXml(xml);
                foreach (XmlNode billNode in doc.GetElementsByTagName("head"))
                {
                    foreach (XmlNode detailNode in doc.GetElementsByTagName("data"))
                    {
                        DataRow detailRow = ds.Tables["DETAIL"].NewRow();
                        //主表信息
                        detailRow["bb_type"]             = billNode.SelectSingleNode("bb_type").InnerText;
                        detailRow["bb_order_id"]         = billNode.SelectSingleNode("bb_order_id").InnerText;
                        detailRow["bb_corporation_id"]   = billNode.SelectSingleNode("bb_corporation_id").InnerText;
                        detailRow["bb_corporation_name"] = billNode.SelectSingleNode("bb_corporation_name").InnerText;

                        //细表信息
                        detailRow["bb_detail_id"]       = detailNode.SelectSingleNode("bb_detail_id").InnerText;
                        detailRow["bb_operate_type"]    = detailNode.SelectSingleNode("bb_operate_type").InnerText == "A" ? "盘点" : detailNode.SelectSingleNode("bb_operate_type").InnerText == "B" ? "移出" : detailNode.SelectSingleNode("bb_operate_type").InnerText == "C" ? "移入" : "异常";
                        detailRow["bb_pallet_move_flg"] = detailNode.SelectSingleNode("bb_pallet_move_flg").InnerText;
                        detailRow["bb_cargo_no"]        = detailNode.SelectSingleNode("bb_cargo_no").InnerText;
                        if (billNode.SelectSingleNode("bb_type").InnerText == "STOCKTAKE")
                        {
                            detailRow["bb_shelf_no"] = detailNode.SelectSingleNode("bb_shelf_no").InnerText;
                        }
                        detailRow["bb_pallet_no"]     = detailNode.SelectSingleNode("bb_pallet_no").InnerText;
                        detailRow["bb_brand_id"]      = detailNode.SelectSingleNode("bb_brand_id").InnerText;
                        detailRow["bb_brand_name"]    = detailNode.SelectSingleNode("bb_brand_name").InnerText;
                        detailRow["bb_handle_num"]    = Convert.ToDouble(detailNode.SelectSingleNode("bb_handle_num").InnerText);
                        detailRow["bb_inventory_num"] = Convert.ToDouble(detailNode.SelectSingleNode("bb_inventory_num").InnerText);
                        detailRow["bb_unit"]          = detailNode.SelectSingleNode("bb_unit").InnerText;
                        detailRow["bb_cell_rfid"]     = detailNode.SelectSingleNode("bb_cell_rfid").InnerText;
                        detailRow["bb_stock_rfid"]    = detailNode.SelectSingleNode("bb_stock_rfid").InnerText;
                        detailRow["bb_unit_name"]     = detailNode.SelectSingleNode("bb_unit_name").InnerText;
                        detailRow["bb_area_type"]     = detailNode.SelectSingleNode("bb_area_type").InnerText;
                        detailRow["bb_data_time"]     = DateTime.Now;

                        ds.Tables["DETAIL"].Rows.Add(detailRow);
                    }
                }
            }
            catch (Exception e)
            {
                THOKUtil.ShowError("从浪潮下载数据出错,原因:" + e.Message);
            }
            return(ds);
        }
Esempio n. 4
0
        public List <string> ScanNewBill(string billString, string billType)
        {
            List <string> list = new List <string>();

            try
            {
                DzInspurWarehouseOperationService.WarehouseOperationServiceService ops = new DzInspurWarehouseOperationService.WarehouseOperationServiceService();
                string xml = ops.ScanNewBill();
                list = ParsDateBill(xml, billType, list);
            }
            catch (Exception e)
            {
                THOKUtil.ShowError("从浪潮ScanNewBill下载数据出错,原因:" + e.Message);
            }
            return(list);
        }
Esempio n. 5
0
        /// <summary>
        /// 查询单据号 zxl 2013-12-19
        /// </summary>
        /// <param name="billString">查询方法名</param>
        /// <param name="billType">订单类型</param>
        /// <returns>返回单据集合</returns>
        //public List<string> ScanNewBill(string billString,string billType)
        //{
        //    List<string> list = new List<string>();
        //    try
        //    {
        //        url = configUtil.GetConfig("URL")["URL"] + "WarehouseOperationService/ScanNewBill";
        //        WebClient client = new WebClient();
        //        byte[] data = client.DownloadData(url);
        //        string xml = System.Text.Encoding.GetEncoding("GB2312").GetString(data);

        //        file.logInfo(DateTime.Now.ToString("yyyy-MM-dd"), "[单号数据][" + DateTime.Now + "]:" + xml);
        //        list = ParsDateBill(xml, billType, list);
        //    }
        //    catch (Exception e)
        //    {
        //        THOKUtil.ShowError("从浪潮下载数据出错,原因:" + e.Message);
        //    }
        //    return list;
        //}
        public List <string> ScanNewBill(string billString, string billType)
        {
            List <string> list = new List <string>();

            try
            {
                DzInspurWarehouseOperationService.WarehouseOperationServiceService ops = new DzInspurWarehouseOperationService.WarehouseOperationServiceService();
                string xml = ops.ScanNewBill();
                file.logInfo(DateTime.Now.ToString("yyyy-MM-dd"), "[单号数据][" + DateTime.Now + "]:" + xml);
                list = ParsDateBill(xml, billType, list);
            }
            catch (Exception e)
            {
                THOKUtil.ShowError("从浪潮ScanNewBill下载数据出错,原因:" + e.Message);
            }
            return(list);
        }
Esempio n. 6
0
        /// <summary>
        /// 读取数据 达州
        /// </summary>
        /// <param name="strPort"></param>
        /// <param name="nBaudrate"></param>
        /// <param name="errString"></param>
        /// <returns></returns>
        //public List<string> LoadTagList(string strPort, int nBaudrate, out string errString)
        //{
        //    List<string> listRfid = new List<string>();
        //    errString = string.Empty;
        //    string[] MyTagList = new string[100];
        //    try
        //    {
        //        brdr = new BRIReader(null, "SERIAL://" + strPort);
        //        DateTime now = DateTime.Now;
        //        do
        //        {
        //            bool state = brdr.Read();
        //            if (brdr.TagCount > 0)
        //            {
        //                foreach (Tag tt in brdr.Tags)
        //                {
        //                    listRfid.Add(tt.ToString());
        //                    //MyTagList[++iTagCount] = tt.ToString();
        //                    //if (tt.TagFields.ItemCount > 0)
        //                    //{
        //                    //    foreach (TagField tf in tt.TagFields.FieldArray)
        //                    //    {
        //                    //        if (tf.Status < 0)
        //                    //        {
        //                    //            //code to handle read or write error on this field
        //                    //        }
        //                    //        else
        //                    //        {
        //                    //            //get field data such as ANT, COUNT, TIME, AFI, etc.
        //                    //            MyTagList[iTagCount] += " " + tf.ToString();
        //                    //        }
        //                    //    }
        //                    //}
        //                    //listRfid.Add(MyTagList[iTagCount]);
        //                }
        //            }
        //            if (listRfid.Count != 0)//读取到数据就跳出
        //            {
        //                break;
        //            }
        //        } while (((TimeSpan)(DateTime.Now - now)).TotalSeconds < 8);//5秒后无数据就返回
        //        brdr.Dispose();
        //        // this.CloseCom();
        //        return listRfid;
        //    }
        //    catch (Exception e)
        //    {
        //        brdr.Dispose();
        //        throw new Exception("错误:" + e.Message + "," + errString + ",数据:" + listRfid.ToArray());
        //    }
        //}

        public List <string> LoadTagList(string strPort, int nBaudrate, out string errString)
        {
            List <string> listRfid = new List <string>();

            errString = string.Empty;
            string[] MyTagList = new string[100];
            try
            {
                brdr = new BRIReader(null, "SERIAL://" + strPort);
            }
            catch (Exception ex)
            {
                THOKUtil.ShowError("BRIReader读取串口 [ " + strPort + " ] 失败!" + "内部:" + ex.Message);
                //throw new Exception("BRI读取串口:" + ex.Message);
                return(null);
            }
            try
            {
                DateTime now = DateTime.Now;
                do
                {
                    bool state = brdr.Read();
                    if (brdr.TagCount > 0)
                    {
                        foreach (Tag tt in brdr.Tags)
                        {
                            listRfid.Add(tt.ToString());
                        }
                    }
                    if (listRfid.Count != 0)//读取到数据就跳出
                    {
                        break;
                    }
                }while (((TimeSpan)(DateTime.Now - now)).TotalSeconds < 8);//5秒后无数据就返回
                brdr.Dispose();
                return(listRfid);
            }
            catch (Exception e)
            {
                brdr.Dispose();
                THOKUtil.ShowError("方法LoadTagList错误:" + e.Message + "," + errString + ",数据:" + listRfid.ToArray());
                return(null);
            }
        }