using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using WIDESEA_Common;
using WIDESEA_Common.Tools;
using WIDESEA_Core.EFDbContext;
using WIDESEA_Core.Utilities;
using WIDESEA_Entity.DomainModels;
using WIDESEA_Services;
using WIDESEA_Services.IRepositories;
using WIDESEA_Services.Repositories;
using WIDESEA_Services.Services;
using WIDESEA_WCS.WCSClient;
namespace WIDESEA_WCS.Jobs
{
public partial class EquipmentExecutor : SchedulerExecuteBase
{
private static int _readCBJSignalso = 0;
///
/// 拆包站逻辑流程
///
///
///
public static void Z_CBJtask()
{
if (Interlocked.Exchange(ref _readCBJSignalso, 1) == 0)
{
try
{
VOLContext Context = new VOLContext();
Idt_task_numberRepository tasknumberRep = new dt_task_numberRepository(Context);
dt_task_numberService tasknumber = new dt_task_numberService(tasknumberRep);
Ibase_ware_locationRepository locRepository = new base_ware_locationRepository(Context);
Ibase_routing_tableRepository routingRepository = new base_routing_tableRepository(Context);
Ibill_pda_groupdiskRepository pdaRepository = new bill_pda_groupdiskRepository(Context);
Idt_agvtaskRepository agvRepository = new dt_agvtaskRepository(Context);
Ibill_group_stockRepository groupRepository = new bill_group_stockRepository(Context);
// 抓取PDA主盘表数据
var PDAtask = pdaRepository.FindFirst(v => v.ishandle == 1);
if (PDAtask != null)
{
//添加库存信息
bill_group_stock stock = new bill_group_stock();
stock.stock_id = Guid.NewGuid();
stock.MaterialType = PDAtask.MaterialType;
stock.BarCode = PDAtask.BarCode;
stock.MaterialStatus = PDAtask.MaterialStatus;
stock.first_tb = 0;
stock.TB_Status = "";
stock.FQ_Status = "";
stock.GY_Status = "";
stock.QX_Status = "";
stock.created_user = "WCS";
stock.created_time = DateTime.Now;
stock.updated_user = "WCS";
stock.updated_time = DateTime.Now;
stock.Remark2 = PDAtask.Remark2;
stock.Remark3 = PDAtask.Remark3;
groupRepository.Add(stock, true);
//给MES回传物料移动信息
// MESAPIInvoke.BindMaterialDevid(PDAtask.Devid, route.route_end, PDAtask.MaterialType, PDAtask.BarCode, PDAtask.MaterialStatus);
// break;
//修改PDA组盘表
PDAtask.ishandle = 0;
pdaRepository.Update(PDAtask, true);
}
}
catch (Exception)
{
}
finally
{
Interlocked.Exchange(ref _readCBJSignalso, 0);
}
}
}
}
}