吉特仓库管理系统- 基本问题解答

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了吉特仓库管理系统- 基本问题解答相关的知识,希望对你有一定的参考价值。

 

  吉特仓储管理系统简单版开源也有一段时间了,得到了众多的开发者和软件开发企业的咨询和青睐,在此期间也经历了版权纠纷等问题,反而到现在好像也不是版权纠纷的问题了,软件著作权这个东西本身就很难以区分, 经过上次这么一闹之后卖源代码的网站反而越来越多了,实在是令人防不慎防,由于工作也就懒得去搭理这些东西了,就跟朋友说的我这是自找难受。由于个人工作时间的问题,有些技术方面的问题实在不好一一解答,今天写一篇博文总结一下各位所问道的问题。

 

  一. 哪里修改数据连接

    这个是所有开发者中问的最多的问题,基本上加我QQ问我问题的基本也就是这个了。数据库配置不是在web.config 中, 请各位不要被web.config中的连接误导了,这是由于新建项目自动生成的代码。 数据库配置文件路径:

    \\Git.Storage.Web\\Configs\\Data\\Database.config    以下是数据库连接代码,其中database 节点中的name=“JooWMS” 不能随意修改, 这个对应映射到实体匹配关系,一般情况情况我设置为了与最初数据库名相同。

<?xml version="1.0" encoding="utf-8" ?>
<databaseList>
  <database name="JooWMS">
    <connectionString>Server=127.0.0.1;database=JooWMS;user id=sa;Password=000000</connectionString>
  </database>
</databaseList>

 

  二. 编译不通过

    如果遇到编译不通过的可以先查看各个项目中dll引用是否有警告,如果遇到黄色dll引用警告则是dll文件丢失。 解决办法是找到相应的dll重新添加引用或使用nuget重新下载

 

  三. 实体为什么使用partial关键字

[TableAttribute(DbName = "JooWMS", Name = "OutStoDetail", PrimaryKeyName = "ID", IsInternal = false)]
    public partial class OutStoDetailEntity : BaseEntity
    {
        public OutStoDetailEntity()
        {
        }

        [DataMapping(ColumnName = "ID", DbType = DbType.Int32, Length = 4, CanNull = false, DefaultValue = null, PrimaryKey = true, AutoIncrement = true, IsMap = true)]
        public Int32 ID { get; set; }

        public OutStoDetailEntity IncludeID(bool flag)
        {
            if (flag && !this.ColumnList.Contains("ID"))
            {
                this.ColumnList.Add("ID");
            }
            return this;
        }

        [DataMapping(ColumnName = "SnNum", DbType = DbType.String, Length = 50, CanNull = false, DefaultValue = null, PrimaryKey = false, AutoIncrement = false, IsMap = true)]
        public string SnNum { get; set; }

        public OutStoDetailEntity IncludeSnNum(bool flag)
        {
            if (flag && !this.ColumnList.Contains("SnNum"))
            {
                this.ColumnList.Add("SnNum");
            }
            return this;
        }

        [DataMapping(ColumnName = "OrderNum", DbType = DbType.String, Length = 50, CanNull = false, DefaultValue = null, PrimaryKey = false, AutoIncrement = false, IsMap = true)]
        public string OrderNum { get; set; }

        public OutStoDetailEntity IncludeOrderNum(bool flag)
        {
            if (flag && !this.ColumnList.Contains("OrderNum"))
            {
                this.ColumnList.Add("OrderNum");
            }
            return this;
        }

        [DataMapping(ColumnName = "ProductName", DbType = DbType.String, Length = 200, CanNull = true, DefaultValue = null, PrimaryKey = false, AutoIncrement = false, IsMap = true)]
        public string ProductName { get; set; }

        public OutStoDetailEntity IncludeProductName(bool flag)
        {
            if (flag && !this.ColumnList.Contains("ProductName"))
            {
                this.ColumnList.Add("ProductName");
            }
            return this;
        }

        [DataMapping(ColumnName = "BarCode", DbType = DbType.String, Length = 50, CanNull = false, DefaultValue = null, PrimaryKey = false, AutoIncrement = false, IsMap = true)]
        public string BarCode { get; set; }

        public OutStoDetailEntity IncludeBarCode(bool flag)
        {
            if (flag && !this.ColumnList.Contains("BarCode"))
            {
                this.ColumnList.Add("BarCode");
            }
            return this;
        }

        [DataMapping(ColumnName = "ProductNum", DbType = DbType.String, Length = 50, CanNull = false, DefaultValue = null, PrimaryKey = false, AutoIncrement = false, IsMap = true)]
        public string ProductNum { get; set; }

        public OutStoDetailEntity IncludeProductNum(bool flag)
        {
            if (flag && !this.ColumnList.Contains("ProductNum"))
            {
                this.ColumnList.Add("ProductNum");
            }
            return this;
        }

        [DataMapping(ColumnName = "BatchNum", DbType = DbType.String, Length = 100, CanNull = true, DefaultValue = null, PrimaryKey = false, AutoIncrement = false, IsMap = true)]
        public string BatchNum { get; set; }

        public OutStoDetailEntity IncludeBatchNum(bool flag)
        {
            if (flag && !this.ColumnList.Contains("BatchNum"))
            {
                this.ColumnList.Add("BatchNum");
            }
            return this;
        }

        [DataMapping(ColumnName = "LocalNum", DbType = DbType.String, Length = 50, CanNull = false, DefaultValue = null, PrimaryKey = false, AutoIncrement = false, IsMap = true)]
        public string LocalNum { get; set; }

        public OutStoDetailEntity IncludeLocalNum(bool flag)
        {
            if (flag && !this.ColumnList.Contains("LocalNum"))
            {
                this.ColumnList.Add("LocalNum");
            }
            return this;
        }

        [DataMapping(ColumnName = "StorageNum", DbType = DbType.String, Length = 50, CanNull = true, DefaultValue = null, PrimaryKey = false, AutoIncrement = false, IsMap = true)]
        public string StorageNum { get; set; }

        public OutStoDetailEntity IncludeStorageNum(bool flag)
        {
            if (flag && !this.ColumnList.Contains("StorageNum"))
            {
                this.ColumnList.Add("StorageNum");
            }
            return this;
        }

        [DataMapping(ColumnName = "Num", DbType = DbType.Double, Length = 8, CanNull = false, DefaultValue = null, PrimaryKey = false, AutoIncrement = false, IsMap = true)]
        public double Num { get; set; }

        public OutStoDetailEntity IncludeNum(bool flag)
        {
            if (flag && !this.ColumnList.Contains("Num"))
            {
                this.ColumnList.Add("Num");
            }
            return this;
        }

        [DataMapping(ColumnName = "IsPick", DbType = DbType.Int32, Length = 4, CanNull = false, DefaultValue = null, PrimaryKey = false, AutoIncrement = false, IsMap = true)]
        public Int32 IsPick { get; set; }

        public OutStoDetailEntity IncludeIsPick(bool flag)
        {
            if (flag && !this.ColumnList.Contains("IsPick"))
            {
                this.ColumnList.Add("IsPick");
            }
            return this;
        }

        [DataMapping(ColumnName = "RealNum", DbType = DbType.Double, Length = 8, CanNull = false, DefaultValue = null, PrimaryKey = false, AutoIncrement = false, IsMap = true)]
        public double RealNum { get; set; }

        public OutStoDetailEntity IncludeRealNum(bool flag)
        {
            if (flag && !this.ColumnList.Contains("RealNum"))
            {
                this.ColumnList.Add("RealNum");
            }
            return this;
        }

        [DataMapping(ColumnName = "OutPrice", DbType = DbType.Double, Length = 8, CanNull = true, DefaultValue = null, PrimaryKey = false, AutoIncrement = false, IsMap = true)]
        public double OutPrice { get; set; }

        public OutStoDetailEntity IncludeOutPrice(bool flag)
        {
            if (flag && !this.ColumnList.Contains("OutPrice"))
            {
                this.ColumnList.Add("OutPrice");
            }
            return this;
        }

        [DataMapping(ColumnName = "Amount", DbType = DbType.Double, Length = 8, CanNull = true, DefaultValue = null, PrimaryKey = false, AutoIncrement = false, IsMap = true)]
        public double Amount { get; set; }

        public OutStoDetailEntity IncludeAmount(bool flag)
        {
            if (flag && !this.ColumnList.Contains("Amount"))
            {
                this.ColumnList.Add("Amount");
            }
            return this;
        }

        [DataMapping(ColumnName = "ContractOrder", DbType = DbType.String, Length = 50, CanNull = true, DefaultValue = null, PrimaryKey = false, AutoIncrement = false, IsMap = true)]
        public string ContractOrder { get; set; }

        public OutStoDetailEntity IncludeContractOrder(bool flag)
        {
            if (flag && !this.ColumnList.Contains("ContractOrder"))
            {
                this.ColumnList.Add("ContractOrder");
            }
            return this;
        }

        [DataMapping(ColumnName = "ContractSn", DbType = DbType.String, Length = 50, CanNull = true, DefaultValue = null, PrimaryKey = false, AutoIncrement = false, IsMap = true)]
        public string ContractSn { get; set; }

        public OutStoDetailEntity IncludeContractSn(bool flag)
        {
            if (flag && !this.ColumnList.Contains("ContractSn"))
            {
                this.ColumnList.Add("ContractSn");
            }
            return this;
        }

        [DataMapping(ColumnName = "CreateTime", DbType = DbType.DateTime, Length = 8, CanNull = false, DefaultValue = null, PrimaryKey = false, AutoIncrement = false, IsMap = true)]
        public DateTime CreateTime { get; set; }

        public OutStoDetailEntity IncludeCreateTime(bool flag)
        {
            if (flag && !this.ColumnList.Contains("CreateTime"))
            {
                this.ColumnList.Add("CreateTime");
            }
            return this;
        }

    }
出库单实体类

  以上是项目中截取的代码, 定义了出库单的实体对象,使用partial 关键字,以上代码是Git.Framework.ORM 中实体映射类,在这个项目中业务模型类与数据库模型类是公用的,所以在这个类上会扩展出来很多其他的属性出来。

public partial class OutStoDetailEntity
    {
        /// <summary>
        /// 产品规格
        /// </summary>
        public string Size { get; set; }

        /// <summary>
        /// 库位名称
        /// </summary>
        public string LocalName { get; set; }

        /// <summary>
        /// 用于退货临时数据变量,已经退货数量
        /// </summary>
        public double BackNum { get; set; }

        /// <summary>
        /// 数量 临时变量
        /// </summary>
        public double Qty { get; set; }
}
出库单扩展字段

  以上就是扩展出来的辅助字段,可以用于业务模型对象以及数据传输对象【我是偷懒了,业务模型,数据模型,数据传输模型我公用了一个类】。目前众多开发者受DDD领域驱动开发思想的影响,定义了众多的模型, 我承认我是为了偷懒减少代码量所以公用了。

 

  四. 数据库操作好像不是EF

public override List<InStorageEntity> GetList(InStorageEntity entity, ref PageInfo pageInfo)
        {
            entity.IncludeAll();
            entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete);
            entity.OrderBy(a => a.ID, EOrderBy.DESC);
            AdminEntity admin = new AdminEntity();
            admin.Include(a => new { CreateUserName = a.UserName });
            entity.Left<AdminEntity>(admin, new Params<string, string>() { Item1 = "CreateUser", Item2 = "UserCode" });
            int rowCount = 0;
            List<InStorageEntity> listResult = this.InStorage.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount);
            pageInfo.RowCount = rowCount;
            return listResult;
        }
数据库操作实例代码

  上面一段代码是连接查询数据库,查询了两张表。并且有相应的查询条件,使用了表达式会让人误以为是EF,这个里面不是使用的EF操作数据库,本人对EF了解不够深,也不太喜欢使用EF,这是一个基于微软企业库的ORM框架,由本人个人开发,因为不够足够的优秀所以在网上也就不出名,基本也就我个人项目使用一下。既然不好为什么还要用, 原因很简单 顺手,开发项目快,而且基本趋于稳定。

  关于这个ORM框架使用的相关文章: 《Git.Framework.Orm 框架使用文章汇总》  http://www.cnblogs.com/qingyuan/category/239086.html

 

  五. 为什么不使用EF

    1. EF 个人使用的太少,没有深入的去学习过EF, 有坑不能去解决

    2. Git.Framework.Orm 是根据自己平时项目中遇到的问题总结下来编写的。比如指定修改某个字段,查询某些指定字段(数据权限控制),查询字段直接映射业务模型,支持最直接的SQL语句,底层是ADO.NET(基于微软企业库)

    3. 自己写的东西用起来自然觉得舒服很多,自己的习惯来。

    4. 除了使用对象映射还可以使用配置文件来配置SQL语句(用于复杂的SQL语句,ORM很难处理复杂的SQL语句)

    5. 定义了一套完整的数据库操作方法, 支持存储过程对应映射,用法和ADO.NET一样

Proc_AuditeInStorageEntity auditeEntity = new Proc_AuditeInStorageEntity();
auditeEntity.OrderNum = entity.OrderNum;
auditeEntity.Status = entity.Status;
auditeEntity.AuditUser = entity.AuditUser;
auditeEntity.Reason = entity.Reason;
auditeEntity.OperateType = entity.OperateType;
auditeEntity.EquipmentNum = entity.EquipmentNum;
auditeEntity.EquipmentCode = entity.EquipmentCode;
auditeEntity.Remark = entity.Remark;
int line = this.Proc_AuditeInStorage.ExecuteNonQuery(auditeEntity);
存储过程调用示例

 

<dataCommand name="Common.GetProceParam" database="JooWMS" commandType="Text">
    <commandText>
      <![CDATA[
          SELECT [SPECIFIC_CATALOG],[SPECIFIC_NAME],[ORDINAL_POSITION],[PARAMETER_MODE],[PARAMETER_NAME],[DATA_TYPE],[CHARACTER_MAXIMUM_LENGTH] 
        FROM [INFORMATION_SCHEMA].[PARAMETERS] 
        WHERE [SPECIFIC_NAME]=@SPECIFIC_NAME
          ]]>
    </commandText>
    <parameters>
      <param name="@SPECIFIC_NAME" dbType="String" direction="Input"/>
    </parameters>
  </dataCommand>
SQL语句配置执行

 

public List<ProceMetadata> GetMetadataList(string argProceName)
{
            DataCommand command = DataCommandManager.GetDataCommand("Common.GetProceParam");
            command.SetParameterValue("@SPECIFIC_NAME", argProceName);
            List<ProceMetadata> list = command.ExecuteEntityList<ProceMetadata>();
            
            return list;
}

 

  六. 如何加载的CSS JS 文件

    在加载CSS JS等文件的时候和传统的方式没有什么区别,只是在页面生成的时候做了一下处理。项目中的所有CSS 以及JS都是通过配置来加载的

       配置路径:\\gitwms\\Git.Storage.Web\\Configs\\File\\File.config

<?xml version="1.0" encoding="utf-8"?>
<Configs>
  <file name="CSS.bootstrap"><![CDATA[/Theme/plugins/bootstrap/css/bootstrap.css]]></file>
  <file name="CSS.font-awesome"><![CDATA[/Theme/plugins/font-awesome/css/font-awesome.css]]></file>
  <file name="CSS.style"><![CDATA[/Theme/css/style.css]]></file>
  <file name="CSS.style-responsive"><![CDATA[/Theme/css/style-responsive.css]]></file>
  <file name="CSS.default"><![CDATA[/Theme/css/themes/default.css]]></file>
  <file name="CSS.jbox"><![CDATA[/Theme/plugins/jbox-v2.3/jBox/Skins/Gray/jbox.css]]></file>
  <file name="CSS.autocomplete"><![CDATA[/Theme/plugins/jquery-autocomplete3.2.2/jquery.autocomplete.css]]></file>
  <file name="CSS.Error"><![CDATA[/Theme/css/pages/error.css]]></file>
  <file name="CSS.metro"><![CDATA[/Theme/plugins/bootstrap/css/style-metro.css]]></file>

  <!--公用JS组件-->
  <file name="Js.Enum"><![CDATA[/Common/Js]]></file>
  <file name="Js.Jquery"><![CDATA[/Theme/plugins/jquery-1.8.3.min.js]]></file>
  <file name="Js.bootstrap"><![CDATA[/Theme/plugins/bootstrap/js/bootstrap.min.js]]></file>
  <file name="Js.jBox"><![CDATA[/Theme/plugins/jbox-v2.3/jBox/jquery.jBox-2.3.min.js]]></file>
  <file name="Js.autocomplete"><![CDATA[/Theme/plugins/jquery-autocomplete3.2.2/jquery.autocomplete.js]]></file>
  <file name="Js.WdatePicker"><![CDATA[/Theme/plugins/My97DatePicker/WdatePicker.js]]></file>
  <file name="Js.Common"><![CDATA[/Theme/customer/Git.Framework.Common.js]]></file>
  <file name="Js.UICommon"><![CDATA[/Theme/customer/Git.Framework.UICommon.js]]></file>
  <file name="Js.Uploader"><![CDATA[/Theme/customer/jquery.jUploader-1.01.min.js]]></file>
  
  <file name="Js.Git.Framework.Sequence"><![CDATA[/Theme/customer/Git.Framework.Sequence.js]]></file>
  
  <!--吉特仓库管理系统(开源)-如何在网页端启动WinForm 程序

吉特仓库管理系统(开源)-如何在网页端启动WinForm 程序

吉特日化MES-日化行业原料仓库所见问题汇总

吉特仓储管理系统配置向导

吉特仓储管系统(开源WMS)--Web在线报表以及打印模板分享

吉特日化MES实施--三种浪费