using Rhea.Common;
using Tiger.Model.Minsun;
using Microsoft.AspNetCore.Http;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Tiger.Model;
using Apache.NMS;
using System.Drawing.Drawing2D;
using Tiger.Model.Sharetronic.Shelf;
using Tiger.IBusiness;
namespace Tiger.Business.WMS.Transaction
{
///
/// 查储位补印条码事务
///
public class RePrintLabel : WMSTransactionBase, IRePrintLabel
{
public IRePrintLabel Init(string id, string userCode, string apiHost, string orgCode)
{
TransID = id;
UserCode = userCode;
ApiHost = apiHost;
OrgCode = orgCode;
Logger.Console.Info($"Start {this.GetType().Name} Transaction[ID: {TransID}]");
return this;
}
#region Propertys & Variables
public string UserCode { get; set; }
public long UserId { get; set; }
public string OrgCode { get; set; }
public List Suggests { get; set; } = new();
public List Vitem { get; set; } = new();
public List CurPoolList => Suggests.Where(q => !q.poolItem.IsNullOrEmpty()).Select(q => q.poolItem).ToList();
public Inventory CurInv { get; set; }
public BIZ_ERP_PROD_OUT req { get; set; }
public ReqType CurReqType { get; set; }
public List dtls { get; set; } = new();
public bool isExceed { get; set; }
public ProductionPickToMes toMes { get; set; }
public bool his_isComplete { get; set; }
public bool isCutting { get; set; }
public decimal cutQty { get; set; }
public BIZ_WMS_TRANSFER transferH = null;
public BIZ_WMS_TRANSFER cTransferH = null;
public BIZ_WMS_TRANSFER_DTL transferDtl = null;
public BIZ_WMS_TRANSFER_SN transferSn = null;
#endregion
#region Functions
///
/// 扫描入口
///
public async Task> Scan(BaseInput input)
{
var action = new ApiAction();
try
{
if (input.SN.IsNullOrEmpty())
{
action.IsSuccessed = false;
action.LocaleMsg = Biz.L("WMS.RePrint.ScanItem.SnEmptyFailure");
return SetOutPutMqttMsg(action, input.Locale);
}
var whUnit = await Biz.Db.Queryable().Where(t => (t.SHELF_CODE.ToUpper() == input.SN || t.LOCATION_CODE.ToUpper() == input.SN) && t.AUTH_ORG == OrgCode).IncludesAllFirstLayer().FirstAsync();
}
catch (Exception ex)
{
//取消当前操作
ResetInfo();
//action.CatchExceptionWithLog(ex, $"扫描[{input.SN}]异常");
action.CatchExceptionWithLog(ex, Biz.L("WMS.Default.Scan.ScanException", input.SN));
}
return SetOutPutMqttMsg(action, input.Locale);
}
#endregion
public override bool Close(bool needSaveHistoryLog = false)
{
needSaveHistoryLog = true;
//保存操作日志
this.IsFinished = true;
return IsFinished ? base.Close(needSaveHistoryLog) : IsFinished;
}
}//endClass
}