示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            JavaScriptSerializer jss = new JavaScriptSerializer();
            string     sBarcodeNum   = this.Request["BarCodeNum"];
            Msg        msg           = PrintModel.GetBarCodeNum(sBarcodeNum);
            BarCodeRet ret           = new BarCodeRet();

            if (msg.Status)
            {
                Tbl_BarCodeInfo info = msg.UserData as Tbl_BarCodeInfo;
                ret.Status       = (int)MsgStatus.成功;
                ret.Message      = "";
                ret.BuildBunchId = int.Parse(info.BarCodeBatchID.ToString());
                ret.BuildName    = info.BuildName;
                ret.CreateTime   = info.CreateTime.ToString();
                ret.MetariesType = info.MateriesType;
                ret.ProjectName  = info.ProjectName;
                ret.WorkMapId    = info.WorkMapID;
            }
            else
            {
                ret.Status  = (int)MsgStatus.失败;
                ret.Message = msg.Message;
            }

            this.Response.Write(jss.Serialize(ret));
        }
        protected void ensure_Click(object sender, EventArgs e)
        {
            //首先判断是否存在此批次
            string MetriesId           = this.Request["BuildBunchId"];
            Tbl_OutProductBatch oBunch = new Tbl_OutProductBatch();

            oBunch.PlanID           = int.Parse(txbPlanId.Value);
            oBunch.MateriesID       = int.Parse(txbMateriesID.Value);
            oBunch.BuildID          = txbBuildID.Value;
            oBunch.BuildName        = txbBuildName.Value;
            oBunch.MateriesType     = txbMetriesType.Value;
            oBunch.MateriesTasbleID = int.Parse(txbMateriesID.Value);
            oBunch.ProjectName      = txbProductNum.Value;
            oBunch.Time             = DateTime.Now;
            oBunch.WorkMapID        = txbProductNum.Value;
            oBunch.Count            = int.Parse(txbCount.Value);
            oBunch.PreAdmStatus     = 1;
            oBunch.NowAdmStatus     = 1;
            oBunch.PreAdmTime       = DateTime.Now;
            oBunch.NowAdmTime       = DateTime.Now;
            oBunch.BuildBatchID     = int.Parse(txbBuildBunchID.Value);
            Msg msg = ProductModel.EditOutBunch(oBunch);

            if (CheckBox1.Checked)
            {
                Msg printMsg = PrintModel.GetBarCodeNum(oBunch.BuildBatchID, int.Parse(txbPrintCount.Text));
                if (printMsg.Status)
                {
                    CsPrint print = new CsPrint();
                    print.bartext = printMsg.UserData as List <string>;
                    print.printpreview();
                }
            }
            if (msg.Status)
            {
                PageHelper.ShowAlertMsg(this, "编辑成功");
            }
            else
            {
                PageHelper.ShowAlertMsg(this, "编辑失败:" + msg.Message);
            }
        }