Пример #1
0
    protected void btnSaveClose_Click(object sender, EventArgs e)
    {
        if (txtLot.Text == "" || lblLotprocess.Text == "")
        {
            JScript.Alert("请刷入批次号", this);
            return;
        }

        //模具编号
        string MouldLot = txtLot.Text.Substring(0, 3).ToString();

        //string result = Electroplate.EletroplateCheckIn(txtLot.Text,
        //                                ddlEqp.SelectedValue,
        //                                ddlWorkshop.SelectedValue,
        //                                lblWorksiteID.Text,
        //                                System.Web.HttpContext.Current.Request.Cookies["userID"].Value.ToString()
        //                                );
        string result = MouldComplete.MouldCompleteCheckIn(MouldLot,
                                                           txtLot.Text,
                                                           ddlEqp.SelectedValue,
                                                           ddlWorkshop.SelectedValue,
                                                           lblWorksiteID.Text,
                                                           System.Web.HttpContext.Current.Request.Cookies["userID"].Value.ToString()
                                                           );

        if (result == "success")
        {
            JScript.Alert("成型进站成功!", this);
            txtLot.Text = "";
            return;
        }
        else
        {
            JScript.Alert("成型进站失败!", this);
            return;
        }
    }
    protected void btnSaveClose_Click(object sender, EventArgs e)
    {
        //string a = ddlWorkshop.SelectedValue;
        if (txtLot.Text == "" || lblLotprocess.Text == "")
        {
            JScript.Alert("请刷入批次号", this);
            return;
        }
        #region 防止重复出站 add by lei.xue on 2017-8-29
        //模具编号
        string MouldLot = "";
        #region 判断条码是否有效
        if (txtLot.Text.Length > 3)
        {
            //外发或资产条码是否打印 条码第四位判断:W或Z
            if (txtLot.Text.Substring(3, 1).ToString() == "W")
            {
                if (CRUD.CheckMouldLabel("W", txtLot.Text) == "fail")
                {
                    JScript.Alert("该条码为打印!", this);
                    return;
                }
            }
            else if (txtLot.Text.Substring(3, 1).ToString() == "Z")
            {
                if (CRUD.CheckMouldLabel("Z", txtLot.Text) == "fail")
                {
                    JScript.Alert("该条码未打印!", this);
                    return;
                }
            }

            MouldLot = txtLot.Text.Substring(0, 3).ToString();
        }
        else
        {
            MouldLot = txtLot.Text;
        }
        #endregion
        //查询是否可以过站
        string result1 = CRUD.QueryStationOfLot(lblWorksiteID.Text, MouldLot);
        if (result1 != "success")
        {
            JScript.Alert(result1, this);
            txtLot.Text = "";
            return;
        }
        #endregion


        //检查是否是标签条码
        string strLabel = "";
        if (txtLot.Text.Length > 3)
        {
            strLabel = txtLot.Text;
        }

        string result      = "";
        string CountResult = "";
        if (cbxReworkID.Checked == false)
        {
            //result = WIP.WIPCheckOut(txtLot.Text.Substring(0, 3).ToString(), txtLot.Text, ddlEqp.SelectedValue
            //                        , ddlWorkshop.SelectedValue, ddlWorksite.SelectedValue, System.Web.HttpContext.Current.Request.Cookies["userID"].Value.ToString());
            result = MouldComplete.MouldCompleteCheckOut(txtLot.Text.Substring(0, 3).ToString(), strLabel, ddlEqp.SelectedValue
                                                         , ddlWorkshop.SelectedValue, lblWorksiteID.Text, System.Web.HttpContext.Current.Request.Cookies["userID"].Value.ToString(),
                                                         "Y", "N");
            CountResult = CRUD.UpdateMouldLotCount(txtLot.Text.Substring(0, 3).ToString());
            if (result == "success" && CountResult == "success")
            {
                //打印标签调用前台方法
                //ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>PrintLabel();</script>");
                JScript.Alert("成型出站成功!", this);
                ClearInfo();
                return;
            }
            else
            {
                JScript.Alert("成型出站失败!", this);
                return;
            }
        }
        else
        {
            //返工站点的流程编号
            string Flowidno = "";
            Flowidno = CRUD.GetFlowidno(txtLot.Text.Substring(0, 3).ToString(), ddlWorksite.SelectedValue);
            result   = MouldComplete.MouldCompleteCheckOut(txtLot.Text.Substring(0, 3).ToString(), strLabel, ddlEqp.SelectedValue
                                                           , ddlWorkshop.SelectedValue, ddlWorksite.SelectedValue, System.Web.HttpContext.Current.Request.Cookies["userID"].Value.ToString(),
                                                           "N", "Y");

            //记录返工记录
            CRUD.rework(lblWorksiteID.Text, ddlWorksite.SelectedValue, txtLot.Text.Substring(0, 3).ToString(),
                        System.Web.HttpContext.Current.Request.Cookies["userID"].Value.ToString(), Flowidno);

            if (result == "success")
            {
                JScript.Alert("成型出站成功!", this);
                ClearInfo();
                return;
            }
            else
            {
                JScript.Alert("成型出站失败!", this);
                return;
            }
        }
    }