public void SearchRfidInfo(string rfid, Result result) { BillDetail[] billDetails = new BillDetail[] { }; try { var taryInfo = TrayInfoRepository.GetQueryable() .Where(t => t.TaryRfid == rfid) .Select(t => new BillDetail() { ProductCode = t.ProductCode, PieceQuantity = t.Quantity }).ToArray(); billDetails = billDetails.Concat(taryInfo).ToArray(); result.IsSuccess = true; result.BillDetails = billDetails; } catch (Exception e) { result.IsSuccess = false; result.Message = "调用服务器服务查询托盘信息失败!,详情:" + e.InnerException.Message + " 其他错误" + e.Message; } }
public void GetBillDetail(BillMaster[] billMasters, string productCode, string OperateType, string OperateAreas, string Operator, Result result) { BillDetail[] billDetails = new BillDetail[] { }; var ops = OperateAreas.Split(',').Select(a => Convert.ToInt32(a)).ToArray(); try { foreach (var billMaster in billMasters) { string billNo = billMaster.BillNo; switch (billMaster.BillType) { #region 读入库单细单 case "1"://入库单 var inBillDetails = InBillAllotRepository.GetQueryable() .WhereIn(m => m.Cell.Layer, ops) .Where(i => i.BillNo == billNo && (i.ProductCode == productCode || productCode == string.Empty) && (i.Status == "0" || (i.Status == "1" && i.Operator == Operator))) .Select(i => new BillDetail() { BillNo = i.BillNo, BillType = "1" , DetailID = i.ID, StorageName = i.Cell.CellName, StorageRfid = i.Storage.Rfid, CellRfid = i.Cell.Rfid, TargetStorageName = "", TargetStorageRfid = "", ProductCode = i.ProductCode, ProductName = i.Product.ProductName, PieceQuantity =Math.Floor(i.AllotQuantity/i.Product.UnitList.Unit01.Count), BarQuantity = Math.Floor((i.AllotQuantity % i.Product.UnitList.Unit01.Count) / i.Product.UnitList.Unit02.Count), OperatePieceQuantity = Math.Floor(i.AllotQuantity / i.Product.UnitList.Unit01.Count), OperateBarQuantity = Math.Floor((i.AllotQuantity % i.Product.UnitList.Unit01.Count) / i.Product.UnitList.Unit02.Count), OperatorCode = string.Empty, Operator = i.Operator, Status = i.Status, }) .ToArray(); billDetails = billDetails.Concat(inBillDetails).ToArray(); break; #endregion #region 读出库单细单 case "2"://出库单 var outBillDetails = OutBillAllotRepository.GetQueryable() .WhereIn(m => m.Cell.Layer, ops) .Where(i => i.BillNo == billNo && (i.CanRealOperate == "1" || OperateType != "Real") && (i.Status == "0" || (i.Status == "1" && i.Operator == Operator))) .Select(i => new BillDetail() { BillNo = i.BillNo, BillType = "2", DetailID = i.ID, StorageName = i.Cell.CellName, StorageRfid = i.Storage.Rfid, CellRfid =i.Cell.Rfid, TargetStorageName = "", TargetStorageRfid = "", ProductCode = i.ProductCode, ProductName = i.Product.ProductName, PieceQuantity = Math.Floor(i.AllotQuantity / i.Product.UnitList.Unit01.Count), BarQuantity = Math.Floor((i.AllotQuantity % i.Product.UnitList.Unit01.Count) / i.Product.UnitList.Unit02.Count), OperatePieceQuantity = Math.Floor(i.AllotQuantity / i.Product.UnitList.Unit01.Count), OperateBarQuantity = Math.Floor((i.AllotQuantity % i.Product.UnitList.Unit01.Count) / i.Product.UnitList.Unit02.Count), OperatorCode = string.Empty, Operator = i.Operator, Status = i.Status, }) .ToArray(); billDetails = billDetails.Concat(outBillDetails).ToArray(); var outBillMaster = OutBillMasterRepository.GetQueryable() .Where(i => i.BillNo == billNo) .FirstOrDefault(); if (outBillMaster != null && outBillMaster.MoveBillMasterBillNo != null) { billNo = outBillMaster.MoveBillMasterBillNo; //todo; var moveBillDetailss = MoveBillDetailRepository.GetQueryable() .WhereIn(m => m.InCell.Layer, ops) .Where(i => i.BillNo == billNo && (i.CanRealOperate == "1" || OperateType != "Real") && (i.Status == "0" || (i.Status == "1" && i.Operator == Operator))) .ToArray() .Select(i => new BillDetail() { BillNo = i.BillNo, BillType = "3", DetailID = i.ID, StorageName = i.OutCell.CellName, StorageRfid = i.OutCell.Rfid, TargetStorageName = i.InCell.CellName, TargetStorageRfid = i.InCell.Rfid, ProductCode = i.ProductCode, ProductName = i.Product.ProductName, PieceQuantity = Math.Floor(i.RealQuantity / i.Product.UnitList.Unit01.Count), BarQuantity = Math.Floor((i.RealQuantity % i.Product.UnitList.Unit01.Count) / i.Product.UnitList.Unit02.Count), OperatePieceQuantity = Math.Floor(i.RealQuantity / i.Product.UnitList.Unit01.Count), OperateBarQuantity = Math.Floor((i.RealQuantity % i.Product.UnitList.Unit01.Count) / i.Product.UnitList.Unit02.Count), OperatorCode = string.Empty, Operator = i.Operator, Status = i.Status, }) .ToArray(); billDetails = billDetails.Concat(moveBillDetailss).ToArray(); } break; #endregion #region 读移库单细单 case "3"://移库单 var moveBillDetails = MoveBillDetailRepository.GetQueryable() .WhereIn(m => m.InCell.Layer, ops) .Where(i => i.BillNo == billNo && (i.CanRealOperate == "1" || OperateType != "Real") && (i.Status == "0" || (i.Status == "1" && i.Operator == Operator))) .Select(i => new BillDetail() { BillNo = i.BillNo, BillType = "3", DetailID = i.ID, StorageName = i.OutCell.CellName, StorageRfid = i.OutStorage.Rfid, CellRfid = i.OutCell.Rfid, TargetStorageName = i.InCell.CellName, TargetStorageRfid = i.InCell.Rfid, ProductCode = i.ProductCode, ProductName = i.Product.ProductName, PieceQuantity = Math.Floor(i.RealQuantity / i.Product.UnitList.Unit01.Count), BarQuantity = Math.Floor((i.RealQuantity % i.Product.UnitList.Unit01.Count) / i.Product.UnitList.Unit02.Count), OperatePieceQuantity = Math.Floor(i.RealQuantity / i.Product.UnitList.Unit01.Count), OperateBarQuantity = Math.Floor((i.RealQuantity % i.Product.UnitList.Unit01.Count) / i.Product.UnitList.Unit02.Count), OperatorCode = string.Empty, Operator = i.Operator, Status = i.Status, PalletTag = i.PalletTag??0 }) .ToArray(); billDetails = billDetails.Concat(moveBillDetails).ToArray(); break; #endregion #region 读盘点单细单 case "4"://盘点单 var checkBillDetails = CheckBillDetailRepository.GetQueryable() .WhereIn(m => m.Cell.Layer, ops) .Where(i => i.BillNo == billNo && (i.Status == "0" || (i.Status == "1" && i.Operator == Operator))) .Select(i => new BillDetail() { BillNo = i.BillNo, BillType = "4", DetailID = i.ID, StorageName = i.Cell.CellName, StorageRfid = i.Storage.Rfid, CellRfid = i.Cell.Rfid, TargetStorageName = "", TargetStorageRfid = "", ProductCode = i.ProductCode, ProductName = i.Product.ProductName, PieceQuantity = Math.Floor(i.RealQuantity / i.Product.UnitList.Unit01.Count), BarQuantity = Math.Floor((i.RealQuantity % i.Product.UnitList.Unit01.Count) / i.Product.UnitList.Unit02.Count), OperatePieceQuantity = Math.Floor(i.RealQuantity / i.Product.UnitList.Unit01.Count), OperateBarQuantity = Math.Floor((i.RealQuantity % i.Product.UnitList.Unit01.Count) / i.Product.UnitList.Unit02.Count), OperatorCode = string.Empty, Operator = i.Operator, Status = i.Status, }) .ToArray(); billDetails = billDetails.Concat(checkBillDetails).ToArray(); break; default: break; #endregion } } result.IsSuccess = true; result.BillDetails = billDetails.OrderByDescending(i => i.Status) .ThenByDescending(b => b.TargetStorageName).ToArray(); } catch (Exception e) { result.IsSuccess = false; result.Message = "调用服务器服务查询订单细表失败,详情:" + e.InnerException.Message + " 其他错误" + e.Message; } }