From b0688c1efd606284fd5bc31f2d60a1fec9aef968 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期二, 08 四月 2025 11:20:50 +0800
Subject: [PATCH] 自定义菜单优化
---
WebAPI/Controllers/基础资料/基础资料/Gy_SOPBillEditController.cs | 223 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 202 insertions(+), 21 deletions(-)
diff --git "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_SOPBillEditController.cs" "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_SOPBillEditController.cs"
index d09ad7d..9a84f8b 100644
--- "a/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_SOPBillEditController.cs"
+++ "b/WebAPI/Controllers/\345\237\272\347\241\200\350\265\204\346\226\231/\345\237\272\347\241\200\350\265\204\346\226\231/Gy_SOPBillEditController.cs"
@@ -28,6 +28,8 @@
public bool BillChange; //
public DataGridView grdMain = new System.Windows.Forms.DataGridView();
ClsGridViewSum oSumGrid = new ClsGridViewSum();
+ //鑾峰彇绯荤粺鍙傛暟
+ Pub_Class.ClsXt_SystemParameter oSystemParameter = new Pub_Class.ClsXt_SystemParameter();
//瀹氫箟
public const Int16 HTagCol = 0;
@@ -139,7 +141,7 @@
string msg1 = _value.ToString();
string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
string msg2 = sArray[0].ToString();
- string msg3 = sArray[1].ToString();//褰撳墠浜�
+ string msg3 = sArray[2].ToString();//褰撳墠浜�
//鍙嶅簭鍒楀寲
msg2 = "[" + msg2.ToString() + "]";
@@ -147,6 +149,7 @@
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;
@@ -159,6 +162,17 @@
string HRemark = list[0].HRemark;
bool HStandard = list[0].HStandard;
bool HUse = list[0].HUse;
+ string HMaker = msg3;
+ int HMaterTypeID = list[0].HMaterTypeID;
+
+ //瀛愯〃
+ List<SOPBillSub> list2 = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SOPBillSub>>(msg2);
+
+ int HProcNo = list2[0].HProcNo;
+ long HProcID = list2[0].HProcID;
+ long HWorkStationID = list2[0].HWorkStationID;
+ long HCenterID = list2[0].HCenterID;
+ string HRemark2 = list2[0].HRemark;
//鍒ゆ柇鏉冮檺
//if (!ClsPub.Security_Log("Gy_Repair_Edit", 1, false, msg3))
@@ -170,6 +184,17 @@
// return objJsonResult;
//}
+ DataSet CS;
+ Int64 lID = 0;
+ string BillType = "";
+ CS = oCN.RunProcReturn("select * from Gy_BillNumber with (nolock) where BillCode='" + 3305 + "'", "Gy_BillNumber");
+
+ if (CS.Tables[0].Rows.Count != 0)
+ {
+ lID = ClsPub.isLong(CS.Tables[0].Rows[0]["IDNow"].ToString());
+ BillType = CS.Tables[0].Rows[0]["BillType"].ToString().Trim();
+ }
+
//鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
oCN.BeginTran();
//涓昏〃
@@ -178,16 +203,28 @@
",HYear,HPeriod,HRemark,HMaker,Hmakedate,HMaterID,HName,HMaterTypeID" +
",HUnitID,HMaterNumber,HUnitNumber,HStandard" +
") " +
- " values('" + 3305 + "'," + HMaterID + ",'" + HMaterID + "','" + "2022-11-04" + "'" +
- "," + 2022 + "," + 11 + ",'" + HRemark + "','" + "Test" + "'," + "2022-11-04" + "," + HMaterID.ToString() + ",'" + HName + "'," + 656 +
+ " 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() + "'");
//" values(" + 3305 + "','" + 12333 + "','" + "test" + "','" + HDate + "','" +
//2022 + "','" + 11 + "','" + HRemark + "','" + "Test" + "','" + "2022-11-04" + "','" + HMaterID.ToString() + "','" + HName + "','" + "656" +
//"','" + HUnitID.ToString() + "','" + HMaterNumber + "','" + HUnitNumber + "','" + HStandard.ToString() +
//") ");
//淇敼涓婄骇涓洪潪鏈骇浠g爜
//oCN.RunProc("Update Gy_MouldType set HEndflag=0 where HItemID=" + HParentID, ref DBUtility.ClsPub.sExeReturnInfo);
+
+ //鎻掑叆瀛愯〃
+ oCN.RunProc("Insert into Gy_SOPBillSub " +
+ "(HInterID,HEntryID,HProcID,HProcNO" +
+ ",HWorkStationID,HCenterID,HRemark" +
+ ") values("
+ + HInterID + "," + 1 + "," + HProcID + "," + HProcNo +
+ "," + HWorkStationID + "," + HCenterID + ",'" + HRemark2 + "'" +
+ ") ");
+
oCN.Commit();
objJsonResult.code = "1";
@@ -206,6 +243,93 @@
}
}
#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 = "淇濆瓨鎴愬姛锛�";
+ //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()
@@ -254,14 +378,26 @@
[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";
@@ -277,11 +413,10 @@
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);//鏂囦欢涓婁紶璺緞
@@ -290,6 +425,25 @@
string fileSavePath = path;// 涓婁紶淇濆瓨璺緞
int filesize = files.ContentLength;//鑾峰彇涓婁紶鏂囦欢鐨勫ぇ灏忓崟浣嶄负瀛楄妭byte
int Maxsize = 40000 * 1024;//瀹氫箟涓婁紶鏂囦欢鐨勬渶澶х┖闂村ぇ灏忎负40M
+
+ DataSet CS;
+ Int64 lID = 0;
+ string BillType = "";
+ CS = oCN.RunProcReturn("select * from Gy_BillNumber with (nolock) where BillCode='" + 3305 + "'", "Gy_BillNumber");
+ if (CS.Tables[0].Rows.Count != 0)
+ {
+ lID = ClsPub.isLong(CS.Tables[0].Rows[0]["IDNow"].ToString())-1;
+ BillType = CS.Tables[0].Rows[0]["BillType"].ToString().Trim();
+ }
+
+ DataSet Ds;
+ Int64 Sno = 1;
+ Ds = oCN.RunProcReturn("select MAX(HSno) HSno from Gy_SOPBillSub2" , "Gy_SOPBillSub2");
+ if (Ds.Tables[0].Rows.Count != 0 && ClsPub.isLong(Ds.Tables[0].Rows[0]["HSno"].ToString())!= 0)
+ {
+ Sno = ClsPub.isLong(Ds.Tables[0].Rows[0]["HSno"].ToString());
+ Sno += 1;
+ }
try
{
@@ -316,17 +470,30 @@
{
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()" + ",'" + 0 + "','" + 0 + "','" + 0 + "','" + 0 + "','" + 0 +
- "') ");
+ ",HUpMan,HUpTime,HInterID,HEntryID,HSno,HFileID,HFileSize" +
+ ") values('"
+ + filename.ToString() + "','" + StrPath.ToString() + "','" + fileExtension.ToString() + "'" +
+ ",'" + HUserName + "',getdate()" + ",'" + HInterID + "','" + HEntryID + "','" + Sno + "','" + lID + "','" + filesize +
+ "') ");
}
else
{
@@ -336,8 +503,22 @@
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))
{
//杩欓噷鍙互鎵ц涓�浜涘叾瀹冪殑鎿嶄綔锛屾瘮濡傛洿鏂版暟鎹簱
@@ -345,8 +526,8 @@
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
--
Gitblit v1.9.1