Inheritance: com.Sconit.Entity.MasterData.FlowPlanBase
コード例 #1
0
 public virtual void DeleteFlowPlan(FlowPlan entity)
 {
     entityDao.DeleteFlowPlan(entity);
 }
コード例 #2
0
ファイル: ImportMgr.cs プロジェクト: Novthirteen/yfkey-scms
        public IList<FlowPlan> ReadShipScheduleYFKFromXls(Stream inputStream, User user, string planType, string partyCode, string timePeriodType, DateTime date)
        {
            IList<FlowPlan> flowPlanList = new List<FlowPlan>();
            if (inputStream.Length == 0)
                throw new BusinessErrorException("Import.Stream.Empty");

            HSSFWorkbook workbook = new HSSFWorkbook(inputStream);

            Sheet sheet = workbook.GetSheetAt(0);
            IEnumerator rows = sheet.GetRowEnumerator();

            ImportHelper.JumpRows(rows, 8);
            int colIndex = this.GetColumnIndexToRead_ShipScheduleYFK((HSSFRow)rows.Current, date);

            if (colIndex < 0)
                throw new BusinessErrorException("Import.MRP.DateNotExist", date.ToShortDateString());

            #region 列定义
            int colFlow = 1;//Flow
            int colUC = 6;//单包装
            #endregion

            while (rows.MoveNext())
            {
                Row row = (HSSFRow)rows.Current;
                if (!this.CheckValidDataRow(row, 1, 6))
                {
                    break;//边界
                }

                //string regCode=row.GetCell(
                string flowCode = string.Empty;
                string itemCode = string.Empty;
                decimal UC = 1;
                decimal planQty = 0;
                string refOrderNo = string.Empty;
                #region 读取客户代码
                //try
                //{
                //    pCode = row.GetCell(1).StringCellValue;
                //    if (pCode.Trim() == string.Empty)
                //        throw new BusinessErrorException("Import.MRP.Empty.Error.Customer", (row.RowNum + 1).ToString());

                //    if (partyCode != null && partyCode.Trim() != string.Empty)
                //    {
                //        if (pCode.Trim().ToUpper() != partyCode.Trim().ToUpper())
                //            continue;//客户过滤
                //    }
                //}
                //catch
                //{
                //    throw new BusinessErrorException("Import.MRP.Read.Error.Customer", (row.RowNum + 1).ToString());
                //}
                #endregion

                #region 读取参考订单号
                try
                {
                    refOrderNo = row.GetCell(3).StringCellValue;
                }
                catch { throw new BusinessErrorException("Import.MRP.Read.Error.RefOrderNo", (row.RowNum + 1).ToString()); }

                #endregion

                #region 读取Flow
                try
                {
                    flowCode = row.GetCell(colFlow).StringCellValue;
                    if (flowCode.Trim() == string.Empty)
                        continue;
                }
                catch
                {
                    this.ThrowCommonError(row, colIndex);
                }
                #endregion

                #region 读取成品代码
                try
                {
                    itemCode = row.GetCell(4).StringCellValue;
                    if (itemCode == string.Empty)
                        throw new BusinessErrorException("Import.PSModel.Empty.Error.ItemCode", (row.RowNum + 1).ToString());
                }
                catch
                {
                    throw new BusinessErrorException("Import.PSModel.Read.Error.ItemCode", (row.RowNum + 1).ToString());
                }
                #endregion

                #region 读取单包装
                try
                {
                    UC = Convert.ToDecimal(row.GetCell(colUC).NumericCellValue);
                }
                catch
                {
                    this.ThrowCommonError(row.RowNum, colUC, row.GetCell(colUC));
                }
                #endregion

                #region 读取计划量
                try
                {
                    planQty = Convert.ToDecimal(row.GetCell(colIndex).NumericCellValue);
                }
                catch
                {
                    throw new BusinessErrorException("Import.PSModel.Read.Error.PlanQty", (row.RowNum + 1).ToString());
                }
                #endregion

                FlowDetail flowDetail = this.LoadFlowDetailByFlow(flowCode, itemCode, UC);
                if (flowDetail == null)
                    throw new BusinessErrorException("Import.MRP.Distribution.FlowDetail.Not.Exist", (row.RowNum + 1).ToString());

                if (partyCode != null && partyCode.Trim() != string.Empty)
                {
                    if (!StringHelper.Eq(flowCode, partyCode))
                        continue;//客户过滤
                }

                //区域过滤
                if (partyCode != null && partyCode.Trim() != string.Empty)
                {
                    if (!StringHelper.Eq(partyCode, flowDetail.Flow.PartyTo.Code))
                        continue;//客户过滤
                }
                //区域权限过滤
                if (!user.HasPermission(flowDetail.Flow.PartyFrom.Code) && !user.HasPermission(flowDetail.Flow.PartyTo.Code))
                    continue;

                FlowPlan flowPlan = new FlowPlan();
                flowPlan.FlowDetail = flowDetail;
                flowPlan.TimePeriodType = timePeriodType;
                flowPlan.ReqDate = date;
                flowPlan.PlanQty = planQty;
                flowPlan.RefOrderNo = refOrderNo;
                flowPlanList.Add(flowPlan);
            }

            if (flowPlanList.Count == 0)
                throw new BusinessErrorException("Import.Result.Error.ImportNothing");

            return flowPlanList;
        }
コード例 #3
0
 public virtual void UpdateFlowPlan(FlowPlan entity)
 {
     entityDao.UpdateFlowPlan(entity);
 }
コード例 #4
0
 public virtual void CreateFlowPlan(FlowPlan entity)
 {
     entityDao.CreateFlowPlan(entity);
 }
コード例 #5
0
 public virtual void DeleteFlowPlan(FlowPlan entity)
 {
     Delete(entity);
 }
コード例 #6
0
 public virtual void UpdateFlowPlan(FlowPlan entity)
 {
     Update(entity);
 }
コード例 #7
0
 public virtual void CreateFlowPlan(FlowPlan entity)
 {
     Create(entity);
 }