예제 #1
0
 public static void Reset()
 {
     g_el_frameroot.Clear();
     Inspecting.Reset();
     App.AppHost.CallFunction("Extern_InspectorReset");
     App.AppDebugger.CallFunction("Extern_ResetDebugger");
 }
예제 #2
0
        /// <summary>
        /// 恢复人工检查初始状态
        /// </summary>
        private void Clear()
        {
            wip = new Inspecting();

            edtBarCode.Text       = "";
            edtRouteCheckInf.Text = "";

            grdvSubWIPCodes.BeginUpdate();
            grdSubWIPCodes.DataSource = null;
            grdvSubWIPCodes.EndUpdate();

            grdvFailureItems.BeginUpdate();
            grdFailureItems.DataSource = null;
            grdvFailureItems.EndUpdate();

            cboCheckResult.SelectedIndex = -1;

            grdFailureItems.UseEmbeddedNavigator            = false;
            grdvFailureItems.OptionsBehavior.Editable       = false;
            grdvFailureItems.OptionsView.NewItemRowPosition =
                DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.None;

            gpcInspectStatus.Enabled = false;

            btnBarCodeConf.Enabled = false;
        }
예제 #3
0
        protected override IntPtr OnPostedNotification(IntPtr wparam, IntPtr lparam)
        {
            Utils.Assert_UIThread();

            NOTIFICATION what = (NOTIFICATION)wparam.ToInt32();

            switch (what)
            {
            case NOTIFICATION.LOG_ARRIVED:
                _sdh.OnNotify_LOG_ARRIVED();
                break;

            case NOTIFICATION.CONTENT_CHANGED:
                Inspecting.OnPostedContentChange();
                break;

            case NOTIFICATION.LOAD_PAGE:
                State.OnPostedLoadPage();
                break;

            case NOTIFICATION.CLOSE_PAGE:
                State.ClosePage();
                break;
            }
            return(IntPtr.Zero);
        }
예제 #4
0
        ////

        //Return Back
        private void BackButton_Click(object sender, EventArgs e)
        {
            RefreshUniversitiesList();

            if (_inspectingList.Any())
            {
                _inspectingList.RemoveAt(_inspectingList.Count - 1);
            }

            switch (_inspecting)
            {
            case Inspecting.Groups:
                RefreshUniversitiesList();
                _inspecting = Inspecting.Universities;
                break;

            case Inspecting.Students:
                RefreshGroupsList(_inspectingList.Last());
                _inspecting = Inspecting.Groups;
                break;

            case Inspecting.StudentMarks:
                RefreshStudentsList(_inspectingList.Last());
                _inspecting = Inspecting.Students;
                break;
            }
        }
예제 #5
0
 public Form1()
 {
     InitializeComponent();
     _inspecting         = Inspecting.Universities;
     _inspectingList     = new List <int>();
     _dataAccessProvider = new DataAccessProvider();
     RefreshUniversitiesList();
 }
예제 #6
0
 /// <summary>
 /// 人工检查实体对象中是否有子板需要送修
 /// </summary>
 /// <param name="wipInspecting"></param>
 /// <returns></returns>
 private bool NeedRepair(Inspecting wipInspecting)
 {
     foreach (SubWIPIDCodeInfo_Inspecting subWIP in wipInspecting.SubWIPIDCodes)
     {
         if (subWIP.InspectingStatus == 3)
         {
             return(true);
         }
     }
     return(false);
 }
예제 #7
0
        protected override bool OnMouse(SciterElement se, SciterXBehaviors.MOUSE_PARAMS prms)
        {
#if OSX
            bool control_shift = AppKit.NSEvent.CurrentModifierFlags == (AppKit.NSEventModifierMask.ShiftKeyMask | AppKit.NSEventModifierMask.CommandKeyMask);
#else
            bool control_shift = prms.alt_state == (SciterXBehaviors.KEYBOARD_STATES.CONTROL_KEY_PRESSED | SciterXBehaviors.KEYBOARD_STATES.SHIFT_KEY_PRESSED);
#endif

            int cmd = ((int)SciterXBehaviors.MOUSE_EVENTS.MOUSE_DOWN) | ((int)SciterXBehaviors.PHASE_MASK.SINKING);
            if ((int)prms.cmd == cmd &&
                control_shift &&
                prms.button_state == 1)
            {
                SciterElement target = new SciterElement(prms.target);
                Inspecting.UserPageElemInspect(target);
                if (target.Parent != null)               // BUG workaround for <text> elements
                {
                    App.AppHost.CallFunction("Extern_InspectElement", Inspecting.g_el_inspected.ExpandoValue);
                }

                _wasCtrlShiftMouseDown = true;
                return(true);
            }

            bool sinking = prms.cmd.HasFlag((SciterXBehaviors.MOUSE_EVENTS)SciterXBehaviors.PHASE_MASK.SINKING);
            if (_wasCtrlShiftMouseDown && sinking)
            {
                if (prms.cmd.HasFlag(SciterXBehaviors.MOUSE_EVENTS.MOUSE_UP) || prms.cmd.HasFlag(SciterXBehaviors.MOUSE_EVENTS.MOUSE_LEAVE))
                {
                    App.AppHost.InvokePost(() => _wasCtrlShiftMouseDown = false);
                }
                return(true);
            }

            /*if(prms.cmd == SciterXBehaviors.MOUSE_EVENTS.MOUSE_DOWN && prms.button_state == (uint)SciterXBehaviors.MOUSE_BUTTONS.PROP_MOUSE_BUTTON)// right-click + MOUSE_DOWN on bubbling
             * {
             *      // user disabled?
             *      SciterValue sv = App.AppHost.EvalScript("View.omnidata.right_inspect_disable");
             *      if(sv.Get(false))
             *              return true;
             *
             *      SciterElement target = new SciterElement(prms.target);
             *      Inspecting.UserPageElemInspect(target);
             *      if(target.Parent != null)// BUG workaround for <text> elements
             *              App.AppHost.CallFunction("Extern_InspectElement", target.ExpandoValue);
             *
             *      return true;
             * }*/
            return(false);
        }
예제 #8
0
        static void InternalLoad(string url, bool is_file)
        {
            if (page_loaded)
            {
                pending_load_url = url;
                ClosePage();
                App.AppHost.PostNotification(new IntPtr((int)Host.NOTIFICATION.LOAD_PAGE), IntPtr.Zero);
                return;
            }

            long      took_load;
            long      took_inspecting;
            Stopwatch sw = new Stopwatch();

            {
                sw.Start();
                page_loaded       = true;
                page_current_url  = url;
                page_current_file = null;

                App.AppDebugger.CallFunction("Extern_ReloadDebugger", new SciterValue(url));
                App.AppHost.CallFunction("View_LoadURL", new SciterValue(url), new SciterValue(is_file));
                took_load = sw.ElapsedMilliseconds;
            }

            if (page_loaded)           // page inside debugger, and was closed
            {
                sw.Restart();
                Inspecting.Reload();
                took_inspecting = sw.ElapsedMilliseconds;
                sw.Stop();

                //g_host.eval_script("Settings.ns_data.config.show()");

                /*var sv_stats = AppHost.EvalScript("(Settings.ns_data.config#output-load-statistics)");
                 * if(sv_stats.Get(false))
                 * {
                 *      Task.Run(() =>
                 *      {
                 *              Thread.Sleep(100);
                 *              AppHost.InvokePost(() =>
                 *              {
                 *                      Inspecting.CountElements();
                 *                      DbgOutput.InternalOutput($"{took_load}ms page load time; DOM count: {Inspecting.g_dom_count_elem} elements, {Inspecting.g_dom_count_node} nodes", true);
                 *              });
                 *      });
                 * }*/
            }
        }
예제 #9
0
        private void SelectCellFromUniversityRow(DataGridViewCellMouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                ShowContextMenu(e);
                return;
            }

            var universityRepository = new UniversityRepository();

            var table        = universityRepository.FindAll();
            var universityId = table.Rows[e.RowIndex].Field <int>("UniversityID");

            _inspecting = Inspecting.Groups;
            _inspectingList.Add(universityId);
            RefreshGroupsList(universityId);
        }
예제 #10
0
        private void SelectCellFromStudentRow(DataGridViewCellMouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                ShowContextMenu(e);
                return;
            }

            var studentRepository = new StudentRepository();

            var table     = studentRepository.FindAllFrom(_inspectingList.Last());
            var studentId = table.Rows[e.RowIndex].Field <int>("StudentID");

            _inspecting = Inspecting.StudentMarks;
            _inspectingList.Add(studentId);
            RefreshRecordsList(studentId);
        }
예제 #11
0
        private void SelectCellFromGroupRow(DataGridViewCellMouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                ShowContextMenu(e);
                return;
            }

            var groupRepository = new GroupRepository();

            var table   = groupRepository.FindAllFrom(_inspectingList.Last());
            var groupId = table.Rows[e.RowIndex].Field <int>("GroupID");

            _inspecting = Inspecting.Students;
            _inspectingList.Add(groupId);
            RefreshStudentsList(groupId);
        }
예제 #12
0
 protected override bool OnEvent(SciterElement elSource, SciterElement elTarget, SciterXBehaviors.BEHAVIOR_EVENTS type, IntPtr reason, SciterValue data)
 {
     if (type == SciterXBehaviors.BEHAVIOR_EVENTS.CONTENT_CHANGED)
     {
         Inspecting.OnContentChanged();
     }
     else if (type == SciterXBehaviors.BEHAVIOR_EVENTS.DOCUMENT_CREATED)
     {
         Inspecting.OnContentChanged();
         //State.AppHost.Notify(HostMain.NOTIFICATION.PAGE_LOADED)
     }
     else if (type == SciterXBehaviors.BEHAVIOR_EVENTS.DOCUMENT_COMPLETE)
     {
         // Sciter always sends a BEHAVIOR_EVENTS.CONTENT_CHANGED even before BEHAVIOR_EVENTS.DOCUMENT_COMPLETE
         //g_host.PostNotification(Host.NOTIFICATION.PAGE_LOADED);
     }
     else if (type == SciterXBehaviors.BEHAVIOR_EVENTS.CLICK)
     {
     }
     return(base.OnEvent(elSource, elTarget, type, reason, data));
 }
예제 #13
0
        /// <summary>
        /// 获取用于人工检查的在制品以及子在制品信息
        /// </summary>
        /// <param name="communityID">社区标识</param>
        /// <param name="wipIDCode">在制品标识</param>
        /// <param name="productLeaf">当前选中产品叶标识</param>
        /// <param name="workUnitLeaf">当前选中工位叶标识</param>
        /// <param name="isEnhanced">是否增强</param>
        /// <param name="sysLogID">系统登录标识</param>
        /// <returns>Inspecting</returns>
        public IRAPJsonResult mfn_GetInfo_WIPIDCode(
            int communityID,
            string wipIDCode,
            int productLeaf,
            int workUnitLeaf,
            bool isEnhanced,
            long sysLogID,
            out int errCode,
            out string errText)
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                Inspecting     inspectingObject = new Inspecting();
                IRAPJsonResult jsonResult       = ufn_GetInfo_WIPIDCode(
                    communityID,
                    wipIDCode,
                    productLeaf,
                    workUnitLeaf,
                    isEnhanced,
                    sysLogID,
                    out errCode,
                    out errText);
                if (errCode == 0)
                {
                    WIPIDCode wip = IRAPJsonSerializer.Deserializer(
                        jsonResult.Json,
                        typeof(WIPIDCode)) as WIPIDCode;
                    inspectingObject.MainWIPIDCode = wip;

                    if (wip.BarcodeStatus == 0 && wip.RoutingStatus == 0)
                    {
                        jsonResult = ufn_GetList_SubWIPIDCodes(
                            communityID,
                            wip.WIPCode,
                            productLeaf,
                            workUnitLeaf,
                            sysLogID,
                            out errCode,
                            out errText);
                        if (errCode == 0)
                        {
                            List <SubWIPIDCodeInfo> subWIPs = IRAPJsonSerializer.Deserializer(
                                jsonResult.Json,
                                typeof(List <SubWIPIDCodeInfo>)) as List <SubWIPIDCodeInfo>;
                            foreach (SubWIPIDCodeInfo subWIP in subWIPs)
                            {
                                inspectingObject.SubWIPIDCodes.Add(
                                    new SubWIPIDCodeInfo_Inspecting()
                                {
                                    Ordinal         = subWIP.Ordinal,
                                    T102LeafID      = subWIP.T102LeafID,
                                    ProductNo       = subWIP.ProductNo,
                                    SubWIPGroupID   = subWIP.SubWIPGroupID,
                                    SubWIPIDCode    = subWIP.SubWIPIDCode,
                                    Scrapped        = subWIP.Scrapped,
                                    PWOCategoryLeaf = subWIP.PWOCategoryLeaf,
                                });
                            }
                        }
                    }
                }

                return(Json(inspectingObject));
            }
            catch (Exception error)
            {
                errCode = 99000;
                errText = error.Message;
                WriteLog.Instance.Write(errText, strProcedureName);
                WriteLog.Instance.Write(error.StackTrace, strProcedureName);

                return(Json(new Inspecting()));
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
예제 #14
0
 public void Host_RefreshElemDetails() => Inspecting.RefreshElemDetails();
예제 #15
0
        /// <summary>
        /// 人工检查记录保存
        /// </summary>
        /// <param name="userCode">系统登录用户号</param>
        /// <param name="agencyLeaf">登录用户的机构叶标识</param>
        /// <param name="productLeaf">产品叶标识</param>
        /// <param name="workUnitLeaf">工位叶标识</param>
        /// <param name="t107EntityID">工位实体标识</param>
        /// <param name="t132LeafID">产品族叶标识</param>
        /// <param name="containerNo">容器号</param>
        /// <param name="functionName">功能名称</param>
        /// <param name="wipInspecting">人工检查实体对象</param>
        /// <param name="confirmTime">检查确认时间</param>
        public void msp_SaveFact_ManualInspecting(
            int communityID,
            string userCode,
            int agencyLeaf,
            int productLeaf,
            int workUnitLeaf,
            int t107EntityID,
            int t132LeafID,
            string containerNo,
            string functionName,
            Inspecting wipInspecting,
            DateTime confirmTime,
            long sysLogID,
            out int errCode,
            out string errText)
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                using (WCFClient client = new WCFClient())
                {
                    Hashtable hashParams = new Hashtable();

                    #region 将函数参数加入 Hashtable 中
                    hashParams.Add("communityID", communityID);
                    hashParams.Add("userCode", userCode);
                    hashParams.Add("agencyLeaf", agencyLeaf);
                    hashParams.Add("productLeaf", productLeaf);
                    hashParams.Add("workUnitLeaf", workUnitLeaf);
                    hashParams.Add("t107EntityID", t107EntityID);
                    hashParams.Add("t132LeafID", t132LeafID);
                    hashParams.Add("containerNo", containerNo);
                    hashParams.Add("functionName", functionName);
                    hashParams.Add("wipInspecting", wipInspecting);
                    hashParams.Add("confirmTime", confirmTime);
                    hashParams.Add("sysLogID", sysLogID);
                    WriteLog.Instance.Write(
                        string.Format(
                            "执行存储过程 msp_SaveFact_ManualInspecting,输入参数:" +
                            "CommunityID={0}|UserCode={1}|AgencyLeaf={2}|" +
                            "ProductLeaf={3}|WorkUnitLeaf={4}|T107EntityID={5}|" +
                            "T132LeafID={6}|ContainerNo={7}|FunctionName={8}|" +
                            "WIPInspecting.Count={9}|ConfirmTime={10}|SysLogID={11}",
                            communityID, userCode, agencyLeaf, productLeaf, workUnitLeaf,
                            t107EntityID, t132LeafID, containerNo, functionName,
                            wipInspecting.SubWIPIDCodes.Count,
                            confirmTime,
                            sysLogID),
                        strProcedureName);
                    #endregion

                    #region 调用应用服务过程,并解析返回值
                    object rlt = client.WCFRESTFul(
                        "IRAP.BL.MES.dll",
                        "IRAP.BL.MES.ManualInspecting",
                        "msp_SaveFact_ManualInspecting",
                        hashParams,
                        out errCode,
                        out errText);
                    WriteLog.Instance.Write(
                        string.Format(
                            "({0}){1}",
                            errCode,
                            errText),
                        strProcedureName);
                    #endregion
                }
            }
            catch (Exception error)
            {
                WriteLog.Instance.Write(error.Message, strProcedureName);
                errCode = -1001;
                errText = error.Message;
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
예제 #16
0
        /// <summary>
        /// 人工检查记录保存
        /// </summary>
        /// <param name="userCode">系统登录用户号</param>
        /// <param name="agencyLeaf">登录用户的机构叶标识</param>
        /// <param name="productLeaf">产品叶标识</param>
        /// <param name="workUnitLeaf">工位叶标识</param>
        /// <param name="t107EntityID">工位实体标识</param>
        /// <param name="t132LeafID">产品族叶标识</param>
        /// <param name="containerNo">容器号</param>
        /// <param name="functionName">功能名称</param>
        /// <param name="wipInspecting">人工检查实体对象</param>
        /// <param name="confirmTime">检查确认时间</param>
        /// <returns></returns>
        public IRAPJsonResult msp_SaveFact_ManualInspecting(
            int communityID,
            string userCode,
            int agencyLeaf,
            int productLeaf,
            int workUnitLeaf,
            int t107EntityID,
            int t132LeafID,
            string containerNo,
            string functionName,
            Inspecting wipInspecting,
            DateTime confirmTime,
            long sysLogID,
            out int errCode,
            out string errText)
        {
            string strProcedureName = string.Format("{0}.{1}",
                                                    className, MethodBase.GetCurrentMethod().Name);

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                WriteLog.Instance.Write(string.Format("CommunityID={0}|UserCode={1}|AgencyLeaf={2}|" +
                                                      "ProductLeaf={3}|WorkUnitLeaf={4}|T107EntityID={5}|T132LeafID={6}|" +
                                                      "ContainerNo={7}|FunctionName={8}|ConfirmTime={9}|SysLogID={10}",
                                                      communityID,
                                                      userCode,
                                                      agencyLeaf,
                                                      productLeaf,
                                                      workUnitLeaf,
                                                      t107EntityID,
                                                      t132LeafID,
                                                      containerNo,
                                                      functionName,
                                                      confirmTime,
                                                      sysLogID),
                                        strProcedureName);

                using (IRAPSQLConnection conn = new IRAPSQLConnection())
                {
                    long transactNo = 0;

                    #region 申请交易号
                    WriteLog.Instance.Write("开始申请交易号", strProcedureName);
                    try
                    {
                        ssp_GetSequenceNo(
                            communityID,
                            "NextTransactNo",
                            1,
                            sysLogID,
                            "-6",
                            "",
                            ref transactNo,
                            out errCode,
                            out errText);
                        WriteLog.Instance.Write(
                            string.Format("({0}){1}", errCode, errText),
                            strProcedureName);
                        if (errCode == 0)
                        {
                            WriteLog.Instance.Write(string.Format("申请到的交易号:{0}", transactNo),
                                                    strProcedureName);
                        }
                        else
                        {
                            errCode = 99001;
                            errText = string.Format("申请交易号出错:{0}", errText);
                            WriteLog.Instance.Write(errText, strProcedureName);
                            return(Json(errCode));
                        }
                    }
                    catch (Exception error)
                    {
                        errCode = 99001;
                        errText = string.Format("申请交易号出错:{0}", error.Message);
                        WriteLog.Instance.Write(errText, strProcedureName);
                        WriteLog.Instance.Write(error.StackTrace, strProcedureName);
                        return(Json(errCode));
                    }
                    #endregion

                    int passByTimes = ufn_GetWIPPassByTimes(
                        communityID, productLeaf, workUnitLeaf, wipInspecting.MainWIPIDCode.WIPCode);
                    long stdcycleTimeOfOperation = ufn_GetStdCycleTimeOfOperation(
                        communityID, productLeaf, workUnitLeaf);
                    long unscheduledPDTofAWorkUnit = ufn_GetUnscheduledPDTofAWorkUnit(
                        communityID,
                        workUnitLeaf,
                        wipInspecting.MainWIPIDCode.MoveInTime,
                        confirmTime,
                        sysLogID);

                    // 开始事务处理
                    conn.BeginTran();

                    foreach (SubWIPIDCodeInfo_Inspecting wip in wipInspecting.SubWIPIDCodes)
                    {
                        long factID              = 0;
                        long partitionPolicy     = 0;
                        long factPartitioningKey = 0;

                        #region 申请事实编号
                        try
                        {
                            factID = IRAPDAL.UTS.Instance.msp_GetSequenceNo("NextFactNo", 1);
                        }
                        catch (Exception error)
                        {
                            errCode = 99001;
                            errText = string.Format("申请事实编号出错:{0}", error.Message);
                            WriteLog.Instance.Write(errText, strProcedureName);
                            WriteLog.Instance.Write(error.StackTrace, strProcedureName);

                            conn.RollBack();

                            return(Json(errCode));
                        }
                        if (factID <= 0)
                        {
                            errCode = 99001;
                            errText = "未申请到事实编号!";
                            WriteLog.Instance.Write(errText, strProcedureName);

                            conn.RollBack();

                            return(Json(errCode));
                        }
                        else
                        {
                            WriteLog.Instance.Write(string.Format("申请到的事实编号:{0}", factID),
                                                    strProcedureName);
                        }
                        #endregion

                        #region 在行集事实表(RSFact_Inspecting)中添加纪录
                        WriteLog.Instance.Write("保存行集事实", strProcedureName);
                        partitionPolicy = Int64.Parse(DateTime.Now.Year.ToString() +
                                                      (100000000L + communityID).ToString().Substring(1, 8) + "0006");

                        wip.GetListFromDataTable();
                        for (int i = 0; i < wip.FailureItems.Count; i++)
                        {
                            RSFact_Inspecting rsFactInspecting = new RSFact_Inspecting()
                            {
                                FactID          = factID,
                                PartitionPolicy = partitionPolicy,
                                WFInstanceID    = wipInspecting.MainWIPIDCode.PWONo,
                                Ordinal         = i + 1,
                                T101LeafID      = wip.FailureItems[i].T101LeafID,
                                T110LeafID      = wip.FailureItems[i].T110LeafID,
                                T118LeafID      = wip.FailureItems[i].T118LeafID,
                                T216LeafID      = wip.FailureItems[i].T216LeafID,
                                T183LeafID      = wip.FailureItems[i].T183LeafID,
                                T184LeafID      = wip.FailureItems[i].T184LeafID,
                                CntDefect       = wip.FailureItems[i].CntDefect,
                            };
                            try
                            {
                                conn.Insert(rsFactInspecting);
                            }
                            catch (Exception error)
                            {
                                errCode = 99002;
                                errText = string.Format("保存行集事实失败:{0}", error.Message);
                                WriteLog.Instance.Write(errText, strProcedureName);
                                WriteLog.Instance.Write(error.StackTrace, strProcedureName);

                                conn.RollBack();

                                return(Json(errCode));
                            }
                        }
                        WriteLog.Instance.Write("行集事实保存完成", strProcedureName);
                        #endregion

                        #region 在辅助事实表(AuxFact_PDC)中添加纪录
                        WriteLog.Instance.Write("保存辅助事实", strProcedureName);
                        partitionPolicy = Int64.Parse(communityID.ToString() +
                                                      (100000000L + t132LeafID).ToString().Substring(1, 8) +
                                                      DateTime.Now.Year.ToString());
                        factPartitioningKey = Int64.Parse(DateTime.Now.Year.ToString() +
                                                          (100000000L + communityID).ToString().Substring(1, 8) + "0006");

                        AuxFact_PDC auxFactPDC = new AuxFact_PDC()
                        {
                            FactID                = factID,
                            PartitioningKey       = partitionPolicy,
                            FactPartitioningKey   = factPartitioningKey,
                            WFInstanceID          = wipInspecting.MainWIPIDCode.PWONo,
                            WIPCode               = wip.SubWIPIDCode,
                            AltWIPCode            = wipInspecting.MainWIPIDCode.AltWIPCode,
                            SerialNumber          = wipInspecting.MainWIPIDCode.SerialNumber,
                            LotNumber             = wipInspecting.MainWIPIDCode.LotNumber,
                            ContainerNo           = containerNo,
                            FakePreventingCode    = "",
                            CustomerAssignedID    = "",
                            ElectronicProductCode = "",
                        };

                        #region 计算 QCStatus 值
                        if (wip.InspectingStatus == 3)
                        {
                            wip.QCStatus = CalculateQCStatus(communityID,
                                                             productLeaf,
                                                             workUnitLeaf,
                                                             wipInspecting.MainWIPIDCode.PWONo,
                                                             wip.QCStatus);
                        }
                        auxFactPDC.QCStatus = wip.QCStatus;
                        #endregion

                        try
                        {
                            conn.Insert(auxFactPDC);
                        }
                        catch (Exception error)
                        {
                            errCode = 99002;
                            errText = string.Format("保存辅助事实表失败:{0}", error.Message);
                            WriteLog.Instance.Write(errText, strProcedureName);
                            WriteLog.Instance.Write(error.StackTrace, strProcedureName);

                            conn.RollBack();

                            return(Json(errCode));
                        }
                        WriteLog.Instance.Write("辅助事实保存完成", strProcedureName);
                        #endregion

                        #region 在主事实表(FixedFact_MES)中添加记录
                        WriteLog.Instance.Write("保存主事实", strProcedureName);
                        partitionPolicy = Int64.Parse(DateTime.Now.Year.ToString() +
                                                      (100000000L + communityID).ToString().Substring(1, 8) + "0006");

                        #region 准备需要保存的数据
                        FixedFact_MES fixedFactMES = new FixedFact_MES()
                        {
                            FactID          = factID,
                            PartitioningKey = partitionPolicy,
                            TransactNo      = transactNo,
                            IsFixed         = 1,
                            OpID            = 6,
                            OpType          = wip.InspectingStatus,
                            BusinessDate    = confirmTime,
                            Code01          = wipInspecting.MainWIPIDCode.T102Code,
                            Code02          = wipInspecting.MainWIPIDCode.T120Code,
                            Code03          = wipInspecting.MainWIPIDCode.T107Code,
                            Code04          = wipInspecting.MainWIPIDCode.T126Code,
                            Code05          = wipInspecting.MainWIPIDCode.T1Code,
                            Code06          = wipInspecting.MainWIPIDCode.T134Code,
                            Code07          = wipInspecting.MainWIPIDCode.T181Code,
                            Code08          = wipInspecting.MainWIPIDCode.T1002Code,
                            Leaf01          = wipInspecting.MainWIPIDCode.T102Leaf,
                            Leaf02          = wipInspecting.MainWIPIDCode.T120Leaf,
                            Leaf03          = wipInspecting.MainWIPIDCode.T107Leaf,
                            Leaf04          = wipInspecting.MainWIPIDCode.T126Leaf,
                            Leaf05          = wipInspecting.MainWIPIDCode.T1Leaf,
                            Leaf06          = wipInspecting.MainWIPIDCode.T134Leaf,
                            Leaf07          = wipInspecting.MainWIPIDCode.T181Leaf,
                            Leaf08          = wipInspecting.MainWIPIDCode.T1002Leaf,
                        };

                        fixedFactMES.AChecksum     = 0;
                        fixedFactMES.CorrelationID = 0;
                        fixedFactMES.Metric01      = 1; // 此处应该由前台传入
                        fixedFactMES.Metric02      = passByTimes;
                        fixedFactMES.Metric03      = 1;

                        fixedFactMES.Metric04 = Int64.Parse((confirmTime -
                                                             wipInspecting.MainWIPIDCode.MoveInTime).TotalMilliseconds.ToString()) /
                                                wipInspecting.MainWIPIDCode.NumOfSubWIPs;
                        fixedFactMES.Metric05 = fixedFactMES.Metric04 + fixedFactMES.Metric02;
                        fixedFactMES.Metric06 = fixedFactMES.Metric04 + fixedFactMES.Metric03;
                        fixedFactMES.Metric07 = stdcycleTimeOfOperation;
                        fixedFactMES.Metric08 = TimeParser.LocalTimeToUnix(confirmTime);
                        fixedFactMES.Metric09 = (long)(wipInspecting.ScanTime -
                                                       wipInspecting.MainWIPIDCode.MoveInTime).TotalMilliseconds;
                        fixedFactMES.Metric10      = unscheduledPDTofAWorkUnit;
                        fixedFactMES.BChecksum     = 0;
                        fixedFactMES.MeasurementID = 0;
                        fixedFactMES.WFInstanceID  = wipInspecting.MainWIPIDCode.PWONo;
                        fixedFactMES.Remark        = functionName;
                        fixedFactMES.LinkedFactID  = 0;
                        #endregion

                        #region 添加记录
                        try
                        {
                            conn.Insert(fixedFactMES);
                        }
                        catch (Exception error)
                        {
                            errCode = 99002;
                            errText = string.Format("保存主事实表失败:{0}", error.Message);
                            WriteLog.Instance.Write(errText, strProcedureName);
                            WriteLog.Instance.Write(error.StackTrace, strProcedureName);

                            conn.RollBack();

                            return(Json(errCode));
                        }
                        #endregion
                        WriteLog.Instance.Write("主事实保存完成", strProcedureName);
                        #endregion
                    }

                    if (NeedRepair(wipInspecting))
                    {
                        #region 调整路由送修(IRAPMES..usp_MarkNGWIP)
                        {
                            WriteLog.Instance.Write("调整路由送修", strProcedureName);
                            WIP wip = new WIP();
                            try
                            {
                                IRAPJsonResult rlt = wip.usp_MarkNGWIP(
                                    communityID,
                                    productLeaf,
                                    wipInspecting.MainWIPIDCode.WIPCode,
                                    wipInspecting.MainWIPIDCode.LotNumber,
                                    containerNo,
                                    wipInspecting.MainWIPIDCode.PWONo,
                                    wipInspecting.MainWIPIDCode.QCStatus,
                                    workUnitLeaf,
                                    0,
                                    sysLogID,
                                    out errCode,
                                    out errText);
                                WriteLog.Instance.Write(string.Format("({0}){1}", errCode, errText),
                                                        strProcedureName);
                                if (errCode != 0)
                                {
                                    conn.RollBack();
                                    return(Json(errCode));
                                }
                            }
                            catch (Exception error)
                            {
                                errCode = 99003;
                                errText = string.Format("调用 usp_MarkNGWIP 失败:{0}", error.Message);
                                WriteLog.Instance.Write(errText, strProcedureName);
                                WriteLog.Instance.Write(error.StackTrace, strProcedureName);

                                conn.RollBack();

                                return(Json(errCode));
                            }
                            WriteLog.Instance.Write("路由送修调整完毕", strProcedureName);
                        }
                        #endregion
                    }
                    else
                    {
                        #region 调整路由(IRAPMES..usp_WIPForward)
                        {
                            WriteLog.Instance.Write("调整路由", strProcedureName);
                            WIP wip = new WIP();
                            try
                            {
                                IRAPJsonResult rlt = wip.usp_WIPForward(
                                    communityID,
                                    productLeaf,
                                    wipInspecting.MainWIPIDCode.WIPPattern,
                                    wipInspecting.MainWIPIDCode.LotNumber,
                                    containerNo,
                                    wipInspecting.MainWIPIDCode.PWONo,
                                    wipInspecting.MainWIPIDCode.QCStatus,
                                    workUnitLeaf,
                                    0,
                                    sysLogID,
                                    out errCode,
                                    out errText);
                                WriteLog.Instance.Write(string.Format("({0}){1}", errCode, errText),
                                                        strProcedureName);
                                if (errCode != 0)
                                {
                                    conn.RollBack();

                                    return(Json(errCode));
                                }
                            }
                            catch (Exception error)
                            {
                                errCode = 99003;
                                errText = string.Format("调用 usp_WIPForward 失败:{0}", error.Message);
                                WriteLog.Instance.Write(errText, strProcedureName);
                                WriteLog.Instance.Write(error.StackTrace, strProcedureName);

                                conn.RollBack();

                                return(Json(errCode));
                            }
                            WriteLog.Instance.Write("路由调整完成", strProcedureName);
                        }
                        #endregion
                    }

                    #region 更新工位的第二个瞬态属性(IRAPMDM..stb060)
                    {
                        WriteLog.Instance.Write("更新工位第二个瞬态属性", strProcedureName);
                        int partitioningKey             = Int32.Parse(communityID.ToString() + "0107");
                        List <IDataParameter> paramList = new List <IDataParameter>();
                        paramList.Add(new IRAPProcParameter("@Statistic02", DbType.Int64, TimeParser.LocalTimeToUnix(confirmTime)));
                        paramList.Add(new IRAPProcParameter("@PartitioningKey", DbType.Int64, partitioningKey));
                        paramList.Add(new IRAPProcParameter("@T107EntityID", DbType.Int32, t107EntityID));
                        try
                        {
                            conn.Update("UPDATE IRAPMDM..stb060 SET Statistic02 = @Statistic02 " +
                                        "WHERE PartitioningKey = @PartitioningKey AND EntityID = @T107EntityID",
                                        paramList);
                        }
                        catch (Exception error)
                        {
                            errCode = 99004;
                            errText = string.Format("更新工位(IRAPMDM..stb060)的第二个瞬态属性失败:{0}", error.Message);
                            WriteLog.Instance.Write(errText, strProcedureName);
                            WriteLog.Instance.Write(error.StackTrace, strProcedureName);

                            conn.RollBack();

                            return(Json(errCode));
                        }
                        WriteLog.Instance.Write("工位第二个瞬态属性更新完成", strProcedureName);
                    }
                    #endregion

                    #region 交易复核(IRAPMES..stb010)
                    {
                        WriteLog.Instance.Write("交易复核", strProcedureName);
                        long partitionPolicy = Int64.Parse(confirmTime.Year.ToString() +
                                                           (100000000L + communityID).ToString().Substring(1, 8));
                        List <IDataParameter> paramList = new List <IDataParameter>();
                        paramList.Add(new IRAPProcParameter("@OkayTime", DbType.DateTime2, confirmTime));
                        paramList.Add(new IRAPProcParameter("@AgencyLeaf2", DbType.Int32, agencyLeaf));
                        paramList.Add(new IRAPProcParameter("@Checked", DbType.String, userCode));
                        paramList.Add(new IRAPProcParameter("@TransactNo", DbType.Int64, transactNo));
                        paramList.Add(new IRAPProcParameter("@PartitioningKey", DbType.Int64, partitionPolicy));
                        try
                        {
                            conn.Update("UPDATE IRAPMES..stb010 SET OkayTime = @OkayTime, " +
                                        "AgencyLeaf2 = @AgencyLeaf2, Checked = @Checked, " +
                                        "Status = 5 WHERE TransactNo = @TransactNo AND " +
                                        "PartitioningKey = @PartitioningKey",
                                        paramList);
                        }
                        catch (Exception error)
                        {
                            errCode = 99004;
                            errText = string.Format("交易复核(IRAPMES..stb010)失败:{0}", error.Message);
                            WriteLog.Instance.Write(errText, strProcedureName);
                            WriteLog.Instance.Write(error.StackTrace, strProcedureName);

                            conn.RollBack();

                            return(Json(errCode));
                        }
                        WriteLog.Instance.Write("交易复核完成", strProcedureName);
                    }
                    #endregion

                    conn.Commit();

                    errCode = 0;
                    errText = "保存成功";

                    return(Json(errCode));
                }
            }
            finally
            {
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }
        }
예제 #17
0
        private void edtBarCode_Validating(object sender, CancelEventArgs e)
        {
            string strProcedureName =
                string.Format(
                    "{0}.{1}",
                    className,
                    MethodBase.GetCurrentMethod().Name);

            if (Options.SelectProduct == null || Options.SelectStation == null)
            {
                WriteLog.Instance.Write("还没有配置产品列表和工位列表", strProcedureName);
                XtraMessageBox.Show(
                    "还没有配置产品列表和工位列表",
                    "系统信息",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);

                Clear();

                return;
            }

            if (edtBarCode.Text.Trim() == "")
            {
                edtRouteCheckInf.Text = "";

                Clear();

                return;
            }

            string strBarCode = edtBarCode.Text;

            if (strBarCode == wip.MainWIPIDCode.AltWIPCode)
            {
                return;
            }
            else
            {
                Clear();
            }

            WriteLog.Instance.WriteBeginSplitter(strProcedureName);
            try
            {
                edtBarCode.Text = strBarCode;

                wip = new Inspecting()
                {
                    ScanTime = DateTime.Now,
                };
                int    errCode = 0;
                string errText = "";

                IRAPMESClient.Instance.mfn_GetInfo_WIPIDCode(
                    IRAPUser.Instance.CommunityID,
                    strBarCode,
                    Options.SelectProduct.T102LeafID,
                    Options.SelectStation.T107LeafID,
                    true,
                    IRAPUser.Instance.SysLogID,
                    ref wip,
                    out errCode,
                    out errText);
                WriteLog.Instance.Write(
                    string.Format("({0}){1}", errCode, errText),
                    strProcedureName);
                if (errCode == 0)
                {
                    if (wip.MainWIPIDCode.BarcodeStatus == 0)
                    {
                        if (wip.MainWIPIDCode.RoutingStatus == 0)
                        {
                            edtRouteCheckInf.Text = wip.MainWIPIDCode.RoutingStatusStr;
                            edtRouteCheckInf.Properties.AppearanceDisabled.ForeColor = Color.Blue;

                            grdSubWIPCodes.DataSource = wip.SubWIPIDCodes;
                            grdvSubWIPCodes.BestFitColumns();

                            if (wip.SubWIPIDCodes.Count > 0)
                            {
                                grdvSubWIPCodes.FocusedRowHandle = 0;
                            }

                            gpcInspectStatus.Enabled = true;
                            e.Cancel = false;
                        }
                        else
                        {
                            edtBarCode.Text = "";

                            edtRouteCheckInf.Text = wip.MainWIPIDCode.RoutingStatusStr;
                            edtRouteCheckInf.Properties.AppearanceDisabled.ForeColor = Color.Red;

                            gpcInspectStatus.Enabled = false;
                            e.Cancel = true;
                        }
                    }
                    else
                    {
                        edtBarCode.Text = "";

                        edtRouteCheckInf.Text = wip.MainWIPIDCode.BarcodeStatusStr;
                        edtRouteCheckInf.Properties.AppearanceDisabled.ForeColor = Color.Red;

                        gpcInspectStatus.Enabled = false;
                        e.Cancel = true;
                    }
                }
                else
                {
                    edtBarCode.Text = "";

                    edtRouteCheckInf.Text = errText;
                    edtRouteCheckInf.Properties.AppearanceDisabled.ForeColor = Color.Red;

                    gpcInspectStatus.Enabled = false;
                    e.Cancel = true;
                }
            }
            catch (Exception error)
            {
                edtBarCode.Text = "";

                WriteLog.Instance.Write(error.Message, strProcedureName);
                WriteLog.Instance.Write(error.StackTrace, strProcedureName);

                edtRouteCheckInf.Text = error.Message;
                edtRouteCheckInf.Properties.AppearanceDisabled.ForeColor = Color.Red;

                gpcInspectStatus.Enabled = false;
                e.Cancel = true;
            }
            finally
            {
                btnBarCodeConf.Enabled = CanSave();
                WriteLog.Instance.WriteEndSplitter(strProcedureName);
            }

            if (btnBarCodeConf.Enabled)
            {
                btnBarCodeConf.Focus();
            }
        }
예제 #18
0
 public void Host_InspectElement(SciterValue[] args) => Inspecting.UserPageElemInspect(new SciterElement(args[0]));