private void PrintTipMsg(ProductBatchInfoVM p, string title, ref string tipMsg) { if (p.ReturnQuantity > 0 && p.ReturnQuantity > p.Quantity && !IsNotLend_Return) { tipMsg += string.Format("批次为 {0} 的商品{1}数量不能大于借出数量.\r\n", p.BatchNumber, "归还"); } if (p.Quantity != 0 && IsNotLend_Return) { if (!(p.Quantity > 0 && this.PType == PageType.Adjust) && Math.Abs(p.Quantity) > p.ActualQty) { tipMsg += string.Format("批次为 {0} 的商品{1}数量不能大于库存数量.\r\n", p.BatchNumber, title); } } if (p.Quantity != 0 && p.Status.Equals("R")) { tipMsg += string.Format("批次号为 {0} 的批号未激活,不能使用.\r\n", p.BatchNumber); } }
private void CheckBatch(ProductBatchInfoVM p, ref string tipMsg) { switch (this.PType) { case PageType.Lend: PrintTipMsg(p, "借出", ref tipMsg); break; case PageType.Adjust: if (p.Quantity < 0) { PrintTipMsg(p, "损益", ref tipMsg); } break; case PageType.Convert: PrintTipMsg(p, "转换", ref tipMsg); break; } }