Esempio n. 1
0
        //提交单头
        protected void insert1(object sender, EventArgs e)
        {
            Return_headerDC DC           = new Return_headerDC();
            WoDC            DC2          = new WoDC();
            string          invoice_no   = invoice_no2.Value;
            string          quit_type    = quit_type1.Items[quit_type1.SelectedIndex].Value;
            int             enabled      = 0;
            int             subinventory = 0;
            string          remark       = remark1.InnerText;
            string          return_man   = Session["LoginName"].ToString();
            string          wo_no        = return_wo_no1.Value;

            if (String.IsNullOrEmpty(invoice_no))
            {
                PageUtil.showToast(this.Page, "请点击插入自动生成单据号!");
            }
            else if (String.IsNullOrEmpty(return_wo_no1.Value))
            {
                PageUtil.showToast(this.Page, "请输入工单号!");
            }

            List <ModelWO> wo;

            wo = DC2.getWOByWo_no(wo_no);
            if (wo == null)
            {
                PageUtil.showToast(this.Page, "没有这个工单号,请检查数据");
            }
            else
            {
                try
                {
                    enabled      = int.Parse(Enabled1.Items[Enabled1.SelectedIndex].Value);
                    subinventory = int.Parse(Subinventory1.Items[Subinventory1.SelectedIndex].Value);
                }
                catch (Exception ex)
                {
                    PageUtil.showToast(this.Page, "数据转换出错,请检查数据格式!");
                }
                bool a = DC.insertReturn_header(invoice_no, quit_type, subinventory, enabled, wo[0].Wo_key, return_man, remark);
                if (a == true)
                {
                    PageUtil.showToast(this.Page, "添加退料单头成功!");

                    Line_Repeater.DataSource = DC.getReturn_headerByLikeINVOICE_NO(invoice_no);
                    if (Line_Repeater.DataSource == null)
                    {
                        PageUtil.showToast(this, "数据库中没有对应数据,请添加数据后再查询");
                    }
                    else
                    {
                        Line_Repeater.DataBind();
                    }
                }
                else
                {
                    PageUtil.showToast(this.Page, "添加退料单头失败!");
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Insert(object sender, EventArgs e)
        {
            string part_no = DropDownList1.Items[DropDownList1.SelectedIndex].Value;
            string wo_no   = Wo_no.Value;
            string status  = Status.Value;
            string version = DropDownList2.Items[DropDownList2.SelectedIndex].Value;
            int    target_qty;

            //if (part_no.Length > 20)
            //{
            //    PageUtil.showToast(this, "输入的料号长度不得超过20个字符!");
            //    return;
            //}
            if (wo_no.Length > 50)
            {
                PageUtil.showToast(this, "输入的工单号长度不得超过50个字符!");
                return;
            }
            //if (Status.Value == "")
            //{
            //    status = 0;
            //}
            //else
            //{
            //    status = Convert.ToInt32(Status.Value);
            //}
            if (Target_qty.Value == "")
            {
                target_qty = 0;
            }
            else
            {
                try
                {
                    target_qty = Convert.ToInt32(Target_qty.Value);
                }
                catch
                {
                    PageUtil.showToast(this, "工单对应数量输入格式错误!");
                    return;
                }
            }
            if (part_no == "选择大料号")
            {
                PageUtil.showToast(this.Page, "请选择大料号");
                return;
            }
            if (version == "请选择版本号")
            {
                PageUtil.showToast(this.Page, "请选择版本号");
                return;
            }
            if (version == string.Empty || part_no == string.Empty || Status.Value == string.Empty || Target_qty.Value == string.Empty || wo_no == string.Empty)
            {
                PageUtil.showToast(this, "新增工单的输入数据不能为空!");
                return;
            }
            if (wodc.getWOByWo_no(wo_no) != null)
            {
                PageUtil.showToast(this, "该工单号已存在!");
                return;
            }
            bool flag = new bool();

            flag = wodc.insertWo(wo_no, status, target_qty, part_no, version, DateTime.Now);
            if (flag == true)
            {
                PageUtil.showToast(this, "添加数据成功!");
                Select(sender, e);
            }
            else
            {
                string add_work = "添加数据失败!";
                PageUtil.showToast(this, add_work);
            }
            //Part_no.Value = String.Empty;
            Wo_no.Value      = String.Empty;
            Status.Value     = String.Empty;
            Target_qty.Value = String.Empty;
        }