Closed 154681189 closed 2 years ago
实体设置如下 ` using Chloe.Annotations; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace G.MES.DataModel.Custom.Print { /// /// 包装重量表 ///
[Table("B_PACKAGE_WEIGHT")] public class B_PACKAGE_WEIGHT { /// <summary> /// 主键 /// </summary> [Column( "B_PACKAGE_WEIGHTOID")] public long B_PACKAGE_WEIGHTOID { get; set; } /// <summary> /// 生产线外键 /// </summary> [Column("B_PRODUCTIONLINE_FK")] public long B_PRODUCTIONLINE_FK { get; set; } /// <summary> /// 生产工单外键 /// </summary> [Column("PS_WB_FK")] public long PS_WB_FK { get; set; } /// <summary> /// 二维码 /// </summary> [Column("QRCODE_STR")] public string QRCODE_STR { get; set; } /// <summary> /// 打印的IP地址 /// </summary> [Column("PRINT_IP_ADDRESS")] public string PRINT_IP_ADDRESS { get; set; } /// <summary> /// 重量 /// </summary> [Column("WEIGHT")] public decimal WEIGHT { get; set; } /// <summary> /// 创建人 /// </summary> [Column("SYS_CREATED_BY")] public long SYS_CREATED_BY { get; set; } /// <summary> /// 创建时间 /// </summary> [Column("SYS_CREATED")] public DateTime? SYS_CREATED { get; set; } /// <summary> /// 最后修改人 /// </summary> [Column("SYS_LAST_UPD_BY")] public long SYS_LAST_UPD_BY { get; set; } /// <summary> /// 删除标识 /// </summary> [Column("SYS_DELETED")] public bool? SYS_DELETED { get; set; } /// <summary> /// 最后修改时间 /// </summary> [Column("SYS_LAST_UPD")] public DateTime? SYS_LAST_UPD { get; set; } }
}
数据库结构 -- auto-generated definition create table B_PACKAGE_WEIGHT ( B_PACKAGE_WEIGHTOID NUMBER(20) not null constraint B_PACKAGE_WEIGHTOID primary key, B_PRODUCTIONLINE_FK NUMBER(20) not null, PS_WB_FK NUMBER(20) not null, QRCODE_STR VARCHAR2(256) not null, WEIGHT NUMBER(10, 4) not null, PRINT_IP_ADDRESS VARCHAR2(256) not null, SYS_CREATED_BY NUMBER(20) not null, SYS_CREATED DATE not null, SYS_LAST_UPD_BY NUMBER(20), SYS_DELETED NUMBER(1) default 0, SYS_LAST_UPD DATE ) /
数据库结构
comment on table B_PACKAGE_WEIGHT is '包装重量表' /
comment on column B_PACKAGE_WEIGHT.B_PACKAGE_WEIGHTOID is '包装重量表主键' /
comment on column B_PACKAGE_WEIGHT.B_PRODUCTIONLINE_FK is '生产线主键' /
comment on column B_PACKAGE_WEIGHT.PS_WB_FK is '生产线主键' /
comment on column B_PACKAGE_WEIGHT.QRCODE_STR is '二维码' /
comment on column B_PACKAGE_WEIGHT.WEIGHT is '重量' /
comment on column B_PACKAGE_WEIGHT.PRINT_IP_ADDRESS is '打印的IP地址' /
comment on column B_PACKAGE_WEIGHT.SYS_CREATED_BY is '创建人' /
comment on column B_PACKAGE_WEIGHT.SYS_CREATED is '创建时间' /
comment on column B_PACKAGE_WEIGHT.SYS_LAST_UPD_BY is '最后修改人' /
comment on column B_PACKAGE_WEIGHT.SYS_DELETED is '是否删除' /
comment on column B_PACKAGE_WEIGHT.SYS_LAST_UPD is '最后修改时间' /
`
赋值代码 // 执行插入操作 B_PACKAGE_WEIGHT b_PACKAGE_WEIGHT = new B_PACKAGE_WEIGHT(); b_PACKAGE_WEIGHT.B_PACKAGE_WEIGHTOID = UUIDHelper.GenerateIntID() ; b_PACKAGE_WEIGHT.SYS_CREATED = nowTime; b_PACKAGE_WEIGHT.QRCODE_STR = dto.QRCODE_STR; b_PACKAGE_WEIGHT.SYS_CREATED_BY = PirntConstant.SysCreatedBy; b_PACKAGE_WEIGHT.SYS_DELETED = false; b_PACKAGE_WEIGHT.PRINT_IP_ADDRESS = dto.PRINT_IP_ADDRESS; 调试的时候主键有值,但是报错,不能插入null字段到主键
// 执行插入操作 B_PACKAGE_WEIGHT b_PACKAGE_WEIGHT = new B_PACKAGE_WEIGHT(); b_PACKAGE_WEIGHT.B_PACKAGE_WEIGHTOID = UUIDHelper.GenerateIntID() ; b_PACKAGE_WEIGHT.SYS_CREATED = nowTime; b_PACKAGE_WEIGHT.QRCODE_STR = dto.QRCODE_STR; b_PACKAGE_WEIGHT.SYS_CREATED_BY = PirntConstant.SysCreatedBy; b_PACKAGE_WEIGHT.SYS_DELETED = false; b_PACKAGE_WEIGHT.PRINT_IP_ADDRESS = dto.PRINT_IP_ADDRESS; 调试的时候主键有值,但是报错,不能插入null字段到主键
[Column( "B_PACKAGE_WEIGHTOID")] [NonAutoIncrementAttribute] //非自增 public long B_PACKAGE_WEIGHTOID { get; set; }
Chloe框架有一些默认规则,具体查看文档 https://github.com/shuxinqin/Chloe/wiki/Annotations
我试了下,可以了,谢谢
实体设置如下 ` using Chloe.Annotations; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;
namespace G.MES.DataModel.Custom.Print { ///
/// 包装重量表
///
}
数据库结构
-- auto-generated definition create table B_PACKAGE_WEIGHT ( B_PACKAGE_WEIGHTOID NUMBER(20) not null constraint B_PACKAGE_WEIGHTOID primary key, B_PRODUCTIONLINE_FK NUMBER(20) not null, PS_WB_FK NUMBER(20) not null, QRCODE_STR VARCHAR2(256) not null, WEIGHT NUMBER(10, 4) not null, PRINT_IP_ADDRESS VARCHAR2(256) not null, SYS_CREATED_BY NUMBER(20) not null, SYS_CREATED DATE not null, SYS_LAST_UPD_BY NUMBER(20), SYS_DELETED NUMBER(1) default 0, SYS_LAST_UPD DATE ) /comment on table B_PACKAGE_WEIGHT is '包装重量表' /
comment on column B_PACKAGE_WEIGHT.B_PACKAGE_WEIGHTOID is '包装重量表主键' /
comment on column B_PACKAGE_WEIGHT.B_PRODUCTIONLINE_FK is '生产线主键' /
comment on column B_PACKAGE_WEIGHT.PS_WB_FK is '生产线主键' /
comment on column B_PACKAGE_WEIGHT.QRCODE_STR is '二维码' /
comment on column B_PACKAGE_WEIGHT.WEIGHT is '重量' /
comment on column B_PACKAGE_WEIGHT.PRINT_IP_ADDRESS is '打印的IP地址' /
comment on column B_PACKAGE_WEIGHT.SYS_CREATED_BY is '创建人' /
comment on column B_PACKAGE_WEIGHT.SYS_CREATED is '创建时间' /
comment on column B_PACKAGE_WEIGHT.SYS_LAST_UPD_BY is '最后修改人' /
comment on column B_PACKAGE_WEIGHT.SYS_DELETED is '是否删除' /
comment on column B_PACKAGE_WEIGHT.SYS_LAST_UPD is '最后修改时间' /
`
赋值代码
// 执行插入操作 B_PACKAGE_WEIGHT b_PACKAGE_WEIGHT = new B_PACKAGE_WEIGHT(); b_PACKAGE_WEIGHT.B_PACKAGE_WEIGHTOID = UUIDHelper.GenerateIntID() ; b_PACKAGE_WEIGHT.SYS_CREATED = nowTime; b_PACKAGE_WEIGHT.QRCODE_STR = dto.QRCODE_STR; b_PACKAGE_WEIGHT.SYS_CREATED_BY = PirntConstant.SysCreatedBy; b_PACKAGE_WEIGHT.SYS_DELETED = false; b_PACKAGE_WEIGHT.PRINT_IP_ADDRESS = dto.PRINT_IP_ADDRESS; 调试的时候主键有值,但是报错,不能插入null字段到主键