public JArray Create_ModelPo_South() { JArray pos = new JArray(); string sqlHeader = string.Format("select * from MM_PO_HEADER where STATUS = ''"); DataTable dt = DAL.SELECT_SQL(sqlHeader); int count = dt.Rows.Count; DataTable dtPokey = this.Get_Pokey(count); if (count > 0 && dtPokey.Rows.Count == count) { for (int i = 0; i < count; i++) { POInfor_Model po = new POInfor_Model(); IList <Podetail> podetails = new List <Podetail>(); string pokey_Infor = dtPokey.Rows[i][0].ToString(); po.pokey = pokey_Infor; po.potype = "1"; po.storerkey = "ow9305"; po.externpokey = dt.Rows[i]["Order_Number"].ToString(); po.whseid = "wmwhse7"; po.addwho = "wmsadmin"; po.editwho = "wmsadmin"; podetails = this.Create_PoDetail(po.externpokey, pokey_Infor); po.podetails = podetails; string output = JsonConvert.SerializeObject(po); JObject objectPo = JObject.Parse(output); pos.Add(objectPo); } } return(pos); }
public JArray Create_ModelPo() { JArray pos = new JArray(); string sqlHeader = string.Format("select * from MM_PO_HEADER where STATUS = ''"); DataTable dt = DAL.SELECT_SQL(sqlHeader); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { POInfor_Model po = new POInfor_Model(); IList <Podetail> podetails = new List <Podetail>(); string pokey_Infor = dt.Rows[i]["Order_Number"].ToString(); string type = dt.Rows[i]["Order_Type"].ToString().Trim(); switch (type) { case "19": po.potype = "0"; break; case "20": po.potype = "1"; break; case " ": po.potype = "1"; break; } po.pokey = pokey_Infor; po.storerkey = "ow0094"; po.externpokey = pokey_Infor; po.expectedreceiptdate = DateTime.Parse(dt.Rows[i]["Plan_Delivery_Date"].ToString()); po.podate = DateTime.Parse(dt.Rows[i]["Order_Date"].ToString()); po.sellername = dt.Rows[i]["Supplier_Number"].ToString(); po.whseid = "wmwhse3"; po.addwho = "wmsadmin"; po.editwho = "wmsadmin"; podetails = this.Create_PoDetail(po.externpokey, pokey_Infor); po.podetails = podetails; string output = JsonConvert.SerializeObject(po); JObject objectPo = JObject.Parse(output); pos.Add(objectPo); } } return(pos); }
public JArray Create_ModelPo() { JArray pos = new JArray(); string sqlHeader = string.Format("select * from MM_PO_HEADER where STATUS = '' and Warehouse_Number='90072'"); DataTable dt = DAL.SELECT_SQL(sqlHeader); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { try { POInfor_Model po = new POInfor_Model(); IList <Podetail> podetails = new List <Podetail>(); string pokey_mm = dt.Rows[i]["Order_Number"].ToString().Trim(); code = pokey_mm; string pokey_infor = dt.Rows[i]["Order_Number"].ToString().Trim().TrimStart('0'); string type = dt.Rows[i]["Order_Type"].ToString().Trim(); switch (type) { case "19": po.potype = "0"; break; case "6": po.potype = "0"; break; case "20": po.potype = "1"; break; case " ": po.potype = "1"; break; case "02": po.potype = "3"; break; default: po.potype = "1"; break; } po.pokey = pokey_infor; po.storerkey = "N0528"; po.externpokey = pokey_mm; po.externalpokey2 = dt.Rows[i]["Warehouse_Number"].ToString().Trim(); po.expectedreceiptdate = DateTime.Parse(dt.Rows[i]["Plan_Delivery_Date"].ToString().Trim()); po.podate = DateTime.Parse(dt.Rows[i]["Order_Date"].ToString().Trim()); po.sellername = dt.Rows[i]["Supplier_Number"].ToString().Trim().TrimStart('0'); po.whseid = "wmwhse3"; po.addwho = "wmsadmin"; po.editwho = "wmsadmin"; podetails = this.Create_PoDetail(pokey_mm, pokey_infor); po.podetails = podetails; string output = JsonConvert.SerializeObject(po); JObject objectPo = JObject.Parse(output); pos.Add(objectPo); } catch (Exception e) { string step = string.Format(Constant.MODEL_PO, "NORTH"); resultMapping.Handle_Error_Mapping(code, e.ToString(), step); continue; } } } return(pos); }