米其林项目Giraf的新接口,采用WebAPI形式,会应用在上海玉兰,印度米其林及波兰米其林项目中
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
3.3 KiB

using WMS_GIRAF_Interface.Data;
using WMS_GIRAF_Interface.Entities;
using WMS_GIRAF_Interface.Models;
using WMS_GIRAF_Interface.Repositories.Implement;
using WMS_GIRAF_Interface.Repositories.Interface;
namespace WMS_GIRAF_Interface.TaskServices;
public class ManageTaskService(MichelinDbContext context,IManageMainRepository mangeMainRepository)
{
private readonly MichelinDbContext _context = context;
private readonly IManageMainRepository _mangeMainRepository = mangeMainRepository;
/// <summary>
/// 生成入库到line任务逻辑/一楼手工入库的任务逻辑
/// </summary>
/// <param name="inputRequest">产品信息</param>
/// <param name="startPostNumber">起始post number</param>
/// <param name="supportType">类型信息</param>
/// <param name="isBlocked">block属性</param>
/// <param name="trans">事务属性</param>
/// <param name="IssendControl">是否生成控制任务</param>
/// <param name="sResult">返回信息</param>
public bool CreateInputTaskFromGiraf( InputRequest.Product inputRequest,string startPostNumber,int endLaneWay,string sku,string supportType,string requestNumber,bool isBlocked,bool trans,bool IssendControl ,out string sResult)
{
bool bResult = true;
sResult = string.Empty;
//判断当前胎号是否有任务
var cellInfoStart = _context.Wh_Cell.FirstOrDefault(x => x.CELL_CODE == startPostNumber);
//获取起点信息
if (cellInfoStart != null)
{
var manageMain = _mangeMainRepository.GetManageMain("barcode", inputRequest.identifier);
if (manageMain != null)
{
//更新当前任务信息
manageMain.END_CELL_ID = endLaneWay;
manageMain.requestNumber = requestNumber;
manageMain.CELL_MODEL = supportType;
manageMain.START_CELL_ID = cellInfoStart.CELL_ID;
manageMain.LOTNUMBER = sku;
manageMain.POPULATIONNUMBER = inputRequest.productClass;
manageMain.keepRequestInMemoryEventIfLackOfProductIssue = true;
manageMain.keepRequestInMemoryEventIfMechanicalIssue = true;
bResult = _mangeMainRepository.UpdateManageMain(manageMain);
}
else
{
//创建任务
var newManageMain = new MANAGE_MAIN
{
STOCK_BARCODE = inputRequest.identifier,
requestNumber = requestNumber,
MANAGE_TYPE_CODE = cellInfoStart.CELL_MODEL == "DP" ? "ManageLineMove" : "ManageInlocal",
MANAGE_STATUS = "WaitingSend",
MANAGE_OPERATOR = "AUTO",
MANAGE_BEGIN_TIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
CELL_MODEL = supportType,
START_CELL_ID = cellInfoStart.CELL_ID,
END_CELL_ID = endLaneWay,
LOTNUMBER = sku,
POPULATIONNUMBER = inputRequest.productClass,
keepRequestInMemoryEventIfLackOfProductIssue = true,
keepRequestInMemoryEventIfMechanicalIssue = true,
};
}
}
else
{
//起点信息出问题
}
return bResult;
}
}