Example #1
0
        private bool CheckAccept(RouteDetailOperationStepVm rd) // ANY True mean sn will stuck
        {
            if (rd.accept_code.Count <= 0)
            {
                return(false);                           // if not accept code found = no accept configured
            }
            foreach (string routeAcceptSlug in rd.accept_code)
            {
                var routeAcceptDetail = GetWsObj.GetSnipByRouteAcceptName(routeAcceptSlug);
                if (routeAcceptDetail == null)
                {
                    return(SetMsgAndReturn(EnumMessage.SystemObjectNotFoundBySlug, new List <string>()
                    {
                        EnumMpObject.RouteAccept.ToString(), routeAcceptSlug
                    }, false));
                }

                if (routeAcceptDetail.snippet.code != "" & routeAcceptDetail.snippet.status == EnumStatus.A.ToString())
                {
                    var snD = new MpFlexLib.Classes.SnDetailVm()
                    {
                        number = "test"
                    };
                    if (GetFlexObj.ExecuteScript(routeAcceptDetail.snippet.code, GetWsObj.TokenAccessKey, snD))
                    {
                        return(SetMsgAndReturn(EnumMessage.SnipReturnFalse, new List <string>()
                        {
                            routeAcceptDetail.snippet.name, routeAcceptDetail.snippet.title, routeAcceptDetail.snippet.returnmessage
                        }, true));
                    }
                }
            }
            return(false);
        }
Example #2
0
 public string ValidateNextCode()
 {
     if (RouteDetail.next_code.Count <= 0)
     {
         return(RouteDetail.next_pass);                                  // if no config no action
     }
     foreach (NextCodeVm code in RouteDetail.next_code)
     {
         var snip = (SnipVm)GetWsObj.GetSnippetBySlug(code.slug);
         if (!(snip.code != "" & snip.status == EnumStatus.A.ToString()))
         {
             continue;
         }
         if (!GetFlexObj.ExecuteScript(snip.code, GetWsObj.TokenAccessKey))
         {
             continue;
         }
         SetMsgAndReturn(EnumMessage.NextCodeExecute, new List <string>()
         {
             snip.name, snip.title, snip.returnmessage, RouteDetail.next_pass, RouteDetail.operation
         }, true);
         RouteDetail.next_pass = RouteDetail.operation;
         return(RouteDetail.operation);
     }
     return(RouteDetail.next_pass);
 }
Example #3
0
        private bool ExecuteScript()
        {
            Debug.Print("ParamItem - ExecuteScript");
            if (ParamItemDetail == null)
            {
                ReturnMsg = GetMsgObj.GetSystemMsg(EnumMessage.ParameterItemDetailNotFound, new List <string>()
                {
                    ParamItem.title
                });
                return(false);
            }
            if (ParamItemDetail.snippet == null)
            {
                return(true);
            }
            var c = GetWsObj.GetSnippetBySlug(ParamItemDetail.snippet);

            if (c == null)
            {
                return(true);
            }
            // If GetFlexObj.ExecuteScript(c.code, FormObject) Then
            if (GetFlexObj.ExecuteScript(c.code, GetWsObj.TokenAccessKey))
            {
                return(true);
            }
            ReturnMsg = GetMsgObj.GetSystemMsg(EnumMessage.SnipReturnFalse, new List <string>()
            {
                c.name, c.title, c.returnmessage
            });
            return(false);
        }
Example #4
0
        private bool RegisterSnValidation(string sn)
        {
            var woDetail = GetWsObj.GetWorkOrderDetail(ShopOrder);

            if (woDetail == null)
            {
                return(SetMsgAndReturn(EnumMessage.WorkOrderNotFound, new List <string>()
                {
                    ShopOrder
                }, false));
            }
            if (!GetWsObj.RexExValidate(sn, woDetail.regexp))
            {
                return(SetMsgAndReturn(EnumMessage.SnFormatNotMatch, new List <string>()
                {
                    sn, SnFormat
                }, false));
            }

            SnDetail = new SnDetailVm()
            {
                number = sn, current_operation = Operation
            };
            Route = woDetail.routing.name;
            if (!CheckRouting())
            {
                return(SetMsgAndReturn(EnumMessage.RouteNotFound, new List <string>()
                {
                    SnDetail.number
                }, false));
            }
            UnitSn = sn;
            return(true);
        }
Example #5
0
 private bool CheckExcept(RouteDetailOperationStepVm rd) // ANY True mean sn will stuck
 {
     if (rd.reject_code.Count <= 0)
     {
         return(true);                           // if not reject code found = no reject configured
     }
     foreach (var routeRejectSlug in rd.reject_code)
     {
         var routeRejectDetail = GetWsObj.GetSnipByRouteRejectName(routeRejectSlug);
         if (routeRejectDetail == null)
         {
             return(SetMsgAndReturn(EnumMessage.SystemObjectNotFoundBySlug, new List <string>()
             {
                 EnumMpObject.RouteReject.ToString(), routeRejectSlug
             }, false));
         }
         if (routeRejectDetail.snippet.code != "" & routeRejectDetail.snippet.code == EnumStatus.A.ToString())
         {
             if (GetFlexObj.ExecuteScript(routeRejectDetail.snippet.code, GetWsObj.TokenAccessKey))
             {
                 return(SetMsgAndReturn(EnumMessage.SnipReturnFalse, new List <string>()
                 {
                     routeRejectDetail.snippet.name, routeRejectDetail.snippet.title, routeRejectDetail.snippet.returnmessage
                 }, false));
             }
         }
     }
     return(true);
 }
Example #6
0
 public AutoCompleteStringCollection GetReworkCodeAutoComplete()
 {
     // TODO : need to change bom name to variable
     if (_bomName == "")
     {
         _bomName = "bom001";
     }
     return(_objControlBuild.GetAutoComplete(GetWsObj.GetBomDetail(_bomName), "rd"));
 }
Example #7
0
        public int EngageTransactionUpdate(SnEngageUpdateVm data, string slug)
        {
            var resultvalue = (int)GetWsObj.GetSnUpdate(data, slug);

            SetMsgAndReturn(resultvalue > 0 ? EnumMessage.TransactionSuccess : EnumMessage.TransactionParamFail, new List <string>()
            {
                data.number
            }, true);
            return(resultvalue);
        }
Example #8
0
        public int PerformTransaction(SnPerformVm data, string sn)
        {
            var resultvalue = (int)GetWsObj.GetSnPerform(data);

            SetMsgAndReturn(resultvalue > 0 ? EnumMessage.TransactionSuccess : EnumMessage.TransactionParamFail, new List <string>()
            {
                sn
            }, true);
            return(resultvalue);
        }
Example #9
0
        public int PerformParametric(List <ParameterItemValueVm> data, string sn)
        {
            var lastResult = 0;

            foreach (var d in data)
            {
                var resultvalue = (int)GetWsObj.GetParametric(d);
                ReturnMsg = GetMsgObj.GetSystemMsg(resultvalue > 0 ? EnumMessage.TransactionParamSuccess : EnumMessage.TransactionParamFail, sn);
                if (resultvalue == 0)
                {
                    return(resultvalue);
                }
                lastResult = resultvalue;
            }
            return(lastResult);
        }
Example #10
0
 public bool InputValidation(string value)
 {
     if (ParamItem.input_type == EnumParamItemType.TEXT.ToString() && !GetWsObj.RexExValidate(value, ParamItem.regexp))
     {
         ReturnMsg = GetMsgObj.GetSystemMsg(EnumMessage.SnFormatNotMatch, new List <string>()
         {
             value, ParamItem.regexp
         });
         return(false);
     }
     if (ExecuteScript())
     {
         return(true);
     }
     Result = EnumResult.Fail;
     return(false);
 }
Example #11
0
        private bool CheckRouting() // Start Check Routing process
        {
            if (Operation == "")
            {
                return(SetMsgAndReturn(EnumMessage.SystemNoOperationAssign, new List <string>()
                {
                    SnDetail.number
                }, false));
            }
            var routeDetailList = GetWsObj.GetRoutingDetail(Route, Operation);

            if (routeDetailList == null)
            {
                return(SetMsgAndReturn(EnumMessage.OperationNotFoundInRoute, new List <string>()
                {
                    Route, Operation
                }, false));
            }

            if (!routeDetailList.Any())
            {
                return(SetMsgAndReturn(EnumMessage.OperationNotFoundInRoute, new List <string>()
                {
                    Route, Operation
                }, false));
            }
            RouteDetail = GetWsObj.GetRoutingDetailList(routeDetailList[0].url);
            if (Operation == SnDetail.current_operation)
            {
                return(CheckExcept(RouteDetail));
            }

            if (CheckAccept(RouteDetail))
            {
                return(true);                         // if true = accept route
            }
            return(SetMsgAndReturn(EnumMessage.WrongOperation, new List <string>()
            {
                SnDetail.number, SnDetail.current_operation
            }, false));
        }
Example #12
0
        private bool GetRouting()
        {
            if (SnDetail?.routing != null)
            {
                var routeListVm = GetWsObj.GetRoute(SnDetail.routing);
                if (routeListVm != null)
                {
                    Route = routeListVm.name; return(true);
                }
            }

            if (SnDetail == null)
            {
                return(true);
            }
            var wo = GetWsObj.GetWorkOrderBySlug(SnDetail.workorder);

            if (wo == null)
            {
                return(false);
            }
            ShopOrderName = wo.name;
            if (wo.routing.name != "")
            {
                Route = wo.routing.name; return(true);
            }

            var prod = GetWsObj.GetProductBySlug(wo.product);

            if (prod == null)
            {
                return(false);
            }
            Route = prod.routing.name;

            return(true);
        }
Example #13
0
 public List <ReworkVm> GetRework(string defectCode) => (List <ReworkVm>)GetWsObj.GetReworkCode(defectCode);
Example #14
0
 public List <FailureVm> GetFailure() => (List <FailureVm>)GetWsObj.GetFailureCode();
Example #15
0
 public List <DefectVm> GetDefect(string failureCode) => (List <DefectVm>)GetWsObj.GetDefectCode(failureCode);
Example #16
0
 public UnitFailureVm GetUnitFailure() => (UnitFailureVm)GetWsObj.GetFailureHistory(UnitSn);
Example #17
0
 public UnitFailureVm GetUnitFailure(string sn)
 {
     UnitSn = sn;
     return((UnitFailureVm)GetWsObj.GetFailureHistory(UnitSn));
 }
Example #18
0
 public object GetItemBySlug(string parameterSlug) => GetWsObj.GetItemBySlug(parameterSlug);
Example #19
0
 public WorkOrderDetailVm GetOrderDetailVm(string order)
 {
     return(GetWsObj.GetWorkOrderDetail(order));
 }
Example #20
0
 public List <WorkOrderVm> GetOrderVm(string prod)
 {
     return(GetWsObj.GetWorkOrder(prod));
 }
Example #21
0
 public List <WorkOrderVm> GetOrderVm()
 {
     return(GetWsObj.GetWorkOrder());
 }
Example #22
0
 public AutoCompleteStringCollection GetDefectCodeAutoComplete()
 {
     // TODO : need to change bom name to variable
     return((AutoCompleteStringCollection)GetWsObj.GetDefectCode());
 }
Example #23
0
        public List <WorkOrderVm> GetProductVm()
        {
            List <WorkOrderVm> result = GetWsObj.GetWorkOrder();

            return(result ?? new List <WorkOrderVm>());
        }
Example #24
0
 public object GetParameterBySlug(string routingDetailSlug) => GetWsObj.GetParameterBySlug(routingDetailSlug);
Example #25
0
        public bool CheckSerialNumber(string sn)
        {
            if (sn == "")
            {
                return(SetMsgAndReturn(EnumMessage.SnNotFound, new List <string>()
                {
                    "Serial Number"
                }, false));
            }

            var snVmList = GetWsObj.GetSn(sn);
            var snVm     = snVmList.Any() ? snVmList.First() : null;

            if (ShopOrder != null && snVm == null)
            {
                return(RegisterSnValidation(sn));                                    // register station
            }
            if (snVm == null)
            {
                return(SetMsgAndReturn(EnumMessage.SnNotFound, new List <string>()
                {
                    sn
                }, false));
            }
            if (!snVm.wip)
            {
                return(SetMsgAndReturn(EnumMessage.SnNotInWip, new List <string>()
                {
                    sn
                }, false));
            }

            SnDetail = GetWsObj.GetJsonObjectUrl <SnDetailVm>(snVm.url);
            if (SnDetail == null)
            {
                return(SetMsgAndReturn(EnumMessage.SnDetailNotFound, new List <string>()
                {
                    sn
                }, false));
            }
            if (!GetRouting())
            {
                return(SetMsgAndReturn(EnumMessage.RouteNotFound, new List <string>()
                {
                    SnDetail.number
                }, false));
            }

            if (!CheckRouting())
            {
                return(SetMsgAndReturn(EnumMessage.RouteNotFound, new List <string> {
                    SnDetail.number
                }, false));
            }
            if (UnitSn != sn)
            {
                sn = UnitSn;               // this supports when flex overwrite txtsn
            }
            return(SetMsgAndReturn(EnumMessage.UnitIsReady, new List <string>()
            {
                SnDetail.number
            }, true));
        }
Example #26
0
 public ParameterVm GetParameterProfileDetail(string paramSlug)
 {
     return(GetWsObj != null?GetWsObj.GetParameterProfileDetail(paramSlug) : new ParameterVm());
 }
Example #27
0
 public object GetOrder()
 {
     return(GetWsObj.GetWorkOrder());
 }