コード例 #1
0
ファイル: OrderMgrImpl.cs プロジェクト: druidwang/Les_parts
        private IList<OrderMaster> TryLoadOrderMasters(SequenceMaster sequenceMaster)
        {
            if (sequenceMaster.OrderDetails == null)
            {
                TryLoadSequenceDetails(sequenceMaster);
            }

            string hql = string.Empty;
            IList<object> para = new List<object>();
            foreach (string orderNo in sequenceMaster.SequenceDetails.Select(p => p.OrderNo).Distinct())
            {
                if (hql == string.Empty)
                {
                    hql = "from OrderMaster where OrderNo in (?";
                }
                else
                {
                    hql += ",?";
                }

                para.Add(orderNo);
            }
            hql += ")";

            return this.genericMgr.FindAll<OrderMaster>(hql, para.ToArray());
        }
コード例 #2
0
ファイル: OrderMgrImpl.cs プロジェクト: druidwang/Les_parts
        private IList<SequenceDetail> TryLoadSequenceDetails(SequenceMaster sequenceMaster)
        {
            if (sequenceMaster.SequenceDetails == null)
            {
                #region 获取排序单明细
                sequenceMaster.SequenceDetails = this.genericMgr.FindAll<SequenceDetail>("from SequenceDetail where SequenceNo = ? and IsClose = ? order by Sequence", new object[] { sequenceMaster.SequenceNo, false });
                #endregion
            }

            return sequenceMaster.SequenceDetails;
        }
コード例 #3
0
ファイル: OrderMgrImpl.cs プロジェクト: druidwang/Les_parts
        private IList<OrderDetail> TryLoadOrderDetails(SequenceMaster sequenceMaster)
        {
            if (sequenceMaster.OrderDetails == null)
            {
                TryLoadSequenceDetails(sequenceMaster);

                #region 获取订单明细
                string hql = string.Empty;
                IList<object> para = new List<object>();
                foreach (int orderDetailId in sequenceMaster.SequenceDetails.Select(p => p.OrderDetailId).Distinct())
                {
                    if (hql == string.Empty)
                    {
                        hql = "from OrderDetail where Id in (?";
                    }
                    else
                    {
                        hql += ",?";
                    }

                    para.Add(orderDetailId);
                }
                hql += ")";

                sequenceMaster.OrderDetails = this.genericMgr.FindAll<OrderDetail>(hql, para.ToArray());
                #endregion
            }

            return sequenceMaster.OrderDetails;
        }
コード例 #4
0
ファイル: OrderMgrImpl.cs プロジェクト: druidwang/Les_parts
 public IpMaster ShipSequenceOrder(SequenceMaster sequenceMaster)
 {
     return ShipSequenceOrder(sequenceMaster, DateTime.Now);
 }
コード例 #5
0
ファイル: OrderMgrImpl.cs プロジェクト: druidwang/Les_parts
        public IpMaster ShipSequenceOrder(SequenceMaster sequenceMaster, DateTime effectiveDate)
        {
            if (sequenceMaster.Status != CodeMaster.SequenceStatus.Pack)
            {
                throw new BusinessException("状态为{1}的排序装箱单{0}不能发货", sequenceMaster.SequenceNo,
                    systemMgr.GetCodeDetailDescription(com.Sconit.CodeMaster.CodeMaster.SequenceStatus, ((int)sequenceMaster.Status).ToString()));
            }

            #region 获取排序单明细
            TryLoadSequenceDetails(sequenceMaster);
            #endregion

            #region 获取订单头
            IList<OrderMaster> orderMasterList = TryLoadOrderMasters(sequenceMaster);
            #endregion

            #region 获取订单明细
            IList<OrderDetail> orderDetailList = TryLoadOrderDetails(sequenceMaster);
            #endregion

            #region 更新订单头状态
            foreach (OrderMaster orderMaster in orderMasterList)
            {
                if (orderMaster.Status == CodeMaster.OrderStatus.Submit)
                {
                    this.UpdateOrderMasterStatus2InProcess(orderMaster);
                }
            }
            #endregion

            #region 更新订单明细的发货数
            foreach (OrderDetail orderDetail in orderDetailList)
            {
                orderDetail.ShippedQty += sequenceMaster.SequenceDetails.Where(p => p.OrderDetailId == orderDetail.Id).Sum(p => p.Qty);
                this.genericMgr.Update(orderDetail);
            }
            #endregion

            #region 更新排序单头
            sequenceMaster.Status = CodeMaster.SequenceStatus.Ship;
            sequenceMaster.ShipDate = DateTime.Now;
            sequenceMaster.ShipUserId = SecurityContextHolder.Get().Id;
            sequenceMaster.ShipUserName = SecurityContextHolder.Get().FullName;

            this.genericMgr.Update(sequenceMaster);
            #endregion

            #region 发货
            IpMaster ipMaster = ipMgr.TransferSequenceMaster2Ip(sequenceMaster);
            ipMgr.CreateIp(ipMaster, effectiveDate);
            #endregion

            #region 自动收货
            AutoReceiveIp(ipMaster, effectiveDate);
            #endregion

            return ipMaster;
        }
コード例 #6
0
ファイル: OrderMgrImpl.cs プロジェクト: druidwang/Les_parts
        public void UnPackSequenceOrder(SequenceMaster sequenceMaster)
        {
            #region 检查
            if (sequenceMaster.Status != CodeMaster.SequenceStatus.Pack)
            {
                throw new BusinessException("状态为{1}的排序装箱单{0}不能取消装箱", sequenceMaster.SequenceNo,
                    systemMgr.GetCodeDetailDescription(com.Sconit.CodeMaster.CodeMaster.SequenceStatus, ((int)sequenceMaster.Status).ToString()));
            }
            #endregion

            #region 更新排序装箱单头
            sequenceMaster.Status = CodeMaster.SequenceStatus.Submit;
            this.genericMgr.Update(sequenceMaster);
            #endregion

            #region 更新排序装箱单明细
            TryLoadSequenceDetails(sequenceMaster);
            foreach (SequenceDetail sequenceDetail in sequenceMaster.SequenceDetails)
            {
                sequenceDetail.HuId = null;
                sequenceDetail.LotNo = null;

                this.genericMgr.Update(sequenceDetail);
            }
            #endregion

            #region 更新排序单
            string hql = string.Empty;
            IList<object> paras = new List<object>();
            foreach (SequenceDetail sequenceDetail in sequenceMaster.SequenceDetails)
            {
                if (hql == string.Empty)
                {
                    hql = "from OrderMaster where OrderNo in (?";
                }
                else
                {
                    hql += ", ?";
                }
                paras.Add(sequenceDetail.OrderNo);
            }
            hql += ")";

            foreach (OrderMaster orderMaster in this.genericMgr.FindAll<OrderMaster>(hql, paras.ToArray()))
            {
                orderMaster.Status = CodeMaster.OrderStatus.Submit;
                this.genericMgr.Update(orderMaster);
            }
            #endregion

            //释放库存暂用
            this.locationDetailMgr.CancelInventoryOccupy(CodeMaster.OccupyType.Sequence, sequenceMaster.SequenceNo);
        }
コード例 #7
0
ファイル: OrderMgrImpl.cs プロジェクト: druidwang/Les_parts
        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
        }
コード例 #8
0
ファイル: OrderMgrImpl.cs プロジェクト: druidwang/Les_parts
        private SequenceMaster CreateSequenceOrder(IList<object[]> orderDetailAryList)
        {
            if (orderDetailAryList == null || orderDetailAryList.Count() == 0)
            {
                return null;
            }

            string orderNos = string.Empty;
            foreach (string orderNo in orderDetailAryList.Select(o => (string)o[0]))
            {
                if (orderNos == string.Empty)
                {
                    orderNos = orderNo;
                }
                else
                {
                    orderNos += "," + orderNo;
                }
            }

            try
            {
                log.Debug("Start create sequence order, flow[" + orderDetailAryList[0][1] + "], orderNo in [" + orderNos + "].");

                SequenceMaster sequenceMaster = new SequenceMaster();

                sequenceMaster.SequenceNo = this.numberControlMgr.GetSequenceNo(sequenceMaster);
                sequenceMaster.Status = CodeMaster.SequenceStatus.Submit;
                sequenceMaster.Flow = (string)orderDetailAryList[0][1];
                sequenceMaster.OrderType = (CodeMaster.OrderType)((byte)orderDetailAryList[0][2]);
                sequenceMaster.QualityType = (CodeMaster.QualityType)((byte)orderDetailAryList[0][3]);
                sequenceMaster.StartTime = (DateTime)orderDetailAryList[0][4];
                sequenceMaster.WindowTime = (DateTime)orderDetailAryList[0][5];
                sequenceMaster.PartyFrom = (string)orderDetailAryList[0][6];
                sequenceMaster.PartyFromName = (string)orderDetailAryList[0][7];
                sequenceMaster.PartyTo = (string)orderDetailAryList[0][8];
                sequenceMaster.PartyToName = (string)orderDetailAryList[0][9];
                sequenceMaster.ShipFrom = (string)orderDetailAryList[0][10];
                sequenceMaster.ShipFromAddress = (string)orderDetailAryList[0][11];
                sequenceMaster.ShipFromTel = (string)orderDetailAryList[0][12];
                sequenceMaster.ShipFromCell = (string)orderDetailAryList[0][13];
                sequenceMaster.ShipFromFax = (string)orderDetailAryList[0][14];
                sequenceMaster.ShipFromContact = (string)orderDetailAryList[0][15];
                sequenceMaster.ShipTo = (string)orderDetailAryList[0][16];
                sequenceMaster.ShipToAddress = (string)orderDetailAryList[0][17];
                sequenceMaster.ShipToTel = (string)orderDetailAryList[0][18];
                sequenceMaster.ShipToCell = (string)orderDetailAryList[0][19];
                sequenceMaster.ShipToFax = (string)orderDetailAryList[0][20];
                sequenceMaster.ShipToContact = (string)orderDetailAryList[0][21];
                sequenceMaster.LocationFrom = (string)orderDetailAryList[0][22];
                sequenceMaster.LocationFromName = (string)orderDetailAryList[0][23];
                sequenceMaster.LocationTo = (string)orderDetailAryList[0][24];
                sequenceMaster.LocationToName = (string)orderDetailAryList[0][25];
                sequenceMaster.Dock = (string)orderDetailAryList[0][26];
                sequenceMaster.IsAutoReceive = (bool)orderDetailAryList[0][27];
                sequenceMaster.IsPrintAsn = (bool)orderDetailAryList[0][28];
                sequenceMaster.IsPrintReceipt = (bool)orderDetailAryList[0][29];
                sequenceMaster.IsCheckPartyFromAuthority = (bool)orderDetailAryList[0][30];
                sequenceMaster.IsCheckPartyToAuthority = (bool)orderDetailAryList[0][31];
                sequenceMaster.AsnTemplate = (string)orderDetailAryList[0][32];
                sequenceMaster.ReceiptTemplate = (string)orderDetailAryList[0][33];
                sequenceMaster.Container = (string)orderDetailAryList[0][46];
                sequenceMaster.ContainerDescription = (string)orderDetailAryList[0][47];

                this.genericMgr.Create(sequenceMaster);

                foreach (object[] orderDetailAry in orderDetailAryList)
                {
                    SequenceDetail sequenceDetail = new SequenceDetail();

                    sequenceDetail.SequenceNo = sequenceMaster.SequenceNo;
                    sequenceDetail.Sequence = (long)orderDetailAry[34];
                    sequenceDetail.OrderNo = (string)orderDetailAry[0];
                    sequenceDetail.TraceCode = (string)orderDetailAry[35];
                    sequenceDetail.OrderDetailId = (int)orderDetailAry[36];
                    sequenceDetail.OrderDetailSequence = (int)orderDetailAry[37];
                    sequenceDetail.StartTime = (DateTime)orderDetailAry[4];
                    sequenceDetail.WindowTime = (DateTime)orderDetailAry[5];
                    sequenceDetail.Item = (string)orderDetailAry[38];
                    sequenceDetail.ItemDescription = (string)orderDetailAry[39];
                    sequenceDetail.ReferenceItemCode = (string)orderDetailAry[40];
                    sequenceDetail.Uom = (string)orderDetailAry[41];
                    sequenceDetail.UnitQty = (decimal)orderDetailAry[42];
                    sequenceDetail.BaseUom = (string)orderDetailAry[43];
                    sequenceDetail.UnitCount = (decimal)orderDetailAry[44];
                    sequenceDetail.QualityType = (CodeMaster.QualityType)((byte)orderDetailAry[3]);
                    sequenceDetail.ManufactureParty = (string)orderDetailAry[45];
                    sequenceDetail.Qty = (decimal)orderDetailAry[48];
                    sequenceDetail.IsClose = (decimal)orderDetailAry[49] > 0 || (decimal)orderDetailAry[50] > 0; //已排序数量大于0或者收货数大于0,代表已经送过,要把位置空着

                    this.genericMgr.Create(sequenceDetail);
                    sequenceMaster.AddSequenceDetail(sequenceDetail);
                }

                //#region 发送WMS
                //string loc = systemMgr.GetEntityPreferenceValue(Entity.SYS.EntityPreference.CodeEnum.WMSAnjiRegion);
                //if (sequenceMaster.PartyFrom.Equals(loc, StringComparison.OrdinalIgnoreCase))
                //{
                //    //this.genericMgr.FlushSession();
                //    //this.AsyncRecourdMessageQueue(MethodNameType.CreateSeqOrder, sequenceMaster.SequenceNo);
                //    this.CreateMessageQueue("CreateSeqOrder", sequenceMaster.SequenceNo);
                //}
                //#endregion

                #region 发送打印
                this.AsyncSendPrintData(sequenceMaster, false);
                #endregion

                log.Debug("Success create sequence order, flow[" + orderDetailAryList[0][1] + "], orderNo in [" + orderNos + "]");

                return sequenceMaster;
            }
            catch (Exception ex)
            {
                log.Error("Fail create sequence order, flow[" + orderDetailAryList[0][1] + "], orderNo in [" + orderNos + "]", ex);

                //清空Session
                this.genericMgr.CleanSession();
            }

            return null;
        }
コード例 #9
0
        public string GetSequenceNo(SequenceMaster sequenceMaster)
        {
            SqlParameter[] parm = new SqlParameter[9];

            parm[0] = new SqlParameter("@Flow", SqlDbType.VarChar, 50);
            parm[0].Value = sequenceMaster.Flow;

            parm[1] = new SqlParameter("@OrderType", SqlDbType.TinyInt);
            parm[1].Value = sequenceMaster.OrderType;

            parm[2] = new SqlParameter("@QualityType", SqlDbType.TinyInt);
            parm[2].Value = sequenceMaster.QualityType;

            parm[3] = new SqlParameter("@PartyFrom", SqlDbType.VarChar, 50);
            parm[3].Value = sequenceMaster.PartyFrom;

            parm[4] = new SqlParameter("@PartyTo", SqlDbType.VarChar, 50);
            parm[4].Value = sequenceMaster.PartyTo;

            parm[5] = new SqlParameter("@LocTo", SqlDbType.VarChar, 50);
            parm[5].Value = sequenceMaster.LocationTo;

            parm[6] = new SqlParameter("@LocFrom", SqlDbType.VarChar, 50);
            parm[6].Value = sequenceMaster.LocationFrom;

            parm[7] = new SqlParameter("@Dock", SqlDbType.VarChar, 50);
            parm[7].Value = sequenceMaster.Dock;

            parm[8] = new SqlParameter("@SeqNo", SqlDbType.VarChar, 100);
            parm[8].Direction = ParameterDirection.InputOutput;

            sqlDao.ExecuteStoredProcedure("USP_GetDocNo_SEQ", parm);

            return parm[8].Value.ToString();

        }
コード例 #10
0
ファイル: IpMgrImpl.cs プロジェクト: zhsh1241/Sconit5_Shenya
        public IpMaster TransferSequenceMaster2Ip(SequenceMaster sequenceMaster)
        {
            #region 发货单头
            IpMaster ipMaster = Mapper.Map<SequenceMaster, IpMaster>(sequenceMaster);
            ipMaster.IsShipScanHu = true;
            ipMaster.IsReceiveScanHu = true;
            ipMaster.IsReceiveExceed = false;
            ipMaster.IsReceiveFulfillUC = true;
            ipMaster.IsReceiveFifo = false;
            ipMaster.IsAsnUniqueReceive = true;
            ipMaster.CreateHuOption = CodeMaster.CreateHuOption.None;
            ipMaster.ReceiveGapTo = CodeMaster.ReceiveGapTo.RecordIpGap;
            ipMaster.Status = CodeMaster.IpStatus.Submit;
            ipMaster.WMSNo = sequenceMaster.WMSIpNo;
            #endregion

            #region 发货单明细
            foreach (SequenceDetail sequenceDetail in sequenceMaster.SequenceDetails.OrderBy(s => s.Sequence))
            {
                OrderDetail orderDetail = sequenceMaster.OrderDetails.Where(o => o.Id == sequenceDetail.OrderDetailId).Single();
                IpDetail ipDetail = Mapper.Map<OrderDetail, IpDetail>(orderDetail);
                ipDetail.Flow = sequenceMaster.Flow;
                ipDetail.IsInspect = false;
                ipDetail.StartTime = sequenceDetail.StartTime;
                ipDetail.WindowTime = sequenceDetail.WindowTime;

                IpDetailInput ipDetailInput = new IpDetailInput();
                ipDetailInput.ShipQty = sequenceDetail.Qty / sequenceDetail.UnitQty;
                ipDetailInput.HuId = sequenceDetail.HuId;
                ipDetailInput.LotNo = sequenceDetail.LotNo;
                if (!string.IsNullOrWhiteSpace(ipDetailInput.HuId))
                {
                    ipDetailInput.OccupyType = CodeMaster.OccupyType.Sequence;
                    ipDetailInput.OccupyReferenceNo = sequenceMaster.SequenceNo;
                }
                ipDetailInput.SequenceNo = sequenceDetail.SequenceNo;
                ipDetailInput.WMSIpSeq = sequenceDetail.WMSIpSeq;

                ipDetail.AddIpDetailInput(ipDetailInput);
                ipMaster.AddIpDetail(ipDetail);
            }
            #endregion

            return ipMaster;
        }