diff --git a/attachments/2026/09/21/OTHER/099f6655-7f95-41aa-8961-51fcad2885ce.png b/attachments/2026/09/21/OTHER/099f6655-7f95-41aa-8961-51fcad2885ce.png
new file mode 100644
index 0000000..b8a6131
Binary files /dev/null and b/attachments/2026/09/21/OTHER/099f6655-7f95-41aa-8961-51fcad2885ce.png differ
diff --git a/attachments/2026/09/21/OTHER/27eeaa6d-491f-4125-8e8a-fa5bc69259a0.png b/attachments/2026/09/21/OTHER/27eeaa6d-491f-4125-8e8a-fa5bc69259a0.png
new file mode 100644
index 0000000..b8a6131
Binary files /dev/null and b/attachments/2026/09/21/OTHER/27eeaa6d-491f-4125-8e8a-fa5bc69259a0.png differ
diff --git a/attachments/2026/09/21/OTHER/8dd47341-0b89-4509-89dc-f40ecd5cb541.txt b/attachments/2026/09/21/OTHER/8dd47341-0b89-4509-89dc-f40ecd5cb541.txt
new file mode 100644
index 0000000..cb03687
--- /dev/null
+++ b/attachments/2026/09/21/OTHER/8dd47341-0b89-4509-89dc-f40ecd5cb541.txt
@@ -0,0 +1,105 @@
+WMS系统:
+一、入库
+1、输入“图号、检验单号”——均强制输入。
+2、需要选择归属(工单or科技项目编号)。
+3、能够添加附件(图纸PDF*能查看)。
+4、数量使用手数或加号、区域需要明确货架号+位置号码。
+5、批次信息是按输入的什么信息自动填写,填写的是日期吗?
+6、“精密件SN入库”改为“电气件入库”。
+7、除结构件和电气件外,增加其它入库,防止螺栓、工装、试验设备等,增加规格输入(强制)。
+8、入库时是点提交入库需要弹出确认对话框,其它修改数据库操作相同。
+9、入库时库位能否根据图号名称规格自动匹配识别(出库相同)?
+二、出库
+1、工单备料出库是否根据MES排产自动生成,平时无需操作?
+2、增加科技项目出库类别
+3、通用出库:先区分一下类别(摁钮点选,退料、样品、报废、发货、其它“手动输入”),然后分别填写归属(工单号or科技项目号)、类型(电气件、结构件、其它)、名称(图号)、批次(非强制)/SN(强制)(能否根据类型选择自动更换?)
+4、出库记录:查询可以输入归属、名称图号、日期进行查询。
+ 记录表另外明确“归属、工位”
+5、查询时输入多项的话,是取“或”吗?
+三、质量检验
+1、质量检验录入改为来料检验录入
+2、来料检记录:需要输入报检单号、归属、名称图号、SN/批次、检验单号、上传附件(pdf,可查看)、相关标准(检验细则号)、生产厂家、检验员、检验日期。
+3、能否试验对一张纸上数据的自动识别和提取?
+4、电气件来料检界面什么样?
+5、检验界面上输入的单号,能否自动传递到入库?
+6、如果检验数和合格数不一致会怎么样?
+7、检验记录:查询输入加一个归属,物料编码改成名称图号
+ 记录表明确“检验说明换成相关标准、不合格原因不要、增加归属,检验员改成记录人、检验日期改成记录日期、需要能够直接点击查看附件。
+8、记录查询时相同的项会自动合并吗?
+四、基础资料
+1、物料档案的关键字按出、入库信息去修改。
+2、区域维护中对于区域的定位按货架号和位置号来定位。
+五、系统管理
+1、用户在MES、WMS及工位上通用吗?
+六、库存管理
+1、解释一下,原料类(SN/结构件/其它)如果刚开始判定合格入库,实际使用过程中不合格,转为退货或换修,系统如何修改和调整。
+2、物料汇总库存类型加一个其它。
+3、锁定量是说已列至排产计划的?
+4、物料汇总和库存明细有什么差别?
+5、库存盘点功能详细展示一下。
+6、半成品/成品入库,需与OA链接。
+7、产成品入库:需要输入归属(工单号or科技项目号)、名称图号、编码(二维码)、产品状态(已通过、部分通过、返修)、相关标准(试验方案号)、试验记录单号、上传附件(pdf,可查看)、记录员、记录日期。
+8、半成品/成品出库,增加一个“原因”摁钮(包装、继续生产、检验试验、其它),扫SN码后,自动显示相关信息。
+9、半成品/成本查询增加“归属查询(工单号or科技项目号)”,物料编码需能够从扫码枪识别二维码。
+10、工单备料台账增加通过完成时间范围查询。
+11、工单备料台账里状态跟领不领料没关系,关键是看是否满足生产需求(齐套-需求量全满足、未齐套-需求量部分满足且满足未来5天生产、预警-需求量不满足未来5天生产、未到货-未出库到货)
+MES系统:
+一、生产管理
+1、新建工单中数量要支持直接输入数字,要输入完成日期,显示创建日期和创建人。
+2、工单如何支持与公司OA衔接,用于接受新工单信息?
+3、日排产能否支持自动排产(比如以平均生产的方式或者是日固定排产量的方式)?
+4、物料清单要明确归属。需要能够从design中读取数据,最低要求需要能够支持导入(txt、xls)
+5、备料单是否会自动同步到WMS系统?详细解释一下从日排产、到备料单、到工单备料台账到出库到AGV配送的完整工作过程如何流转执行。
+6、目前备料无法体现出是送到哪个工位。
+7、绩效报表里的内容均为工位机自动上报?NG数是什么意思?
+8、绩效报表里能否加上上机时间,统计工作效率?
+二、现场作业
+1、详细解释一下工位组合下发什么意思?工位组合加设流水线1(工位1、3、5、7、9、11)和流水线2(工位2、4、6、8、10、12)。
+2、SN码在产品上,工位上才有扫码枪,需要上产线前进行识别吧,如何实现如何识别,现在只有?
+3、下发日志里的工位是什么意思,完成时间是什么意思?
+4、手动报工是干什么用的,跟完工确认有什么差别。列表里工位和工位号有什么差别?
+5、工件追溯做一个示例。
+6、拧紧查询需实现:1、输入工单号(查所有)、SN(查单件)、日期、工位进行查询,多项输入复合查询(取交)。2、增加统计功能,根据工艺文件自动计算螺栓拧紧数量是否满足要求。3、一级窗口显示工单号、SN、工位(1-12),拧紧数量(合格/不合格)、拧紧结果(合格/不合格),操作人、时间;点击拧紧结果进入二级窗口,显示SN在当前工位所有详细拧紧数据,包括扭矩、角度、是否合格、详细时间等。
+7、拧紧数据自动读取电动拧紧工具上传数据。特殊需单独上传的数据在工位上传,检验员审核,两人签字。
+8、巡检中的开工签到、工位点检、过程巡检(按工艺文件确定工序,每一步工序都需要检验)、完工确认都在工位终端、扫码枪和pad上操作,服务器只做存储和查询。
+9、开工签到的照片如何上传(用扫码枪)?
+10、完工确认修改“确认该SN已完成生产”,扫描SN码。
+11、异常上报看看其他示例中是如何使用的?
+12、记录查看加一项看工单号查询
+三、基础配置
+1、需要能够新增工位
+四、系统管理
+1、增加时间筛选查询
+工位终端:
+工位终端需要进一步完善:开工签到、工位点检、申请巡检、工序间检验、工艺文件查询、叫料/退料、工序开始/结束/暂停、应急呼叫等。
+
+
+生产部分:
+1、工单号 →工程编号;
+2、产品编码’ →产品编号;
+3、装配工位:增加备注“操作人姓名”,工位固定操作人不固定;
+4、工位组合下发:
+情况一:某一工序需要两个工位同时完成,这种情况怎么考虑?
+5、增加涵盖一个产品生产流程卡;
+6、若一个产品当天没有完成,停留在流水线上,第二天流水线怎么开始?
+7、增加一个0号工位和13号工位;
+工位部分:
+1、需要结合检验卡或生产流程卡进行工位操作确认;
+2、每个工位对精密器件应进行扫码录入;记录在检验单上;
+出入库部分:
+1:已知原材料库存量和生产原材料清单计算出可生产数量,并设置原材料缺货报警提示;
+2、库房这边能否查询原材料清单,便于库房管理人员根据清单提供不同工位需要的原材料;
+3、工位上发现原材料数量与下发的原材数量不一致,怎么解决?;
+4、工位上原材料退库怎么处理?
+质量检验录入:
+ 应先录入产品BOM,包含物料编码、归属(项目)、名称图号型号、相关标准(检验细则)、工序所属;然后在质量检验录入时输入对应物料编码或名称图号型号即可调出相应物料信息;检验完成后记录要包括报检单号、SN/批次、生产厂家、检验员、检验单号、检验日期、上传附件(PDF、图片)。对于不合格品,要能根据相应模板一键生成不合格单;对于后续不合格品处理,要区分退货、返修、退换。
+检验记录查询:
+ 应支持模糊查询,包括但不限于输入物料编码、名称、图号、型号即可查询。
+工艺流程界面:
+ 单个工序要可以上传相应工序的工艺文件,让工位终端可以进行查询。
+巡检终端:
+ 对于过程巡检一栏,要支持分工序提交工序间检验记录,且支持上传附件(图片、PDF)。单个产品所有工序完成后,可以根据相应模板一键生成工序间检验记录。
+资料导入:
+1.增加批量导入产品BOM功能
+2.图纸管理,如何上传,如何分发,是否按工序分发等
+
diff --git a/attachments/2026/09/21/OTHER/f4e261e1-66a5-49ab-8ab1-d9d3ad24d6e7.png b/attachments/2026/09/21/OTHER/f4e261e1-66a5-49ab-8ab1-d9d3ad24d6e7.png
new file mode 100644
index 0000000..b8a6131
Binary files /dev/null and b/attachments/2026/09/21/OTHER/f4e261e1-66a5-49ab-8ab1-d9d3ad24d6e7.png differ
diff --git a/bj_power_mes/ent/client.go b/bj_power_mes/ent/client.go
index 1ff9c48..c4f32c6 100644
--- a/bj_power_mes/ent/client.go
+++ b/bj_power_mes/ent/client.go
@@ -17,6 +17,7 @@ import (
"bj_power_mes/ent/attachment"
"bj_power_mes/ent/bomitem"
"bj_power_mes/ent/dailyplan"
+ "bj_power_mes/ent/dock"
"bj_power_mes/ent/eventlog"
"bj_power_mes/ent/inspectionrecord"
"bj_power_mes/ent/linepoint"
@@ -65,6 +66,8 @@ type Client struct {
BomItem *BomItemClient
// DailyPlan is the client for interacting with the DailyPlan builders.
DailyPlan *DailyPlanClient
+ // Dock is the client for interacting with the Dock builders.
+ Dock *DockClient
// EventLog is the client for interacting with the EventLog builders.
EventLog *EventLogClient
// InspectionRecord is the client for interacting with the InspectionRecord builders.
@@ -132,6 +135,7 @@ func (c *Client) init() {
c.Attachment = NewAttachmentClient(c.config)
c.BomItem = NewBomItemClient(c.config)
c.DailyPlan = NewDailyPlanClient(c.config)
+ c.Dock = NewDockClient(c.config)
c.EventLog = NewEventLogClient(c.config)
c.InspectionRecord = NewInspectionRecordClient(c.config)
c.LinePoint = NewLinePointClient(c.config)
@@ -255,6 +259,7 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) {
Attachment: NewAttachmentClient(cfg),
BomItem: NewBomItemClient(cfg),
DailyPlan: NewDailyPlanClient(cfg),
+ Dock: NewDockClient(cfg),
EventLog: NewEventLogClient(cfg),
InspectionRecord: NewInspectionRecordClient(cfg),
LinePoint: NewLinePointClient(cfg),
@@ -305,6 +310,7 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
Attachment: NewAttachmentClient(cfg),
BomItem: NewBomItemClient(cfg),
DailyPlan: NewDailyPlanClient(cfg),
+ Dock: NewDockClient(cfg),
EventLog: NewEventLogClient(cfg),
InspectionRecord: NewInspectionRecordClient(cfg),
LinePoint: NewLinePointClient(cfg),
@@ -360,7 +366,7 @@ func (c *Client) Close() error {
func (c *Client) Use(hooks ...Hook) {
for _, n := range []interface{ Use(...Hook) }{
c.Alert, c.AlertRule, c.AssociationTrace, c.Attachment, c.BomItem, c.DailyPlan,
- c.EventLog, c.InspectionRecord, c.LinePoint, c.MaterialQtyReport,
+ c.Dock, c.EventLog, c.InspectionRecord, c.LinePoint, c.MaterialQtyReport,
c.MaterialRequest, c.Permission, c.PlcMoveCmd, c.PlcSendLog, c.ProcessFlow,
c.ProcessStep, c.ProductType, c.Role, c.SemiFlow, c.Station, c.StationProcess,
c.StepCriterion, c.StepData, c.TorqueAuditLog, c.TorqueRecord, c.User,
@@ -375,7 +381,7 @@ func (c *Client) Use(hooks ...Hook) {
func (c *Client) Intercept(interceptors ...Interceptor) {
for _, n := range []interface{ Intercept(...Interceptor) }{
c.Alert, c.AlertRule, c.AssociationTrace, c.Attachment, c.BomItem, c.DailyPlan,
- c.EventLog, c.InspectionRecord, c.LinePoint, c.MaterialQtyReport,
+ c.Dock, c.EventLog, c.InspectionRecord, c.LinePoint, c.MaterialQtyReport,
c.MaterialRequest, c.Permission, c.PlcMoveCmd, c.PlcSendLog, c.ProcessFlow,
c.ProcessStep, c.ProductType, c.Role, c.SemiFlow, c.Station, c.StationProcess,
c.StepCriterion, c.StepData, c.TorqueAuditLog, c.TorqueRecord, c.User,
@@ -400,6 +406,8 @@ func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) {
return c.BomItem.mutate(ctx, m)
case *DailyPlanMutation:
return c.DailyPlan.mutate(ctx, m)
+ case *DockMutation:
+ return c.Dock.mutate(ctx, m)
case *EventLogMutation:
return c.EventLog.mutate(ctx, m)
case *InspectionRecordMutation:
@@ -1253,6 +1261,139 @@ func (c *DailyPlanClient) mutate(ctx context.Context, m *DailyPlanMutation) (Val
}
}
+// DockClient is a client for the Dock schema.
+type DockClient struct {
+ config
+}
+
+// NewDockClient returns a client for the Dock from the given config.
+func NewDockClient(c config) *DockClient {
+ return &DockClient{config: c}
+}
+
+// Use adds a list of mutation hooks to the hooks stack.
+// A call to `Use(f, g, h)` equals to `dock.Hooks(f(g(h())))`.
+func (c *DockClient) Use(hooks ...Hook) {
+ c.hooks.Dock = append(c.hooks.Dock, hooks...)
+}
+
+// Intercept adds a list of query interceptors to the interceptors stack.
+// A call to `Intercept(f, g, h)` equals to `dock.Intercept(f(g(h())))`.
+func (c *DockClient) Intercept(interceptors ...Interceptor) {
+ c.inters.Dock = append(c.inters.Dock, interceptors...)
+}
+
+// Create returns a builder for creating a Dock entity.
+func (c *DockClient) Create() *DockCreate {
+ mutation := newDockMutation(c.config, OpCreate)
+ return &DockCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// CreateBulk returns a builder for creating a bulk of Dock entities.
+func (c *DockClient) CreateBulk(builders ...*DockCreate) *DockCreateBulk {
+ return &DockCreateBulk{config: c.config, builders: builders}
+}
+
+// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
+// a builder and applies setFunc on it.
+func (c *DockClient) MapCreateBulk(slice any, setFunc func(*DockCreate, int)) *DockCreateBulk {
+ rv := reflect.ValueOf(slice)
+ if rv.Kind() != reflect.Slice {
+ return &DockCreateBulk{err: fmt.Errorf("calling to DockClient.MapCreateBulk with wrong type %T, need slice", slice)}
+ }
+ builders := make([]*DockCreate, rv.Len())
+ for i := 0; i < rv.Len(); i++ {
+ builders[i] = c.Create()
+ setFunc(builders[i], i)
+ }
+ return &DockCreateBulk{config: c.config, builders: builders}
+}
+
+// Update returns an update builder for Dock.
+func (c *DockClient) Update() *DockUpdate {
+ mutation := newDockMutation(c.config, OpUpdate)
+ return &DockUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOne returns an update builder for the given entity.
+func (c *DockClient) UpdateOne(_m *Dock) *DockUpdateOne {
+ mutation := newDockMutation(c.config, OpUpdateOne, withDock(_m))
+ return &DockUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// UpdateOneID returns an update builder for the given id.
+func (c *DockClient) UpdateOneID(id int) *DockUpdateOne {
+ mutation := newDockMutation(c.config, OpUpdateOne, withDockID(id))
+ return &DockUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// Delete returns a delete builder for Dock.
+func (c *DockClient) Delete() *DockDelete {
+ mutation := newDockMutation(c.config, OpDelete)
+ return &DockDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
+}
+
+// DeleteOne returns a builder for deleting the given entity.
+func (c *DockClient) DeleteOne(_m *Dock) *DockDeleteOne {
+ return c.DeleteOneID(_m.ID)
+}
+
+// DeleteOneID returns a builder for deleting the given entity by its id.
+func (c *DockClient) DeleteOneID(id int) *DockDeleteOne {
+ builder := c.Delete().Where(dock.ID(id))
+ builder.mutation.id = &id
+ builder.mutation.op = OpDeleteOne
+ return &DockDeleteOne{builder}
+}
+
+// Query returns a query builder for Dock.
+func (c *DockClient) Query() *DockQuery {
+ return &DockQuery{
+ config: c.config,
+ ctx: &QueryContext{Type: TypeDock},
+ inters: c.Interceptors(),
+ }
+}
+
+// Get returns a Dock entity by its id.
+func (c *DockClient) Get(ctx context.Context, id int) (*Dock, error) {
+ return c.Query().Where(dock.ID(id)).Only(ctx)
+}
+
+// GetX is like Get, but panics if an error occurs.
+func (c *DockClient) GetX(ctx context.Context, id int) *Dock {
+ obj, err := c.Get(ctx, id)
+ if err != nil {
+ panic(err)
+ }
+ return obj
+}
+
+// Hooks returns the client hooks.
+func (c *DockClient) Hooks() []Hook {
+ return c.hooks.Dock
+}
+
+// Interceptors returns the client interceptors.
+func (c *DockClient) Interceptors() []Interceptor {
+ return c.inters.Dock
+}
+
+func (c *DockClient) mutate(ctx context.Context, m *DockMutation) (Value, error) {
+ switch m.Op() {
+ case OpCreate:
+ return (&DockCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdate:
+ return (&DockUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpUpdateOne:
+ return (&DockUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
+ case OpDelete, OpDeleteOne:
+ return (&DockDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
+ default:
+ return nil, fmt.Errorf("ent: unknown Dock mutation op: %q", m.Op())
+ }
+}
+
// EventLogClient is a client for the EventLog schema.
type EventLogClient struct {
config
@@ -4581,19 +4722,19 @@ func (c *WorkpieceProcessClient) mutate(ctx context.Context, m *WorkpieceProcess
// hooks and interceptors per client, for fast access.
type (
hooks struct {
- Alert, AlertRule, AssociationTrace, Attachment, BomItem, DailyPlan, EventLog,
- InspectionRecord, LinePoint, MaterialQtyReport, MaterialRequest, Permission,
- PlcMoveCmd, PlcSendLog, ProcessFlow, ProcessStep, ProductType, Role, SemiFlow,
- Station, StationProcess, StepCriterion, StepData, TorqueAuditLog, TorqueRecord,
- User, UserStation, WorkOrder, Workpiece, WorkpieceBind,
- WorkpieceProcess []ent.Hook
+ Alert, AlertRule, AssociationTrace, Attachment, BomItem, DailyPlan, Dock,
+ EventLog, InspectionRecord, LinePoint, MaterialQtyReport, MaterialRequest,
+ Permission, PlcMoveCmd, PlcSendLog, ProcessFlow, ProcessStep, ProductType,
+ Role, SemiFlow, Station, StationProcess, StepCriterion, StepData,
+ TorqueAuditLog, TorqueRecord, User, UserStation, WorkOrder, Workpiece,
+ WorkpieceBind, WorkpieceProcess []ent.Hook
}
inters struct {
- Alert, AlertRule, AssociationTrace, Attachment, BomItem, DailyPlan, EventLog,
- InspectionRecord, LinePoint, MaterialQtyReport, MaterialRequest, Permission,
- PlcMoveCmd, PlcSendLog, ProcessFlow, ProcessStep, ProductType, Role, SemiFlow,
- Station, StationProcess, StepCriterion, StepData, TorqueAuditLog, TorqueRecord,
- User, UserStation, WorkOrder, Workpiece, WorkpieceBind,
- WorkpieceProcess []ent.Interceptor
+ Alert, AlertRule, AssociationTrace, Attachment, BomItem, DailyPlan, Dock,
+ EventLog, InspectionRecord, LinePoint, MaterialQtyReport, MaterialRequest,
+ Permission, PlcMoveCmd, PlcSendLog, ProcessFlow, ProcessStep, ProductType,
+ Role, SemiFlow, Station, StationProcess, StepCriterion, StepData,
+ TorqueAuditLog, TorqueRecord, User, UserStation, WorkOrder, Workpiece,
+ WorkpieceBind, WorkpieceProcess []ent.Interceptor
}
)
diff --git a/bj_power_wms/ent/dock.go b/bj_power_mes/ent/dock.go
similarity index 82%
rename from bj_power_wms/ent/dock.go
rename to bj_power_mes/ent/dock.go
index 8d9a357..72aedba 100644
--- a/bj_power_wms/ent/dock.go
+++ b/bj_power_mes/ent/dock.go
@@ -3,9 +3,10 @@
package ent
import (
- "bj_power_wms/ent/dock"
+ "bj_power_mes/ent/dock"
"fmt"
"strings"
+ "time"
"entgo.io/ent"
"entgo.io/ent/dialect/sql"
@@ -30,8 +31,8 @@ type Dock struct {
PalletRef string `json:"palletRef,omitempty"`
// Status holds the value of the "status" field.
Status string `json:"status,omitempty"`
- // 鍒涘缓鏃堕棿
- CreatedAt int64 `json:"createdAt,omitempty"`
+ // CreatedAt holds the value of the "createdAt" field.
+ CreatedAt time.Time `json:"createdAt,omitempty"`
selectValues sql.SelectValues
}
@@ -42,10 +43,12 @@ func (*Dock) scanValues(columns []string) ([]any, error) {
switch columns[i] {
case dock.FieldHasPallet:
values[i] = new(sql.NullBool)
- case dock.FieldID, dock.FieldStationNo, dock.FieldCreatedAt:
+ case dock.FieldID, dock.FieldStationNo:
values[i] = new(sql.NullInt64)
case dock.FieldDockCode, dock.FieldName, dock.FieldDockType, dock.FieldPalletRef, dock.FieldStatus:
values[i] = new(sql.NullString)
+ case dock.FieldCreatedAt:
+ values[i] = new(sql.NullTime)
default:
values[i] = new(sql.UnknownType)
}
@@ -69,7 +72,7 @@ func (_m *Dock) assignValues(columns []string, values []any) error {
_m.ID = int(value.Int64)
case dock.FieldDockCode:
if value, ok := values[i].(*sql.NullString); !ok {
- return fmt.Errorf("unexpected type %T for field dock_code", values[i])
+ return fmt.Errorf("unexpected type %T for field dockCode", values[i])
} else if value.Valid {
_m.DockCode = value.String
}
@@ -81,25 +84,25 @@ func (_m *Dock) assignValues(columns []string, values []any) error {
}
case dock.FieldDockType:
if value, ok := values[i].(*sql.NullString); !ok {
- return fmt.Errorf("unexpected type %T for field dock_type", values[i])
+ return fmt.Errorf("unexpected type %T for field dockType", values[i])
} else if value.Valid {
_m.DockType = value.String
}
case dock.FieldStationNo:
if value, ok := values[i].(*sql.NullInt64); !ok {
- return fmt.Errorf("unexpected type %T for field station_no", values[i])
+ return fmt.Errorf("unexpected type %T for field stationNo", values[i])
} else if value.Valid {
_m.StationNo = int(value.Int64)
}
case dock.FieldHasPallet:
if value, ok := values[i].(*sql.NullBool); !ok {
- return fmt.Errorf("unexpected type %T for field has_pallet", values[i])
+ return fmt.Errorf("unexpected type %T for field hasPallet", values[i])
} else if value.Valid {
_m.HasPallet = value.Bool
}
case dock.FieldPalletRef:
if value, ok := values[i].(*sql.NullString); !ok {
- return fmt.Errorf("unexpected type %T for field pallet_ref", values[i])
+ return fmt.Errorf("unexpected type %T for field palletRef", values[i])
} else if value.Valid {
_m.PalletRef = value.String
}
@@ -110,10 +113,10 @@ func (_m *Dock) assignValues(columns []string, values []any) error {
_m.Status = value.String
}
case dock.FieldCreatedAt:
- if value, ok := values[i].(*sql.NullInt64); !ok {
- return fmt.Errorf("unexpected type %T for field created_at", values[i])
+ if value, ok := values[i].(*sql.NullTime); !ok {
+ return fmt.Errorf("unexpected type %T for field createdAt", values[i])
} else if value.Valid {
- _m.CreatedAt = value.Int64
+ _m.CreatedAt = value.Time
}
default:
_m.selectValues.Set(columns[i], values[i])
@@ -151,29 +154,29 @@ func (_m *Dock) String() string {
var builder strings.Builder
builder.WriteString("Dock(")
builder.WriteString(fmt.Sprintf("id=%v, ", _m.ID))
- builder.WriteString("dock_code=")
+ builder.WriteString("dockCode=")
builder.WriteString(_m.DockCode)
builder.WriteString(", ")
builder.WriteString("name=")
builder.WriteString(_m.Name)
builder.WriteString(", ")
- builder.WriteString("dock_type=")
+ builder.WriteString("dockType=")
builder.WriteString(_m.DockType)
builder.WriteString(", ")
- builder.WriteString("station_no=")
+ builder.WriteString("stationNo=")
builder.WriteString(fmt.Sprintf("%v", _m.StationNo))
builder.WriteString(", ")
- builder.WriteString("has_pallet=")
+ builder.WriteString("hasPallet=")
builder.WriteString(fmt.Sprintf("%v", _m.HasPallet))
builder.WriteString(", ")
- builder.WriteString("pallet_ref=")
+ builder.WriteString("palletRef=")
builder.WriteString(_m.PalletRef)
builder.WriteString(", ")
builder.WriteString("status=")
builder.WriteString(_m.Status)
builder.WriteString(", ")
- builder.WriteString("created_at=")
- builder.WriteString(fmt.Sprintf("%v", _m.CreatedAt))
+ builder.WriteString("createdAt=")
+ builder.WriteString(_m.CreatedAt.Format(time.ANSIC))
builder.WriteByte(')')
return builder.String()
}
diff --git a/bj_power_wms/ent/dock/dock.go b/bj_power_mes/ent/dock/dock.go
similarity index 72%
rename from bj_power_wms/ent/dock/dock.go
rename to bj_power_mes/ent/dock/dock.go
index b17a733..47e7f2e 100644
--- a/bj_power_wms/ent/dock/dock.go
+++ b/bj_power_mes/ent/dock/dock.go
@@ -3,6 +3,8 @@
package dock
import (
+ "time"
+
"entgo.io/ent/dialect/sql"
)
@@ -11,24 +13,24 @@ const (
Label = "dock"
// FieldID holds the string denoting the id field in the database.
FieldID = "id"
- // FieldDockCode holds the string denoting the dock_code field in the database.
+ // FieldDockCode holds the string denoting the dockcode field in the database.
FieldDockCode = "dock_code"
// FieldName holds the string denoting the name field in the database.
FieldName = "name"
- // FieldDockType holds the string denoting the dock_type field in the database.
+ // FieldDockType holds the string denoting the docktype field in the database.
FieldDockType = "dock_type"
- // FieldStationNo holds the string denoting the station_no field in the database.
+ // FieldStationNo holds the string denoting the stationno field in the database.
FieldStationNo = "station_no"
- // FieldHasPallet holds the string denoting the has_pallet field in the database.
+ // FieldHasPallet holds the string denoting the haspallet field in the database.
FieldHasPallet = "has_pallet"
- // FieldPalletRef holds the string denoting the pallet_ref field in the database.
+ // FieldPalletRef holds the string denoting the palletref field in the database.
FieldPalletRef = "pallet_ref"
// FieldStatus holds the string denoting the status field in the database.
FieldStatus = "status"
- // FieldCreatedAt holds the string denoting the created_at field in the database.
+ // FieldCreatedAt holds the string denoting the createdat field in the database.
FieldCreatedAt = "created_at"
// Table holds the table name of the dock in the database.
- Table = "docks"
+ Table = "dock"
)
// Columns holds all SQL columns for dock fields.
@@ -55,30 +57,30 @@ func ValidColumn(column string) bool {
}
var (
- // DockCodeValidator is a validator for the "dock_code" field. It is called by the builders before save.
+ // DockCodeValidator is a validator for the "dockCode" field. It is called by the builders before save.
DockCodeValidator func(string) error
// DefaultName holds the default value on creation for the "name" field.
DefaultName string
// NameValidator is a validator for the "name" field. It is called by the builders before save.
NameValidator func(string) error
- // DefaultDockType holds the default value on creation for the "dock_type" field.
+ // DefaultDockType holds the default value on creation for the "dockType" field.
DefaultDockType string
- // DockTypeValidator is a validator for the "dock_type" field. It is called by the builders before save.
+ // DockTypeValidator is a validator for the "dockType" field. It is called by the builders before save.
DockTypeValidator func(string) error
- // DefaultStationNo holds the default value on creation for the "station_no" field.
+ // DefaultStationNo holds the default value on creation for the "stationNo" field.
DefaultStationNo int
- // DefaultHasPallet holds the default value on creation for the "has_pallet" field.
+ // DefaultHasPallet holds the default value on creation for the "hasPallet" field.
DefaultHasPallet bool
- // DefaultPalletRef holds the default value on creation for the "pallet_ref" field.
+ // DefaultPalletRef holds the default value on creation for the "palletRef" field.
DefaultPalletRef string
- // PalletRefValidator is a validator for the "pallet_ref" field. It is called by the builders before save.
+ // PalletRefValidator is a validator for the "palletRef" field. It is called by the builders before save.
PalletRefValidator func(string) error
// DefaultStatus holds the default value on creation for the "status" field.
DefaultStatus string
// StatusValidator is a validator for the "status" field. It is called by the builders before save.
StatusValidator func(string) error
- // DefaultCreatedAt holds the default value on creation for the "created_at" field.
- DefaultCreatedAt func() int64
+ // DefaultCreatedAt holds the default value on creation for the "createdAt" field.
+ DefaultCreatedAt func() time.Time
)
// OrderOption defines the ordering options for the Dock queries.
@@ -89,7 +91,7 @@ func ByID(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldID, opts...).ToFunc()
}
-// ByDockCode orders the results by the dock_code field.
+// ByDockCode orders the results by the dockCode field.
func ByDockCode(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDockCode, opts...).ToFunc()
}
@@ -99,22 +101,22 @@ func ByName(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldName, opts...).ToFunc()
}
-// ByDockType orders the results by the dock_type field.
+// ByDockType orders the results by the dockType field.
func ByDockType(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldDockType, opts...).ToFunc()
}
-// ByStationNo orders the results by the station_no field.
+// ByStationNo orders the results by the stationNo field.
func ByStationNo(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStationNo, opts...).ToFunc()
}
-// ByHasPallet orders the results by the has_pallet field.
+// ByHasPallet orders the results by the hasPallet field.
func ByHasPallet(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldHasPallet, opts...).ToFunc()
}
-// ByPalletRef orders the results by the pallet_ref field.
+// ByPalletRef orders the results by the palletRef field.
func ByPalletRef(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldPalletRef, opts...).ToFunc()
}
@@ -124,7 +126,7 @@ func ByStatus(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldStatus, opts...).ToFunc()
}
-// ByCreatedAt orders the results by the created_at field.
+// ByCreatedAt orders the results by the createdAt field.
func ByCreatedAt(opts ...sql.OrderTermOption) OrderOption {
return sql.OrderByField(FieldCreatedAt, opts...).ToFunc()
}
diff --git a/bj_power_wms/ent/dock/where.go b/bj_power_mes/ent/dock/where.go
similarity index 75%
rename from bj_power_wms/ent/dock/where.go
rename to bj_power_mes/ent/dock/where.go
index 47edbd6..bd20ad3 100644
--- a/bj_power_wms/ent/dock/where.go
+++ b/bj_power_mes/ent/dock/where.go
@@ -3,7 +3,8 @@
package dock
import (
- "bj_power_wms/ent/predicate"
+ "bj_power_mes/ent/predicate"
+ "time"
"entgo.io/ent/dialect/sql"
)
@@ -53,7 +54,7 @@ func IDLTE(id int) predicate.Dock {
return predicate.Dock(sql.FieldLTE(FieldID, id))
}
-// DockCode applies equality check predicate on the "dock_code" field. It's identical to DockCodeEQ.
+// DockCode applies equality check predicate on the "dockCode" field. It's identical to DockCodeEQ.
func DockCode(v string) predicate.Dock {
return predicate.Dock(sql.FieldEQ(FieldDockCode, v))
}
@@ -63,22 +64,22 @@ func Name(v string) predicate.Dock {
return predicate.Dock(sql.FieldEQ(FieldName, v))
}
-// DockType applies equality check predicate on the "dock_type" field. It's identical to DockTypeEQ.
+// DockType applies equality check predicate on the "dockType" field. It's identical to DockTypeEQ.
func DockType(v string) predicate.Dock {
return predicate.Dock(sql.FieldEQ(FieldDockType, v))
}
-// StationNo applies equality check predicate on the "station_no" field. It's identical to StationNoEQ.
+// StationNo applies equality check predicate on the "stationNo" field. It's identical to StationNoEQ.
func StationNo(v int) predicate.Dock {
return predicate.Dock(sql.FieldEQ(FieldStationNo, v))
}
-// HasPallet applies equality check predicate on the "has_pallet" field. It's identical to HasPalletEQ.
+// HasPallet applies equality check predicate on the "hasPallet" field. It's identical to HasPalletEQ.
func HasPallet(v bool) predicate.Dock {
return predicate.Dock(sql.FieldEQ(FieldHasPallet, v))
}
-// PalletRef applies equality check predicate on the "pallet_ref" field. It's identical to PalletRefEQ.
+// PalletRef applies equality check predicate on the "palletRef" field. It's identical to PalletRefEQ.
func PalletRef(v string) predicate.Dock {
return predicate.Dock(sql.FieldEQ(FieldPalletRef, v))
}
@@ -88,72 +89,72 @@ func Status(v string) predicate.Dock {
return predicate.Dock(sql.FieldEQ(FieldStatus, v))
}
-// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ.
-func CreatedAt(v int64) predicate.Dock {
+// CreatedAt applies equality check predicate on the "createdAt" field. It's identical to CreatedAtEQ.
+func CreatedAt(v time.Time) predicate.Dock {
return predicate.Dock(sql.FieldEQ(FieldCreatedAt, v))
}
-// DockCodeEQ applies the EQ predicate on the "dock_code" field.
+// DockCodeEQ applies the EQ predicate on the "dockCode" field.
func DockCodeEQ(v string) predicate.Dock {
return predicate.Dock(sql.FieldEQ(FieldDockCode, v))
}
-// DockCodeNEQ applies the NEQ predicate on the "dock_code" field.
+// DockCodeNEQ applies the NEQ predicate on the "dockCode" field.
func DockCodeNEQ(v string) predicate.Dock {
return predicate.Dock(sql.FieldNEQ(FieldDockCode, v))
}
-// DockCodeIn applies the In predicate on the "dock_code" field.
+// DockCodeIn applies the In predicate on the "dockCode" field.
func DockCodeIn(vs ...string) predicate.Dock {
return predicate.Dock(sql.FieldIn(FieldDockCode, vs...))
}
-// DockCodeNotIn applies the NotIn predicate on the "dock_code" field.
+// DockCodeNotIn applies the NotIn predicate on the "dockCode" field.
func DockCodeNotIn(vs ...string) predicate.Dock {
return predicate.Dock(sql.FieldNotIn(FieldDockCode, vs...))
}
-// DockCodeGT applies the GT predicate on the "dock_code" field.
+// DockCodeGT applies the GT predicate on the "dockCode" field.
func DockCodeGT(v string) predicate.Dock {
return predicate.Dock(sql.FieldGT(FieldDockCode, v))
}
-// DockCodeGTE applies the GTE predicate on the "dock_code" field.
+// DockCodeGTE applies the GTE predicate on the "dockCode" field.
func DockCodeGTE(v string) predicate.Dock {
return predicate.Dock(sql.FieldGTE(FieldDockCode, v))
}
-// DockCodeLT applies the LT predicate on the "dock_code" field.
+// DockCodeLT applies the LT predicate on the "dockCode" field.
func DockCodeLT(v string) predicate.Dock {
return predicate.Dock(sql.FieldLT(FieldDockCode, v))
}
-// DockCodeLTE applies the LTE predicate on the "dock_code" field.
+// DockCodeLTE applies the LTE predicate on the "dockCode" field.
func DockCodeLTE(v string) predicate.Dock {
return predicate.Dock(sql.FieldLTE(FieldDockCode, v))
}
-// DockCodeContains applies the Contains predicate on the "dock_code" field.
+// DockCodeContains applies the Contains predicate on the "dockCode" field.
func DockCodeContains(v string) predicate.Dock {
return predicate.Dock(sql.FieldContains(FieldDockCode, v))
}
-// DockCodeHasPrefix applies the HasPrefix predicate on the "dock_code" field.
+// DockCodeHasPrefix applies the HasPrefix predicate on the "dockCode" field.
func DockCodeHasPrefix(v string) predicate.Dock {
return predicate.Dock(sql.FieldHasPrefix(FieldDockCode, v))
}
-// DockCodeHasSuffix applies the HasSuffix predicate on the "dock_code" field.
+// DockCodeHasSuffix applies the HasSuffix predicate on the "dockCode" field.
func DockCodeHasSuffix(v string) predicate.Dock {
return predicate.Dock(sql.FieldHasSuffix(FieldDockCode, v))
}
-// DockCodeEqualFold applies the EqualFold predicate on the "dock_code" field.
+// DockCodeEqualFold applies the EqualFold predicate on the "dockCode" field.
func DockCodeEqualFold(v string) predicate.Dock {
return predicate.Dock(sql.FieldEqualFold(FieldDockCode, v))
}
-// DockCodeContainsFold applies the ContainsFold predicate on the "dock_code" field.
+// DockCodeContainsFold applies the ContainsFold predicate on the "dockCode" field.
func DockCodeContainsFold(v string) predicate.Dock {
return predicate.Dock(sql.FieldContainsFold(FieldDockCode, v))
}
@@ -223,192 +224,192 @@ func NameContainsFold(v string) predicate.Dock {
return predicate.Dock(sql.FieldContainsFold(FieldName, v))
}
-// DockTypeEQ applies the EQ predicate on the "dock_type" field.
+// DockTypeEQ applies the EQ predicate on the "dockType" field.
func DockTypeEQ(v string) predicate.Dock {
return predicate.Dock(sql.FieldEQ(FieldDockType, v))
}
-// DockTypeNEQ applies the NEQ predicate on the "dock_type" field.
+// DockTypeNEQ applies the NEQ predicate on the "dockType" field.
func DockTypeNEQ(v string) predicate.Dock {
return predicate.Dock(sql.FieldNEQ(FieldDockType, v))
}
-// DockTypeIn applies the In predicate on the "dock_type" field.
+// DockTypeIn applies the In predicate on the "dockType" field.
func DockTypeIn(vs ...string) predicate.Dock {
return predicate.Dock(sql.FieldIn(FieldDockType, vs...))
}
-// DockTypeNotIn applies the NotIn predicate on the "dock_type" field.
+// DockTypeNotIn applies the NotIn predicate on the "dockType" field.
func DockTypeNotIn(vs ...string) predicate.Dock {
return predicate.Dock(sql.FieldNotIn(FieldDockType, vs...))
}
-// DockTypeGT applies the GT predicate on the "dock_type" field.
+// DockTypeGT applies the GT predicate on the "dockType" field.
func DockTypeGT(v string) predicate.Dock {
return predicate.Dock(sql.FieldGT(FieldDockType, v))
}
-// DockTypeGTE applies the GTE predicate on the "dock_type" field.
+// DockTypeGTE applies the GTE predicate on the "dockType" field.
func DockTypeGTE(v string) predicate.Dock {
return predicate.Dock(sql.FieldGTE(FieldDockType, v))
}
-// DockTypeLT applies the LT predicate on the "dock_type" field.
+// DockTypeLT applies the LT predicate on the "dockType" field.
func DockTypeLT(v string) predicate.Dock {
return predicate.Dock(sql.FieldLT(FieldDockType, v))
}
-// DockTypeLTE applies the LTE predicate on the "dock_type" field.
+// DockTypeLTE applies the LTE predicate on the "dockType" field.
func DockTypeLTE(v string) predicate.Dock {
return predicate.Dock(sql.FieldLTE(FieldDockType, v))
}
-// DockTypeContains applies the Contains predicate on the "dock_type" field.
+// DockTypeContains applies the Contains predicate on the "dockType" field.
func DockTypeContains(v string) predicate.Dock {
return predicate.Dock(sql.FieldContains(FieldDockType, v))
}
-// DockTypeHasPrefix applies the HasPrefix predicate on the "dock_type" field.
+// DockTypeHasPrefix applies the HasPrefix predicate on the "dockType" field.
func DockTypeHasPrefix(v string) predicate.Dock {
return predicate.Dock(sql.FieldHasPrefix(FieldDockType, v))
}
-// DockTypeHasSuffix applies the HasSuffix predicate on the "dock_type" field.
+// DockTypeHasSuffix applies the HasSuffix predicate on the "dockType" field.
func DockTypeHasSuffix(v string) predicate.Dock {
return predicate.Dock(sql.FieldHasSuffix(FieldDockType, v))
}
-// DockTypeEqualFold applies the EqualFold predicate on the "dock_type" field.
+// DockTypeEqualFold applies the EqualFold predicate on the "dockType" field.
func DockTypeEqualFold(v string) predicate.Dock {
return predicate.Dock(sql.FieldEqualFold(FieldDockType, v))
}
-// DockTypeContainsFold applies the ContainsFold predicate on the "dock_type" field.
+// DockTypeContainsFold applies the ContainsFold predicate on the "dockType" field.
func DockTypeContainsFold(v string) predicate.Dock {
return predicate.Dock(sql.FieldContainsFold(FieldDockType, v))
}
-// StationNoEQ applies the EQ predicate on the "station_no" field.
+// StationNoEQ applies the EQ predicate on the "stationNo" field.
func StationNoEQ(v int) predicate.Dock {
return predicate.Dock(sql.FieldEQ(FieldStationNo, v))
}
-// StationNoNEQ applies the NEQ predicate on the "station_no" field.
+// StationNoNEQ applies the NEQ predicate on the "stationNo" field.
func StationNoNEQ(v int) predicate.Dock {
return predicate.Dock(sql.FieldNEQ(FieldStationNo, v))
}
-// StationNoIn applies the In predicate on the "station_no" field.
+// StationNoIn applies the In predicate on the "stationNo" field.
func StationNoIn(vs ...int) predicate.Dock {
return predicate.Dock(sql.FieldIn(FieldStationNo, vs...))
}
-// StationNoNotIn applies the NotIn predicate on the "station_no" field.
+// StationNoNotIn applies the NotIn predicate on the "stationNo" field.
func StationNoNotIn(vs ...int) predicate.Dock {
return predicate.Dock(sql.FieldNotIn(FieldStationNo, vs...))
}
-// StationNoGT applies the GT predicate on the "station_no" field.
+// StationNoGT applies the GT predicate on the "stationNo" field.
func StationNoGT(v int) predicate.Dock {
return predicate.Dock(sql.FieldGT(FieldStationNo, v))
}
-// StationNoGTE applies the GTE predicate on the "station_no" field.
+// StationNoGTE applies the GTE predicate on the "stationNo" field.
func StationNoGTE(v int) predicate.Dock {
return predicate.Dock(sql.FieldGTE(FieldStationNo, v))
}
-// StationNoLT applies the LT predicate on the "station_no" field.
+// StationNoLT applies the LT predicate on the "stationNo" field.
func StationNoLT(v int) predicate.Dock {
return predicate.Dock(sql.FieldLT(FieldStationNo, v))
}
-// StationNoLTE applies the LTE predicate on the "station_no" field.
+// StationNoLTE applies the LTE predicate on the "stationNo" field.
func StationNoLTE(v int) predicate.Dock {
return predicate.Dock(sql.FieldLTE(FieldStationNo, v))
}
-// HasPalletEQ applies the EQ predicate on the "has_pallet" field.
+// HasPalletEQ applies the EQ predicate on the "hasPallet" field.
func HasPalletEQ(v bool) predicate.Dock {
return predicate.Dock(sql.FieldEQ(FieldHasPallet, v))
}
-// HasPalletNEQ applies the NEQ predicate on the "has_pallet" field.
+// HasPalletNEQ applies the NEQ predicate on the "hasPallet" field.
func HasPalletNEQ(v bool) predicate.Dock {
return predicate.Dock(sql.FieldNEQ(FieldHasPallet, v))
}
-// PalletRefEQ applies the EQ predicate on the "pallet_ref" field.
+// PalletRefEQ applies the EQ predicate on the "palletRef" field.
func PalletRefEQ(v string) predicate.Dock {
return predicate.Dock(sql.FieldEQ(FieldPalletRef, v))
}
-// PalletRefNEQ applies the NEQ predicate on the "pallet_ref" field.
+// PalletRefNEQ applies the NEQ predicate on the "palletRef" field.
func PalletRefNEQ(v string) predicate.Dock {
return predicate.Dock(sql.FieldNEQ(FieldPalletRef, v))
}
-// PalletRefIn applies the In predicate on the "pallet_ref" field.
+// PalletRefIn applies the In predicate on the "palletRef" field.
func PalletRefIn(vs ...string) predicate.Dock {
return predicate.Dock(sql.FieldIn(FieldPalletRef, vs...))
}
-// PalletRefNotIn applies the NotIn predicate on the "pallet_ref" field.
+// PalletRefNotIn applies the NotIn predicate on the "palletRef" field.
func PalletRefNotIn(vs ...string) predicate.Dock {
return predicate.Dock(sql.FieldNotIn(FieldPalletRef, vs...))
}
-// PalletRefGT applies the GT predicate on the "pallet_ref" field.
+// PalletRefGT applies the GT predicate on the "palletRef" field.
func PalletRefGT(v string) predicate.Dock {
return predicate.Dock(sql.FieldGT(FieldPalletRef, v))
}
-// PalletRefGTE applies the GTE predicate on the "pallet_ref" field.
+// PalletRefGTE applies the GTE predicate on the "palletRef" field.
func PalletRefGTE(v string) predicate.Dock {
return predicate.Dock(sql.FieldGTE(FieldPalletRef, v))
}
-// PalletRefLT applies the LT predicate on the "pallet_ref" field.
+// PalletRefLT applies the LT predicate on the "palletRef" field.
func PalletRefLT(v string) predicate.Dock {
return predicate.Dock(sql.FieldLT(FieldPalletRef, v))
}
-// PalletRefLTE applies the LTE predicate on the "pallet_ref" field.
+// PalletRefLTE applies the LTE predicate on the "palletRef" field.
func PalletRefLTE(v string) predicate.Dock {
return predicate.Dock(sql.FieldLTE(FieldPalletRef, v))
}
-// PalletRefContains applies the Contains predicate on the "pallet_ref" field.
+// PalletRefContains applies the Contains predicate on the "palletRef" field.
func PalletRefContains(v string) predicate.Dock {
return predicate.Dock(sql.FieldContains(FieldPalletRef, v))
}
-// PalletRefHasPrefix applies the HasPrefix predicate on the "pallet_ref" field.
+// PalletRefHasPrefix applies the HasPrefix predicate on the "palletRef" field.
func PalletRefHasPrefix(v string) predicate.Dock {
return predicate.Dock(sql.FieldHasPrefix(FieldPalletRef, v))
}
-// PalletRefHasSuffix applies the HasSuffix predicate on the "pallet_ref" field.
+// PalletRefHasSuffix applies the HasSuffix predicate on the "palletRef" field.
func PalletRefHasSuffix(v string) predicate.Dock {
return predicate.Dock(sql.FieldHasSuffix(FieldPalletRef, v))
}
-// PalletRefIsNil applies the IsNil predicate on the "pallet_ref" field.
+// PalletRefIsNil applies the IsNil predicate on the "palletRef" field.
func PalletRefIsNil() predicate.Dock {
return predicate.Dock(sql.FieldIsNull(FieldPalletRef))
}
-// PalletRefNotNil applies the NotNil predicate on the "pallet_ref" field.
+// PalletRefNotNil applies the NotNil predicate on the "palletRef" field.
func PalletRefNotNil() predicate.Dock {
return predicate.Dock(sql.FieldNotNull(FieldPalletRef))
}
-// PalletRefEqualFold applies the EqualFold predicate on the "pallet_ref" field.
+// PalletRefEqualFold applies the EqualFold predicate on the "palletRef" field.
func PalletRefEqualFold(v string) predicate.Dock {
return predicate.Dock(sql.FieldEqualFold(FieldPalletRef, v))
}
-// PalletRefContainsFold applies the ContainsFold predicate on the "pallet_ref" field.
+// PalletRefContainsFold applies the ContainsFold predicate on the "palletRef" field.
func PalletRefContainsFold(v string) predicate.Dock {
return predicate.Dock(sql.FieldContainsFold(FieldPalletRef, v))
}
@@ -478,43 +479,43 @@ func StatusContainsFold(v string) predicate.Dock {
return predicate.Dock(sql.FieldContainsFold(FieldStatus, v))
}
-// CreatedAtEQ applies the EQ predicate on the "created_at" field.
-func CreatedAtEQ(v int64) predicate.Dock {
+// CreatedAtEQ applies the EQ predicate on the "createdAt" field.
+func CreatedAtEQ(v time.Time) predicate.Dock {
return predicate.Dock(sql.FieldEQ(FieldCreatedAt, v))
}
-// CreatedAtNEQ applies the NEQ predicate on the "created_at" field.
-func CreatedAtNEQ(v int64) predicate.Dock {
+// CreatedAtNEQ applies the NEQ predicate on the "createdAt" field.
+func CreatedAtNEQ(v time.Time) predicate.Dock {
return predicate.Dock(sql.FieldNEQ(FieldCreatedAt, v))
}
-// CreatedAtIn applies the In predicate on the "created_at" field.
-func CreatedAtIn(vs ...int64) predicate.Dock {
+// CreatedAtIn applies the In predicate on the "createdAt" field.
+func CreatedAtIn(vs ...time.Time) predicate.Dock {
return predicate.Dock(sql.FieldIn(FieldCreatedAt, vs...))
}
-// CreatedAtNotIn applies the NotIn predicate on the "created_at" field.
-func CreatedAtNotIn(vs ...int64) predicate.Dock {
+// CreatedAtNotIn applies the NotIn predicate on the "createdAt" field.
+func CreatedAtNotIn(vs ...time.Time) predicate.Dock {
return predicate.Dock(sql.FieldNotIn(FieldCreatedAt, vs...))
}
-// CreatedAtGT applies the GT predicate on the "created_at" field.
-func CreatedAtGT(v int64) predicate.Dock {
+// CreatedAtGT applies the GT predicate on the "createdAt" field.
+func CreatedAtGT(v time.Time) predicate.Dock {
return predicate.Dock(sql.FieldGT(FieldCreatedAt, v))
}
-// CreatedAtGTE applies the GTE predicate on the "created_at" field.
-func CreatedAtGTE(v int64) predicate.Dock {
+// CreatedAtGTE applies the GTE predicate on the "createdAt" field.
+func CreatedAtGTE(v time.Time) predicate.Dock {
return predicate.Dock(sql.FieldGTE(FieldCreatedAt, v))
}
-// CreatedAtLT applies the LT predicate on the "created_at" field.
-func CreatedAtLT(v int64) predicate.Dock {
+// CreatedAtLT applies the LT predicate on the "createdAt" field.
+func CreatedAtLT(v time.Time) predicate.Dock {
return predicate.Dock(sql.FieldLT(FieldCreatedAt, v))
}
-// CreatedAtLTE applies the LTE predicate on the "created_at" field.
-func CreatedAtLTE(v int64) predicate.Dock {
+// CreatedAtLTE applies the LTE predicate on the "createdAt" field.
+func CreatedAtLTE(v time.Time) predicate.Dock {
return predicate.Dock(sql.FieldLTE(FieldCreatedAt, v))
}
diff --git a/bj_power_mes/ent/dock_create.go b/bj_power_mes/ent/dock_create.go
new file mode 100644
index 0000000..8ff007b
--- /dev/null
+++ b/bj_power_mes/ent/dock_create.go
@@ -0,0 +1,387 @@
+// Code generated by ent, DO NOT EDIT.
+
+package ent
+
+import (
+ "bj_power_mes/ent/dock"
+ "context"
+ "errors"
+ "fmt"
+ "time"
+
+ "entgo.io/ent/dialect/sql/sqlgraph"
+ "entgo.io/ent/schema/field"
+)
+
+// DockCreate is the builder for creating a Dock entity.
+type DockCreate struct {
+ config
+ mutation *DockMutation
+ hooks []Hook
+}
+
+// SetDockCode sets the "dockCode" field.
+func (_c *DockCreate) SetDockCode(v string) *DockCreate {
+ _c.mutation.SetDockCode(v)
+ return _c
+}
+
+// SetName sets the "name" field.
+func (_c *DockCreate) SetName(v string) *DockCreate {
+ _c.mutation.SetName(v)
+ return _c
+}
+
+// SetNillableName sets the "name" field if the given value is not nil.
+func (_c *DockCreate) SetNillableName(v *string) *DockCreate {
+ if v != nil {
+ _c.SetName(*v)
+ }
+ return _c
+}
+
+// SetDockType sets the "dockType" field.
+func (_c *DockCreate) SetDockType(v string) *DockCreate {
+ _c.mutation.SetDockType(v)
+ return _c
+}
+
+// SetNillableDockType sets the "dockType" field if the given value is not nil.
+func (_c *DockCreate) SetNillableDockType(v *string) *DockCreate {
+ if v != nil {
+ _c.SetDockType(*v)
+ }
+ return _c
+}
+
+// SetStationNo sets the "stationNo" field.
+func (_c *DockCreate) SetStationNo(v int) *DockCreate {
+ _c.mutation.SetStationNo(v)
+ return _c
+}
+
+// SetNillableStationNo sets the "stationNo" field if the given value is not nil.
+func (_c *DockCreate) SetNillableStationNo(v *int) *DockCreate {
+ if v != nil {
+ _c.SetStationNo(*v)
+ }
+ return _c
+}
+
+// SetHasPallet sets the "hasPallet" field.
+func (_c *DockCreate) SetHasPallet(v bool) *DockCreate {
+ _c.mutation.SetHasPallet(v)
+ return _c
+}
+
+// SetNillableHasPallet sets the "hasPallet" field if the given value is not nil.
+func (_c *DockCreate) SetNillableHasPallet(v *bool) *DockCreate {
+ if v != nil {
+ _c.SetHasPallet(*v)
+ }
+ return _c
+}
+
+// SetPalletRef sets the "palletRef" field.
+func (_c *DockCreate) SetPalletRef(v string) *DockCreate {
+ _c.mutation.SetPalletRef(v)
+ return _c
+}
+
+// SetNillablePalletRef sets the "palletRef" field if the given value is not nil.
+func (_c *DockCreate) SetNillablePalletRef(v *string) *DockCreate {
+ if v != nil {
+ _c.SetPalletRef(*v)
+ }
+ return _c
+}
+
+// SetStatus sets the "status" field.
+func (_c *DockCreate) SetStatus(v string) *DockCreate {
+ _c.mutation.SetStatus(v)
+ return _c
+}
+
+// SetNillableStatus sets the "status" field if the given value is not nil.
+func (_c *DockCreate) SetNillableStatus(v *string) *DockCreate {
+ if v != nil {
+ _c.SetStatus(*v)
+ }
+ return _c
+}
+
+// SetCreatedAt sets the "createdAt" field.
+func (_c *DockCreate) SetCreatedAt(v time.Time) *DockCreate {
+ _c.mutation.SetCreatedAt(v)
+ return _c
+}
+
+// SetNillableCreatedAt sets the "createdAt" field if the given value is not nil.
+func (_c *DockCreate) SetNillableCreatedAt(v *time.Time) *DockCreate {
+ if v != nil {
+ _c.SetCreatedAt(*v)
+ }
+ return _c
+}
+
+// Mutation returns the DockMutation object of the builder.
+func (_c *DockCreate) Mutation() *DockMutation {
+ return _c.mutation
+}
+
+// Save creates the Dock in the database.
+func (_c *DockCreate) Save(ctx context.Context) (*Dock, error) {
+ _c.defaults()
+ return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
+}
+
+// SaveX calls Save and panics if Save returns an error.
+func (_c *DockCreate) SaveX(ctx context.Context) *Dock {
+ v, err := _c.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (_c *DockCreate) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (_c *DockCreate) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
+
+// defaults sets the default values of the builder before save.
+func (_c *DockCreate) defaults() {
+ if _, ok := _c.mutation.Name(); !ok {
+ v := dock.DefaultName
+ _c.mutation.SetName(v)
+ }
+ if _, ok := _c.mutation.DockType(); !ok {
+ v := dock.DefaultDockType
+ _c.mutation.SetDockType(v)
+ }
+ if _, ok := _c.mutation.StationNo(); !ok {
+ v := dock.DefaultStationNo
+ _c.mutation.SetStationNo(v)
+ }
+ if _, ok := _c.mutation.HasPallet(); !ok {
+ v := dock.DefaultHasPallet
+ _c.mutation.SetHasPallet(v)
+ }
+ if _, ok := _c.mutation.PalletRef(); !ok {
+ v := dock.DefaultPalletRef
+ _c.mutation.SetPalletRef(v)
+ }
+ if _, ok := _c.mutation.Status(); !ok {
+ v := dock.DefaultStatus
+ _c.mutation.SetStatus(v)
+ }
+ if _, ok := _c.mutation.CreatedAt(); !ok {
+ v := dock.DefaultCreatedAt()
+ _c.mutation.SetCreatedAt(v)
+ }
+}
+
+// check runs all checks and user-defined validators on the builder.
+func (_c *DockCreate) check() error {
+ if _, ok := _c.mutation.DockCode(); !ok {
+ return &ValidationError{Name: "dockCode", err: errors.New(`ent: missing required field "Dock.dockCode"`)}
+ }
+ if v, ok := _c.mutation.DockCode(); ok {
+ if err := dock.DockCodeValidator(v); err != nil {
+ return &ValidationError{Name: "dockCode", err: fmt.Errorf(`ent: validator failed for field "Dock.dockCode": %w`, err)}
+ }
+ }
+ if _, ok := _c.mutation.Name(); !ok {
+ return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "Dock.name"`)}
+ }
+ if v, ok := _c.mutation.Name(); ok {
+ if err := dock.NameValidator(v); err != nil {
+ return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Dock.name": %w`, err)}
+ }
+ }
+ if _, ok := _c.mutation.DockType(); !ok {
+ return &ValidationError{Name: "dockType", err: errors.New(`ent: missing required field "Dock.dockType"`)}
+ }
+ if v, ok := _c.mutation.DockType(); ok {
+ if err := dock.DockTypeValidator(v); err != nil {
+ return &ValidationError{Name: "dockType", err: fmt.Errorf(`ent: validator failed for field "Dock.dockType": %w`, err)}
+ }
+ }
+ if _, ok := _c.mutation.StationNo(); !ok {
+ return &ValidationError{Name: "stationNo", err: errors.New(`ent: missing required field "Dock.stationNo"`)}
+ }
+ if _, ok := _c.mutation.HasPallet(); !ok {
+ return &ValidationError{Name: "hasPallet", err: errors.New(`ent: missing required field "Dock.hasPallet"`)}
+ }
+ if v, ok := _c.mutation.PalletRef(); ok {
+ if err := dock.PalletRefValidator(v); err != nil {
+ return &ValidationError{Name: "palletRef", err: fmt.Errorf(`ent: validator failed for field "Dock.palletRef": %w`, err)}
+ }
+ }
+ if _, ok := _c.mutation.Status(); !ok {
+ return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "Dock.status"`)}
+ }
+ if v, ok := _c.mutation.Status(); ok {
+ if err := dock.StatusValidator(v); err != nil {
+ return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "Dock.status": %w`, err)}
+ }
+ }
+ if _, ok := _c.mutation.CreatedAt(); !ok {
+ return &ValidationError{Name: "createdAt", err: errors.New(`ent: missing required field "Dock.createdAt"`)}
+ }
+ return nil
+}
+
+func (_c *DockCreate) sqlSave(ctx context.Context) (*Dock, error) {
+ if err := _c.check(); err != nil {
+ return nil, err
+ }
+ _node, _spec := _c.createSpec()
+ if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ return nil, err
+ }
+ id := _spec.ID.Value.(int64)
+ _node.ID = int(id)
+ _c.mutation.id = &_node.ID
+ _c.mutation.done = true
+ return _node, nil
+}
+
+func (_c *DockCreate) createSpec() (*Dock, *sqlgraph.CreateSpec) {
+ var (
+ _node = &Dock{config: _c.config}
+ _spec = sqlgraph.NewCreateSpec(dock.Table, sqlgraph.NewFieldSpec(dock.FieldID, field.TypeInt))
+ )
+ if value, ok := _c.mutation.DockCode(); ok {
+ _spec.SetField(dock.FieldDockCode, field.TypeString, value)
+ _node.DockCode = value
+ }
+ if value, ok := _c.mutation.Name(); ok {
+ _spec.SetField(dock.FieldName, field.TypeString, value)
+ _node.Name = value
+ }
+ if value, ok := _c.mutation.DockType(); ok {
+ _spec.SetField(dock.FieldDockType, field.TypeString, value)
+ _node.DockType = value
+ }
+ if value, ok := _c.mutation.StationNo(); ok {
+ _spec.SetField(dock.FieldStationNo, field.TypeInt, value)
+ _node.StationNo = value
+ }
+ if value, ok := _c.mutation.HasPallet(); ok {
+ _spec.SetField(dock.FieldHasPallet, field.TypeBool, value)
+ _node.HasPallet = value
+ }
+ if value, ok := _c.mutation.PalletRef(); ok {
+ _spec.SetField(dock.FieldPalletRef, field.TypeString, value)
+ _node.PalletRef = value
+ }
+ if value, ok := _c.mutation.Status(); ok {
+ _spec.SetField(dock.FieldStatus, field.TypeString, value)
+ _node.Status = value
+ }
+ if value, ok := _c.mutation.CreatedAt(); ok {
+ _spec.SetField(dock.FieldCreatedAt, field.TypeTime, value)
+ _node.CreatedAt = value
+ }
+ return _node, _spec
+}
+
+// DockCreateBulk is the builder for creating many Dock entities in bulk.
+type DockCreateBulk struct {
+ config
+ err error
+ builders []*DockCreate
+}
+
+// Save creates the Dock entities in the database.
+func (_c *DockCreateBulk) Save(ctx context.Context) ([]*Dock, error) {
+ if _c.err != nil {
+ return nil, _c.err
+ }
+ specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
+ nodes := make([]*Dock, len(_c.builders))
+ mutators := make([]Mutator, len(_c.builders))
+ for i := range _c.builders {
+ func(i int, root context.Context) {
+ builder := _c.builders[i]
+ builder.defaults()
+ var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
+ mutation, ok := m.(*DockMutation)
+ if !ok {
+ return nil, fmt.Errorf("unexpected mutation type %T", m)
+ }
+ if err := builder.check(); err != nil {
+ return nil, err
+ }
+ builder.mutation = mutation
+ var err error
+ nodes[i], specs[i] = builder.createSpec()
+ if i < len(mutators)-1 {
+ _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
+ } else {
+ spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
+ // Invoke the actual operation on the latest mutation in the chain.
+ if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
+ if sqlgraph.IsConstraintError(err) {
+ err = &ConstraintError{msg: err.Error(), wrap: err}
+ }
+ }
+ }
+ if err != nil {
+ return nil, err
+ }
+ mutation.id = &nodes[i].ID
+ if specs[i].ID.Value != nil {
+ id := specs[i].ID.Value.(int64)
+ nodes[i].ID = int(id)
+ }
+ mutation.done = true
+ return nodes[i], nil
+ })
+ for i := len(builder.hooks) - 1; i >= 0; i-- {
+ mut = builder.hooks[i](mut)
+ }
+ mutators[i] = mut
+ }(i, ctx)
+ }
+ if len(mutators) > 0 {
+ if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
+ return nil, err
+ }
+ }
+ return nodes, nil
+}
+
+// SaveX is like Save, but panics if an error occurs.
+func (_c *DockCreateBulk) SaveX(ctx context.Context) []*Dock {
+ v, err := _c.Save(ctx)
+ if err != nil {
+ panic(err)
+ }
+ return v
+}
+
+// Exec executes the query.
+func (_c *DockCreateBulk) Exec(ctx context.Context) error {
+ _, err := _c.Save(ctx)
+ return err
+}
+
+// ExecX is like Exec, but panics if an error occurs.
+func (_c *DockCreateBulk) ExecX(ctx context.Context) {
+ if err := _c.Exec(ctx); err != nil {
+ panic(err)
+ }
+}
diff --git a/bj_power_wms/ent/dock_delete.go b/bj_power_mes/ent/dock_delete.go
similarity index 97%
rename from bj_power_wms/ent/dock_delete.go
rename to bj_power_mes/ent/dock_delete.go
index c606e64..391f929 100644
--- a/bj_power_wms/ent/dock_delete.go
+++ b/bj_power_mes/ent/dock_delete.go
@@ -3,8 +3,8 @@
package ent
import (
- "bj_power_wms/ent/dock"
- "bj_power_wms/ent/predicate"
+ "bj_power_mes/ent/dock"
+ "bj_power_mes/ent/predicate"
"context"
"entgo.io/ent/dialect/sql"
diff --git a/bj_power_wms/ent/dock_query.go b/bj_power_mes/ent/dock_query.go
similarity index 89%
rename from bj_power_wms/ent/dock_query.go
rename to bj_power_mes/ent/dock_query.go
index 65c5dcd..1658aa3 100644
--- a/bj_power_wms/ent/dock_query.go
+++ b/bj_power_mes/ent/dock_query.go
@@ -3,13 +3,14 @@
package ent
import (
- "bj_power_wms/ent/dock"
- "bj_power_wms/ent/predicate"
+ "bj_power_mes/ent/dock"
+ "bj_power_mes/ent/predicate"
"context"
"fmt"
"math"
"entgo.io/ent"
+ "entgo.io/ent/dialect"
"entgo.io/ent/dialect/sql"
"entgo.io/ent/dialect/sql/sqlgraph"
"entgo.io/ent/schema/field"
@@ -22,6 +23,7 @@ type DockQuery struct {
order []dock.OrderOption
inters []Interceptor
predicates []predicate.Dock
+ modifiers []func(*sql.Selector)
// intermediate query (i.e. traversal path).
sql *sql.Selector
path func(context.Context) (*sql.Selector, error)
@@ -251,8 +253,9 @@ func (_q *DockQuery) Clone() *DockQuery {
inters: append([]Interceptor{}, _q.inters...),
predicates: append([]predicate.Dock{}, _q.predicates...),
// clone intermediate query.
- sql: _q.sql.Clone(),
- path: _q.path,
+ sql: _q.sql.Clone(),
+ path: _q.path,
+ modifiers: append([]func(*sql.Selector){}, _q.modifiers...),
}
}
@@ -343,6 +346,9 @@ func (_q *DockQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Dock, e
nodes = append(nodes, node)
return node.assignValues(columns, values)
}
+ if len(_q.modifiers) > 0 {
+ _spec.Modifiers = _q.modifiers
+ }
for i := range hooks {
hooks[i](ctx, _spec)
}
@@ -357,6 +363,9 @@ func (_q *DockQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Dock, e
func (_q *DockQuery) sqlCount(ctx context.Context) (int, error) {
_spec := _q.querySpec()
+ if len(_q.modifiers) > 0 {
+ _spec.Modifiers = _q.modifiers
+ }
_spec.Node.Columns = _q.ctx.Fields
if len(_q.ctx.Fields) > 0 {
_spec.Unique = _q.ctx.Unique != nil && *_q.ctx.Unique
@@ -419,6 +428,9 @@ func (_q *DockQuery) sqlQuery(ctx context.Context) *sql.Selector {
if _q.ctx.Unique != nil && *_q.ctx.Unique {
selector.Distinct()
}
+ for _, m := range _q.modifiers {
+ m(selector)
+ }
for _, p := range _q.predicates {
p(selector)
}
@@ -436,6 +448,38 @@ func (_q *DockQuery) sqlQuery(ctx context.Context) *sql.Selector {
return selector
}
+// ForUpdate locks the selected rows against concurrent updates, and prevent them from being
+// updated, deleted or "selected ... for update" by other sessions, until the transaction is
+// either committed or rolled-back.
+func (_q *DockQuery) ForUpdate(opts ...sql.LockOption) *DockQuery {
+ if _q.driver.Dialect() == dialect.Postgres {
+ _q.Unique(false)
+ }
+ _q.modifiers = append(_q.modifiers, func(s *sql.Selector) {
+ s.ForUpdate(opts...)
+ })
+ return _q
+}
+
+// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock
+// on any rows that are read. Other sessions can read the rows, but cannot modify them
+// until your transaction commits.
+func (_q *DockQuery) ForShare(opts ...sql.LockOption) *DockQuery {
+ if _q.driver.Dialect() == dialect.Postgres {
+ _q.Unique(false)
+ }
+ _q.modifiers = append(_q.modifiers, func(s *sql.Selector) {
+ s.ForShare(opts...)
+ })
+ return _q
+}
+
+// Modify adds a query modifier for attaching custom logic to queries.
+func (_q *DockQuery) Modify(modifiers ...func(s *sql.Selector)) *DockSelect {
+ _q.modifiers = append(_q.modifiers, modifiers...)
+ return _q.Select()
+}
+
// DockGroupBy is the group-by builder for Dock entities.
type DockGroupBy struct {
selector
@@ -525,3 +569,9 @@ func (_s *DockSelect) sqlScan(ctx context.Context, root *DockQuery, v any) error
defer rows.Close()
return sql.ScanSlice(rows, v)
}
+
+// Modify adds a query modifier for attaching custom logic to queries.
+func (_s *DockSelect) Modify(modifiers ...func(s *sql.Selector)) *DockSelect {
+ _s.modifiers = append(_s.modifiers, modifiers...)
+ return _s
+}
diff --git a/bj_power_wms/ent/dock_update.go b/bj_power_mes/ent/dock_update.go
similarity index 76%
rename from bj_power_wms/ent/dock_update.go
rename to bj_power_mes/ent/dock_update.go
index c296ff0..0935a73 100644
--- a/bj_power_wms/ent/dock_update.go
+++ b/bj_power_mes/ent/dock_update.go
@@ -3,8 +3,8 @@
package ent
import (
- "bj_power_wms/ent/dock"
- "bj_power_wms/ent/predicate"
+ "bj_power_mes/ent/dock"
+ "bj_power_mes/ent/predicate"
"context"
"errors"
"fmt"
@@ -17,8 +17,9 @@ import (
// DockUpdate is the builder for updating Dock entities.
type DockUpdate struct {
config
- hooks []Hook
- mutation *DockMutation
+ hooks []Hook
+ mutation *DockMutation
+ modifiers []func(*sql.UpdateBuilder)
}
// Where appends a list predicates to the DockUpdate builder.
@@ -27,13 +28,13 @@ func (_u *DockUpdate) Where(ps ...predicate.Dock) *DockUpdate {
return _u
}
-// SetDockCode sets the "dock_code" field.
+// SetDockCode sets the "dockCode" field.
func (_u *DockUpdate) SetDockCode(v string) *DockUpdate {
_u.mutation.SetDockCode(v)
return _u
}
-// SetNillableDockCode sets the "dock_code" field if the given value is not nil.
+// SetNillableDockCode sets the "dockCode" field if the given value is not nil.
func (_u *DockUpdate) SetNillableDockCode(v *string) *DockUpdate {
if v != nil {
_u.SetDockCode(*v)
@@ -55,13 +56,13 @@ func (_u *DockUpdate) SetNillableName(v *string) *DockUpdate {
return _u
}
-// SetDockType sets the "dock_type" field.
+// SetDockType sets the "dockType" field.
func (_u *DockUpdate) SetDockType(v string) *DockUpdate {
_u.mutation.SetDockType(v)
return _u
}
-// SetNillableDockType sets the "dock_type" field if the given value is not nil.
+// SetNillableDockType sets the "dockType" field if the given value is not nil.
func (_u *DockUpdate) SetNillableDockType(v *string) *DockUpdate {
if v != nil {
_u.SetDockType(*v)
@@ -69,14 +70,14 @@ func (_u *DockUpdate) SetNillableDockType(v *string) *DockUpdate {
return _u
}
-// SetStationNo sets the "station_no" field.
+// SetStationNo sets the "stationNo" field.
func (_u *DockUpdate) SetStationNo(v int) *DockUpdate {
_u.mutation.ResetStationNo()
_u.mutation.SetStationNo(v)
return _u
}
-// SetNillableStationNo sets the "station_no" field if the given value is not nil.
+// SetNillableStationNo sets the "stationNo" field if the given value is not nil.
func (_u *DockUpdate) SetNillableStationNo(v *int) *DockUpdate {
if v != nil {
_u.SetStationNo(*v)
@@ -84,19 +85,19 @@ func (_u *DockUpdate) SetNillableStationNo(v *int) *DockUpdate {
return _u
}
-// AddStationNo adds value to the "station_no" field.
+// AddStationNo adds value to the "stationNo" field.
func (_u *DockUpdate) AddStationNo(v int) *DockUpdate {
_u.mutation.AddStationNo(v)
return _u
}
-// SetHasPallet sets the "has_pallet" field.
+// SetHasPallet sets the "hasPallet" field.
func (_u *DockUpdate) SetHasPallet(v bool) *DockUpdate {
_u.mutation.SetHasPallet(v)
return _u
}
-// SetNillableHasPallet sets the "has_pallet" field if the given value is not nil.
+// SetNillableHasPallet sets the "hasPallet" field if the given value is not nil.
func (_u *DockUpdate) SetNillableHasPallet(v *bool) *DockUpdate {
if v != nil {
_u.SetHasPallet(*v)
@@ -104,13 +105,13 @@ func (_u *DockUpdate) SetNillableHasPallet(v *bool) *DockUpdate {
return _u
}
-// SetPalletRef sets the "pallet_ref" field.
+// SetPalletRef sets the "palletRef" field.
func (_u *DockUpdate) SetPalletRef(v string) *DockUpdate {
_u.mutation.SetPalletRef(v)
return _u
}
-// SetNillablePalletRef sets the "pallet_ref" field if the given value is not nil.
+// SetNillablePalletRef sets the "palletRef" field if the given value is not nil.
func (_u *DockUpdate) SetNillablePalletRef(v *string) *DockUpdate {
if v != nil {
_u.SetPalletRef(*v)
@@ -118,7 +119,7 @@ func (_u *DockUpdate) SetNillablePalletRef(v *string) *DockUpdate {
return _u
}
-// ClearPalletRef clears the value of the "pallet_ref" field.
+// ClearPalletRef clears the value of the "palletRef" field.
func (_u *DockUpdate) ClearPalletRef() *DockUpdate {
_u.mutation.ClearPalletRef()
return _u
@@ -138,27 +139,6 @@ func (_u *DockUpdate) SetNillableStatus(v *string) *DockUpdate {
return _u
}
-// SetCreatedAt sets the "created_at" field.
-func (_u *DockUpdate) SetCreatedAt(v int64) *DockUpdate {
- _u.mutation.ResetCreatedAt()
- _u.mutation.SetCreatedAt(v)
- return _u
-}
-
-// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
-func (_u *DockUpdate) SetNillableCreatedAt(v *int64) *DockUpdate {
- if v != nil {
- _u.SetCreatedAt(*v)
- }
- return _u
-}
-
-// AddCreatedAt adds value to the "created_at" field.
-func (_u *DockUpdate) AddCreatedAt(v int64) *DockUpdate {
- _u.mutation.AddCreatedAt(v)
- return _u
-}
-
// Mutation returns the DockMutation object of the builder.
func (_u *DockUpdate) Mutation() *DockMutation {
return _u.mutation
@@ -195,7 +175,7 @@ func (_u *DockUpdate) ExecX(ctx context.Context) {
func (_u *DockUpdate) check() error {
if v, ok := _u.mutation.DockCode(); ok {
if err := dock.DockCodeValidator(v); err != nil {
- return &ValidationError{Name: "dock_code", err: fmt.Errorf(`ent: validator failed for field "Dock.dock_code": %w`, err)}
+ return &ValidationError{Name: "dockCode", err: fmt.Errorf(`ent: validator failed for field "Dock.dockCode": %w`, err)}
}
}
if v, ok := _u.mutation.Name(); ok {
@@ -205,12 +185,12 @@ func (_u *DockUpdate) check() error {
}
if v, ok := _u.mutation.DockType(); ok {
if err := dock.DockTypeValidator(v); err != nil {
- return &ValidationError{Name: "dock_type", err: fmt.Errorf(`ent: validator failed for field "Dock.dock_type": %w`, err)}
+ return &ValidationError{Name: "dockType", err: fmt.Errorf(`ent: validator failed for field "Dock.dockType": %w`, err)}
}
}
if v, ok := _u.mutation.PalletRef(); ok {
if err := dock.PalletRefValidator(v); err != nil {
- return &ValidationError{Name: "pallet_ref", err: fmt.Errorf(`ent: validator failed for field "Dock.pallet_ref": %w`, err)}
+ return &ValidationError{Name: "palletRef", err: fmt.Errorf(`ent: validator failed for field "Dock.palletRef": %w`, err)}
}
}
if v, ok := _u.mutation.Status(); ok {
@@ -221,6 +201,12 @@ func (_u *DockUpdate) check() error {
return nil
}
+// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
+func (_u *DockUpdate) Modify(modifiers ...func(u *sql.UpdateBuilder)) *DockUpdate {
+ _u.modifiers = append(_u.modifiers, modifiers...)
+ return _u
+}
+
func (_u *DockUpdate) sqlSave(ctx context.Context) (_node int, err error) {
if err := _u.check(); err != nil {
return _node, err
@@ -260,12 +246,7 @@ func (_u *DockUpdate) sqlSave(ctx context.Context) (_node int, err error) {
if value, ok := _u.mutation.Status(); ok {
_spec.SetField(dock.FieldStatus, field.TypeString, value)
}
- if value, ok := _u.mutation.CreatedAt(); ok {
- _spec.SetField(dock.FieldCreatedAt, field.TypeInt64, value)
- }
- if value, ok := _u.mutation.AddedCreatedAt(); ok {
- _spec.AddField(dock.FieldCreatedAt, field.TypeInt64, value)
- }
+ _spec.AddModifiers(_u.modifiers...)
if _node, err = sqlgraph.UpdateNodes(ctx, _u.driver, _spec); err != nil {
if _, ok := err.(*sqlgraph.NotFoundError); ok {
err = &NotFoundError{dock.Label}
@@ -281,18 +262,19 @@ func (_u *DockUpdate) sqlSave(ctx context.Context) (_node int, err error) {
// DockUpdateOne is the builder for updating a single Dock entity.
type DockUpdateOne struct {
config
- fields []string
- hooks []Hook
- mutation *DockMutation
+ fields []string
+ hooks []Hook
+ mutation *DockMutation
+ modifiers []func(*sql.UpdateBuilder)
}
-// SetDockCode sets the "dock_code" field.
+// SetDockCode sets the "dockCode" field.
func (_u *DockUpdateOne) SetDockCode(v string) *DockUpdateOne {
_u.mutation.SetDockCode(v)
return _u
}
-// SetNillableDockCode sets the "dock_code" field if the given value is not nil.
+// SetNillableDockCode sets the "dockCode" field if the given value is not nil.
func (_u *DockUpdateOne) SetNillableDockCode(v *string) *DockUpdateOne {
if v != nil {
_u.SetDockCode(*v)
@@ -314,13 +296,13 @@ func (_u *DockUpdateOne) SetNillableName(v *string) *DockUpdateOne {
return _u
}
-// SetDockType sets the "dock_type" field.
+// SetDockType sets the "dockType" field.
func (_u *DockUpdateOne) SetDockType(v string) *DockUpdateOne {
_u.mutation.SetDockType(v)
return _u
}
-// SetNillableDockType sets the "dock_type" field if the given value is not nil.
+// SetNillableDockType sets the "dockType" field if the given value is not nil.
func (_u *DockUpdateOne) SetNillableDockType(v *string) *DockUpdateOne {
if v != nil {
_u.SetDockType(*v)
@@ -328,14 +310,14 @@ func (_u *DockUpdateOne) SetNillableDockType(v *string) *DockUpdateOne {
return _u
}
-// SetStationNo sets the "station_no" field.
+// SetStationNo sets the "stationNo" field.
func (_u *DockUpdateOne) SetStationNo(v int) *DockUpdateOne {
_u.mutation.ResetStationNo()
_u.mutation.SetStationNo(v)
return _u
}
-// SetNillableStationNo sets the "station_no" field if the given value is not nil.
+// SetNillableStationNo sets the "stationNo" field if the given value is not nil.
func (_u *DockUpdateOne) SetNillableStationNo(v *int) *DockUpdateOne {
if v != nil {
_u.SetStationNo(*v)
@@ -343,19 +325,19 @@ func (_u *DockUpdateOne) SetNillableStationNo(v *int) *DockUpdateOne {
return _u
}
-// AddStationNo adds value to the "station_no" field.
+// AddStationNo adds value to the "stationNo" field.
func (_u *DockUpdateOne) AddStationNo(v int) *DockUpdateOne {
_u.mutation.AddStationNo(v)
return _u
}
-// SetHasPallet sets the "has_pallet" field.
+// SetHasPallet sets the "hasPallet" field.
func (_u *DockUpdateOne) SetHasPallet(v bool) *DockUpdateOne {
_u.mutation.SetHasPallet(v)
return _u
}
-// SetNillableHasPallet sets the "has_pallet" field if the given value is not nil.
+// SetNillableHasPallet sets the "hasPallet" field if the given value is not nil.
func (_u *DockUpdateOne) SetNillableHasPallet(v *bool) *DockUpdateOne {
if v != nil {
_u.SetHasPallet(*v)
@@ -363,13 +345,13 @@ func (_u *DockUpdateOne) SetNillableHasPallet(v *bool) *DockUpdateOne {
return _u
}
-// SetPalletRef sets the "pallet_ref" field.
+// SetPalletRef sets the "palletRef" field.
func (_u *DockUpdateOne) SetPalletRef(v string) *DockUpdateOne {
_u.mutation.SetPalletRef(v)
return _u
}
-// SetNillablePalletRef sets the "pallet_ref" field if the given value is not nil.
+// SetNillablePalletRef sets the "palletRef" field if the given value is not nil.
func (_u *DockUpdateOne) SetNillablePalletRef(v *string) *DockUpdateOne {
if v != nil {
_u.SetPalletRef(*v)
@@ -377,7 +359,7 @@ func (_u *DockUpdateOne) SetNillablePalletRef(v *string) *DockUpdateOne {
return _u
}
-// ClearPalletRef clears the value of the "pallet_ref" field.
+// ClearPalletRef clears the value of the "palletRef" field.
func (_u *DockUpdateOne) ClearPalletRef() *DockUpdateOne {
_u.mutation.ClearPalletRef()
return _u
@@ -397,27 +379,6 @@ func (_u *DockUpdateOne) SetNillableStatus(v *string) *DockUpdateOne {
return _u
}
-// SetCreatedAt sets the "created_at" field.
-func (_u *DockUpdateOne) SetCreatedAt(v int64) *DockUpdateOne {
- _u.mutation.ResetCreatedAt()
- _u.mutation.SetCreatedAt(v)
- return _u
-}
-
-// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
-func (_u *DockUpdateOne) SetNillableCreatedAt(v *int64) *DockUpdateOne {
- if v != nil {
- _u.SetCreatedAt(*v)
- }
- return _u
-}
-
-// AddCreatedAt adds value to the "created_at" field.
-func (_u *DockUpdateOne) AddCreatedAt(v int64) *DockUpdateOne {
- _u.mutation.AddCreatedAt(v)
- return _u
-}
-
// Mutation returns the DockMutation object of the builder.
func (_u *DockUpdateOne) Mutation() *DockMutation {
return _u.mutation
@@ -467,7 +428,7 @@ func (_u *DockUpdateOne) ExecX(ctx context.Context) {
func (_u *DockUpdateOne) check() error {
if v, ok := _u.mutation.DockCode(); ok {
if err := dock.DockCodeValidator(v); err != nil {
- return &ValidationError{Name: "dock_code", err: fmt.Errorf(`ent: validator failed for field "Dock.dock_code": %w`, err)}
+ return &ValidationError{Name: "dockCode", err: fmt.Errorf(`ent: validator failed for field "Dock.dockCode": %w`, err)}
}
}
if v, ok := _u.mutation.Name(); ok {
@@ -477,12 +438,12 @@ func (_u *DockUpdateOne) check() error {
}
if v, ok := _u.mutation.DockType(); ok {
if err := dock.DockTypeValidator(v); err != nil {
- return &ValidationError{Name: "dock_type", err: fmt.Errorf(`ent: validator failed for field "Dock.dock_type": %w`, err)}
+ return &ValidationError{Name: "dockType", err: fmt.Errorf(`ent: validator failed for field "Dock.dockType": %w`, err)}
}
}
if v, ok := _u.mutation.PalletRef(); ok {
if err := dock.PalletRefValidator(v); err != nil {
- return &ValidationError{Name: "pallet_ref", err: fmt.Errorf(`ent: validator failed for field "Dock.pallet_ref": %w`, err)}
+ return &ValidationError{Name: "palletRef", err: fmt.Errorf(`ent: validator failed for field "Dock.palletRef": %w`, err)}
}
}
if v, ok := _u.mutation.Status(); ok {
@@ -493,6 +454,12 @@ func (_u *DockUpdateOne) check() error {
return nil
}
+// Modify adds a statement modifier for attaching custom logic to the UPDATE statement.
+func (_u *DockUpdateOne) Modify(modifiers ...func(u *sql.UpdateBuilder)) *DockUpdateOne {
+ _u.modifiers = append(_u.modifiers, modifiers...)
+ return _u
+}
+
func (_u *DockUpdateOne) sqlSave(ctx context.Context) (_node *Dock, err error) {
if err := _u.check(); err != nil {
return _node, err
@@ -549,12 +516,7 @@ func (_u *DockUpdateOne) sqlSave(ctx context.Context) (_node *Dock, err error) {
if value, ok := _u.mutation.Status(); ok {
_spec.SetField(dock.FieldStatus, field.TypeString, value)
}
- if value, ok := _u.mutation.CreatedAt(); ok {
- _spec.SetField(dock.FieldCreatedAt, field.TypeInt64, value)
- }
- if value, ok := _u.mutation.AddedCreatedAt(); ok {
- _spec.AddField(dock.FieldCreatedAt, field.TypeInt64, value)
- }
+ _spec.AddModifiers(_u.modifiers...)
_node = &Dock{config: _u.config}
_spec.Assign = _node.assignValues
_spec.ScanValues = _node.scanValues
diff --git a/bj_power_mes/ent/ent.go b/bj_power_mes/ent/ent.go
index 8044519..c5940af 100644
--- a/bj_power_mes/ent/ent.go
+++ b/bj_power_mes/ent/ent.go
@@ -9,6 +9,7 @@ import (
"bj_power_mes/ent/attachment"
"bj_power_mes/ent/bomitem"
"bj_power_mes/ent/dailyplan"
+ "bj_power_mes/ent/dock"
"bj_power_mes/ent/eventlog"
"bj_power_mes/ent/inspectionrecord"
"bj_power_mes/ent/linepoint"
@@ -109,6 +110,7 @@ func checkColumn(t, c string) error {
attachment.Table: attachment.ValidColumn,
bomitem.Table: bomitem.ValidColumn,
dailyplan.Table: dailyplan.ValidColumn,
+ dock.Table: dock.ValidColumn,
eventlog.Table: eventlog.ValidColumn,
inspectionrecord.Table: inspectionrecord.ValidColumn,
linepoint.Table: linepoint.ValidColumn,
diff --git a/bj_power_mes/ent/hook/hook.go b/bj_power_mes/ent/hook/hook.go
index 54542bc..6b9f93c 100644
--- a/bj_power_mes/ent/hook/hook.go
+++ b/bj_power_mes/ent/hook/hook.go
@@ -80,6 +80,18 @@ func (f DailyPlanFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, e
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.DailyPlanMutation", m)
}
+// The DockFunc type is an adapter to allow the use of ordinary
+// function as Dock mutator.
+type DockFunc func(context.Context, *ent.DockMutation) (ent.Value, error)
+
+// Mutate calls f(ctx, m).
+func (f DockFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
+ if mv, ok := m.(*ent.DockMutation); ok {
+ return f(ctx, mv)
+ }
+ return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.DockMutation", m)
+}
+
// The EventLogFunc type is an adapter to allow the use of ordinary
// function as EventLog mutator.
type EventLogFunc func(context.Context, *ent.EventLogMutation) (ent.Value, error)
diff --git a/bj_power_mes/ent/migrate/schema.go b/bj_power_mes/ent/migrate/schema.go
index ea31e8a..b78d352 100644
--- a/bj_power_mes/ent/migrate/schema.go
+++ b/bj_power_mes/ent/migrate/schema.go
@@ -219,6 +219,36 @@ var (
},
},
}
+ // DockColumns holds the columns for the "dock" table.
+ DockColumns = []*schema.Column{
+ {Name: "id", Type: field.TypeInt, Increment: true},
+ {Name: "dock_code", Type: field.TypeString, Unique: true, Size: 20},
+ {Name: "name", Type: field.TypeString, Size: 64, Default: ""},
+ {Name: "dock_type", Type: field.TypeString, Size: 16, Default: "line"},
+ {Name: "station_no", Type: field.TypeInt, Default: 0},
+ {Name: "has_pallet", Type: field.TypeBool, Default: false},
+ {Name: "pallet_ref", Type: field.TypeString, Nullable: true, Size: 64, Default: ""},
+ {Name: "status", Type: field.TypeString, Size: 20, Default: "ENABLED"},
+ {Name: "created_at", Type: field.TypeTime},
+ }
+ // DockTable holds the schema information for the "dock" table.
+ DockTable = &schema.Table{
+ Name: "dock",
+ Columns: DockColumns,
+ PrimaryKey: []*schema.Column{DockColumns[0]},
+ Indexes: []*schema.Index{
+ {
+ Name: "dock_dock_code",
+ Unique: true,
+ Columns: []*schema.Column{DockColumns[1]},
+ },
+ {
+ Name: "dock_dock_type",
+ Unique: false,
+ Columns: []*schema.Column{DockColumns[3]},
+ },
+ },
+ }
// EventLogColumns holds the columns for the "event_log" table.
EventLogColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
@@ -1129,6 +1159,7 @@ var (
AttachmentTable,
WorkOrderBomTable,
DailyPlanTable,
+ DockTable,
EventLogTable,
InspectionRecordTable,
LinePointTable,
@@ -1176,6 +1207,9 @@ func init() {
DailyPlanTable.Annotation = &entsql.Annotation{
Table: "daily_plan",
}
+ DockTable.Annotation = &entsql.Annotation{
+ Table: "dock",
+ }
EventLogTable.Annotation = &entsql.Annotation{
Table: "event_log",
}
diff --git a/bj_power_mes/ent/mutation.go b/bj_power_mes/ent/mutation.go
index 4dff793..17bc04c 100644
--- a/bj_power_mes/ent/mutation.go
+++ b/bj_power_mes/ent/mutation.go
@@ -9,6 +9,7 @@ import (
"bj_power_mes/ent/attachment"
"bj_power_mes/ent/bomitem"
"bj_power_mes/ent/dailyplan"
+ "bj_power_mes/ent/dock"
"bj_power_mes/ent/eventlog"
"bj_power_mes/ent/inspectionrecord"
"bj_power_mes/ent/linepoint"
@@ -60,6 +61,7 @@ const (
TypeAttachment = "Attachment"
TypeBomItem = "BomItem"
TypeDailyPlan = "DailyPlan"
+ TypeDock = "Dock"
TypeEventLog = "EventLog"
TypeInspectionRecord = "InspectionRecord"
TypeLinePoint = "LinePoint"
@@ -5690,6 +5692,768 @@ func (m *DailyPlanMutation) ResetEdge(name string) error {
return fmt.Errorf("unknown DailyPlan edge %s", name)
}
+// DockMutation represents an operation that mutates the Dock nodes in the graph.
+type DockMutation struct {
+ config
+ op Op
+ typ string
+ id *int
+ dockCode *string
+ name *string
+ dockType *string
+ stationNo *int
+ addstationNo *int
+ hasPallet *bool
+ palletRef *string
+ status *string
+ createdAt *time.Time
+ clearedFields map[string]struct{}
+ done bool
+ oldValue func(context.Context) (*Dock, error)
+ predicates []predicate.Dock
+}
+
+var _ ent.Mutation = (*DockMutation)(nil)
+
+// dockOption allows management of the mutation configuration using functional options.
+type dockOption func(*DockMutation)
+
+// newDockMutation creates new mutation for the Dock entity.
+func newDockMutation(c config, op Op, opts ...dockOption) *DockMutation {
+ m := &DockMutation{
+ config: c,
+ op: op,
+ typ: TypeDock,
+ clearedFields: make(map[string]struct{}),
+ }
+ for _, opt := range opts {
+ opt(m)
+ }
+ return m
+}
+
+// withDockID sets the ID field of the mutation.
+func withDockID(id int) dockOption {
+ return func(m *DockMutation) {
+ var (
+ err error
+ once sync.Once
+ value *Dock
+ )
+ m.oldValue = func(ctx context.Context) (*Dock, error) {
+ once.Do(func() {
+ if m.done {
+ err = errors.New("querying old values post mutation is not allowed")
+ } else {
+ value, err = m.Client().Dock.Get(ctx, id)
+ }
+ })
+ return value, err
+ }
+ m.id = &id
+ }
+}
+
+// withDock sets the old Dock of the mutation.
+func withDock(node *Dock) dockOption {
+ return func(m *DockMutation) {
+ m.oldValue = func(context.Context) (*Dock, error) {
+ return node, nil
+ }
+ m.id = &node.ID
+ }
+}
+
+// Client returns a new `ent.Client` from the mutation. If the mutation was
+// executed in a transaction (ent.Tx), a transactional client is returned.
+func (m DockMutation) Client() *Client {
+ client := &Client{config: m.config}
+ client.init()
+ return client
+}
+
+// Tx returns an `ent.Tx` for mutations that were executed in transactions;
+// it returns an error otherwise.
+func (m DockMutation) Tx() (*Tx, error) {
+ if _, ok := m.driver.(*txDriver); !ok {
+ return nil, errors.New("ent: mutation is not running in a transaction")
+ }
+ tx := &Tx{config: m.config}
+ tx.init()
+ return tx, nil
+}
+
+// ID returns the ID value in the mutation. Note that the ID is only available
+// if it was provided to the builder or after it was returned from the database.
+func (m *DockMutation) ID() (id int, exists bool) {
+ if m.id == nil {
+ return
+ }
+ return *m.id, true
+}
+
+// IDs queries the database and returns the entity ids that match the mutation's predicate.
+// That means, if the mutation is applied within a transaction with an isolation level such
+// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
+// or updated by the mutation.
+func (m *DockMutation) IDs(ctx context.Context) ([]int, error) {
+ switch {
+ case m.op.Is(OpUpdateOne | OpDeleteOne):
+ id, exists := m.ID()
+ if exists {
+ return []int{id}, nil
+ }
+ fallthrough
+ case m.op.Is(OpUpdate | OpDelete):
+ return m.Client().Dock.Query().Where(m.predicates...).IDs(ctx)
+ default:
+ return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
+ }
+}
+
+// SetDockCode sets the "dockCode" field.
+func (m *DockMutation) SetDockCode(s string) {
+ m.dockCode = &s
+}
+
+// DockCode returns the value of the "dockCode" field in the mutation.
+func (m *DockMutation) DockCode() (r string, exists bool) {
+ v := m.dockCode
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldDockCode returns the old "dockCode" field's value of the Dock entity.
+// If the Dock object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *DockMutation) OldDockCode(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldDockCode is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldDockCode requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldDockCode: %w", err)
+ }
+ return oldValue.DockCode, nil
+}
+
+// ResetDockCode resets all changes to the "dockCode" field.
+func (m *DockMutation) ResetDockCode() {
+ m.dockCode = nil
+}
+
+// SetName sets the "name" field.
+func (m *DockMutation) SetName(s string) {
+ m.name = &s
+}
+
+// Name returns the value of the "name" field in the mutation.
+func (m *DockMutation) Name() (r string, exists bool) {
+ v := m.name
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldName returns the old "name" field's value of the Dock entity.
+// If the Dock object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *DockMutation) OldName(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldName is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldName requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldName: %w", err)
+ }
+ return oldValue.Name, nil
+}
+
+// ResetName resets all changes to the "name" field.
+func (m *DockMutation) ResetName() {
+ m.name = nil
+}
+
+// SetDockType sets the "dockType" field.
+func (m *DockMutation) SetDockType(s string) {
+ m.dockType = &s
+}
+
+// DockType returns the value of the "dockType" field in the mutation.
+func (m *DockMutation) DockType() (r string, exists bool) {
+ v := m.dockType
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldDockType returns the old "dockType" field's value of the Dock entity.
+// If the Dock object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *DockMutation) OldDockType(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldDockType is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldDockType requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldDockType: %w", err)
+ }
+ return oldValue.DockType, nil
+}
+
+// ResetDockType resets all changes to the "dockType" field.
+func (m *DockMutation) ResetDockType() {
+ m.dockType = nil
+}
+
+// SetStationNo sets the "stationNo" field.
+func (m *DockMutation) SetStationNo(i int) {
+ m.stationNo = &i
+ m.addstationNo = nil
+}
+
+// StationNo returns the value of the "stationNo" field in the mutation.
+func (m *DockMutation) StationNo() (r int, exists bool) {
+ v := m.stationNo
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldStationNo returns the old "stationNo" field's value of the Dock entity.
+// If the Dock object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *DockMutation) OldStationNo(ctx context.Context) (v int, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldStationNo is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldStationNo requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldStationNo: %w", err)
+ }
+ return oldValue.StationNo, nil
+}
+
+// AddStationNo adds i to the "stationNo" field.
+func (m *DockMutation) AddStationNo(i int) {
+ if m.addstationNo != nil {
+ *m.addstationNo += i
+ } else {
+ m.addstationNo = &i
+ }
+}
+
+// AddedStationNo returns the value that was added to the "stationNo" field in this mutation.
+func (m *DockMutation) AddedStationNo() (r int, exists bool) {
+ v := m.addstationNo
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// ResetStationNo resets all changes to the "stationNo" field.
+func (m *DockMutation) ResetStationNo() {
+ m.stationNo = nil
+ m.addstationNo = nil
+}
+
+// SetHasPallet sets the "hasPallet" field.
+func (m *DockMutation) SetHasPallet(b bool) {
+ m.hasPallet = &b
+}
+
+// HasPallet returns the value of the "hasPallet" field in the mutation.
+func (m *DockMutation) HasPallet() (r bool, exists bool) {
+ v := m.hasPallet
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldHasPallet returns the old "hasPallet" field's value of the Dock entity.
+// If the Dock object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *DockMutation) OldHasPallet(ctx context.Context) (v bool, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldHasPallet is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldHasPallet requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldHasPallet: %w", err)
+ }
+ return oldValue.HasPallet, nil
+}
+
+// ResetHasPallet resets all changes to the "hasPallet" field.
+func (m *DockMutation) ResetHasPallet() {
+ m.hasPallet = nil
+}
+
+// SetPalletRef sets the "palletRef" field.
+func (m *DockMutation) SetPalletRef(s string) {
+ m.palletRef = &s
+}
+
+// PalletRef returns the value of the "palletRef" field in the mutation.
+func (m *DockMutation) PalletRef() (r string, exists bool) {
+ v := m.palletRef
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldPalletRef returns the old "palletRef" field's value of the Dock entity.
+// If the Dock object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *DockMutation) OldPalletRef(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldPalletRef is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldPalletRef requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldPalletRef: %w", err)
+ }
+ return oldValue.PalletRef, nil
+}
+
+// ClearPalletRef clears the value of the "palletRef" field.
+func (m *DockMutation) ClearPalletRef() {
+ m.palletRef = nil
+ m.clearedFields[dock.FieldPalletRef] = struct{}{}
+}
+
+// PalletRefCleared returns if the "palletRef" field was cleared in this mutation.
+func (m *DockMutation) PalletRefCleared() bool {
+ _, ok := m.clearedFields[dock.FieldPalletRef]
+ return ok
+}
+
+// ResetPalletRef resets all changes to the "palletRef" field.
+func (m *DockMutation) ResetPalletRef() {
+ m.palletRef = nil
+ delete(m.clearedFields, dock.FieldPalletRef)
+}
+
+// SetStatus sets the "status" field.
+func (m *DockMutation) SetStatus(s string) {
+ m.status = &s
+}
+
+// Status returns the value of the "status" field in the mutation.
+func (m *DockMutation) Status() (r string, exists bool) {
+ v := m.status
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldStatus returns the old "status" field's value of the Dock entity.
+// If the Dock object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *DockMutation) OldStatus(ctx context.Context) (v string, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldStatus is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldStatus requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldStatus: %w", err)
+ }
+ return oldValue.Status, nil
+}
+
+// ResetStatus resets all changes to the "status" field.
+func (m *DockMutation) ResetStatus() {
+ m.status = nil
+}
+
+// SetCreatedAt sets the "createdAt" field.
+func (m *DockMutation) SetCreatedAt(t time.Time) {
+ m.createdAt = &t
+}
+
+// CreatedAt returns the value of the "createdAt" field in the mutation.
+func (m *DockMutation) CreatedAt() (r time.Time, exists bool) {
+ v := m.createdAt
+ if v == nil {
+ return
+ }
+ return *v, true
+}
+
+// OldCreatedAt returns the old "createdAt" field's value of the Dock entity.
+// If the Dock object wasn't provided to the builder, the object is fetched from the database.
+// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
+func (m *DockMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) {
+ if !m.op.Is(OpUpdateOne) {
+ return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
+ }
+ if m.id == nil || m.oldValue == nil {
+ return v, errors.New("OldCreatedAt requires an ID field in the mutation")
+ }
+ oldValue, err := m.oldValue(ctx)
+ if err != nil {
+ return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
+ }
+ return oldValue.CreatedAt, nil
+}
+
+// ResetCreatedAt resets all changes to the "createdAt" field.
+func (m *DockMutation) ResetCreatedAt() {
+ m.createdAt = nil
+}
+
+// Where appends a list predicates to the DockMutation builder.
+func (m *DockMutation) Where(ps ...predicate.Dock) {
+ m.predicates = append(m.predicates, ps...)
+}
+
+// WhereP appends storage-level predicates to the DockMutation builder. Using this method,
+// users can use type-assertion to append predicates that do not depend on any generated package.
+func (m *DockMutation) WhereP(ps ...func(*sql.Selector)) {
+ p := make([]predicate.Dock, len(ps))
+ for i := range ps {
+ p[i] = ps[i]
+ }
+ m.Where(p...)
+}
+
+// Op returns the operation name.
+func (m *DockMutation) Op() Op {
+ return m.op
+}
+
+// SetOp allows setting the mutation operation.
+func (m *DockMutation) SetOp(op Op) {
+ m.op = op
+}
+
+// Type returns the node type of this mutation (Dock).
+func (m *DockMutation) Type() string {
+ return m.typ
+}
+
+// Fields returns all fields that were changed during this mutation. Note that in
+// order to get all numeric fields that were incremented/decremented, call
+// AddedFields().
+func (m *DockMutation) Fields() []string {
+ fields := make([]string, 0, 8)
+ if m.dockCode != nil {
+ fields = append(fields, dock.FieldDockCode)
+ }
+ if m.name != nil {
+ fields = append(fields, dock.FieldName)
+ }
+ if m.dockType != nil {
+ fields = append(fields, dock.FieldDockType)
+ }
+ if m.stationNo != nil {
+ fields = append(fields, dock.FieldStationNo)
+ }
+ if m.hasPallet != nil {
+ fields = append(fields, dock.FieldHasPallet)
+ }
+ if m.palletRef != nil {
+ fields = append(fields, dock.FieldPalletRef)
+ }
+ if m.status != nil {
+ fields = append(fields, dock.FieldStatus)
+ }
+ if m.createdAt != nil {
+ fields = append(fields, dock.FieldCreatedAt)
+ }
+ return fields
+}
+
+// Field returns the value of a field with the given name. The second boolean
+// return value indicates that this field was not set, or was not defined in the
+// schema.
+func (m *DockMutation) Field(name string) (ent.Value, bool) {
+ switch name {
+ case dock.FieldDockCode:
+ return m.DockCode()
+ case dock.FieldName:
+ return m.Name()
+ case dock.FieldDockType:
+ return m.DockType()
+ case dock.FieldStationNo:
+ return m.StationNo()
+ case dock.FieldHasPallet:
+ return m.HasPallet()
+ case dock.FieldPalletRef:
+ return m.PalletRef()
+ case dock.FieldStatus:
+ return m.Status()
+ case dock.FieldCreatedAt:
+ return m.CreatedAt()
+ }
+ return nil, false
+}
+
+// OldField returns the old value of the field from the database. An error is
+// returned if the mutation operation is not UpdateOne, or the query to the
+// database failed.
+func (m *DockMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
+ switch name {
+ case dock.FieldDockCode:
+ return m.OldDockCode(ctx)
+ case dock.FieldName:
+ return m.OldName(ctx)
+ case dock.FieldDockType:
+ return m.OldDockType(ctx)
+ case dock.FieldStationNo:
+ return m.OldStationNo(ctx)
+ case dock.FieldHasPallet:
+ return m.OldHasPallet(ctx)
+ case dock.FieldPalletRef:
+ return m.OldPalletRef(ctx)
+ case dock.FieldStatus:
+ return m.OldStatus(ctx)
+ case dock.FieldCreatedAt:
+ return m.OldCreatedAt(ctx)
+ }
+ return nil, fmt.Errorf("unknown Dock field %s", name)
+}
+
+// SetField sets the value of a field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *DockMutation) SetField(name string, value ent.Value) error {
+ switch name {
+ case dock.FieldDockCode:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetDockCode(v)
+ return nil
+ case dock.FieldName:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetName(v)
+ return nil
+ case dock.FieldDockType:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetDockType(v)
+ return nil
+ case dock.FieldStationNo:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetStationNo(v)
+ return nil
+ case dock.FieldHasPallet:
+ v, ok := value.(bool)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetHasPallet(v)
+ return nil
+ case dock.FieldPalletRef:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetPalletRef(v)
+ return nil
+ case dock.FieldStatus:
+ v, ok := value.(string)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetStatus(v)
+ return nil
+ case dock.FieldCreatedAt:
+ v, ok := value.(time.Time)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.SetCreatedAt(v)
+ return nil
+ }
+ return fmt.Errorf("unknown Dock field %s", name)
+}
+
+// AddedFields returns all numeric fields that were incremented/decremented during
+// this mutation.
+func (m *DockMutation) AddedFields() []string {
+ var fields []string
+ if m.addstationNo != nil {
+ fields = append(fields, dock.FieldStationNo)
+ }
+ return fields
+}
+
+// AddedField returns the numeric value that was incremented/decremented on a field
+// with the given name. The second boolean return value indicates that this field
+// was not set, or was not defined in the schema.
+func (m *DockMutation) AddedField(name string) (ent.Value, bool) {
+ switch name {
+ case dock.FieldStationNo:
+ return m.AddedStationNo()
+ }
+ return nil, false
+}
+
+// AddField adds the value to the field with the given name. It returns an error if
+// the field is not defined in the schema, or if the type mismatched the field
+// type.
+func (m *DockMutation) AddField(name string, value ent.Value) error {
+ switch name {
+ case dock.FieldStationNo:
+ v, ok := value.(int)
+ if !ok {
+ return fmt.Errorf("unexpected type %T for field %s", value, name)
+ }
+ m.AddStationNo(v)
+ return nil
+ }
+ return fmt.Errorf("unknown Dock numeric field %s", name)
+}
+
+// ClearedFields returns all nullable fields that were cleared during this
+// mutation.
+func (m *DockMutation) ClearedFields() []string {
+ var fields []string
+ if m.FieldCleared(dock.FieldPalletRef) {
+ fields = append(fields, dock.FieldPalletRef)
+ }
+ return fields
+}
+
+// FieldCleared returns a boolean indicating if a field with the given name was
+// cleared in this mutation.
+func (m *DockMutation) FieldCleared(name string) bool {
+ _, ok := m.clearedFields[name]
+ return ok
+}
+
+// ClearField clears the value of the field with the given name. It returns an
+// error if the field is not defined in the schema.
+func (m *DockMutation) ClearField(name string) error {
+ switch name {
+ case dock.FieldPalletRef:
+ m.ClearPalletRef()
+ return nil
+ }
+ return fmt.Errorf("unknown Dock nullable field %s", name)
+}
+
+// ResetField resets all changes in the mutation for the field with the given name.
+// It returns an error if the field is not defined in the schema.
+func (m *DockMutation) ResetField(name string) error {
+ switch name {
+ case dock.FieldDockCode:
+ m.ResetDockCode()
+ return nil
+ case dock.FieldName:
+ m.ResetName()
+ return nil
+ case dock.FieldDockType:
+ m.ResetDockType()
+ return nil
+ case dock.FieldStationNo:
+ m.ResetStationNo()
+ return nil
+ case dock.FieldHasPallet:
+ m.ResetHasPallet()
+ return nil
+ case dock.FieldPalletRef:
+ m.ResetPalletRef()
+ return nil
+ case dock.FieldStatus:
+ m.ResetStatus()
+ return nil
+ case dock.FieldCreatedAt:
+ m.ResetCreatedAt()
+ return nil
+ }
+ return fmt.Errorf("unknown Dock field %s", name)
+}
+
+// AddedEdges returns all edge names that were set/added in this mutation.
+func (m *DockMutation) AddedEdges() []string {
+ edges := make([]string, 0, 0)
+ return edges
+}
+
+// AddedIDs returns all IDs (to other nodes) that were added for the given edge
+// name in this mutation.
+func (m *DockMutation) AddedIDs(name string) []ent.Value {
+ return nil
+}
+
+// RemovedEdges returns all edge names that were removed in this mutation.
+func (m *DockMutation) RemovedEdges() []string {
+ edges := make([]string, 0, 0)
+ return edges
+}
+
+// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
+// the given name in this mutation.
+func (m *DockMutation) RemovedIDs(name string) []ent.Value {
+ return nil
+}
+
+// ClearedEdges returns all edge names that were cleared in this mutation.
+func (m *DockMutation) ClearedEdges() []string {
+ edges := make([]string, 0, 0)
+ return edges
+}
+
+// EdgeCleared returns a boolean which indicates if the edge with the given name
+// was cleared in this mutation.
+func (m *DockMutation) EdgeCleared(name string) bool {
+ return false
+}
+
+// ClearEdge clears the value of the edge with the given name. It returns an error
+// if that edge is not defined in the schema.
+func (m *DockMutation) ClearEdge(name string) error {
+ return fmt.Errorf("unknown Dock unique edge %s", name)
+}
+
+// ResetEdge resets all changes to the edge with the given name in this mutation.
+// It returns an error if the edge is not defined in the schema.
+func (m *DockMutation) ResetEdge(name string) error {
+ return fmt.Errorf("unknown Dock edge %s", name)
+}
+
// EventLogMutation represents an operation that mutates the EventLog nodes in the graph.
type EventLogMutation struct {
config
diff --git a/bj_power_mes/ent/predicate/predicate.go b/bj_power_mes/ent/predicate/predicate.go
index 7da5558..28c01a5 100644
--- a/bj_power_mes/ent/predicate/predicate.go
+++ b/bj_power_mes/ent/predicate/predicate.go
@@ -24,6 +24,9 @@ type BomItem func(*sql.Selector)
// DailyPlan is the predicate function for dailyplan builders.
type DailyPlan func(*sql.Selector)
+// Dock is the predicate function for dock builders.
+type Dock func(*sql.Selector)
+
// EventLog is the predicate function for eventlog builders.
type EventLog func(*sql.Selector)
diff --git a/bj_power_mes/ent/runtime.go b/bj_power_mes/ent/runtime.go
index a097cdc..afbc48c 100644
--- a/bj_power_mes/ent/runtime.go
+++ b/bj_power_mes/ent/runtime.go
@@ -9,6 +9,7 @@ import (
"bj_power_mes/ent/attachment"
"bj_power_mes/ent/bomitem"
"bj_power_mes/ent/dailyplan"
+ "bj_power_mes/ent/dock"
"bj_power_mes/ent/eventlog"
"bj_power_mes/ent/inspectionrecord"
"bj_power_mes/ent/linepoint"
@@ -368,6 +369,48 @@ func init() {
dailyplanDescID := dailyplanFields[0].Descriptor()
// dailyplan.IDValidator is a validator for the "id" field. It is called by the builders before save.
dailyplan.IDValidator = dailyplanDescID.Validators[0].(func(int) error)
+ dockFields := schema.Dock{}.Fields()
+ _ = dockFields
+ // dockDescDockCode is the schema descriptor for dockCode field.
+ dockDescDockCode := dockFields[0].Descriptor()
+ // dock.DockCodeValidator is a validator for the "dockCode" field. It is called by the builders before save.
+ dock.DockCodeValidator = dockDescDockCode.Validators[0].(func(string) error)
+ // dockDescName is the schema descriptor for name field.
+ dockDescName := dockFields[1].Descriptor()
+ // dock.DefaultName holds the default value on creation for the name field.
+ dock.DefaultName = dockDescName.Default.(string)
+ // dock.NameValidator is a validator for the "name" field. It is called by the builders before save.
+ dock.NameValidator = dockDescName.Validators[0].(func(string) error)
+ // dockDescDockType is the schema descriptor for dockType field.
+ dockDescDockType := dockFields[2].Descriptor()
+ // dock.DefaultDockType holds the default value on creation for the dockType field.
+ dock.DefaultDockType = dockDescDockType.Default.(string)
+ // dock.DockTypeValidator is a validator for the "dockType" field. It is called by the builders before save.
+ dock.DockTypeValidator = dockDescDockType.Validators[0].(func(string) error)
+ // dockDescStationNo is the schema descriptor for stationNo field.
+ dockDescStationNo := dockFields[3].Descriptor()
+ // dock.DefaultStationNo holds the default value on creation for the stationNo field.
+ dock.DefaultStationNo = dockDescStationNo.Default.(int)
+ // dockDescHasPallet is the schema descriptor for hasPallet field.
+ dockDescHasPallet := dockFields[4].Descriptor()
+ // dock.DefaultHasPallet holds the default value on creation for the hasPallet field.
+ dock.DefaultHasPallet = dockDescHasPallet.Default.(bool)
+ // dockDescPalletRef is the schema descriptor for palletRef field.
+ dockDescPalletRef := dockFields[5].Descriptor()
+ // dock.DefaultPalletRef holds the default value on creation for the palletRef field.
+ dock.DefaultPalletRef = dockDescPalletRef.Default.(string)
+ // dock.PalletRefValidator is a validator for the "palletRef" field. It is called by the builders before save.
+ dock.PalletRefValidator = dockDescPalletRef.Validators[0].(func(string) error)
+ // dockDescStatus is the schema descriptor for status field.
+ dockDescStatus := dockFields[6].Descriptor()
+ // dock.DefaultStatus holds the default value on creation for the status field.
+ dock.DefaultStatus = dockDescStatus.Default.(string)
+ // dock.StatusValidator is a validator for the "status" field. It is called by the builders before save.
+ dock.StatusValidator = dockDescStatus.Validators[0].(func(string) error)
+ // dockDescCreatedAt is the schema descriptor for createdAt field.
+ dockDescCreatedAt := dockFields[7].Descriptor()
+ // dock.DefaultCreatedAt holds the default value on creation for the createdAt field.
+ dock.DefaultCreatedAt = dockDescCreatedAt.Default.(func() time.Time)
eventlogFields := schema.EventLog{}.Fields()
_ = eventlogFields
// eventlogDescEventType is the schema descriptor for eventType field.
diff --git a/bj_power_mes/ent/tx.go b/bj_power_mes/ent/tx.go
index 9c2de04..1566fd2 100644
--- a/bj_power_mes/ent/tx.go
+++ b/bj_power_mes/ent/tx.go
@@ -24,6 +24,8 @@ type Tx struct {
BomItem *BomItemClient
// DailyPlan is the client for interacting with the DailyPlan builders.
DailyPlan *DailyPlanClient
+ // Dock is the client for interacting with the Dock builders.
+ Dock *DockClient
// EventLog is the client for interacting with the EventLog builders.
EventLog *EventLogClient
// InspectionRecord is the client for interacting with the InspectionRecord builders.
@@ -211,6 +213,7 @@ func (tx *Tx) init() {
tx.Attachment = NewAttachmentClient(tx.config)
tx.BomItem = NewBomItemClient(tx.config)
tx.DailyPlan = NewDailyPlanClient(tx.config)
+ tx.Dock = NewDockClient(tx.config)
tx.EventLog = NewEventLogClient(tx.config)
tx.InspectionRecord = NewInspectionRecordClient(tx.config)
tx.LinePoint = NewLinePointClient(tx.config)
diff --git a/bj_power_mes/frontend/src/help.js b/bj_power_mes/frontend/src/help.js
index 6a4e485..ecaf649 100644
--- a/bj_power_mes/frontend/src/help.js
+++ b/bj_power_mes/frontend/src/help.js
@@ -237,6 +237,21 @@ export const helpStation = {
]
}
+export const helpDock = {
+ title: '鎺ラ┏鍙扮淮鎶わ紙鍙涓绘暟鎹級',
+ overview:
+ '鎺ラ┏鍙版槸浜х嚎涓庡簱鎴夸箣闂翠緵 AGV 鍙栭佽揣鐨勭墿鐞嗗仠闈犱綅锛岀湡婧愬湪 MES锛2026-09-21 鑷 WMS 杩佸叆锛夈傚叡 21 涓浐瀹氱紪鐮侊細DOCK01~DOCK20锛堜骇绾匡紝DOCKn鈫斿伐浣峮锛+ DOCK21锛堝簱鎴挎敹璐э級銆俓n\n鎺ラ┏鍙颁负绯荤粺棰勭疆鍙涓绘暟鎹紝鐢辩瀛愬垵濮嬪寲锛屾湰椤典笉鎻愪緵鏂板/淇敼/鍒犻櫎锛屼粎渚涙煡鐪嬶紱宸ヤ綅缁存姢銆佹帓浜ф帹鑽愩丄GV 閫氳鍧囦互鏈〃涓虹湡婧愭煡璇㈡帴椹冲彴銆俓n\n銆屽崰鐢ㄧ姸鎬/鎵樼洏鍏宠仈銆嶅弽鏄犺鎺ラ┏鍙板綋鍓嶆槸鍚︽湁鎵樼洏鍙婃墭鐩樺搴旂殑鍑哄簱/澶囨枡鍗曪紝渚涚幇鍦鸿皟搴﹀弬鑰冦',
+ fields: [
+ { name: '鎺ラ┏鍙扮紪鐮', source: '绯荤粺棰勭疆锛堢瀛愶級銆', purpose: '鎺ラ┏鍙板敮涓鏍囪瘑 DOCK01..21', fill: '鍙' },
+ { name: '鎺ラ┏鍙板悕绉', source: '绯荤粺棰勭疆銆', purpose: '鎺ラ┏鍙版樉绀哄悕绉', fill: '鍙' },
+ { name: '绫诲瀷', source: '绯荤粺棰勭疆銆俵ine=浜х嚎 / store=搴撴埧 / other=鍏朵粬銆', purpose: '鍖哄垎鎺ラ┏鍙版墍鍦ㄤ綅缃', fill: '鍙' },
+ { name: '缁戝畾宸ヤ綅', source: '绯荤粺棰勭疆锛堜骇绾挎帴椹冲彴涓庡伐浣 1:1锛夈', purpose: '璇ユ帴椹冲彴鏈嶅姟鐨勪骇绾垮伐浣嶅彿', fill: '鍙锛涘簱鎴/鍏朵粬鎺ラ┏鍙颁笉缁戝伐浣' },
+ { name: '鍗犵敤鐘舵', source: 'PLC 鎵樼洏浼犳劅鍣 / AGV 鍒颁綅鍗歌揣鑷姩缁存姢銆', purpose: '褰撳墠鏄惁鏈夋墭鐩', fill: '鍙' },
+ { name: '鎵樼洏鍏宠仈', source: '鏈夋墭鐩樻椂璁板綍瀵瑰簲鍑哄簱鍗曞彿/澶囨枡鍗曞彿銆', purpose: '鏌ヨ繖涓墭鐩樻槸鍝壒鏂欍佽閫佸埌鍝', fill: '鍙' },
+ { name: '鍚敤鐘舵', source: '绯荤粺棰勭疆 ENABLED/DISABLED銆', purpose: '鍋滅敤鍚庝笉鍦ㄤ笅鎷夊嚭鐜', fill: '鍙' }
+ ]
+}
+
export const helpTrace = {
title: '宸ヤ欢杩芥函',
overview:
diff --git a/bj_power_mes/frontend/src/layouts/MainLayout.vue b/bj_power_mes/frontend/src/layouts/MainLayout.vue
index 574c728..6afba14 100644
--- a/bj_power_mes/frontend/src/layouts/MainLayout.vue
+++ b/bj_power_mes/frontend/src/layouts/MainLayout.vue
@@ -70,7 +70,7 @@ import { useRouter } from 'vue-router'
import {
Document, Calendar, Box, Goods, ShoppingCart, Monitor, Tools,
Operation, Link, DataLine, EditPen, Search, CircleCheck, Clock, User,
- Key, Fold, Expand, Warning, Paperclip, Tickets, Bell
+ Key, Fold, Expand, Warning, Paperclip, Tickets, Bell, Aim
} from '@element-plus/icons-vue'
import { ElNotification } from 'element-plus'
import { getUser, logout } from '../utils/auth'
@@ -152,6 +152,7 @@ const menuGroups = [
title: '鍩虹閰嶇疆', icon: Box, children: [
{ code: 'produce.processflow', name: '宸ヨ壓娴佺▼', path: '/process-flow', icon: Operation },
{ code: 'produce.station', name: '鍏宠仈宸ヤ綅', path: '/station', icon: Link },
+ { code: 'produce.dock', name: '鎺ラ┏鍙扮淮鎶', path: '/dock', icon: Aim },
{ code: 'produce.product', name: '鐗╂枡妗f', path: '/product-type', icon: Box }
]
},
diff --git a/bj_power_wms/frontend/src/pages/Dock.vue b/bj_power_mes/frontend/src/pages/Dock.vue
similarity index 91%
rename from bj_power_wms/frontend/src/pages/Dock.vue
rename to bj_power_mes/frontend/src/pages/Dock.vue
index 1571057..3eb1e88 100644
--- a/bj_power_wms/frontend/src/pages/Dock.vue
+++ b/bj_power_mes/frontend/src/pages/Dock.vue
@@ -2,9 +2,9 @@
+ title="鎺ラ┏鍙版槸浜х嚎涓庡簱鎴夸箣闂翠緵 AGV 鍙栭佽揣鐨勭墿鐞嗗仠闈犱綅锛屼负绯荤粺棰勭疆鐨勫彧璇讳富鏁版嵁锛堢湡婧愬湪 MES锛夛紝鏈〉浠呬緵鏌ョ湅銆" />
-
+
@@ -87,7 +87,7 @@ const list = ref([])
const total = ref(0)
const loading = ref(false)
const page = reactive({ current: 1, size: 20 })
-// 榛樿鍙湅鍚敤锛涘仠鐢ㄩ渶涓诲姩閫夋嫨锛堥渶姹7 涓鑷寸殑榛樿鍙e緞锛
+// 榛樿鍙湅鍚敤锛涘仠鐢ㄩ渶涓诲姩閫夋嫨
const filter = reactive({ dockCode: '', name: '', dockType: '', status: 'ENABLED' })
const TYPE_LABEL = { line: '浜х嚎', store: '搴撴埧', other: '鍏朵粬' }
@@ -102,7 +102,7 @@ async function load() {
if (filter.name.trim()) params.name = filter.name.trim()
if (filter.dockType) params.dockType = filter.dockType
if (filter.status) params.status = filter.status
- const data = await request.get('/docks', { params })
+ const data = await request.get('/docks/maint', { params })
list.value = data?.list || []
total.value = data?.total || 0
} finally {
diff --git a/bj_power_mes/frontend/src/router/index.js b/bj_power_mes/frontend/src/router/index.js
index 5e32444..f4dab50 100644
--- a/bj_power_mes/frontend/src/router/index.js
+++ b/bj_power_mes/frontend/src/router/index.js
@@ -17,6 +17,7 @@ const routes = [
{ path: 'torque', name: 'Torque', component: () => import('../pages/Torque.vue'), meta: { title: '鎷х揣鏌ヨ' } },
{ path: 'process-flow', name: 'ProcessFlow', component: () => import('../pages/ProcessFlow.vue'), meta: { title: '宸ヨ壓娴佺▼' } },
{ path: 'station', name: 'Station', component: () => import('../pages/Station.vue'), meta: { title: '鍏宠仈宸ヤ綅' } },
+ { path: 'dock', name: 'Dock', component: () => import('../pages/Dock.vue'), meta: { title: '鎺ラ┏鍙扮淮鎶' } },
{ path: 'performance', name: 'Performance', component: () => import('../pages/Performance.vue'), meta: { title: '缁╂晥鎶ヨ〃' } },
{ path: 'inspect', name: 'Inspect', component: () => import('../pages/Inspect.vue'), meta: { title: '宸℃缁堢' } },
{ path: 'quality', name: 'QualityInspection', component: () => import('../pages/QualityInspection.vue'), meta: { title: '璐ㄩ噺妫楠' } },
diff --git a/bj_power_mes/internal/db/db.go b/bj_power_mes/internal/db/db.go
index 5820a4c..e308017 100644
--- a/bj_power_mes/internal/db/db.go
+++ b/bj_power_mes/internal/db/db.go
@@ -187,6 +187,10 @@ var schemaPatchSQL = []string{
`ALTER TABLE attachment ADD COLUMN IF NOT EXISTS deleted boolean NOT NULL DEFAULT false`,
`ALTER TABLE attachment ADD COLUMN IF NOT EXISTS deleted_at bigint NOT NULL DEFAULT 0`,
`ALTER TABLE attachment ADD COLUMN IF NOT EXISTS deleted_by varchar(64) NOT NULL DEFAULT ''`,
+
+ // ---- 鎺ラ┏鍙颁富鏁版嵁杩佸叆 MES锛2026-09-21锛岀湡婧愯嚜 WMS 绉诲叆锛----
+ // 宸ヤ綅鈫旀帴椹冲彴 1:1锛氶儴鍒嗗敮涓绱㈠紩鍙害鏉熷凡缁戝畾宸ヤ綅(station_no>0)鐨勮锛屽簱鎴/鍏朵粬鎺ラ┏鍙颁笉鍙備笌銆
+ `CREATE UNIQUE INDEX IF NOT EXISTS ux_dock_station_no ON dock (station_no) WHERE station_no > 0`,
}
// EnsureSchema ent 寤鸿〃 + 骞傜瓑鍒楄ˉ涓侊紙鍙锛屼笉鍒犳暟鎹級
diff --git a/bj_power_mes/internal/handler/production/bom_material.go b/bj_power_mes/internal/handler/production/bom_material.go
index 2e71eff..21fadbe 100644
--- a/bj_power_mes/internal/handler/production/bom_material.go
+++ b/bj_power_mes/internal/handler/production/bom_material.go
@@ -305,19 +305,7 @@ func MarkMaterialRequestStatusInternalHandler(svcCtx *svc.ServiceContext) http.H
}
// ---------- 鎺ラ┏鍙 / 鎺ユ枡纭 ----------
-
-// ListDocksHandler GET /docks 鎷夊彇 WMS 鎺ラ┏鍙颁富鏁版嵁锛坉ock 鐪熸簮鍦 WMS锛夈
-// WMS 涓嶅彲杈鹃檷绾т负閿欒锛屽墠绔粛鍙敤鍐欐鍏滃簳涓嬫媺銆
-func ListDocksHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) {
- list, err := svcCtx.Wms.ListDocks(r.Context())
- if err != nil {
- httpx.Fail(w, 3113, "鎷夊彇鎺ラ┏鍙板け璐ワ細"+err.Error())
- return
- }
- httpx.Ok(w, list)
- }
-}
+// 鎺ラ┏鍙版煡璇/缁存姢鎺ュ彛瑙 dock.go锛堢湡婧愬凡杩 MES 鏈湴 dock 琛級銆
// ReceiveMaterialRequestHandler POST /material-requests/receive 鎺ユ枡纭锛圡ES 澶囨枡椤典汉宸ョ偣銆屽凡鎺ユ枡銆嶏級銆
// qty 鍙┖锛堚墹0 琛ㄧず纭鏈壒鍏ㄩ儴鍓╀綑锛夛紱绱姞 receivedQty锛堝凡鎺ユ枡锛夛紝涓婇檺涓哄凡鍙戝嚭閲忋
diff --git a/bj_power_mes/internal/handler/production/dock.go b/bj_power_mes/internal/handler/production/dock.go
new file mode 100644
index 0000000..ffd6204
--- /dev/null
+++ b/bj_power_mes/internal/handler/production/dock.go
@@ -0,0 +1,121 @@
+package production
+
+import (
+ "net/http"
+ "strconv"
+ "strings"
+
+ "bj_power_mes/common/httpx"
+ "bj_power_mes/ent"
+ "bj_power_mes/ent/dock"
+ "bj_power_mes/internal/svc"
+)
+
+// 鎺ラ┏鍙颁富鏁版嵁锛堢湡婧愬湪 MES锛2026-09-21 鑷 WMS 杩佸叆锛夛細绯荤粺棰勭疆鍙锛屼笉鎻愪緵澧炲垹鏀广
+// 宸ヤ綅缁存姢 / 鎺掍骇鎺ㄨ崘 / AGV 閫氳鍧囨煡鏈〃锛涗粨搴撲笉鍐嶇淮鎶ゆ帴椹冲彴銆佷篃涓嶇粰鎺ラ┏鍙版淳浠诲姟銆
+
+// dockRow 鎺ラ┏鍙拌繑鍥 DTO锛堟樉寮 json 鏍囩锛岄伩鍏 ent omitempty 鍚炴帀 hasPallet=false锛夈
+type dockRow struct {
+ ID int64 `json:"id"`
+ DockCode string `json:"dockCode"`
+ Name string `json:"name"`
+ DockType string `json:"dockType"`
+ StationNo int `json:"stationNo"`
+ Status string `json:"status"`
+ HasPallet bool `json:"hasPallet"`
+ PalletRef string `json:"palletRef"`
+ CreatedAt int64 `json:"createdAt"`
+}
+
+func dockRowOf(d *ent.Dock) dockRow {
+ return dockRow{
+ ID: int64(d.ID),
+ DockCode: d.DockCode,
+ Name: d.Name,
+ DockType: d.DockType,
+ StationNo: d.StationNo,
+ Status: d.Status,
+ HasPallet: d.HasPallet,
+ PalletRef: d.PalletRef,
+ CreatedAt: d.CreatedAt.Unix(),
+ }
+}
+
+// ListDocksHandler GET /docks 鎺ラ┏鍙板叏閲忓垪琛紙宸ヤ綅/鎺掍骇/AGV 涓嬫媺鐪熸簮锛岃鏈湴 dock 琛級銆
+func ListDocksHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ list, err := svcCtx.EntClient.Dock.Query().Order(ent.Asc("dockCode")).All(r.Context())
+ if err != nil {
+ httpx.Fail(w, 3113, "鏌ヨ鎺ラ┏鍙板け璐ワ細"+err.Error())
+ return
+ }
+ rows := make([]dockRow, 0, len(list))
+ for _, d := range list {
+ rows = append(rows, dockRowOf(d))
+ }
+ httpx.Ok(w, rows)
+ }
+}
+
+// ListDocksMaintHandler GET /docks/maint 鎺ラ┏鍙扮淮鎶ら〉鍙鍒嗛〉鏌ヨ銆
+// 缂栫爜绮剧‘ / 鍚嶇О妯$硦 / 绫诲瀷绮剧‘ / 鐘舵佺簿纭悇鑷嫭绔嬬瓫閫夛紙鐪熷垎椤靛湪 SQL 灞傦級銆
+func ListDocksMaintHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ q := r.URL.Query()
+ query := svcCtx.EntClient.Dock.Query()
+ if typ := strings.TrimSpace(q.Get("dockType")); typ != "" {
+ query = query.Where(dock.DockTypeEQ(typ))
+ }
+ if code := strings.TrimSpace(q.Get("dockCode")); code != "" {
+ query = query.Where(dock.DockCodeEqualFold(code))
+ }
+ if name := strings.TrimSpace(q.Get("name")); name != "" {
+ query = query.Where(dock.NameContainsFold(name))
+ }
+ if status := strings.TrimSpace(q.Get("status")); status != "" {
+ query = query.Where(dock.StatusEQ(status))
+ }
+ total, err := query.Count(r.Context())
+ if err != nil {
+ httpx.Fail(w, 3113, "鏌ヨ鎺ラ┏鍙板け璐ワ細"+err.Error())
+ return
+ }
+ page, _ := strconv.Atoi(q.Get("page"))
+ if page < 1 {
+ page = 1
+ }
+ size, _ := strconv.Atoi(q.Get("pageSize"))
+ if size < 1 || size > 200 {
+ size = 20
+ }
+ list, err := query.
+ Order(ent.Desc("createdAt"), ent.Desc("id")).
+ Offset((page - 1) * size).Limit(size).All(r.Context())
+ if err != nil {
+ httpx.Fail(w, 3113, "鏌ヨ鎺ラ┏鍙板け璐ワ細"+err.Error())
+ return
+ }
+ rows := make([]dockRow, 0, len(list))
+ for _, d := range list {
+ rows = append(rows, dockRowOf(d))
+ }
+ httpx.Ok(w, map[string]any{"list": rows, "total": total, "page": page, "pageSize": size})
+ }
+}
+
+// ListDocksInternalHandler GET /api/internal/docks 渚 WMS 鎷夊彇鎺ラ┏鍙颁富鏁版嵁
+// 锛圵MS 鍑哄簱鐩爣宸ヤ綅涓嬫媺 / AGV 椤垫帴椹冲彴鍒楄〃锛沝ock 鐪熸簮宸茶縼 MES锛夈俋-API-TOKEN 淇濇姢銆
+func ListDocksInternalHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+ return func(w http.ResponseWriter, r *http.Request) {
+ list, err := svcCtx.EntClient.Dock.Query().Order(ent.Asc("dockCode")).All(r.Context())
+ if err != nil {
+ httpx.Fail(w, 3113, "鏌ヨ鎺ラ┏鍙板け璐ワ細"+err.Error())
+ return
+ }
+ rows := make([]dockRow, 0, len(list))
+ for _, d := range list {
+ rows = append(rows, dockRowOf(d))
+ }
+ httpx.Ok(w, map[string]any{"list": rows})
+ }
+}
diff --git a/bj_power_mes/internal/handler/routes_production.go b/bj_power_mes/internal/handler/routes_production.go
index 7f119d8..cc1ce5a 100644
--- a/bj_power_mes/internal/handler/routes_production.go
+++ b/bj_power_mes/internal/handler/routes_production.go
@@ -99,6 +99,9 @@ func RegisterProductionRoutes(server *rest.Server, serverCtx *svc.ServiceContext
server.AddRoute(rest.Route{
Method: http.MethodGet, Path: "/api/internal/dock/pallet", Handler: internal(production.DockPalletInternalHandler(serverCtx)),
})
+ server.AddRoute(rest.Route{
+ Method: http.MethodGet, Path: "/api/internal/docks", Handler: internal(production.ListDocksInternalHandler(serverCtx)),
+ })
server.AddRoute(rest.Route{
Method: http.MethodGet, Path: "/api/internal/workpiece/bind-panel", Handler: internal(production.BindPanelInternalHandler(serverCtx)),
})
@@ -181,6 +184,7 @@ func RegisterProductionRoutes(server *rest.Server, serverCtx *svc.ServiceContext
{Method: http.MethodGet, Path: "/qty-reports/stats", Handler: QtyReportStatsHandler(serverCtx)},
{Method: http.MethodPost, Path: "/qty-reports/handle", Handler: HandleQtyReportHandler(serverCtx)},
{Method: http.MethodGet, Path: "/docks", Handler: production.ListDocksHandler(serverCtx)},
+ {Method: http.MethodGet, Path: "/docks/maint", Handler: production.ListDocksMaintHandler(serverCtx)},
{Method: http.MethodPost, Path: "/plc/send-process", Handler: production.PlcSendProcessHandler(serverCtx)},
{Method: http.MethodGet, Path: "/plc/send-logs", Handler: production.PlcSendLogsHandler(serverCtx)},
diff --git a/bj_power_mes/internal/logic/seed.go b/bj_power_mes/internal/logic/seed.go
index 9e351aa..4ceedcd 100644
--- a/bj_power_mes/internal/logic/seed.go
+++ b/bj_power_mes/internal/logic/seed.go
@@ -80,6 +80,7 @@ func (s *Service) Seed(ctx context.Context) error {
{"produce.torque", "鎷х揣鏌ヨ", "MENU", "/torque"},
{"produce.processflow", "宸ヨ壓娴佺▼", "MENU", "/process-flow"},
{"produce.station", "鍏宠仈宸ヤ綅", "MENU", "/station"}, {"produce.performance", "缁╂晥鎶ヨ〃", "MENU", "/performance"},
+ {"produce.dock", "鎺ラ┏鍙扮淮鎶", "MENU", "/dock"},
{"produce.scan", "鎵嬪姩鎶ュ伐", "MENU", "/scan"},
{"produce.trace", "宸ヤ欢杩芥函", "MENU", "/trace"},
{"produce.wip", "鍦ㄥ埗鍝", "MENU", "/wip"},
@@ -170,9 +171,39 @@ func (s *Service) Seed(ctx context.Context) error {
// 4. 鍒濆鍖栦骇绾垮伐浣嶏紙鍐呯疆鍙涓绘暟鎹級锛涘伐鑹烘祦绋/宸ュ簭姝ラ鐢辩敤鎴峰湪銆屽伐鑹烘祦绋嬨嶉〉鑷缓锛屼笉棰勭疆
seedStations(ctx, s)
+ // 5. 鎺ラ┏鍙颁富鏁版嵁锛堢湡婧愬湪 MES锛2026-09-21 鑷 WMS 杩佸叆锛夛紱绯荤粺棰勭疆鍙
+ seedDocks(ctx, s)
return nil
}
+// seedDocks 鎺ラ┏鍙颁富鏁版嵁锛欴OCK01~20(浜х嚎, DOCKn鈫斿伐浣峮) + DOCK21(搴撴埧鏀惰揣)銆
+// 绯荤粺棰勭疆鍙涓绘暟鎹紙涓嶆彁渚涘鍒犳敼锛夛紝涓庡伐浣嶇瀛愬悓婧愪竴娆℃у啓鍏ャ
+func seedDocks(ctx context.Context, s *Service) {
+ count, _ := s.ctx.EntClient.Dock.Query().Count(ctx)
+ if count > 0 {
+ return
+ }
+ for i := 1; i <= 20; i++ {
+ code := "DOCK" + pad2(i)
+ _, _ = s.ctx.EntClient.Dock.Create().
+ SetDockCode(code).
+ SetName("浜х嚎鎺ラ┏鍙 " + code + "锛堝伐浣" + strconv.Itoa(i) + "锛").
+ SetDockType("line").
+ SetStationNo(i).
+ SetHasPallet(false).
+ SetStatus("ENABLED").
+ Save(ctx)
+ }
+ _, _ = s.ctx.EntClient.Dock.Create().
+ SetDockCode("DOCK21").
+ SetName("搴撴埧鏀惰揣鎺ラ┏鍙").
+ SetDockType("store").
+ SetStationNo(0).
+ SetHasPallet(false).
+ SetStatus("ENABLED").
+ Save(ctx)
+}
+
func seedStations(ctx context.Context, s *Service) {
// 宸ヤ綅鏄骇绾垮浐瀹氱墿鐞嗗伐浣嶏紝涓寰嬨屽唴缃伐浣嶃嶏細闇杩 PLC銆佹寜宸ヤ綅鍙烽『搴忔祦杞佷笉鍙敼绫诲瀷銆佷笉鍙垹闄ゃ佷粎鍙敼鍚嶏紝
// 灞炵郴缁熷唴缃彧璇讳富鏁版嵁锛堝悓 WMS 鎺ラ┏鍙帮級锛屾晠鐢辩瀛愬垵濮嬪寲銆12 涓閰嶅伐浣嶏紙1~10 甯︽帴椹冲彴锛11/12 浜х嚎鏈鏃犳帴椹冲彴锛夛紱
diff --git a/bj_power_mes/internal/wmsclient/client.go b/bj_power_mes/internal/wmsclient/client.go
index 899c470..344cfb7 100644
--- a/bj_power_mes/internal/wmsclient/client.go
+++ b/bj_power_mes/internal/wmsclient/client.go
@@ -389,28 +389,6 @@ func (c *Client) MaterialTypes(ctx context.Context, codes []string) (map[string]
return body.Data.Types, nil
}
-// DockRow 鎺ラ┏鍙颁富鏁版嵁琛岋紙WMS dock 鐪熸簮锛
-type DockRow struct {
- DockCode string `json:"dockCode"`
- Name string `json:"name"`
- DockType string `json:"dockType"`
- StationNo int `json:"stationNo"`
- HasPallet bool `json:"hasPallet"`
- Status string `json:"status"`
-}
-
-// ListDocks 鎷夊彇 WMS 鎺ラ┏鍙颁富鏁版嵁鍒楄〃锛圡ES 宸ヤ綅缁存姢椤点岄佽揪鎺ラ┏鍙般嶄笅鎷夌湡婧愶級銆
-// WMS 涓嶅彲杈捐繑鍥 err锛岀敱璋冪敤鏂归檷绾т负鍐欐鍏滃簳銆
-func (c *Client) ListDocks(ctx context.Context) ([]DockRow, error) {
- var data struct {
- List []DockRow `json:"list"`
- }
- if err := c.get(ctx, "/api/internal/docks", &data); err != nil {
- return nil, err
- }
- return data.List, nil
-}
-
// BackflushItem 鍙嶅啿鍗曟潯鐗╂枡锛堝凡鍚崯鑰楃殑鍗曚欢娑堣 * 瀹屾垚浠舵暟锛
type BackflushItem struct {
MaterialCode string `json:"materialCode"`
diff --git a/bj_power_mes/public/index.html b/bj_power_mes/public/index.html
index 77229d5..b2222c3 100644
--- a/bj_power_mes/public/index.html
+++ b/bj_power_mes/public/index.html
@@ -6,8 +6,8 @@
MES 浜х嚎鎺у埗
-
-
+
+
diff --git a/bj_power_mes/schema/dock.go b/bj_power_mes/schema/dock.go
new file mode 100644
index 0000000..6c03293
--- /dev/null
+++ b/bj_power_mes/schema/dock.go
@@ -0,0 +1,46 @@
+package schema
+
+import (
+ "time"
+
+ "entgo.io/ent"
+ "entgo.io/ent/dialect/entsql"
+ "entgo.io/ent/schema"
+ "entgo.io/ent/schema/field"
+ "entgo.io/ent/schema/index"
+)
+
+// Dock 鎺ラ┏鍙颁富鏁版嵁锛欴OCK01~DOCK20锛堜骇绾匡紝DOCKn鈫斿伐浣峮锛+ DOCK21锛堝簱鎴挎敹璐э級銆
+// 鎺ラ┏鍙扮湡婧愬湪 MES锛堝伐浣嶇淮鎶ゃ丄GV 閫氳銆佹帓浜ф帹鑽愰兘鏌ユ湰琛級锛涗粨搴撲笉缁存姢鎺ラ┏鍙般
+// hasPallet 鏍囪璇ユ帴椹冲彴褰撳墠鏄惁鏈夋墭鐩橈細鏉ユ簮 PLC 鎵樼洏浼犳劅鍣 鎴 AGV 鍒颁綅/鍗歌揣鑷姩缁存姢銆
+type Dock struct {
+ ent.Schema
+}
+
+func (Dock) Annotations() []schema.Annotation {
+ return []schema.Annotation{entsql.Annotation{Table: "dock"}}
+}
+
+func (Dock) Fields() []ent.Field {
+ return []ent.Field{
+ field.String("dockCode").Unique().MaxLen(20).Comment("鎺ラ┏鍙扮紪鐮 DOCK01..21"),
+ field.String("name").Default("").MaxLen(64).Comment("鎺ラ┏鍙板悕绉"),
+ // type: line(浜х嚎) / store(搴撴埧) / other(鍏朵粬锛屽缂撳瓨鍖恒佺嚎杈规殏瀛樹綅)
+ field.String("dockType").Default("line").MaxLen(16).Comment("绫诲瀷 line浜х嚎/store搴撴埧/other鍏朵粬"),
+ // 鍏宠仈宸ヤ綅锛堜骇绾挎帴椹冲彴 DOCKn鈫斿伐浣峮锛1:1锛夛紱搴撴埧/鍏朵粬鎺ラ┏鍙颁笉鎸傚伐浣嶏紝涓 0
+ field.Int("stationNo").Default(0).Comment("鍏宠仈宸ヤ綅鍙(涓庡伐浣1:1锛岄潪浜х嚎涓0)"),
+ field.Bool("hasPallet").Default(false).Comment("褰撳墠鏄惁鏈夋墭鐩"),
+ // 鏈夋墭鐩樻椂鐨勫叧鑱斿嚭搴/浠诲姟锛堜究浜庢煡杩欎釜鎵樼洏鏄摢鎵规枡銆佽閫佸埌鍝級
+ field.String("palletRef").Default("").MaxLen(64).Optional().Comment("鎵樼洏鍏宠仈(鍑哄簱鍗曞彿/澶囨枡鍗曞彿)"),
+ // ENABLED / DISABLED
+ field.String("status").Default("ENABLED").MaxLen(20),
+ field.Time("createdAt").Default(time.Now).Immutable(),
+ }
+}
+
+func (Dock) Indexes() []ent.Index {
+ return []ent.Index{
+ index.Fields("dockCode").Unique(),
+ index.Fields("dockType"),
+ }
+}
diff --git a/bj_power_wms/ent/client.go b/bj_power_wms/ent/client.go
index 87f582f..d8f999d 100644
--- a/bj_power_wms/ent/client.go
+++ b/bj_power_wms/ent/client.go
@@ -13,7 +13,6 @@ import (
"bj_power_wms/ent/agvtask"
"bj_power_wms/ent/attachment"
- "bj_power_wms/ent/dock"
"bj_power_wms/ent/eventlog"
"bj_power_wms/ent/inbounddetail"
"bj_power_wms/ent/inboundorder"
@@ -49,8 +48,6 @@ type Client struct {
AgvTask *AgvTaskClient
// Attachment is the client for interacting with the Attachment builders.
Attachment *AttachmentClient
- // Dock is the client for interacting with the Dock builders.
- Dock *DockClient
// EventLog is the client for interacting with the EventLog builders.
EventLog *EventLogClient
// InboundDetail is the client for interacting with the InboundDetail builders.
@@ -104,7 +101,6 @@ func (c *Client) init() {
c.Schema = migrate.NewSchema(c.driver)
c.AgvTask = NewAgvTaskClient(c.config)
c.Attachment = NewAttachmentClient(c.config)
- c.Dock = NewDockClient(c.config)
c.EventLog = NewEventLogClient(c.config)
c.InboundDetail = NewInboundDetailClient(c.config)
c.InboundOrder = NewInboundOrderClient(c.config)
@@ -219,7 +215,6 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) {
config: cfg,
AgvTask: NewAgvTaskClient(cfg),
Attachment: NewAttachmentClient(cfg),
- Dock: NewDockClient(cfg),
EventLog: NewEventLogClient(cfg),
InboundDetail: NewInboundDetailClient(cfg),
InboundOrder: NewInboundOrderClient(cfg),
@@ -261,7 +256,6 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error)
config: cfg,
AgvTask: NewAgvTaskClient(cfg),
Attachment: NewAttachmentClient(cfg),
- Dock: NewDockClient(cfg),
EventLog: NewEventLogClient(cfg),
InboundDetail: NewInboundDetailClient(cfg),
InboundOrder: NewInboundOrderClient(cfg),
@@ -311,7 +305,7 @@ func (c *Client) Close() error {
// In order to add hooks to a specific client, call: `client.Node.Use(...)`.
func (c *Client) Use(hooks ...Hook) {
for _, n := range []interface{ Use(...Hook) }{
- c.AgvTask, c.Attachment, c.Dock, c.EventLog, c.InboundDetail, c.InboundOrder,
+ c.AgvTask, c.Attachment, c.EventLog, c.InboundDetail, c.InboundOrder,
c.InspectionRecord, c.Inventory, c.InventoryLock, c.Material, c.MaterialDemand,
c.OrderMaterialLedger, c.OutboundDetail, c.OutboundOrder, c.Permission,
c.ProducibleSnapshot, c.ReturnOrder, c.Role, c.SemiFinished, c.StocktakeItem,
@@ -325,7 +319,7 @@ func (c *Client) Use(hooks ...Hook) {
// In order to add interceptors to a specific client, call: `client.Node.Intercept(...)`.
func (c *Client) Intercept(interceptors ...Interceptor) {
for _, n := range []interface{ Intercept(...Interceptor) }{
- c.AgvTask, c.Attachment, c.Dock, c.EventLog, c.InboundDetail, c.InboundOrder,
+ c.AgvTask, c.Attachment, c.EventLog, c.InboundDetail, c.InboundOrder,
c.InspectionRecord, c.Inventory, c.InventoryLock, c.Material, c.MaterialDemand,
c.OrderMaterialLedger, c.OutboundDetail, c.OutboundOrder, c.Permission,
c.ProducibleSnapshot, c.ReturnOrder, c.Role, c.SemiFinished, c.StocktakeItem,
@@ -342,8 +336,6 @@ func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) {
return c.AgvTask.mutate(ctx, m)
case *AttachmentMutation:
return c.Attachment.mutate(ctx, m)
- case *DockMutation:
- return c.Dock.mutate(ctx, m)
case *EventLogMutation:
return c.EventLog.mutate(ctx, m)
case *InboundDetailMutation:
@@ -655,139 +647,6 @@ func (c *AttachmentClient) mutate(ctx context.Context, m *AttachmentMutation) (V
}
}
-// DockClient is a client for the Dock schema.
-type DockClient struct {
- config
-}
-
-// NewDockClient returns a client for the Dock from the given config.
-func NewDockClient(c config) *DockClient {
- return &DockClient{config: c}
-}
-
-// Use adds a list of mutation hooks to the hooks stack.
-// A call to `Use(f, g, h)` equals to `dock.Hooks(f(g(h())))`.
-func (c *DockClient) Use(hooks ...Hook) {
- c.hooks.Dock = append(c.hooks.Dock, hooks...)
-}
-
-// Intercept adds a list of query interceptors to the interceptors stack.
-// A call to `Intercept(f, g, h)` equals to `dock.Intercept(f(g(h())))`.
-func (c *DockClient) Intercept(interceptors ...Interceptor) {
- c.inters.Dock = append(c.inters.Dock, interceptors...)
-}
-
-// Create returns a builder for creating a Dock entity.
-func (c *DockClient) Create() *DockCreate {
- mutation := newDockMutation(c.config, OpCreate)
- return &DockCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}
-}
-
-// CreateBulk returns a builder for creating a bulk of Dock entities.
-func (c *DockClient) CreateBulk(builders ...*DockCreate) *DockCreateBulk {
- return &DockCreateBulk{config: c.config, builders: builders}
-}
-
-// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates
-// a builder and applies setFunc on it.
-func (c *DockClient) MapCreateBulk(slice any, setFunc func(*DockCreate, int)) *DockCreateBulk {
- rv := reflect.ValueOf(slice)
- if rv.Kind() != reflect.Slice {
- return &DockCreateBulk{err: fmt.Errorf("calling to DockClient.MapCreateBulk with wrong type %T, need slice", slice)}
- }
- builders := make([]*DockCreate, rv.Len())
- for i := 0; i < rv.Len(); i++ {
- builders[i] = c.Create()
- setFunc(builders[i], i)
- }
- return &DockCreateBulk{config: c.config, builders: builders}
-}
-
-// Update returns an update builder for Dock.
-func (c *DockClient) Update() *DockUpdate {
- mutation := newDockMutation(c.config, OpUpdate)
- return &DockUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation}
-}
-
-// UpdateOne returns an update builder for the given entity.
-func (c *DockClient) UpdateOne(_m *Dock) *DockUpdateOne {
- mutation := newDockMutation(c.config, OpUpdateOne, withDock(_m))
- return &DockUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
-}
-
-// UpdateOneID returns an update builder for the given id.
-func (c *DockClient) UpdateOneID(id int) *DockUpdateOne {
- mutation := newDockMutation(c.config, OpUpdateOne, withDockID(id))
- return &DockUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}
-}
-
-// Delete returns a delete builder for Dock.
-func (c *DockClient) Delete() *DockDelete {
- mutation := newDockMutation(c.config, OpDelete)
- return &DockDelete{config: c.config, hooks: c.Hooks(), mutation: mutation}
-}
-
-// DeleteOne returns a builder for deleting the given entity.
-func (c *DockClient) DeleteOne(_m *Dock) *DockDeleteOne {
- return c.DeleteOneID(_m.ID)
-}
-
-// DeleteOneID returns a builder for deleting the given entity by its id.
-func (c *DockClient) DeleteOneID(id int) *DockDeleteOne {
- builder := c.Delete().Where(dock.ID(id))
- builder.mutation.id = &id
- builder.mutation.op = OpDeleteOne
- return &DockDeleteOne{builder}
-}
-
-// Query returns a query builder for Dock.
-func (c *DockClient) Query() *DockQuery {
- return &DockQuery{
- config: c.config,
- ctx: &QueryContext{Type: TypeDock},
- inters: c.Interceptors(),
- }
-}
-
-// Get returns a Dock entity by its id.
-func (c *DockClient) Get(ctx context.Context, id int) (*Dock, error) {
- return c.Query().Where(dock.ID(id)).Only(ctx)
-}
-
-// GetX is like Get, but panics if an error occurs.
-func (c *DockClient) GetX(ctx context.Context, id int) *Dock {
- obj, err := c.Get(ctx, id)
- if err != nil {
- panic(err)
- }
- return obj
-}
-
-// Hooks returns the client hooks.
-func (c *DockClient) Hooks() []Hook {
- return c.hooks.Dock
-}
-
-// Interceptors returns the client interceptors.
-func (c *DockClient) Interceptors() []Interceptor {
- return c.inters.Dock
-}
-
-func (c *DockClient) mutate(ctx context.Context, m *DockMutation) (Value, error) {
- switch m.Op() {
- case OpCreate:
- return (&DockCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdate:
- return (&DockUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpUpdateOne:
- return (&DockUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx)
- case OpDelete, OpDeleteOne:
- return (&DockDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx)
- default:
- return nil, fmt.Errorf("ent: unknown Dock mutation op: %q", m.Op())
- }
-}
-
// EventLogClient is a client for the EventLog schema.
type EventLogClient struct {
config
@@ -3451,17 +3310,15 @@ func (c *ZoneClient) mutate(ctx context.Context, m *ZoneMutation) (Value, error)
// hooks and interceptors per client, for fast access.
type (
hooks struct {
- AgvTask, Attachment, Dock, EventLog, InboundDetail, InboundOrder,
- InspectionRecord, Inventory, InventoryLock, Material, MaterialDemand,
- OrderMaterialLedger, OutboundDetail, OutboundOrder, Permission,
- ProducibleSnapshot, ReturnOrder, Role, SemiFinished, StocktakeItem,
- StocktakeOrder, User, Zone []ent.Hook
+ AgvTask, Attachment, EventLog, InboundDetail, InboundOrder, InspectionRecord,
+ Inventory, InventoryLock, Material, MaterialDemand, OrderMaterialLedger,
+ OutboundDetail, OutboundOrder, Permission, ProducibleSnapshot, ReturnOrder,
+ Role, SemiFinished, StocktakeItem, StocktakeOrder, User, Zone []ent.Hook
}
inters struct {
- AgvTask, Attachment, Dock, EventLog, InboundDetail, InboundOrder,
- InspectionRecord, Inventory, InventoryLock, Material, MaterialDemand,
- OrderMaterialLedger, OutboundDetail, OutboundOrder, Permission,
- ProducibleSnapshot, ReturnOrder, Role, SemiFinished, StocktakeItem,
- StocktakeOrder, User, Zone []ent.Interceptor
+ AgvTask, Attachment, EventLog, InboundDetail, InboundOrder, InspectionRecord,
+ Inventory, InventoryLock, Material, MaterialDemand, OrderMaterialLedger,
+ OutboundDetail, OutboundOrder, Permission, ProducibleSnapshot, ReturnOrder,
+ Role, SemiFinished, StocktakeItem, StocktakeOrder, User, Zone []ent.Interceptor
}
)
diff --git a/bj_power_wms/ent/dock_create.go b/bj_power_wms/ent/dock_create.go
deleted file mode 100644
index ee09694..0000000
--- a/bj_power_wms/ent/dock_create.go
+++ /dev/null
@@ -1,997 +0,0 @@
-// Code generated by ent, DO NOT EDIT.
-
-package ent
-
-import (
- "bj_power_wms/ent/dock"
- "context"
- "errors"
- "fmt"
-
- "entgo.io/ent/dialect/sql"
- "entgo.io/ent/dialect/sql/sqlgraph"
- "entgo.io/ent/schema/field"
-)
-
-// DockCreate is the builder for creating a Dock entity.
-type DockCreate struct {
- config
- mutation *DockMutation
- hooks []Hook
- conflict []sql.ConflictOption
-}
-
-// SetDockCode sets the "dock_code" field.
-func (_c *DockCreate) SetDockCode(v string) *DockCreate {
- _c.mutation.SetDockCode(v)
- return _c
-}
-
-// SetName sets the "name" field.
-func (_c *DockCreate) SetName(v string) *DockCreate {
- _c.mutation.SetName(v)
- return _c
-}
-
-// SetNillableName sets the "name" field if the given value is not nil.
-func (_c *DockCreate) SetNillableName(v *string) *DockCreate {
- if v != nil {
- _c.SetName(*v)
- }
- return _c
-}
-
-// SetDockType sets the "dock_type" field.
-func (_c *DockCreate) SetDockType(v string) *DockCreate {
- _c.mutation.SetDockType(v)
- return _c
-}
-
-// SetNillableDockType sets the "dock_type" field if the given value is not nil.
-func (_c *DockCreate) SetNillableDockType(v *string) *DockCreate {
- if v != nil {
- _c.SetDockType(*v)
- }
- return _c
-}
-
-// SetStationNo sets the "station_no" field.
-func (_c *DockCreate) SetStationNo(v int) *DockCreate {
- _c.mutation.SetStationNo(v)
- return _c
-}
-
-// SetNillableStationNo sets the "station_no" field if the given value is not nil.
-func (_c *DockCreate) SetNillableStationNo(v *int) *DockCreate {
- if v != nil {
- _c.SetStationNo(*v)
- }
- return _c
-}
-
-// SetHasPallet sets the "has_pallet" field.
-func (_c *DockCreate) SetHasPallet(v bool) *DockCreate {
- _c.mutation.SetHasPallet(v)
- return _c
-}
-
-// SetNillableHasPallet sets the "has_pallet" field if the given value is not nil.
-func (_c *DockCreate) SetNillableHasPallet(v *bool) *DockCreate {
- if v != nil {
- _c.SetHasPallet(*v)
- }
- return _c
-}
-
-// SetPalletRef sets the "pallet_ref" field.
-func (_c *DockCreate) SetPalletRef(v string) *DockCreate {
- _c.mutation.SetPalletRef(v)
- return _c
-}
-
-// SetNillablePalletRef sets the "pallet_ref" field if the given value is not nil.
-func (_c *DockCreate) SetNillablePalletRef(v *string) *DockCreate {
- if v != nil {
- _c.SetPalletRef(*v)
- }
- return _c
-}
-
-// SetStatus sets the "status" field.
-func (_c *DockCreate) SetStatus(v string) *DockCreate {
- _c.mutation.SetStatus(v)
- return _c
-}
-
-// SetNillableStatus sets the "status" field if the given value is not nil.
-func (_c *DockCreate) SetNillableStatus(v *string) *DockCreate {
- if v != nil {
- _c.SetStatus(*v)
- }
- return _c
-}
-
-// SetCreatedAt sets the "created_at" field.
-func (_c *DockCreate) SetCreatedAt(v int64) *DockCreate {
- _c.mutation.SetCreatedAt(v)
- return _c
-}
-
-// SetNillableCreatedAt sets the "created_at" field if the given value is not nil.
-func (_c *DockCreate) SetNillableCreatedAt(v *int64) *DockCreate {
- if v != nil {
- _c.SetCreatedAt(*v)
- }
- return _c
-}
-
-// Mutation returns the DockMutation object of the builder.
-func (_c *DockCreate) Mutation() *DockMutation {
- return _c.mutation
-}
-
-// Save creates the Dock in the database.
-func (_c *DockCreate) Save(ctx context.Context) (*Dock, error) {
- _c.defaults()
- return withHooks(ctx, _c.sqlSave, _c.mutation, _c.hooks)
-}
-
-// SaveX calls Save and panics if Save returns an error.
-func (_c *DockCreate) SaveX(ctx context.Context) *Dock {
- v, err := _c.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
-}
-
-// Exec executes the query.
-func (_c *DockCreate) Exec(ctx context.Context) error {
- _, err := _c.Save(ctx)
- return err
-}
-
-// ExecX is like Exec, but panics if an error occurs.
-func (_c *DockCreate) ExecX(ctx context.Context) {
- if err := _c.Exec(ctx); err != nil {
- panic(err)
- }
-}
-
-// defaults sets the default values of the builder before save.
-func (_c *DockCreate) defaults() {
- if _, ok := _c.mutation.Name(); !ok {
- v := dock.DefaultName
- _c.mutation.SetName(v)
- }
- if _, ok := _c.mutation.DockType(); !ok {
- v := dock.DefaultDockType
- _c.mutation.SetDockType(v)
- }
- if _, ok := _c.mutation.StationNo(); !ok {
- v := dock.DefaultStationNo
- _c.mutation.SetStationNo(v)
- }
- if _, ok := _c.mutation.HasPallet(); !ok {
- v := dock.DefaultHasPallet
- _c.mutation.SetHasPallet(v)
- }
- if _, ok := _c.mutation.PalletRef(); !ok {
- v := dock.DefaultPalletRef
- _c.mutation.SetPalletRef(v)
- }
- if _, ok := _c.mutation.Status(); !ok {
- v := dock.DefaultStatus
- _c.mutation.SetStatus(v)
- }
- if _, ok := _c.mutation.CreatedAt(); !ok {
- v := dock.DefaultCreatedAt()
- _c.mutation.SetCreatedAt(v)
- }
-}
-
-// check runs all checks and user-defined validators on the builder.
-func (_c *DockCreate) check() error {
- if _, ok := _c.mutation.DockCode(); !ok {
- return &ValidationError{Name: "dock_code", err: errors.New(`ent: missing required field "Dock.dock_code"`)}
- }
- if v, ok := _c.mutation.DockCode(); ok {
- if err := dock.DockCodeValidator(v); err != nil {
- return &ValidationError{Name: "dock_code", err: fmt.Errorf(`ent: validator failed for field "Dock.dock_code": %w`, err)}
- }
- }
- if _, ok := _c.mutation.Name(); !ok {
- return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "Dock.name"`)}
- }
- if v, ok := _c.mutation.Name(); ok {
- if err := dock.NameValidator(v); err != nil {
- return &ValidationError{Name: "name", err: fmt.Errorf(`ent: validator failed for field "Dock.name": %w`, err)}
- }
- }
- if _, ok := _c.mutation.DockType(); !ok {
- return &ValidationError{Name: "dock_type", err: errors.New(`ent: missing required field "Dock.dock_type"`)}
- }
- if v, ok := _c.mutation.DockType(); ok {
- if err := dock.DockTypeValidator(v); err != nil {
- return &ValidationError{Name: "dock_type", err: fmt.Errorf(`ent: validator failed for field "Dock.dock_type": %w`, err)}
- }
- }
- if _, ok := _c.mutation.StationNo(); !ok {
- return &ValidationError{Name: "station_no", err: errors.New(`ent: missing required field "Dock.station_no"`)}
- }
- if _, ok := _c.mutation.HasPallet(); !ok {
- return &ValidationError{Name: "has_pallet", err: errors.New(`ent: missing required field "Dock.has_pallet"`)}
- }
- if v, ok := _c.mutation.PalletRef(); ok {
- if err := dock.PalletRefValidator(v); err != nil {
- return &ValidationError{Name: "pallet_ref", err: fmt.Errorf(`ent: validator failed for field "Dock.pallet_ref": %w`, err)}
- }
- }
- if _, ok := _c.mutation.Status(); !ok {
- return &ValidationError{Name: "status", err: errors.New(`ent: missing required field "Dock.status"`)}
- }
- if v, ok := _c.mutation.Status(); ok {
- if err := dock.StatusValidator(v); err != nil {
- return &ValidationError{Name: "status", err: fmt.Errorf(`ent: validator failed for field "Dock.status": %w`, err)}
- }
- }
- if _, ok := _c.mutation.CreatedAt(); !ok {
- return &ValidationError{Name: "created_at", err: errors.New(`ent: missing required field "Dock.created_at"`)}
- }
- return nil
-}
-
-func (_c *DockCreate) sqlSave(ctx context.Context) (*Dock, error) {
- if err := _c.check(); err != nil {
- return nil, err
- }
- _node, _spec := _c.createSpec()
- if err := sqlgraph.CreateNode(ctx, _c.driver, _spec); err != nil {
- if sqlgraph.IsConstraintError(err) {
- err = &ConstraintError{msg: err.Error(), wrap: err}
- }
- return nil, err
- }
- id := _spec.ID.Value.(int64)
- _node.ID = int(id)
- _c.mutation.id = &_node.ID
- _c.mutation.done = true
- return _node, nil
-}
-
-func (_c *DockCreate) createSpec() (*Dock, *sqlgraph.CreateSpec) {
- var (
- _node = &Dock{config: _c.config}
- _spec = sqlgraph.NewCreateSpec(dock.Table, sqlgraph.NewFieldSpec(dock.FieldID, field.TypeInt))
- )
- _spec.OnConflict = _c.conflict
- if value, ok := _c.mutation.DockCode(); ok {
- _spec.SetField(dock.FieldDockCode, field.TypeString, value)
- _node.DockCode = value
- }
- if value, ok := _c.mutation.Name(); ok {
- _spec.SetField(dock.FieldName, field.TypeString, value)
- _node.Name = value
- }
- if value, ok := _c.mutation.DockType(); ok {
- _spec.SetField(dock.FieldDockType, field.TypeString, value)
- _node.DockType = value
- }
- if value, ok := _c.mutation.StationNo(); ok {
- _spec.SetField(dock.FieldStationNo, field.TypeInt, value)
- _node.StationNo = value
- }
- if value, ok := _c.mutation.HasPallet(); ok {
- _spec.SetField(dock.FieldHasPallet, field.TypeBool, value)
- _node.HasPallet = value
- }
- if value, ok := _c.mutation.PalletRef(); ok {
- _spec.SetField(dock.FieldPalletRef, field.TypeString, value)
- _node.PalletRef = value
- }
- if value, ok := _c.mutation.Status(); ok {
- _spec.SetField(dock.FieldStatus, field.TypeString, value)
- _node.Status = value
- }
- if value, ok := _c.mutation.CreatedAt(); ok {
- _spec.SetField(dock.FieldCreatedAt, field.TypeInt64, value)
- _node.CreatedAt = value
- }
- return _node, _spec
-}
-
-// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
-// of the `INSERT` statement. For example:
-//
-// client.Dock.Create().
-// SetDockCode(v).
-// OnConflict(
-// // Update the row with the new values
-// // the was proposed for insertion.
-// sql.ResolveWithNewValues(),
-// ).
-// // Override some of the fields with custom
-// // update values.
-// Update(func(u *ent.DockUpsert) {
-// SetDockCode(v+v).
-// }).
-// Exec(ctx)
-func (_c *DockCreate) OnConflict(opts ...sql.ConflictOption) *DockUpsertOne {
- _c.conflict = opts
- return &DockUpsertOne{
- create: _c,
- }
-}
-
-// OnConflictColumns calls `OnConflict` and configures the columns
-// as conflict target. Using this option is equivalent to using:
-//
-// client.Dock.Create().
-// OnConflict(sql.ConflictColumns(columns...)).
-// Exec(ctx)
-func (_c *DockCreate) OnConflictColumns(columns ...string) *DockUpsertOne {
- _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
- return &DockUpsertOne{
- create: _c,
- }
-}
-
-type (
- // DockUpsertOne is the builder for "upsert"-ing
- // one Dock node.
- DockUpsertOne struct {
- create *DockCreate
- }
-
- // DockUpsert is the "OnConflict" setter.
- DockUpsert struct {
- *sql.UpdateSet
- }
-)
-
-// SetDockCode sets the "dock_code" field.
-func (u *DockUpsert) SetDockCode(v string) *DockUpsert {
- u.Set(dock.FieldDockCode, v)
- return u
-}
-
-// UpdateDockCode sets the "dock_code" field to the value that was provided on create.
-func (u *DockUpsert) UpdateDockCode() *DockUpsert {
- u.SetExcluded(dock.FieldDockCode)
- return u
-}
-
-// SetName sets the "name" field.
-func (u *DockUpsert) SetName(v string) *DockUpsert {
- u.Set(dock.FieldName, v)
- return u
-}
-
-// UpdateName sets the "name" field to the value that was provided on create.
-func (u *DockUpsert) UpdateName() *DockUpsert {
- u.SetExcluded(dock.FieldName)
- return u
-}
-
-// SetDockType sets the "dock_type" field.
-func (u *DockUpsert) SetDockType(v string) *DockUpsert {
- u.Set(dock.FieldDockType, v)
- return u
-}
-
-// UpdateDockType sets the "dock_type" field to the value that was provided on create.
-func (u *DockUpsert) UpdateDockType() *DockUpsert {
- u.SetExcluded(dock.FieldDockType)
- return u
-}
-
-// SetStationNo sets the "station_no" field.
-func (u *DockUpsert) SetStationNo(v int) *DockUpsert {
- u.Set(dock.FieldStationNo, v)
- return u
-}
-
-// UpdateStationNo sets the "station_no" field to the value that was provided on create.
-func (u *DockUpsert) UpdateStationNo() *DockUpsert {
- u.SetExcluded(dock.FieldStationNo)
- return u
-}
-
-// AddStationNo adds v to the "station_no" field.
-func (u *DockUpsert) AddStationNo(v int) *DockUpsert {
- u.Add(dock.FieldStationNo, v)
- return u
-}
-
-// SetHasPallet sets the "has_pallet" field.
-func (u *DockUpsert) SetHasPallet(v bool) *DockUpsert {
- u.Set(dock.FieldHasPallet, v)
- return u
-}
-
-// UpdateHasPallet sets the "has_pallet" field to the value that was provided on create.
-func (u *DockUpsert) UpdateHasPallet() *DockUpsert {
- u.SetExcluded(dock.FieldHasPallet)
- return u
-}
-
-// SetPalletRef sets the "pallet_ref" field.
-func (u *DockUpsert) SetPalletRef(v string) *DockUpsert {
- u.Set(dock.FieldPalletRef, v)
- return u
-}
-
-// UpdatePalletRef sets the "pallet_ref" field to the value that was provided on create.
-func (u *DockUpsert) UpdatePalletRef() *DockUpsert {
- u.SetExcluded(dock.FieldPalletRef)
- return u
-}
-
-// ClearPalletRef clears the value of the "pallet_ref" field.
-func (u *DockUpsert) ClearPalletRef() *DockUpsert {
- u.SetNull(dock.FieldPalletRef)
- return u
-}
-
-// SetStatus sets the "status" field.
-func (u *DockUpsert) SetStatus(v string) *DockUpsert {
- u.Set(dock.FieldStatus, v)
- return u
-}
-
-// UpdateStatus sets the "status" field to the value that was provided on create.
-func (u *DockUpsert) UpdateStatus() *DockUpsert {
- u.SetExcluded(dock.FieldStatus)
- return u
-}
-
-// SetCreatedAt sets the "created_at" field.
-func (u *DockUpsert) SetCreatedAt(v int64) *DockUpsert {
- u.Set(dock.FieldCreatedAt, v)
- return u
-}
-
-// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
-func (u *DockUpsert) UpdateCreatedAt() *DockUpsert {
- u.SetExcluded(dock.FieldCreatedAt)
- return u
-}
-
-// AddCreatedAt adds v to the "created_at" field.
-func (u *DockUpsert) AddCreatedAt(v int64) *DockUpsert {
- u.Add(dock.FieldCreatedAt, v)
- return u
-}
-
-// UpdateNewValues updates the mutable fields using the new values that were set on create.
-// Using this option is equivalent to using:
-//
-// client.Dock.Create().
-// OnConflict(
-// sql.ResolveWithNewValues(),
-// ).
-// Exec(ctx)
-func (u *DockUpsertOne) UpdateNewValues() *DockUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
- return u
-}
-
-// Ignore sets each column to itself in case of conflict.
-// Using this option is equivalent to using:
-//
-// client.Dock.Create().
-// OnConflict(sql.ResolveWithIgnore()).
-// Exec(ctx)
-func (u *DockUpsertOne) Ignore() *DockUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
- return u
-}
-
-// DoNothing configures the conflict_action to `DO NOTHING`.
-// Supported only by SQLite and PostgreSQL.
-func (u *DockUpsertOne) DoNothing() *DockUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
-}
-
-// Update allows overriding fields `UPDATE` values. See the DockCreate.OnConflict
-// documentation for more info.
-func (u *DockUpsertOne) Update(set func(*DockUpsert)) *DockUpsertOne {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&DockUpsert{UpdateSet: update})
- }))
- return u
-}
-
-// SetDockCode sets the "dock_code" field.
-func (u *DockUpsertOne) SetDockCode(v string) *DockUpsertOne {
- return u.Update(func(s *DockUpsert) {
- s.SetDockCode(v)
- })
-}
-
-// UpdateDockCode sets the "dock_code" field to the value that was provided on create.
-func (u *DockUpsertOne) UpdateDockCode() *DockUpsertOne {
- return u.Update(func(s *DockUpsert) {
- s.UpdateDockCode()
- })
-}
-
-// SetName sets the "name" field.
-func (u *DockUpsertOne) SetName(v string) *DockUpsertOne {
- return u.Update(func(s *DockUpsert) {
- s.SetName(v)
- })
-}
-
-// UpdateName sets the "name" field to the value that was provided on create.
-func (u *DockUpsertOne) UpdateName() *DockUpsertOne {
- return u.Update(func(s *DockUpsert) {
- s.UpdateName()
- })
-}
-
-// SetDockType sets the "dock_type" field.
-func (u *DockUpsertOne) SetDockType(v string) *DockUpsertOne {
- return u.Update(func(s *DockUpsert) {
- s.SetDockType(v)
- })
-}
-
-// UpdateDockType sets the "dock_type" field to the value that was provided on create.
-func (u *DockUpsertOne) UpdateDockType() *DockUpsertOne {
- return u.Update(func(s *DockUpsert) {
- s.UpdateDockType()
- })
-}
-
-// SetStationNo sets the "station_no" field.
-func (u *DockUpsertOne) SetStationNo(v int) *DockUpsertOne {
- return u.Update(func(s *DockUpsert) {
- s.SetStationNo(v)
- })
-}
-
-// AddStationNo adds v to the "station_no" field.
-func (u *DockUpsertOne) AddStationNo(v int) *DockUpsertOne {
- return u.Update(func(s *DockUpsert) {
- s.AddStationNo(v)
- })
-}
-
-// UpdateStationNo sets the "station_no" field to the value that was provided on create.
-func (u *DockUpsertOne) UpdateStationNo() *DockUpsertOne {
- return u.Update(func(s *DockUpsert) {
- s.UpdateStationNo()
- })
-}
-
-// SetHasPallet sets the "has_pallet" field.
-func (u *DockUpsertOne) SetHasPallet(v bool) *DockUpsertOne {
- return u.Update(func(s *DockUpsert) {
- s.SetHasPallet(v)
- })
-}
-
-// UpdateHasPallet sets the "has_pallet" field to the value that was provided on create.
-func (u *DockUpsertOne) UpdateHasPallet() *DockUpsertOne {
- return u.Update(func(s *DockUpsert) {
- s.UpdateHasPallet()
- })
-}
-
-// SetPalletRef sets the "pallet_ref" field.
-func (u *DockUpsertOne) SetPalletRef(v string) *DockUpsertOne {
- return u.Update(func(s *DockUpsert) {
- s.SetPalletRef(v)
- })
-}
-
-// UpdatePalletRef sets the "pallet_ref" field to the value that was provided on create.
-func (u *DockUpsertOne) UpdatePalletRef() *DockUpsertOne {
- return u.Update(func(s *DockUpsert) {
- s.UpdatePalletRef()
- })
-}
-
-// ClearPalletRef clears the value of the "pallet_ref" field.
-func (u *DockUpsertOne) ClearPalletRef() *DockUpsertOne {
- return u.Update(func(s *DockUpsert) {
- s.ClearPalletRef()
- })
-}
-
-// SetStatus sets the "status" field.
-func (u *DockUpsertOne) SetStatus(v string) *DockUpsertOne {
- return u.Update(func(s *DockUpsert) {
- s.SetStatus(v)
- })
-}
-
-// UpdateStatus sets the "status" field to the value that was provided on create.
-func (u *DockUpsertOne) UpdateStatus() *DockUpsertOne {
- return u.Update(func(s *DockUpsert) {
- s.UpdateStatus()
- })
-}
-
-// SetCreatedAt sets the "created_at" field.
-func (u *DockUpsertOne) SetCreatedAt(v int64) *DockUpsertOne {
- return u.Update(func(s *DockUpsert) {
- s.SetCreatedAt(v)
- })
-}
-
-// AddCreatedAt adds v to the "created_at" field.
-func (u *DockUpsertOne) AddCreatedAt(v int64) *DockUpsertOne {
- return u.Update(func(s *DockUpsert) {
- s.AddCreatedAt(v)
- })
-}
-
-// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
-func (u *DockUpsertOne) UpdateCreatedAt() *DockUpsertOne {
- return u.Update(func(s *DockUpsert) {
- s.UpdateCreatedAt()
- })
-}
-
-// Exec executes the query.
-func (u *DockUpsertOne) Exec(ctx context.Context) error {
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for DockCreate.OnConflict")
- }
- return u.create.Exec(ctx)
-}
-
-// ExecX is like Exec, but panics if an error occurs.
-func (u *DockUpsertOne) ExecX(ctx context.Context) {
- if err := u.create.Exec(ctx); err != nil {
- panic(err)
- }
-}
-
-// Exec executes the UPSERT query and returns the inserted/updated ID.
-func (u *DockUpsertOne) ID(ctx context.Context) (id int, err error) {
- node, err := u.create.Save(ctx)
- if err != nil {
- return id, err
- }
- return node.ID, nil
-}
-
-// IDX is like ID, but panics if an error occurs.
-func (u *DockUpsertOne) IDX(ctx context.Context) int {
- id, err := u.ID(ctx)
- if err != nil {
- panic(err)
- }
- return id
-}
-
-// DockCreateBulk is the builder for creating many Dock entities in bulk.
-type DockCreateBulk struct {
- config
- err error
- builders []*DockCreate
- conflict []sql.ConflictOption
-}
-
-// Save creates the Dock entities in the database.
-func (_c *DockCreateBulk) Save(ctx context.Context) ([]*Dock, error) {
- if _c.err != nil {
- return nil, _c.err
- }
- specs := make([]*sqlgraph.CreateSpec, len(_c.builders))
- nodes := make([]*Dock, len(_c.builders))
- mutators := make([]Mutator, len(_c.builders))
- for i := range _c.builders {
- func(i int, root context.Context) {
- builder := _c.builders[i]
- builder.defaults()
- var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {
- mutation, ok := m.(*DockMutation)
- if !ok {
- return nil, fmt.Errorf("unexpected mutation type %T", m)
- }
- if err := builder.check(); err != nil {
- return nil, err
- }
- builder.mutation = mutation
- var err error
- nodes[i], specs[i] = builder.createSpec()
- if i < len(mutators)-1 {
- _, err = mutators[i+1].Mutate(root, _c.builders[i+1].mutation)
- } else {
- spec := &sqlgraph.BatchCreateSpec{Nodes: specs}
- spec.OnConflict = _c.conflict
- // Invoke the actual operation on the latest mutation in the chain.
- if err = sqlgraph.BatchCreate(ctx, _c.driver, spec); err != nil {
- if sqlgraph.IsConstraintError(err) {
- err = &ConstraintError{msg: err.Error(), wrap: err}
- }
- }
- }
- if err != nil {
- return nil, err
- }
- mutation.id = &nodes[i].ID
- if specs[i].ID.Value != nil {
- id := specs[i].ID.Value.(int64)
- nodes[i].ID = int(id)
- }
- mutation.done = true
- return nodes[i], nil
- })
- for i := len(builder.hooks) - 1; i >= 0; i-- {
- mut = builder.hooks[i](mut)
- }
- mutators[i] = mut
- }(i, ctx)
- }
- if len(mutators) > 0 {
- if _, err := mutators[0].Mutate(ctx, _c.builders[0].mutation); err != nil {
- return nil, err
- }
- }
- return nodes, nil
-}
-
-// SaveX is like Save, but panics if an error occurs.
-func (_c *DockCreateBulk) SaveX(ctx context.Context) []*Dock {
- v, err := _c.Save(ctx)
- if err != nil {
- panic(err)
- }
- return v
-}
-
-// Exec executes the query.
-func (_c *DockCreateBulk) Exec(ctx context.Context) error {
- _, err := _c.Save(ctx)
- return err
-}
-
-// ExecX is like Exec, but panics if an error occurs.
-func (_c *DockCreateBulk) ExecX(ctx context.Context) {
- if err := _c.Exec(ctx); err != nil {
- panic(err)
- }
-}
-
-// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause
-// of the `INSERT` statement. For example:
-//
-// client.Dock.CreateBulk(builders...).
-// OnConflict(
-// // Update the row with the new values
-// // the was proposed for insertion.
-// sql.ResolveWithNewValues(),
-// ).
-// // Override some of the fields with custom
-// // update values.
-// Update(func(u *ent.DockUpsert) {
-// SetDockCode(v+v).
-// }).
-// Exec(ctx)
-func (_c *DockCreateBulk) OnConflict(opts ...sql.ConflictOption) *DockUpsertBulk {
- _c.conflict = opts
- return &DockUpsertBulk{
- create: _c,
- }
-}
-
-// OnConflictColumns calls `OnConflict` and configures the columns
-// as conflict target. Using this option is equivalent to using:
-//
-// client.Dock.Create().
-// OnConflict(sql.ConflictColumns(columns...)).
-// Exec(ctx)
-func (_c *DockCreateBulk) OnConflictColumns(columns ...string) *DockUpsertBulk {
- _c.conflict = append(_c.conflict, sql.ConflictColumns(columns...))
- return &DockUpsertBulk{
- create: _c,
- }
-}
-
-// DockUpsertBulk is the builder for "upsert"-ing
-// a bulk of Dock nodes.
-type DockUpsertBulk struct {
- create *DockCreateBulk
-}
-
-// UpdateNewValues updates the mutable fields using the new values that
-// were set on create. Using this option is equivalent to using:
-//
-// client.Dock.Create().
-// OnConflict(
-// sql.ResolveWithNewValues(),
-// ).
-// Exec(ctx)
-func (u *DockUpsertBulk) UpdateNewValues() *DockUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues())
- return u
-}
-
-// Ignore sets each column to itself in case of conflict.
-// Using this option is equivalent to using:
-//
-// client.Dock.Create().
-// OnConflict(sql.ResolveWithIgnore()).
-// Exec(ctx)
-func (u *DockUpsertBulk) Ignore() *DockUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore())
- return u
-}
-
-// DoNothing configures the conflict_action to `DO NOTHING`.
-// Supported only by SQLite and PostgreSQL.
-func (u *DockUpsertBulk) DoNothing() *DockUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.DoNothing())
- return u
-}
-
-// Update allows overriding fields `UPDATE` values. See the DockCreateBulk.OnConflict
-// documentation for more info.
-func (u *DockUpsertBulk) Update(set func(*DockUpsert)) *DockUpsertBulk {
- u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) {
- set(&DockUpsert{UpdateSet: update})
- }))
- return u
-}
-
-// SetDockCode sets the "dock_code" field.
-func (u *DockUpsertBulk) SetDockCode(v string) *DockUpsertBulk {
- return u.Update(func(s *DockUpsert) {
- s.SetDockCode(v)
- })
-}
-
-// UpdateDockCode sets the "dock_code" field to the value that was provided on create.
-func (u *DockUpsertBulk) UpdateDockCode() *DockUpsertBulk {
- return u.Update(func(s *DockUpsert) {
- s.UpdateDockCode()
- })
-}
-
-// SetName sets the "name" field.
-func (u *DockUpsertBulk) SetName(v string) *DockUpsertBulk {
- return u.Update(func(s *DockUpsert) {
- s.SetName(v)
- })
-}
-
-// UpdateName sets the "name" field to the value that was provided on create.
-func (u *DockUpsertBulk) UpdateName() *DockUpsertBulk {
- return u.Update(func(s *DockUpsert) {
- s.UpdateName()
- })
-}
-
-// SetDockType sets the "dock_type" field.
-func (u *DockUpsertBulk) SetDockType(v string) *DockUpsertBulk {
- return u.Update(func(s *DockUpsert) {
- s.SetDockType(v)
- })
-}
-
-// UpdateDockType sets the "dock_type" field to the value that was provided on create.
-func (u *DockUpsertBulk) UpdateDockType() *DockUpsertBulk {
- return u.Update(func(s *DockUpsert) {
- s.UpdateDockType()
- })
-}
-
-// SetStationNo sets the "station_no" field.
-func (u *DockUpsertBulk) SetStationNo(v int) *DockUpsertBulk {
- return u.Update(func(s *DockUpsert) {
- s.SetStationNo(v)
- })
-}
-
-// AddStationNo adds v to the "station_no" field.
-func (u *DockUpsertBulk) AddStationNo(v int) *DockUpsertBulk {
- return u.Update(func(s *DockUpsert) {
- s.AddStationNo(v)
- })
-}
-
-// UpdateStationNo sets the "station_no" field to the value that was provided on create.
-func (u *DockUpsertBulk) UpdateStationNo() *DockUpsertBulk {
- return u.Update(func(s *DockUpsert) {
- s.UpdateStationNo()
- })
-}
-
-// SetHasPallet sets the "has_pallet" field.
-func (u *DockUpsertBulk) SetHasPallet(v bool) *DockUpsertBulk {
- return u.Update(func(s *DockUpsert) {
- s.SetHasPallet(v)
- })
-}
-
-// UpdateHasPallet sets the "has_pallet" field to the value that was provided on create.
-func (u *DockUpsertBulk) UpdateHasPallet() *DockUpsertBulk {
- return u.Update(func(s *DockUpsert) {
- s.UpdateHasPallet()
- })
-}
-
-// SetPalletRef sets the "pallet_ref" field.
-func (u *DockUpsertBulk) SetPalletRef(v string) *DockUpsertBulk {
- return u.Update(func(s *DockUpsert) {
- s.SetPalletRef(v)
- })
-}
-
-// UpdatePalletRef sets the "pallet_ref" field to the value that was provided on create.
-func (u *DockUpsertBulk) UpdatePalletRef() *DockUpsertBulk {
- return u.Update(func(s *DockUpsert) {
- s.UpdatePalletRef()
- })
-}
-
-// ClearPalletRef clears the value of the "pallet_ref" field.
-func (u *DockUpsertBulk) ClearPalletRef() *DockUpsertBulk {
- return u.Update(func(s *DockUpsert) {
- s.ClearPalletRef()
- })
-}
-
-// SetStatus sets the "status" field.
-func (u *DockUpsertBulk) SetStatus(v string) *DockUpsertBulk {
- return u.Update(func(s *DockUpsert) {
- s.SetStatus(v)
- })
-}
-
-// UpdateStatus sets the "status" field to the value that was provided on create.
-func (u *DockUpsertBulk) UpdateStatus() *DockUpsertBulk {
- return u.Update(func(s *DockUpsert) {
- s.UpdateStatus()
- })
-}
-
-// SetCreatedAt sets the "created_at" field.
-func (u *DockUpsertBulk) SetCreatedAt(v int64) *DockUpsertBulk {
- return u.Update(func(s *DockUpsert) {
- s.SetCreatedAt(v)
- })
-}
-
-// AddCreatedAt adds v to the "created_at" field.
-func (u *DockUpsertBulk) AddCreatedAt(v int64) *DockUpsertBulk {
- return u.Update(func(s *DockUpsert) {
- s.AddCreatedAt(v)
- })
-}
-
-// UpdateCreatedAt sets the "created_at" field to the value that was provided on create.
-func (u *DockUpsertBulk) UpdateCreatedAt() *DockUpsertBulk {
- return u.Update(func(s *DockUpsert) {
- s.UpdateCreatedAt()
- })
-}
-
-// Exec executes the query.
-func (u *DockUpsertBulk) Exec(ctx context.Context) error {
- if u.create.err != nil {
- return u.create.err
- }
- for i, b := range u.create.builders {
- if len(b.conflict) != 0 {
- return fmt.Errorf("ent: OnConflict was set for builder %d. Set it on the DockCreateBulk instead", i)
- }
- }
- if len(u.create.conflict) == 0 {
- return errors.New("ent: missing options for DockCreateBulk.OnConflict")
- }
- return u.create.Exec(ctx)
-}
-
-// ExecX is like Exec, but panics if an error occurs.
-func (u *DockUpsertBulk) ExecX(ctx context.Context) {
- if err := u.create.Exec(ctx); err != nil {
- panic(err)
- }
-}
diff --git a/bj_power_wms/ent/ent.go b/bj_power_wms/ent/ent.go
index 56806e3..1e72ce4 100644
--- a/bj_power_wms/ent/ent.go
+++ b/bj_power_wms/ent/ent.go
@@ -5,7 +5,6 @@ package ent
import (
"bj_power_wms/ent/agvtask"
"bj_power_wms/ent/attachment"
- "bj_power_wms/ent/dock"
"bj_power_wms/ent/eventlog"
"bj_power_wms/ent/inbounddetail"
"bj_power_wms/ent/inboundorder"
@@ -97,7 +96,6 @@ func checkColumn(t, c string) error {
columnCheck = sql.NewColumnCheck(map[string]func(string) bool{
agvtask.Table: agvtask.ValidColumn,
attachment.Table: attachment.ValidColumn,
- dock.Table: dock.ValidColumn,
eventlog.Table: eventlog.ValidColumn,
inbounddetail.Table: inbounddetail.ValidColumn,
inboundorder.Table: inboundorder.ValidColumn,
diff --git a/bj_power_wms/ent/hook/hook.go b/bj_power_wms/ent/hook/hook.go
index 73936fe..5440088 100644
--- a/bj_power_wms/ent/hook/hook.go
+++ b/bj_power_wms/ent/hook/hook.go
@@ -32,18 +32,6 @@ func (f AttachmentFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value,
return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.AttachmentMutation", m)
}
-// The DockFunc type is an adapter to allow the use of ordinary
-// function as Dock mutator.
-type DockFunc func(context.Context, *ent.DockMutation) (ent.Value, error)
-
-// Mutate calls f(ctx, m).
-func (f DockFunc) Mutate(ctx context.Context, m ent.Mutation) (ent.Value, error) {
- if mv, ok := m.(*ent.DockMutation); ok {
- return f(ctx, mv)
- }
- return nil, fmt.Errorf("unexpected mutation type %T. expect *ent.DockMutation", m)
-}
-
// The EventLogFunc type is an adapter to allow the use of ordinary
// function as EventLog mutator.
type EventLogFunc func(context.Context, *ent.EventLogMutation) (ent.Value, error)
diff --git a/bj_power_wms/ent/migrate/schema.go b/bj_power_wms/ent/migrate/schema.go
index 4ca4c98..3702b70 100644
--- a/bj_power_wms/ent/migrate/schema.go
+++ b/bj_power_wms/ent/migrate/schema.go
@@ -101,36 +101,6 @@ var (
},
},
}
- // DocksColumns holds the columns for the "docks" table.
- DocksColumns = []*schema.Column{
- {Name: "id", Type: field.TypeInt, Increment: true},
- {Name: "dock_code", Type: field.TypeString, Unique: true, Size: 20},
- {Name: "name", Type: field.TypeString, Size: 64, Default: ""},
- {Name: "dock_type", Type: field.TypeString, Size: 16, Default: "line"},
- {Name: "station_no", Type: field.TypeInt, Default: 0},
- {Name: "has_pallet", Type: field.TypeBool, Default: false},
- {Name: "pallet_ref", Type: field.TypeString, Nullable: true, Size: 64, Default: ""},
- {Name: "status", Type: field.TypeString, Size: 20, Default: "ENABLED"},
- {Name: "created_at", Type: field.TypeInt64},
- }
- // DocksTable holds the schema information for the "docks" table.
- DocksTable = &schema.Table{
- Name: "docks",
- Columns: DocksColumns,
- PrimaryKey: []*schema.Column{DocksColumns[0]},
- Indexes: []*schema.Index{
- {
- Name: "dock_dock_code",
- Unique: true,
- Columns: []*schema.Column{DocksColumns[1]},
- },
- {
- Name: "dock_dock_type",
- Unique: false,
- Columns: []*schema.Column{DocksColumns[3]},
- },
- },
- }
// EventLogColumns holds the columns for the "event_log" table.
EventLogColumns = []*schema.Column{
{Name: "id", Type: field.TypeInt, Increment: true},
@@ -867,7 +837,6 @@ var (
Tables = []*schema.Table{
AgvTasksTable,
AttachmentsTable,
- DocksTable,
EventLogTable,
InboundDetailsTable,
InboundOrdersTable,
diff --git a/bj_power_wms/ent/mutation.go b/bj_power_wms/ent/mutation.go
index fe43634..b0920b2 100644
--- a/bj_power_wms/ent/mutation.go
+++ b/bj_power_wms/ent/mutation.go
@@ -5,7 +5,6 @@ package ent
import (
"bj_power_wms/ent/agvtask"
"bj_power_wms/ent/attachment"
- "bj_power_wms/ent/dock"
"bj_power_wms/ent/eventlog"
"bj_power_wms/ent/inbounddetail"
"bj_power_wms/ent/inboundorder"
@@ -47,7 +46,6 @@ const (
// Node types.
TypeAgvTask = "AgvTask"
TypeAttachment = "Attachment"
- TypeDock = "Dock"
TypeEventLog = "EventLog"
TypeInboundDetail = "InboundDetail"
TypeInboundOrder = "InboundOrder"
@@ -2561,801 +2559,6 @@ func (m *AttachmentMutation) ResetEdge(name string) error {
return fmt.Errorf("unknown Attachment edge %s", name)
}
-// DockMutation represents an operation that mutates the Dock nodes in the graph.
-type DockMutation struct {
- config
- op Op
- typ string
- id *int
- dock_code *string
- name *string
- dock_type *string
- station_no *int
- addstation_no *int
- has_pallet *bool
- pallet_ref *string
- status *string
- created_at *int64
- addcreated_at *int64
- clearedFields map[string]struct{}
- done bool
- oldValue func(context.Context) (*Dock, error)
- predicates []predicate.Dock
-}
-
-var _ ent.Mutation = (*DockMutation)(nil)
-
-// dockOption allows management of the mutation configuration using functional options.
-type dockOption func(*DockMutation)
-
-// newDockMutation creates new mutation for the Dock entity.
-func newDockMutation(c config, op Op, opts ...dockOption) *DockMutation {
- m := &DockMutation{
- config: c,
- op: op,
- typ: TypeDock,
- clearedFields: make(map[string]struct{}),
- }
- for _, opt := range opts {
- opt(m)
- }
- return m
-}
-
-// withDockID sets the ID field of the mutation.
-func withDockID(id int) dockOption {
- return func(m *DockMutation) {
- var (
- err error
- once sync.Once
- value *Dock
- )
- m.oldValue = func(ctx context.Context) (*Dock, error) {
- once.Do(func() {
- if m.done {
- err = errors.New("querying old values post mutation is not allowed")
- } else {
- value, err = m.Client().Dock.Get(ctx, id)
- }
- })
- return value, err
- }
- m.id = &id
- }
-}
-
-// withDock sets the old Dock of the mutation.
-func withDock(node *Dock) dockOption {
- return func(m *DockMutation) {
- m.oldValue = func(context.Context) (*Dock, error) {
- return node, nil
- }
- m.id = &node.ID
- }
-}
-
-// Client returns a new `ent.Client` from the mutation. If the mutation was
-// executed in a transaction (ent.Tx), a transactional client is returned.
-func (m DockMutation) Client() *Client {
- client := &Client{config: m.config}
- client.init()
- return client
-}
-
-// Tx returns an `ent.Tx` for mutations that were executed in transactions;
-// it returns an error otherwise.
-func (m DockMutation) Tx() (*Tx, error) {
- if _, ok := m.driver.(*txDriver); !ok {
- return nil, errors.New("ent: mutation is not running in a transaction")
- }
- tx := &Tx{config: m.config}
- tx.init()
- return tx, nil
-}
-
-// ID returns the ID value in the mutation. Note that the ID is only available
-// if it was provided to the builder or after it was returned from the database.
-func (m *DockMutation) ID() (id int, exists bool) {
- if m.id == nil {
- return
- }
- return *m.id, true
-}
-
-// IDs queries the database and returns the entity ids that match the mutation's predicate.
-// That means, if the mutation is applied within a transaction with an isolation level such
-// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated
-// or updated by the mutation.
-func (m *DockMutation) IDs(ctx context.Context) ([]int, error) {
- switch {
- case m.op.Is(OpUpdateOne | OpDeleteOne):
- id, exists := m.ID()
- if exists {
- return []int{id}, nil
- }
- fallthrough
- case m.op.Is(OpUpdate | OpDelete):
- return m.Client().Dock.Query().Where(m.predicates...).IDs(ctx)
- default:
- return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op)
- }
-}
-
-// SetDockCode sets the "dock_code" field.
-func (m *DockMutation) SetDockCode(s string) {
- m.dock_code = &s
-}
-
-// DockCode returns the value of the "dock_code" field in the mutation.
-func (m *DockMutation) DockCode() (r string, exists bool) {
- v := m.dock_code
- if v == nil {
- return
- }
- return *v, true
-}
-
-// OldDockCode returns the old "dock_code" field's value of the Dock entity.
-// If the Dock object wasn't provided to the builder, the object is fetched from the database.
-// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
-func (m *DockMutation) OldDockCode(ctx context.Context) (v string, err error) {
- if !m.op.Is(OpUpdateOne) {
- return v, errors.New("OldDockCode is only allowed on UpdateOne operations")
- }
- if m.id == nil || m.oldValue == nil {
- return v, errors.New("OldDockCode requires an ID field in the mutation")
- }
- oldValue, err := m.oldValue(ctx)
- if err != nil {
- return v, fmt.Errorf("querying old value for OldDockCode: %w", err)
- }
- return oldValue.DockCode, nil
-}
-
-// ResetDockCode resets all changes to the "dock_code" field.
-func (m *DockMutation) ResetDockCode() {
- m.dock_code = nil
-}
-
-// SetName sets the "name" field.
-func (m *DockMutation) SetName(s string) {
- m.name = &s
-}
-
-// Name returns the value of the "name" field in the mutation.
-func (m *DockMutation) Name() (r string, exists bool) {
- v := m.name
- if v == nil {
- return
- }
- return *v, true
-}
-
-// OldName returns the old "name" field's value of the Dock entity.
-// If the Dock object wasn't provided to the builder, the object is fetched from the database.
-// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
-func (m *DockMutation) OldName(ctx context.Context) (v string, err error) {
- if !m.op.Is(OpUpdateOne) {
- return v, errors.New("OldName is only allowed on UpdateOne operations")
- }
- if m.id == nil || m.oldValue == nil {
- return v, errors.New("OldName requires an ID field in the mutation")
- }
- oldValue, err := m.oldValue(ctx)
- if err != nil {
- return v, fmt.Errorf("querying old value for OldName: %w", err)
- }
- return oldValue.Name, nil
-}
-
-// ResetName resets all changes to the "name" field.
-func (m *DockMutation) ResetName() {
- m.name = nil
-}
-
-// SetDockType sets the "dock_type" field.
-func (m *DockMutation) SetDockType(s string) {
- m.dock_type = &s
-}
-
-// DockType returns the value of the "dock_type" field in the mutation.
-func (m *DockMutation) DockType() (r string, exists bool) {
- v := m.dock_type
- if v == nil {
- return
- }
- return *v, true
-}
-
-// OldDockType returns the old "dock_type" field's value of the Dock entity.
-// If the Dock object wasn't provided to the builder, the object is fetched from the database.
-// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
-func (m *DockMutation) OldDockType(ctx context.Context) (v string, err error) {
- if !m.op.Is(OpUpdateOne) {
- return v, errors.New("OldDockType is only allowed on UpdateOne operations")
- }
- if m.id == nil || m.oldValue == nil {
- return v, errors.New("OldDockType requires an ID field in the mutation")
- }
- oldValue, err := m.oldValue(ctx)
- if err != nil {
- return v, fmt.Errorf("querying old value for OldDockType: %w", err)
- }
- return oldValue.DockType, nil
-}
-
-// ResetDockType resets all changes to the "dock_type" field.
-func (m *DockMutation) ResetDockType() {
- m.dock_type = nil
-}
-
-// SetStationNo sets the "station_no" field.
-func (m *DockMutation) SetStationNo(i int) {
- m.station_no = &i
- m.addstation_no = nil
-}
-
-// StationNo returns the value of the "station_no" field in the mutation.
-func (m *DockMutation) StationNo() (r int, exists bool) {
- v := m.station_no
- if v == nil {
- return
- }
- return *v, true
-}
-
-// OldStationNo returns the old "station_no" field's value of the Dock entity.
-// If the Dock object wasn't provided to the builder, the object is fetched from the database.
-// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
-func (m *DockMutation) OldStationNo(ctx context.Context) (v int, err error) {
- if !m.op.Is(OpUpdateOne) {
- return v, errors.New("OldStationNo is only allowed on UpdateOne operations")
- }
- if m.id == nil || m.oldValue == nil {
- return v, errors.New("OldStationNo requires an ID field in the mutation")
- }
- oldValue, err := m.oldValue(ctx)
- if err != nil {
- return v, fmt.Errorf("querying old value for OldStationNo: %w", err)
- }
- return oldValue.StationNo, nil
-}
-
-// AddStationNo adds i to the "station_no" field.
-func (m *DockMutation) AddStationNo(i int) {
- if m.addstation_no != nil {
- *m.addstation_no += i
- } else {
- m.addstation_no = &i
- }
-}
-
-// AddedStationNo returns the value that was added to the "station_no" field in this mutation.
-func (m *DockMutation) AddedStationNo() (r int, exists bool) {
- v := m.addstation_no
- if v == nil {
- return
- }
- return *v, true
-}
-
-// ResetStationNo resets all changes to the "station_no" field.
-func (m *DockMutation) ResetStationNo() {
- m.station_no = nil
- m.addstation_no = nil
-}
-
-// SetHasPallet sets the "has_pallet" field.
-func (m *DockMutation) SetHasPallet(b bool) {
- m.has_pallet = &b
-}
-
-// HasPallet returns the value of the "has_pallet" field in the mutation.
-func (m *DockMutation) HasPallet() (r bool, exists bool) {
- v := m.has_pallet
- if v == nil {
- return
- }
- return *v, true
-}
-
-// OldHasPallet returns the old "has_pallet" field's value of the Dock entity.
-// If the Dock object wasn't provided to the builder, the object is fetched from the database.
-// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
-func (m *DockMutation) OldHasPallet(ctx context.Context) (v bool, err error) {
- if !m.op.Is(OpUpdateOne) {
- return v, errors.New("OldHasPallet is only allowed on UpdateOne operations")
- }
- if m.id == nil || m.oldValue == nil {
- return v, errors.New("OldHasPallet requires an ID field in the mutation")
- }
- oldValue, err := m.oldValue(ctx)
- if err != nil {
- return v, fmt.Errorf("querying old value for OldHasPallet: %w", err)
- }
- return oldValue.HasPallet, nil
-}
-
-// ResetHasPallet resets all changes to the "has_pallet" field.
-func (m *DockMutation) ResetHasPallet() {
- m.has_pallet = nil
-}
-
-// SetPalletRef sets the "pallet_ref" field.
-func (m *DockMutation) SetPalletRef(s string) {
- m.pallet_ref = &s
-}
-
-// PalletRef returns the value of the "pallet_ref" field in the mutation.
-func (m *DockMutation) PalletRef() (r string, exists bool) {
- v := m.pallet_ref
- if v == nil {
- return
- }
- return *v, true
-}
-
-// OldPalletRef returns the old "pallet_ref" field's value of the Dock entity.
-// If the Dock object wasn't provided to the builder, the object is fetched from the database.
-// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
-func (m *DockMutation) OldPalletRef(ctx context.Context) (v string, err error) {
- if !m.op.Is(OpUpdateOne) {
- return v, errors.New("OldPalletRef is only allowed on UpdateOne operations")
- }
- if m.id == nil || m.oldValue == nil {
- return v, errors.New("OldPalletRef requires an ID field in the mutation")
- }
- oldValue, err := m.oldValue(ctx)
- if err != nil {
- return v, fmt.Errorf("querying old value for OldPalletRef: %w", err)
- }
- return oldValue.PalletRef, nil
-}
-
-// ClearPalletRef clears the value of the "pallet_ref" field.
-func (m *DockMutation) ClearPalletRef() {
- m.pallet_ref = nil
- m.clearedFields[dock.FieldPalletRef] = struct{}{}
-}
-
-// PalletRefCleared returns if the "pallet_ref" field was cleared in this mutation.
-func (m *DockMutation) PalletRefCleared() bool {
- _, ok := m.clearedFields[dock.FieldPalletRef]
- return ok
-}
-
-// ResetPalletRef resets all changes to the "pallet_ref" field.
-func (m *DockMutation) ResetPalletRef() {
- m.pallet_ref = nil
- delete(m.clearedFields, dock.FieldPalletRef)
-}
-
-// SetStatus sets the "status" field.
-func (m *DockMutation) SetStatus(s string) {
- m.status = &s
-}
-
-// Status returns the value of the "status" field in the mutation.
-func (m *DockMutation) Status() (r string, exists bool) {
- v := m.status
- if v == nil {
- return
- }
- return *v, true
-}
-
-// OldStatus returns the old "status" field's value of the Dock entity.
-// If the Dock object wasn't provided to the builder, the object is fetched from the database.
-// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
-func (m *DockMutation) OldStatus(ctx context.Context) (v string, err error) {
- if !m.op.Is(OpUpdateOne) {
- return v, errors.New("OldStatus is only allowed on UpdateOne operations")
- }
- if m.id == nil || m.oldValue == nil {
- return v, errors.New("OldStatus requires an ID field in the mutation")
- }
- oldValue, err := m.oldValue(ctx)
- if err != nil {
- return v, fmt.Errorf("querying old value for OldStatus: %w", err)
- }
- return oldValue.Status, nil
-}
-
-// ResetStatus resets all changes to the "status" field.
-func (m *DockMutation) ResetStatus() {
- m.status = nil
-}
-
-// SetCreatedAt sets the "created_at" field.
-func (m *DockMutation) SetCreatedAt(i int64) {
- m.created_at = &i
- m.addcreated_at = nil
-}
-
-// CreatedAt returns the value of the "created_at" field in the mutation.
-func (m *DockMutation) CreatedAt() (r int64, exists bool) {
- v := m.created_at
- if v == nil {
- return
- }
- return *v, true
-}
-
-// OldCreatedAt returns the old "created_at" field's value of the Dock entity.
-// If the Dock object wasn't provided to the builder, the object is fetched from the database.
-// An error is returned if the mutation operation is not UpdateOne, or the database query fails.
-func (m *DockMutation) OldCreatedAt(ctx context.Context) (v int64, err error) {
- if !m.op.Is(OpUpdateOne) {
- return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations")
- }
- if m.id == nil || m.oldValue == nil {
- return v, errors.New("OldCreatedAt requires an ID field in the mutation")
- }
- oldValue, err := m.oldValue(ctx)
- if err != nil {
- return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err)
- }
- return oldValue.CreatedAt, nil
-}
-
-// AddCreatedAt adds i to the "created_at" field.
-func (m *DockMutation) AddCreatedAt(i int64) {
- if m.addcreated_at != nil {
- *m.addcreated_at += i
- } else {
- m.addcreated_at = &i
- }
-}
-
-// AddedCreatedAt returns the value that was added to the "created_at" field in this mutation.
-func (m *DockMutation) AddedCreatedAt() (r int64, exists bool) {
- v := m.addcreated_at
- if v == nil {
- return
- }
- return *v, true
-}
-
-// ResetCreatedAt resets all changes to the "created_at" field.
-func (m *DockMutation) ResetCreatedAt() {
- m.created_at = nil
- m.addcreated_at = nil
-}
-
-// Where appends a list predicates to the DockMutation builder.
-func (m *DockMutation) Where(ps ...predicate.Dock) {
- m.predicates = append(m.predicates, ps...)
-}
-
-// WhereP appends storage-level predicates to the DockMutation builder. Using this method,
-// users can use type-assertion to append predicates that do not depend on any generated package.
-func (m *DockMutation) WhereP(ps ...func(*sql.Selector)) {
- p := make([]predicate.Dock, len(ps))
- for i := range ps {
- p[i] = ps[i]
- }
- m.Where(p...)
-}
-
-// Op returns the operation name.
-func (m *DockMutation) Op() Op {
- return m.op
-}
-
-// SetOp allows setting the mutation operation.
-func (m *DockMutation) SetOp(op Op) {
- m.op = op
-}
-
-// Type returns the node type of this mutation (Dock).
-func (m *DockMutation) Type() string {
- return m.typ
-}
-
-// Fields returns all fields that were changed during this mutation. Note that in
-// order to get all numeric fields that were incremented/decremented, call
-// AddedFields().
-func (m *DockMutation) Fields() []string {
- fields := make([]string, 0, 8)
- if m.dock_code != nil {
- fields = append(fields, dock.FieldDockCode)
- }
- if m.name != nil {
- fields = append(fields, dock.FieldName)
- }
- if m.dock_type != nil {
- fields = append(fields, dock.FieldDockType)
- }
- if m.station_no != nil {
- fields = append(fields, dock.FieldStationNo)
- }
- if m.has_pallet != nil {
- fields = append(fields, dock.FieldHasPallet)
- }
- if m.pallet_ref != nil {
- fields = append(fields, dock.FieldPalletRef)
- }
- if m.status != nil {
- fields = append(fields, dock.FieldStatus)
- }
- if m.created_at != nil {
- fields = append(fields, dock.FieldCreatedAt)
- }
- return fields
-}
-
-// Field returns the value of a field with the given name. The second boolean
-// return value indicates that this field was not set, or was not defined in the
-// schema.
-func (m *DockMutation) Field(name string) (ent.Value, bool) {
- switch name {
- case dock.FieldDockCode:
- return m.DockCode()
- case dock.FieldName:
- return m.Name()
- case dock.FieldDockType:
- return m.DockType()
- case dock.FieldStationNo:
- return m.StationNo()
- case dock.FieldHasPallet:
- return m.HasPallet()
- case dock.FieldPalletRef:
- return m.PalletRef()
- case dock.FieldStatus:
- return m.Status()
- case dock.FieldCreatedAt:
- return m.CreatedAt()
- }
- return nil, false
-}
-
-// OldField returns the old value of the field from the database. An error is
-// returned if the mutation operation is not UpdateOne, or the query to the
-// database failed.
-func (m *DockMutation) OldField(ctx context.Context, name string) (ent.Value, error) {
- switch name {
- case dock.FieldDockCode:
- return m.OldDockCode(ctx)
- case dock.FieldName:
- return m.OldName(ctx)
- case dock.FieldDockType:
- return m.OldDockType(ctx)
- case dock.FieldStationNo:
- return m.OldStationNo(ctx)
- case dock.FieldHasPallet:
- return m.OldHasPallet(ctx)
- case dock.FieldPalletRef:
- return m.OldPalletRef(ctx)
- case dock.FieldStatus:
- return m.OldStatus(ctx)
- case dock.FieldCreatedAt:
- return m.OldCreatedAt(ctx)
- }
- return nil, fmt.Errorf("unknown Dock field %s", name)
-}
-
-// SetField sets the value of a field with the given name. It returns an error if
-// the field is not defined in the schema, or if the type mismatched the field
-// type.
-func (m *DockMutation) SetField(name string, value ent.Value) error {
- switch name {
- case dock.FieldDockCode:
- v, ok := value.(string)
- if !ok {
- return fmt.Errorf("unexpected type %T for field %s", value, name)
- }
- m.SetDockCode(v)
- return nil
- case dock.FieldName:
- v, ok := value.(string)
- if !ok {
- return fmt.Errorf("unexpected type %T for field %s", value, name)
- }
- m.SetName(v)
- return nil
- case dock.FieldDockType:
- v, ok := value.(string)
- if !ok {
- return fmt.Errorf("unexpected type %T for field %s", value, name)
- }
- m.SetDockType(v)
- return nil
- case dock.FieldStationNo:
- v, ok := value.(int)
- if !ok {
- return fmt.Errorf("unexpected type %T for field %s", value, name)
- }
- m.SetStationNo(v)
- return nil
- case dock.FieldHasPallet:
- v, ok := value.(bool)
- if !ok {
- return fmt.Errorf("unexpected type %T for field %s", value, name)
- }
- m.SetHasPallet(v)
- return nil
- case dock.FieldPalletRef:
- v, ok := value.(string)
- if !ok {
- return fmt.Errorf("unexpected type %T for field %s", value, name)
- }
- m.SetPalletRef(v)
- return nil
- case dock.FieldStatus:
- v, ok := value.(string)
- if !ok {
- return fmt.Errorf("unexpected type %T for field %s", value, name)
- }
- m.SetStatus(v)
- return nil
- case dock.FieldCreatedAt:
- v, ok := value.(int64)
- if !ok {
- return fmt.Errorf("unexpected type %T for field %s", value, name)
- }
- m.SetCreatedAt(v)
- return nil
- }
- return fmt.Errorf("unknown Dock field %s", name)
-}
-
-// AddedFields returns all numeric fields that were incremented/decremented during
-// this mutation.
-func (m *DockMutation) AddedFields() []string {
- var fields []string
- if m.addstation_no != nil {
- fields = append(fields, dock.FieldStationNo)
- }
- if m.addcreated_at != nil {
- fields = append(fields, dock.FieldCreatedAt)
- }
- return fields
-}
-
-// AddedField returns the numeric value that was incremented/decremented on a field
-// with the given name. The second boolean return value indicates that this field
-// was not set, or was not defined in the schema.
-func (m *DockMutation) AddedField(name string) (ent.Value, bool) {
- switch name {
- case dock.FieldStationNo:
- return m.AddedStationNo()
- case dock.FieldCreatedAt:
- return m.AddedCreatedAt()
- }
- return nil, false
-}
-
-// AddField adds the value to the field with the given name. It returns an error if
-// the field is not defined in the schema, or if the type mismatched the field
-// type.
-func (m *DockMutation) AddField(name string, value ent.Value) error {
- switch name {
- case dock.FieldStationNo:
- v, ok := value.(int)
- if !ok {
- return fmt.Errorf("unexpected type %T for field %s", value, name)
- }
- m.AddStationNo(v)
- return nil
- case dock.FieldCreatedAt:
- v, ok := value.(int64)
- if !ok {
- return fmt.Errorf("unexpected type %T for field %s", value, name)
- }
- m.AddCreatedAt(v)
- return nil
- }
- return fmt.Errorf("unknown Dock numeric field %s", name)
-}
-
-// ClearedFields returns all nullable fields that were cleared during this
-// mutation.
-func (m *DockMutation) ClearedFields() []string {
- var fields []string
- if m.FieldCleared(dock.FieldPalletRef) {
- fields = append(fields, dock.FieldPalletRef)
- }
- return fields
-}
-
-// FieldCleared returns a boolean indicating if a field with the given name was
-// cleared in this mutation.
-func (m *DockMutation) FieldCleared(name string) bool {
- _, ok := m.clearedFields[name]
- return ok
-}
-
-// ClearField clears the value of the field with the given name. It returns an
-// error if the field is not defined in the schema.
-func (m *DockMutation) ClearField(name string) error {
- switch name {
- case dock.FieldPalletRef:
- m.ClearPalletRef()
- return nil
- }
- return fmt.Errorf("unknown Dock nullable field %s", name)
-}
-
-// ResetField resets all changes in the mutation for the field with the given name.
-// It returns an error if the field is not defined in the schema.
-func (m *DockMutation) ResetField(name string) error {
- switch name {
- case dock.FieldDockCode:
- m.ResetDockCode()
- return nil
- case dock.FieldName:
- m.ResetName()
- return nil
- case dock.FieldDockType:
- m.ResetDockType()
- return nil
- case dock.FieldStationNo:
- m.ResetStationNo()
- return nil
- case dock.FieldHasPallet:
- m.ResetHasPallet()
- return nil
- case dock.FieldPalletRef:
- m.ResetPalletRef()
- return nil
- case dock.FieldStatus:
- m.ResetStatus()
- return nil
- case dock.FieldCreatedAt:
- m.ResetCreatedAt()
- return nil
- }
- return fmt.Errorf("unknown Dock field %s", name)
-}
-
-// AddedEdges returns all edge names that were set/added in this mutation.
-func (m *DockMutation) AddedEdges() []string {
- edges := make([]string, 0, 0)
- return edges
-}
-
-// AddedIDs returns all IDs (to other nodes) that were added for the given edge
-// name in this mutation.
-func (m *DockMutation) AddedIDs(name string) []ent.Value {
- return nil
-}
-
-// RemovedEdges returns all edge names that were removed in this mutation.
-func (m *DockMutation) RemovedEdges() []string {
- edges := make([]string, 0, 0)
- return edges
-}
-
-// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with
-// the given name in this mutation.
-func (m *DockMutation) RemovedIDs(name string) []ent.Value {
- return nil
-}
-
-// ClearedEdges returns all edge names that were cleared in this mutation.
-func (m *DockMutation) ClearedEdges() []string {
- edges := make([]string, 0, 0)
- return edges
-}
-
-// EdgeCleared returns a boolean which indicates if the edge with the given name
-// was cleared in this mutation.
-func (m *DockMutation) EdgeCleared(name string) bool {
- return false
-}
-
-// ClearEdge clears the value of the edge with the given name. It returns an error
-// if that edge is not defined in the schema.
-func (m *DockMutation) ClearEdge(name string) error {
- return fmt.Errorf("unknown Dock unique edge %s", name)
-}
-
-// ResetEdge resets all changes to the edge with the given name in this mutation.
-// It returns an error if the edge is not defined in the schema.
-func (m *DockMutation) ResetEdge(name string) error {
- return fmt.Errorf("unknown Dock edge %s", name)
-}
-
// EventLogMutation represents an operation that mutates the EventLog nodes in the graph.
type EventLogMutation struct {
config
diff --git a/bj_power_wms/ent/predicate/predicate.go b/bj_power_wms/ent/predicate/predicate.go
index 9e3a79e..62e37fe 100644
--- a/bj_power_wms/ent/predicate/predicate.go
+++ b/bj_power_wms/ent/predicate/predicate.go
@@ -12,9 +12,6 @@ type AgvTask func(*sql.Selector)
// Attachment is the predicate function for attachment builders.
type Attachment func(*sql.Selector)
-// Dock is the predicate function for dock builders.
-type Dock func(*sql.Selector)
-
// EventLog is the predicate function for eventlog builders.
type EventLog func(*sql.Selector)
diff --git a/bj_power_wms/ent/runtime.go b/bj_power_wms/ent/runtime.go
index 4f46af2..5f0f390 100644
--- a/bj_power_wms/ent/runtime.go
+++ b/bj_power_wms/ent/runtime.go
@@ -5,7 +5,6 @@ package ent
import (
"bj_power_wms/ent/agvtask"
"bj_power_wms/ent/attachment"
- "bj_power_wms/ent/dock"
"bj_power_wms/ent/eventlog"
"bj_power_wms/ent/inbounddetail"
"bj_power_wms/ent/inboundorder"
@@ -117,48 +116,6 @@ func init() {
attachmentDescCreatedAt := attachmentFields[15].Descriptor()
// attachment.DefaultCreatedAt holds the default value on creation for the created_at field.
attachment.DefaultCreatedAt = attachmentDescCreatedAt.Default.(func() int64)
- dockFields := schema.Dock{}.Fields()
- _ = dockFields
- // dockDescDockCode is the schema descriptor for dock_code field.
- dockDescDockCode := dockFields[0].Descriptor()
- // dock.DockCodeValidator is a validator for the "dock_code" field. It is called by the builders before save.
- dock.DockCodeValidator = dockDescDockCode.Validators[0].(func(string) error)
- // dockDescName is the schema descriptor for name field.
- dockDescName := dockFields[1].Descriptor()
- // dock.DefaultName holds the default value on creation for the name field.
- dock.DefaultName = dockDescName.Default.(string)
- // dock.NameValidator is a validator for the "name" field. It is called by the builders before save.
- dock.NameValidator = dockDescName.Validators[0].(func(string) error)
- // dockDescDockType is the schema descriptor for dock_type field.
- dockDescDockType := dockFields[2].Descriptor()
- // dock.DefaultDockType holds the default value on creation for the dock_type field.
- dock.DefaultDockType = dockDescDockType.Default.(string)
- // dock.DockTypeValidator is a validator for the "dock_type" field. It is called by the builders before save.
- dock.DockTypeValidator = dockDescDockType.Validators[0].(func(string) error)
- // dockDescStationNo is the schema descriptor for station_no field.
- dockDescStationNo := dockFields[3].Descriptor()
- // dock.DefaultStationNo holds the default value on creation for the station_no field.
- dock.DefaultStationNo = dockDescStationNo.Default.(int)
- // dockDescHasPallet is the schema descriptor for has_pallet field.
- dockDescHasPallet := dockFields[4].Descriptor()
- // dock.DefaultHasPallet holds the default value on creation for the has_pallet field.
- dock.DefaultHasPallet = dockDescHasPallet.Default.(bool)
- // dockDescPalletRef is the schema descriptor for pallet_ref field.
- dockDescPalletRef := dockFields[5].Descriptor()
- // dock.DefaultPalletRef holds the default value on creation for the pallet_ref field.
- dock.DefaultPalletRef = dockDescPalletRef.Default.(string)
- // dock.PalletRefValidator is a validator for the "pallet_ref" field. It is called by the builders before save.
- dock.PalletRefValidator = dockDescPalletRef.Validators[0].(func(string) error)
- // dockDescStatus is the schema descriptor for status field.
- dockDescStatus := dockFields[6].Descriptor()
- // dock.DefaultStatus holds the default value on creation for the status field.
- dock.DefaultStatus = dockDescStatus.Default.(string)
- // dock.StatusValidator is a validator for the "status" field. It is called by the builders before save.
- dock.StatusValidator = dockDescStatus.Validators[0].(func(string) error)
- // dockDescCreatedAt is the schema descriptor for created_at field.
- dockDescCreatedAt := dockFields[7].Descriptor()
- // dock.DefaultCreatedAt holds the default value on creation for the created_at field.
- dock.DefaultCreatedAt = dockDescCreatedAt.Default.(func() int64)
eventlogFields := schema.EventLog{}.Fields()
_ = eventlogFields
// eventlogDescEventType is the schema descriptor for event_type field.
diff --git a/bj_power_wms/ent/tx.go b/bj_power_wms/ent/tx.go
index 4166791..f51b589 100644
--- a/bj_power_wms/ent/tx.go
+++ b/bj_power_wms/ent/tx.go
@@ -16,8 +16,6 @@ type Tx struct {
AgvTask *AgvTaskClient
// Attachment is the client for interacting with the Attachment builders.
Attachment *AttachmentClient
- // Dock is the client for interacting with the Dock builders.
- Dock *DockClient
// EventLog is the client for interacting with the EventLog builders.
EventLog *EventLogClient
// InboundDetail is the client for interacting with the InboundDetail builders.
@@ -191,7 +189,6 @@ func (tx *Tx) Client() *Client {
func (tx *Tx) init() {
tx.AgvTask = NewAgvTaskClient(tx.config)
tx.Attachment = NewAttachmentClient(tx.config)
- tx.Dock = NewDockClient(tx.config)
tx.EventLog = NewEventLogClient(tx.config)
tx.InboundDetail = NewInboundDetailClient(tx.config)
tx.InboundOrder = NewInboundOrderClient(tx.config)
diff --git a/bj_power_wms/frontend/src/components/AttachmentPanel.vue b/bj_power_wms/frontend/src/components/AttachmentPanel.vue
index 44edc84..baed2c9 100644
--- a/bj_power_wms/frontend/src/components/AttachmentPanel.vue
+++ b/bj_power_wms/frontend/src/components/AttachmentPanel.vue
@@ -54,6 +54,16 @@ function preview(row) {
window.open(row.url, '_blank')
}
+// 涓嬭浇锛氬悗绔 /uploads/{id}?dl=1 杩斿洖 Content-Disposition: attachment锛岀敤涓存椂 瑙﹀彂鐪熷疄涓嬭浇锛堢粫寮寮圭獥鎷︽埅锛
+function download(row) {
+ const a = document.createElement('a')
+ a.href = row.url + '?dl=1'
+ a.download = row.fileName || ''
+ document.body.appendChild(a)
+ a.click()
+ document.body.removeChild(a)
+}
+
async function remove(row) {
try {
await ElMessageBox.confirm(`纭鍒犻櫎闄勪欢銆${row.fileName}銆嶏紵`, '鍒犻櫎纭', { type: 'warning' })
@@ -91,10 +101,14 @@ defineExpose({ load })
涓婁紶闄勪欢
- 鏀寔 PDF / 鍥剧焊 / 鍥剧墖 / Office锛屽崟涓笉瓒呰繃 20MB锛涚偣銆屾煡鐪嬨嶆柊绐楀彛鎵撳紑
+ 鏀寔 PDF / 鍥剧焊 / 鍥剧墖 / Office锛屽崟涓笉瓒呰繃 20MB锛涚偣鏂囦欢鍚嶆垨銆屼笅杞姐嶄笅杞斤紝鐐广屾煡鐪嬨嶆柊绐楀彛棰勮