예제 #1
0
파일: InventoryBll.cs 프로젝트: Core130/jr
        public EntityComputationUnit GetComputationUnit(string cComUnitName)
        {
            EntityComputationUnit entity = new EntityComputationUnit();
            string sql = @"select cComUnitCode,cGroupCode from ComputationUnit where cComUnitName=@cComUnitName";

            SqlParameter[] para =
            {
                new SqlParameter("@cComUnitName", cComUnitName),
            };
            DataTable dt = DB_SqlHelper.ExecuteDataTable(sql, para);

            if (dt != null && dt.Rows.Count > 0)
            {
                entity.cComUnitCode = dt.Rows[0]["cComUnitCode"].ToString();
                entity.cGroupCode   = dt.Rows[0]["cGroupCode"].ToString();
            }
            return(entity);
        }
예제 #2
0
파일: InventoryBll.cs 프로젝트: Core130/jr
        public string AddInventory(string UserCode, string PlainPassword,
                                   string StrAccID, int AccYear, string Act, EntityInventory entity, out int success)
        {
            success = 0;
            #region 验证

            // 字段必填项验证
            string msg = "";
            if (!entity.CheckEntity(out msg))
            {
                return(msg);
            }


            if (string.IsNullOrWhiteSpace(GetInventoryClass(entity.cInvCCode, true)))
            {
                return(string.Format("U8中不存在存货分类编码或非末级:{0}!", entity.cInvCCode));
            }

            EntityComputationUnit unit = new EntityComputationUnit();
            unit = GetComputationUnit(entity.cComUnitCode);
            if (string.IsNullOrWhiteSpace(unit.cComUnitCode))
            {
                return(string.Format("U8中没有维护计量单位:{0}!", entity.cComUnitCode));
            }
            #endregion
            entity.cComUnitCode = unit.cComUnitCode;
            entity.cGroupCode   = unit.cGroupCode;
            entity.cMaker       = GetUserName(UserCode);
            entity.bBarCode     = string.IsNullOrWhiteSpace(entity.cBarCode) ? 0 : 1;
            entity.cValueType   = string.IsNullOrWhiteSpace(entity.cValueType) ? "全月平均法" : entity.cValueType;
            string id = "";
            if (!string.IsNullOrWhiteSpace(GetInventory(entity.cInvCode)))
            {
                id = UpdateInventory(entity);
            }
            else
            {
                id = InsertInventory(entity);
            }
            success = string.IsNullOrWhiteSpace(id) ? 0 : 1;
            return(id);
        }