public ActionResult Insert(MED07_0000 model) { MED07_0000 data = new MED07_0000(); //在取完畫面上的值後,如果有一些別名欄位要變更值,可以在這邊2次加工 data.mo_code = "mo_code"; data.wrk_code = "wrk_code"; data.mac_code = "mac_code"; data.pro_code = "pro_code"; data.lot_no = "lot_no"; data.pro_qty = 1; data.pro_unit = "cm"; data.loc_code = "loc_code"; data.ins_date = DateTime.Now.ToString("yyyy/MM/dd"); data.ins_time = DateTime.Now.ToString("HH:mm:ss"); data.usr_code = "Derrick"; data.des_memo = "des_memo"; data.is_ng = "Y"; data.is_end = "Y"; data.end_memo = "end_memo"; data.end_date = DateTime.Now.ToString("yyyy/MM/dd"); data.end_time = DateTime.Now.ToString("HH:mm:ss"); data.end_usr_code = "Derrick"; //執行存檔 data.InsertData(data); //存完檔回到主頁,如果不跳回主頁要在這裡做修改 return(RedirectToAction("Index")); }
public ActionResult Index(FormCollection form) { string sMacCode = iWork.Get_MacCodeByMacAddress(); string sPerCode = iWork.Get_UserCodeByMacCode(sMacCode); string sOutQty = comm.sGetString(form["out_qty"].ToString()); string sProCode = comm.sGetString(form["pro_code"].ToString()); string sLotNo = comm.sGetString(form["lot_no"].ToString()); MED07_0000 med07_0000 = new MED07_0000(); comm.Set_ModelValue(med07_0000, form); med07_0000.user_field_01 = form["user_field_01"]; med07_0000.user_field_02 = form["user_field_02"]; med07_0000.user_field_03 = form["user_field_03"]; med07_0000.user_field_04 = form["user_field_04"]; med07_0000.user_field_05 = form["user_field_05"]; med07_0000.user_field_06 = form["user_field_06"]; med07_0000.user_field_07 = form["user_field_07"]; med07_0000.user_field_08 = form["user_field_08"]; med07_0000.user_field_09 = form["user_field_09"]; med07_0000.user_field_10 = form["user_field_10"]; if (form["user_field_01"] == null) { med07_0000.user_field_01 = ""; } if (form["user_field_02"] == null) { med07_0000.user_field_02 = ""; } if (form["user_field_03"] == null) { med07_0000.user_field_03 = ""; } if (form["user_field_04"] == null) { med07_0000.user_field_04 = ""; } if (form["user_field_05"] == null) { med07_0000.user_field_05 = ""; } if (form["user_field_06"] == null) { med07_0000.user_field_06 = ""; } if (form["user_field_07"] == null) { med07_0000.user_field_07 = ""; } if (form["user_field_08"] == null) { med07_0000.user_field_08 = ""; } if (form["user_field_09"] == null) { med07_0000.user_field_09 = ""; } if (form["user_field_10"] == null) { med07_0000.user_field_10 = ""; } med07_0000.InsertData(med07_0000); try { Dictionary <string, string> data = new Dictionary <string, string>(); data.Add("pro_code", sProCode); data.Add("lot_no", sLotNo); data.Add("mac_code", sMacCode); data.Add("per_code", sPerCode); data.Add("pro_qty", sOutQty); string dataStr = JsonConvert.SerializeObject(data); //寫入退料記錄 string json = MesApi.Ins_PreparEdData(pubToken, dataStr); JObject obj_ins = JsonConvert.DeserializeObject <JObject>(json); ViewBag.message = obj_ins["Message"].ToString(); ////錯誤訊息 } catch (Exception e) { } return(View()); //string sKeyData = GD.Get_EpbField(PrgCode()); //string sFieldData = GD.Get_DataByArray(pubFieldTable, sKeyData, pubPKCode(), "field_code"); //string sMacCode = iWork.Get_MacCodeByMacAddress(); //string sPerCode = iWork.Get_UserCodeByMacCode(sMacCode); //string sMoCode = iWork.Get_MoCodeByMacCode(sMacCode); //string sWrkCode = iWork.Get_WrkCodeByMacCode(sMacCode); ////string sToken = GD.Get_Data("BDP08_0000", form["usr_code"], "usr_code", "token"); ////string sToken = "da21d7ca-a288-47c6-ad6f-40394c26"; ////string JsonApi = GD.DataToJson(sFieldData, form); ////WA.Ins_Login(sToken, JsonApi); //string tmp_lot_no = form["lot_no"].ToString(); //string pro_code = tmp_lot_no.Split('%')[0]; //string lot_no = tmp_lot_no.Split('%')[1]; //string pro_qty = tmp_lot_no.Split('%')[6]; //object data = new object(); //data = new //{ // mo_code = sMoCode, // wrk_code = sWrkCode, // mac_code = sMacCode, // pro_code = pro_code, // lot_no = lot_no, // pro_qty = pro_qty, // pro_unit = comm.sGetString(form["pro_unit"]), // loc_code = sMacCode,//暫用MacCode // ins_date = DateTime.Now.ToString("yyyy/MM/dd"), // ins_time = DateTime.Now.ToString("HH:mm:ss"), // usr_code = sPerCode, // des_memo = "", // is_ng = "N", // is_end = "N", // end_memo = "", // end_date = "", // end_time = "", // end_usr_code = "", //}; //DT.InsertData("MED07_0000", data); ////是否跳回MENU //string sIsReturnMenu = GD.Get_Data("BDP00_0000", "is_return_menu", "par_name", "par_value"); //if (sIsReturnMenu == "Y") //{ // return RedirectToAction("Index", "Main"); //} //return RedirectToAction("Index"); }