public string GetMaterialInfo(string jsMaterialInfo) { NetLog.Write("GetRawMaterialInfo" + " " + jsMaterialInfo); List <FDIGetMaterialInfo> mains = new List <FDIGetMaterialInfo>(); try { mains = SafeConverter.JsonDeserializeObject <List <FDIGetMaterialInfo> >(jsMaterialInfo); foreach (var main in mains) { var check = GetFDIGetMaterialInfos($"ItemCode = '{main.ItemCode}'"); foreach (var c in check) { DelFDIGetMaterialInfo(c.PKNO); } main.PKNO = CBaseData.NewGuid(); AddFDIGetMaterialInfo(main); } } catch (Exception ex) { NetLog.Error("GetRawMaterialInfo error", ex); return("error: " + ex.Message); } return("OK"); }
public bool Add([FromBody] string obj) { try { T t = SafeConverter.JsonDeserializeObject <T>(obj); return(Bll.Add(t)); } catch { return(false); } }
private async void button3_Click(object sender, RoutedEventArgs e) { //Add TestEFCodeFirst test = new TestEFCodeFirst() { PKNO = tbIn.Text, USER_NAME = "Test1", PASSWORD = "******", }; string value = SafeConverter.JsonSerializeObject(test); TestEFCodeFirst test2 = SafeConverter.JsonDeserializeObject <TestEFCodeFirst>(value); bool m_SysUser = (await testEfCodeFirstF.Add(test)); tbResult.Text = SafeConverter.JsonSerializeObject(m_SysUser); }
public string GetRawMaterial(string jsMaterialMain, string jsMaterialDetail) { NetLog.Write("GetRawMaterial" + " " + jsMaterialMain); NetLog.Write("GetRawMaterial" + " " + jsMaterialDetail); List <FDIGetRawMaterial> mains = new List <FDIGetRawMaterial>(); List <FDIGetRawMaterialDetail> detials = new List <FDIGetRawMaterialDetail>(); try { mains = SafeConverter.JsonDeserializeObject <List <FDIGetRawMaterial> >(jsMaterialMain); detials = SafeConverter.JsonDeserializeObject <List <FDIGetRawMaterialDetail> >(jsMaterialDetail); foreach (var main in mains) { var check = GetFDIGetRawMaterials($"DocEntry = '{main.DocEntry}'"); foreach (var c in check) { DelFDIGetRawMaterial(c.PKNO); } main.PKNO = CBaseData.NewGuid(); AddFDIGetRawMaterial(main); } foreach (var detail in detials) { var check = GetFDIGetRawMaterialDetails($"DocEntry = '{detail.DocEntry}' and LineId = '{detail.LineId}'"); foreach (var c in check) { DelFDIGetRawMaterialDetail(c.PKNO); } detail.PKNO = CBaseData.NewGuid(); AddFDIGetRawMaterialDetail(detail); } } catch (Exception ex) { NetLog.Error("GetRawMaterial error", ex); return("error: " + ex.Message); } return("OK"); }
public string GetRawMaterial(string jsMaterialMain, string jsMaterialDetail) { List <FDIGetMaterial> mains = new List <FDIGetMaterial>(); List <FDIGetMaterialDetail> detials = new List <FDIGetMaterialDetail>(); try { mains = SafeConverter.JsonDeserializeObject <List <FDIGetMaterial> >(jsMaterialMain); detials = SafeConverter.JsonDeserializeObject <List <FDIGetMaterialDetail> >(jsMaterialDetail); foreach (var main in mains) { var check = GetFDIGetMaterials($"ReciverID = '{main.ReciverID}'"); foreach (var c in check) { DelFDIGetMaterial(c.PKNO); } main.PKNO = CBaseData.NewGuid(); AddFDIGetMaterial(main); } foreach (var detail in detials) { var check = GetFDIGetMaterialDetails($"ReciverID = '{detail.ReciverID}'"); foreach (var c in check) { DelFDIGetMaterialDetail(c.PKNO); } detail.PKNO = CBaseData.NewGuid(); AddFDIGetMaterialDetail(detail); } } catch (Exception ex) { return("error: " + ex.Message); } return("OK"); }
public string GetWorkOrder(string jsWOMain, string jsWODetail) { NetLog.Write("GetWorkOrder" + " " + jsWOMain); NetLog.Write("GetWorkOrder" + " " + jsWODetail); List <FDIGetWOrder> mains = new List <FDIGetWOrder>(); List <FDIGetWOrderDetail> detials = new List <FDIGetWOrderDetail>(); //String jsWOMain = "[{\r\n" + // "\"DocEntry\": \"5\",\r\n" + // "\"ItemCode\": \"P00000001\",\r\n" + // "\"Status\": \"L\",\r\n" + // "\"Type\": \"S\",\r\n" + // "\"PlannedQty\": \"100.000000\",\r\n" + // " \"Comments\": \"\",\"RlsDate\": \"2019-03-26\",\r\n" + // " \"Warehouse\": \"W001\",\r\n" + // "\"Project\": \"\",\r\n" + // "\"OcrCode\": \"\",\r\n" + // "\"OcrCode2\": \"\",\r\n" + // " \"OcrCode3\": \"\",\"OcrCode4\": \"\",\r\n" + // "\"OcrCode5\": \"\",\r\n" + // "\"OriginNum\": \"-1\",\r\n" + // "\"Cardcode\": \"\",\r\n" + // "\"UserSign\": \"9\",\r\n" + // "\"StartDate\": \"2019-03-26\",\"DueDate\": \"2019-03-26\",\r\n" + // "\"DocTime\": \"142602\",\r\n" + // "\"Udf1\": \"\",\r\n" + // "\"Udf2\": \"\",\r\n" + // "\"Udf3\": \"\",\r\n" + // "\"Udf4\": \"\",\r\n" + // " \"Udf5\": \"\"\r\n" + // "}\r\n" + // "]"; //String jsWODetail = "[{\r\n" + // "\"DocEntry\": \"5\",\r\n" + // "\"LineNum\": \"0\",\r\n" + // " \"ItemCode\": \"M00000001\",\r\n" + // " \"ItemName\": \"16寸轮毂毛坯\",\r\n" + // " \"BaseQty\": \"1.000000\",\r\n" + // " \"PlannedQty\": \"100.000000\",\r\n" + // " \"WareHouse\": \"W001\",\r\n" + // " \"Project\": \"\",\r\n" + // " \"OcrCode\": \"\",\r\n" + // " \"OcrCode2\": \"\",\r\n" + // " \"OcrCode3\": \"\",\r\n" + // " \"OcrCode4\": \"\",\r\n" + // " \"OcrCode5\": \"\",\r\n" + // " \"Udf1\": \"\",\r\n" + // " \"Udf2\": \"\",\r\n" + // " \"Udf3\": \"\",\r\n" + // " \"Udf4\": \"\",\r\n" + // " \"Udf5\": \"\"\r\n" + // " }\r\n" + // "]"; try { mains = SafeConverter.JsonDeserializeObject <List <FDIGetWOrder> >(jsWOMain); detials = SafeConverter.JsonDeserializeObject <List <FDIGetWOrderDetail> >(jsWODetail); foreach (var main in mains) { var check = GetFDIGetWOrders($"DocEntry = '{main.DocEntry}'"); foreach (var c in check) { DelFDIGetWOrder(c.PKNO); } main.PKNO = CBaseData.NewGuid(); AddFDIGetWOrder(main); } foreach (var detail in detials) { var check = GetFDIGetWOrderDetails($"DocEntry = '{detail.DocEntry}'and LineNum = '{detail.LineNum}'"); foreach (var c in check) { DelFDIGetWOrderDetail(c.PKNO); } detail.PKNO = CBaseData.NewGuid(); AddFDIGetWOrderDetail(detail); } } catch (Exception ex) { NetLog.Error("GetRawMaterial error", ex); return("error: " + ex.Message); } return("OK"); }