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; /// /// 生成入库到line任务逻辑/一楼手工入库的任务逻辑 /// /// 产品信息 /// 起始post number /// 类型信息 /// block属性 /// 事务属性 /// 是否生成控制任务 /// 返回信息 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; } }