| | |
| | | } |
| | | |
| | | // 1. 查询XB_RACKING_TASK_SYXT_LOG中ItemBarcode和PalletCode的映射关系 |
| | | var rackingTaskData = Db.Queryable<XbRackingTaskSyxtLog>() |
| | | var allRackingTaskData = Db.Queryable<XbRackingTaskSyxtLog>() |
| | | .Where(x => !string.IsNullOrEmpty(x.ItemBarcode)) |
| | | .Select(x => new { x.ItemBarcode, x.PalletCode }) |
| | | .Select(x => new { x.ItemBarcode, x.PalletCode, x.Code, x.Id }) |
| | | .ToList(); |
| | | |
| | | var rackingTaskData = allRackingTaskData |
| | | .GroupBy(x => x.ItemBarcode) |
| | | .Select(g => g.OrderByDescending(x => x.Id).First()) |
| | | .Where(x => x.Code != "500") |
| | | .ToList(); |
| | | |
| | | if (rackingTaskData == null || !rackingTaskData.Any()) |
| | |
| | | decimal messageId = 0; |
| | | string taskCode = ""; |
| | | |
| | | // 根据条码查询XB_RACKING_TASK_SYXT_LOG表,查询max(PALLETCODE) |
| | | var maxPalletCode = Db.Queryable<XbRackingTaskSyxtLog>() |
| | | // 根据条码查询XB_RACKING_TASK_SYXT_LOG表,查询max(PALLETCODE)和对应的widthType |
| | | var rackingTaskInfo = Db.Queryable<XbRackingTaskSyxtLog>() |
| | | .Where(x => x.ItemBarcode == barcode) |
| | | .Max(x => x.PalletCode); |
| | | .OrderByDescending(x => x.Id) |
| | | .Select(x => new { x.PalletCode, x.WidthType }) |
| | | .First(); |
| | | |
| | | try |
| | | { |
| | |
| | | { |
| | | taskCode = taskCode, |
| | | taskType = "1", |
| | | palletCode = maxPalletCode ?? "", |
| | | widthType = "180", |
| | | palletCode = rackingTaskInfo?.PalletCode ?? "", |
| | | widthType = rackingTaskInfo?.WidthType?.ToString() ?? "2000", |
| | | station = "3" |
| | | }; |
| | | var requestList = new[] { requestData }; |
| | |
| | | CreateDate = DateTime.Now, |
| | | TaskCode = taskCode, |
| | | TaskType = "立库出库请求", |
| | | PalletCode = maxPalletCode, |
| | | WidthType = 180, |
| | | PalletCode = rackingTaskInfo?.PalletCode ?? "", |
| | | WidthType = rackingTaskInfo?.WidthType ?? 2000, |
| | | MaterialName = firstStock.ItemName, |
| | | MaterialCode = firstStock.ItemNo, |
| | | BatchNo = firstStock.LotNo, |