| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- 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.Data.SqlClient;
- using System.Data;
- namespace Procurement.Controllers
- {
- [Produces("application/json")]
- [Route("api/wms/[controller]")]
- public class BarcodeTraceController : AbpController
- {
- private readonly ISqlRepository _repository;
- public BarcodeTraceController(ISqlRepository sqlRepository)
- {
- _repository = sqlRepository;
- }
- [HttpGet]
- public async Task<IActionResult> Get(string domain, string barcode)
- {
- ResultCode code = ResultCode.Success, subCode = ResultCode.Success;
- string subMsg = "";
- dynamic items = null;
- try
- {
- SqlParameter[] parameters = {
- new SqlParameter { ParameterName = "@Domain", Value = domain,SqlDbType=SqlDbType.VarChar},
- new SqlParameter { ParameterName = "@BarCode", Value = barcode,SqlDbType=SqlDbType.VarChar},
- };
- items = await _repository.GetListByProcAsync("pr_WMS_GetBarcodeTraceList", parameters);
- }
- catch (Exception ex)
- {
- subMsg = ex.Message;
- code = ResultCode.Fail;
- subCode = ResultCode.Fail;
- }
- ResultViewModel result = ResultHelper.CreateResult(code, items, subCode, subMsg);
- return Ok(result);
- }
- [Route("hist")]
- [HttpGet]
- public async Task<IActionResult> Hist(string domain, string type, string barcode = "", int recid = 0)
- {
- ResultCode code = ResultCode.Success, subCode = ResultCode.Success;
- string subMsg = "";
- dynamic items = null;
- try
- {
- SqlParameter[] parameters = {
- new SqlParameter { ParameterName = "@Domain", Value = domain,SqlDbType=SqlDbType.VarChar},
- new SqlParameter { ParameterName = "@Type", Value = type,SqlDbType=SqlDbType.VarChar},
- new SqlParameter { ParameterName = "@BarCode", Value = barcode,SqlDbType=SqlDbType.VarChar},
- new SqlParameter { ParameterName = "@RecID", Value = recid,SqlDbType=SqlDbType.BigInt},
- };
- items = await _repository.GetListByProcAsync("pr_WMS_GetBarcodeTransHistList", parameters);
- }
- catch (Exception ex)
- {
- subMsg = ex.Message;
- code = ResultCode.Fail;
- subCode = ResultCode.Fail;
- }
- ResultViewModel result = ResultHelper.CreateResult(code, items, subCode, subMsg);
- return Ok(result);
- }
- [Route("single")]
- [HttpGet]
- public async Task<IActionResult> SingleBarCode(string domain, string barcode, bool isapp = false)
- {
- ResultCode code = ResultCode.Success, subCode = ResultCode.Success;
- string subMsg = "";
- dynamic items = null;
- try
- {
- SqlParameter[] parameters = {
- new SqlParameter { ParameterName = "@Domain", Value = domain,SqlDbType=SqlDbType.VarChar},
- new SqlParameter { ParameterName = "@BarCode", Value = barcode,SqlDbType=SqlDbType.VarChar},
- new SqlParameter { ParameterName = "@IsApp", Value = isapp,SqlDbType=SqlDbType.Int},
- };
- items = await _repository.GetListByProcAsync("pr_SFM_SingleLabelBarcodeTrackHist", parameters);
- }
- catch (Exception ex)
- {
- subMsg = ex.Message;
- code = ResultCode.Fail;
- subCode = ResultCode.Fail;
- }
- ResultViewModel result = ResultHelper.CreateResult(code, items, subCode, subMsg);
- return Ok(result);
- }
- }
- }
|