public void AddTransportationBillDetail(string billNo, IList<TransportationActBill> transportationActBillList, User user)
        {
            TransportationBill oldTransportationBill = this.CheckAndLoadTransportationBill(billNo, true);

            #region ���״̬
            if (oldTransportationBill.Status != BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE)
            {
                throw new BusinessErrorException("TransportationBill.Error.StatusErrorWhenAddDetail", oldTransportationBill.Status, oldTransportationBill.BillNo);
            }
            #endregion

            if (transportationActBillList != null && transportationActBillList.Count > 0)
            {
                foreach (TransportationActBill transportationActBill in transportationActBillList)
                {
                    TransportationActBill oldTransportationActBill = this.transportationActBillMgr.LoadTransportationActBill(transportationActBill.Id);
                    oldTransportationActBill.CurrentBillQty = transportationActBill.CurrentBillQty;
                    oldTransportationActBill.CurrentDiscount = transportationActBill.CurrentDiscount;

                    TransportationBillDetail transportationBillDetail = this.transportationBillDetailMgr.TransferTransportationActBill2TransportationBillDetail(oldTransportationActBill);
                    transportationBillDetail.Bill = oldTransportationBill;
                    oldTransportationBill.AddTransportationBillDetail(transportationBillDetail);

                    this.transportationBillDetailMgr.CreateTransportationBillDetail(transportationBillDetail);
                    //�ۼ�TransportationActBill�����ͽ��
                    this.transportationActBillMgr.ReverseUpdateTransportationActBill(null, transportationBillDetail, user);
                }

                oldTransportationBill.LastModifyDate = DateTime.Now;
                oldTransportationBill.LastModifyUser = user;

                this.UpdateTransportationBill(oldTransportationBill);
            }
        }
        public void RecordLocationTransaction(OrderLocationTransaction orderLocationTransaction, InventoryTransaction inventoryTransaction, Receipt receipt, User user)
        {
            LocationTransaction locationTransaction = GenerateOrderLocationTransaction(orderLocationTransaction, orderLocationTransaction.Location, user);

            if (inventoryTransaction.Hu != null)
            {
                locationTransaction.HuId = inventoryTransaction.Hu.HuId;
                locationTransaction.LotNo = inventoryTransaction.Hu.LotNo;
            }
            if (locationTransaction.LotNo == null || locationTransaction.LotNo == string.Empty)
            {
                locationTransaction.LotNo = inventoryTransaction.LotNo;
            }
            locationTransaction.BatchNo = inventoryTransaction.LocationLotDetailId;
            locationTransaction.ReceiptNo = receipt.ReceiptNo;
            locationTransaction.IpNo = receipt.ReferenceIpNo;
            locationTransaction.Qty = inventoryTransaction.Qty;
            locationTransaction.EffectiveDate = DateTime.Parse(receipt.CreateDate.ToString("yyyy-MM-dd"));
            if (orderLocationTransaction.OrderDetail.OrderHead.Type == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_TRANSFER)
            {
                OrderLocationTransaction outOrderLocationTransaction = this.orderLocationTransactionMgrE.GetOrderLocationTransaction(orderLocationTransaction.OrderDetail.Id, BusinessConstants.IO_TYPE_OUT)[0];
                locationTransaction.RefLocation = outOrderLocationTransaction.Location.Code;
                locationTransaction.RefLocationName = outOrderLocationTransaction.Location.Name;
            }

            this.CreateLocationTransaction(locationTransaction);
        }
예제 #3
0
        public IList<Hu> CloneHu(string huId, decimal uintCount, int count, User user)
        {
            IList<Hu> huList = new List<Hu>();
            Hu oldHu = this.LoadHu(huId);
            DateTime dateTimeNow = DateTime.Now;

            int i = 0;
            while (i < count)
            {
                Hu huTemplate = CloneHelper.DeepClone<Hu>(oldHu);
                huTemplate.LotSize = uintCount;
                huTemplate.UnitCount = uintCount;
                huTemplate.Qty = uintCount;
                #region �����ö����������ɹ��������������ſ�ͷ��Ϊԭ�������룬����������ſ�ͷ��Ϊ��Ʒ����
                if (oldHu.HuId.StartsWith(oldHu.Item.Code))
                {
                    huTemplate.HuId = this.numberControlMgr.CloneRMHuId(oldHu.HuId, uintCount);
                }
                else
                {
                    huTemplate.HuId = this.numberControlMgr.CloneFGHuId(oldHu.HuId);
                }
                #endregion
                huTemplate.CreateDate = dateTimeNow;
                huTemplate.CreateUser = user;
                huTemplate.Status = BusinessConstants.CODE_MASTER_HU_STATUS_VALUE_CREATE;

                this.CreateHu(huTemplate);
                huList.Add(huTemplate);
                i++;
            }

            return huList;
        }
        public static bool CheckAuthrize(PickList pickList, User user)
        {
            bool partyFromAuthrized = false;
            //bool partyToAuthrized = false;

            foreach (Permission permission in user.Permissions)
            {
                if (permission.Code == pickList.PartyFrom.Code)
                {
                    partyFromAuthrized = true;
                    break;
                }

                //if (permission.Code == pickList.PartyTo.Code)
                //{
                //    partyToAuthrized = true;
                //}

                //if (partyFromAuthrized && partyToAuthrized)
                //{
                //    break;
                //}
            }

            //if (!(partyFromAuthrized && partyToAuthrized))
            if (!partyFromAuthrized)
            {
                //没有该订单的操作权限
                throw new BusinessErrorException("Order.Error.PickUp.NoPermission", pickList.PickListNo);
            }

            return true;
        }
        public static DetachedCriteria[] GetPermissionCriteriaByCategory(User user, string category)
        {
            DetachedCriteria[] criteria = new DetachedCriteria[2];

            DetachedCriteria upSubCriteria = DetachedCriteria.For<UserPermission>();
            upSubCriteria.CreateAlias("User", "u");
            upSubCriteria.CreateAlias("Permission", "pm");
            upSubCriteria.CreateAlias("pm.Category", "pmc");
            upSubCriteria.Add(Expression.Eq("pmc.Type", category));
            upSubCriteria.Add(Expression.Eq("u.Code", user.Code));
            upSubCriteria.SetProjection(Projections.ProjectionList().Add(Projections.GroupProperty("pm.Code")));

            DetachedCriteria rpSubCriteria = DetachedCriteria.For<RolePermission>();
            rpSubCriteria.CreateAlias("Role", "r");
            rpSubCriteria.CreateAlias("Permission", "pm");
            rpSubCriteria.CreateAlias("pm.Category", "pmc");
            rpSubCriteria.Add(Expression.Eq("pmc.Type", category));
            rpSubCriteria.SetProjection(Projections.ProjectionList().Add(Projections.GroupProperty("pm.Code")));

            DetachedCriteria urSubCriteria = DetachedCriteria.For<UserRole>();
            urSubCriteria.CreateAlias("User", "u");
            urSubCriteria.CreateAlias("Role", "r");
            urSubCriteria.Add(Expression.Eq("u.Code", user.Code));
            urSubCriteria.SetProjection(Projections.ProjectionList().Add(Projections.GroupProperty("r.Code")));

            rpSubCriteria.Add(Subqueries.PropertyIn("r.Code", urSubCriteria));

            criteria[0] = upSubCriteria;
            criteria[1] = rpSubCriteria;

            return criteria;
        }
예제 #6
0
 public void CreateUserRoles(User user, IList<Role> rList)
 {
     foreach (Role role in rList)
     {
         UserRole userRole = new UserRole();
         userRole.User = user;
         userRole.Role = role;
         entityDao.CreateUserRole(userRole);
     }
 }
예제 #7
0
 public void CreateUserPermissions(User user, IList<Permission> rList)
 {
     foreach (Permission permission in rList)
     {
         UserPermission userPermission = new UserPermission();
         userPermission.User = user;
         userPermission.Permission = permission;
         entityDao.CreateUserPermission(userPermission);
     }
 }
        public void RecordWOBackflushLocationTransaction(OrderLocationTransaction orderLocationTransaction, string huId, string lotNo, decimal qty, string ipNo, User user, Location locFrom)
        {
            LocationTransaction locationTransaction = new LocationTransaction();

            OrderDetail orderDetail = orderLocationTransaction.OrderDetail;
            OrderHead orderHead = orderDetail.OrderHead;
            string prodline = orderHead.Flow;

            locationTransaction.OrderNo = orderHead.OrderNo;            
            locationTransaction.OrderDetailId = orderDetail.Id;
            locationTransaction.OrderLocationTransactionId = orderLocationTransaction.Id;
            locationTransaction.ExternalOrderNo = orderHead.ExternalOrderNo;
            locationTransaction.ReferenceOrderNo = orderHead.ReferenceOrderNo;
            locationTransaction.IpNo = ipNo;
            //locationTransaction.ReceiptNo = 
            //locationTransaction.TransactionType = orderLocationTransaction.TransactionType;
            locationTransaction.TransactionType = BusinessConstants.CODE_MASTER_LOCATION_TRANSACTION_TYPE_VALUE_ISS_WO_BF; //投料回冲事务写死 ISS-WO-BF
            locationTransaction.Item = orderLocationTransaction.Item.Code;
            locationTransaction.ItemDescription = orderLocationTransaction.Item.Description;
            locationTransaction.Uom = orderLocationTransaction.Item.Uom.Code;
            //locationTransaction.Qty = 
            locationTransaction.PartyFrom = orderHead.PartyFrom.Code;
            locationTransaction.PartyFromName = orderHead.PartyFrom.Name;
            locationTransaction.PartyTo = orderHead.PartyTo.Code;
            locationTransaction.PartyToName = orderHead.PartyTo.Name;
            locationTransaction.ShipFrom = orderHead.ShipFrom != null ? orderHead.ShipFrom.Code : null;
            locationTransaction.ShipFromAddress = orderHead.ShipFrom != null ? orderHead.ShipFrom.Address : null;
            locationTransaction.ShipTo = orderHead.ShipTo != null ? orderHead.ShipTo.Code : null;
            locationTransaction.ShipToAddress = orderHead.ShipTo != null ? orderHead.ShipTo.Address : null;
            locationTransaction.Location = prodline;
            locationTransaction.LocationName = prodline;
            locationTransaction.DockDescription = orderHead.DockDescription;
            locationTransaction.Carrier = orderHead.Carrier != null ? orderHead.Carrier.Code : null;
            locationTransaction.CarrierBillCode = orderHead.CarrierBillAddress != null ? orderHead.CarrierBillAddress.Code : null;
            locationTransaction.CarrierBillAddress = orderHead.CarrierBillAddress != null ? orderHead.CarrierBillAddress.Address : null;
            locationTransaction.CreateDate = DateTime.Now;
            locationTransaction.CreateUser = user.Code;
            if (huId != null && huId.Trim() != string.Empty)
            {
                locationTransaction.HuId = huId;
            }
            if (lotNo != null && lotNo.Trim() != string.Empty)
            {
                locationTransaction.LotNo = lotNo;
            }
            locationTransaction.Qty = 0 - qty;
            locationTransaction.EffectiveDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd"));
            locationTransaction.RefLocation = locFrom.Code;
            locationTransaction.RefLocationName = locFrom.Name;

            this.CreateLocationTransaction(locationTransaction);
        }
        public IList<Permission> GetALlPermissionsByCategory(string categoryCode, User user)
        {
            DetachedCriteria criteria = DetachedCriteria.For(typeof(Permission));

            DetachedCriteria[] pCrieteria = SecurityHelper.GetPermissionCriteriaByCategory(user, categoryCode);

            criteria.Add(
                Expression.Or(
                    Subqueries.PropertyIn("Code", pCrieteria[0]),
                    Subqueries.PropertyIn("Code", pCrieteria[1])));

            return criteriaMgrE.FindAll<Permission>(criteria);
        }
예제 #10
0
        public virtual NamedQuery LoadNamedQuery(com.Sconit.Entity.MasterData.User user, String queryName)
        {
            string             hql    = @"from NamedQuery entity where entity.User.Code = ? and entity.QueryName = ?";
            IList <NamedQuery> result = FindAllWithCustomQuery <NamedQuery>(hql, new object[] { user.Code, queryName }, new IType[] { NHibernateUtil.String, NHibernateUtil.String });

            if (result != null && result.Count > 0)
            {
                return(result[0]);
            }
            else
            {
                return(null);
            }
        }
        public void CancelTransportationOrder(TransportationOrder order, User user)
        {
            if (order.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_CLOSE || order.Status == BusinessConstants.CODE_MASTER_STATUS_VALUE_COMPLETE)
            {
                throw new BusinessErrorException("TransportationOrder.Error.StatusErrorWhenCancel", order.Status, order.OrderNo);
            }

            #region ��鿪��Ʊ�IJ���ȡ��
            IList<TransportationActBill> actBillList = transportationActBillMgr.GetTransportationActBill(order);
            var i = (from c in actBillList
                     where c.BilledAmount > 0
                     select c).Count();
            #endregion
            if (i > 0)
            {
                throw new BusinessErrorException("TransportationOrder.Error.BillAmountErrorWhenCancel", order.OrderNo);
            }

            #region �ر�actbill
            if (actBillList != null && actBillList.Count > 0)
            {
                foreach (TransportationActBill actBill in actBillList)
                {
                    actBill.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CLOSE;
                    actBill.LastModifyDate = DateTime.Now;
                    actBill.LastModifyUser = user;
                    transportationActBillMgr.UpdateTransportationActBill(actBill);
                }
            }
            #endregion
            #region ɾ����asn�Ĺ���
            foreach (TransportationOrderDetail orderDetail in order.OrderDetails)
            {
                InProcessLocation ip = orderDetail.InProcessLocation;
                ip.IsReferenced = false;
                inProcessLocationMgr.UpdateInProcessLocation(ip);
            }

            #endregion

            #region �����˵�ͷ
            order.CancelDate = DateTime.Now;
            order.CancelUser = user;
            order.LastModifyDate = DateTime.Now;
            order.LastModifyUser = user;
            order.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CANCEL;

            this.UpdateTransportationOrder(order);
            #endregion
        }
예제 #12
0
        public virtual UserPreference LoadUserPreference(com.Sconit.Entity.MasterData.User user, String code)
        {
            string hql = @" from UserPreference entity where entity.User.Code = ? and entity.Code = ?";
            IList <UserPreference> result = FindAllWithCustomQuery <UserPreference>(hql, new object[] { user.Code, code }, new IType[] { NHibernateUtil.String, NHibernateUtil.String });

            if (result != null && result.Count > 0)
            {
                return(result[0]);
            }
            else
            {
                return(null);
            }
        }
예제 #13
0
        public virtual Favorites LoadFavorites(com.Sconit.Entity.MasterData.User user, String type, String pageName)
        {
            string            hql    = @"from Favorites entity where entity.User.Code = ? and entity.Type = ? and entity.PageName = ?";
            IList <Favorites> result = FindAllWithCustomQuery <Favorites>(hql, new object[] { user.Code, type, pageName }, new IType[] { NHibernateUtil.String, NHibernateUtil.String, NHibernateUtil.String });

            if (result != null && result.Count > 0)
            {
                return(result[0]);
            }
            else
            {
                return(null);
            }
        }
        public void RecordBillTransaction(BillDetail billDetail, User user, bool isCancel)
        {
            DateTime dateTimeNow = DateTime.Now;

            BillTransaction billTransaction = new BillTransaction();
            billTransaction.OrderNo = billDetail.ActingBill.OrderHead.OrderNo;
            billTransaction.ExternalReceiptNo = billDetail.ActingBill.ExternalReceiptNo;
            billTransaction.ReceiptNo = billDetail.ActingBill.ReceiptNo;
            billTransaction.Item = billDetail.ActingBill.Item.Code;
            billTransaction.ItemDescription = billDetail.ActingBill.Item.Description;
            billTransaction.Uom = billDetail.ActingBill.Uom.Code;
            billTransaction.BillAddress = billDetail.ActingBill.BillAddress.Code;
            billTransaction.BillAddressDescription = billDetail.ActingBill.BillAddress.Address;
            billTransaction.Party = billDetail.ActingBill.BillAddress.Party.Code;
            billTransaction.PartyName = billDetail.ActingBill.BillAddress.Party.Name;
            if (!isCancel)
            {
                billTransaction.Qty = billDetail.BilledQty;
            }
            else
            {
                billTransaction.Qty = billDetail.BilledQty * -1;
            }
            billTransaction.EffectiveDate = DateTime.Parse(dateTimeNow.ToShortDateString());   //仅保留年月日;
            if (billDetail.ActingBill.TransactionType == BusinessConstants.BILL_TRANS_TYPE_PO)
            {
                billTransaction.TransactionType = BusinessConstants.BILL_TRANS_TYPE_PO_BILL;
            }
            else
            {
                billTransaction.TransactionType = BusinessConstants.BILL_TRANS_TYPE_SO_BILL;
            }
            //billTransaction.PlannedBill = billDetail.ActingBill.Id;
            billTransaction.BillDetailId = billDetail.Id;
            billTransaction.CreateUser = user.Code;
            billTransaction.CreateDate = dateTimeNow;
            billTransaction.ActingBill = billDetail.ActingBill.Id;
            billTransaction.LocationFrom = billDetail.ActingBill.LocationFrom;
            billTransaction.IpNo = billDetail.ActingBill.IpNo;
            billTransaction.ReferenceItemCode = billDetail.ActingBill.ReferenceItemCode;
            //billTransaction.Location = billDetail.ActingBill.LocationFrom;
            //billTransaction.LocationName = locationLotDetail.Location.Name;
            //billTransaction.HuId = locationLotDetail.Hu != null ? locationLotDetail.Hu.HuId : string.Empty;
            //billTransaction.LotNo = locationLotDetail.LotNo;
            //billTransaction.BatchNo = locationLotDetail.Id;

            this.CreateBillTransaction(billTransaction);
        }
        public void RecordLocationTransaction(OrderLocationTransaction orderLocationTransaction, InventoryTransaction inventoryTransaction, InProcessLocation inProcessLocation, User user)
        {
            LocationTransaction locationTransaction = GenerateOrderLocationTransaction(orderLocationTransaction, inventoryTransaction.Location, user);

            if (inventoryTransaction.Hu != null)
            {
                locationTransaction.HuId = inventoryTransaction.Hu.HuId;
                locationTransaction.LotNo = inventoryTransaction.Hu.LotNo;
            }
            if (locationTransaction.LotNo == null || locationTransaction.LotNo == string.Empty)
            {
                locationTransaction.LotNo = inventoryTransaction.LotNo;
            }
            locationTransaction.BatchNo = inventoryTransaction.LocationLotDetailId;
            locationTransaction.IpNo = inProcessLocation.IpNo;
            locationTransaction.Qty = inventoryTransaction.Qty;
            locationTransaction.EffectiveDate = DateTime.Parse(inProcessLocation.CreateDate.ToString("yyyy-MM-dd"));

            this.CreateLocationTransaction(locationTransaction);
        }
예제 #16
0
 public void CreateRegion(Region entity, User currentUser)
 {
     if (partyDao.LoadParty(entity.Code) == null)
     {
         base.CreateRegion(entity);
     }
     else
     {
         CreateRegionOnly(entity);
     }
     Permission permission = new Permission();
     permission.Category = permissionCategoryMgr.LoadPermissionCategory(BusinessConstants.CODE_MASTER_PERMISSION_CATEGORY_TYPE_VALUE_REGION);
     permission.Code = entity.Code;
     permission.Description = entity.Name;
     permissionMgr.CreatePermission(permission);
     UserPermission userPermission = new UserPermission();
     userPermission.User = currentUser;
     userPermission.Permission = permission;
     userPermissionMgr.CreateUserPermission(userPermission);
 }
예제 #17
0
        public HuOdd CreateHuOdd(ReceiptDetail receiptDetail, LocationLotDetail locationLotDetail, User user)
        {
            OrderLocationTransaction orderLocationTransaction = receiptDetail.OrderLocationTransaction;
            OrderDetail orderDetail = orderLocationTransaction.OrderDetail;
            DateTime dateTimeNow = DateTime.Now;

            HuOdd huOdd = new HuOdd();
            huOdd.OrderDetail = orderDetail;
            huOdd.LocationLotDetail = locationLotDetail;
            huOdd.OddQty = receiptDetail.ReceivedQty.Value;
            huOdd.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_CREATE;
            huOdd.CreatedQty = 0;
            huOdd.CreateUser = user;
            huOdd.CreateDate = dateTimeNow;
            huOdd.LastModifyUser = user;
            huOdd.LastModifyDate = dateTimeNow;

            this.CreateHuOdd(huOdd);
            return huOdd;
        }
예제 #18
0
        public void RecordBillTransaction(PlannedBill plannedBill, ActingBill actingBill, LocationLotDetail locationLotDetail, User user)
        {
            #region 记BillTransaction
            DateTime dateTimeNow = DateTime.Now;

            BillTransaction billTransaction = new BillTransaction();
            billTransaction.OrderNo = plannedBill.OrderNo;
            billTransaction.ExternalReceiptNo = plannedBill.ExternalReceiptNo;
            billTransaction.ReceiptNo = plannedBill.ReceiptNo;
            billTransaction.Item = plannedBill.Item.Code;
            billTransaction.ItemDescription = plannedBill.Item.Description;
            billTransaction.Uom = plannedBill.Uom.Code;
            billTransaction.BillAddress = plannedBill.BillAddress.Code;
            billTransaction.BillAddressDescription = plannedBill.BillAddress.Address;
            billTransaction.Party = plannedBill.BillAddress.Party.Code;
            billTransaction.PartyName = plannedBill.BillAddress.Party.Name;
            billTransaction.Qty = plannedBill.CurrentActingQty;
            billTransaction.EffectiveDate = DateTime.Parse(dateTimeNow.ToShortDateString());   //仅保留年月日;
            billTransaction.TransactionType = plannedBill.TransactionType;
            billTransaction.PlannedBill = plannedBill.Id;
            billTransaction.CreateUser = user.Code;
            billTransaction.CreateDate = dateTimeNow;
            billTransaction.ActingBill = actingBill.Id;
            billTransaction.LocationFrom = plannedBill.LocationFrom;
            billTransaction.PartyFrom = plannedBill.PartyFrom;
            billTransaction.IpNo = plannedBill.IpNo;
            billTransaction.ReferenceItemCode = plannedBill.ReferenceItemCode;
            if (locationLotDetail != null)
            {
                billTransaction.Location = locationLotDetail.Location.Code;
                billTransaction.LocationName = locationLotDetail.Location.Name;
                billTransaction.HuId = locationLotDetail.Hu != null ? locationLotDetail.Hu.HuId : string.Empty;
                billTransaction.LotNo = locationLotDetail.LotNo;
                billTransaction.BatchNo = locationLotDetail.Id;
            }

            this.CreateBillTransaction(billTransaction);
            #endregion
        }
예제 #19
0
        public IList<Hu> CreateHu(IList<FlowDetail> flowDetailList, User user, string idMark, string packageType)
        {
            if (flowDetailList != null && flowDetailList.Count > 0)
            {
                IList<Hu> huList = new List<Hu>();
                int? huLotSize = null;
                foreach (FlowDetail flowDetail in flowDetailList)
                {
                    Flow flow = flowDetail.Flow;
                    if (packageType == BusinessConstants.CODE_MASTER_PACKAGETYPE_INNER)
                    {
                        huLotSize = Convert.ToInt32(flowDetail.UnitCount);
                    }
                    else 
                    {
                        huLotSize = flowDetail.HuLotSize;
                    }

                    if (flow.Type != BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_PRODUCTION)
                    {
                        IListHelper.AddRange<Hu>(huList,
                        CreateHu(flowDetail.Item, flowDetail.OrderedQty, flowDetail.HuLotNo, flowDetail.Uom, flowDetail.UnitCount, huLotSize,
                            null, null, null, flowDetail.Flow.PartyFrom, BusinessConstants.CODE_MASTER_ITEM_QUALITY_LEVEL_VALUE_1, user, flowDetail, null, flowDetail.ItemVersion, idMark,flowDetail.CustomerItemCode));
                    }
                    else
                    {
                        IListHelper.AddRange<Hu>(huList,
                        CreateHu(flowDetail.Item, flowDetail.OrderedQty, flowDetail.HuLotNo, flowDetail.Uom, flowDetail.UnitCount, huLotSize,
                            null, null, null, flowDetail.Flow.PartyFrom, BusinessConstants.CODE_MASTER_ITEM_QUALITY_LEVEL_VALUE_1, user, flowDetail, flowDetail.HuShiftCode, flowDetail.ItemVersion, idMark,flowDetail.CustomerItemCode));
                    }
                }

                return huList;
            }

            return null;
        }
예제 #20
0
 public IList<Hu> CreateHu(IList<OrderDetail> orderDetailList, User user)
 {
     return CreateHu(orderDetailList, user, null);
 }
예제 #21
0
 public IList<Hu> CreateHu(IList<FlowDetail> flowDetailList, User user, string idMark)
 {
     return CreateHu(flowDetailList, user, idMark, null);
 }
예제 #22
0
 public virtual Favorites LoadFavorites(com.Sconit.Entity.MasterData.User user, String type, String pageName)
 {
     return(entityDao.LoadFavorites(user, type, pageName));
 }
예제 #23
0
        public string TranslateMessage(string content, User user, params string[] parameters)
        {
            //try
            //{
            //    content = ProcessMessage(content, parameters);

            //    if (user != null && user.UserLanguage != null && user.UserLanguage != string.Empty)
            //    {
            //        content = this.ProcessLanguage(content, user.UserLanguage);
            //    }
            //    else
            //    {
            //        EntityPreference defaultLanguage = entityPreferenceMgrE.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_DEFAULT_LANGUAGE);
            //        content = this.ProcessLanguage(content, defaultLanguage.Value);
            //    }
            //}
            //catch (Exception ex)
            //{
            //    throw new TechnicalException("翻译时出现异常:" + ex.Message);
            //}
            //return content;

            string language = null;
            if (user != null && user.UserLanguage != null && user.UserLanguage != string.Empty)
            {
                language = user.UserLanguage;
            }
            else
            {
                EntityPreference defaultLanguage = entityPreferenceMgrE.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_DEFAULT_LANGUAGE);
                language = defaultLanguage.Value;
            }
            return TranslateContent(content, language, parameters);
        }
        public void SaveShiftPlanSchedule(ShiftPlanSchedule shiftPlanSchedule, User user)
        {
            //this.ClearOldShiftPlanSchedule(shiftPlanSchedule);

            //shiftPlanSchedule.LastModifyDate = DateTime.Now;
            //shiftPlanSchedule.LastModifyUser = user;
            //this.CreateShiftPlanSchedule(shiftPlanSchedule);

            ShiftPlanSchedule sps = this.GetShiftPlanSchedule(shiftPlanSchedule.FlowDetail.Id, shiftPlanSchedule.ReqDate, shiftPlanSchedule.Shift.Code, shiftPlanSchedule.Sequence);
            if (sps == null)
            {
                shiftPlanSchedule.LastModifyDate = DateTime.Now;
                shiftPlanSchedule.LastModifyUser = user;
                this.CreateShiftPlanSchedule(shiftPlanSchedule);
            }
            else
            {
                sps.PlanQty = shiftPlanSchedule.PlanQty;
                sps.LastModifyUser = shiftPlanSchedule.LastModifyUser;
                sps.LastModifyDate = DateTime.Now;
                this.UpdateShiftPlanSchedule(sps);
            }
        }
예제 #25
0
        public IList<Hu> CreateHu(InProcessLocationDetail inProcessLocationDetail, User user)
        {
            if (inProcessLocationDetail.HuId != null)
            {
                throw new TechnicalException("HuId already exist.");
            }

            OrderLocationTransaction orderLocationTransaction = inProcessLocationDetail.OrderLocationTransaction;
            OrderDetail orderDetail = orderLocationTransaction.OrderDetail;
            OrderHead orderHead = orderDetail.OrderHead;

            return CreateHu(orderLocationTransaction.Item, inProcessLocationDetail.Qty, inProcessLocationDetail.LotNo, orderDetail.Uom, orderDetail.UnitCount, orderDetail.HuLotSize,
                    orderHead.OrderNo, null, null, orderHead.PartyFrom, BusinessConstants.CODE_MASTER_ITEM_QUALITY_LEVEL_VALUE_1, user, inProcessLocationDetail, null, orderLocationTransaction.ItemVersion, null,orderDetail.CustomerItemCode);
        }
예제 #26
0
        public IList<Hu> CreateHu(OrderHead orderHead, User user)
        {
            if (orderHead.OrderDetails != null && orderHead.OrderDetails.Count > 0)
            {
                IList<Hu> huList = new List<Hu>();
                foreach (OrderDetail orderDetail in orderHead.OrderDetails)
                {
                    IListHelper.AddRange<Hu>(huList,
                        CreateHu(orderDetail.Item, orderDetail.OrderedQty, orderDetail.HuLotNo, orderDetail.Uom, orderDetail.UnitCount, orderDetail.HuLotSize,
                        null, null, null, orderDetail.OrderHead.PartyFrom, BusinessConstants.CODE_MASTER_ITEM_QUALITY_LEVEL_VALUE_1, user, orderDetail, null, orderDetail.ItemVersion, null,orderDetail.CustomerItemCode));
                }

                return huList;
            }

            return null;
        }
예제 #27
0
 public virtual void DeleteUserPreference(com.Sconit.Entity.MasterData.User user, String code)
 {
     entityDao.DeleteUserPreference(user, code);
 }
예제 #28
0
        public virtual void DeleteUserPreference(com.Sconit.Entity.MasterData.User user, String code)
        {
            string hql = @" from UserPreference entity where entity.User.Code = ? and entity.Code = ?";

            Delete(hql, new object[] { user.Code, code }, new IType[] { NHibernateUtil.String, NHibernateUtil.String });
        }
예제 #29
0
 public virtual NamedQuery LoadNamedQuery(com.Sconit.Entity.MasterData.User user, String queryName)
 {
     return(entityDao.LoadNamedQuery(user, queryName));
 }
예제 #30
0
 public virtual void DeleteNamedQuery(com.Sconit.Entity.MasterData.User user, String queryName)
 {
     entityDao.DeleteNamedQuery(user, queryName);
 }
예제 #31
0
        public IList<Hu> CreateHu(IList<OrderDetail> orderDetailList, User user, string idMark)
        {
            if (orderDetailList != null && orderDetailList.Count > 0)
            {
                IList<Hu> huList = new List<Hu>();
                foreach (OrderDetail orderDetail in orderDetailList)
                {
                  
                    string lotNo = orderDetail.HuLotNo != null && orderDetail.HuLotNo.Trim().Length != 0 ? orderDetail.HuLotNo.Trim() : LotNoHelper.GenerateLotNo(orderDetail.OrderHead.WindowTime);
                    IListHelper.AddRange<Hu>(huList,
                        CreateHu(orderDetail.Item, orderDetail.OrderedQty, lotNo, orderDetail.Uom, orderDetail.UnitCount, orderDetail.HuLotSize,
                        null, null, null, orderDetail.OrderHead.PartyFrom, BusinessConstants.CODE_MASTER_ITEM_QUALITY_LEVEL_VALUE_1, user, orderDetail, null, orderDetail.ItemVersion, idMark,orderDetail.CustomerItemCode));
                }

                return huList;
            }

            return null;
        }
예제 #32
0
        public IList<Hu> CreateHu(ReceiptDetail receiptDetail, User user)
        {
            if (receiptDetail.HuId != null)
            {
                throw new TechnicalException("HuId already exist.");
            }

            OrderLocationTransaction orderLocationTransaction = receiptDetail.OrderLocationTransaction;
            OrderDetail orderDetail = orderLocationTransaction.OrderDetail;
            OrderHead orderHead = orderDetail.OrderHead;
            IList<Hu> huList = new List<Hu>();
            string lotNo = null;

            if (orderHead.Type != BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION)
            {
                lotNo = receiptDetail.LotNo;
            }

            #region 为正品创建Hu
            if (receiptDetail.ReceivedQty.HasValue && receiptDetail.ReceivedQty != 0)
            {
                huList = CreateHu(orderLocationTransaction.Item, receiptDetail.ReceivedQty.Value, lotNo, orderDetail.Uom, orderDetail.UnitCount, orderDetail.HuLotSize,
                    orderHead.OrderNo, receiptDetail.Receipt.ReceiptNo, null, orderHead.PartyFrom, BusinessConstants.CODE_MASTER_ITEM_QUALITY_LEVEL_VALUE_1, user, receiptDetail, null, orderLocationTransaction.ItemVersion, null,orderDetail.CustomerItemCode);
            }
            #endregion

            #region 为次品创建Hu
            //if (receiptDetail.RejectedQty.HasValue && receiptDetail.RejectedQty != 0)
            //{
            //    IList<Hu> rejHuList = CreateHu(orderLocationTransaction.Item, receiptDetail.RejectedQty.Value, lotNo, orderDetail.Uom, orderDetail.UnitCount, orderDetail.HuLotSize,
            //        orderHead.OrderNo, receiptDetail.Receipt.ReceiptNo, null, orderHead.PartyFrom, BusinessConstants.CODE_MASTER_ITEM_QUALITY_LEVEL_VALUE_2, user, receiptDetail, null);
            //    IListHelper.AddRange<Hu>(huList, rejHuList);
            //}
            #endregion

            return huList;
        }
 public void SaveShiftPlanSchedule(IList<ShiftPlanSchedule> shiftPlanScheduleList, User user)
 {
     if (shiftPlanScheduleList != null && shiftPlanScheduleList.Count > 0)
     {
         foreach (ShiftPlanSchedule shiftPlanSchedule in shiftPlanScheduleList)
         {
             this.SaveShiftPlanSchedule(shiftPlanSchedule, user);
         }
     }
 }
예제 #34
0
 public IList<Hu> CloneHu(Hu hu, decimal uintCount, int count, User user)
 {
     return CloneHu(hu.HuId, uintCount, count, user);
 }
예제 #35
0
 public virtual UserPreference LoadUserPreference(com.Sconit.Entity.MasterData.User user, String code)
 {
     return(entityDao.LoadUserPreference(user, code));
 }
예제 #36
0
        public IList<Hu> CreateHu(Item item, decimal qty, string lotNo, Uom uom, decimal unitCount, int? huLotSize,
            string orderNo, string recNo, DateTime? manufactureDate, Party manufactureParty, string qualityLevel, User user, Object obj, string shiftCode, string itemVersion, string idMark,string customerItemCode)
        {
            IList<Hu> huList = new List<Hu>();

            #region 根据Hu批量创建Hu
            decimal remainHuQty = qty;                                        //剩余量
            decimal currentHuQty = GetNextHuQty(ref remainHuQty, huLotSize);  //本次量
            DateTime dateTimeNow = DateTime.Now;

            while (currentHuQty > 0)
            {
                #region 创建Hu
                Hu hu = new Hu();
                #region HuId生成
                if (obj.GetType() == typeof(FlowDetail))
                {
                    FlowDetail flowDetail = (FlowDetail)obj;
                    if (flowDetail.Flow.Type != BusinessConstants.CODE_MASTER_FLOW_TYPE_VALUE_PRODUCTION)
                    {
                        lotNo = lotNo != null ? lotNo : LotNoHelper.GenerateLotNo();
                        hu.HuId = this.numberControlMgrE.GenerateRMHuId(flowDetail, lotNo, currentHuQty, idMark);
                    }
                    else
                    {
                        if (shiftCode != null && shiftCode.Trim().Length != 0)
                        {
                            lotNo = lotNo != null ? lotNo : LotNoHelper.GenerateLotNo();
                            hu.HuId = this.numberControlMgrE.GenerateFGHuId(flowDetail, shiftCode, currentHuQty, idMark);
                        }
                        else
                        {
                            throw new TechnicalException("ShiftCode can't be null when create fg huId by flowdetail");
                        }
                    }
                }
                else if (obj.GetType() == typeof(OrderDetail))
                {
                    OrderDetail orderDetail = (OrderDetail)obj;
                    if (orderDetail.OrderHead.Type != BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION)
                    {
                        lotNo = lotNo != null ? lotNo : LotNoHelper.GenerateLotNo(orderDetail.OrderHead.WindowTime);
                        hu.HuId = this.numberControlMgrE.GenerateRMHuId(orderDetail, lotNo, currentHuQty, idMark);
                    }
                    else
                    {
                        lotNo = lotNo != null ? lotNo : LotNoHelper.GenerateLotNo(orderDetail.OrderHead.WindowTime);
                        hu.HuId = this.numberControlMgrE.GenerateFGHuId(orderDetail, currentHuQty, idMark);
                    }
                }
                else if (obj.GetType() == typeof(InProcessLocationDetail))
                {
                    InProcessLocationDetail inProcessLocationDetail = (InProcessLocationDetail)obj;
                    if (inProcessLocationDetail.OrderLocationTransaction.OrderDetail.OrderHead.Type
                        != BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION)
                    {
                        lotNo = lotNo != null ? lotNo : LotNoHelper.GenerateLotNo();
                        hu.HuId = this.numberControlMgrE.GenerateRMHuId(inProcessLocationDetail, lotNo, currentHuQty);
                    }
                    else
                    {
                        throw new TechnicalException("Can't create fg huid by InProcessLocationDetail");
                    }
                }
                else if (obj.GetType() == typeof(ReceiptDetail))
                {
                    ReceiptDetail receiptDetail = (ReceiptDetail)obj;
                    if (receiptDetail.OrderLocationTransaction.OrderDetail.OrderHead.Type
                        != BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION)
                    {
                        lotNo = lotNo != null ? lotNo : LotNoHelper.GenerateLotNo();
                        hu.HuId = this.numberControlMgrE.GenerateRMHuId(receiptDetail, lotNo, currentHuQty);
                    }
                    else
                    {
                        lotNo = lotNo != null ? lotNo : LotNoHelper.GenerateLotNo();
                        hu.HuId = this.numberControlMgrE.GenerateFGHuId(receiptDetail, currentHuQty);
                    }
                }
                else
                {
                    throw new TechnicalException("Parameter obj only accept type: FlowDetail, OrderDetail, InProcessLocationDetail, ReceiptDetail");
                }
                #endregion
                hu.Item = item;
                hu.OrderNo = orderNo;
                hu.ReceiptNo = recNo;
                hu.Uom = uom;   //用订单单位
                hu.UnitCount = unitCount;
                #region 单位用量
                //如果是OrderDetail,应该等于inOrderLocationTransaction.UnitQty,现在暂时直接用单位换算
                if (item.Uom.Code != uom.Code)
                {
                    hu.UnitQty = this.uomConversionMgrE.ConvertUomQty(item, uom, 1, item.Uom);   //单位用量
                }
                else
                {
                    hu.UnitQty = 1;
                }
                #endregion
                hu.QualityLevel = qualityLevel;
                hu.Qty = currentHuQty;
                hu.LotNo = lotNo;
                hu.ManufactureDate = manufactureDate.HasValue ? manufactureDate.Value : LotNoHelper.ResolveLotNo(hu.LotNo);
                hu.ManufactureParty = manufactureParty;
                hu.CreateUser = user;
                hu.CreateDate = dateTimeNow;
                hu.LotSize = huLotSize.HasValue ? huLotSize.Value : currentHuQty;
                hu.Version = itemVersion;
                hu.Status = BusinessConstants.CODE_MASTER_HU_STATUS_VALUE_CREATE;
                hu.CustomerItemCode = customerItemCode;

                this.CreateHu(hu);
                #endregion

                huList.Add(hu);
                currentHuQty = GetNextHuQty(ref remainHuQty, huLotSize);
            }
            #endregion

            return huList;
        }
예제 #37
0
 public string TranslateMessage(string content, User user)
 {
     return this.TranslateMessage(content, user, null);
 }
예제 #38
0
 public IList<Hu> CreateHu(IList<FlowDetail> flowDetailList, User user)
 {
     return CreateHu(flowDetailList, user, null);
 }
예제 #39
0
        public MiscOrder SaveMiscOrder(MiscOrder miscOrder, User user)
        {
            MiscOrder dbMiscOrder = null;
            if (miscOrder != null && miscOrder.OrderNo != null)
            {
                dbMiscOrder = miscOrderDao.LoadMiscOrder(miscOrder.OrderNo);
            }
                
            if (dbMiscOrder != null)
            {
                IList<MiscOrderDetail> dbMiscOrderDets = dbMiscOrder.MiscOrderDetails;
                foreach (MiscOrderDetail miscOrderDet in dbMiscOrderDets)
                {
                    miscOrderDetailMgrE.DeleteMiscOrderDetail(miscOrderDet);
                }

                MiscOrder pageMiscOrder = miscOrder;
                IList<MiscOrderDetail> pageMiscOrderDets = pageMiscOrder.MiscOrderDetails;
                foreach (MiscOrderDetail miscOrderDet in pageMiscOrderDets)
                {
                    miscOrderDet.MiscOrder = pageMiscOrder;
                    miscOrderDetailMgrE.CreateMiscOrderDetail(miscOrderDet);
                }
                dbMiscOrder.Remark = pageMiscOrder.Remark;
                dbMiscOrder.Reason = pageMiscOrder.Reason;
                dbMiscOrder.EffectiveDate = pageMiscOrder.EffectiveDate;
                dbMiscOrder.Location = pageMiscOrder.Location;
                dbMiscOrder.CreateDate = DateTime.Now;
                miscOrderDao.UpdateMiscOrder(dbMiscOrder);
            }
            else
            {
                dbMiscOrder = miscOrder;
                dbMiscOrder.CreateUser = user;
                dbMiscOrder.CreateDate = DateTime.Now;
                dbMiscOrder.OrderNo = numberControlMgrE.GenerateNumber(BusinessConstants.CODE_PREFIX_MISCO);
                miscOrderDao.CreateMiscOrder(dbMiscOrder);

                IList<MiscOrderDetail> pageMiscOrderDets = dbMiscOrder.MiscOrderDetails;
                foreach (MiscOrderDetail miscOrderDet in pageMiscOrderDets)
                {
                    miscOrderDet.MiscOrder = dbMiscOrder;
                    miscOrderDetailMgrE.CreateMiscOrderDetail(miscOrderDet);
                    
                    //出入库
                    if (dbMiscOrder.Type == BusinessConstants.CODE_MASTER_MISC_ORDER_TYPE_VALUE_GI)
                    {
                        //出库
                        this.locationMgrE.InventoryOut(miscOrderDet, user);
                    }
                    else if (dbMiscOrder.Type == BusinessConstants.CODE_MASTER_MISC_ORDER_TYPE_VALUE_GR)
                    {
                        //入库
                        this.locationMgrE.InventoryIn(miscOrderDet, user);
                    }
                    else if (dbMiscOrder.Type == BusinessConstants.CODE_MASTER_MISC_ORDER_TYPE_VALUE_ADJ)
                    {
                        //用入库操作就可以做调整
                        this.locationMgrE.InventoryIn(miscOrderDet, user);
                        //if (miscOrderDet.Qty > 0)
                        //{
                        //    //入库
                        //    this.locationMgrE.InventoryIn(miscOrderDet, user);
                        //}
                        //else if (miscOrderDet.Qty < 0)
                        //{
                        //    //出库
                        //    miscOrderDet.Qty = miscOrderDet.Qty * -1;  //调整为正数
                        //    this.locationMgrE.InventoryOut(miscOrderDet, user);
                        //}
                    }
                    else
                    {
                        throw new TechnicalException("MiscOrder Type:" + dbMiscOrder.Type + " is not valided");
                    }
                }
                
            }
            return ReLoadMiscOrder(dbMiscOrder.OrderNo);

        }
예제 #40
0
        public virtual void DeleteNamedQuery(com.Sconit.Entity.MasterData.User user, String queryName)
        {
            string hql = @"from NamedQuery entity where entity.User.Code = ? and entity.QueryName = ?";

            Delete(hql, new object[] { user.Code, queryName }, new IType[] { NHibernateUtil.String, NHibernateUtil.String });
        }