提交
This commit is contained in:
@@ -171,6 +171,33 @@ func workOrderContractHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
// workOrderExistsHandler GET /api/workorder/exists?orderNo=
|
||||
// 入库「产品工号」软校验(B1):只判工单是否存在(不要求有合同号)。
|
||||
// 红字提示由前端出、不阻断保存;404=查不到,5xx=MES 不可达。
|
||||
func workOrderExistsHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
orderNo := r.URL.Query().Get("orderNo")
|
||||
if orderNo == "" {
|
||||
fail(w, http.StatusBadRequest, "工单号必填")
|
||||
return
|
||||
}
|
||||
if ctx.Mes == nil {
|
||||
fail(w, http.StatusInternalServerError, "MES 客户端未配置")
|
||||
return
|
||||
}
|
||||
wo, err := ctx.Mes.GetWorkOrder(ctx0(), orderNo)
|
||||
if err != nil {
|
||||
fail(w, http.StatusBadGateway, "MES 不可达:"+err.Error())
|
||||
return
|
||||
}
|
||||
if wo == nil {
|
||||
fail(w, http.StatusNotFound, "工单不存在")
|
||||
return
|
||||
}
|
||||
ok(w, map[string]any{"exists": true, "workOrderNo": wo.WorkOrderNo})
|
||||
}
|
||||
}
|
||||
|
||||
// semiOutboundHandler 半成品/成品出库(重上线/发货等):更新 inventories 状态
|
||||
// 客户诉求 L224:出库原因必选(包装/继续生产/检验试验/其他),写入 outbound_reason 留痕。
|
||||
func semiOutboundHandler(ctx *svc.ServiceContext) http.HandlerFunc {
|
||||
|
||||
Reference in New Issue
Block a user