refactor(wms): 合并库存表为统一inventory,重构业务逻辑
1. 合并inventory_batch与serial_number为统一inventory表,用manage_mode区分结构件批次/精密件SN 2. 移除冗余的material_type字段与相关逻辑 3. 重构库存查询、检验、入库出库等业务逻辑适配新表结构 4. 调整前端路由与菜单,拆分基础数据为区域维护和物料档案 5. 优化入库校验逻辑,避免空单问题 6. 调整Vite构建配置,关闭自动清空输出目录 7. 为各模块添加详细中文注释,统一业务术语 8. 生成并更新Ent自动代码文件
This commit is contained in:
@@ -21,7 +21,6 @@ func createMaterialHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
Unit string `json:"unit"`
|
||||
Description string `json:"description"`
|
||||
ManageMode int `json:"manageMode"` // 1批次/2序列号
|
||||
MaterialType string `json:"materialType"`
|
||||
TemplateCode string `json:"templateCode"`
|
||||
}
|
||||
if err := parseJSON(r, &req); err != nil {
|
||||
@@ -61,7 +60,6 @@ func createMaterialHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
SetManageMode(manageMode).
|
||||
SetIsBatchManaged(manageMode == 1).
|
||||
SetIsSerialManaged(manageMode == 2).
|
||||
SetNillableMaterialType(strPtr(req.MaterialType)).
|
||||
SetNillableTemplateCode(strPtr(req.TemplateCode)).
|
||||
Save(ctx0())
|
||||
if err != nil {
|
||||
@@ -120,7 +118,6 @@ func queryMaterialsHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
page := atoi(r.URL.Query().Get("page"), 1)
|
||||
pageSize := atoi(r.URL.Query().Get("pageSize"), 20)
|
||||
keyword := r.URL.Query().Get("keyword")
|
||||
materialType := r.URL.Query().Get("materialType")
|
||||
templateCode := r.URL.Query().Get("templateCode")
|
||||
|
||||
q := ctx.EntClient.Material.Query()
|
||||
@@ -132,9 +129,6 @@ func queryMaterialsHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
),
|
||||
)
|
||||
}
|
||||
if materialType != "" {
|
||||
q = q.Where(material.MaterialTypeEQ(materialType))
|
||||
}
|
||||
if templateCode != "" {
|
||||
q = q.Where(material.TemplateCodeEQ(templateCode))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user