Compare commits

...

2 Commits

Author SHA1 Message Date
杨家亮 41c9569eea 入库 2025-07-08 18:51:57 +08:00
杨家亮 64082cbb9c 物资添加照片 2025-07-01 19:03:10 +08:00
6 changed files with 575 additions and 1337 deletions

View File

@ -10155,6 +10155,14 @@ namespace Model
}
}
public System.Data.Linq.Table<V_Cl_W_MaterialOutS> V_Cl_W_MaterialOutS
{
get
{
return this.GetTable<V_Cl_W_MaterialOutS>();
}
}
public System.Data.Linq.Table<V_JOINTVIEW> 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<decimal> _OutQuantity;
private decimal _ReturnQuantity;
private System.Nullable<decimal> _Sjcksl;
private System.Nullable<decimal> _Weight;
private System.Nullable<decimal> _Price;
private string _FirstpartyCode;
private string _ProjectId;
private string _InstallationId;
private string _YYPID;
private string _UAid;
private System.Nullable<System.DateTime> _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<decimal> 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<decimal> 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<decimal> 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<decimal> 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<System.DateTime> 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
{

File diff suppressed because it is too large Load Diff

View File

@ -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;
@ -154,13 +156,26 @@ namespace WebAPI.Controllers
{
string strSql = "SELECT cp.ProjectId,cp.InstallationId,zz.Installationname AS InstallationName,ghfs AS Ghfs,cp.MaterialID,MaterialName,specificationtype AS Specificationtype,MaterialQuality,standardspecification ,unit AS Unit," +
"technicalconditions AS TechnicalConditions,SystemCode,rtrim( ltrim( TAreaMaterialMID ) ) AS AreaCode,0.000 AS bcckl,SUM ( Aquantity ) AS Aquantity,SUM ( Pquantity ) AS jh_quantity,SUM ( SQuantity ) AS dj_quantity,SUM ( HQuantity ) AS hj_quantity,SUM ( Pquantity ) - SUM ( OQuantity ) AS ck_quantity,SUM ( RQuantity ) AS tk_quantity,(SELECT SUM( SQuantity ) - SUM ( OQuantity ) + SUM ( RQuantity ) - SUM ( HQuantity ) FROM cl_w_comp WHERE cl_w_comp.MaterialID= cp.MaterialID AND cl_w_comp.InstallationId= cp.InstallationId AND cl_w_comp.ghfs= cp.ghfs ) AS kc_quantity,ROW_NUMBER ( ) OVER ( ORDER BY zz.InstallationCode,SystemCode ASC ) AS RowNum,0 AS xz,0 AS xh FROM cl_w_comp cp LEFT JOIN CL_B_Material mt ON mt.MaterialID= cp.MaterialID LEFT JOIN cl_b_Installation zz ON zz.InstallationId= cp.InstallationId GROUP BY cp.ProjectId,cp.InstallationId,zz.InstallationCode,zz.Installationname,ghfs,cp.MaterialID,MaterialName,specificationtype,MaterialQuality,standardspecification,unit,technicalconditions,SystemCode,TAreaMaterialMID HAVING " ;
"technicalconditions AS TechnicalConditions,SystemCode,";
if (!string.IsNullOrWhiteSpace(area))
{
strSql += "rtrim( ltrim( TAreaMaterialMID ) ) AS AreaCode,";
}
strSql += "0.000 AS bcckl,SUM ( Aquantity ) AS Aquantity,SUM ( Pquantity ) AS jh_quantity,SUM ( SQuantity ) AS dj_quantity,SUM ( HQuantity ) AS hj_quantity,SUM ( Pquantity ) - SUM ( OQuantity ) AS ck_quantity,SUM ( RQuantity ) AS tk_quantity,(SELECT SUM( SQuantity ) - SUM ( OQuantity ) + SUM ( RQuantity ) - SUM ( HQuantity ) FROM cl_w_comp WHERE cl_w_comp.MaterialID= cp.MaterialID AND cl_w_comp.InstallationId= cp.InstallationId AND cl_w_comp.ghfs= cp.ghfs ) AS kc_quantity,ROW_NUMBER ( ) OVER ( ORDER BY zz.InstallationCode,SystemCode ASC ) AS RowNum,0 AS xz,0 AS xh FROM cl_w_comp cp LEFT JOIN CL_B_Material mt ON mt.MaterialID= cp.MaterialID LEFT JOIN cl_b_Installation zz ON zz.InstallationId= cp.InstallationId GROUP BY cp.ProjectId,cp.InstallationId,zz.InstallationCode,zz.Installationname,ghfs,cp.MaterialID,MaterialName,specificationtype,MaterialQuality,standardspecification,unit,technicalconditions,SystemCode";
if (!string.IsNullOrWhiteSpace(area))
{
strSql += ", TAreaMaterialMID";
}
List<SqlParameter> listStr = new List<SqlParameter>();
strSql += "cp.ProjectId= @ProjectId AND cp.installationid= @InstallationId AND TAreaMaterialMID = @area AND ghfs = @ghfs";
strSql += " HAVING cp.ProjectId= @ProjectId AND cp.installationid= @InstallationId AND ghfs = @ghfs";
listStr.Add(new SqlParameter("@ProjectId", ProjectId));
listStr.Add(new SqlParameter("@InstallationId", InstallationId));
listStr.Add(new SqlParameter("@ghfs", ghfs));
if (!string.IsNullOrWhiteSpace(area))
{
strSql += " AND TAreaMaterialMID = @area ";
listStr.Add(new SqlParameter("@area", area));
}
SqlParameter[] parameter = listStr.ToArray();
System.Data.DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
responeData.data = tb;
@ -173,5 +188,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
}
}

View File

@ -0,0 +1,92 @@
using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Linq;
using System.Runtime.Remoting.Messaging;
using System.Web.Http;
using WebAPI.Helpers;
namespace WebAPI.Controllers
{
public class MaterialsExitController : ApiController
{
#region
[HttpPost]
public Model.ResponeData AddMaterialExitM(Model.Cl_W_MaterialStorageM exit)
{
var responeData = new Model.ResponeData();
try
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var userTime = DateTime.Now;
int count = db.Cl_W_MaterialStorageM.Where(x => x.UserTime.Value.Year == userTime.Year && x.UserTime.Value.Month == userTime.Month && x.UserTime.Value.Day == userTime.Day).ToList().Count();
Model.Cl_W_MaterialStorageM exitM = new Model.Cl_W_MaterialStorageM
{
StorageSheetMID = exit.StorageSheetMID,
StorageSheetCode = string.Format("RKD--{0}{1}", DateTime.Now.ToString("yyyyMMdd"), count.ToString("000")),
UserId = exit.UserId,
UserTime = DateTime.Now,
IsOk = "0", // 0-未审核1-已审核
APid = exit.APid, // 采购方类别(甲乙供)
Specialityid = exit.Specialityid, // 专业ID
InstallationId = exit.InstallationId
};
exit.UserTime = DateTime.Now;
exit.StorageSheetCode = string.Format("CKD--{0}{1}", DateTime.Now.ToString("yyyyMMdd"), count.ToString("000"));
db.Cl_W_MaterialStorageM.InsertOnSubmit(exitM);
db.SubmitChanges();
responeData.data = exit;
}
}
catch (System.Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
#region
[HttpPost]
public Model.ResponeData AddMaterialExitS(Model.Cl_W_MaterialStorageS s)
{
var responeData = new Model.ResponeData();
try
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
Model.Cl_W_MaterialStorageS cws = new Model.Cl_W_MaterialStorageS();
cws.SystemCode = s.SystemCode;
cws.StorageQuantity = s.StorageQuantity; // 到货数量
cws.TheoryWeight = s.TheoryWeight; // 单价
cws.ActualWeight = s.ActualWeight; // 金额
cws.RecordTableOptions = s.RecordTableOptions; // 备注说明
cws.Manufacturer = s.Manufacturer; // 制造厂家
cws.ProjectId = s.ProjectId;
cws.StorageSheetMID = s.StorageSheetMID;
cws.StorageSheetSID = Guid.NewGuid().ToString();
cws.MaterialID = s.MaterialID;
db.Cl_W_MaterialStorageS.InsertOnSubmit(cws);
db.SubmitChanges();
responeData.data = "添加成功";
}
}
catch (System.Exception ex)
{
responeData.code = 0;
responeData.message = ex.Message;
}
return responeData;
}
#endregion
}
}

View File

@ -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")
{
@ -145,6 +99,33 @@ 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;
}
}

View File

@ -176,7 +176,7 @@
<Compile Include="Controllers\HSSE\SafetyInspectionController.cs" />
<Compile Include="Controllers\HSSE\SafetyResponsibilitiesController.cs" />
<Compile Include="Controllers\HSSE\TrainTestRecordController.cs" />
<Compile Include="Controllers\MaterialEntranceAndExitController.cs" />
<Compile Include="Controllers\MaterialsExitController.cs" />
<Compile Include="Controllers\MaterialsBasicsController.cs" />
<Compile Include="Controllers\MaterialsOutController.cs" />
<Compile Include="Controllers\Person\PersonCheckController.cs" />