using FreeSql.DataAnnotations;
using F9WebAiTest.Domain.Common;
namespace F9WebAiTest.Domain.Entities.Wms;
// 仓储(对应 F9 WinClient\F9.Business.WMS 的五个模块:原料 / 副产品 / 中间品 / 生丝 / 物资)
// 五个模块的「入库 / 出库 / 库存台账」结构完全一致,仅「台账项目」口径不同:
// 原料 = 原料庄口,副产品/中间品/生丝/物资 = 物资目录(中间品另有一套按工艺庄口的「笼筒架台账」)
// 因此统一为一套表 + Module 维度(F9 里是五套同名表),字段为五个模块字段的并集。
/// 仓储模块
public enum Wms_Module_Enum
{
原料 = 1,
副产品 = 2,
中间品 = 3,
生丝 = 4,
物资 = 5
}
/// 入库单(五模块共用)
[Table(Name = "WmsRukus")]
[Index("IX_WmsRukus_Module_Date_Code", "Module, Date, Code", IsUnique = true)]
public class WmsRuku : BaseEntity
{
public Wms_Module_Enum Module { get; set; } // 模块
public DateTime Date { get; set; } // 入库日期
public int Type { get; set; } // 入库类型(各模块枚举值,见 WmsTypes)
public string Code { get; set; } = ""; // 单据编号
public long GysId { get; set; } // 供应商(原料/物资)
public long KhId { get; set; } // 客户(副产品)
public long GyzkId { get; set; } // 工艺庄口(副产品入库)
public long DepId { get; set; } // 部门(副产品/在制品)
public string Lianxiren { get; set; } = ""; // 联系人(原料)
public string Phone { get; set; } = ""; // 联系电话(原料)
public string Carno { get; set; } = ""; // 车牌号(原料)
public string Kuguan { get; set; } = ""; // 库管员
public string Caigouyuan { get; set; } = ""; // 采购员(物资)
public string PayStatus { get; set; } = ""; // 支付类型(物资)
public int RkStatus { get; set; } // 入库状态(物资:0未入库 1已入库)
public int BxStatus { get; set; } // 报销状态(物资:0无 1待报销 2已报销)
public string Description { get; set; } = ""; // 备注
}
/// 入库明细(五模块共用)
[Table(Name = "WmsRukuDetails")]
public class WmsRukuDetail : BaseEntity
{
public long RukuId { get; set; }
public long WzmlId { get; set; } // 物资目录
public long YlzkId { get; set; } // 原料庄口(原料)
public long GyzkId { get; set; } // 工艺庄口(在制品)
public long DepId { get; set; } // 部门(在制品)
public int Jianshu { get; set; } // 件数
public decimal Maozhong { get; set; } // 毛重
public decimal Pizhong { get; set; } // 皮重
public decimal Jingzhong { get; set; } // 净重
public decimal BiaobaoZhongliang { get; set; } // 标包重量(在制品)
public decimal BaozhuangZhongliang { get; set; } // 包装重量(在制品)
public decimal Shuliang { get; set; } // 数量(物资)
public decimal Danjia { get; set; } // 单价
public decimal Jine { get; set; } // 金额
public decimal Sunhao { get; set; } // 运损(原料)
public string PiciCodes { get; set; } = ""; // 批次号(生丝)
public int PiciNum { get; set; } // 批数(生丝)
public int BaojianNum { get; set; } // 包件数(生丝)
public string PiciIds { get; set; } = ""; // 批次ID(生丝,逗号分隔,入库按批次关联)
public string Banci { get; set; } = ""; // 班次(在制品出库)
public string JidiWaigou { get; set; } = ""; // 基地 / 外购(生丝)
}
/// 磅码单(原料入库/出库过磅明细)
[Table(Name = "WmsBangmadans")]
public class WmsBangmadan : BaseEntity
{
public long DetailId { get; set; } // 出/入库明细 Id
public bool IsChuku { get; set; } // false=入库 true=出库
public int Jianshu { get; set; } // 件数
public decimal Maozhong { get; set; } // 毛重
public decimal Pizhong { get; set; } // 皮重
public decimal Jingzhong { get; set; } // 净重 = 毛重 − 皮重
public DateTime? GuobangShijian { get; set; } // 过磅时间
}
/// 出库单(五模块共用)
[Table(Name = "WmsChukus")]
[Index("IX_WmsChukus_Module_Date_Code", "Module, Date, Code", IsUnique = true)]
public class WmsChuku : BaseEntity
{
public Wms_Module_Enum Module { get; set; }
public DateTime Date { get; set; } // 出库日期
public int Type { get; set; } // 出库类型
public string Code { get; set; } = ""; // 单据编号
public long WldwId { get; set; } // 往来单位/客户(生丝/原料销售)
public long KhId { get; set; } // 客户(副产品)
public long GyzkId { get; set; } // 工艺庄口(原料领料)
public long LingliaoDepId { get; set; } // 领料部门(物资)
public long UseDepId { get; set; } // 使用部门(物资)
public long DbdepId { get; set; } // 调拨部门(物资/副产品)
public string Lingliaoren { get; set; } = ""; // 领料人
public string Kuguan { get; set; } = ""; // 库管员
public string UseLocation { get; set; } = ""; // 使用位置(物资)
public int CkStatus { get; set; } // 出库状态(物资:0未出库 1已出库)
public DateTime? CkTime { get; set; } // 出库时间(物资)
public bool IsHongchong { get; set; } // 是否红冲(物资)
public long HongchongId { get; set; } // 红冲单据(物资)
public string Description { get; set; } = ""; // 备注
}
/// 出库明细(五模块共用)
[Table(Name = "WmsChukuDetails")]
public class WmsChukuDetail : BaseEntity
{
public long ChukuId { get; set; }
public long WzmlId { get; set; } // 物资目录
public long YlzkId { get; set; } // 原料庄口(原料)
public long GyzkId { get; set; } // 工艺庄口(在制品)
public long DepId { get; set; } // 部门(在制品)
public int Jianshu { get; set; }
public decimal Maozhong { get; set; }
public decimal Pizhong { get; set; }
public decimal Jingzhong { get; set; }
public decimal BiaobaoZhongliang { get; set; }
public decimal BaozhuangZhongliang { get; set; }
public decimal Shuliang { get; set; } // 数量(物资)
public decimal Danjia { get; set; }
public decimal Jine { get; set; }
public decimal KucunNum { get; set; } // 库存数量(物资,用于金额分摊)
public string PiciCodes { get; set; } = ""; // 批次号(生丝)
public int PiciNum { get; set; }
public string PcAndBjIds { get; set; } = ""; // 批次+包件ID(生丝,JSON:[{piciId,piciBaojianIds}...])
public string Lingyongren { get; set; } = ""; // 领用人(物资)
public string Banci { get; set; } = ""; // 班次(在制品)
public string JidiWaigou { get; set; } = ""; // 基地 / 外购(生丝)
}
/// 库存台账-日期(一天一条;在制品的「笼筒架台账」用 Kind=1 区分)
[Table(Name = "WmsKcTzDates")]
[Index("IX_WmsKcTzDates_Module_Kind_Date", "Module, Kind, Date", IsUnique = true)]
public class WmsKcTzDate : BaseEntity
{
public Wms_Module_Enum Module { get; set; }
public int Kind { get; set; } // 0=库存台账 1=笼筒架台账(在制品)
public DateTime Date { get; set; } // 台账日期
public DateTime LastDate { get; set; } // 上一台账日期
}
/// 库存台账-明细(按台账项目一行)
[Table(Name = "WmsKcTzItems")]
[Index("IX_WmsKcTzItems_TzDateId_ItemId", "TzDateId, ItemId, SubKey", IsUnique = true)]
public class WmsKcTzItem : BaseEntity
{
public long TzDateId { get; set; }
public Wms_Module_Enum Module { get; set; }
public int Kind { get; set; }
public DateTime Date { get; set; } // 台账日期
public long ItemId { get; set; } // 台账项目(原料=原料庄口,其余=物资目录,笼筒架=工艺庄口)
public string SubKey { get; set; } = ""; // 项目辅助维度(生丝=基地/外购)
public string ItemName { get; set; } = ""; // 项目名称快照
public string ItemCode { get; set; } = ""; // 项目编号快照(物资台账)
public decimal Ydayjianshu { get; set; } // 上日结存件数(物资台账=数量)
public decimal Ydayjingzhong { get; set; } // 上日结存净重(物资台账=金额)
public decimal Tdayrukujianshu { get; set; } // 今日入库件数
public decimal Tdayrukujingzhong { get; set; } // 今日入库净重
public decimal Tdaychukujianshu { get; set; } // 今日出库件数
public decimal Tdaychukujingzhong { get; set; } // 今日出库净重
public decimal Yingkui { get; set; } // 盈亏
public decimal Tdayjianshu { get; set; } // 今日结存件数
public decimal Tdayjingzhong { get; set; } // 今日结存净重
public decimal Yangjianjianshu { get; set; } // 样茧件数(原料)
public bool AllChuku { get; set; } // 全部出库
public string Description { get; set; } = "";
}
/// 生丝批次(对应 F9 SS_Pici)
[Table(Name = "WmsPicis")]
[Index("IX_WmsPicis_Code", "Code", IsUnique = true)]
public class WmsPici : BaseEntity
{
public string Code { get; set; } = ""; // 批号
public int CodeType { get; set; } // 批号类型
public int Year { get; set; }
public DateTime Date { get; set; } // 织批日期
public DateTime? ScDate { get; set; } // 生产日期
public long GyzkId { get; set; } // 工艺庄口
public long WzmlId { get; set; } // 物资目录(生丝规格)
public long DepId { get; set; } // 部门
public string Guige { get; set; } = ""; // 规格
public string JidiWaigou { get; set; } = ""; // 基地 / 外购
public string YoujiPutong { get; set; } = ""; // 优质 / 普通
public int Baoshu { get; set; } // 包数
public int StartBaojianNum { get; set; } // 起始包件号
public decimal Maozhong { get; set; }
public decimal Pizhong { get; set; }
public decimal Jingzhong { get; set; }
public decimal Gongliang { get; set; } // 公量
public int KcStatus { get; set; } // 0全部 1待入库 2已入库 3部分出库 4已出库
public long RkItemId { get; set; } // 关联入库明细
public DateTime? RkDate { get; set; } // 入库日期
public long CkItemId { get; set; } // 关联出库明细(最后一笔)
public DateTime CkLastDate { get; set; } // 最后出库日期
public int CkBaoshu { get; set; } // 已出库包数
public decimal CkJingzhong { get; set; } // 已出库净重
public int KcBaoshu { get; set; } // 库存包数
public string Dengji { get; set; } = ""; // 等级
public decimal Qingjie { get; set; } // 清洁
public decimal Jiejing { get; set; } // 洁净
public decimal Piancha { get; set; } // 偏差
public decimal Zongcha { get; set; } // 总差
public decimal Qieduan { get; set; } // 切断
public string Description { get; set; } = "";
}
/// 生丝批次-包件(对应 F9 SS_Pici_Baojian)
[Table(Name = "WmsPiciBaojians")]
public class WmsPiciBaojian : BaseEntity
{
public long PiciId { get; set; }
public int Baojianhao { get; set; } // 包件号
public decimal Maozhong { get; set; }
public decimal Pizhong { get; set; }
public decimal Jingzhong { get; set; }
public decimal Gongliang { get; set; } // 公量
public decimal Huichaolv { get; set; } // 实测回潮率(%)
public bool CkIsck { get; set; } // 是否已出库
public long CkItemId { get; set; } // 出库明细ID
public DateTime? CkDate { get; set; } // 出库日期
public decimal CkJingzhong { get; set; } // 出库净重
public string Description { get; set; } = "";
}
/// 生丝批次-出库记录(对应 F9 SS_Pici_Chuku)
[Table(Name = "WmsPiciChukus")]
public class WmsPiciChuku : BaseEntity
{
public long PiciId { get; set; }
public long CkItemId { get; set; } // 出库明细ID
public int CkBaoshu { get; set; } // 出库包数
public DateTime? CkDate { get; set; }
public decimal CkJingzhong { get; set; } // 出库净重
}
/// 生丝批次-质检(对应 F9 SS_Pici_Qc)
[Table(Name = "WmsPiciQcs")]
[Index("IX_WmsPiciQcs_PiciId", "PiciId", IsUnique = true)]
public class WmsPiciQc : BaseEntity
{
public long PiciId { get; set; } // 生丝批次ID
public string Pingwei { get; set; } = ""; // 品味
public string Seze { get; set; } = ""; // 检验-色泽
public decimal AvgHuichaolv { get; set; } // 平均回潮率
public decimal AvgGongliangXiandu { get; set; } // 平均公量纤度
public decimal XianduPiancha { get; set; } // 纤度偏差
public decimal XianduZdpiancha { get; set; } // 纤度最大偏差
public decimal Qingjie { get; set; } // 清洁
public decimal Jiejing { get; set; } // 洁净
public int JunyunYd { get; set; } // 均匀一度变化
public int JunyunEd { get; set; } // 均匀二度变化
public int JunyunSd { get; set; } // 均匀三度变化
public int Qieduan { get; set; } // 切断次数
public string DuanlieQiangdu { get; set; } = ""; // 断裂强度
public string DuanlieShenchanglv { get; set; } = ""; // 断裂伸长率
public int Baohe { get; set; } // 抱合
public string WgWg { get; set; } = ""; // 外观-外观检验
public string WgYanse { get; set; } = ""; // 外观-颜色
public string WgGuangze { get; set; } = ""; // 外观-光泽
public string WgShougan { get; set; } = ""; // 外观-手感
public int? QjZhuyao { get; set; } // 清洁-主要疵点
public int? QjCiyaoFeisi { get; set; } // 清洁-次要疵点-废丝
public int? QjCiyaoDacao { get; set; } // 清洁-次要疵点-大糙
public int? QjCiyaoNianfucao { get; set; } // 清洁-次要疵点-粘附糙
public int? QjCiyaoDachangjie { get; set; } // 清洁-次要疵点-大长结
public int? QjCiyaoZhongluoxuan { get; set; } // 清洁-次要疵点-重螺旋
public int? QjPutongXiaocao { get; set; } // 清洁-普通疵点-小糙
public int? QjPutongChangjie { get; set; } // 清洁-普通疵点-长结
public int? QjPutongLuoxuan { get; set; } // 清洁-普通疵点-螺旋
public int? QjPutongHuanjie { get; set; } // 清洁-普通疵点-环结及裂丝
public int? Jj100 { get; set; } // 洁净100
public int? Jj95 { get; set; }
public int? Jj90 { get; set; }
public int? Jj85 { get; set; }
public int? Jj80 { get; set; }
public int? Jj75 { get; set; }
public int? Jj70 { get; set; }
public int? Jj65 { get; set; }
public int? Jj60 { get; set; }
public int? Jj55 { get; set; }
public int? Jj50 { get; set; }
public int? Jj45 { get; set; }
public string JjYuanyin { get; set; } = ""; // 降级原因
public string Description { get; set; } = ""; // 备注
}
/// 生丝批次-纤度检验(对应 F9 SS_Pici_Qc_Xdjy)
[Table(Name = "WmsPiciQcXdjys")]
public class WmsPiciQcXdjy : BaseEntity
{
public long PiciId { get; set; }
public decimal Xiandu { get; set; }
public int Num { get; set; }
}
/// 物资库存(对应 F9 WJ_Kucun,按物资目录一行)
[Table(Name = "WmsKucuns")]
[Index("IX_WmsKucuns_WzmlId", "WzmlId", IsUnique = true)]
public class WmsKucun : BaseEntity
{
public long WzmlId { get; set; }
public decimal Shuliang { get; set; } // 库存数量
public decimal Danjia { get; set; } // 库存单价(加权平均)
public decimal Jine { get; set; } // 库存金额
}
/// 原料采购(对应 F9 Yuanliao_Caigou)
[Table(Name = "WmsCaigous")]
public class WmsCaigou : BaseEntity
{
public DateTime Date { get; set; }
public string Code { get; set; } = ""; // 采购单号
public long GysId { get; set; } // 供应商(往来单位)
public long YlzkId { get; set; } // 原料庄口
public int Jianshu { get; set; }
public decimal Maozhong { get; set; }
public decimal Pizhong { get; set; }
public decimal Jingzhong { get; set; }
public decimal Danjia { get; set; }
public decimal Jine { get; set; }
public string Description { get; set; } = "";
}
/// 原料翻包计划(对应 F9 Fbplan)
[Table(Name = "WmsFbplans")]
public class WmsFbplan : BaseEntity
{
public DateTime Date { get; set; } // 翻包日期
public string Code { get; set; } = ""; // 计划号
public long YlzkId { get; set; } // 原料庄口
public long WzmlId { get; set; } // 物资目录
public int Jianshu { get; set; } // 计划件数
public decimal Jingzhong { get; set; } // 计划净重
public int FbType { get; set; } // 1翻包中 2完成 3暂停
public int RukuStatus { get; set; } // 1有效 2作废 3无
public string Description { get; set; } = "";
}
/// 原料翻包记录(对应 F9 Fbjl)
[Table(Name = "WmsFbjls")]
public class WmsFbjl : BaseEntity
{
public long FbplanId { get; set; }
public DateTime Date { get; set; }
public int Jianshu { get; set; }
public decimal Jingzhong { get; set; }
public string Description { get; set; } = "";
}
/// 物资采购计划(对应 F9 WJ_Cgplan)
[Table(Name = "WmsCgplans")]
public class WmsCgplan : BaseEntity
{
public DateTime Date { get; set; }
public string Code { get; set; } = ""; // 计划号
public long DepId { get; set; } // 申请部门
public int Status { get; set; } // 0草稿 1已确认 2已完成
public string Description { get; set; } = "";
}
/// 物资采购计划明细(对应 F9 WJ_Cgplan_Item)
[Table(Name = "WmsCgplanItems")]
public class WmsCgplanItem : BaseEntity
{
public long CgplanId { get; set; }
public long WzmlId { get; set; }
public decimal Shuliang { get; set; }
public decimal Danjia { get; set; }
public decimal Jine { get; set; }
public string Description { get; set; } = "";
}