Esempio n. 1
0
        //导入实绩到NC
        protected void btntm_Click(object sender, EventArgs e)
        {
            try
            {
                string result = "";
                ApiDispatchOrder_SJ apifyd = new ApiDispatchOrder_SJ();
                string        filePath     = "~/FileInterface/download/nc_" + txtsendcode.Text + ".xml";
                string        xmlFileName  = System.Web.HttpContext.Current.Server.MapPath(filePath);
                List <string> resList      = apifyd.SendXmlApiDispatchOrder(txtsendcode.Text, xmlFileName, ltlempid.Text, 8);

                string jg = resList[0].ToString() == "1" ? "导入NC成功" : GetNCError(resList);
                result = "单据号:" + txtsendcode.Text + ",结果:" + jg;

                if (resList[0].ToString() == "1")
                {
                    var logger = Logger.CreateLogger(this.GetType());
                    logger.Info("导入NC成功发运单号:" + txtsendcode.Text);

                    if (tmd_dispatch.UpdateFydWW(txtsendcode.Text, 8, ltlempid.Text, hidempname.Value))
                    {
                        try
                        {
                            #region //生成远程质证书


                            DataTable dt = tmd_dispatchdetails.GetList(txtsendcode.Text).Tables[0];
                            if (dt.Rows.Count > 0)
                            {
                                for (int i = 0; i < dt.Rows.Count; i++)
                                {
                                    Mod_TMD_DISPATCHDETAILS moditem = tmd_dispatchdetails.GetModel(dt.Rows[i]["C_ID"].ToString());

                                    string[] dj = { "A", "AA", "AAA", "CK", "A1", "合格品", "B1", "B2", "C1", "C2" };
                                    if (dj.Contains(moditem.C_JUDGE_LEV_ZH))
                                    {
                                        bool res = trc_roll_prodcut.ExistsZZS(moditem.C_DISPATCH_ID, moditem.C_BATCH_NO);
                                        //检查是否重复批次
                                        if (!res)
                                        {
                                            DataTable dtRoll = trc_roll_prodcut.GetZZS("", "", moditem.C_DISPATCH_ID, "", "", moditem.C_BATCH_NO, "", "", "Y", "8", "", "").Tables[0];
                                            if (dtRoll.Rows.Count > 0)
                                            {
                                                DataTable dtCustStd = trc_roll_prodcut.GetCustStd_JH(dtRoll.Rows[0]["C_STD_CODE"].ToString(), dtRoll.Rows[0]["C_STL_GRD"].ToString(), dtRoll.Rows[0]["C_ZYX1"].ToString(), dtRoll.Rows[0]["C_ZYX2"].ToString()).Tables[0];

                                                DataTable dtJSXYH = trc_roll_prodcut.GetCustStd_JH(dtRoll.Rows[0]["C_STD_CODE"].ToString(), dtRoll.Rows[0]["C_STL_GRD"].ToString(), dtRoll.Rows[0]["C_TECH_PROT"].ToString(), dtRoll.Rows[0]["C_ZYX1"].ToString(), dtRoll.Rows[0]["C_ZYX2"].ToString()).Tables[0];

                                                #region //添加参数
                                                Mod_TQC_ZZS_INFO mod = new Mod_TQC_ZZS_INFO();
                                                mod.C_FYDH     = moditem.C_DISPATCH_ID;
                                                mod.C_BATCH_NO = moditem.C_BATCH_NO;
                                                mod.C_STOVE    = dtRoll.Rows[0]["C_STOVE"].ToString();
                                                mod.C_SPEC     = dtRoll.Rows[0]["C_SPEC"].ToString();
                                                mod.C_STL_GRD  = dtRoll.Rows[0]["C_STL_GRD"].ToString();
                                                mod.C_STD_CODE = dtRoll.Rows[0]["C_STD_CODE"].ToString();
                                                mod.D_CKSJ     = Convert.ToDateTime(dtRoll.Rows[0]["D_CKSJ"].ToString());
                                                mod.N_JZ       = Convert.ToDecimal(dtRoll.Rows[0]["N_WGT"].ToString());
                                                mod.N_NUM      = Convert.ToDecimal(dtRoll.Rows[0]["QUA"].ToString());
                                                mod.C_CH       = dtRoll.Rows[0]["C_CH"].ToString();

                                                mod.C_ZSH = randomnumber.GetZSH(); //证书号

                                                mod.C_QZR = "02";                  //签证人


                                                #region //生成二维码

                                                string msg = $@"http://60.6.254.51:808/Common/qualCert.aspx?fyd={mod.C_FYDH}&zsh={mod.C_ZSH}";

                                                Bitmap bt = GenByZXingNet(msg);            //调用生成二维码方法

                                                mod.C_IMG = $@"D:/QRCode/{mod.C_ZSH}.jpg"; //生成二维码图片命名

                                                string upPath = $@"~/QRCode/{mod.C_ZSH}.jpg";

                                                bt.Save(Server.MapPath(upPath));//保存二维码图片

                                                #endregion

                                                Mod_TS_CUSTFILE mod_TS_CUSTFILE = ts_custfile.GetCustModel(dtRoll.Rows[0]["C_CGC"].ToString());

                                                mod.C_CUST_NO   = mod_TS_CUSTFILE.C_NO;
                                                mod.C_CON_NO    = dtRoll.Rows[0]["C_CON_NO"].ToString();
                                                mod.C_CUST_NAME = dtRoll.Rows[0]["C_CUST_NAME"].ToString();
                                                mod.C_SH_NAME   = mod_TS_CUSTFILE.C_NAME;
                                                mod.C_MAT_NAME  = dtRoll.Rows[0]["C_MAT_DESC"].ToString();
                                                mod.C_STD_JH    = dtCustStd.Rows[0]["C_STD_JH"].ToString();
                                                mod.C_ZLDJ      = dtRoll.Rows[0]["C_JUDGE_LEV_ZH"].ToString();
                                                mod.C_JH_STATE  = dtRoll.Rows[0]["C_JH_STATE"].ToString();
                                                mod.C_JSXYH     = dtJSXYH.Rows[0]["C_JSXYH"].ToString();
                                                mod.C_XKZH      = dtRoll.Rows[0]["C_XKZH"].ToString();
                                                mod.C_BY1       = "8";

                                                #endregion

                                                trc_roll_prodcut.InsertZZS(mod);
                                            }
                                        }
                                    }
                                }
                            }


                            #endregion
                        }
                        catch (Exception)
                        {
                            throw;
                        }

                        this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "", "<script language='javascript'> _closemsg('" + result + "');</script>", false);
                        BindList();
                    }
                }
                else
                {
                    this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "", "<script language='javascript'> _closemsg('" + result + "');</script>", false);
                }
            }
            catch (Exception ex)
            {
                WebMsg.MessageBox(ex.Message);
            }
        }
Esempio n. 2
0
        private void GetZZS()
        {
            var logger = Logger.CreateLogger(this.GetType());

            try
            {
                DataTable dt = tmd_dispatchdetails.GetGPZZS();
                for (int j = 0; j < dt.Rows.Count; j++)
                {
                    string sendcode = dt.Rows[j]["C_DISPATCH_ID"].ToString();

                    #region//钢坯质证书

                    Bll_RandomNumber randomnumber = new Bll_RandomNumber();

                    DataTable gpdt = tmd_dispatchdetails.GetZJBList(sendcode).Tables[0];
                    for (int i = 0; i < gpdt.Rows.Count; i++)
                    {
                        if (gpdt.Rows[i]["N_STATUS"].ToString() == "6")//钢坯
                        {
                            bool res = trc_roll_prodcut.ExistsZZS(sendcode, gpdt.Rows[i]["C_BATCH_NO"].ToString(), gpdt.Rows[i]["C_STOVE"].ToString());
                            //检查是否重复批次
                            if (!res)
                            {
                                DataTable dtroll = trc_roll_prodcut.GetZZS("", "", sendcode, "", "", gpdt.Rows[i]["C_BATCH_NO"].ToString(), "", "", "N", gpdt.Rows[i]["N_STATUS"].ToString(), gpdt.Rows[i]["C_STOVE"].ToString(), "").Tables[0];
                                if (dtroll.Rows.Count > 0)
                                {
                                    DataTable dtCustStd = trc_roll_prodcut.GetCustStd_JH(dtroll.Rows[0]["C_STD_CODE"].ToString(), dtroll.Rows[0]["C_STL_GRD"].ToString(), dtroll.Rows[0]["C_ZYX1"].ToString(), dtroll.Rows[0]["C_ZYX2"].ToString()).Tables[0];

                                    DataTable dtJSXYH = trc_roll_prodcut.GetCustStd_JH(dtroll.Rows[0]["C_STD_CODE"].ToString(), dtroll.Rows[0]["C_STL_GRD"].ToString(), dtroll.Rows[0]["C_TECH_PROT"].ToString(), dtroll.Rows[0]["C_ZYX1"].ToString(), dtroll.Rows[0]["C_ZYX2"].ToString()).Tables[0];

                                    #region //添加参数
                                    Mod_TQC_ZZS_INFO mod = new Mod_TQC_ZZS_INFO();
                                    mod.C_FYDH     = sendcode;
                                    mod.C_BATCH_NO = dtroll.Rows[0]["C_BATCH_NO"].ToString();
                                    mod.C_STOVE    = dtroll.Rows[0]["C_STOVE"].ToString();
                                    mod.C_SPEC     = dtroll.Rows[0]["C_SPEC"].ToString();
                                    mod.C_STL_GRD  = dtroll.Rows[0]["C_STL_GRD"].ToString();
                                    mod.C_STD_CODE = dtroll.Rows[0]["C_STD_CODE"].ToString();
                                    mod.D_CKSJ     = Convert.ToDateTime(dtroll.Rows[0]["D_CKSJ"].ToString());
                                    mod.N_JZ       = Convert.ToDecimal(dtroll.Rows[0]["N_WGT"].ToString());
                                    mod.N_NUM      = Convert.ToDecimal(dtroll.Rows[0]["QUA"].ToString());
                                    mod.C_CH       = dtroll.Rows[0]["C_CH"].ToString();

                                    mod.C_ZSH = randomnumber.GetZSH(); //证书号

                                    mod.C_QZR = "01";                  //签证人


                                    #region //生成二维码

                                    string msg = $@"http://60.6.254.51:808/Common/qualCert.aspx?fyd={mod.C_FYDH}&zsh={mod.C_ZSH}";

                                    Bitmap bt = GenByZXingNet(msg);            //调用生成二维码方法

                                    mod.C_IMG = $@"D:/QRCode/{mod.C_ZSH}.jpg"; //生成二维码图片命名

                                    string upPath = $@"~/QRCode/{mod.C_ZSH}.jpg";

                                    bt.Save(Server.MapPath(upPath));//保存二维码图片


                                    #endregion

                                    Mod_TS_CUSTFILE mod_TS_CUSTFILE = ts_custfile.GetCustModel(dtroll.Rows[0]["C_CGC"].ToString());

                                    mod.C_CUST_NO   = mod_TS_CUSTFILE.C_NO;
                                    mod.C_CON_NO    = dtroll.Rows[0]["C_CON_NO"].ToString();
                                    mod.C_CUST_NAME = dtroll.Rows[0]["C_CUST_NAME"].ToString();
                                    mod.C_SH_NAME   = mod_TS_CUSTFILE.C_NAME;
                                    mod.C_MAT_NAME  = dtroll.Rows[0]["C_MAT_DESC"].ToString();
                                    mod.C_STD_JH    = dtCustStd.Rows[0]["C_STD_JH"].ToString();
                                    mod.C_ZLDJ      = dtroll.Rows[0]["C_JUDGE_LEV_ZH"].ToString();
                                    mod.C_JH_STATE  = dtroll.Rows[0]["C_JH_STATE"].ToString();
                                    mod.C_JSXYH     = dtJSXYH.Rows[0]["C_JSXYH"].ToString();
                                    mod.C_XKZH      = dtroll.Rows[0]["C_XKZH"].ToString();
                                    mod.C_BY1       = gpdt.Rows[i]["N_STATUS"].ToString();

                                    #endregion

                                    trc_roll_prodcut.InsertZZS(mod);
                                }
                            }
                        }
                    }

                    #endregion
                }
            }
            catch (Exception ex)
            {
                logger.Info("生成钢坯质证失败" + ex.Message);
            }
        }
Esempio n. 3
0
        //生成远程质证书
        protected void btnExport_Click(object sender, EventArgs e)
        {
            try
            {
                bool   result = true;
                string ww     = cbxww.Checked == true ? "Y" : "N";

                List <Mod_TQC_ZZS_INFO> list = new List <Mod_TQC_ZZS_INFO>();

                for (int i = 0; i < rptList.Items.Count; i++)
                {
                    HtmlInputCheckBox cbxID = (HtmlInputCheckBox)rptList.Items[i].FindControl("cbxID");
                    if (cbxID.Checked)
                    {
                        Bll_RandomNumber randomnumber = new Bll_RandomNumber();

                        #region //控件
                        Literal ltlC_FYDH         = (Literal)rptList.Items[i].FindControl("ltlC_FYDH");
                        Literal ltlC_BATCH_NO     = (Literal)rptList.Items[i].FindControl("ltlC_BATCH_NO");
                        Literal ltlC_JUDGE_LEV_ZH = (Literal)rptList.Items[i].FindControl("ltlC_JUDGE_LEV_ZH");
                        Literal ltlC_TYPE         = (Literal)rptList.Items[i].FindControl("ltlC_TYPE");//8线材/6钢坯
                        Literal ltlC_STOVE        = (Literal)rptList.Items[i].FindControl("ltlC_STOVE");
                        #endregion

                        string[] dj = { "A", "AA", "AAA", "CK", "A1", "合格品", "B1", "B2", "C1", "C2" };
                        if (dj.Contains(ltlC_JUDGE_LEV_ZH.Text))
                        {
                            bool res = ltlC_TYPE.Text == "8" ? trc_roll_prodcut.ExistsZZS(ltlC_FYDH.Text, ltlC_BATCH_NO.Text) : trc_roll_prodcut.ExistsZZS(ltlC_FYDH.Text, ltlC_BATCH_NO.Text, ltlC_STOVE.Text);
                            //检查是否重复批次
                            if (!res)
                            {
                                DataTable dt = trc_roll_prodcut.GetZZS("", "", ltlC_FYDH.Text, "", "", ltlC_BATCH_NO.Text, "", "", ww, ltlC_TYPE.Text, ltlC_STOVE.Text, "").Tables[0];
                                if (dt.Rows.Count > 0)
                                {
                                    DataTable dtCustStd = trc_roll_prodcut.GetCustStd_JH(dt.Rows[0]["C_STD_CODE"].ToString(), dt.Rows[0]["C_STL_GRD"].ToString(), dt.Rows[0]["C_ZYX1"].ToString(), dt.Rows[0]["C_ZYX2"].ToString()).Tables[0];

                                    DataTable dtJSXYH = trc_roll_prodcut.GetCustStd_JH(dt.Rows[0]["C_STD_CODE"].ToString(), dt.Rows[0]["C_STL_GRD"].ToString(), dt.Rows[0]["C_TECH_PROT"].ToString(), dt.Rows[0]["C_ZYX1"].ToString(), dt.Rows[0]["C_ZYX2"].ToString()).Tables[0];

                                    #region //添加参数
                                    Mod_TQC_ZZS_INFO mod = new Mod_TQC_ZZS_INFO();
                                    mod.C_FYDH     = ltlC_FYDH.Text;
                                    mod.C_BATCH_NO = ltlC_BATCH_NO.Text;
                                    mod.C_STOVE    = dt.Rows[0]["C_STOVE"].ToString();
                                    mod.C_SPEC     = dt.Rows[0]["C_SPEC"].ToString();
                                    mod.C_STL_GRD  = dt.Rows[0]["C_STL_GRD"].ToString();
                                    mod.C_STD_CODE = dt.Rows[0]["C_STD_CODE"].ToString();
                                    mod.D_CKSJ     = Convert.ToDateTime(dt.Rows[0]["D_CKSJ"].ToString());
                                    mod.N_JZ       = Convert.ToDecimal(dt.Rows[0]["N_WGT"].ToString());
                                    mod.N_NUM      = Convert.ToDecimal(dt.Rows[0]["QUA"].ToString());
                                    mod.C_CH       = dt.Rows[0]["C_CH"].ToString();

                                    mod.C_ZSH = randomnumber.GetZSH(); //证书号

                                    mod.C_QZR = ltlC_QZR.Text;         //签证人


                                    #region //生成二维码

                                    string msg = $@"http://60.6.254.51:808/Common/qualCert.aspx?fyd={mod.C_FYDH}&zsh={mod.C_ZSH}";

                                    Bitmap bt = GenByZXingNet(msg);            //调用生成二维码方法

                                    mod.C_IMG = $@"D:/QRCode/{mod.C_ZSH}.jpg"; //生成二维码图片命名

                                    string upPath = $@"~/QRCode/{mod.C_ZSH}.jpg";

                                    bt.Save(Server.MapPath(upPath));//保存二维码图片

                                    #endregion

                                    Mod_TS_CUSTFILE mod_TS_CUSTFILE = ts_custfile.GetCustModel(dt.Rows[0]["C_CGC"].ToString());

                                    mod.C_CUST_NO   = mod_TS_CUSTFILE.C_NO;
                                    mod.C_CON_NO    = dt.Rows[0]["C_CON_NO"].ToString();
                                    mod.C_CUST_NAME = dt.Rows[0]["C_CUST_NAME"].ToString();
                                    mod.C_SH_NAME   = mod_TS_CUSTFILE.C_NAME;
                                    mod.C_MAT_NAME  = dt.Rows[0]["C_MAT_DESC"].ToString();
                                    mod.C_STD_JH    = dtCustStd.Rows[0]["C_STD_JH"].ToString();
                                    mod.C_ZLDJ      = dt.Rows[0]["C_JUDGE_LEV_ZH"].ToString();
                                    mod.C_JH_STATE  = dt.Rows[0]["C_JH_STATE"].ToString();
                                    mod.C_JSXYH     = dtJSXYH.Rows[0]["C_JSXYH"].ToString();
                                    mod.C_XKZH      = dt.Rows[0]["C_XKZH"].ToString();
                                    mod.C_BY1       = ltlC_TYPE.Text;

                                    #endregion

                                    result = trc_roll_prodcut.InsertZZS(mod);
                                }
                            }
                        }
                    }
                }
                if (result)
                {
                    GetList();
                }
            }
            catch (Exception ex)
            {
                WebMsg.MessageBox(ex.Message);
            }
        }