diff --git a/SlnMesnac.Model/domain/Pstmminjar.cs b/SlnMesnac.Model/domain/Pstmminjar.cs
new file mode 100644
index 0000000..3574691
--- /dev/null
+++ b/SlnMesnac.Model/domain/Pstmminjar.cs
@@ -0,0 +1,150 @@
+using System;
+using SqlSugar;
+
+namespace SlnMesnac.Model.domain
+{
+ ///
+ /// Mes投料记录
+ ///
+ [SugarTable("Pstmminjar"), TenantAttribute("mes")]
+ public class Pstmminjar
+ {
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="JarID" ,IsPrimaryKey = true ,IsIdentity = true )]
+ public long JarID { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="Materbarcode" )]
+ public string Materbarcode { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="StoragePlaceID" )]
+ public string StoragePlaceID { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="StockDate" )]
+ public DateTime? StockDate { get; set; }
+ ///
+ ///
+ /// 默认值: (' ')
+ ///
+ [SugarColumn(ColumnName="MaterCode" )]
+ public string MaterCode { get; set; }
+ ///
+ ///
+ /// 默认值: (' ')
+ ///
+ [SugarColumn(ColumnName="EquipCode" )]
+ public string EquipCode { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="ShiftDate" )]
+ public DateTime? ShiftDate { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="ShiftID" )]
+ public short? ShiftID { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="InTime" )]
+ public DateTime? InTime { get; set; }
+ ///
+ ///
+ /// 默认值: ((0))
+ ///
+ [SugarColumn(ColumnName="RealNum" )]
+ public int? RealNum { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="RealWeight" )]
+ public decimal? RealWeight { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="handLename" )]
+ public string HandLename { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="Usedweigh" )]
+ public decimal? Usedweigh { get; set; }
+ ///
+ ///
+ /// 默认值: ('1')
+ ///
+ [SugarColumn(ColumnName="UsedFlag" )]
+ public string UsedFlag { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="ClearFlag" )]
+ public string ClearFlag { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="AuditFlag" )]
+ public int? AuditFlag { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="InaccountDuration" )]
+ public string InaccountDuration { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="InaccountFlag" )]
+ public string InaccountFlag { get; set; }
+ ///
+ ///
+ /// 默认值: ((0))
+ ///
+ [SugarColumn(ColumnName="DeleteFlag" )]
+ public string DeleteFlag { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="StorageID" )]
+ public string StorageID { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="OldMaterCode" )]
+ public string OldMaterCode { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="KCSIGN" )]
+ public string Kcsign { get; set; }
+ ///
+ ///
+ /// 默认值: ('')
+ ///
+ [SugarColumn(ColumnName="FeedPosition" )]
+ public string FeedPosition { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="FeedJarNo" )]
+ public string FeedJarNo { get; set; }
+ ///
+ ///
+ /// 默认值: (getdate())
+ ///
+ [SugarColumn(ColumnName="BDSaveTime" )]
+ public DateTime? BDSaveTime { get; set; }
+ ///
+ ///
+ ///
+ [SugarColumn(ColumnName="RationMaterCd" )]
+ public string RationMaterCd { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/SlnMesnac.Model/domain/RecordMaterialInput.cs b/SlnMesnac.Model/domain/RecordMaterialInput.cs
new file mode 100644
index 0000000..e5c16f0
--- /dev/null
+++ b/SlnMesnac.Model/domain/RecordMaterialInput.cs
@@ -0,0 +1,81 @@
+using System;
+using SqlSugar;
+
+namespace SlnMesnac.Model.domain
+{
+
+ [SugarTable("Record_MaterialInput"), TenantAttribute("mes")]
+ public class RecordMaterialInput
+ {
+ ///
+ /// 标识
+ ///
+ [SugarColumn(ColumnName="obj_id" ,IsPrimaryKey = true ,IsIdentity = true )]
+ public int obj_id { get; set; }
+ ///
+ /// 设备编号
+ ///
+ [SugarColumn(ColumnName="equip_id" )]
+ public string equip_id { get; set; }
+ ///
+ /// 料罐编号
+ ///
+ [SugarColumn(ColumnName="can_number" )]
+ public string can_number { get; set; }
+ ///
+ /// 设备类型
+ ///
+ [SugarColumn(ColumnName="equip_type" )]
+ public string equip_type { get; set; }
+ ///
+ /// 物料条码
+ ///
+ [SugarColumn(ColumnName="material_barcode" )]
+ public string material_barcode { get; set; }
+ ///
+ /// 投入数量
+ ///
+ [SugarColumn(ColumnName="input_quantity" )]
+ public int? input_quantity { get; set; }
+ ///
+ /// 投入重量
+ ///
+ [SugarColumn(ColumnName="input_weight" )]
+ public decimal? input_weight { get; set; }
+ ///
+ /// 是否余料
+ ///
+ [SugarColumn(ColumnName="is_remainder" )]
+ public bool? is_remainder { get; set; }
+ ///
+ /// 余料数量
+ ///
+ [SugarColumn(ColumnName="remainder_quantity" )]
+ public int? remainder_quantity { get; set; }
+ ///
+ /// 余料重量
+ ///
+ [SugarColumn(ColumnName="remainder_weight" )]
+ public decimal? remainder_weight { get; set; }
+ ///
+ /// 是否开仓:1-开仓;2-只保存
+ ///
+ [SugarColumn(ColumnName="is_open" )]
+ public int? is_open { get; set; }
+ ///
+ /// 投料结果:1-成功;0-失败
+ ///
+ [SugarColumn(ColumnName="is_flag" )]
+ public int? is_flag { get; set; }
+ ///
+ /// 备注
+ ///
+ [SugarColumn(ColumnName="remark" )]
+ public string remark { get; set; }
+ ///
+ /// 记录时间
+ ///
+ [SugarColumn(ColumnName="record_time" )]
+ public DateTime? record_time { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/SlnMesnac.Repository/service/Impl/InputRecordServiceImpl.cs b/SlnMesnac.Repository/service/Impl/InputRecordServiceImpl.cs
index 1fd5327..f29538f 100644
--- a/SlnMesnac.Repository/service/Impl/InputRecordServiceImpl.cs
+++ b/SlnMesnac.Repository/service/Impl/InputRecordServiceImpl.cs
@@ -11,10 +11,13 @@ namespace SlnMesnac.Repository.service.Impl
private readonly Repository _cwssRep;
- public InputRecordServiceImpl(Repository mcsRep,Repository cwssRep)
+ private readonly Repository _mesRep;
+
+ public InputRecordServiceImpl(Repository mcsRep,Repository cwssRep, Repository mesRep)
{
_mcsRep = mcsRep;
_cwssRep = cwssRep;
+ _mesRep = mesRep;
}
///
@@ -48,6 +51,7 @@ namespace SlnMesnac.Repository.service.Impl
try
{
result = _mcsRep.Insert(mcsInputRecord);
+ SaveMesInputRecord(mcsInputRecord, null, out result);
}
catch (Exception e)
{
@@ -87,6 +91,8 @@ namespace SlnMesnac.Repository.service.Impl
try
{
result = _cwssRep.Insert(cwssInputRecord);
+
+ SaveMesInputRecord(null, cwssInputRecord, out result);
}
catch (Exception e)
{
@@ -94,5 +100,86 @@ namespace SlnMesnac.Repository.service.Impl
}
return result;
}
+
+ ///
+ /// 保存Mes投料记录
+ ///
+ ///
+ ///
+ ///
+ private void SaveMesInputRecord(McsInputRecord mcsInputRecord,CwssInputRecord cwssInputRecord,out bool result)
+ {
+ result = false;
+ try
+ {
+ RecordMaterialInput recordMaterialInput = null;
+ if (mcsInputRecord != null)
+ {
+ /*Pstmminjar pstmminjar = new Pstmminjar()
+ {
+ Materbarcode = mcsInputRecord.MaterialBarcode,
+ EquipCode = "01001",
+ ShiftDate = DateTime.Now,
+ InTime = mcsInputRecord.RecordTime,
+ RealNum = mcsInputRecord.InputQuantity,
+ RealWeight = Convert.ToDecimal(mcsInputRecord.InputWeight),
+ BDSaveTime = DateTime.Now
+ };*/
+ recordMaterialInput = new RecordMaterialInput()
+ {
+ equip_id = mcsInputRecord.EquipId.ToString(),
+ can_number = mcsInputRecord.CanNumber,
+ equip_type = "mcs",
+ input_quantity = mcsInputRecord.InputQuantity,
+ input_weight = mcsInputRecord.InputQuantity,
+ is_remainder = mcsInputRecord.IsRemainder,
+ remainder_quantity = mcsInputRecord.RemainderQuantity,
+ remainder_weight = Convert.ToDecimal(mcsInputRecord.RemainderWeight),
+ is_open = mcsInputRecord.IsOpen,
+ is_flag = mcsInputRecord.IsFlag,
+ remark = mcsInputRecord.Remark,
+ record_time = mcsInputRecord.RecordTime
+ };
+ }
+
+ if (cwssInputRecord != null)
+ {
+ /*Pstmminjar pstmminjar = new Pstmminjar()
+ {
+ Materbarcode = cwssInputRecord.MaterialBarcode,
+ EquipCode = "0200"+cwssInputRecord.CanNumber,
+ ShiftDate = DateTime.Now,
+ InTime = cwssInputRecord.RecordTime,
+ RealNum = cwssInputRecord.InputQuantity,
+ RealWeight = Convert.ToDecimal(cwssInputRecord.InputWeight),
+ BDSaveTime = DateTime.Now
+ };*/
+ recordMaterialInput = new RecordMaterialInput()
+ {
+ equip_id = cwssInputRecord.EquipId.ToString(),
+ can_number = cwssInputRecord.CanNumber,
+ equip_type = "cwss",
+ input_quantity = cwssInputRecord.InputQuantity,
+ input_weight = cwssInputRecord.InputQuantity,
+ is_remainder = cwssInputRecord.IsRemainder,
+ remainder_quantity = cwssInputRecord.RemainderQuantity,
+ remainder_weight = Convert.ToDecimal(cwssInputRecord.RemainderWeight),
+ is_open = cwssInputRecord.IsOpen,
+ is_flag = cwssInputRecord.IsFlag,
+ remark = cwssInputRecord.Remark,
+ record_time = cwssInputRecord.RecordTime
+ };
+ }
+
+ if (recordMaterialInput != null)
+ {
+ result = _mesRep.Insert(recordMaterialInput);
+ }
+ }
+ catch (Exception e)
+ {
+ new InvalidOperationException($"保存Mes投料记录异常:{e.Message}");
+ }
+ }
}
}
\ No newline at end of file
diff --git a/SlnMesnac/appsettings.Development.json b/SlnMesnac/appsettings.Development.json
index 764d921..b669750 100644
--- a/SlnMesnac/appsettings.Development.json
+++ b/SlnMesnac/appsettings.Development.json
@@ -33,6 +33,11 @@
"configId": "mesApi",
"dbType": 2,
"connStr": "DataSource=E:\\桌面\\杜肯密炼MES项目\\程序设计\\Durk.SlnMesnac\\SlnMesnac\\bin\\Debug\\net6.0\\data\\data.db"
+ },
+ {
+ "configId": "mes",
+ "dbType": 1,
+ "connStr": "server=123.60.55.13,39711;uid=sa;pwd=MeS@2024?;database=Mes"
}
],
"PlcConfig": [