|
|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
using HslCommunication.Core;
|
|
|
|
|
using Mesnac.Compressor.Entity;
|
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
using Microsoft.Data.SqlClient;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
|
@ -19,6 +20,7 @@ using System.Text;
|
|
|
|
|
using System.Text.Json;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Xml.Linq;
|
|
|
|
|
using static System.Net.Mime.MediaTypeNames;
|
|
|
|
|
|
|
|
|
|
namespace ConsoleApp
|
|
|
|
|
{
|
|
|
|
|
@ -71,6 +73,30 @@ namespace ConsoleApp
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
private void test()
|
|
|
|
|
{
|
|
|
|
|
Datastation datastation = new Datastation()
|
|
|
|
|
{
|
|
|
|
|
Stime = DateTime.Now,
|
|
|
|
|
Stationid = StationCode,
|
|
|
|
|
Productid = "S123456",
|
|
|
|
|
Partid = "",
|
|
|
|
|
Modelid = "",
|
|
|
|
|
Ng = 1,
|
|
|
|
|
Proc = 0,
|
|
|
|
|
Sublinenum = 0,
|
|
|
|
|
Sublinesnnum = 0,
|
|
|
|
|
Partsnnum = 1,
|
|
|
|
|
Sublineids = "",
|
|
|
|
|
Partsns = "123456",
|
|
|
|
|
Sublinesns = StringChange.ModeToJson(new partsns()),
|
|
|
|
|
Paratemp = "",
|
|
|
|
|
Stringtemp = "",
|
|
|
|
|
GroupStationId = "",
|
|
|
|
|
Renum = "0",
|
|
|
|
|
};
|
|
|
|
|
int id = SqlSugarClient.Insertable(datastation).ExecuteReturnIdentity();
|
|
|
|
|
}
|
|
|
|
|
public void Start()
|
|
|
|
|
{
|
|
|
|
|
init();
|
|
|
|
|
@ -219,7 +245,7 @@ namespace ConsoleApp
|
|
|
|
|
string jsonString = StringChange.ModeToJson(partsns);
|
|
|
|
|
|
|
|
|
|
//查询本地库是否存在该数据
|
|
|
|
|
datastationLocal = _datastationLocalService.GetDatastationLocal("jsonString");
|
|
|
|
|
datastationLocal = _datastationLocalService.GetDatastationLocal(jsonString);
|
|
|
|
|
//datastationLocal = SqlSugarClient.Queryable<DatastationLocal>().First(it => it.Partsns == jsonString);
|
|
|
|
|
//datastation = SqlSugarClient.Queryable<Datastation>().First(it => it.Partsns == jsonString);
|
|
|
|
|
if (datastationLocal != null)
|
|
|
|
|
@ -382,7 +408,7 @@ namespace ConsoleApp
|
|
|
|
|
bool insertflag = await _datastationLocalService.AddDatastationLocalAsync(datastationLocal);
|
|
|
|
|
|
|
|
|
|
int id = SqlSugarClient.Insertable(datastation).ExecuteReturnIdentity();
|
|
|
|
|
|
|
|
|
|
_logger.Info("datastationID"+id);
|
|
|
|
|
Plc.writeInt16ByAddress("D7704", 1);
|
|
|
|
|
_logger.Info(StringChange.ModeToJson(datastation));
|
|
|
|
|
|
|
|
|
|
@ -392,7 +418,7 @@ namespace ConsoleApp
|
|
|
|
|
Datastationparam datastationparam1 = new Datastationparam()
|
|
|
|
|
{
|
|
|
|
|
Dsid = id,
|
|
|
|
|
Productid = StationCode,
|
|
|
|
|
Productid = dataproduce.Productid,
|
|
|
|
|
Stationid = StationCode,
|
|
|
|
|
N = data1.n,
|
|
|
|
|
T = false,
|
|
|
|
|
@ -406,7 +432,7 @@ namespace ConsoleApp
|
|
|
|
|
Datastationparam datastationparam2 = new Datastationparam()
|
|
|
|
|
{
|
|
|
|
|
Dsid = id,
|
|
|
|
|
Productid = StationCode,
|
|
|
|
|
Productid = dataproduce.Productid,
|
|
|
|
|
Stationid = StationCode,
|
|
|
|
|
N = data2.n,
|
|
|
|
|
T = false,
|
|
|
|
|
@ -420,7 +446,7 @@ namespace ConsoleApp
|
|
|
|
|
Datastationparam datastationparam3 = new Datastationparam()
|
|
|
|
|
{
|
|
|
|
|
Dsid = id,
|
|
|
|
|
Productid = StationCode,
|
|
|
|
|
Productid = dataproduce.Productid,
|
|
|
|
|
Stationid = StationCode,
|
|
|
|
|
N = data3.n,
|
|
|
|
|
T = false,
|
|
|
|
|
@ -434,7 +460,7 @@ namespace ConsoleApp
|
|
|
|
|
Datastationparam datastationparam4 = new Datastationparam()
|
|
|
|
|
{
|
|
|
|
|
Dsid = id,
|
|
|
|
|
Productid = StationCode,
|
|
|
|
|
Productid = dataproduce.Productid,
|
|
|
|
|
Stationid = StationCode,
|
|
|
|
|
N = data4.n,
|
|
|
|
|
T = false,
|
|
|
|
|
@ -448,7 +474,7 @@ namespace ConsoleApp
|
|
|
|
|
Datastationparam datastationparam5 = new Datastationparam()
|
|
|
|
|
{
|
|
|
|
|
Dsid = id,
|
|
|
|
|
Productid = StationCode,
|
|
|
|
|
Productid = dataproduce.Productid,
|
|
|
|
|
Stationid = StationCode,
|
|
|
|
|
N = data5.n,
|
|
|
|
|
T = false,
|
|
|
|
|
@ -495,7 +521,7 @@ namespace ConsoleApp
|
|
|
|
|
Plc.writeInt16ByAddress(_completeAskAddress, 2);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
//存盘
|
|
|
|
|
//前盖码
|
|
|
|
|
byte[] _QGBarcode = Plc.readValueByAddress(_semiBarcode2, 20);
|
|
|
|
|
@ -503,17 +529,21 @@ namespace ConsoleApp
|
|
|
|
|
_logger.Info("前盖码:" + QGBarCode);
|
|
|
|
|
#region 根据前盖码查询Productid
|
|
|
|
|
//根据前盖码查询Productid
|
|
|
|
|
//下发PLC上工位合格
|
|
|
|
|
Plc.writeInt16ByAddress(_completeAskAddress, 1);
|
|
|
|
|
_logger.Info(StationCode + "工作允许");
|
|
|
|
|
var Dipsn = SqlSugarClient.Queryable<Dataproduce>().First(it => it.Mainsn == QGBarCode);
|
|
|
|
|
|
|
|
|
|
if (Dipsn != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var ZZBarcide = SqlSugarClient.Queryable<Dataproduce>().First(it => it.Mainsn == ZZBarCode);
|
|
|
|
|
if (ZZBarcide != null)
|
|
|
|
|
{
|
|
|
|
|
ZZBarcide.Sysid = Dipsn.Productid;
|
|
|
|
|
//ZZBarcide.Snlist = QGBarCode + "," + ZZBarCode;
|
|
|
|
|
//ZZBarcide.Operseq = Dipsn.Operseq + "," + StationCode;
|
|
|
|
|
int updateflag = SqlSugarClient.Updateable(Dipsn).ExecuteCommand();
|
|
|
|
|
int updateflag = SqlSugarClient.Updateable(ZZBarcide).ExecuteCommand();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Dipsn dipsn = new Dipsn()
|
|
|
|
|
@ -544,8 +574,7 @@ namespace ConsoleApp
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
#endregion
|
|
|
|
|
//下发PLC上工位合格
|
|
|
|
|
Plc.writeInt16ByAddress(_completeAskAddress, 1);
|
|
|
|
|
|
|
|
|
|
//BarCodeRelationShipBinding(Plc);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|