public void Release(ISession session) { #region 检查 if (this.OrderTypeCode == ORDER_TYPE_CHK && this._status != INVCheckStatus.Confirm) { throw new Exception("状态为确认的盘点单才可以执行发布操作"); } if (this.OrderTypeCode == ORDER_TYPE_ADJ && this._status != INVCheckStatus.New) { throw new Exception("新建状态的库存调整单才可以执行发布操作"); } if (session.CreateEntityQuery <INVCheckLine>() .Where(Exp.Eq("OrderNumber", this._orderNumber)) .SetLastOffset(1) .Count() <= 0) { throw new Exception("没有明细,无法执行发布操作"); } #endregion this._status = INVCheckStatus.Release; this._approveResult = ApproveStatus.UnApprove; this.Update(session, "Status", "ApproveResult"); ERPUtil.ApproveThis(session, this); }
public void Release(ISession session) { if (this.Status != POStatus.New) { throw new Exception(string.Format("采购订单{0}不是新建状态,无法执行发布操作", this.OrderNumber)); } IList <POLine> lines = session.CreateEntityQuery <POLine>() .Where(Exp.Eq("OrderNumber", this.OrderNumber)) .List <POLine>(); if (lines == null || lines.Count <= 0) { throw new Exception(string.Format("采购订单{0}没有明细,不能发布", this.OrderNumber)); } System.Text.StringBuilder builder = new System.Text.StringBuilder(); foreach (POLine line in lines) { if (line.PurchaseQty <= 0M || line.Price <= 0M) { builder.Append("行").Append(line.LineNumber).Append("无效的数量或价格, "); } } if (builder.Length > 0) { throw new Exception(builder.ToString()); } this.Status = POStatus.Release; this.ApproveResult = ApproveStatus.UnApprove; this.Update(session, "Status", "ApproveResult"); ERPUtil.ApproveThis(session, this); //送签单据 }
public void Confirm(ISession session) { if (this._status != StockInStatus.Confirm) { throw new Exception("单据不是发布状态,无法审批入库价格"); } if (this.OrderTypeCode != StockInHead.ORD_TYPE_PRD_IN) { throw new Exception(this.OrderNumber + "不是产品入库单"); } this._status = StockInStatus.Release; this.Update(session, "Status"); ERPUtil.ApproveThis(session, this); }
public void Release(ISession session) { #region 检查 if (this._status != StockInStatus.New) { throw new Exception("单据不是新建状态,无法发布"); } IList <StockInLine> lines = session.CreateEntityQuery <StockInLine>() .Where(Exp.Eq("OrderNumber", this._orderNumber)) .OrderBy("LineNumber") .List <StockInLine>(); System.Text.StringBuilder builder = new System.Text.StringBuilder(); if (lines.Count <= 0) { builder.Append("单据").Append(this._orderNumber).Append("没有明细,无法发布"); } else { foreach (StockInLine line in lines) { if (string.IsNullOrEmpty(line.AreaCode) || line.AreaCode.Trim().Length <= 0) { builder.Append("行号").Append(line.LineNumber).Append("仓库无效; "); } if (line.Quantity <= 0) { builder.Append("行号").Append(line.LineNumber).Append("数量无效; "); } } } if (builder.Length > 0) { throw new Exception(builder.ToString()); } #endregion if (this.OrderTypeCode != StockInHead.ORD_TYPE_PRD_IN) { this._status = StockInStatus.Release; ERPUtil.ApproveThis(session, this); } //产品入库单,发布后需要填写价格再走签核、入库处理流程 else { this._status = StockInStatus.Confirm; } this.Update(session, "Status"); }
public void Release(ISession session) { if (this._status != InterchangeStatus.New) { throw new Exception("交接单" + this._orderNumber + "不是新建状态,无法发布"); } if (session.CreateEntityQuery <ICLine>() .Where(Exp.Eq("OrderNumber", this._orderNumber)) .Count() <= 0) { throw new Exception("交接单没有明细,无法发布"); } this._status = InterchangeStatus.Release; this._approveResult = ApproveStatus.UnApprove; this.Update(session, "Status", "ApproveResult"); ERPUtil.ApproveThis(session, this); }
public void Release(ISession session) { if (this.Status != POReturnStatus.New) { throw new Exception("退货单不是新建状态,无法发布"); } int count = session.CreateEntityQuery <POReturnLine>() .Where(Exp.Eq("OrderNumber", this.OrderNumber)) .Count(); if (count <= 0) { throw new Exception("退货单没有退货明细,无法发布"); } this.Status = POReturnStatus.Release; this.Update(session, "Status"); ERPUtil.ApproveThis(session, this); }
public void Release(ISession session) { if (this.Status != WHTransferStatus.New) { log.WarnFormat("移库单{0}不是新建状态,无法执行发布操作", this.OrderNumber); throw new Exception(string.Format("移库单{0}不是新建状态,无法执行发布操作", this.OrderNumber)); } IList <WHTransferLine> lines = session.CreateEntityQuery <WHTransferLine>() .Where(Exp.Eq("OrderNumber", this.OrderNumber)) .List <WHTransferLine>(); if (lines.Count <= 0) { log.ErrorFormat("移库单{0}没有明细,无法执行发布操作", this.OrderNumber); throw new Exception(string.Format("移库单{0}没有明细,无法执行发布操作", this.OrderNumber)); } this.Status = WHTransferStatus.Release; this.Update(session, "Status"); ERPUtil.ApproveThis(session, this); }
public void Release(ISession session) { if (this.Status != ReturnStatus.New) { throw new Exception("退货单不是新建状态,无法执行发布操作"); } //换货退货单,必须扫描退货商品,扫描数量必须等于退货商品数量 if (this.OrderTypeCode == ORDER_TYPE_EXCHANGE_RTN && !this.HasScaned) { throw new Exception("您还没有扫描退货商品"); } IList <ReturnLine> lines = session.CreateEntityQuery <ReturnLine>() .Where(Exp.Eq("OrderNumber", this.OrderNumber)) .List <ReturnLine>(); if (lines.Count <= 0 && this.OrderTypeCode != ReturnHead.ORDER_TYPE_EXCHANGE_RTN) { throw new Exception("没有退货明细,无法发布"); } this.CheckWHSettings(session, lines); this.Status = ReturnStatus.Release; this.Update(session, "Status"); ERPUtil.ApproveThis(session, this); }
public void Release(ISession session) { #region 检查 if (this.Status != ReceiveStatus.New) { throw new Exception(string.Format("收货单{0}不是新建状态,无法执行发布操作", this.OrderNumber)); } int count = session.CreateEntityQuery <RCVLine>() .Where(Exp.Eq("OrderNumber", this.OrderNumber)) .Count(); if (count <= 0) { throw new Exception(string.Format("收货单{0}没有明细,不能发布", this.OrderNumber)); } IList <RCVLine> lines = session.CreateEntityQuery <RCVLine>() .Where(Exp.Eq("OrderNumber", this._orderNumber)) .List <RCVLine>(); bool error = false, errorHead = false; System.Text.StringBuilder builder = new System.Text.StringBuilder(); foreach (RCVLine line in lines) { errorHead = false; if (string.IsNullOrEmpty(line.LocationCode) || line.LocationCode.Trim().Length <= 0) { error = true; if (!errorHead) { builder.Append("行号").Append(line.LineNumber).Append(":"); } builder.Append("仓储地为空; "); errorHead = true; } if (string.IsNullOrEmpty(line.AreaCode) || line.AreaCode.Trim().Length <= 0) { error = true; if (!errorHead) { builder.Append("行号").Append(line.LineNumber).Append(":"); } builder.Append("入库区域为空; "); errorHead = true; } if (line.RCVTotalQty <= 0M) { error = true; if (!errorHead) { builder.Append("行号").Append(line.LineNumber).Append(":"); } builder.Append("收货数量无效; "); errorHead = true; } if (line.QualifiedQty <= 0M) { error = true; if (!errorHead) { builder.Append("行号").Append(line.LineNumber).Append(":"); } builder.Append("合格数量无效; "); errorHead = true; } } if (error) { throw new Exception(builder.ToString()); } #endregion this.Status = ReceiveStatus.Release; this.ApproveResult = ApproveStatus.UnApprove; this.Update(session, "Status", "ApproveResult"); ERPUtil.ApproveThis(session, this); //送签单据 }