| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- using Procurement.Enums;
- using Microsoft.AspNetCore.Mvc;
- using System;
- using System.Threading.Tasks;
- using Volo.Abp.AspNetCore.Mvc;
- using Procurement.EntityFrameworkCore.SqlRepositories;
- using Procurement.ViewModel;
- using Procurement.Helpers;
- using System.Text.Json;
- using System.Data.SqlClient;
- namespace Procurement.Controllers
- {
- [Produces("application/json")]
- [Route("api/wms/[controller]")]
- public class PurOrdRctBarcodeController : AbpController
- {
- private readonly ISqlRepository _repository;
- public PurOrdRctBarcodeController(ISqlRepository sqlRepository)
- {
- _repository = sqlRepository;
- }
- /// <summary>
- /// 保存收货
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public async Task<IActionResult> Post([FromBody] JsonElement jsonElement)
- {
- if (jsonElement.ValueKind == JsonValueKind.Undefined || jsonElement.ValueKind == JsonValueKind.Null)
- {
- return BadRequest();
- }
- ResultCode code = ResultCode.Fail, subCode = ResultCode.Fail;
- string subMsg = "";
- try
- {
- string proc = "pr_WMS_BPM_RctPurOrdAndPurOrdByBarcode";
- SqlParameter[] sqlParams = SqlHelper.CreateSqlParameters(jsonElement);
- var resultData = await _repository.GetResultByProcAsync(proc, sqlParams);
- subMsg = resultData.msg;
- if (resultData.isSuccess)
- {
- code = ResultCode.Success;
- subCode = ResultCode.Success;
- }
- }
- catch (Exception ex)
- {
- subMsg = ex.Message;
- code = ResultCode.Fail;
- subCode = ResultCode.Fail;
- }
- ResultViewModel result = ResultHelper.CreateResult(code, null, subCode, subMsg);
- return Ok(result);
- }
- /// <summary>
- /// 检验确认后重新点数收货
- /// </summary>
- /// <returns></returns>
- [Route("reconfirmqty")]
- [HttpPost]
- public async Task<IActionResult> ReconfirmQty([FromBody] JsonElement jsonElement)
- {
- if (jsonElement.ValueKind == JsonValueKind.Undefined || jsonElement.ValueKind == JsonValueKind.Null)
- {
- return BadRequest();
- }
- ResultCode code = ResultCode.Fail, subCode = ResultCode.Fail;
- string subMsg = "";
- try
- {
- string proc = "pr_WMS_SavePurOrdRctByReconfirmQty";
- SqlParameter[] sqlParams = SqlHelper.CreateSqlParameters(jsonElement);
- var resultData = await _repository.GetResultByProcAsync(proc, sqlParams);
- subMsg = resultData.msg;
- if (resultData.isSuccess)
- {
- code = ResultCode.Success;
- subCode = ResultCode.Success;
- }
- }
- catch (Exception ex)
- {
- subMsg = ex.Message;
- code = ResultCode.Fail;
- subCode = ResultCode.Fail;
- }
- ResultViewModel result = ResultHelper.CreateResult(code, null, subCode, subMsg);
- return Ok(result);
- }
- /// <summary>
- /// 保存供应商标签
- /// </summary>
- /// <returns></returns>
- [Route("suppbarcode")]
- [HttpPost]
- public async Task<IActionResult> SuppBarCode([FromBody] JsonElement jsonElement)
- {
- if (jsonElement.ValueKind == JsonValueKind.Undefined || jsonElement.ValueKind == JsonValueKind.Null)
- {
- return BadRequest();
- }
- ResultCode code = ResultCode.Success, subCode = ResultCode.Success;
- string subMsg = "";
- dynamic items = null;
- try
- {
- string proc = "pr_WMS_CreateBarCodeSuppCode";
- SqlParameter[] sqlParams = SqlHelper.CreateSqlParameters(jsonElement);
- items = await _repository.GetListByProcAsync(proc, sqlParams);
- }
- catch (Exception ex)
- {
- subMsg = ex.Message;
- code = ResultCode.Fail;
- subCode = ResultCode.Fail;
- }
- ResultViewModel result = ResultHelper.CreateResult(code, items, subCode, subMsg);
- return Ok(result);
- }
- }
- }
|