diff --git a/ConsoleApp/MainCentralControl.cs b/ConsoleApp/MainCentralControl.cs index adeb2b3..a44721b 100644 --- a/ConsoleApp/MainCentralControl.cs +++ b/ConsoleApp/MainCentralControl.cs @@ -2,6 +2,7 @@ using Mesnac.Compressor.Entity; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; +using Models; using Newtonsoft.Json.Linq; using SlnMesnac.Common; using SlnMesnac.Config; @@ -203,7 +204,7 @@ namespace ConsoleApp { n = "转子压装位置1压力值", t = 0, - ng = int.Parse(Plc.readFloatByAddress("D7708").ToString()), + ng = int.Parse(Plc.readFloatByAddress("D7708").ToString()) == 1? 0 : 1, v = Plc.readFloatByAddress("D7705").ToString(), min = Plc.readFloatByAddress("D7706").ToString(), max = Plc.readFloatByAddress("D7707").ToString(), @@ -212,7 +213,7 @@ namespace ConsoleApp { n = "转子压装位置2压力值", t = 0, - ng = int.Parse(Plc.readFloatByAddress("D7712").ToString()), + ng = int.Parse(Plc.readFloatByAddress("D7712").ToString()) == 1 ? 0 : 1, v = Plc.readFloatByAddress("D7709").ToString(), min = Plc.readFloatByAddress("D7710").ToString(), max = Plc.readFloatByAddress("D7711").ToString(), @@ -221,7 +222,7 @@ namespace ConsoleApp { n = "转子压装位置3压力值", t = 0, - ng = int.Parse(Plc.readFloatByAddress("D7716").ToString()), + ng = int.Parse(Plc.readFloatByAddress("D7716").ToString()) == 1 ? 0 : 1, v = Plc.readFloatByAddress("D7713").ToString(), min = Plc.readFloatByAddress("D7714").ToString(), max = Plc.readFloatByAddress("D7715").ToString(), @@ -230,7 +231,7 @@ namespace ConsoleApp { n = "转子压装位置4位移值", t = 0, - ng = 1, + ng = int.Parse(Plc.readFloatByAddress("D7720").ToString()) == 1 ? 0 : 1, v = Plc.readFloatByAddress("D7717").ToString(), min = Plc.readFloatByAddress("D7718").ToString(), max = Plc.readFloatByAddress("D7719").ToString(), @@ -239,7 +240,7 @@ namespace ConsoleApp { n = "转子压装位置4压力值", t = 0, - ng = int.Parse(Plc.readFloatByAddress("D7724").ToString()), + ng = int.Parse(Plc.readFloatByAddress("D7724").ToString()) == 1 ? 0 : 1, v = Plc.readFloatByAddress("D7721").ToString(), min = Plc.readFloatByAddress("D7722").ToString(), max = Plc.readFloatByAddress("D7723").ToString(), @@ -276,7 +277,7 @@ namespace ConsoleApp Productid = "", Partid = "", Modelid = "", - Ng = Plc.readFloatByAddress("D7708").ToString() == "1" ? 0 : 1, + Ng = Plc.readFloatByAddress("D7725").ToString() == "1" ? 0 : 1, Proc = 0, Sublinenum = 0, Sublinesnnum = 0, @@ -300,6 +301,7 @@ namespace ConsoleApp Datastationparam datastationparam1 = new Datastationparam() { Dsid = datastationid.Id, + Productid = StationCode, Stationid = StationCode, N = data1.n, T = false, @@ -313,6 +315,7 @@ namespace ConsoleApp Datastationparam datastationparam2 = new Datastationparam() { Dsid = datastationid.Id, + Productid = StationCode, Stationid = StationCode, N = data2.n, T = false, @@ -326,6 +329,7 @@ namespace ConsoleApp Datastationparam datastationparam3 = new Datastationparam() { Dsid = datastationid.Id, + Productid = StationCode, Stationid = StationCode, N = data3.n, T = false, @@ -339,6 +343,7 @@ namespace ConsoleApp Datastationparam datastationparam4 = new Datastationparam() { Dsid = datastationid.Id, + Productid = StationCode, Stationid = StationCode, N = data4.n, T = false, @@ -352,6 +357,7 @@ namespace ConsoleApp Datastationparam datastationparam5 = new Datastationparam() { Dsid = datastationid.Id, + Productid = StationCode, Stationid = StationCode, N = data5.n, T = false, @@ -406,17 +412,21 @@ namespace ConsoleApp _logger.Info("前盖码:" + QGBarCode); #region 根据前盖码查询Productid //根据前盖码查询Productid - var Dipsn = SqlSugarClient.Queryable().First(it => it.Sn == QGBarCode); + var Dipsn = SqlSugarClient.Queryable().First(it => it.Mainsn == QGBarCode); if (Dipsn != null) { - Dipsn dipsn = new Dipsn() - { - Type = Dipsn.Type, - Stime = DateTime.Now, - Sn = ZZBarCode, - Productid = Dipsn.Productid, - }; - int id = SqlSugarClient.Insertable(dipsn).ExecuteReturnIdentity(); + Dipsn.Snlist = QGBarCode+","+ZZBarCode; + Dipsn.Operseq = Dipsn.Operseq+","+StationCode; + int updateflag = SqlSugarClient.Updateable(Dipsn).ExecuteCommand(); + + //Dipsn dipsn = new Dipsn() + //{ + // Type = Dipsn.Type, + // Stime = DateTime.Now, + // Sn = ZZBarCode, + // Productid = Dipsn.Productid, + //}; + //int id = SqlSugarClient.Insertable(dipsn).ExecuteReturnIdentity(); } #endregion #region 查询datastation表,更新Productid diff --git a/ConsoleApp/appsettings.json b/ConsoleApp/appsettings.json index a27a073..fe2b25c 100644 --- a/ConsoleApp/appsettings.json +++ b/ConsoleApp/appsettings.json @@ -57,6 +57,6 @@ ], "redisConfig": "175.27.215.92:6379,password=redis@2023", - "StationCode": "S130-2" + "StationCode": "S130-1" } } diff --git a/SlnMesnac.Model/domain/Dataproduce.cs b/SlnMesnac.Model/domain/Dataproduce.cs new file mode 100644 index 0000000..804122e --- /dev/null +++ b/SlnMesnac.Model/domain/Dataproduce.cs @@ -0,0 +1,249 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using SqlSugar; +namespace Models +{ + /// + /// 产品生产摘要数据 + /// + [SugarTable("dataproduce")] + public class Dataproduce + { + + + /// + /// 备 注: + /// 默认值: + /// + [SugarColumn(ColumnName="id" ,IsPrimaryKey = true,IsIdentity = true) ] + public int Id { get; set; } + + /// + /// 备 注:产品码 + /// 默认值: + /// + [SugarColumn(ColumnName="productid" ) ] + public string? Productid { get; set; } + + /// + /// 备 注:部件系统码列表. 逗号分隔 + /// 默认值: + /// + [SugarColumn(ColumnName="sysid" ) ] + public string? Sysid { get; set; } + + /// + /// 备 注:机种码 + /// 默认值: + /// + [SugarColumn(ColumnName="modelid" ) ] + public string? Modelid { get; set; } + + /// + /// 备 注:开始时间 + /// 默认值: + /// + [SugarColumn(ColumnName="stime" ) ] + public DateTime? Stime { get; set; } + + /// + /// 备 注:结束时间 + /// 默认值: + /// + [SugarColumn(ColumnName="etime" ) ] + public DateTime? Etime { get; set; } + + /// + /// 备 注:是否合格:0 合格;1不 合格 + /// 默认值: + /// + [SugarColumn(ColumnName="qc" ) ] + public bool? Qc { get; set; } + + /// + /// 备 注:是否结束:0 未结束;1 结束; 2 半成品结束 + /// 默认值: + /// + [SugarColumn(ColumnName="finished" ) ] + public bool? Finished { get; set; } + + /// + /// 备 注:是否有标签:0 无;1 有 + /// 默认值: + /// + [SugarColumn(ColumnName="hasid" ) ] + public bool? Hasid { get; set; } + + /// + /// 备 注:是否返修:0 无;1 udp正在返修中,未开始启动; 2 udp返修中,已经启动操作;3tcp返修 + /// 默认值: + /// + [SugarColumn(ColumnName="hasret" ) ] + public int? Hasret { get; set; } + + /// + /// 备 注:当前工位ID + /// 默认值: + /// + [SugarColumn(ColumnName="curstationid" ) ] + public string? Curstationid { get; set; } + + /// + /// 备 注:NG 工位ID + /// 默认值: + /// + [SugarColumn(ColumnName="ngstationid" ) ] + public string? Ngstationid { get; set; } + + /// + /// 备 注:NG品排出工位ID + /// 默认值: + /// + [SugarColumn(ColumnName="ngoutstationid" ) ] + public string? Ngoutstationid { get; set; } + + /// + /// 备 注:托盘rfid码 + /// 默认值: + /// + [SugarColumn(ColumnName="rfid" ) ] + public string? Rfid { get; set; } + + /// + /// 备 注:经过的操作工位序列,','号分隔的字符串:1,2,3,4,5,6 + /// 默认值: + /// + [SugarColumn(ColumnName="operseq" ) ] + public string? Operseq { get; set; } + + /// + /// 备 注:产品条码列表. 逗号分隔 + /// 默认值: + /// + [SugarColumn(ColumnName="snlist" ) ] + public string? Snlist { get; set; } + + /// + /// 备 注:(预留暂不用)其他物料代码列表,逗号分隔 + /// 默认值: + /// + [SugarColumn(ColumnName="materiallist" ) ] + public string? Materiallist { get; set; } + + /// + /// 备 注:产品状态:0-合格, 1- 不合格,2-说明是半成品不计入统计,3-该产品被解绑不参与统计 + /// 默认值: + /// + [SugarColumn(ColumnName="status" ) ] + public int? Status { get; set; } + + /// + /// 备 注:重投(返修)工位号 + /// 默认值: + /// + [SugarColumn(ColumnName="reinid" ) ] + public int? Reinid { get; set; } + + /// + /// 备 注:动态数据,记录当前工艺顺序号 + /// 默认值: + /// + [SugarColumn(ColumnName="iNowNo" ) ] + public int? INowNo { get; set; } + + /// + /// 备 注: + /// 默认值: + /// + [SugarColumn(ColumnName="lineid" ) ] + public int? Lineid { get; set; } + + /// + /// 备 注:主SN码,在主线和支线首工位填写,默认PLC上报的第1个SN就是主码 + /// 默认值: + /// + [SugarColumn(ColumnName="mainsn" ) ] + public string? Mainsn { get; set; } + + /// + /// 备 注:重投工位的工艺顺序号,初始化为0,标识该机种在某一线路中的工艺顺序号(首工位是1) + /// 默认值: + /// + [SugarColumn(ColumnName="reinno" ) ] + public int? Reinno { get; set; } + + /// + /// 备 注:该工位产品类别(针对机种下的首工位),是主产品还是部件,1主产品,2一级部件,3二级部件,4其他。同cfgstattion.statpdtype和cftproductStation.statpdtype + /// 默认值: + /// + [SugarColumn(ColumnName="pdtype" ) ] + public int? Pdtype { get; set; } + + /// + /// 备 注:拆解次数 + /// 默认值: + /// + [SugarColumn(ColumnName="disnum" ) ] + public int? Disnum { get; set; } + + /// + /// 备 注:拆解时间 + /// 默认值: + /// + [SugarColumn(ColumnName="distime" ) ] + public DateTime? Distime { get; set; } + + /// + /// 备 注:拆解工位 + /// 默认值: + /// + [SugarColumn(ColumnName="disstation" ) ] + public string? Disstation { get; set; } + + /// + /// 备 注:当前重投工位。填写值为填写根据拆解时按勾选的最小工艺序号得到的工位代码 + /// 默认值: + /// + [SugarColumn(ColumnName="currreinstation" ) ] + public string? Currreinstation { get; set; } + + /// + /// 备 注:拆解前上一次生产加工开始时间 + /// 默认值: + /// + [SugarColumn(ColumnName="laststime" ) ] + public DateTime? Laststime { get; set; } + + /// + /// 备 注:拆解前上一次生产加工结束时间 + /// 默认值: + /// + [SugarColumn(ColumnName="lastetime" ) ] + public DateTime? Lastetime { get; set; } + + /// + /// 备 注:完全拆解,0:正常,1:完全拆解,2:部分拆解 + /// 默认值: + /// + [SugarColumn(ColumnName="fulldis" ) ] + public int Fulldis { get; set; } + + /// + /// 备 注:在某工位NG的次数,OK通过该工位后需要清零 + /// 默认值: + /// + [SugarColumn(ColumnName="renum" ) ] + public int Renum { get; set; } + + /// + /// 备 注:重投时在重投位及后续工位需要跳过不用再操作的工位(现只允许有1个此类工位),标识该机种在某一线路的首工位工艺顺序号是1 + /// 默认值: + /// + [SugarColumn(ColumnName="notdisno" ) ] + public int? Notdisno { get; set; } + + + } + +} \ No newline at end of file