From 64082cbb9ce9da930fb196681e269e77e7b834f9 Mon Sep 17 00:00:00 2001 From: ZONES <765289303@qq.com> Date: Tue, 1 Jul 2025 19:03:10 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E8=B5=84=E6=B7=BB=E5=8A=A0=E7=85=A7?= =?UTF-8?q?=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SGGL/Model/Model.cs | 395 ++++++++++++++++++ .../Controllers/MaterialsBasicsController.cs | 40 ++ .../Controllers/MaterialsOutController.cs | 81 ++-- 3 files changed, 466 insertions(+), 50 deletions(-) diff --git a/SGGL/Model/Model.cs b/SGGL/Model/Model.cs index 9dbf700..c46d65b 100644 --- a/SGGL/Model/Model.cs +++ b/SGGL/Model/Model.cs @@ -10155,6 +10155,14 @@ namespace Model } } + public System.Data.Linq.Table V_Cl_W_MaterialOutS + { + get + { + return this.GetTable(); + } + } + public System.Data.Linq.Table V_JOINTVIEW { get @@ -437711,6 +437719,393 @@ namespace Model } } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.V_Cl_W_MaterialOutS")] + public partial class V_Cl_W_MaterialOutS + { + + private string _UAName; + + private string _Installationname; + + private string _OutSheetCode; + + private string _OutSheetSID; + + private string _StorageSheetSID; + + private string _MaterialID; + + private string _SystemCode; + + private string _Materialname; + + private string _Specificationtype; + + private string _Unit; + + private System.Nullable _OutQuantity; + + private decimal _ReturnQuantity; + + private System.Nullable _Sjcksl; + + private System.Nullable _Weight; + + private System.Nullable _Price; + + private string _FirstpartyCode; + + private string _ProjectId; + + private string _InstallationId; + + private string _YYPID; + + private string _UAid; + + private System.Nullable _UserTime; + + public V_Cl_W_MaterialOutS() + { + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UAName", DbType="NVarChar(100)")] + public string UAName + { + get + { + return this._UAName; + } + set + { + if ((this._UAName != value)) + { + this._UAName = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Installationname", DbType="NVarChar(50)")] + public string Installationname + { + get + { + return this._Installationname; + } + set + { + if ((this._Installationname != value)) + { + this._Installationname = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OutSheetCode", DbType="NVarChar(50)")] + public string OutSheetCode + { + get + { + return this._OutSheetCode; + } + set + { + if ((this._OutSheetCode != value)) + { + this._OutSheetCode = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OutSheetSID", DbType="Char(36) NOT NULL", CanBeNull=false)] + public string OutSheetSID + { + get + { + return this._OutSheetSID; + } + set + { + if ((this._OutSheetSID != value)) + { + this._OutSheetSID = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_StorageSheetSID", DbType="Char(36)")] + public string StorageSheetSID + { + get + { + return this._StorageSheetSID; + } + set + { + if ((this._StorageSheetSID != value)) + { + this._StorageSheetSID = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_MaterialID", DbType="Char(36)")] + public string MaterialID + { + get + { + return this._MaterialID; + } + set + { + if ((this._MaterialID != value)) + { + this._MaterialID = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_SystemCode", DbType="NVarChar(50)")] + public string SystemCode + { + get + { + return this._SystemCode; + } + set + { + if ((this._SystemCode != value)) + { + this._SystemCode = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Name="materialname", Storage="_Materialname", DbType="NVarChar(500)")] + public string Materialname + { + get + { + return this._Materialname; + } + set + { + if ((this._Materialname != value)) + { + this._Materialname = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Name="specificationtype", Storage="_Specificationtype", DbType="NVarChar(500)")] + public string Specificationtype + { + get + { + return this._Specificationtype; + } + set + { + if ((this._Specificationtype != value)) + { + this._Specificationtype = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Name="unit", Storage="_Unit", DbType="NVarChar(50)")] + public string Unit + { + get + { + return this._Unit; + } + set + { + if ((this._Unit != value)) + { + this._Unit = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_OutQuantity", DbType="Decimal(15,4)")] + public System.Nullable OutQuantity + { + get + { + return this._OutQuantity; + } + set + { + if ((this._OutQuantity != value)) + { + this._OutQuantity = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ReturnQuantity", DbType="Decimal(38,4) NOT NULL")] + public decimal ReturnQuantity + { + get + { + return this._ReturnQuantity; + } + set + { + if ((this._ReturnQuantity != value)) + { + this._ReturnQuantity = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Name="sjcksl", Storage="_Sjcksl", DbType="Decimal(38,4)")] + public System.Nullable Sjcksl + { + get + { + return this._Sjcksl; + } + set + { + if ((this._Sjcksl != value)) + { + this._Sjcksl = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Weight", DbType="Decimal(10,4)")] + public System.Nullable Weight + { + get + { + return this._Weight; + } + set + { + if ((this._Weight != value)) + { + this._Weight = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_Price", DbType="Decimal(10,4)")] + public System.Nullable Price + { + get + { + return this._Price; + } + set + { + if ((this._Price != value)) + { + this._Price = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_FirstpartyCode", DbType="NVarChar(20)")] + public string FirstpartyCode + { + get + { + return this._FirstpartyCode; + } + set + { + if ((this._FirstpartyCode != value)) + { + this._FirstpartyCode = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_ProjectId", DbType="NVarChar(50)")] + public string ProjectId + { + get + { + return this._ProjectId; + } + set + { + if ((this._ProjectId != value)) + { + this._ProjectId = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_InstallationId", DbType="NVarChar(50)")] + public string InstallationId + { + get + { + return this._InstallationId; + } + set + { + if ((this._InstallationId != value)) + { + this._InstallationId = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_YYPID", DbType="NVarChar(150)")] + public string YYPID + { + get + { + return this._YYPID; + } + set + { + if ((this._YYPID != value)) + { + this._YYPID = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UAid", DbType="Char(36)")] + public string UAid + { + get + { + return this._UAid; + } + set + { + if ((this._UAid != value)) + { + this._UAid = value; + } + } + } + + [global::System.Data.Linq.Mapping.ColumnAttribute(Storage="_UserTime", DbType="DateTime")] + public System.Nullable UserTime + { + get + { + return this._UserTime; + } + set + { + if ((this._UserTime != value)) + { + this._UserTime = value; + } + } + } + } + [global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.V_JOINTVIEW")] public partial class V_JOINTVIEW { diff --git a/SGGL/WebAPI/Controllers/MaterialsBasicsController.cs b/SGGL/WebAPI/Controllers/MaterialsBasicsController.cs index ad6840f..1680c40 100644 --- a/SGGL/WebAPI/Controllers/MaterialsBasicsController.cs +++ b/SGGL/WebAPI/Controllers/MaterialsBasicsController.cs @@ -2,10 +2,12 @@ using BLL; using Microsoft.Office.Interop.Excel; using Model; +using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; +using System.Net.NetworkInformation; using System.Web.Http; using static WebAPI.Controllers.HSSE.ImageRecognitionController; @@ -173,5 +175,43 @@ namespace WebAPI.Controllers return responeData; } #endregion + + #region 保存物资文件 + [HttpPost] + public Model.ResponeData UploadMaterialsFile(Model.Cl_file file) + { + Model.ResponeData responeData = new Model.ResponeData(); + try + { + using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) + { + int count = db.Cl_file.Count(); + Model.Cl_file new_file = new Model.Cl_file(); + new_file.FID = Guid.NewGuid().ToString(); + new_file.Ffl = file.Ffl; + new_file.Fname = file.Fname; + new_file.Fshm = file.Fshm; + new_file.UserTime = DateTime.Now; + new_file.UserID = file.UserID; + new_file.Flj = file.Flj; + new_file.Flx = file.Flx; + new_file.Bz = file.Bz; + new_file.InstallationId = file.InstallationId; + new_file.Unid = file.Unid; + new_file.ProjectId = file.ProjectId; + db.Cl_file.InsertOnSubmit(new_file); + db.SubmitChanges(); + responeData.message = new_file.FID; + } + + } + catch(System.Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + return responeData; + } + #endregion } } \ No newline at end of file diff --git a/SGGL/WebAPI/Controllers/MaterialsOutController.cs b/SGGL/WebAPI/Controllers/MaterialsOutController.cs index 374eb62..06f1e82 100644 --- a/SGGL/WebAPI/Controllers/MaterialsOutController.cs +++ b/SGGL/WebAPI/Controllers/MaterialsOutController.cs @@ -2,6 +2,7 @@ using Model; using System; using System.Linq; +using System.Runtime.Remoting.Metadata.W3cXsd2001; using System.Web.Http; @@ -37,9 +38,10 @@ namespace WebAPI.Controllers outm.PlanSheetMID = MaterialOutM.PlanSheetMID; // 工区ID outm.YYPID = MaterialOutM.YYPID; outm.RecordMan = MaterialOutM.RecordMan; + MaterialOutM.OutSheetCode = string.Format("CKD--{0}{1}", DateTime.Now.ToString("yyyyMMdd"), count.ToString("000")); db.Cl_W_MaterialOutM.InsertOnSubmit(outm); db.SubmitChanges(); - responeData.data = MaterialOutM.OutSheetMID; + responeData.data = MaterialOutM; } } catch (System.Exception ex) @@ -89,54 +91,6 @@ namespace WebAPI.Controllers outs.Bhsje = MaterialOutS.Bhsje; db.Cl_W_MaterialOutS.InsertOnSubmit(outs); - - var sourceData = db.Cl_W_MaterialOutS - .Where(s => s.OutSheetMID == MaterialOutS.OutSheetMID) - .Select(s => new // 先投影到匿名对象 - { - ProjectId = s.ProjectId, - InstallationId = db.Cl_W_MaterialOutM - .Where(m => m.OutSheetMID == s.OutSheetMID) - .Select(m => m.InstallationId) - .FirstOrDefault(), - Ghfs = db.Cl_W_MaterialOutM - .Where(m => m.OutSheetMID == s.OutSheetMID) - .Select(m => m.YYPID) - .FirstOrDefault(), - FirstpartyCode = s.FirstpartyCode, - MaterialID = s.MaterialID, - OutSheetMID = s.OutSheetMID, - OutSheetSID = s.OutSheetSID, - OutQuantity = s.OutQuantity - }) - .AsEnumerable() // 切换到客户端评估 - .Select(x => new Model.Cl_w_comp // 现在可以构造实体对象了 - { - CompID = Guid.NewGuid().ToString(), - ProjectId = x.ProjectId, - InstallationId = x.InstallationId, - Ghfs = x.Ghfs, - TAreaMaterialMID = x.FirstpartyCode, - TAreaMaterialSID = "", - MaterialID = x.MaterialID, - Aquantity = 0, - PlanSheetMID = "", - PlanSheetSID = "", - Pquantity = 0, - StorageSheetMID = "", - StorageSheetSID = "", - SQuantity = 0, - StorageHJSID = "", - StorageHJMID = "", - HQuantity = 0, - OutSheetMID = x.OutSheetMID, - OutSheetSID = x.OutSheetSID, - OQuantity = x.OutQuantity, - ReturnSheetMid = "", - ReturnSheetSID = "", - RQuantity = 0 - }); - db.Cl_w_comp.InsertAllOnSubmit(sourceData); Model.Cl_W_MaterialOutM clw = db.Cl_W_MaterialOutM.FirstOrDefault(x => x.OutSheetMID == MaterialOutS.OutSheetMID); if(clw.IsOk != "1") { @@ -144,7 +98,34 @@ namespace WebAPI.Controllers } db.SubmitChanges(); - + + Model.Cl_w_comp cl = new Model.Cl_w_comp(); + cl.CompID = Guid.NewGuid().ToString(); + cl.ProjectId = MaterialOutS.ProjectId; + cl.InstallationId = clw.InstallationId; + cl.Ghfs = clw.YYPID; + cl.TAreaMaterialMID = MaterialOutS.FirstpartyCode; + cl.TAreaMaterialSID = ""; + cl.MaterialID = MaterialOutS.MaterialID; + cl.Aquantity = 0; + cl.PlanSheetMID = ""; + cl.PlanSheetSID = ""; + cl.Pquantity = 0; + cl.StorageSheetMID = ""; + cl.StorageSheetSID = ""; + cl.SQuantity = 0; + cl.StorageHJSID = ""; + cl.StorageHJMID = ""; + cl.HQuantity = 0; + cl.OutSheetMID = MaterialOutS.OutSheetMID; + cl.OutSheetSID = outs.OutSheetSID; + cl.OQuantity = MaterialOutS.OutQuantity; + cl.ReturnSheetMid = ""; + cl.ReturnSheetSID = ""; + cl.RQuantity = 0; + + db.Cl_w_comp.InsertOnSubmit(cl); + db.SubmitChanges(); responeData.data = MaterialOutS.OutSheetSID; } }