| | |
| | | public DAL.ClsGy_SOPBill BillOld = new DAL.ClsGy_SOPBill(); |
| | | public bool BillChange; // |
| | | public DataGridView grdMain = new System.Windows.Forms.DataGridView(); |
| | | ClsGridViewSum oSumGrid = new ClsGridViewSum(); |
| | | ClsGridViewSum oSumGrid = new ClsGridViewSum(); |
| | | //è·åç³»ç»åæ° |
| | | Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter(); |
| | | |
| | | //å®ä¹ |
| | | public const Int16 HTagCol = 0; |
| | |
| | | List<SOPBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SOPBill>>(msg2); |
| | | |
| | | string HBillNo = list[0].HBillNo; |
| | | int HInterID = list[0].HInterID; |
| | | DateTime HDate = list[0].HDate; |
| | | string HName = list[0].HName; |
| | | int HMaterID = list[0].HMaterID; |
| | |
| | | ",HYear,HPeriod,HRemark,HMaker,Hmakedate,HMaterID,HName,HMaterTypeID" + |
| | | ",HUnitID,HMaterNumber,HUnitNumber,HStandard" + |
| | | ") " + |
| | | " values('" + 3305 + "'," + lID + ",'" + HBillNo + "'," + "getdate()" + |
| | | " values('" + 3305 + "'," + HInterID + ",'" + HBillNo + "'," + "getdate()" + |
| | | "," + "datepart(yyyy,GETDATE())" + "," + "datepart(mm,getdate())" + ",'" + HRemark + "','" + HMaker + "'," + "getdate()" + "," + HMaterID.ToString() + ",'" + HName + "'," + HMaterTypeID + |
| | | "," + HUnitID.ToString() + ",'" + HMaterNumber + "','" + HUnitNumber + "','" + HStandard.ToString() + |
| | | "') "); |
| | | |
| | | oCN.RunProc("update Gy_BillNumber set IDNow=IDNow+1 where BillType='" + BillType.Trim() + "'"); |
| | | //oCN.RunProc("update Gy_BillNumber set IDNow=IDNow+1 where BillType='" + BillType.Trim() + "'"); |
| | | //" values(" + 3305 + "','" + 12333 + "','" + "test" + "','" + HDate + "','" + |
| | | //2022 + "','" + 11 + "','" + HRemark + "','" + "Test" + "','" + "2022-11-04" + "','" + HMaterID.ToString() + "','" + HName + "','" + "656" + |
| | | //"','" + HUnitID.ToString() + "','" + HMaterNumber + "','" + HUnitNumber + "','" + HStandard.ToString() + |
| | |
| | | "(HInterID,HEntryID,HProcID,HProcNO" + |
| | | ",HWorkStationID,HCenterID,HRemark" + |
| | | ") values(" |
| | | + lID + "," + 1 + "," + HProcID + "," + HProcNo + |
| | | + HInterID + "," + 1 + "," + HProcID + "," + HProcNo + |
| | | "," + HWorkStationID + "," + HCenterID + ",'" + HRemark2 + "'" + |
| | | ") "); |
| | | |
| | |
| | | } |
| | | } |
| | | #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(); //ç¨æ· |
| | | DBUtility.ClsPub.CurUserName = user; |
| | | |
| | | 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 = "ä¿åæåï¼"; |
| | | 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() |
| | |
| | | [HttpPost] |
| | | public object UploadFile1() |
| | | { |
| | | |
| | | string path=""; |
| | | string HBillNo = HttpContext.Current.Request.Params["HBillNo"]; //åæ®å· |
| | | string HRemark = HttpContext.Current.Request.Params["HRemark"]; //夿³¨ |
| | | string HUserName = HttpContext.Current.Request.Params["HUserName"]; //å建人 |
| | | 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 Ret = ""; |
| | | if (oSystemParameter.ShowBill(ref Ret)) |
| | | { |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "æå·æ¯è«å°") |
| | | { |
| | | path = "D:/ç½ç«åå¸/MES/MESæµè¯/LAYUI/Files/SOP/" + HBillNo; |
| | | } |
| | | else |
| | | { |
| | | path = HttpContext.Current.Server.MapPath("~/../Files/SOP/" + HBillNo); |
| | | } |
| | | } |
| | | //string path = @"D:\\Files\\"+ HBillNo; |
| | | dynamic dyResult = UpLoadFile(files, path, HBillNo, HRemark, HUserName); |
| | | Int64 HEntryID = Convert.ToInt64(HttpContext.Current.Request.Params["HEntryID"]); //åå
ç |
| | | dynamic dyResult = UpLoadFile(files, path, HBillNo, HInterID, HUserName, HEntryID); |
| | | if (dyResult != null && dyResult.result == 1) |
| | | { |
| | | objJsonResult.code = "1"; |
| | |
| | | objJsonResult.Message = dyResult.returnval; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | public dynamic UpLoadFile(HttpPostedFile files, string path, string HBillNo, string HRemark, string HUserName) |
| | | public dynamic UpLoadFile(HttpPostedFile files, string path, string HBillNo, string HInterID, string HUserName,Int64 HEntryID) |
| | | { |
| | | dynamic Result_Ob = new { result = 1, returnval = "ä¸ä¼ æåï¼" }; |
| | | string filePath = Path.GetFullPath(files.FileName);//æä»¶ä¸ä¼ è·¯å¾ |
| | |
| | | { |
| | | File.Delete(fileurl); //å 餿宿件 |
| | | files.SaveAs(fileurl); |
| | | string StrPath = "/files/" + HBillNo + "/" + filename; |
| | | string StrPath = ""; |
| | | string Ret = ""; |
| | | if (oSystemParameter.ShowBill(ref Ret)) |
| | | { |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "æå·æ¯è«å°") |
| | | { |
| | | StrPath = "D:/ç½ç«åå¸/MES/MESæµè¯/LAYUI/Files/SOP/" + HBillNo + "/" + filename; |
| | | } |
| | | else |
| | | { |
| | | 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() + "'" + |
| | | ",'" + HUserName + "',getdate()" + ",'" + Sno + "','" + 0 + "','" + Sno + "','" + lID + "','" + 0 + |
| | | + filename.ToString() + "','" + StrPath.ToString() + "','" + fileExtension.ToString() + "'" + |
| | | ",'" + HUserName + "',getdate()" + ",'" + HInterID + "','" + HEntryID + "','" + Sno + "','" + lID + "','" + filesize + |
| | | "') "); |
| | | } |
| | | else |
| | |
| | | else |
| | | { |
| | | Directory.CreateDirectory(fileSavePath); //æ·»å æä»¶å¤¹ |
| | | files.SaveAs(fileurl); |
| | | string StrPath = "/files/" + HBillNo + "/" + filename; |
| | | files.SaveAs(fileurl); |
| | | string StrPath = ""; |
| | | string Ret = ""; |
| | | //if (oSystemParameter.ShowBill(ref Ret)) |
| | | //{ |
| | | // if (oSystemParameter.omodel.WMS_CampanyName == "æå·æ¯è«å°") |
| | | // { |
| | | // StrPath = "D:/ç½ç«åå¸/MES/MESæµè¯/LAYUI/Files/SOP/" + HBillNo + "/" + filename; |
| | | // } |
| | | // else |
| | | // { |
| | | // StrPath = "/files/SOP/" + HBillNo + "/" + filename; |
| | | // } |
| | | //} |
| | | 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() + "'" + |
| | | ",'" + HUserName + "',getdate()" + ",'" + 111 + "','" + 222 + "','" + 333 + "','" + 444 + "','" + 555 + |
| | | + filename.ToString() + "','" + StrPath.ToString() + "','" + fileExtension.ToString() + "'" + |
| | | ",'" + HUserName + "',getdate()" + ",'" + HInterID + "','" + HEntryID + "','" + Sno + "','" + lID + "','" + filesize + |
| | | "') "); |
| | | } |
| | | else |
| | |
| | | return Result_Ob; |
| | | } |
| | | |
| | | |
| | | #region ä½ä¸æå¯¼ä¹¦ç¼è¾ |
| | | |
| | | [Route("Gy_SOPBill/GetGy_SOPEdit")] |
| | | [HttpGet] |
| | | public object GetSB_EquipICMOTechParamBill_Json(Int64 HInterID, string HMaker) |
| | | { |
| | | try |
| | | { |
| | | //夿æé |
| | | if (!DBUtility.ClsPub.Security_Log("Gy_SOPBill_Edit", 3, false, HMaker)) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æ¨æ²¡æè¯¥æ¨¡åç¼è¾æé,请ä¸ç®¡çåèç³»ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | |
| | | //è¿ååè¡¨ä¿¡æ¯ |
| | | ds = oCN.RunProcReturn("exec h_p_Gy_SOPBill_Edit " + HInterID, "h_p_Gy_SOPBill_Edit"); |
| | | if (ds == null || ds.Tables[0].Rows.Count == 0) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "æªæ¥è¯¢å°ä½ä¸æå¯¼ä¹¦ï¼è¯·å·æ°æ°æ®åéæ°éæ©ï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | else |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "æåï¼"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "è¿åä½ä¸æå¯¼ä¹¦ä¿¡æ¯å¤±è´¥ï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®åæ®å·æ¥æ¾ä¸ä¼ æä»¶å表 |
| | | /// </summary> |
| | | /// <param name="sWhere"></param> |
| | | /// <returns></returns> |
| | | [Route("Gy_SOPBill/GetFilelist")] |
| | | [HttpGet] |
| | | public object GetFilelist(string HBillNo,string HInterID) |
| | | { |
| | | string Ret = ""; |
| | | var url = ""; |
| | | if (oSystemParameter.ShowBill(ref Ret)) |
| | | { |
| | | if (oSystemParameter.omodel.WMS_CampanyName == "æå·æ¯è«å°") |
| | | { |
| | | url = "D:/ç½ç«åå¸/MES/MESæµè¯/LAYUI/Files/SOP/" + HBillNo + "/" ; |
| | | } |
| | | else |
| | | { |
| | | url = "/files/SOP/" + HBillNo + "/"; |
| | | } |
| | | } |
| | | try |
| | | { |
| | | ds = oCN.RunProcReturn("select *,'" + url + "'+CAST(HFileName as varchar(200))as url from Gy_SOPBillSub2 where HInterID='" + HInterID + "'", "Gy_SOPBillSub2"); |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "Sucessï¼"; |
| | | objJsonResult.data = ds.Tables[0]; |
| | | return objJsonResult; |
| | | |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// æ ¹æ®IDï¼å 餿件 |
| | | /// </summary> |
| | | /// <param name="sWhere"></param> |
| | | /// <returns></returns> |
| | | [Route("Gy_SOPBillEditController/DeleteFile")] |
| | | [HttpGet] |
| | | public object DeleteFile(string HFileID, string HPath) |
| | | { |
| | | try |
| | | { |
| | | // å 餿°æ®åºè®°å½ |
| | | oCN.RunProc("delete from Gy_SOPBillSub2 where HItemID =" + HFileID); |
| | | |
| | | //File.Delete(HPath); //å 餿宿件 |
| | | objJsonResult.code = "1"; |
| | | objJsonResult.count = 1; |
| | | objJsonResult.Message = "å 餿åï¼"; |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | objJsonResult.code = "0"; |
| | | objJsonResult.count = 0; |
| | | objJsonResult.Message = "Exceptionï¼" + e.ToString(); |
| | | objJsonResult.data = null; |
| | | return objJsonResult; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | } |