using Aborlen.Model;
|
|
using FrameWork.Log;
|
|
using SqlSugar;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using WorkStationBase;
|
|
|
|
namespace Aborlen.WorkStation
|
|
{
|
|
public partial class WorkStation01 : StationBase
|
|
{
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 扫描条码
|
|
/// </summary>
|
|
/// <param name="stationCode"></param>
|
|
/// <param name="value"></param>
|
|
/// <param name="triggerTime"></param>
|
|
public void BarCode(string stationCode, object value, DateTime triggerTime)
|
|
{
|
|
try
|
|
{
|
|
//读取产品型号 查询当前型号的最近订单
|
|
|
|
|
|
|
|
string barcode = value.ToString();
|
|
|
|
byte productType = Convert.ToByte(Read(1180));
|
|
|
|
if (productType == 6 || productType == 7)
|
|
{
|
|
//验证条码规则 电动
|
|
|
|
if (value.ToString().Contains(ProductInfo.Query().Where(p => p.product_id == productType).First().motor_rule))
|
|
{
|
|
PresentOrder = ProductOrder.Query().Where(p => p.product_id == productType).OrderBy(p=>p.id, OrderByType.Desc).First();
|
|
|
|
ProductCode = barcode;
|
|
//判断数据表是否存在当前工件数据,如果存在,则更新数据,如果不存在,则创建数据
|
|
|
|
if (ProductData_Outline.Query().Where(p => p.motor_pid == barcode).Count() > 0)
|
|
{
|
|
//之前上过线,暂时不做任何修改
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
ProductData_Outline productData_Outline = new ProductData_Outline();
|
|
productData_Outline.plan_id = PresentOrder.plan_id;
|
|
productData_Outline.product_name = PresentOrder.product_name;
|
|
productData_Outline.product_id = productType;
|
|
productData_Outline.motor_pid = value.ToString();
|
|
productData_Outline.ProductState = 0;
|
|
ProductData_Outline.Insert(productData_Outline);
|
|
|
|
}
|
|
//写入扫描完成
|
|
Write(1080, (byte)1);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
LogHelper.WriteLog(LogHelper.GetMethodInfo(), ex);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|