public ActionResult Index(FormCollection form) { string sMacCode = iWork.Get_MacCodeByMacAddress(); string sPerCode = iWork.Get_UserCodeByMacCode(sMacCode); string sMoCode = iWork.Get_MoCodeByMacCode(sMacCode); string sWrkCode = iWork.Get_WrkCodeByMacCode(sMacCode); string pro_qty = comm.sGetString(form["pro_qty"].ToString()); string pro_lot_no = comm.sGetString(form["lot_no"].ToString()); //string pallet_code = comm.sGetString(form["pallet_code"].ToString()); //string pro_code = comm.sGetString(form["pro_code"].ToString()); Dictionary <string, string> data = new Dictionary <string, string>(); data.Add("mo_code", sMoCode); data.Add("wrk_code", sWrkCode); data.Add("mac_code", sMacCode); data.Add("per_code", sPerCode); data.Add("pro_qty", pro_qty); data.Add("pro_lot_no", pro_lot_no); //data.Add("pallet_code", pallet_code); //data.Add("pro_code", pro_code); string dataStr = JsonConvert.SerializeObject(data); //寫入上MED09_0000,call Ins_ProQtyData API string json = MesApi.Ins_ProQtyData(pubToken, dataStr, form); JObject obj_ins = JsonConvert.DeserializeObject <JObject>(json); //GET med09_0000 KEY AND UPDATE MED090A DATA string sSql = "select top(1) med09_0000 from MED09_0000 where 1 = 1 order by med09_0000 desc "; DataTable dtmp = comm.Get_DataTable(sSql); MED09_0000 med09_0000 = new MED09_0000(); comm.Set_ModelValue(med09_0000, form); med09_0000.med09_0000 = int.Parse(dtmp.Rows[0]["med09_0000"].ToString()); med09_0000.UpdateData(med09_0000); //錯誤訊息 ViewBag.message = obj_ins["Message"].ToString(); return(RedirectToAction("Index")); }
public ActionResult Index(FormCollection form) { string sMacCode = iWork.Get_MacCodeByMacAddress(); string sPerCode = iWork.Get_UserCodeByMacCode(sMacCode); string sMoCode = iWork.Get_MoCodeByMacCode(sMacCode); string sWrkCode = iWork.Get_WrkCodeByMacCode(sMacCode); string pro_qty = comm.sGetString(form["pro_qty"].ToString()); string pro_lot_no = comm.sGetString(form["lot_no"].ToString()); //string pallet_code = comm.sGetString(form["pallet_code"].ToString()); //string pro_code = comm.sGetString(form["pro_code"].ToString()); Dictionary <string, string> data = new Dictionary <string, string>(); data.Add("mo_code", sMoCode); data.Add("wrk_code", sWrkCode); data.Add("mac_code", sMacCode); data.Add("per_code", sPerCode); data.Add("pro_qty", pro_qty); data.Add("pro_lot_no", pro_lot_no); //data.Add("pallet_code", pallet_code); //data.Add("pro_code", pro_code); string dataStr = JsonConvert.SerializeObject(data); //寫入上MED09_0000,call Ins_ProQtyData API string json = MesApi.Ins_ProQtyData(pubToken, dataStr); JObject obj_ins = JsonConvert.DeserializeObject <JObject>(json); ViewBag.message = obj_ins["Message"].ToString(); ////錯誤訊息 string sSql = "select top(1) med09_0000 from MED09_0000 where 1 = '1' order by med09_0000 desc "; DataTable dtmp = comm.Get_DataTable(sSql); MED09_0000 med09_0000 = new MED09_0000(); comm.Set_ModelValue(med09_0000, form); med09_0000.med09_0000 = int.Parse(dtmp.Rows[0]["med09_0000"].ToString()); med09_0000.UpdateData(med09_0000); //寫入生產資料 //string sMacCode = iWork.Get_MacCodeByMacAddress(); //string sPerCode = iWork.Get_UserCodeByMacCode(sMacCode); //string sMoCode = iWork.Get_MoCodeByMacCode(sMacCode); //string sWrkCode = iWork.Get_WrkCodeByMacCode(sMacCode); //float now_ok_qty = comm.sGetfloat(form["pro_qty"].ToString()); //string slot_no = comm.sGetString(form["lot_no"].ToString()); ////寫入生產資料 //MED09_0000 med09_0000 = new MED09_0000(); //comm.Set_ModelValue(med09_0000, form); //med09_0000.mo_code = sMoCode; //med09_0000.wrk_code = sWrkCode; //med09_0000.mac_code = comm.sGetString(sMacCode); //med09_0000.pro_code = comm.Get_QueryData("MET01_0000", sMoCode, "mo_code", "pro_code"); //med09_0000.pro_lot_no = slot_no; //med09_0000.pro_qty = comm.sGetDouble(form["pro_qty"].ToString()); //med09_0000.ins_date = comm.Get_Date(); //med09_0000.ins_time = comm.Get_Time(); //med09_0000.usr_code = sPerCode; //med09_0000.des_memo = ""; //med09_0000.is_ng = "N"; //med09_0000.is_end = "N"; //med09_0000.end_memo = ""; //med09_0000.end_date = ""; //med09_0000.end_time = ""; //med09_0000.end_usr_code = ""; //med09_0000.InsertData(med09_0000); //string sSql = "select ok_qty " + // " from MEM01_0000 " + // " where mo_code = '" + sMoCode + "' " + // " and mac_code ='" + sMacCode + "' "; //var dtDat = comm.Get_DataTable(sSql); //float tmp_ok = comm.sGetfloat(dtDat.Rows[0]["ok_qty"].ToString()); //string uSql = "update MEM01_0000 " + // " set ok_qty = '" + (tmp_ok + now_ok_qty) + "'" + // " where mo_code = '" + sMoCode + "' " + // " and mac_code ='" + sMacCode + "' "; //comm.Connect_DB(uSql); return(RedirectToAction("Index")); }