From 53c7de340f55ab0c917a03d54d883b4a8082f42d Mon Sep 17 00:00:00 2001
From: cdk <2441919651@qq.com>
Date: 星期四, 27 十一月 2025 09:47:48 +0800
Subject: [PATCH] 增加通过网址获取供应商评分数据的接口
---
Controllers/Wom/MesWorkProdController.cs | 134 +++++++++++++++++++++++++++++++-------------
1 files changed, 95 insertions(+), 39 deletions(-)
diff --git a/Controllers/Wom/MesWorkProdController.cs b/Controllers/Wom/MesWorkProdController.cs
index 0c571b7..92b1a8e 100644
--- a/Controllers/Wom/MesWorkProdController.cs
+++ b/Controllers/Wom/MesWorkProdController.cs
@@ -1,31 +1,34 @@
锘縰sing System.Dynamic;
using Microsoft.AspNetCore.Mvc;
+using NewPdaSqlServer.Dto.service;
using NewPdaSqlServer.entity;
using NewPdaSqlServer.service.Wom;
using NewPdaSqlServer.util;
namespace NewPdaSqlServer.Controllers.Wom;
-[ApiController]
+/// <summary>
+/// 鐢熶骇鎶ュ伐鐩稿叧鎺ュ彛
+/// </summary>
[Route("api/[controller]")]
+[ApiController]
public class MesWorkProdController : ControllerBase
{
- private readonly MesWorkProdManager m = new();
+ private readonly MesWorkProdManager _manager = new();
-
- /***杩涘叆妯$増绠$悊鍙互淇敼妯$増***/
+ #region 鍩虹CRUD
/// <summary>
/// 鑾峰彇鎵�鏈�
/// </summary>
- /// <returns></returns>
+ /// <returns>鎶ュ伐鍗曞垪琛�</returns>
[HttpPost("GetList")]
public ResponseResult GetList()
{
try
{
dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.GetList();
+ resultInfos.tbBillList = _manager.GetList();
return new ResponseResult
{
status = 0,
@@ -39,18 +42,17 @@
}
}
-
/// <summary>
/// 鏍规嵁涓婚敭鑾峰彇
/// </summary>
- /// <returns></returns>
+ /// <returns>鎶ュ伐鍗曚俊鎭�</returns>
[HttpPost("GetById")]
public ResponseResult GetById(int id)
{
try
{
dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.GetById(id);
+ resultInfos.tbBillList = _manager.GetById(id);
return new ResponseResult
{
status = 0,
@@ -67,14 +69,14 @@
/// <summary>
/// 鏍规嵁涓婚敭鍒犻櫎
/// </summary>
- /// <returns></returns>
+ /// <returns>鍒犻櫎缁撴灉</returns>
[HttpPost("DeleteByIds")]
public ResponseResult DeleteByIds([FromBody] object[] ids)
{
try
{
dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.DeleteByIds(ids);
+ resultInfos.tbBillList = _manager.DeleteByIds(ids);
return new ResponseResult
{
status = 0,
@@ -91,38 +93,14 @@
/// <summary>
/// 娣诲姞
/// </summary>
- /// <returns></returns>
+ /// <returns>娣诲姞缁撴灉</returns>
[HttpPost("Insert")]
public ResponseResult Add([FromBody] MesWorkProd data)
{
try
{
dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.Insert(data);
- return new ResponseResult
- {
- status = 0,
- message = "OK",
- data = resultInfos
- };
- }
- catch (Exception ex)
- {
- return ResponseResult.ResponseError(ex);
- }
- }
-
- /// <summary>
- /// 娣诲姞杩斿洖鑷
- /// </summary>
- /// <returns></returns>
- [HttpPost("InsertReturnIdentity")]
- public ResponseResult InsertReturnIdentity([FromBody] MesWorkProd data)
- {
- try
- {
- dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.InsertReturnIdentity(data);
+ resultInfos.tbBillList = _manager.Insert(data);
return new ResponseResult
{
status = 0,
@@ -139,14 +117,14 @@
/// <summary>
/// 淇敼
/// </summary>
- /// <returns></returns>
+ /// <returns>淇敼缁撴灉</returns>
[HttpPost("Update")]
public ResponseResult Update([FromBody] MesWorkProd data)
{
try
{
dynamic resultInfos = new ExpandoObject();
- resultInfos.tbBillList = m.Update(data);
+ resultInfos.tbBillList = _manager.Update(data);
return new ResponseResult
{
status = 0,
@@ -159,4 +137,82 @@
return ResponseResult.ResponseError(ex);
}
}
+
+ #endregion
+
+ #region 鐢熶骇鎶ュ伐
+
+ /// <summary>
+ /// PDA鎵弿鐢熶骇鎶ュ伐
+ /// </summary>
+ /// <param name="request">鎶ュ伐璇锋眰鍙傛暟</param>
+ /// <returns>鎶ュ伐缁撴灉</returns>
+ /// <remarks>
+ /// 璇锋眰绀轰緥:
+ /// POST /api/MesWorkProd/ScanWork
+ /// {
+ /// "staffNo": "ST001",
+ /// "itemBarcode": "BC001",
+ /// "userNo": "admin"
+ /// }
+ /// </remarks>
+ /// <response code="200">鎵弿鎴愬姛</response>
+ /// <response code="400">鎵弿澶辫触锛岃繑鍥炲叿浣撻敊璇俊鎭�</response>
+ [HttpPost("ScanWork")]
+ public ResponseResult ScanWork([FromBody] ScanWorkRequest request)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.result = _manager.ScanWorkAsync(request);
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ /// <summary>
+ /// PDA鎵弿鐢熶骇鎶ュ伐(甯︽暟閲�)
+ /// </summary>
+ /// <param name="request">鎶ュ伐璇锋眰鍙傛暟</param>
+ /// <returns>鎶ュ伐缁撴灉</returns>
+ /// <remarks>
+ /// 璇锋眰绀轰緥:
+ /// POST /api/MesWorkProd/ScanWorkProd
+ /// {
+ /// "itemBarcode": "BC001",
+ /// "quantity": 10,
+ /// "userNo": "admin"
+ /// }
+ /// </remarks>
+ /// <response code="200">鎵弿鎴愬姛</response>
+ /// <response code="400">鎵弿澶辫触锛岃繑鍥炲叿浣撻敊璇俊鎭�</response>
+ [HttpPost("ScanWorkProd")]
+ public ResponseResult ScanWorkProd([FromBody] ScanWorkRequest request)
+ {
+ try
+ {
+ dynamic resultInfos = new ExpandoObject();
+ resultInfos.success = _manager.ScanWorkProdAsync(request);
+ return new ResponseResult
+ {
+ status = 0,
+ message = "OK",
+ data = resultInfos
+ };
+ }
+ catch (Exception ex)
+ {
+ return ResponseResult.ResponseError(ex);
+ }
+ }
+
+ #endregion
}
\ No newline at end of file
--
Gitblit v1.9.3