示例#1
0
        private RevisionedObject ResolveRDO(string rdo_type_name, string rdo_name, string rdo_revision, bool throwException)
        {
            RevisionedObject res = null;

            if (rdo_revision == null)
            {
                rdo_revision = "";
            }
            if (rdo_revision != "")
            {
                const string queryRDObyRevision = "ELEMENT (SELECT o FROM {0}Extent AS o WHERE o.RevBase.Name = $1 AND o.Revision = $2)";
                // Query from revision
                IQuery       oqlQuery = ObjScope.GetOqlQuery(string.Format(queryRDObyRevision, rdo_type_name));
                IQueryResult result   = oqlQuery.Execute(rdo_name, rdo_revision);
                if (result.Count > 0)
                {
                    res = result[0] as RevisionedObject;
                }
                result.Dispose();
            }
            else
            {
                res = (ResolveNDO(rdo_type_name + "Base", rdo_name, throwException) as RevisionBase).Current;
            }
            if (res == null && throwException == true)
            {
                throw new UOServiceException(string.Format(MSG.Object_not_found, string.Format("{0}({1})", rdo_name, rdo_revision), rdo_type_name));
            }
            return(res);
        }
示例#2
0
        virtual public bool Add(NamedObject ndo_insert)
        {
            string idProperty_Name = null;
            object check_exist     = ResolveNDO(ndo_insert, out idProperty_Name);

            if (check_exist == null)
            {
                foreach (PropertyInfo pi in ndo_insert.GetType().GetProperties())
                {
                    if (pi.Name == idProperty_Name)
                    {
                        continue;   // do not update Primary Property
                    }
                    object v_changes = pi.GetValue(ndo_insert, null);
                    if (v_changes != null && (pi.CanWrite || v_changes.GetType().IsGenericType))
                    {
                        SetProperty(ndo_insert, pi, v_changes);
                    }
                }
                ObjScope.Transaction.Begin();
                ObjScope.Add(ndo_insert);
                ObjScope.Transaction.Commit();
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#3
0
文件: Start.cs 项目: kyjb2000/uo-mes
        protected override bool ModifyEntity()
        {
            bool          success = true;
            CurrentStatus cs_temp = new CurrentStatus();

            AssignToCurrentStatus(cs_temp);
            CurrentStatus cs = ResolveCurrentStatus(cs_temp);

            if (cs == null)
            {
                ObjScope.Add(cs_temp);
                cs = cs_temp;
            }
            foreach (StartDetail sd in Details)
            {
                Container co = new Container();
                co.CurrentStatus = cs;
                AssignToContainer(co);
                AssignStartDetailsToContainer(sd, co);
                ObjScope.Add(co);
                if (null != MfgOrder)
                {
                    MfgOrder.ReleasedQty += co.Qty;
                }
            }
            return(success);
        }
示例#4
0
        protected override bool RecordServiceHistory()
        {
            ResourceThruputHistory h = new ResourceThruputHistory();

            AssignToResourceThruputHistory(h);
            ObjScope.Add(h);
            return(true);
        }
示例#5
0
文件: MoveIn.cs 项目: kyjb2000/uo-mes
        protected override bool RecordServiceHistory()
        {
            MoveInHistory h = new MoveInHistory();

            AssignToMoveInHistory(h);
            ObjScope.Add(h);
            return(true);
        }
示例#6
0
文件: Hold.cs 项目: kyjb2000/uo-mes
        protected override bool RecordServiceHistory()
        {
            HoldReleaseHistory h = new HoldReleaseHistory();

            AssignToHoldReleaseHistory(h);
            ObjScope.Add(h);
            return(true);
        }
示例#7
0
 private void initializeHistoryMainline()
 {
     if (ObjScope.IsNew(historyMainLine))
     {
         ObjScope.Add(historyMainLine);
     }
     HistoryMainLine.TxnDate = TxnDate;
 }
示例#8
0
        protected override bool RecordServiceHistory()
        {
            // Define Transaction History Object
            HoldReleaseHistory existHoldHistory  = ResolveHoldHistory(Container);
            HoldReleaseHistory newReleaseHistory = new HoldReleaseHistory();

            AssignToHoldReleaseHistory(existHoldHistory, newReleaseHistory);
            ObjScope.Add(newReleaseHistory);
            return(true);
        }
示例#9
0
        protected HoldReleaseHistory ResolveHoldHistory(Container co)
        {
            object       res      = null;
            IQuery       oqlQuery = ObjScope.GetOqlQuery(queryHoldHistory);
            IQueryResult result   = oqlQuery.Execute(co);

            if (result.Count > 0)
            {
                res = result[0];
            }
            result.Dispose();
            return(res as HoldReleaseHistory);
        }
示例#10
0
        protected string[] getObjectNamesViaQuery(string parcialObjectName, string odlQuery)
        {
            List <string> list  = new List <string>();
            IQuery        query = ObjScope.GetOqlQuery(odlQuery);

            using (IQueryResult result = query.Execute(parcialObjectName + '*'))
            {
                foreach (object res in result)
                {
                    list.Add(res as string);
                }
            }
            return(list.ToArray());
        }
示例#11
0
        protected Container ResolveContainer(string container_name)
        {
            const string queryContainerByName = "ELEMENT (SELECT o FROM ContainerExtent AS o WHERE o.ContainerName = $1)";
            object       res      = null;
            IQuery       oqlQuery = ObjScope.GetOqlQuery(queryContainerByName);
            IQueryResult result   = oqlQuery.Execute(container_name);

            if (result.Count > 0)
            {
                res = result[0];
            }
            result.Dispose();
            return(res as Container);
        }
示例#12
0
        private int RDOBaseUsageCount(RevisionedObject rdo_obj)
        {
            const string queryRDOBaseUsageCount = "SELECT COUNT(*) FROM {0}Extent AS o WHERE o.RevBase = $1";
            int          count    = 0;
            IQuery       oqlQuery = ObjScope.GetOqlQuery(string.Format(queryRDOBaseUsageCount, rdo_obj.GetType().Name));
            IQueryResult result   = oqlQuery.Execute(rdo_obj.RevBase);

            if (result.Count > 0)
            {
                count = (int)result[0];
            }
            result.Dispose();
            return(count);
        }
示例#13
0
文件: Start.cs 项目: kyjb2000/uo-mes
        protected override bool RecordServiceHistory()
        {
            StartHistory h = new StartHistory();

            AssignToStartHistory(h);
            foreach (StartDetail sd in Details)
            {
                StartHistoryDetail hd = new StartHistoryDetail();
                AssignStartDetailToStartHistoryDetail(sd, hd);
                hd.ServiceHistorySummary = h;
                ObjScope.Add(hd);
            }
            ObjScope.Add(h);
            return(true);
        }
示例#14
0
        protected override bool RecordServiceHistory()
        {
            ComponentIssueHistory h = new ComponentIssueHistory();

            AssignToComponentIssueHistory(h);
            foreach (ComponentIssueDetail sd in Details)
            {
                ComponentIssueHistoryDetail hd = new ComponentIssueHistoryDetail();
                AssignDetailsToHistoryDetail(sd, hd);
                hd.ServiceHistorySummary = h;
                ObjScope.Add(hd);
            }
            ObjScope.Add(h);
            return(true);
        }
示例#15
0
文件: Split.cs 项目: kyjb2000/uo-mes
        protected override bool RecordServiceHistory()
        {
            SplitHistory h = new SplitHistory();

            AssignToSplitHistory(h);
            foreach (SplitDetail sd in ToContainerDetails)
            {
                SplitHistoryDetail hd = new SplitHistoryDetail();
                AssignSplitDetailsToSplitHistoryDetail(sd, hd);
                hd.ServiceHistorySummary = h;
                ObjScope.Add(hd);
            }
            ObjScope.Add(h);
            return(true);
        }
示例#16
0
        protected override bool RecordServiceHistory()
        {
            DisassociateHistory h = new DisassociateHistory();

            AssignToDisassociateHistory(h);
            foreach (DisassociateDetail sd in DisassociateDetails)
            {
                DisassociateHistoryDetail hd = new DisassociateHistoryDetail();
                AssignDisassociateDetailToDisassociateHistoryDetail(sd, hd);
                hd.ServiceHistorySummary = h;
                ObjScope.Add(hd);
            }
            ObjScope.Add(h);
            return(true);
        }
示例#17
0
        protected override bool RecordServiceHistory()
        {
            DefectHistory h = new DefectHistory();

            AssignToDefectHistory(h);
            foreach (DefectDetail d in DefectDetails)
            {
                DefectHistoryDetail hd = new DefectHistoryDetail();
                AssignDefectDetailsToDefectHistoryDetail(d, hd);
                hd.ServiceHistorySummary = h;
                ObjScope.Add(hd);
            }
            ObjScope.Add(h);
            return(true);
        }
示例#18
0
        protected override bool RecordServiceHistory()
        {
            CombineHistory h = new CombineHistory();

            AssignToCombineHistory(h);
            foreach (CombineFromDetail hd in FromContainerDetails)
            {
                CombineHistoryDetail shd = new CombineHistoryDetail();
                AssignCombineDetailsToCombineHistoryDetail(hd, shd);
                shd.ServiceHistorySummary = h;
                ObjScope.Add(shd);
            }
            ObjScope.Add(h);
            return(true);
        }
示例#19
0
        protected override bool RecordServiceHistory()
        {
            SerializeHistory h = new SerializeHistory();

            AssignToSerializeHistory(h);
            foreach (SerializeDetail d in SerializeDetails)
            {
                SerializeHistoryDetail hd = new SerializeHistoryDetail();
                AssignSerializeDetailsToSerializeHistoryDetail(d, hd);
                hd.ServiceHistorySummary = h;
                ObjScope.Add(hd);
            }
            ObjScope.Add(h);
            return(true);
        }
示例#20
0
        protected override bool ModifyEntity()
        {
            bool success = base.ModifyEntity();

            foreach (SerializeDetail d in serializeDetail)
            {
                UO_Model.Execution.Container co = new UO_Model.Execution.Container();
                Container.AssignToContainer(co);
                AssignSerializeDetailsToChildContainer(d, co);
                Container.Qty -= d.ChildQty;
                ObjScope.Add(co);
            }

            return(success);
        }
示例#21
0
        protected override bool RecordServiceHistory()
        {
            CollectResDataHistory h = new CollectResDataHistory();

            AssignToCollectResourceDataHistory(h);
            foreach (ParametricDataDetail sd in Details)
            {
                CollectResDataHistoryDetail hd = new CollectResDataHistoryDetail();
                AssignDetailsToHistoryDetail(sd, hd);
                hd.ServiceHistorySummary = h;
                ObjScope.Add(hd);
            }
            ObjScope.Add(h);
            return(true);
        }
示例#22
0
        protected string[] getObjectRevisionsViaQuery(string parcialObjectName, string odlQuery)
        {
            List <string> list  = new List <string>();
            IQuery        query = ObjScope.GetOqlQuery(odlQuery);

            using (IQueryResult result = query.Execute(parcialObjectName + '*'))
            {
                foreach (object res in result)
                {
                    object[] r         = res as object[];
                    string   revisions = string.Format("{0}({1})", r[0].ToString(), r[1].ToString());
                    list.Add(revisions);
                }
            }
            return(list.ToArray());
        }
示例#23
0
        virtual public bool Remove(NamedObject ndo_obj)
        {
            object res = ResolveNDO(ndo_obj);

            if (res != null)
            {
                ObjScope.Transaction.Begin();
                ObjScope.Remove(res);
                ObjScope.Transaction.Commit();
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#24
0
        protected CurrentStatus ResolveCurrentStatus(CurrentStatus cs)
        {
            const string queryCurrentStatus =
                @"ELEMENT (SELECT * FROM CurrentStatusExtent AS o 
WHERE o.Workflow = $1 AND o.WorkflowStep = $2 AND o.CurrentStepPass = $3
  AND o.Spec = $4 AND o.InProcess = $5 AND o.Resource = $6 AND o.Factory = $7 )";
            object       res      = null;
            IQuery       oqlQuery = ObjScope.GetOqlQuery(queryCurrentStatus);
            IQueryResult result   = oqlQuery.Execute(cs.Workflow, cs.WorkflowStep, cs.CurrentStepPass,
                                                     cs.Spec, cs.InProcess, cs.Resource, cs.Factory);

            if (result.Count > 0)
            {
                res = result[0];
            }
            result.Dispose();
            return(res as CurrentStatus);
        }
示例#25
0
        private object ResolveNDO(string ndo_type_name, string ndo_name, bool throwException)
        {
            const string queryNDObyName = "ELEMENT (SELECT o FROM {0}Extent AS o WHERE o.Name = $1)";
            object       res            = null;
            IQuery       oqlQuery       = ObjScope.GetOqlQuery(string.Format(queryNDObyName, ndo_type_name));
            IQueryResult result         = oqlQuery.Execute(ndo_name);

            if (result.Count > 0)
            {
                res = result[0];
            }
            result.Dispose();
            if (res == null && throwException == true)
            {
                throw new UOServiceException(string.Format(MSG.Object_not_found, ndo_name, ndo_type_name));
            }
            return(res);
        }
示例#26
0
        private bool RecordHistory(RevisionedObject rdo_obj, ActionType actionType)
        {
            Spec o = rdo_obj as Spec;
            SpecChangeHistory h;

            if (actionType == ActionType.Delete)
            {
                h = new SpecChangeHistory(null, this.TxnDate, actionType);
            }
            else
            {
                h = new SpecChangeHistory(rdo_obj, this.TxnDate, actionType);
            }
            o.AssignToSpecChangeHistory(h);
            ObjScope.Transaction.Begin();
            ObjScope.Add(h);
            ObjScope.Transaction.Commit();
            return(true);
        }
示例#27
0
        private bool RecordHistory(NamedObject ndo_obj, ActionType actionType)
        {
            MfgOrder o = ndo_obj as MfgOrder;
            MfgOrderChangeHistory h;

            if (actionType == ActionType.Delete)
            {
                h = new MfgOrderChangeHistory(null, this.TxnDate, actionType);
            }
            else
            {
                h = new MfgOrderChangeHistory(ndo_obj, this.TxnDate, actionType);
            }
            o.AssignToMfgOrderChangeHistory(h);
            ObjScope.Transaction.Begin();
            ObjScope.Add(h);
            ObjScope.Transaction.Commit();
            return(true);
        }
示例#28
0
        protected void ReplaceCurrentStatus(CurrentStatus cs_new)
        {
            CurrentStatus cs_old   = Container.CurrentStatus;
            CurrentStatus cs_exist = ResolveCurrentStatus(cs_new);

            if (cs_exist == null)
            {
                ObjScope.Add(cs_new);
                Container.CurrentStatus = cs_new;
            }
            else
            {
                Container.CurrentStatus = cs_exist;
            }
            if (cs_old.Containers.Count == 0)
            {
                ObjScope.Remove(cs_old);
            }
        }
示例#29
0
文件: Split.cs 项目: kyjb2000/uo-mes
        protected override bool ModifyEntity()
        {
            bool success = base.ModifyEntity();

            foreach (SplitDetail d in ToContainerDetails)
            {
                UO_Model.Execution.Container co = new UO_Model.Execution.Container();
                Container.AssignToContainer(co);
                co.ContainerName = d.ContainerName;
                co.Qty           = d.Qty;
                Container.Qty   -= d.Qty;
                ObjScope.Add(co);
            }
            if (true == CloseWhenEmpty)
            {
                CloseContainerWhenEmpty(this.Container);
            }
            return(success);
        }
示例#30
0
        virtual public bool Remove(RevisionedObject rdo_obj)
        {
            RevisionedObject to_delete = ResolveRDO(rdo_obj);

            if (to_delete != null)
            {
                ObjScope.Transaction.Begin();
                if (1 == RDOBaseUsageCount(to_delete))
                {
                    ObjScope.Remove(to_delete.RevBase);
                }
                ObjScope.Remove(to_delete);
                ObjScope.Transaction.Commit();
                return(true);
            }
            else
            {
                return(false);
            }
        }