/// <summary>
    /// 数据保存
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        BTallyBillData model = new BTallyBillData();
        BTallyBillBB tallyBillBB = new BTallyBillBB();
        try
        {
            if (this.State == "1")
            {
                this.SetModel(ref model);
                model.isrtDt = DateTime.Now.ToString();
                model.isrtEmpId = this.currentUser.empId;
                this.IdValue = tallyBillBB.AddRecord(model);
            }
            else if (this.State == "2")
            {
                model = tallyBillBB.GetModel(this.IdValue);
                this.SetModel(ref model);
                model.updtDt = DateTime.Now.ToString();
                model.updtEmpId = this.currentUser.empId;
                tallyBillBB.ModifyRecord(model);
            }
        }
        catch (Exception ex)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "ShowErr", "ShowErr(\"" + Server.UrlEncode(ex.Message) + "\",3);", true);
            return;
        }
        finally
        {
            tallyBillBB.Dispose();
        }

        Response.Redirect("BTallyBillList.aspx?&itemno=" + this.itemNo + "&pTypeNo=main", false);
    }
Example #2
0
    public int SaveTallyBill(string strPalletNo, int isrtEmpId, string strInstantState)
    {
        BTallyBillBB tallyBillBB = new BTallyBillBB();

        try
        {
            int mainId = 0;
            DataSet ds = new DataSet();
            BTallyBillData tallyBillModel = new BTallyBillData();

            //判断当前托盘是否已经理货
            ds = tallyBillBB.GetList("palletNo='" + strPalletNo + "' and isInStock=0");
            if (ds.Tables[0].Rows.Count == 0)
            {
                tallyBillModel.palletNo = strPalletNo;//托盘条码号
                tallyBillModel.isInStock = false;//是否入库
                tallyBillModel.isrtDt = System.DateTime.Now.ToString();//添加时间
                tallyBillModel.isrtEmpId = isrtEmpId;//添加人
                tallyBillModel.instantState = "01";//理货中

                mainId = tallyBillBB.AddRecord(tallyBillModel);//称重理货单ID赋值
            }
            else
            {
                mainId = Convert.ToInt32(ds.Tables[0].Rows[0]["id"]);//称重理货单ID赋值

                if (strInstantState == "02")//理货已完成
                {
                    tallyBillModel = tallyBillBB.GetModel(mainId);

                    tallyBillModel.instantState = "02";//理货已完成

                    tallyBillBB.ModifyRecord(tallyBillModel);
                }
            }

            return mainId;
        }
        finally
        {
            tallyBillBB.Dispose();
        }
    }