protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.txtBillTypeCode.Text.Length == 0)
         {
             JScript.Instance.ShowMessage(this, "请选择移位单据类型");
             return;
         }
         if (this.txtWHCODE.Text.Length == 0)
         {
             JScript.Instance.ShowMessage(this, "请选择移位的仓库");
             return;
         }
         if (this.hdnOpFlag.Value == "0")
         {
             billMaster.BILLNO        = this.txtBillNo.Text;
             billMaster.BILLDATE      = Convert.ToDateTime(this.txtBillDate.Text);
             billMaster.BILLTYPE      = this.txtBillTypeCode.Text;
             billMaster.OPERATEPERSON = Session["EmployeeCode"].ToString();
             billMaster.STATUS        = "1";
             billMaster.WH_CODE       = this.txtWHCODE.Text;
             billMaster.MEMO          = this.txtMemo.Text.Trim().Replace("\'", "\''");
             billMaster.Insert();
             this.hdnOpFlag.Value            = "1";
             this.ddlBillState.SelectedValue = "1";
             JScript.Instance.ShowMessage(this, "移位单汇总信息保存成功");
         }
         else
         {
             billMaster.BILLNO        = this.txtBillNo.Text;
             billMaster.BILLDATE      = Convert.ToDateTime(this.txtBillDate.Text);
             billMaster.BILLTYPE      = this.txtBillTypeCode.Text;
             billMaster.OPERATEPERSON = this.txtOperatePerson.Text;
             billMaster.STATUS        = "1";
             billMaster.WH_CODE       = this.txtWHCODE.Text;
             billMaster.MEMO          = this.txtMemo.Text.Trim().Replace("\'", "\''");
             billMaster.Update();
             JScript.Instance.ShowMessage(this, "移位单汇总信息修改成功");
         }
     }
     catch (Exception exp)
     {
         JScript.Instance.ShowMessage(this, exp.Message);
     }
 }
Example #2
0
    protected void btnCreateBill_Click(object sender, EventArgs e)
    {
        //JScript.Instance.ShowMessage(this, this.moveList.Items.Count.ToString());
        string billNo = this.billNo.Value;

        if (this.billNo.Value == "")
        {
            billNo                   = billMaster.GetNewBillNo();
            billMaster.BILLNO        = billNo;
            billMaster.BILLDATE      = System.DateTime.Now;
            billMaster.BILLTYPE      = "";
            billMaster.STATUS        = "1";
            billMaster.OPERATEPERSON = Session["EmployeeCode"].ToString();
            billMaster.Insert();
        }
        else
        {
            DataSet ds = billDetail.QueryByBillNo(billNo);
            for (int k = 0; k < ds.Tables[0].Rows.Count; k++)
            {
                ds.Tables[0].Rows[k].Delete();
            }
            billDetail.Delete(ds);
        }
        for (int i = 0; i < moveList.Items.Count; i++)
        {
            billDetail.BILLNO       = billNo;
            billDetail.OUT_CELLCODE = moveList.Items[i].Cells[0].Text;
            billDetail.PRODUCTCODE  = moveList.Items[i].Cells[2].Text;
            billDetail.IN_CELLCODE  = moveList.Items[i].Cells[4].Text;
            billDetail.UNITCODE     = moveList.Items[i].Cells[6].Text;
            billDetail.QUANTITY     = Convert.ToDecimal(moveList.Items[i].Cells[8].Text);
            billDetail.STATUS       = "0";
            billDetail.Insert();
        }

        Response.Redirect("MoveBillEditPage.aspx?BILLNO=" + billNo);
    }