|
|
|
@ -22,6 +22,11 @@ using Admin.Core.IService;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Admin.Core.Model.Model_New;
|
|
|
|
|
using Admin.Core.Model;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
using System.Data.Common;
|
|
|
|
|
using static Org.BouncyCastle.Math.EC.ECCurve;
|
|
|
|
|
using Admin.Core.IRepository;
|
|
|
|
|
using Admin.Core.Service;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* 成品分舵入库首页信息
|
|
|
|
@ -32,20 +37,21 @@ namespace Aucma.Core.ProductOffLine.ViewModels
|
|
|
|
|
public partial class IndexPageViewModel : ObservableObject
|
|
|
|
|
{
|
|
|
|
|
private static readonly log4net.ILog log = LogManager.GetLogger(typeof(IndexPageViewModel));
|
|
|
|
|
private readonly IBaseOrderInfoServices? _baseOrderInfoServices;
|
|
|
|
|
private readonly IBaseOrderInfoServices _baseOrderInfoServices;
|
|
|
|
|
private readonly IProductPlanInfoServices? _productPlanInfoServices;
|
|
|
|
|
private readonly IProductOffLineServices ? _productOffLineServices;
|
|
|
|
|
|
|
|
|
|
public IndexPageViewModel()
|
|
|
|
|
{
|
|
|
|
|
_productOffLineServices = App.ServiceProvider.GetService<IProductOffLineServices>();
|
|
|
|
|
_baseOrderInfoServices = App.ServiceProvider.GetService<IBaseOrderInfoServices>();
|
|
|
|
|
_productPlanInfoServices = App.ServiceProvider.GetService<IProductPlanInfoServices>();
|
|
|
|
|
MvCodeHelper.ReceiveCodeEvent += ReceiveCode;
|
|
|
|
|
|
|
|
|
|
// test();
|
|
|
|
|
//List<MutiDBOperate> listdatabase = Appsettings.app<MutiDBOperate>("DBS")
|
|
|
|
|
// .Where(i => i.Enabled).ToList();
|
|
|
|
|
// test33();
|
|
|
|
|
InitEveryDayMethod();
|
|
|
|
|
//*** test2();
|
|
|
|
|
//*** test2();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#region 扫描信息
|
|
|
|
|
|
|
|
|
@ -220,14 +226,14 @@ namespace Aucma.Core.ProductOffLine.ViewModels
|
|
|
|
|
private async void ReceiveCode(string code, int scannerNo)
|
|
|
|
|
{
|
|
|
|
|
//1.扫描的SN条码去条码系统查询GET_BARCODE_DATA
|
|
|
|
|
|
|
|
|
|
//条码系统返回校验数据
|
|
|
|
|
// string result = _productOffLineServices.QueryChecked(code).Result
|
|
|
|
|
string result = "Y@1104@16160030000000910780@000010034895@@ @000000@000000009000000807@BCD-160C,家电下乡@@BCD-160C@皓月白-家电下乡@161601300@160@1-00版@家电下乡产品@默认@2010-09-01";
|
|
|
|
|
// 如果校验失败,下发报警
|
|
|
|
|
if("N".Equals(result.Substring(0,1)))
|
|
|
|
|
{
|
|
|
|
|
sendPlcError();
|
|
|
|
|
// 刷新页面提示信息 result.Substring(2)
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//2.查询到的数据分割处理,结果中用"@"号分隔,刷新页面显示并存到scada数据库(表待建)
|
|
|
|
@ -239,11 +245,11 @@ namespace Aucma.Core.ProductOffLine.ViewModels
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//3.调条码系统保存接口入库SaveBarcodeInfo
|
|
|
|
|
|
|
|
|
|
_productOffLineServices.SaveBarcodeInfo();
|
|
|
|
|
|
|
|
|
|
//4.更新mes数据库完成数量和时间(BASE_ORDERINFO,PRODUCT_PLANINFO) 注意:查询的字段可能需要修改,确保数据一致
|
|
|
|
|
|
|
|
|
|
//4.1截取订单号去查询更新BASE_ORDERINFO
|
|
|
|
|
//4.1截取订单号去查询更新BASE_ORDERINFO,全放到service处理
|
|
|
|
|
string orderCode = "11215484";
|
|
|
|
|
BaseOrderInfo order = _baseOrderInfoServices.Query(x => x.OrderCode == orderCode).FirstOrDefault();
|
|
|
|
|
if (order.CompleteAmount == 0)
|
|
|
|
@ -292,6 +298,7 @@ namespace Aucma.Core.ProductOffLine.ViewModels
|
|
|
|
|
bool result = false;
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var obj = PlcHelper.melsecList.FirstOrDefault(d => d.EquipName.Equals("成品下线Plc"));
|
|
|
|
|
if (obj != null)
|
|
|
|
|
{
|
|
|
|
@ -430,33 +437,23 @@ namespace Aucma.Core.ProductOffLine.ViewModels
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 连接测试
|
|
|
|
|
/// </summary>
|
|
|
|
|
void test()
|
|
|
|
|
private void test33()
|
|
|
|
|
{
|
|
|
|
|
// string aa = BaseDBConfig.MutiInitConn().Item1[2].Connection;
|
|
|
|
|
string connectionString = "Data Source=(DESCRIPTION=(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.1.50)(PORT = 1521)))(CONNECT_DATA=(SERVICE_NAME=tmdata)));User ID=ILS_SORT;Password=Aucma_2019;";
|
|
|
|
|
// string connectionString = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=175.27.215.92)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=helowin)));User ID=aucma_scada;Password=aucma;";
|
|
|
|
|
// string functionQuery = "SELECT COUNT(*) from CODE_BINDING";
|
|
|
|
|
string sql = "SELECT ILS_TMPRD.ILS_SORT_BARCODE_PKG.GET_BARCODE_DATA('16160030000000910779') FROM DUAL";
|
|
|
|
|
using (OracleConnection connection = new OracleConnection(connectionString))
|
|
|
|
|
{
|
|
|
|
|
connection.Open();
|
|
|
|
|
|
|
|
|
|
using (OracleCommand command = new OracleCommand(sql, connection))
|
|
|
|
|
{
|
|
|
|
|
// 执行函数并获取结果
|
|
|
|
|
string result = command.ExecuteScalar().ToString();
|
|
|
|
|
|
|
|
|
|
// 在结果中用"@"号分隔
|
|
|
|
|
string[] resultArray = result.Split('@');
|
|
|
|
|
|
|
|
|
|
// 使用条码数据库连接
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
//条码系统返回校验数据
|
|
|
|
|
string result = _productOffLineServices.QueryChecked("5").Result;
|
|
|
|
|
Console.WriteLine(result);
|
|
|
|
|
|
|
|
|
|
// 输出结果
|
|
|
|
|
foreach (string item in resultArray)
|
|
|
|
|
{
|
|
|
|
|
Thread.Sleep(2000);
|
|
|
|
|
MessageBox.Show(item);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch(Exception ex)
|
|
|
|
|
{
|
|
|
|
|
Console.WriteLine(ex.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|