private bool GetStockNoType(string woid, ref int stockNoType) { try { Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("stock_no", woid); SearchRInventoryId sr = new SearchRInventoryId(dic); sr.ExecuteQuery(); DataTable dt = sr.GetResult(); if (dt == null || dt.Rows.Count == 0) { ShowHint("在表R_Inventory_Id表中查不到此工单: " + woid, Color.Red); return(false); } stockNoType = int.Parse(dt.Rows[0]["stockno_type"].ToString()); return(true); } catch (Exception ex) { ShowHint("GetStockNoType:" + ex.Message, Color.Red); return(false); } }
private DataTable GetRInventoryId() { try { dic_sap_po.Clear(); Dictionary <string, object> _dic = new Dictionary <string, object>(); _dic.Add("stock_no", txt_stock_no.Text); _dic.Add("stock_year", cbx_Year.Text); SearchRInventoryId sr = new SearchRInventoryId(_dic); sr.ExecuteQuery(); DataTable dt = sr.GetResult(); foreach (DataRow dr in dt.Rows) { Dictionary <string, string> dic = new Dictionary <string, string>(); string Colnum = "material_no, qty, income_qty, status, material_desc, vender_name, inventory_id, stock_no"; foreach (string str in Colnum.Split(',')) { dic.Add(str.Trim(), ""); } dic["material_no"] = dr["material_no"].ToString(); dic["qty"] = dr["qty"].ToString(); dic["income_qty"] = dr["income_qty"].ToString(); dic["status"] = dr["status"].ToString(); dic["material_desc"] = dr["material_desc"].ToString(); dic["vender_no"] = dr["vender_no"].ToString(); dic["vender_name"] = dr["vender_name"].ToString(); dic["inventory_id"] = dr["inventory_id"].ToString(); dic["stock_no"] = txt_stock_no.Text; if (!dic_sap_po.ContainsKey(dic["material_no"])) { dic_sap_po.Add(dic["material_no"], dic); } else { dic_sap_po[dic["material_no"]] = dic; } } return(dt); } catch (Exception ex) { ShowHint(ex.Message, Color.Red); return(null); } }
public static DataTable SearchFromRInventoryIdByKpNo(string kpno) { try { Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("material_no", kpno); SearchRInventoryId sr = new SearchRInventoryId(dic); sr.ExecuteQuery(); return(sr.GetResult()); } catch (Exception ex) { throw ex; } }
private void textBox_trsn_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode != Keys.Enter) { return; } if (string.IsNullOrEmpty(textBox_trsn.Text)) { ShowHint("请先输入单号", Color.Red); return; } DataTable dt = new DataTable(); Dictionary <string, object> dic = new Dictionary <string, object>(); try { dic.Add("stock_no", textBox_trsn.Text); dic.Add("stockno_type", 8); SearchRInventoryId sr = new SearchRInventoryId(dic); sr.ExecuteQuery(); dt = sr.GetResult(); if (dt == null || dt.Rows.Count == 0) { ShowHint("在R_Inventory_Id中查询不到该工单或者该工单类型为7,无数据需要删除", Color.Lime); return; } } catch (Exception ex) { ShowHint("SearchRInventoryId:" + ex.Message, Color.Red); return; } try { dic.Clear(); dic.Add("stock_no", textBox_trsn.Text); //dic.Add("stock_out_no", ""); dic.Add("status", "1"); SearchRInventoryDetail sd = new SearchRInventoryDetail(dic); sd.ExecuteQuery(); dt = sd.GetResult(); if (dt == null || dt.Rows.Count == 0) { ShowHint("该工单无数据需要推送", Color.Lime); return; } } catch (Exception ex) { ShowHint("SearchRInventoryDetail:" + ex.Message, Color.Red); return; } Print("共需要推送:" + dt.Rows.Count + " 条数据!"); foreach (DataRow dr in dt.Rows) { if (!string.IsNullOrEmpty(dr["tr_sn"].ToString())) { try { if (Phicomm_WMS.OUTIO.tR_Tr_Sn.DelTrSn(dr["tr_sn"].ToString())) { Print("删除TrSn=" + dr["tr_sn"].ToString() + " 的线边仓信息成功!"); } } catch (Exception ex) { Print("TrSn=" + dr["tr_sn"].ToString() + ", " + ex.Message); } } } Print("删除完毕"); }