Example #1
0
        public int InsertMaterialOut(CMSMStruct.MaterialOutStruct mes)
        {
            con.Open();
            using (SqlTransaction tran = con.BeginTransaction())
            {
                try
                {
                    string sql1 = "insert into tbMaterialOut values('" + mes.strBatchNo + "'," + mes.strMaterialCode + ",'" + mes.strMaterialName + "','" + mes.strStandardUnit + "','" + mes.strUnit + "'," + mes.dPrice.ToString() + ",'" + mes.strProviderName + "','" + mes.strMaterialType + "'," + mes.dLastCount.ToString() + "," + mes.dOutCount.ToString() + "," + mes.dCount + ",'" + mes.strOperType + "',null,'" + mes.strOutDate + "','" + mes.strDeptID + "','" + mes.strOperDate + "','" + mes.strOperName + "')";
                    SqlHelper.ExecuteNonQuery(con, tran, CommandType.Text, sql1);

                    string sql2 = "update tbMaterialPara set cnnCurCount=" + mes.dCount + " where cnvcBatchNo='" + mes.strBatchNo + "' and cnnMaterialCode=" + mes.strMaterialCode;
                    SqlHelper.ExecuteNonQuery(con, tran, CommandType.Text, sql2);

                    tran.Commit();
                    return(1);
                }
                catch (Exception e)
                {
                    tran.Rollback();
                    clog.WriteLine(e);
                    return(0);
                }
                finally
                {
                    if (con.State == ConnectionState.Open)
                    {
                        con.Close();
                    }
                }
            }
        }
Example #2
0
        public bool InsertMaterialOut(CMSMStruct.MaterialOutStruct mes)
        {
            int recount = msa.InsertMaterialOut(mes);

            if (recount <= 0)
            {
                return(false);
            }

            return(true);
        }