当前位置: 首页>>代码示例>>C#>>正文


C# BusinessException.AddMessage方法代码示例

本文整理汇总了C#中com.Sconit.Entity.Exception.BusinessException.AddMessage方法的典型用法代码示例。如果您正苦于以下问题:C# BusinessException.AddMessage方法的具体用法?C# BusinessException.AddMessage怎么用?C# BusinessException.AddMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.Sconit.Entity.Exception.BusinessException的用法示例。


在下文中一共展示了BusinessException.AddMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DoPick

        public void DoPick(IList<PickListDetail> pickListDetailList)
        {
            if (pickListDetailList.Select(det => det.PickListNo).Distinct().Count() > 1)
            {
                throw new TechnicalException("不能跨拣货单拣货。");
            }

            string pickListNo = pickListDetailList.Select(det => det.PickListNo).Distinct().Single();

            #region 判断是否全0拣货
            if (pickListDetailList == null || pickListDetailList.Count == 0)
            {
                throw new BusinessException("拣货明细不能为空。");
            }

            IList<PickListDetail> nonZeroPickListDetailList = pickListDetailList.Where(o => o.PickListDetailInputs != null && o.PickListDetailInputs.Count > 0).ToList();

            if (nonZeroPickListDetailList.Count == 0)
            {
                throw new BusinessException("拣货明细不能为空。");
            }
            #endregion

            #region 库存占用
            IList<InventoryOccupy> inventoryOccupyList = new List<InventoryOccupy>();
            foreach (PickListDetail pickListDetail in nonZeroPickListDetailList)
            {
                foreach (PickListDetailInput pickListDetailInput in pickListDetail.PickListDetailInputs)
                {
                    InventoryOccupy inventoryOccupy = new InventoryOccupy();
                    inventoryOccupy.HuId = pickListDetailInput.HuId;
                    inventoryOccupy.Location = pickListDetail.LocationFrom;
                    inventoryOccupy.QualityType = CodeMaster.QualityType.Qualified;
                    inventoryOccupy.OccupyType = CodeMaster.OccupyType.Pick;
                    inventoryOccupy.OccupyReferenceNo = pickListDetail.PickListNo;
                    inventoryOccupyList.Add(inventoryOccupy);
                }
            }

            IList<LocationLotDetail> locationLotDetailList = this.locationDetailMgr.InventoryOccupy(inventoryOccupyList);
            #endregion

            #region 检查是否超拣
            BusinessException businessException = new BusinessException();
            foreach (PickListDetail pickListDetail in nonZeroPickListDetailList)
            {
                decimal pickedQty = locationLotDetailList.Where(l => pickListDetail.GetPickedHuList().Contains(l.HuId)).Sum(l => l.HuQty);

                if (pickListDetail.Qty < pickListDetail.PickedQty + pickedQty)
                {
                    businessException.AddMessage("拣货行{0}的拣货数已经超过待拣数。", pickListDetail.Sequence.ToString());
                }

                pickListDetail.PickedQty += pickedQty;
            }
            #endregion

            if (businessException.HasMessage)
            {
                throw businessException;
            }

            #region 更新拣货单头
            PickListMaster pickListMaster = this.genericMgr.FindById<PickListMaster>(pickListNo);
            pickListMaster.CompleteDate = DateTime.Now;
            pickListMaster.CompleteUserId = SecurityContextHolder.Get().Id;
            pickListMaster.CompleteUserName = SecurityContextHolder.Get().FullName;
            #endregion

            #region 更新拣货明细
            foreach (PickListDetail pickListDetail in nonZeroPickListDetailList)
            {
                this.genericMgr.Update(pickListDetail);

                foreach (PickListDetailInput pickListDetailInput in pickListDetail.PickListDetailInputs)
                {
                    LocationLotDetail huLocationLotDetail = locationLotDetailList.Where(l => l.HuId == pickListDetailInput.HuId).Single();

                    PickListResult pickListResult = new PickListResult();

                    pickListResult.PickListNo = pickListMaster.PickListNo;
                    pickListResult.PickListDetailId = pickListDetail.Id;
                    pickListResult.OrderDetailId = pickListDetail.OrderDetailId;
                    pickListResult.Item = pickListDetail.Item;
                    pickListResult.ItemDescription = pickListDetail.ItemDescription;
                    pickListResult.ReferenceItemCode = pickListDetail.ReferenceItemCode;
                    pickListResult.Uom = huLocationLotDetail.HuUom;
                    pickListResult.BaseUom = huLocationLotDetail.BaseUom;
                    pickListResult.UnitCount = huLocationLotDetail.UnitCount;
                    pickListResult.UnitQty = huLocationLotDetail.UnitQty;
                    pickListResult.HuId = huLocationLotDetail.HuId;
                    pickListResult.LotNo = huLocationLotDetail.LotNo;
                    pickListResult.IsConsignment = huLocationLotDetail.IsConsignment;
                    pickListResult.PlanBill = huLocationLotDetail.PlanBill;
                    pickListResult.QualityType = huLocationLotDetail.QualityType;
                    pickListResult.IsFreeze = huLocationLotDetail.IsFreeze;
                    pickListResult.IsATP = huLocationLotDetail.IsATP;
                    pickListResult.Qty = huLocationLotDetail.Qty / huLocationLotDetail.UnitQty;

                    this.genericMgr.Create(pickListResult);
//.........这里部分代码省略.........
开发者ID:Novthirteen,项目名称:sih-les,代码行数:101,代码来源:PickListMgrImpl.cs

示例2: PackSequenceOrder

        public void PackSequenceOrder(SequenceMaster sequenceMaster, IList<string> huIdList)
        {
            #region 检查
            if (sequenceMaster.Status != CodeMaster.SequenceStatus.Submit)
            {
                throw new BusinessException("状态为{1}的排序装箱单{0}不能装箱。", sequenceMaster.SequenceNo,
                    systemMgr.GetCodeDetailDescription(com.Sconit.CodeMaster.CodeMaster.SequenceStatus, ((int)sequenceMaster.Status).ToString()));
            }

            if (huIdList == null || huIdList.Count == 0)
            {
                throw new BusinessException("排序装箱单{0}的装箱条码为空。", sequenceMaster.SequenceNo);
            }
            #endregion

            #region 库存占用
            IList<InventoryOccupy> inventoryOccupyList = (from huId in huIdList
                                                          select new InventoryOccupy
                                                          {
                                                              HuId = huId,
                                                              Location = sequenceMaster.LocationFrom,
                                                              QualityType = CodeMaster.QualityType.Qualified,
                                                              OccupyType = CodeMaster.OccupyType.Sequence,
                                                              OccupyReferenceNo = sequenceMaster.SequenceNo
                                                          }).ToList();

            IList<LocationLotDetail> locationLotDetailList = this.locationDetailMgr.InventoryOccupy(inventoryOccupyList);
            #endregion

            #region 排序单数量和扫描条码数量匹配
            BusinessException businessException = new BusinessException();
            TryLoadSequenceDetails(sequenceMaster);
            if (sequenceMaster.SequenceDetails.Where(d => !d.IsClose).Count() != huIdList.Count)  //过滤掉已经Close的排序件,因为已经暂停
            {
                businessException.AddMessage("扫描条码的数量和排序装箱单明细的数量不匹配。");
            }
            #endregion

            #region 条码匹配检查,按顺序检查排序件条码
            int i = 0;
            foreach (SequenceDetail sequenceDetail in sequenceMaster.SequenceDetails.Where(d => !d.IsClose).OrderBy(d => d.Sequence))
            {
                LocationLotDetail locationLotDetail = locationLotDetailList.Where(l => l.HuId == huIdList[i]).Single();
                i++;
                if (sequenceDetail.Item != locationLotDetail.Item)
                {
                    businessException.AddMessage("排序装箱单序号{0}所需的零件为{1},扫描的零件为{2}。", sequenceDetail.Sequence.ToString(), sequenceDetail.Item, locationLotDetail.Item);
                }
            }

            if (businessException.HasMessage)
            {
                throw businessException;
            }
            #endregion

            #region 更新排序装箱单头
            sequenceMaster.Status = CodeMaster.SequenceStatus.Pack;
            sequenceMaster.PackUserId = SecurityContextHolder.Get().Id;
            sequenceMaster.PackUserName = SecurityContextHolder.Get().FullName;
            sequenceMaster.PackDate = DateTime.Now;
            this.genericMgr.Update(sequenceMaster);
            #endregion

            #region 装箱操作
            i = 0;
            foreach (SequenceDetail sequenceDetail in sequenceMaster.SequenceDetails.Where(d => !d.IsClose))
            {
                LocationLotDetail locationLotDetail = locationLotDetailList.Where(l => l.HuId == huIdList[i]).Single();
                i++;
                sequenceDetail.HuId = locationLotDetail.HuId;
                sequenceDetail.LotNo = locationLotDetail.LotNo;

                this.genericMgr.Update(sequenceDetail);
            }
            #endregion
        }
开发者ID:druidwang,项目名称:Les_parts,代码行数:77,代码来源:OrderMgrImpl.cs

示例3: DoStartVanOrder

        private void DoStartVanOrder(string orderNo, string feedOrderNo, IList<string> feedHuIdList, bool isForce)
        {
            #region 上线
            OrderMaster orderMaster = this.genericMgr.FindById<OrderMaster>(orderNo);

            #region 判断是否第一辆上线
            IList<long> beforeUnstartVanOrderCount = this.genericMgr.FindAll<long>("select count(*) as counter from OrderMaster where Type = ? and Flow = ? and Status = ? and IsPause = ? and Sequence < ?", new object[] { orderMaster.Type, orderMaster.Flow, CodeMaster.OrderStatus.Submit, false, orderMaster.Sequence });

            if (beforeUnstartVanOrderCount != null && beforeUnstartVanOrderCount.Count > 0 && beforeUnstartVanOrderCount[0] > 0)
            {
                throw new BusinessException("生产单{0}不是生产线{1}第一张待上线的生产单。", orderNo, orderMaster.Flow);
            }
            #endregion

            this.StartOrder(orderMaster);
            #endregion

            #region 子生产单投料
            if (!string.IsNullOrWhiteSpace(feedOrderNo))
            {
                this.productionLineMgr.FeedProductOrder(orderNo, feedOrderNo, isForce);
            }
            #endregion

            #region 物料投料
            if (feedHuIdList != null && feedHuIdList.Count > 0)
            {
                #region 查找投料条码
                IList<Hu> huList = this.huMgr.LoadHus(feedHuIdList);
                #endregion

                #region 查找投料工位
                string hql = string.Empty;
                IList<object> para = new List<object>();
                foreach (string item in huList.Select(h => h.Item).Distinct())
                {
                    if (hql == string.Empty)
                    {
                        hql = "from OrderBomDetail where OrderNo = ? and Item in (?";
                        para.Add(orderNo);
                    }
                    else
                    {
                        hql += ", ?";
                    }
                    para.Add(item);
                }
                hql += ")";

                IList<OrderBomDetail> orderBomDetailList = this.genericMgr.FindAll<OrderBomDetail>(hql, para.ToArray());

                #region 判断条码是否在OrderBomDetial中存在
                if (!isForce)
                {
                    BusinessException businessException = new BusinessException();
                    foreach (Hu hu in huList)
                    {
                        if (orderBomDetailList.Where(det => det.Item == hu.Item).Count() == 0)
                        {
                            businessException.AddMessage("投料的条码{0}在生产单的物料清单中不存在。", hu.HuId);
                        }
                    }

                    if (businessException.HasMessage)
                    {
                        throw businessException;
                    }
                }
                #endregion
                #endregion

                #region 投料
                foreach (string huId in feedHuIdList)
                {
                    Hu hu = huList.Where(h => h.HuId == huId).Single();
                    OrderBomDetail orderBomDetail = orderBomDetailList.Where(o => o.Item == hu.Item).OrderBy(o => o.Sequence).First();

                    FeedInput feedInput = new FeedInput();
                    feedInput.HuId = huId;
                    feedInput.Operation = orderBomDetail.Operation;
                    feedInput.OpReference = orderBomDetail.OpReference;

                    IList<FeedInput> feedInputList = new List<FeedInput>();
                    feedInputList.Add(feedInput);

                    this.productionLineMgr.FeedRawMaterial(orderNo, feedInputList, isForce);
                }
                #endregion
            }
            #endregion

            #region 释放驾驶室生产单
            //由后台Job自动释放
            #endregion

            #region 递延扣减
            //记录递延扣减需求,由后台Job自动扣减
            IList<DeferredFeedCounter> deferredFeedCounterList = this.genericMgr.FindAll<DeferredFeedCounter>("from DeferredFeedCounter where Flow = ?", orderMaster.Flow);
            if (deferredFeedCounterList != null && deferredFeedCounterList.Count > 0)
            {
//.........这里部分代码省略.........
开发者ID:druidwang,项目名称:Les_parts,代码行数:101,代码来源:OrderMgrImpl.cs

示例4: CheckKitIpDetail

        private void CheckKitIpDetail(IpMaster ipMaster, bool isCheckKitTraceItem)
        {
            BusinessException businessException = new BusinessException();

            #region 明细行是否收/发货判断
            IList<IpDetail> unReceivedIpDetailList = LoadExceptIpDetails(ipMaster.IpNo, ipMaster.IpDetails.Select(det => det.Id).ToArray());
            if (unReceivedIpDetailList != null && unReceivedIpDetailList.Count > 0)
            {
                foreach (IpDetail unReceivedIpDetail in unReceivedIpDetailList)
                {
                    businessException.AddMessage("KIT送货单{0}行号{1}零件号{2}没有收货。", ipMaster.IpNo, unReceivedIpDetail.Sequence.ToString(), unReceivedIpDetail.Item);
                }
            }
            #endregion

            #region 收/发货数是否等于订单数判断
            foreach (IpDetail ipDetail in ipMaster.IpDetails)
            {
                if (ipDetail.Qty != ipDetail.ReceiveQtyInput)
                {
                    businessException.AddMessage("KIT送货单{0}行号{1}零件号{2}的收货数和送货数不一致。", ipMaster.IpNo, ipDetail.Sequence.ToString(), ipDetail.Item);
                }
            }
            #endregion

            #region KIT中的关键件是否扫描
            if (isCheckKitTraceItem)
            {
                foreach (IpDetail ipDetail in ipMaster.IpDetails.Where(o => o.IsScanHu))
                {
                    if (ipDetail.Qty != ipDetail.IpDetailInputs.Where(o => !string.IsNullOrWhiteSpace(o.HuId)).Count())
                    {
                        businessException.AddMessage("KIT送货单{0}行号{1}的关键零件{1}没有扫描。", ipMaster.IpNo, ipDetail.Sequence.ToString(), ipDetail.Item);
                    }
                }
            }
            #endregion

            if (businessException.HasMessage)
            {
                throw businessException;
            }
        }
开发者ID:druidwang,项目名称:Les_parts,代码行数:43,代码来源:OrderMgrImpl.cs

示例5: CloseOrder

        private void CloseOrder(OrderMaster orderMaster, bool isForce, bool isThrowException = true)
        {
            if (orderMaster.Status == CodeMaster.OrderStatus.InProcess
                || orderMaster.Status == CodeMaster.OrderStatus.Complete)
            {
                DateTime dateTimeNow = DateTime.Now;
                User user = SecurityContextHolder.Get();

                this.genericMgr.FlushSession();
                BusinessException businessException = new BusinessException();

                #region 强制关闭生产单,先把状态改为Complete
                if (isForce && orderMaster.Status == CodeMaster.OrderStatus.InProcess && orderMaster.Type == CodeMaster.OrderType.Production)
                {
                    //生产先做订单完工
                    orderMaster.Status = CodeMaster.OrderStatus.Complete;
                    orderMaster.CompleteDate = dateTimeNow;
                    orderMaster.CompleteUserId = user.Id;
                    orderMaster.CompleteUserName = user.FullName;
                    this.genericMgr.Update(orderMaster);
                }
                #endregion

                #region 条件1所有订单明细收货数大于等于订单数 //强制关闭不用校验这条
                if (!isForce)
                {
                    string hql = "select count(*) as counter from OrderDetail where OrderNo = ? and (ReceivedQty+ScrapQty) < OrderedQty";
                    long counter = this.genericMgr.FindAll<long>(hql, new Object[] { orderMaster.OrderNo })[0];
                    if (counter > 0)
                    {
                        return;
                    }
                }
                #endregion

                #region 条件2所有送货单明细全部关闭
                if (orderMaster.Type != CodeMaster.OrderType.Production)
                {
                    string hql = "select count(*) as counter from IpDetail where OrderNo = ? and IsClose = ?";
                    long counter = this.genericMgr.FindAll<long>(hql, new Object[] { orderMaster.OrderNo, false })[0];
                    if (counter > 0)
                    {
                        if (!isForce)
                        {
                            //非强制关闭直接返回
                            return;
                        }
                        businessException.AddMessage("和订单相关的送货单明细没有全部关闭,不能关闭订单{0}。", orderMaster.OrderNo);
                    }
                }
                #endregion

                #region 条件3所有的拣货单全部关闭
                if (orderMaster.Type == CodeMaster.OrderType.Transfer
                   || orderMaster.Type == CodeMaster.OrderType.SubContractTransfer
                    || orderMaster.Type == CodeMaster.OrderType.Distribution)
                {
                    string hql = "select count(*) as counter from PickListDetail where OrderNo = ? and IsClose = ?";
                    long counter = this.genericMgr.FindAll<long>(hql, new Object[] { orderMaster.OrderNo, false })[0];
                    if (counter > 0)
                    {
                        if (!isForce)
                        {
                            //非强制关闭直接返回
                            return;
                        }
                        businessException.AddMessage("和订单相关的捡货单明细没有全部关闭,不能关闭订单{0}。", orderMaster.OrderNo);
                    }
                }
                #endregion

                if (businessException.HasMessage)
                {
                    if (isThrowException)
                    {
                        throw businessException;
                    }
                }
                else
                {
                    orderMaster.Status = CodeMaster.OrderStatus.Close;
                    orderMaster.CloseDate = dateTimeNow;
                    orderMaster.CloseUserId = user.Id;
                    orderMaster.CloseUserName = user.FullName;
                    this.genericMgr.Update(orderMaster);
                }
            }
            else if (!isForce)
            {
                throw new BusinessException("不能关闭状态为{1}的订单{0}。", orderMaster.OrderNo,
                    systemMgr.GetCodeDetailDescription(com.Sconit.CodeMaster.CodeMaster.OrderStatus, ((int)orderMaster.Status).ToString()));
            }
        }
开发者ID:druidwang,项目名称:Les_parts,代码行数:93,代码来源:OrderMgrImpl.cs

示例6: JudgeInspectDetail

        public void JudgeInspectDetail(IList<InspectDetail> inspectDetailList, DateTime effectiveDate)
        {
            #region 检查
            if (inspectDetailList == null)
            {
                throw new BusinessException("判定结果不能为空。");
            }

            IList<InspectDetail> noneZeroInspectDetailList = inspectDetailList.Where(i => i.CurrentQualifyQty > 0 || i.CurrentRejectQty > 0 || i.CurrentReturnQty > 0 || i.CurrentConcessionQty > 0).ToList();

            if (noneZeroInspectDetailList == null || noneZeroInspectDetailList.Count == 0)
            {
                throw new BusinessException("判定结果不能为空。");
            }

            BusinessException businessException = new BusinessException();
            foreach (InspectDetail inspectDetail in noneZeroInspectDetailList)
            {
                if (inspectDetail.InspectQty < (inspectDetail.QualifyQty + inspectDetail.RejectQty + inspectDetail.CurrentQualifyQty + inspectDetail.CurrentRejectQty + inspectDetail.CurrentReturnQty + inspectDetail.CurrentConcessionQty))
                {
                    businessException.AddMessage("检验单{0}行号{1}的判定数超过了报验数。", inspectDetail.InspectNo, inspectDetail.Sequence.ToString());
                }
            }
            if (businessException.HasMessage)
            {
                throw businessException;
            }
            #endregion

            #region 查找报验单头
            string hql = string.Empty;
            IList<object> paras = new List<object>();
            foreach (string inspectNo in noneZeroInspectDetailList.Select(i => i.InspectNo).Distinct())
            {
                if (hql == string.Empty)
                {
                    hql = "from InspectMaster where InspectNo in (?";
                }
                else
                {
                    hql += ", ?";
                }
                paras.Add(inspectNo);
            }
            hql += ")";
            IList<InspectMaster> inspectMasterList = this.genericMgr.FindAll<InspectMaster>(hql, paras.ToArray());
            #endregion

            #region 生成报验结果
            IList<InspectResult> inspectResultList = new List<InspectResult>();
            #region 合格
            ((List<InspectResult>)inspectResultList).AddRange(from det in noneZeroInspectDetailList
                                                              where det.CurrentQualifyQty > 0
                                                              select new InspectResult
                                                              {
                                                                  InspectNo = det.InspectNo,
                                                                  InspectDetailId = det.Id,
                                                                  InspectDetailSequence = det.Sequence,
                                                                  Item = det.Item,
                                                                  ItemDescription = det.ItemDescription,
                                                                  ReferenceItemCode = det.ReferenceItemCode,
                                                                  UnitCount = det.UnitCount,
                                                                  Uom = det.Uom,
                                                                  BaseUom = det.BaseUom,
                                                                  UnitQty = det.UnitQty,
                                                                  HuId = det.HuId,
                                                                  LotNo = det.LotNo,
                                                                  LocationFrom = det.LocationFrom,
                                                                  CurrentLocation = det.CurrentLocation,
                                                                  JudgeResult = CodeMaster.JudgeResult.Qualified,
                                                                  JudgeQty = det.CurrentQualifyQty,
                                                                  HandleQty = 0,
                                                                  IsHandle = false,
                                                                  ManufactureParty = det.ManufactureParty,
                                                                  IpNo = inspectMasterList.Where(mstr => mstr.InspectNo == det.InspectNo).Single().IpNo,
                                                                  IpDetailSequence = det.IpDetailSequence,
                                                                  WMSNo = det.WMSResNo,
                                                                  WMSSeq = det.WMSResSeq,
                                                                  ReceiptNo = inspectMasterList.Where(mstr => mstr.InspectNo == det.InspectNo).Single().ReceiptNo,
                                                                  ReceiptDetailSequence = det.ReceiptDetailSequence,
                                                              });
            #endregion

            #region 不合格
            ((List<InspectResult>)inspectResultList).AddRange(from det in noneZeroInspectDetailList
                                                              where det.CurrentRejectQty > 0
                                                              select new InspectResult
                                                              {
                                                                  InspectNo = det.InspectNo,
                                                                  InspectDetailId = det.Id,
                                                                  InspectDetailSequence = det.Sequence,
                                                                  Item = det.Item,
                                                                  ItemDescription = det.ItemDescription,
                                                                  ReferenceItemCode = det.ReferenceItemCode,
                                                                  UnitCount = det.UnitCount,
                                                                  Uom = det.Uom,
                                                                  BaseUom = det.BaseUom,
                                                                  UnitQty = det.UnitQty,
                                                                  HuId = det.HuId,
                                                                  LotNo = det.LotNo,
//.........这里部分代码省略.........
开发者ID:Novthirteen,项目名称:sih-les,代码行数:101,代码来源:InspectMgrImpl.cs

示例7: ImportFlow

        public void ImportFlow(Stream inputStream, CodeMaster.OrderType flowType)
        {
            if (inputStream.Length == 0)
            {
                throw new BusinessException("Import.Stream.Empty");
            }

            HSSFWorkbook workbook = new HSSFWorkbook(inputStream);

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

            ImportHelper.JumpRows(rows, 10);

            #region 列定义
            // FlowMaster
            int colType = 1;//路线类型
            int colCode = 2; // 路线代码
            int colDesc = 3; // 路线描述


            // FlowDet
            int colItem = 4; // 物料
            int colUom = 5; // 单位
            int colUnitCount = 6; // 单包装
            int colUcDesc = 7; // 单包装
            int colMinStock = 8;//
            int colMaxStock = 9;//

            // FlowStrategy
            int colLeadTime = 10; // 提前期
            #endregion

            var errorMessage = new BusinessException();
            int colCount = 10;
            List<List<string>> rowDataList = new List<List<string>>();
            var items = this.genericMgr.FindAll<Item>().ToDictionary(d => d.Code, d => d);
            #region 读取数据
            while (rows.MoveNext())
            {
                HSSFRow row = (HSSFRow)rows.Current;
                if (!ImportHelper.CheckValidDataRow(row, 1, 8))
                {
                    break;//边界
                }
                colCount++;

                var rowData = new List<string>();

                #region FlowMaster
                rowData.Add("0");
                rowData.Add(((int)flowType).ToString());
                rowData.Add(ImportHelper.GetCellStringValue(row.GetCell(colCode)));
                if (string.IsNullOrWhiteSpace(rowData[2]))
                {
                    rowData[0] = "1";
                    errorMessage.AddMessage(new Message(com.Sconit.CodeMaster.MessageType.Error, Resources.EXT.ServiceLan.FlowCodeShouldNotEmpty, colCount.ToString()));
                }
                rowData.Add(ImportHelper.GetCellStringValue(row.GetCell(colDesc)));
                if (string.IsNullOrWhiteSpace(rowData[3]))
                {
                    rowData[0] = "1";
                    errorMessage.AddMessage(new Message(com.Sconit.CodeMaster.MessageType.Error, Resources.EXT.ServiceLan.FlowDescShouldNotEmpty, colCount.ToString()));
                }
                #endregion

                #region FlowDetail
                Item item = null;
                rowData.Add(ImportHelper.GetCellStringValue(row.GetCell(colItem)));
                if (!string.IsNullOrWhiteSpace(rowData[4]))
                {
                    item = items.ValueOrDefault(rowData[4]);
                }
                if (item == null)
                {
                    rowData[0] = "1";
                    errorMessage.AddMessage(new Message(com.Sconit.CodeMaster.MessageType.Error, Resources.EXT.ServiceLan.TheSpecialLineItemNotFound,
                        colCount.ToString(), rowData[4]));
                    continue;
                }

                rowData.Add(ImportHelper.GetCellStringValue(row.GetCell(colUom)));
                if (string.IsNullOrWhiteSpace(rowData[5]))
                {
                    rowData[5] = item.Uom;
                }
                else
                {
                    try
                    {
                        Uom uom = this.genericMgr.FindById<Uom>(rowData[5].ToUpper());
                        rowData[5] = uom.Code;
                    }
                    catch (Exception)
                    {
                        rowData[0] = "1";
                        errorMessage.AddMessage(new Message(com.Sconit.CodeMaster.MessageType.Error, Resources.EXT.ServiceLan.TheSpecialLineUomNotFound,
                            colCount.ToString(), rowData[5]));
                    }
                }
//.........这里部分代码省略.........
开发者ID:zhsh1241,项目名称:Sconit5_Shenya,代码行数:101,代码来源:FlowMgrImpl.cs

示例8: ReadShiftPlanFromXls


//.........这里部分代码省略.........
            var flowCodes = shiftPlanList.Select(s => s.Flow).Distinct();
            #region 读取路线
            var flowDetailList = new List<FlowDetail>();
            foreach (var flowCode in flowCodes)
            {
                var flowDetails = this.flowMgr.GetFlowDetailList(flowCode, false, true);
                if (flowDetails == null || flowDetails.Count() == 0)
                {
                    FlowMaster flowMaster = this.genericMgr.FindById<FlowMaster>(flowCode);
                    if (flowMaster.IsManualCreateDetail)
                    {
                        flowDetails = new List<FlowDetail>();
                        var flowDetail = new FlowDetail();
                        flowDetail.CurrentFlowMaster = flowMaster;
                        flowDetails.Add(flowDetail);
                    }
                }
                flowDetailList.AddRange(flowDetails);
            }
            #endregion

            BusinessException bex = new BusinessException();
            #region 校验数据的有效性
            foreach (var shiftPlan in shiftPlanList)
            {
                var flowDetails = flowDetailList.Where(f => f.CurrentFlowMaster.Code == shiftPlan.Flow);
                if (!flowDetails.First().CurrentFlowMaster.IsManualCreateDetail)
                {
                    if (string.IsNullOrWhiteSpace(shiftPlan.Uom))
                    {
                        flowDetails = flowDetails.Where(f => f.Item == shiftPlan.Item);
                        if (flowDetails == null || flowDetails.Count() == 0)
                        {
                            bex.AddMessage("此物料在路线中不存在");
                        }
                        else
                        {
                            shiftPlan.Uom = flowDetails.First().Uom;
                        }
                    }
                    else
                    {
                        flowDetails = flowDetails.Where(f => f.Item == shiftPlan.Item && f.Uom == shiftPlan.Uom);
                        if (flowDetails == null || flowDetails.Count() == 0)
                        {
                            bex.AddMessage("此物料在路线中不存在");
                        }
                    }
                    //shiftPlan.Machine = flowDetails.First().Machine;
                    //Machine machine = this.genericMgr.FindById<Machine>(shiftPlan.Machine);
                    //shiftPlan.ShiftQuota = machine.ShiftQuota;
                }
                else
                {
                    if (string.IsNullOrWhiteSpace(shiftPlan.Uom))
                    {
                        flowDetails = flowDetails.Where(f => f.Item == shiftPlan.Item);
                    }
                    else
                    {
                        flowDetails = flowDetails.Where(f => f.Item == shiftPlan.Item && f.Uom == shiftPlan.Uom);
                    }
                    if (flowDetails != null && flowDetails.Count() > 0)
                    {
                        //shiftPlan.Machine = flowDetails.First().Machine;
                        //shiftPlan.Uom = flowDetails.First().Uom;
开发者ID:zhsh1241,项目名称:Sconit5_Shenya,代码行数:67,代码来源:PlanMgrImpl.cs

示例9: ReadDailyMrpPlanFromXls

        public void ReadDailyMrpPlanFromXls(Stream inputStream, DateTime? startDate, DateTime? endDate, string flowCode, bool isItemRef)
        {
            #region 判断
            if (startDate.HasValue)
            {
                if (startDate.Value.Date < DateTime.Now.Date)
                {
                    throw new BusinessException("开始日期必须大于当期日期");
                }
            }
            else
            {
                startDate = DateTime.Now.Date;
            }

            if (endDate.HasValue)
            {
                if (endDate.Value.Date <= DateTime.Now.Date)
                {
                    throw new BusinessException("结束日期必须大于当期日期");
                }
            }
            else
            {
                endDate = DateTime.MaxValue.Date;
            }

            if (startDate.Value > endDate.Value)
            {
                throw new BusinessException("开始日期必须小于结束日期");
            }

            if (inputStream.Length == 0)
            {
                throw new BusinessException("Import.Stream.Empty");
            }
            #endregion 判断

            HSSFWorkbook workbook = new HSSFWorkbook(inputStream);
            ISheet sheet = workbook.GetSheetAt(0);
            IEnumerator rows = sheet.GetRowEnumerator();
            IRow dateRow = sheet.GetRow(5);

            ImportHelper.JumpRows(rows, 6);

            #region 列定义
            int colFlow = 0;
            //int colLocation = 0;//库位
            int colItemCode = 1;//物料代码或参考物料号
            //int colItemDescription = 2;//物料描述
            int colUom = 3;//单位
            #endregion

            List<FlowDetail> flowDetailList = new List<FlowDetail>();
            var uomDic = this.genericMgr.FindAll<Uom>().ToDictionary(d => d.Code, d => d);
            if (string.IsNullOrWhiteSpace(flowCode))
            {
                var flowMasters = this.genericMgr.FindAll<FlowMaster>(" from FlowMaster where Type=?",
                    CodeMaster.OrderType.Distribution).ToList();
                foreach (var flowMaster in flowMasters)
                {
                    flowDetailList.AddRange(GetFlowDetails(flowMaster));
                }
            }
            else
            {
                flowDetailList = GetFlowDetails(flowCode).ToList();
            }
            var flowDetailDic = flowDetailList.GroupBy(p => p.Flow, (k, g) => new { k, g }).ToDictionary(d => d.k, d => d.g);

            List<MrpPlanLog> mrpPlanLogList = new List<MrpPlanLog>();
            BusinessException businessException = new BusinessException();
            while (rows.MoveNext())
            {
                Item item = null;
                string uomCode = null;
                string itemReference = null;
                string flow = null;

                HSSFRow row = (HSSFRow)rows.Current;
                if (!ImportHelper.CheckValidDataRow(row, 0, 3))
                {
                    break;//边界
                }
                string rowIndex = (row.RowNum + 1).ToString();

                #region 读取路线
                try
                {
                    string flowCell = ImportHelper.GetCellStringValue(row.GetCell(colFlow));
                    if (flowCell != null && flowDetailDic.ContainsKey(flowCell))
                    {
                        flow = flowCell;
                    }
                    else
                    {
                        businessException.AddMessage(string.Format("读取路线出错,第{0}行.", rowIndex));
                        continue;
                    }
                }
//.........这里部分代码省略.........
开发者ID:zhsh1241,项目名称:Sconit5_Shenya,代码行数:101,代码来源:PlanMgrImpl.cs

示例10: ReadWeeklyMrpPlanFromXls


//.........这里部分代码省略.........
            int colFlow = 0;//
            int colItemCode = 1;//物料代码或参考物料号
            //int colItemDescription = 2;//物料描述
            int colUom = 3;//单位
            #endregion

            BusinessException businessException = new BusinessException();

            while (rows.MoveNext())
            {
                string flow = null;
                Item item = null;
                string uomCode = null;
                string itemReference = null;

                HSSFRow row = (HSSFRow)rows.Current;
                if (!ImportHelper.CheckValidDataRow(row, 0, 3))
                {
                    break;//边界
                }
                string rowIndex = (row.RowNum + 1).ToString();

                #region 读取路线
                try
                {
                    string flowCell = ImportHelper.GetCellStringValue(row.GetCell(colFlow));
                    if (flowCell != null && flowDetailDic.ContainsKey(flowCell))
                    {
                        flow = flowCell;
                    }
                }
                catch (Exception ex)
                {
                    businessException.AddMessage(string.Format("读取库位出错,第{0}行." + ex.Message, rowIndex));
                    continue;
                }
                var flowDetails = flowDetailDic.ValueOrDefault(flow);
                #endregion

                #region 读取物料代码
                try
                {
                    string itemCode = ImportHelper.GetCellStringValue(row.GetCell(colItemCode));
                    if (itemCode == null)
                    {
                        businessException.AddMessage(string.Format("物料号不存在,第{0}行", rowIndex));
                        continue;
                    }
                    if (isItemRef)
                    {
                        item = this.genericMgr.FindAll<Item>("from Item as i where i.ReferenceCode = ? ", new object[] { itemCode }, 0, 1).First();
                        itemReference = itemCode;
                    }
                    else
                    {
                        item = this.genericMgr.FindById<Item>(itemCode);
                        itemReference = item.ReferenceCode;
                    }
                    if (item == null)
                    {
                        businessException.AddMessage(string.Format("物料号{0}不存在,第{1}行", itemCode, rowIndex));
                        continue;
                    }
                }
                catch (Exception ex)
                {
开发者ID:zhsh1241,项目名称:Sconit5_Shenya,代码行数:67,代码来源:PlanMgrImpl.cs

示例11: ReadRccpPlanFromXls

        public void ReadRccpPlanFromXls(Stream inputStream, DateTime startDate, DateTime endDate, bool isItemRef, com.Sconit.CodeMaster.TimeUnit dateType)
        {
            #region  判断

            if (startDate > endDate)
            {
                throw new BusinessException("开始日期必须小于结束日期");
            }
            #endregion 判断

            #region Import
            if (inputStream.Length == 0)
            {
                throw new BusinessException("Import.Stream.Empty");
            }

            HSSFWorkbook workbook = new HSSFWorkbook(inputStream);

            ISheet sheet = workbook.GetSheetAt(0);

            IEnumerator rows = sheet.GetRowEnumerator();

            IRow dateRow = sheet.GetRow(5);

            ImportHelper.JumpRows(rows, 6);

            var rccpPlanLogList = new List<RccpPlanLog>();

            #region 列定义
            int colFlow = 0;//路线
            int colItemCode = 1;//物料代码或参考物料号
            int colUom = 3;//单位
            #endregion
            BusinessException businessException = new BusinessException();

            while (rows.MoveNext())
            {
                Item item = null;
                string uomCode = null;
                string itemReference = null;
                string flowCode = null;

                HSSFRow row = (HSSFRow)rows.Current;
                if (!ImportHelper.CheckValidDataRow(row, 0, 3))
                {
                    break;//边界
                }
                string rowIndex = (row.RowNum + 1).ToString();

                #region 读取路线代码
                flowCode = ImportHelper.GetCellStringValue(row.GetCell(colFlow));
                #endregion

                #region 读取物料代码
                try
                {
                    string itemCode = ImportHelper.GetCellStringValue(row.GetCell(colItemCode));
                    if (itemCode == null)
                    {
                        businessException.AddMessage(string.Format("物料不能为空,第{0}行", rowIndex));
                        continue;
                    }
                    if (isItemRef)
                    {
                        item = this.genericMgr.FindAll<Item>("from Item as i where i.ReferenceCode = ? ", new object[] { itemCode }, 0, 1).First();
                        itemReference = itemCode;
                    }
                    else
                    {
                        item = this.itemMgr.GetCacheItem(itemCode);
                        itemReference = item.ReferenceCode;
                    }
                    if (item == null)
                    {
                        businessException.AddMessage(string.Format("物料号{0}不存在,第{1}行.", itemCode, rowIndex));
                        continue;
                    }
                    if (item.ItemCategory != "MODEL")
                    {
                        businessException.AddMessage(string.Format("物料号{0}不是车型,第{1}行.", itemCode, rowIndex));
                        continue;
                    }
                }
                catch
                {
                    businessException.AddMessage(string.Format("读取物料时出错,第{0}行.", rowIndex));
                    continue;
                }
                #endregion

                #region 读取单位
                try
                {
                    string uomCell = ImportHelper.GetCellStringValue(row.GetCell(colUom));
                    uomCode = this.genericMgr.FindById<Uom>(uomCell).Code;
                }
                catch (Exception ex)
                {
                    businessException.AddMessage(string.Format("读取单位出错,第{0}行." + ex.Message, rowIndex));
                    continue;
//.........这里部分代码省略.........
开发者ID:zhsh1241,项目名称:Sconit5_Shenya,代码行数:101,代码来源:PlanMgrImpl.cs

示例12: ChangePassword

        public ActionResult ChangePassword(ChangePasswordModel model)
        {
            if (ModelState.IsValid)
            {
                Regex r = new Regex("^(?:(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])|(?=.*[A-Z])(?=.*[a-z])(?=.*[^A-Za-z0-9])|(?=.*[A-Z])(?=.*[0-9])(?=.*[^A-Za-z0-9])|(?=.*[a-z])(?=.*[0-9])(?=.*[^A-Za-z0-9])).{6,}|(?:(?=.*[A-Z])(?=.*[a-z])|(?=.*[A-Z])(?=.*[0-9])|(?=.*[A-Z])(?=.*[^A-Za-z0-9])|(?=.*[a-z])(?=.*[0-9])|(?=.*[a-z])(?=.*[^A-Za-z0-9])|(?=.*[0-9])(?=.*[^A-Za-z0-9])|).{8,}");

                if (!r.IsMatch(model.ConfirmPassword))
                {
                    BusinessException ex = new BusinessException();
                    ex.AddMessage(Resources.ACC.User.User_Regex);
                    SaveBusinessExceptionMessage(ex);
                }
                else
                {
                    CurrentUser.Password = FormsAuthentication.HashPasswordForStoringInConfigFile(model.ConfirmPassword, "MD5");
                    this.genericMgr.Update(CurrentUser);
                    SaveSuccessMessage(Resources.ACC.User.User_PasswordChanged);
                }
            }

            return View(model);
        }
开发者ID:druidwang,项目名称:Les_parts,代码行数:22,代码来源:UserFavoriteController.cs

示例13: CancelIp


//.........这里部分代码省略.........
            #endregion

            #region 更新订单明细
            if (ipMaster.OrderType != CodeMaster.OrderType.ScheduleLine)
            {
                #region 非计划协议
                #region 获取订单明细
                string selectOrderDetailDetailStatement = "from OrderDetail where Id in (select OrderDetailId from IpDetail where IpNo = ? and IsClose = ?)";
                IList<OrderDetail> orderDetailList = this.genericMgr.FindAll<OrderDetail>(selectOrderDetailDetailStatement, new object[] { ipMaster.IpNo, false });
                #endregion

                foreach (OrderDetail orderDetail in orderDetailList)
                {
                    #region 更新订单数量
                    orderDetail.ShippedQty -= ipMaster.IpDetails.Where(det => det.OrderDetailId == orderDetail.Id).Sum(det => det.Qty);
                    this.genericMgr.Update(orderDetail);
                    #endregion
                }
                #endregion
            }
            else
            {
                #region 计划协议
                BusinessException businessException = new BusinessException();
                foreach (IpDetail ipDetail in ipMaster.IpDetails)
                {
                    decimal remainQty = ipDetail.Qty;

                    IList<OrderDetail> scheduleOrderDetailList = this.genericMgr.FindEntityWithNativeSql<OrderDetail>("select * from ORD_OrderDet_8 where ExtNo = ? and ExtSeq = ? and ScheduleType = ? and ShipQty > RecQty order by EndDate desc",
                                                new object[] { ipDetail.ExternalOrderNo, ipDetail.ExternalSequence, CodeMaster.ScheduleType.Firm });

                    if (scheduleOrderDetailList != null && scheduleOrderDetailList.Count > 0)
                    {
                        foreach (OrderDetail scheduleOrderDetail in scheduleOrderDetailList)
                        {
                            //更新订单的发货数
                            if (remainQty > (scheduleOrderDetail.ShippedQty - scheduleOrderDetail.ReceivedQty))
                            {
                                remainQty -= (scheduleOrderDetail.ShippedQty - scheduleOrderDetail.ReceivedQty);
                                scheduleOrderDetail.ShippedQty = scheduleOrderDetail.ReceivedQty;
                            }
                            else
                            {
                                scheduleOrderDetail.ShippedQty -= remainQty;
                                remainQty = 0;
                                break;
                            }

                            this.genericMgr.Update(scheduleOrderDetail);
                        }
                    }

                    if (remainQty > 0)
                    {
                        businessException.AddMessage(Resources.ORD.IpMaster.Errors_ReceiveQtyExcceedOrderQty, ipMaster.IpNo, ipDetail.Item);
                    }
                }
                #endregion
            }
            #endregion

            this.genericMgr.FlushSession();

            #region 更新库存
            foreach (IpDetail ipDetail in ipMaster.IpDetails)
            {
                ipDetail.IsVoid = true;
                //???????ipDetail.OrderSubType = com.Sconit.CodeMaster.OrderSubType.Return;
                var targetIpLocationDetail = from locDet in ipLocationDetailList
                                             where locDet.IpDetailId == ipDetail.Id
                                             select locDet;

                ipDetail.CurrentPartyFrom = ipMaster.PartyFrom;  //为了记录库存事务
                ipDetail.CurrentPartyFromName = ipMaster.PartyFromName;  //为了记录库存事务
                ipDetail.CurrentPartyTo = ipMaster.PartyTo;      //为了记录库存事务
                ipDetail.CurrentPartyToName = ipMaster.PartyToName;      //为了记录库存事务

                foreach (IpLocationDetail ipLocationDetail in targetIpLocationDetail)
                {
                    IpDetailInput ipDetailInput = new IpDetailInput();
                    ipDetailInput.HuId = ipLocationDetail.HuId;
                    ipDetailInput.ShipQty = -ipLocationDetail.Qty / ipDetail.UnitQty;  //转为订单单位
                    ipDetailInput.LotNo = ipLocationDetail.LotNo;
                    ipDetailInput.IsCreatePlanBill = ipLocationDetail.IsCreatePlanBill;
                    ipDetailInput.IsConsignment = ipLocationDetail.IsConsignment;
                    ipDetailInput.PlanBill = ipLocationDetail.PlanBill;
                    ipDetailInput.ActingBill = ipLocationDetail.ActingBill;
                    ipDetailInput.IsATP = ipLocationDetail.IsATP;
                    ipDetailInput.IsFreeze = ipLocationDetail.IsFreeze;
                    ipDetailInput.OccupyType = ipLocationDetail.OccupyType;
                    ipDetailInput.OccupyReferenceNo = ipLocationDetail.OccupyReferenceNo;

                    ipDetail.AddIpDetailInput(ipDetailInput);
                }
                #region 更新库存、记库存事务
                this.locationDetailMgr.InventoryOut(ipDetail, effectiveDate);
                #endregion
            }
            #endregion
        }
开发者ID:Novthirteen,项目名称:sih-les,代码行数:101,代码来源:IpMgrImpl.cs

示例14: CreatePickList4Qty

        public string CreatePickList4Qty(string deliveryGroup, string[] orderDetailIdArray, string[] pickQtyArray, DateTime? effectiveDate)
        {
            DataTable dataTable = new DataTable("CreatePickListType");
            dataTable.Columns.Add("OrderDetId", typeof(Int32));
            dataTable.Columns.Add("PickQty", typeof(decimal));
            for (int i = 0; i < orderDetailIdArray.Length; i++)
            {
                dataTable.Rows.Add(int.Parse(orderDetailIdArray[i]), decimal.Parse(pickQtyArray[i]));
            }

            User user = SecurityContextHolder.Get();
            SqlParameter[] parameters = new SqlParameter[6];
            parameters[0] = new SqlParameter("@CreatePickListTable", System.Data.SqlDbType.Structured);
            parameters[0].Value = dataTable;

            parameters[1] = new SqlParameter("@DeliveryGroup", System.Data.SqlDbType.VarChar, 50);
            parameters[1].Value = deliveryGroup;

            parameters[2] = new SqlParameter("@UserId", System.Data.SqlDbType.Int);
            parameters[2].Value = user.Id;

            parameters[3] = new SqlParameter("@UserName", System.Data.SqlDbType.VarChar, 50);
            parameters[3].Value = user.FullName;

            parameters[4] = new SqlParameter("@EffDate", System.Data.SqlDbType.DateTime2, 50);
            parameters[4].Value = effectiveDate;

            parameters[5] = new SqlParameter("@PLNo", System.Data.SqlDbType.VarChar, 50);
            parameters[5].Direction = ParameterDirection.Output;

            try
            {
                DataSet dataSet = sqlDao.GetDatasetByStoredProcedure("USP_PIK_CreatePickList4Qty", parameters, false);

                if (dataSet.Tables[0] != null && dataSet.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow row in dataSet.Tables[0].Rows)
                    {
                        MessageHolder.AddErrorMessage(row.ItemArray[0].ToString());
                    }
                }
                return parameters[5].Value.ToString();
            }
            catch (Exception ex)
            {
                BusinessException businessException = new BusinessException();
                if (ex.InnerException != null)
                {
                    if (ex.InnerException.InnerException != null)
                    {
                        businessException.AddMessage(ex.InnerException.InnerException.Message);
                    }
                    else
                    {
                        businessException.AddMessage(ex.InnerException.Message);
                    }
                }
                else
                {
                    businessException.AddMessage(ex.Message);
                }

                throw businessException;
            }
        }
开发者ID:Novthirteen,项目名称:sih-les,代码行数:65,代码来源:PickListMgrImpl.cs

示例15: CloseMiscOrder

        public void CloseMiscOrder(MiscOrderMaster miscOrderMaster, DateTime effectiveDate)
        {
            #region 检查
            BusinessException businessException = new BusinessException();
            if (miscOrderMaster.Status != CodeMaster.MiscOrderStatus.Create)
            {
                if (miscOrderMaster.Type == CodeMaster.MiscOrderType.GI)
                {
                    businessException.AddMessage("计划外出库单{0}的状态为{1}不能确认。",
                          miscOrderMaster.MiscOrderNo, systemMgr.GetCodeDetailDescription(com.Sconit.CodeMaster.CodeMaster.MiscOrderStatus, ((int)miscOrderMaster.Status).ToString()));
                }
                else
                {
                    businessException.AddMessage("计划外入库单{0}的状态为{1}不能确认。",
                         miscOrderMaster.MiscOrderNo, systemMgr.GetCodeDetailDescription(com.Sconit.CodeMaster.CodeMaster.MiscOrderStatus, ((int)miscOrderMaster.Status).ToString()));
                }
            }

            IList<MiscOrderDetail> miscOrderDetailList = TryLoadMiscOrderDetails(miscOrderMaster);
            if (miscOrderDetailList == null || miscOrderDetailList.Count() == 0)
            {
                if (miscOrderMaster.Type == CodeMaster.MiscOrderType.GI)
                {
                    businessException.AddMessage("计划外出库单{0}明细为空。", miscOrderMaster.MiscOrderNo);
                }
                else
                {
                    businessException.AddMessage("计划外入库单{0}明细为空。", miscOrderMaster.MiscOrderNo);
                }
            }
            else
            {
                foreach (MiscOrderDetail miscOrderDetail in miscOrderDetailList)
                {
                    if (miscOrderDetail.Qty <= 0)
                    {
                        businessException.AddMessage("计划外入库单{0}明细行{1}的数量不能小于0。", miscOrderMaster.MiscOrderNo, miscOrderDetail.Sequence.ToString());
                    }
                }
            }

            if (businessException.HasMessage)
            {
                throw businessException;
            }
            #endregion

            User user = SecurityContextHolder.Get();
            miscOrderMaster.CloseDate = DateTime.Now;
            miscOrderMaster.CloseUserId = user.Id;
            miscOrderMaster.CloseUserName = user.FullName;
            miscOrderMaster.Status = com.Sconit.CodeMaster.MiscOrderStatus.Close;
            this.genericMgr.Update(miscOrderMaster);
            //后加工废品报工不影响库存
            if (miscOrderMaster.SubType == CodeMaster.MiscOrderSubType.MES27)
            {
                return;
            }
            //
            IList<MiscOrderLocationDetail> miscOrderLocationDetailList = TryLoadMiscOrderLocationDetails(miscOrderMaster);

            foreach (MiscOrderDetail miscOrderDetail in miscOrderDetailList.OrderByDescending(det => det.ManufactureParty))
            {
                miscOrderDetail.ManufactureParty = miscOrderMaster.IsCs ? miscOrderDetail.ManufactureParty : null;
                IList<InventoryTransaction> inventoryTransactionList = this.locationDetailMgr.InventoryOtherInOut(miscOrderMaster, miscOrderDetail, effectiveDate);

                #region 新增、更新订单库存明细
                foreach (InventoryTransaction inventoryTransaction in inventoryTransactionList)
                {
                    if (miscOrderMaster.IsScanHu)
                    {
                        #region 条码
                        MiscOrderLocationDetail miscOrderLocationDetail = miscOrderLocationDetailList.Where(m => m.HuId == inventoryTransaction.HuId).Single();
                        if (inventoryTransaction.ActingBill.HasValue)
                        {
                            miscOrderLocationDetail.IsConsignment = false;
                            miscOrderLocationDetail.PlanBill = null;
                            miscOrderLocationDetail.ActingBill = inventoryTransaction.ActingBill;
                        }

                        this.genericMgr.Update(miscOrderLocationDetail);
                        #endregion
                    }
                    else
                    {
                        #region 数量
                        MiscOrderLocationDetail miscOrderLocationDetail = new MiscOrderLocationDetail();

                        miscOrderLocationDetail.MiscOrderNo = miscOrderMaster.MiscOrderNo;
                        miscOrderLocationDetail.MiscOrderDetailId = miscOrderDetail.Id;
                        miscOrderLocationDetail.MiscOrderDetailSequence = miscOrderDetail.Sequence;
                        miscOrderLocationDetail.Item = inventoryTransaction.Item;
                        miscOrderLocationDetail.Uom = miscOrderDetail.Uom;
                        //miscOrderLocationDetail.HuId = locationLotDetail.HuId;
                        //miscOrderLocationDetail.LotNo = locationLotDetail.LotNo;
                        miscOrderLocationDetail.IsCreatePlanBill = inventoryTransaction.IsCreatePlanBill;
                        miscOrderLocationDetail.IsConsignment = inventoryTransaction.IsConsignment;
                        miscOrderLocationDetail.PlanBill = inventoryTransaction.PlanBill;
                        #region 查找寄售供应商
                        if (inventoryTransaction.IsConsignment && inventoryTransaction.PlanBill.HasValue)
//.........这里部分代码省略.........
开发者ID:zhsh1241,项目名称:Sconit5_Shenya,代码行数:101,代码来源:MiscOrderMgrImpl.cs


注:本文中的com.Sconit.Entity.Exception.BusinessException.AddMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。