public bool CheckOrderDet(string item, string loc, string checkOrderDetOption) { //不检查 if (checkOrderDetOption == BusinessConstants.CODE_MASTER_CHECK_ORDER_DETAIL_OPTION_VALUE_NOT_CHECK) { return(true); } //检查来源 if (checkOrderDetOption == BusinessConstants.CODE_MASTER_CHECK_ORDER_DETAIL_OPTION_VALUE_CHECK_SOURCE) { DetachedCriteria criteria = DetachedCriteria.For(typeof(FlowDetail)); criteria.Add(Expression.Eq("Item.Code", item)); IList <FlowDetail> flowDetailList = criteriaMgr.FindAll <FlowDetail>(criteria); if (flowDetailList != null && flowDetailList.Count > 0) { foreach (FlowDetail flowDetail in flowDetailList) { if (flowDetail.DefaultLocationTo != null && flowDetail.DefaultLocationTo.Code == loc) { return(true); } //ReferenceFlow if (flowDetail.Flow.ReferenceFlow != null && flowDetail.Flow.ReferenceFlow.Trim() != string.Empty) { Flow refFlow = this.flowMgr.LoadFlow(flowDetail.Flow.ReferenceFlow); if (refFlow.LocationTo != null && refFlow.LocationTo.Code == loc) { return(true); } } } } throw new BusinessErrorException("OrderDetail.Error.CheckOrderDetOption.NoSource", item); } //检查库存 if (checkOrderDetOption == BusinessConstants.CODE_MASTER_CHECK_ORDER_DETAIL_OPTION_VALUE_CHECK_INVENTORY) { decimal currentInv = LocationDetailMgr.GetCurrentInv(loc, item); if (currentInv > 0) { return(true); } else { throw new BusinessErrorException("OrderDetail.Error.CheckOrderDetOption.NoInventory", item, loc); } } return(false); }
private decimal GetDmdStartPAB(DateTime dmdStartTime, string loc, string itemCode) { IList <OrderLocationTransaction> inOrderLocTransList = this.GetOpenOrderLocTrans(loc, itemCode, BusinessConstants.IO_TYPE_IN, null, dmdStartTime); IList <OrderLocationTransaction> outOrderLocTransList = this.GetOpenOrderLocTrans(loc, itemCode, BusinessConstants.IO_TYPE_OUT, null, dmdStartTime); decimal currentInv = LocationDetailMgr.GetCurrentInv(loc, itemCode); decimal totalInputQty = this.GetTotalRemainQty(inOrderLocTransList); decimal totalOutputQty = this.GetTotalRemainQty(outOrderLocTransList); decimal PAB = currentInv + totalInputQty - totalOutputQty; return(PAB); }