From 4ba9609d75b835d8d2ef361ca0fe68fa72dfe5e2 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期一, 14 十一月 2022 18:16:10 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API
---
.gitignore | 1
WebAPI/Controllers/BaseSet/Gy_MaterialController.cs | 27 -
WebAPI/Controllers/基础资料/基础资料/Gy_SOPBillController.cs | 369 +++----------------------
WebAPI/Controllers/基础资料/基础资料/Gy_SOPBillEditController.cs | 367 ++++++++++++++++++++++++++
WebAPI/Controllers/LMESController.cs | 22 +
WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs | 10
6 files changed, 459 insertions(+), 337 deletions(-)
diff --git a/.gitignore b/.gitignore
index 365c632..9c0164d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -141,3 +141,4 @@
/NETERPNoWin/obj
/WebAPI/Sc_MouldProdOutBill/Log
/PayM/bin/Debug
+/PayM/obj/x86/Debug
diff --git a/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs b/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
index c93a272..ea4537e 100644
--- a/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
+++ b/WebAPI/Controllers/BaseSet/Gy_MaterialController.cs
@@ -572,27 +572,21 @@
objJsonResult.data = null;
return objJsonResult;
}
- DataSet Ds, Ds2;
+ DataSet Ds;
Ds = oCN.RunProcReturn("Select * from h_v_IF_BarCodeBillList Where HItemID=" + lngBillKey.ToString(), "h_v_IF_BarCodeBillList");
if (Ds.Tables[0].Rows.Count != 0)
{
- oCN.BeginTran();
- Ds2 = oCN.RunProcReturn("Delete from Gy_BarCodeBill Where HItemID=" + lngBillKey.ToString(), "Gy_BarCodeBill");
- if (Ds2.Tables[0].Rows.Count != 0)
- {
- oCN.Commit();
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = "鍒犻櫎鎴愬姛";
- objJsonResult.data = null;
- return objJsonResult;
- }
- oCN.RollBack();
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = "鍒犻櫎澶辫触";
+ oCN.BeginTran();
+ oCN.RunProc("Delete from Gy_BarCodeBill Where HItemID=" + lngBillKey.ToString());
+
+ oCN.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍒犻櫎鎴愬姛";
objJsonResult.data = null;
return objJsonResult;
+
+
}
else
{
@@ -605,6 +599,7 @@
}
catch (Exception e)
{
+ oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
objJsonResult.Message = e.Message;
diff --git a/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs b/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs
index 00f955e..3f88755 100644
--- a/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs
+++ b/WebAPI/Controllers/CGGL/Cg_POOrderBillController.cs
@@ -57,7 +57,7 @@
bool isCgjl = Security_Log("Cg_POOrderBill_PurchasManager", 1, true, user);
if (!isCgjl)
{
- sWhere += $" and HEmpID in (select HEmpID from Gy_Czygl where Czymc='{user}' )";
+ sWhere += $" and HEmpID in (select HEmpID from Gy_Czygl where Czymc='{user}' and HEmpID >0 )";
}
string sql = "select * from h_v_IF_POOrderBillList where 1 = 1 " + sWhere;
ds = oCN.RunProcReturn(sql, "h_v_IF_POOrderBillList");
@@ -91,9 +91,9 @@
{
foreach (DataColumn item in ds.Tables[0].Columns)
{
- optionList.Add(@"{ field: 'hmainid', title: '"+ item.ToString() + "', sort: true, hide: false }");
+ optionList.Add(@"{ field: 'hmainid', title: '" + item.ToString() + "', sort: true, hide: false }");
}
- string option = string.Join(",",optionList);
+ string option = string.Join(",", optionList);
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Sucess锛�";
@@ -144,7 +144,7 @@
title = item.ToString(),
sort = true,
hide = false,
- });
+ });
}
string option = string.Join(",", optionList);
objJsonResult.code = "1";
@@ -661,5 +661,5 @@
//
}
-
+
}
\ No newline at end of file
diff --git a/WebAPI/Controllers/LMESController.cs b/WebAPI/Controllers/LMESController.cs
index d039b77..b30201c 100644
--- a/WebAPI/Controllers/LMESController.cs
+++ b/WebAPI/Controllers/LMESController.cs
@@ -1,4 +1,5 @@
-锘縰sing Newtonsoft.Json.Linq;
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
using System.Collections;
@@ -59,6 +60,7 @@
DataSet ds;
try
{
+ List<object> columnNameList = new List<object>();
//鍒ゆ柇鏄惁鏈夋煡璇㈡潈闄�
//if (!DBUtility.ClsPub.Security_Log("Sc_ProcessExchangeBill_Query", 1, false, user))
//{
@@ -72,11 +74,19 @@
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
ds = oCN.RunProcReturn("select * from h_v_Sc_ProcessExchangeBillQuery where 1 = 1 " + sWhere + " order by hmainid desc ", "h_v_Sc_ProcessExchangeBillQuery");
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
//if (ds.Tables[0].Rows.Count != 0 || ds != null)
//{
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Sucess锛�";
+ objJsonResult.list = columnNameList;
objJsonResult.data = ds.Tables[0];
return objJsonResult;
//}
@@ -599,11 +609,21 @@
{
try
{
+ List<object> columnNameList = new List<object>();
//if (ds.Tables[0].Rows.Count != 0 || ds != null)
//{
+ //娣诲姞鍒楀悕
+ foreach (DataColumn col in ds.Tables[0].Columns)
+ {
+ Type dataType = col.DataType;
+ string ColmString = "{\"ColmCols\":\"" + col.ColumnName + "\",\"ColmType\":\"" + dataType.Name + "\"}";
+ columnNameList.Add(JsonConvert.DeserializeObject(ColmString));//鑾峰彇鍒癉ataColumn鍒楀璞$殑鍒楀悕
+ }
+
objJsonResult.code = "1";
objJsonResult.count = 1;
objJsonResult.Message = "Sucess锛�";
+ objJsonResult.list = columnNameList;
objJsonResult.data = ds.Tables[0];
return objJsonResult;
//}
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_SOPBillController.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_SOPBillController.cs"
index d315210..c9a5385 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_SOPBillController.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_SOPBillController.cs"
@@ -1,19 +1,15 @@
-锘縰sing Newtonsoft.Json.Linq;
-using NPOI.HSSF.UserModel;
-using NPOI.SS.UserModel;
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
using Pub_Class;
using System;
+using System.Collections;
using System.Collections.Generic;
using System.Data;
-using System.IO;
-using System.Net;
-using System.Net.Http;
-using System.Net.Http.Headers;
-using System.Runtime.InteropServices;
-using System.Web;
+using System.Data.SqlClient;
using System.Web.Http;
-using System.Windows.Forms;
using WebAPI.Models;
+using WebAPI.Service;
+
namespace WebAPI.Controllers.鍩虹璧勬枡.鍩虹璧勬枡
{
public class Gy_SOPBillController : ApiController
@@ -23,344 +19,87 @@
private json objJsonResult = new json();
SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
DataSet ds;
- public DAL.ClsGy_SOPBill BillNew = new DAL.ClsGy_SOPBill();
- public DAL.ClsGy_SOPBill BillOld = new DAL.ClsGy_SOPBill();
- public bool BillChange; //
- public DataGridView grdMain = new System.Windows.Forms.DataGridView();
- ClsGridViewSum oSumGrid = new ClsGridViewSum();
- //瀹氫箟
- public const Int16 HTagCol = 0;
- public const Int16 HSnoCol = 1;
- public const Int16 HProcNoCol = 2;
- public const Int16 HProcIDCol = 3;
- public const Int16 HProcNumberCol = 4;
- public const Int16 HProcNameCol = 5;
- public const Int16 HWorkStationIDCol = 6;
- public const Int16 HWorkStationNumberCol = 7;
- public const Int16 HWorkStationNameCol = 8;
- public const Int16 HCenterIDCol = 9;
- public const Int16 HCenterNumberCol = 10;
- public const Int16 HCenterNameCol = 11;
- public const Int16 HRemarkCol = 12;
- public const Int16 HEntryIDCol = 13;
-
- DAL.ClsIF_Material_View oMater = new DAL.ClsIF_Material_View();
- DAL.ClsIF_Unit_View oUnit = new DAL.ClsIF_Unit_View();
- DAL.ClsIF_Process_View oProc = new DAL.ClsIF_Process_View();
- DAL.ClsGy_WorkStation_View oStation = new DAL.ClsGy_WorkStation_View();
- DAL.ClsGy_WorkCenter_View oCenter = new DAL.ClsGy_WorkCenter_View();
-
- #region 璇诲啓绫�
- //鏄剧ず鍗曟嵁
- public void Sub_ShowBill()
- {
- DAL.ClsIF_Material_View oMater = new DAL.ClsIF_Material_View();
- DAL.ClsIF_Unit_View oUnit = new DAL.ClsIF_Unit_View();
- DAL.ClsIF_Process_View oProc = new DAL.ClsIF_Process_View();
- DAL.ClsGy_WorkStation_View oStation = new DAL.ClsGy_WorkStation_View();
- DAL.ClsGy_WorkCenter_View oCenter = new DAL.ClsGy_WorkCenter_View();
- //ClsGy_SourceHlp oSource = new ClsGy_SourceHlp();
- //鍒ゆ柇鏄惁瀛樺湪鍗曟嵁
- if (BillOld.ShowBill(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == false)
- {
- MessageBox.Show(ClsPub.sExeReturnInfo, "鎻愮ず");
- return;
- }
- //grid绂佹鍒锋柊
-
-
- //鍔犺浇琛ㄤ綋
- int i = 0;
- foreach (Model.ClsGy_SOPBillSub oSub in BillOld.DetailColl)
- {
- if (i >= grdMain.RowCount - 1)
- grdMain.Rows.Add();
- grdMain.Rows[i].Cells[HTagCol].Value = "*";
-
- grdMain.Rows[i].Cells[HProcIDCol].Value = oSub.HProcID.ToString();
- if (oProc.GetInfoByID(oSub.HProcID))
- {
- grdMain.Rows[i].Cells[HProcNumberCol].Value = oProc.omodel.HNumber;
- grdMain.Rows[i].Cells[HProcNameCol].Value = oProc.omodel.HName;
- }
- else
- {
- grdMain.Rows[i].Cells[HProcNumberCol].Value = "";
- grdMain.Rows[i].Cells[HProcNameCol].Value = "";
- }
- //
- grdMain.Rows[i].Cells[HCenterIDCol].Value = oSub.HCenterID.ToString();
- if (oCenter.GetInfoByID(oSub.HCenterID))
- {
- grdMain.Rows[i].Cells[HCenterNumberCol].Value = oCenter.omodel.HNumber;
- grdMain.Rows[i].Cells[HCenterNameCol].Value = oCenter.omodel.HName;
- }
- else
- {
- grdMain.Rows[i].Cells[HCenterNameCol].Value = "";
- grdMain.Rows[i].Cells[HCenterNumberCol].Value = "";
- }
- //
- grdMain.Rows[i].Cells[HWorkStationIDCol].Value = oSub.HWorkStationID.ToString();
- if (oStation.GetInfoByID(oSub.HWorkStationID))
- {
- grdMain.Rows[i].Cells[HWorkStationNumberCol].Value = oStation.omodel.HNumber;
- grdMain.Rows[i].Cells[HWorkStationNameCol].Value = oStation.omodel.HName;
- }
- else
- {
- grdMain.Rows[i].Cells[HWorkStationNumberCol].Value = "";
- grdMain.Rows[i].Cells[HWorkStationNameCol].Value = "";
- }
- //
- grdMain.Rows[i].Cells[HProcNoCol].Value = oSub.HProcNo.ToString();
-
- grdMain.Rows[i].Cells[HRemarkCol].Value = oSub.HRemark;
- grdMain.Rows[i].Cells[HEntryIDCol].Value = oSub.HEntryID;
- i = i + 1;
- }
- //GRID鍏佽鍒锋柊
- DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid);
- //
- //Sub_OperStatus();
- }
- #endregion
-
-
- #region 淇濆瓨鍗曟嵁
- [Route("Gy_SOPBill/ModifyByID")]
- [HttpPost]
- public object Sub_SaveBill([FromBody] JObject oMain)
+ /// <summary>
+ /// 杩斿洖鐢熶骇璧勬簮鐢熶骇鐘舵�佸伐鍗曞垪琛�
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Sc_ICMOBillStatus_Tmp/list")]
+ [HttpGet]
+ public object list(string sWhere, string user)
{
try
{
- var _value = oMain["oMain"].ToString();
- string msg1 = _value.ToString();
- string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
- string msg2 = sArray[0].ToString();
- string msg3 = sArray[1].ToString();//褰撳墠浜�
-
- //鍙嶅簭鍒楀寲
- msg2 = "[" + msg2.ToString() + "]";
-
- List<SOPBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SOPBill>>(msg2);
-
- string HBillNo = list[0].HBillNo;
- DateTime HDate = list[0].HDate;
- string HName = list[0].HName;
- int HMaterID = list[0].HMaterID;
- string HMaterNumber = list[0].HMaterNumber;
- string HMaterName = list[0].HMaterName;
- string HMaterModel = list[0].HMaterModel;
- int HUnitID = list[0].HUnitID;
- string HUnitNumber = list[0].HUnitNumber;
- string HUnitName = list[0].HUnitName;
- string HRemark = list[0].HRemark;
- bool HStandard = list[0].HStandard;
- bool HUse = list[0].HUse;
-
- //鍒ゆ柇鏉冮檺
- //if (!ClsPub.Security_Log("Gy_Repair_Edit", 1, false, msg3))
+ //缂栬緫鏉冮檺
+ //if (!DBUtility.ClsPub.Security_Log_second("Gy_Material", 1, false, user))
//{
// objJsonResult.code = "0";
// objJsonResult.count = 0;
- // objJsonResult.Message = "娌℃湁鎵惧埌璇ュ姛鑳芥ā鍧楋紒";
+ // objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
// objJsonResult.data = null;
// return objJsonResult;
//}
+ string sql1 = string.Format(@"select * from h_v_Sc_WorkOrderList where HMainID='" + sWhere + "'");
+
+ ds = oCN.RunProcReturn(sql1, "h_v_Sc_WorkOrderList");
+
- //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
- oCN.BeginTran();
- //涓昏〃
- oCN.RunProc("Insert Into Gy_SOPBillMain " +
- "(HBillType,HInterID,HBillNo,HDate" +
- ",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 +
- "," + HUnitID.ToString() + ",'" + HMaterNumber + "','" + HUnitNumber + "','" + HStandard.ToString() +
- "') ");
- //" 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.Commit();
objJsonResult.code = "1";
objJsonResult.count = 1;
- objJsonResult.Message = "鏂板鎴愬姛锛�";
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
return objJsonResult;
}
catch (Exception e)
{
- oCN.RollBack();
objJsonResult.code = "0";
objJsonResult.count = 0;
- objJsonResult.Message = "Exception锛�" + e.Message;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
objJsonResult.data = null;
return objJsonResult;
}
}
- #endregion
- [Route("Gy_SOPBill/Use")]
+
+ /// <summary>
+ /// 杩斿洖鏂囦欢娓呭崟鍒楄〃
+ ///鍙傛暟锛歴tring sql銆�
+ ///杩斿洖鍊硷細object銆�
+ /// </summary>
+ [Route("Sc_ICMOBillStatus_Tmp/Filelist")]
[HttpGet]
- public object sy_Click()
+ public object Filelist()
{
- if (BillOld.omodel.HInterID == 0)
- {
- objJsonResult.Message = "浣跨敤澶辫触!褰撳墠浣滀笟鎸囧涔︿笉鏄祻瑙堢姸鎬�!";
- return objJsonResult;
- }
- if (BillOld.Sub_RoutingCheckAndUsed(BillOld.omodel.HInterID))
- {
- objJsonResult.count = 1;
- objJsonResult.Message = "浣跨敤鎴愬姛!";
- return objJsonResult;
- }
- else
- {
- objJsonResult.Message = "浣跨敤澶辫触!";
- return objJsonResult;
- }
- }
-
- [Route("Gy_SOPBill/Cancel")]
- [HttpGet]
- public object fsy_Click()
- {
- if (BillOld.omodel.HInterID == 0)
- {
- objJsonResult.Message = "鍙嶄娇鐢ㄥけ璐�!褰撳墠浣滀笟鎸囧涔︿笉鏄祻瑙堢姸鎬�!";
- return objJsonResult;
- }
- if (BillOld.Sub_RoutingUsed_Back(BillOld.omodel.HInterID))
- {
- objJsonResult.count = 1;
- objJsonResult.Message = "鍙嶄娇鐢ㄦ垚鍔�!";
- return objJsonResult;
- }
- else
- {
- objJsonResult.Message = "鍙嶄娇鐢ㄥけ璐�!";
- return objJsonResult;
- }
- }
-
- [Route("Gy_SOPBill/UploadFile1")]
- [HttpPost]
- public object UploadFile1()
- {
-
- 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 path = @"D:\\Files\\"+ HBillNo;
- dynamic dyResult = UpLoadFile(files, path, HBillNo, HRemark, HUserName);
- if (dyResult != null && dyResult.result == 1)
- {
- objJsonResult.code = "1";
- objJsonResult.count = 1;
- objJsonResult.Message = "涓婁紶鎴愬姛锛�";
- objJsonResult.data = null;
- return objJsonResult;
- }
- else
- {
- objJsonResult.code = "0";
- objJsonResult.count = 0;
- objJsonResult.Message = dyResult.returnval;
- objJsonResult.data = null;
- return objJsonResult;
- }
-
- }
-
- public dynamic UpLoadFile(HttpPostedFile files, string path, string HBillNo, string HRemark, string HUserName)
- {
- dynamic Result_Ob = new { result = 1, returnval = "涓婁紶鎴愬姛锛�" };
- string filePath = Path.GetFullPath(files.FileName);//鏂囦欢涓婁紶璺緞
- string fileExtension = Path.GetExtension(files.FileName);// 鏂囦欢鎵╁睍鍚�
- string filename = files.FileName;//鏂囦欢鍚�
- string fileSavePath = path;// 涓婁紶淇濆瓨璺緞
- int filesize = files.ContentLength;//鑾峰彇涓婁紶鏂囦欢鐨勫ぇ灏忓崟浣嶄负瀛楄妭byte
- int Maxsize = 40000 * 1024;//瀹氫箟涓婁紶鏂囦欢鐨勬渶澶х┖闂村ぇ灏忎负40M
-
try
{
- if (files == null || files.ContentLength <= 0)
- {
- Result_Ob = new { result = 0, returnval = "鏂囦欢涓嶈兘涓虹┖!" };
- return Result_Ob;
- }
- if (filesize >= Maxsize)
- {
- Result_Ob = new { result = 0, returnval = "涓婁紶鏂囦欢瓒呰繃40M锛屼笉鑳戒笂浼狅紒" };
- return Result_Ob;
- }
+ //缂栬緫鏉冮檺
+ //if (!DBUtility.ClsPub.Security_Log_second("Gy_Material", 1, false, user))
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "鏃犳煡鐪嬫潈闄愶紒";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+ string sql1 = string.Format(@"select HSno 搴忓彿,HFileName 鏂囦欢鍚嶇О from Gy_SOPBillSub2");
- string fileurl = Path.Combine(fileSavePath, filename);
- if (Directory.Exists(fileurl) == true) //濡傛灉瀛樺湪閲嶅悕鏂囦欢灏辨彁绀�
- {
- Result_Ob = new { result = 0, returnval = "瀛樺湪鍚屽悕鏂囦欢锛�" };
- return Result_Ob;
- }
- //鍒犻櫎鏁版嵁琛ㄦ暟鎹�
- ds = oCN.RunProcReturn("delete from Gy_SOPBillSub2 where HFileName='" + filename + "'", "Gy_SOPBillSub2");
- if (Directory.Exists(path))
- {
- File.Delete(fileurl); //鍒犻櫎鎸囧畾鏂囦欢
- files.SaveAs(fileurl);
- string StrPath = "/files/" + 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 +
- "') ");
- }
- else
- {
- Result_Ob = new { result = 0, returnval = "涓婁紶澶辫触锛佹鏂囦欢涓烘伓鎰忔枃浠�" };
- }
- }
- else
- {
- Directory.CreateDirectory(fileSavePath); //娣诲姞鏂囦欢澶�
- files.SaveAs(fileurl);
- string StrPath = "/files/" + 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 +
- "') ");
- }
- else
- {
- Result_Ob = new { result = 0, returnval = "涓婁紶澶辫触锛佹鏂囦欢涓烘伓鎰忔枃浠�" };
- }
- }
+ ds = oCN.RunProcReturn(sql1, "Gy_SOPBillSub2");
+
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "Sucess锛�";
+ objJsonResult.data = ds.Tables[0];
+ return objJsonResult;
}
catch (Exception e)
{
- Result_Ob = new { result = 0, returnval = e.Message };
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = "Exception锛�" + e.ToString();
+ objJsonResult.data = null;
+ return objJsonResult;
}
- return Result_Ob;
}
}
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"
new file mode 100644
index 0000000..d09ad7d
--- /dev/null
+++ "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"
@@ -0,0 +1,367 @@
+锘縰sing Newtonsoft.Json.Linq;
+using NPOI.HSSF.UserModel;
+using NPOI.SS.UserModel;
+using Pub_Class;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.IO;
+using System.Net;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Runtime.InteropServices;
+using System.Web;
+using System.Web.Http;
+using System.Windows.Forms;
+using WebAPI.Models;
+namespace WebAPI.Controllers.鍩虹璧勬枡.鍩虹璧勬枡
+{
+ public class Gy_SOPBillEditController : ApiController
+ {
+ public DBUtility.ClsPub.Enum_BillStatus BillStatus;
+
+ private json objJsonResult = new json();
+ SQLHelper.ClsCN oCN = new SQLHelper.ClsCN();
+ DataSet ds;
+ public DAL.ClsGy_SOPBill BillNew = new DAL.ClsGy_SOPBill();
+ public DAL.ClsGy_SOPBill BillOld = new DAL.ClsGy_SOPBill();
+ public bool BillChange; //
+ public DataGridView grdMain = new System.Windows.Forms.DataGridView();
+ ClsGridViewSum oSumGrid = new ClsGridViewSum();
+
+ //瀹氫箟
+ public const Int16 HTagCol = 0;
+ public const Int16 HSnoCol = 1;
+ public const Int16 HProcNoCol = 2;
+ public const Int16 HProcIDCol = 3;
+ public const Int16 HProcNumberCol = 4;
+ public const Int16 HProcNameCol = 5;
+ public const Int16 HWorkStationIDCol = 6;
+ public const Int16 HWorkStationNumberCol = 7;
+ public const Int16 HWorkStationNameCol = 8;
+ public const Int16 HCenterIDCol = 9;
+ public const Int16 HCenterNumberCol = 10;
+ public const Int16 HCenterNameCol = 11;
+ public const Int16 HRemarkCol = 12;
+ public const Int16 HEntryIDCol = 13;
+
+ DAL.ClsIF_Material_View oMater = new DAL.ClsIF_Material_View();
+ DAL.ClsIF_Unit_View oUnit = new DAL.ClsIF_Unit_View();
+ DAL.ClsIF_Process_View oProc = new DAL.ClsIF_Process_View();
+ DAL.ClsGy_WorkStation_View oStation = new DAL.ClsGy_WorkStation_View();
+ DAL.ClsGy_WorkCenter_View oCenter = new DAL.ClsGy_WorkCenter_View();
+
+ #region 璇诲啓绫�
+ //鏄剧ず鍗曟嵁
+ public void Sub_ShowBill()
+ {
+ DAL.ClsIF_Material_View oMater = new DAL.ClsIF_Material_View();
+ DAL.ClsIF_Unit_View oUnit = new DAL.ClsIF_Unit_View();
+ DAL.ClsIF_Process_View oProc = new DAL.ClsIF_Process_View();
+ DAL.ClsGy_WorkStation_View oStation = new DAL.ClsGy_WorkStation_View();
+ DAL.ClsGy_WorkCenter_View oCenter = new DAL.ClsGy_WorkCenter_View();
+ //ClsGy_SourceHlp oSource = new ClsGy_SourceHlp();
+ //鍒ゆ柇鏄惁瀛樺湪鍗曟嵁
+ if (BillOld.ShowBill(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == false)
+ {
+ MessageBox.Show(ClsPub.sExeReturnInfo, "鎻愮ず");
+ return;
+ }
+ //grid绂佹鍒锋柊
+
+
+ //鍔犺浇琛ㄤ綋
+ int i = 0;
+ foreach (Model.ClsGy_SOPBillSub oSub in BillOld.DetailColl)
+ {
+ if (i >= grdMain.RowCount - 1)
+ grdMain.Rows.Add();
+ grdMain.Rows[i].Cells[HTagCol].Value = "*";
+
+ grdMain.Rows[i].Cells[HProcIDCol].Value = oSub.HProcID.ToString();
+ if (oProc.GetInfoByID(oSub.HProcID))
+ {
+ grdMain.Rows[i].Cells[HProcNumberCol].Value = oProc.omodel.HNumber;
+ grdMain.Rows[i].Cells[HProcNameCol].Value = oProc.omodel.HName;
+ }
+ else
+ {
+ grdMain.Rows[i].Cells[HProcNumberCol].Value = "";
+ grdMain.Rows[i].Cells[HProcNameCol].Value = "";
+ }
+ //
+ grdMain.Rows[i].Cells[HCenterIDCol].Value = oSub.HCenterID.ToString();
+ if (oCenter.GetInfoByID(oSub.HCenterID))
+ {
+ grdMain.Rows[i].Cells[HCenterNumberCol].Value = oCenter.omodel.HNumber;
+ grdMain.Rows[i].Cells[HCenterNameCol].Value = oCenter.omodel.HName;
+ }
+ else
+ {
+ grdMain.Rows[i].Cells[HCenterNameCol].Value = "";
+ grdMain.Rows[i].Cells[HCenterNumberCol].Value = "";
+ }
+ //
+ grdMain.Rows[i].Cells[HWorkStationIDCol].Value = oSub.HWorkStationID.ToString();
+ if (oStation.GetInfoByID(oSub.HWorkStationID))
+ {
+ grdMain.Rows[i].Cells[HWorkStationNumberCol].Value = oStation.omodel.HNumber;
+ grdMain.Rows[i].Cells[HWorkStationNameCol].Value = oStation.omodel.HName;
+ }
+ else
+ {
+ grdMain.Rows[i].Cells[HWorkStationNumberCol].Value = "";
+ grdMain.Rows[i].Cells[HWorkStationNameCol].Value = "";
+ }
+ //
+ grdMain.Rows[i].Cells[HProcNoCol].Value = oSub.HProcNo.ToString();
+
+ grdMain.Rows[i].Cells[HRemarkCol].Value = oSub.HRemark;
+ grdMain.Rows[i].Cells[HEntryIDCol].Value = oSub.HEntryID;
+ i = i + 1;
+ }
+ //GRID鍏佽鍒锋柊
+ DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid);
+ //
+ //Sub_OperStatus();
+ }
+ #endregion
+
+
+ #region 淇濆瓨鍗曟嵁
+ [Route("Gy_SOPBill/ModifyByID")]
+ [HttpPost]
+ public object Sub_SaveBill([FromBody] JObject oMain)
+ {
+ try
+ {
+ var _value = oMain["oMain"].ToString();
+ string msg1 = _value.ToString();
+ string[] sArray = msg1.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
+ string msg2 = sArray[0].ToString();
+ string msg3 = sArray[1].ToString();//褰撳墠浜�
+
+ //鍙嶅簭鍒楀寲
+ msg2 = "[" + msg2.ToString() + "]";
+
+ List<SOPBill> list = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SOPBill>>(msg2);
+
+ string HBillNo = list[0].HBillNo;
+ DateTime HDate = list[0].HDate;
+ string HName = list[0].HName;
+ int HMaterID = list[0].HMaterID;
+ string HMaterNumber = list[0].HMaterNumber;
+ string HMaterName = list[0].HMaterName;
+ string HMaterModel = list[0].HMaterModel;
+ int HUnitID = list[0].HUnitID;
+ string HUnitNumber = list[0].HUnitNumber;
+ string HUnitName = list[0].HUnitName;
+ string HRemark = list[0].HRemark;
+ bool HStandard = list[0].HStandard;
+ bool HUse = list[0].HUse;
+
+ //鍒ゆ柇鏉冮檺
+ //if (!ClsPub.Security_Log("Gy_Repair_Edit", 1, false, msg3))
+ //{
+ // objJsonResult.code = "0";
+ // objJsonResult.count = 0;
+ // objJsonResult.Message = "娌℃湁鎵惧埌璇ュ姛鑳芥ā鍧楋紒";
+ // objJsonResult.data = null;
+ // return objJsonResult;
+ //}
+
+ //鑻AINDI閲嶅鍒欓噸鏂拌幏鍙�
+ oCN.BeginTran();
+ //涓昏〃
+ oCN.RunProc("Insert Into Gy_SOPBillMain " +
+ "(HBillType,HInterID,HBillNo,HDate" +
+ ",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 +
+ "," + HUnitID.ToString() + ",'" + HMaterNumber + "','" + HUnitNumber + "','" + HStandard.ToString() +
+ "') ");
+ //" 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.Commit();
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鏂板鎴愬姛锛�";
+ 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()
+ {
+ if (BillOld.omodel.HInterID == 0)
+ {
+ objJsonResult.Message = "浣跨敤澶辫触!褰撳墠浣滀笟鎸囧涔︿笉鏄祻瑙堢姸鎬�!";
+ return objJsonResult;
+ }
+ if (BillOld.Sub_RoutingCheckAndUsed(BillOld.omodel.HInterID))
+ {
+ objJsonResult.count = 1;
+ objJsonResult.Message = "浣跨敤鎴愬姛!";
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.Message = "浣跨敤澶辫触!";
+ return objJsonResult;
+ }
+ }
+
+ [Route("Gy_SOPBill/Cancel")]
+ [HttpGet]
+ public object fsy_Click()
+ {
+ if (BillOld.omodel.HInterID == 0)
+ {
+ objJsonResult.Message = "鍙嶄娇鐢ㄥけ璐�!褰撳墠浣滀笟鎸囧涔︿笉鏄祻瑙堢姸鎬�!";
+ return objJsonResult;
+ }
+ if (BillOld.Sub_RoutingUsed_Back(BillOld.omodel.HInterID))
+ {
+ objJsonResult.count = 1;
+ objJsonResult.Message = "鍙嶄娇鐢ㄦ垚鍔�!";
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.Message = "鍙嶄娇鐢ㄥけ璐�!";
+ return objJsonResult;
+ }
+ }
+
+ [Route("Gy_SOPBill/UploadFile1")]
+ [HttpPost]
+ public object UploadFile1()
+ {
+
+ 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 path = @"D:\\Files\\"+ HBillNo;
+ dynamic dyResult = UpLoadFile(files, path, HBillNo, HRemark, HUserName);
+ if (dyResult != null && dyResult.result == 1)
+ {
+ objJsonResult.code = "1";
+ objJsonResult.count = 1;
+ objJsonResult.Message = "涓婁紶鎴愬姛锛�";
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+ else
+ {
+ objJsonResult.code = "0";
+ objJsonResult.count = 0;
+ objJsonResult.Message = dyResult.returnval;
+ objJsonResult.data = null;
+ return objJsonResult;
+ }
+
+ }
+
+ public dynamic UpLoadFile(HttpPostedFile files, string path, string HBillNo, string HRemark, string HUserName)
+ {
+ dynamic Result_Ob = new { result = 1, returnval = "涓婁紶鎴愬姛锛�" };
+ string filePath = Path.GetFullPath(files.FileName);//鏂囦欢涓婁紶璺緞
+ string fileExtension = Path.GetExtension(files.FileName);// 鏂囦欢鎵╁睍鍚�
+ string filename = files.FileName;//鏂囦欢鍚�
+ string fileSavePath = path;// 涓婁紶淇濆瓨璺緞
+ int filesize = files.ContentLength;//鑾峰彇涓婁紶鏂囦欢鐨勫ぇ灏忓崟浣嶄负瀛楄妭byte
+ int Maxsize = 40000 * 1024;//瀹氫箟涓婁紶鏂囦欢鐨勬渶澶х┖闂村ぇ灏忎负40M
+
+ try
+ {
+ if (files == null || files.ContentLength <= 0)
+ {
+ Result_Ob = new { result = 0, returnval = "鏂囦欢涓嶈兘涓虹┖!" };
+ return Result_Ob;
+ }
+ if (filesize >= Maxsize)
+ {
+ Result_Ob = new { result = 0, returnval = "涓婁紶鏂囦欢瓒呰繃40M锛屼笉鑳戒笂浼狅紒" };
+ return Result_Ob;
+ }
+
+ string fileurl = Path.Combine(fileSavePath, filename);
+ if (Directory.Exists(fileurl) == true) //濡傛灉瀛樺湪閲嶅悕鏂囦欢灏辨彁绀�
+ {
+ Result_Ob = new { result = 0, returnval = "瀛樺湪鍚屽悕鏂囦欢锛�" };
+ return Result_Ob;
+ }
+ //鍒犻櫎鏁版嵁琛ㄦ暟鎹�
+ ds = oCN.RunProcReturn("delete from Gy_SOPBillSub2 where HFileName='" + filename + "'", "Gy_SOPBillSub2");
+ if (Directory.Exists(path))
+ {
+ File.Delete(fileurl); //鍒犻櫎鎸囧畾鏂囦欢
+ files.SaveAs(fileurl);
+ string StrPath = "/files/" + 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 +
+ "') ");
+ }
+ else
+ {
+ Result_Ob = new { result = 0, returnval = "涓婁紶澶辫触锛佹鏂囦欢涓烘伓鎰忔枃浠�" };
+ }
+ }
+ else
+ {
+ Directory.CreateDirectory(fileSavePath); //娣诲姞鏂囦欢澶�
+ files.SaveAs(fileurl);
+ string StrPath = "/files/" + 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 +
+ "') ");
+ }
+ else
+ {
+ Result_Ob = new { result = 0, returnval = "涓婁紶澶辫触锛佹鏂囦欢涓烘伓鎰忔枃浠�" };
+ }
+ }
+
+ }
+ catch (Exception e)
+ {
+ Result_Ob = new { result = 0, returnval = e.Message };
+ }
+ return Result_Ob;
+ }
+
+ }
+}
\ No newline at end of file
--
Gitblit v1.9.1