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); }
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); }
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); }
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); }