feat: 两库对等物料管理及产品工号贯通全流程
- 新增 MES 本地物料表及双向同步接口,WMS 物料变更自动同步 - 全流程新增产品工号字段,贯通入库/库存/出库/检验环节 - 工单管理支持多工单混产,移除单工单互斥限制 - 新增批次号/SN 字段支持质量检验联动 WMS 库存处置 - 修复权限规则,仅内置管理员账号不允许修改删除 - 工位终端新增 SN 扫码自动切换所属工单功能
This commit is contained in:
@@ -166,6 +166,7 @@ func createInboundHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
InspectionNo string `json:"inspectionNo"`
|
||||
OwnershipType string `json:"ownershipType"` // workorder/project/other/none
|
||||
OwnershipNo string `json:"ownershipNo"`
|
||||
ProductWorkNo string `json:"productWorkNo"` // 产品工号(归属下手填二级编号)
|
||||
}
|
||||
if err := parseJSON(r, &req); err != nil {
|
||||
fail(w, http.StatusBadRequest, "参数错误: "+err.Error())
|
||||
@@ -268,6 +269,7 @@ func createInboundHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
SetInspectionNo(req.InspectionNo).
|
||||
SetOwnershipType(ownershipTypeOrNone(req.OwnershipType)).
|
||||
SetNillableOwnershipNo(strPtr(req.OwnershipNo)).
|
||||
SetNillableProductWorkNo(strPtr(req.ProductWorkNo)).
|
||||
SetNillableQualityStatus(strPtr(qualityStatus)).
|
||||
Save(ctx0())
|
||||
if err != nil {
|
||||
@@ -311,6 +313,7 @@ func createInboundHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
if _, err = tx.Inventory.UpdateOneID(existing.ID).
|
||||
AddQuantity(qty).
|
||||
SetNillableSupplier(strPtr(req.Supplier)).
|
||||
SetNillableProductWorkNo(strPtr(req.ProductWorkNo)).
|
||||
Save(ctx0()); err != nil {
|
||||
fail(w, http.StatusInternalServerError, "追加批次失败: "+err.Error())
|
||||
return
|
||||
@@ -331,6 +334,7 @@ func createInboundHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
SetNillablePositionNo(strPtr(req.PositionNo)).
|
||||
SetStatus("在库").
|
||||
SetInboundNo(inboundNo).
|
||||
SetNillableProductWorkNo(strPtr(req.ProductWorkNo)).
|
||||
Save(ctx0()); err != nil {
|
||||
fail(w, http.StatusInternalServerError, "创建库存行失败: "+err.Error())
|
||||
return
|
||||
@@ -379,6 +383,7 @@ func createInboundHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
SetNillablePositionNo(strPtr(req.PositionNo)).
|
||||
SetStatus("在库").
|
||||
SetInboundNo(inboundNo).
|
||||
SetNillableProductWorkNo(strPtr(req.ProductWorkNo)).
|
||||
Save(ctx0()); err != nil {
|
||||
fail(w, http.StatusInternalServerError, "创建 SN 库存行失败: "+err.Error())
|
||||
return
|
||||
@@ -456,6 +461,12 @@ func applyInboundFilters(q *ent.InboundOrderQuery, r *http.Request) *ent.Inbound
|
||||
if v := r.URL.Query().Get("inspectionNo"); v != "" {
|
||||
q = q.Where(inboundorder.InspectionNoContainsFold(v))
|
||||
}
|
||||
if v := r.URL.Query().Get("productWorkNo"); v != "" {
|
||||
q = q.Where(inboundorder.ProductWorkNoContainsFold(v))
|
||||
}
|
||||
if v := r.URL.Query().Get("ownershipNo"); v != "" {
|
||||
q = q.Where(inboundorder.OwnershipNoContainsFold(v))
|
||||
}
|
||||
// 单据状态:有效 / 已作废(作废单保留可查,但不参与库存)
|
||||
if v := r.URL.Query().Get("voided"); v == "true" {
|
||||
q = q.Where(inboundorder.VoidedEQ(true))
|
||||
@@ -601,8 +612,8 @@ func exportInboundHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
}
|
||||
|
||||
// ownershipTypeOrNone 归属类型归一化(需求22)。
|
||||
// 归属三选一:工单编号(workorder) / 科技项目号(project) / 其他(other),默认「其他」。
|
||||
// 这里的「工单编号」是独立维度标签,与 MES 工单号不是同一东西,手动输入、不联动 MES、不校验格式(长度≤64 由前端约束)。
|
||||
// 归属三选一:合同号(workorder) / 科技项目号(project) / 其他(other),默认「其他」。
|
||||
// 这里的「合同号」是独立维度标签,与 MES 工单号不是同一东西,手动输入、不联动 MES、不校验格式(长度≤64 由前端约束)。
|
||||
// 历史遗留的 "none"/空 一律归为 "other"(需求22:显示「无」不对,应为「其他」)。
|
||||
func ownershipTypeOrNone(v string) string {
|
||||
switch v {
|
||||
|
||||
Reference in New Issue
Block a user