예제 #1
0
        protected virtual void ObjectMapping(DssExportHistory dssExportHistory)
        {
            string entityParty    = BusinessConstants.DSS_ENTITY_PARTY;
            string entityLocation = BusinessConstants.DSS_ENTITY_LOCATION;
            string entitySite     = BusinessConstants.DSS_ENTITY_SITE;
            string defaultSite    = dssExportHistory.DssOutboundControl.ExternalSystem.UndefinedString1;
            string extSysCode     = dssExportHistory.DssOutboundControl.ExternalSystem.Code;
            string location       = dssExportHistory.Location;
            string refLocation    = dssExportHistory.ReferenceLocation;
            string partyFrom      = dssExportHistory.PartyFrom;
            string partyTo        = dssExportHistory.PartyTo;

            if (partyFrom == BusinessConstants.SYSTEM_REGION)
            {
                if (refLocation != null && refLocation != BusinessConstants.SYSTEM_LOCATION_INSPECT && refLocation != BusinessConstants.SYSTEM_LOCATION_REJECT)
                {
                    partyFrom = locationMgr.LoadLocation(refLocation).Region.Code;
                }
                else if (location != BusinessConstants.SYSTEM_LOCATION_INSPECT && location != BusinessConstants.SYSTEM_LOCATION_REJECT)
                {
                    partyFrom = locationMgr.LoadLocation(location).Region.Code;
                }
            }
            if (partyTo == BusinessConstants.SYSTEM_REGION)
            {
                if (location != BusinessConstants.SYSTEM_LOCATION_INSPECT && location != BusinessConstants.SYSTEM_LOCATION_REJECT)
                {
                    partyTo = locationMgr.LoadLocation(location).Region.Code;
                }
                else if (refLocation != null && refLocation != BusinessConstants.SYSTEM_LOCATION_INSPECT && refLocation != BusinessConstants.SYSTEM_LOCATION_REJECT)
                {
                    partyTo = locationMgr.LoadLocation(refLocation).Region.Code;
                }
            }

            //供应商,来源区域 => Site
            dssExportHistory.PartyFrom = this.GetMappingExternalCode(entityParty, extSysCode, partyFrom, entitySite, partyFrom);
            //客户,目的区域 => Site
            dssExportHistory.PartyTo = this.GetMappingExternalCode(entityParty, extSysCode, partyTo, entitySite, partyTo);
            //库位
            dssExportHistory.Location = this.GetMappingExternalCode(entityLocation, extSysCode, location, location);

            //移库来源库位
            if (dssExportHistory.ReferenceLocation != null && dssExportHistory.ReferenceLocation.Trim() != string.Empty)
            {
                dssExportHistory.ReferenceLocation = this.GetMappingExternalCode(entityLocation, extSysCode, refLocation, refLocation);
            }
        }
예제 #2
0
        /// <summary>
        /// ISS-UNP 计划外出库
        /// </summary>
        /// <param name="list"></param>
        /// <param name="dssOutboundControl"></param>
        /// <param name="isFLag">是</param>
        /// <returns></returns>
        protected IList <DssExportHistory> ConvertList(IList list, DssOutboundControl dssOutboundControl, bool isFLag)
        {
            IList <DssExportHistory> result = new List <DssExportHistory>();

            if (list != null && list.Count > 0)
            {
                foreach (object obj in list)
                {
                    DssExportHistory dssExportHistory = commonOutboundMgr.ConvertLocationTransactionToDssExportHistory(obj, dssOutboundControl);
                    //add djin 20120910
                    if ((string)((object[])obj)[4] == "Reject" && ((object[])obj).Length > 9)
                    {
                        dssExportHistory.PartyTo = locMgr.LoadLocation((string)((object[])obj)[9]).Region.Code;
                    }

                    dssExportHistory.KeyCode = dssExportHistory.OrderNo;//订单号

                    #region 账户、分账户、成本中心、项目
                    dssExportHistory.DefinedString1 = null; //账户
                    dssExportHistory.DefinedString2 = null; //分账户
                    dssExportHistory.DefinedString3 = null; //成本中心
                    dssExportHistory.DefinedString4 = null; //项目
                    this.GetAccount(dssExportHistory);
                    #endregion

                    result.Add(dssExportHistory);
                }
            }

            return(result);
        }
예제 #3
0
        public LocationDetail FindLocationDetail(string loc, string itemCode, DateTime?effectiveDate, bool includeActiveOrder)
        {
            Item     item     = ItemMgr.LoadItem(itemCode);
            Location location = LocationMgr.LoadLocation(loc);

            if (location == null)
            {
                return(null);
            }
            else
            {
                return(this.FindLocationDetail(location, item, effectiveDate));
            }
        }
예제 #4
0
        private IList <DssExportHistory> GroupSingleDssExportHistory(IList <LocationTransaction> fgLocTrans, IList <LocationTransaction> rmLocTrans, DssOutboundControl dssOutboundControl, DateTime effectiveDate)
        {
            var refLoc = (from l in fgLocTrans where l.Location == "Reject" select l.RefLocation).Distinct().ToList();
            Dictionary <string, string> refDic = new Dictionary <string, string>();

            foreach (var i in refLoc)
            {
                if (i == null)
                {
                    continue;
                }
                Location loc = locMgr.LoadLocation(i);
                if (loc != null && !refDic.ContainsKey(i))
                {
                    refDic.Add(i, loc.Region.Code);
                }
            }
            Dictionary <string, IList <int> > orderdet = new Dictionary <string, IList <int> >();

            var x = (from xxxx in fgLocTrans where xxxx.Item == "" select xxxx).ToList();

            var query = from l in fgLocTrans
                        group l by new { l.PartyFrom, l.PartyTo, l.Location, l.Item, l.RefLocation } into g
                select new DssExportHistory
            {
                PartyFrom = g.Key.PartyFrom,
                PartyTo   = getPartTo(g.Key.Location, g.Key.PartyTo, g.Key.RefLocation, refDic),          //10-15
                Location  = g.Key.Location,
                Item      = g.Key.Item,
                // ReferenceLocation=g.Key.RefLocation,
                Qty                     = g.Sum(d => d.Qty),
                EffectiveDate           = effectiveDate,
                OriginalId              = g.Max(d => d.Id),
                DssOutboundControl      = dssOutboundControl,
                EventCode               = BusinessConstants.DSS_EVENT_CODE_CREATE,
                IsActive                = true,
                CreateDate              = DateTime.Now,
                DssExportHistoryDetails = this.GroupSingleDssExportHistoryDetail(g.Select(d => d.OrderDetailId).Distinct().ToList(), rmLocTrans, dssOutboundControl, effectiveDate, orderdet,
                                                                                 g.Key.PartyFrom + g.Key.PartyTo + g.Key.Location + g.Key.Item
                                                                                 ),
                UndefinedString1 = dssOutboundControl.ExternalSystem.UndefinedString1, //Site,备用
                UndefinedString2 = dssOutboundControl.UndefinedString1,                //雇员
                UndefinedString3 = dssOutboundControl.UndefinedString2,                //工序
                KeyCode          = g.Max(d => d.Id).ToString()                         //Max LocTransId
                ,
                Comments = g.Key.PartyFrom + g.Key.PartyTo + g.Key.Location + g.Key.Item
            };

            var list = query.ToList();

            //djin ISS-wo重复删除
            //var comments = (from i in list select i.Comments).Distinct().ToList();
            //foreach (var com in comments)
            //{
            //    var dsss = (from dss in list where dss.Comments == com select dss).ToList();

            //    bool flag = true;
            //    foreach (DssExportHistory dss in dsss)
            //    {
            //        if (!flag)
            //        {

            //            dss.DssExportHistoryDetails = null;
            //        }
            //        else
            //        {
            //            flag = false;

            //        }

            //    }
            //}

            return(list);
        }
예제 #5
0
        private IList <DssExportHistory> ProcessRctInp(IList <LocationTransaction> inpTr)
        {
            IList <DssExportHistory> dssExportHistoryList = new List <DssExportHistory>();

            if (inpTr != null && inpTr.Count > 0)
            {
                //var issList = inpTr
                //    .Where(i => StringHelper.Eq(i.TransactionType, BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_INP))
                //    .ToList();
                var rctList = inpTr
                              .Where(i => StringHelper.Eq(i.TransactionType, BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_RCT_INP))
                              .ToList();

                foreach (var rctinp in rctList)
                {
                    DssExportHistory dssExportHistory = new DssExportHistory();
                    dssExportHistory.OriginalId = rctinp.Id;
                    dssExportHistory.OrderNo    = rctinp.OrderNo;
                    dssExportHistory.PartyFrom  = rctinp.PartyFrom;
                    dssExportHistory.PartyTo    = rctinp.PartyTo;
                    //if(rctinp.TransactionType=="RCT-INP")
                    //dssExportHistory.PartyTo = rctinp.RefLocation!=string.Empty?
                    //    locationMgr.LoadLocation(rctinp.RefLocation).Region.Code:rctinp.PartyTo;//20120829 djin
                    //else
                    //    dssExportHistory.PartyTo = rctinp.PartyTo;
                    dssExportHistory.Location          = rctinp.Location;
                    dssExportHistory.ReferenceLocation = rctinp.RefLocation;
                    dssExportHistory.EffectiveDate     = rctinp.EffectiveDate;
                    dssExportHistory.Item = rctinp.Item;
                    dssExportHistory.Qty  = rctinp.Qty;

                    //#region 获取来源库位


                    //#region 报验
                    //if (rctinp.Location == BusinessConstants.SYSTEM_LOCATION_INSPECT)
                    //{
                    //    dssExportHistory.PartyFrom = locationMgr.LoadLocation(rctinp.RefLocation).Region.Code;
                    //    dssExportHistory.PartyTo = dssExportHistory.PartyFrom;
                    //}
                    //#endregion

                    //#region 判定
                    //else if (rctinp.RefLocation == BusinessConstants.SYSTEM_LOCATION_INSPECT)
                    //{
                    //    dssExportHistory.PartyTo = locationMgr.LoadLocation(rctinp.Location).Region.Code;
                    //    dssExportHistory.PartyFrom = dssExportHistory.PartyTo;
                    //}
                    //#endregion
                    //#endregion

                    dssExportHistoryList.Add(dssExportHistory);
                }
            }

            #region  射
            //先得出refloc的值,在遍历mapping
            var refLocation = (from a in dssExportHistoryList select a.ReferenceLocation).Distinct().ToList();
            foreach (var rf in refLocation)
            {
                string   regionCode = string.Empty;
                Location loc        = locationMgr.LoadLocation(rf);
                if (loc != null)
                {
                    regionCode = loc.Region.Code;
                    foreach (DssExportHistory dss in dssExportHistoryList)
                    {
                        if (dss.ReferenceLocation == rf)
                        {
                            dss.PartyTo = regionCode;
                        }
                    }
                }
                else//refLoc没有region的不转换
                {
                    ArrayList delList = new ArrayList();
                    for (int i = 0; i < dssExportHistoryList.Count; i++)
                    {
                        if (dssExportHistoryList[i].ReferenceLocation == rf)
                        {
                            delList.Add(dssExportHistoryList[i]);
                        }
                    }
                    foreach (DssExportHistory item in delList)
                    {
                        log.Error("没有找到" + item.ReferenceLocation + "的Region;ID:" + item.Id);
                        dssExportHistoryList.Remove(item);
                    }
                }
            }
            #endregion

            return(dssExportHistoryList);
        }
예제 #6
0
        public IList <OrderDetail> ConvertResolverToOrderDetails(Resolver resolver, Flow flow)
        {
            OrderHead           orderHead    = orderMgr.TransferFlow2Order(flow);
            IList <OrderDetail> orderDetails = new List <OrderDetail>();

            if (resolver.Transformers == null)
            {
                throw new BusinessErrorException("OrderDetail.Error.OrderDetailEmpty");
            }
            foreach (Transformer transformer in resolver.Transformers)
            {
                if (transformer.TransformerDetails != null)
                {
                    foreach (TransformerDetail transformerDetail in transformer.TransformerDetails)
                    {
                        if (transformerDetail.CurrentQty == 0) //数量为零的过滤掉
                        {
                            continue;
                        }

                        OrderDetail newOrderDetail = new OrderDetail();
                        //newOrderDetail.IsScanHu = true;
                        int seqInterval = int.Parse(entityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_SEQ_INTERVAL).Value);
                        if (orderDetails == null || orderDetails.Count == 0)
                        {
                            newOrderDetail.Sequence = seqInterval;
                        }
                        else
                        {
                            newOrderDetail.Sequence = orderDetails.Last <OrderDetail>().Sequence + seqInterval;
                        }
                        newOrderDetail.Item = itemMgr.LoadItem(transformerDetail.ItemCode);
                        newOrderDetail.Uom  = uomMgr.LoadUom(transformerDetail.UomCode);
                        newOrderDetail.HuId = transformerDetail.HuId;
                        if ((resolver.ModuleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_SHIPRETURN) ||
                            resolver.ModuleType == BusinessConstants.TRANSFORMER_MODULE_TYPE_RECEIVERETURN)
                        {
                            newOrderDetail.OrderedQty = -transformerDetail.CurrentQty;
                            newOrderDetail.HuQty      = -transformerDetail.Qty;
                        }
                        else
                        {
                            newOrderDetail.OrderedQty = transformerDetail.CurrentQty;
                            newOrderDetail.HuQty      = transformerDetail.Qty;
                        }
                        if (!(resolver.OrderType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PROCUREMENT ||
                              resolver.OrderType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_CUSTOMERGOODS))
                        {
                            newOrderDetail.LocationFrom = locationMgr.LoadLocation(transformer.LocationFromCode);
                        }
                        if (!(resolver.OrderType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_DISTRIBUTION))
                        {
                            newOrderDetail.LocationTo = locationMgr.LoadLocation(transformer.LocationToCode);
                        }
                        newOrderDetail.ReferenceItemCode = transformer.ReferenceItemCode;
                        newOrderDetail.UnitCount         = transformerDetail.UnitCount;
                        //newOrderDetail.PackageType = transformerDetail.PackageType;
                        newOrderDetail.OrderHead      = orderHead;
                        newOrderDetail.IsScanHu       = true;
                        newOrderDetail.PutAwayBinCode = resolver.BinCode;
                        orderDetails.Add(newOrderDetail);
                    }
                }
            }
            return(orderDetails);
        }