public ActionResult BulkUpdate(string[] ids, CyclecountViewModel header) { string msg = null; foreach (string s in ids) { //string CCNO = s.ToString(); string[] vars = s.Split(','); string CCNO = vars[0]; string DOCNO = vars[1]; CMD.CommandText = "WMS_DESKTOP"; CMD.Parameters.AddWithValue("@STATUS", 7); CMD.Parameters.AddWithValue("@USERID", header.USER); CMD.Parameters.AddWithValue("@USERNAME", header.USERNAME); CMD.Parameters.AddWithValue("@DOCNO", DOCNO); CMD.Parameters.AddWithValue("@WHNO", header.WHNO); CMD.Parameters.AddWithValue("@SUBDOCNO", CCNO); CMD.Parameters.AddWithValue("@DOCTYPE", "CycCount"); //CMD.Parameters.AddWithValue("@DUMUSERID", DUMUSER); dt.EXECUTENONQUERY_PROCE_FUNCT(CMD); CMD.Parameters.Clear(); } return(Json(msg)); }
public ActionResult Cyclecounts(CyclecountViewModel header) { string binno = header.BINNO; if (binno != null) { try { string[] strArr = binno.Split(','); for (int i = 0; i <= strArr.Length - 1; i++) { string SQL = "INSERT INTO WMS_CC_REQUEST (DOCDATE,ZONEID,BINNO,USERID,ACHIVE) VALUES('" + header.DATE1 + "','" + header.ZONEID + "','" + strArr[i] + "','" + header.USER + "','0')"; dt.EXECUTENONQUERY_FUNCT(SQL); } flag = 1; } catch { flag = 0; } } else { try { string zoneid = header.ZONEID; string[] strArr = zoneid.Split(','); for (int i = 0; i <= strArr.Length - 1; i++) { string SQL = "INSERT INTO WMS_CC_REQUEST (DOCDATE,ZONEID,BINNO,USERID,ACHIVE) VALUES('" + header.DATE1 + "','" + strArr[i] + "',null,'" + header.USER + "','0')"; dt.EXECUTENONQUERY_FUNCT(SQL); } flag = 1; } catch { flag = 0; } } // this.AddToastMessage("Success", "Done !!", ToastType.Success); return(Json(flag)); }
public ActionResult FileUpload(HttpPostedFileBase file, CyclecountViewModel header) { //string zone, bin; int flag = 0; if (file.ContentLength > 0) { var fileName = Path.GetFileName(file.FileName); var path = Path.Combine(Server.MapPath("~/assets/docs"), fileName + DateTime.Now.ToString("dd-MMM-yyyy_hh-mm-ss") + ".txt"); file.SaveAs(path); StreamReader SR = new StreamReader(path); CMD.CommandText = "WMS_NAVDATA_PULL"; CMD.Parameters.AddWithValue("@STATUS", 4); var DOCNO = dt.EXECUTESCALAR_PROCE_FUNCT(CMD); CMD.Parameters.Clear(); if (header.ZONENBIN == "ZONENBIN") { while (SR.Peek() >= 0) { string text; text = SR.ReadLine(); //string[] parts = text.Split(new char[] { ',' }); //zone = parts[0]; //bin = parts[1]; if (!string.IsNullOrEmpty(text)) { CMD.CommandText = "WMS_NAVDATA_PULL"; CMD.Parameters.AddWithValue("@STATUS", 5); CMD.Parameters.AddWithValue("@DOCNO", DOCNO); CMD.Parameters.AddWithValue("@WHNO", header.WHNO); CMD.Parameters.AddWithValue("@ZONEID", header.ZONEID); CMD.Parameters.AddWithValue("@BINNO", text); CMD.Parameters.AddWithValue("@USERID", header.USERHOLD); dt.EXECUTENONQUERY_PROCE_FUNCT(CMD); CMD.Parameters.Clear(); string SQL = "INSERT INTO WMS_CC_REQUEST (DOCDATE,ZONEID,BINNO,USERID,ACHIVE) VALUES('" + header.DATE1 + "','" + header.ZONEID + "','" + text + "','" + header.USERHOLD + "','0')"; dt.EXECUTENONQUERY_FUNCT(SQL); flag = 1; } } } else { while (SR.Peek() >= 0) { string text; text = SR.ReadLine(); if (!string.IsNullOrEmpty(text)) { CMD.CommandText = "WMS_NAVDATA_PULL"; CMD.Parameters.AddWithValue("@STATUS", 5); CMD.Parameters.AddWithValue("@DOCNO", DOCNO); CMD.Parameters.AddWithValue("@WHNO", header.WHNO); CMD.Parameters.AddWithValue("@ZONEID", text); CMD.Parameters.AddWithValue("@BINNO", "NULL"); CMD.Parameters.AddWithValue("@USERID", header.USERHOLD); dt.EXECUTENONQUERY_PROCE_FUNCT(CMD); CMD.Parameters.Clear(); string SQL = "INSERT INTO WMS_CC_REQUEST (DOCDATE,ZONEID,BINNO,USERID,ACHIVE) VALUES('" + header.DATE1 + "','" + text + "','NULL','" + header.USERHOLD + "','0')"; dt.EXECUTENONQUERY_FUNCT(SQL); flag = 2; } } } CYCLECOUNT_CLS P = new CYCLECOUNT_CLS(); if (flag == 2) { DataTable RESULT1 = dt.EXECUTEDATATABLE_FUNCT("SELECT DOCNO,WAREHOUSENO FROM WMS_CC_REQUEST WHERE DOCNO='" + DOCNO + "' and WAREHOUSENO='" + header.WHNO + "' group by DOCNO,WAREHOUSENO"); P.REQUESTID = RESULT1.Rows[0]["DOCNO"].ToString(); //P.LOCATION = RESULT1.Rows[0]["WAREHOUSENO"].ToString(); P.LOCATION = "KW"; DataTable RESULTDET = dt.EXECUTEDATATABLE_FUNCT("SELECT ZONEID FROM WMS_CC_REQUEST WHERE DOCNO='"+ DOCNO + "' and WAREHOUSENO='" + header.WHNO + "'"); List <lstZONEID> PTDTL = new List <lstZONEID>(); int zonecount = RESULTDET.Rows.Count; for (int j = 0; j < zonecount; j++) { lstZONEID DET = new lstZONEID(); DET.ZONEID = RESULTDET.Rows[j]["ZONEID"].ToString(); PTDTL.Add(DET); P.lstZONEID = PTDTL; } } if (flag == 1) { DataTable RESULT1 = dt.EXECUTEDATATABLE_FUNCT("SELECT DOCNO,WAREHOUSENO FROM WMS_CC_REQUEST WHERE DOCNO='" + DOCNO + "' and WAREHOUSENO='" + header.WHNO + "' group by DOCNO,WAREHOUSENO"); P.REQUESTID = RESULT1.Rows[0]["DOCNO"].ToString(); P.LOCATION = RESULT1.Rows[0]["WAREHOUSENO"].ToString(); List <lstZONEID> PTDTL = new List <lstZONEID>(); for (int j = 0; j < 1; j++) { lstZONEID DET = new lstZONEID(); DET.ZONEID = header.ZONEID; PTDTL.Add(DET); P.lstZONEID = PTDTL; } DataTable RESULTBINDET = dt.EXECUTEDATATABLE_FUNCT("SELECT BINNO FROM WMS_CC_REQUEST WHERE DOCNO='"+ DOCNO + "' and WAREHOUSENO='" + header.WHNO + "'"); List <lstBINID> BINDTL = new List <lstBINID>(); int bincount = RESULTBINDET.Rows.Count; for (int j = 0; j < bincount; j++) { lstBINID DET = new lstBINID(); DET.BINID = RESULTBINDET.Rows[j]["BINNO"].ToString(); BINDTL.Add(DET); P.lstBINID = BINDTL; } } var jsonData1 = JsonConvert.SerializeObject(P); string json1 = jsonData1; try { //int sizeOfnavdata = NAVDATA.Count; //if (sizeOfnavdata > 0) //{ string webAddr = "http://52.32.169.118:8085/WMSIntegration/GetPutAwayDataFromWMS"; var httpWebRequest = (HttpWebRequest)WebRequest.Create(webAddr); httpWebRequest.ContentType = "application/json; charset=utf-8"; httpWebRequest.PreAuthenticate = true; httpWebRequest.Headers.Add("TokenValue", "B@WMS@at_ERPPut"); httpWebRequest.Method = "POST"; using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) { var jsonData = JsonConvert.SerializeObject(P); string json = jsonData; //streamWriter.Write(json); streamWriter.Flush(); } var httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse(); using (var streamReader = new StreamReader(httpWebResponse.GetResponseStream())) { var responseText = streamReader.ReadToEnd(); //List<PUTAWAY_CLS> PUTHEAD = new List<PUTAWAY_CLS>(); //var model = JsonConvert.DeserializeObject<List<PUTAWAY_CLS>>(responseText); //int c = model.Count(); //for (int i = 0; i < model.Count; i++) //{ // string docno = model[i].DOCNO.ToString(); // string whno = model[i].WAREHOUSENO.ToString(); // string putno = model[i].PUTNO.ToString(); // int count1 = model[i].lstPutAwayDataResponse.Count(); // for (int j = 0; j < count1; j++) // { // string itemno = model[i].lstPutAwayDataResponse[j].ITEMNO.ToString(); // string serialno = model[i].lstPutAwayDataResponse[j].SERIALNO.ToString(); // string success = model[i].lstPutAwayDataResponse[j].SUCCESS.ToString(); // if (success == "1") // { // dt.EXECUTENONQUERY_FUNCT("UPDATE WMS_PUTAWAY SET PUTSTATUS='3' WHERE DOCNO='" + docno + "'AND PUTNO='" + putno + "' AND WAREHOUSENO='" + whno + "' AND ITEMNO='" + itemno + "' AND SERIALNO='" + serialno + "'"); // } // } //} } // } } catch (WebException ex) { Console.WriteLine(ex.Message); } SR.Close(); } BindViewData(); ViewData["insert"] = flag; return(View("~/Views/Cyclecount/Cyclecounts.cshtml")); }