| | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region ä¿ååæ® |
| | | [Route("Gy_SOPBill/Save")] |
| | | [HttpPost] |
| | | public object Save([FromBody] JObject oMain) |
| | | { |
| | | try |
| | | { |
| | | var _value = oMain["oMain"].ToString(); |
| | | string msg1 = _value.ToString(); |
| | | string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); |
| | | string msgMain = sArray[0].ToString(); //è¡¨å¤´ä¿¡æ¯ |
| | | string msgSub = sArray[1].ToString(); //表ä½ä¿¡æ¯ |
| | | string OperationType = sArray[2].ToString(); //æä½ç±»å |
| | | string user = sArray[3].ToString(); //ç¨æ· |
| | | |
| | | ListModels oListModels = new ListModels(); |
| | | DAL.ClsGy_SOPBill oBill = new DAL.ClsGy_SOPBill(); |
| | | List<Model.ClsGy_SOPBillMain> lsmain = new List<Model.ClsGy_SOPBillMain>(); |
| | | msgMain = msgMain.Replace("\\", ""); |
| | | msgMain = msgMain.Replace("\n", ""); //\n |
| | | lsmain = oListModels.getObjectByJson_Gy_SOPBillMain(msgMain); |
| | | foreach (Model.ClsGy_SOPBillMain oItem in lsmain) |
| | | { |
| | | oBill.omodel = oItem; |
| | | } |
| | | //è¡¨ä½æ°æ® |
| | | //æ },{æ¥æåæ°ç» //廿ãåã |
| | | msgSub = msgSub.Substring(1, msgSub.Length - 2); |
| | | msgSub = msgSub.Replace("\\", ""); |
| | | msgSub = msgSub.Replace("\n", ""); //\n |
| | | //msg2 = msg2.Replace("'", "â"); |
| | | List<Model.ClsGy_SOPBillSub> ls = new List<Model.ClsGy_SOPBillSub>(); |
| | | ls = oListModels.getObjectByJson_Gy_SOPBillSub(msgSub); |
| | | int i = 0; |
| | | foreach (Model.ClsGy_SOPBillSub oItemSub in ls) |
| | | { |
| | | |
| | | i++; |
| | | oItemSub.HEntryID = i; |
| | | |
| | | oBill.DetailColl.Add(oItemSub); |
| | | |
| | | } |
| | | //ä¿å |
| | | //ä¿å宿¯åå¤ç |
| | | bool bResult; |
| | | if (OperationType == "1" || OperationType == "2") |
| | | { |
| | | // bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | bResult = oBill.AddBill(ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | else |
| | | { |
| | | bResult = oBill.ModifyBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo); |
| | | } |
| | | if (bResult) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "ä¿åæåï¼"; |
| | | //WebAPIController.Add_Log("éè´§å䏿¨", UserName, "çæéè´§å"); |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "ä¿å失败ï¼" + DBUtility.ClsPub.sExeReturnInfo; |
| | | objJsonResult.data = 1; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | oCN.RollBack(); |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.Message; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | [Route("Gy_SOPBill/Use")] |
| | | [HttpGet] |
| | | public object sy_Click() |
| | |
| | | |
| | | string HBillNo = HttpContext.Current.Request.Params["HBillNo"]; //åæ®å· |
| | | string HUserName = HttpContext.Current.Request.Params["HUserName"]; //å建人 |
| | | string HInterID = HttpContext.Current.Request.Params["HInterID"]; //å建人 |
| | | HttpPostedFile files = HttpContext.Current.Request.Files["file"]; //忮䏻å
ç |
| | | string path = HttpContext.Current.Server.MapPath("~/../Files/" + HBillNo); |
| | | string HInterID = HttpContext.Current.Request.Params["HInterID"]; //åæ®å
ç |
| | | HttpPostedFile files = HttpContext.Current.Request.Files["file"]; //æä»¶ |
| | | string path = HttpContext.Current.Server.MapPath("~/../Files/SOP/" + HBillNo); |
| | | //string path = @"D:\\Files\\"+ HBillNo; |
| | | Int64 HEntryID = Convert.ToInt64(HttpContext.Current.Request.Params["HEntryID"]); //åå
ç |
| | | dynamic dyResult = UpLoadFile(files, path, HBillNo, HInterID, HUserName, HEntryID); |
| | |
| | | objJsonResult.Message = dyResult.returnval; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | public dynamic UpLoadFile(HttpPostedFile files, string path, string HBillNo, string HInterID, string HUserName,Int64 HEntryID) |
| | |
| | | { |
| | | File.Delete(fileurl); //å 餿宿件 |
| | | files.SaveAs(fileurl); |
| | | string StrPath = "/files/" + HBillNo + "/" + filename; |
| | | string StrPath = "/files/SOP/" + HBillNo + "/" + filename; |
| | | if (File.Exists(fileurl)) |
| | | { |
| | | //è¿éå¯ä»¥æ§è¡ä¸äºå
¶å®çæä½ï¼æ¯å¦æ´æ°æ°æ®åº |
| | |
| | | oCN.RunProc("Insert into Gy_SOPBillSub2 (HFileName,HPath,HFileType" + |
| | | ",HUpMan,HUpTime,HInterID,HEntryID,HSno,HFileID,HFileSize" + |
| | | ") values('" |
| | | + filename.ToString() + "','" + filePath.ToString() + "','" + fileExtension.ToString() + "'" + |
| | | + filename.ToString() + "','" + StrPath.ToString() + "','" + fileExtension.ToString() + "'" + |
| | | ",'" + HUserName + "',getdate()" + ",'" + HInterID + "','" + HEntryID + "','" + Sno + "','" + lID + "','" + filesize + |
| | | "') "); |
| | | } |
| | |
| | | { |
| | | Directory.CreateDirectory(fileSavePath); //æ·»å æä»¶å¤¹ |
| | | files.SaveAs(fileurl); |
| | | string StrPath = "/files/" + HBillNo + "/" + filename; |
| | | string StrPath = "/files/SOP/" + HBillNo + "/" + filename; |
| | | if (File.Exists(fileurl)) |
| | | { |
| | | //è¿éå¯ä»¥æ§è¡ä¸äºå
¶å®çæä½ï¼æ¯å¦æ´æ°æ°æ®åº |
| | |
| | | oCN.RunProc("Insert into Gy_SOPBillSub2 (HFileName,HPath,HFileType" + |
| | | ",HUpMan,HUpTime,HInterID,HEntryID,HSno,HFileID,HFileSize" + |
| | | ") values('" |
| | | + filename.ToString() + "','" + filePath.ToString() + "','" + fileExtension.ToString() + "'" + |
| | | + filename.ToString() + "','" + StrPath.ToString() + "','" + fileExtension.ToString() + "'" + |
| | | ",'" + HUserName + "',getdate()" + ",'" + HInterID + "','" + HEntryID + "','" + Sno + "','" + lID + "','" + filesize + |
| | | "') "); |
| | | } |