123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- using Microsoft.AspNetCore.Authorization;
- using Microsoft.AspNetCore.Mvc;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using XYY.Authentication.Standard;
- using XYY.Common.Standard;
- using XYY.Core.Standard.Mvc;
- using XYY.Model.Standard.Dto.MpsOrder;
- using XYY.Model.Standard.MpsOrder;
- using XYY.Service.Standard.Order;
- namespace XYY.Api.Order.Controllers
- {
- [Route("api/[controller]/[action]")]
- [ApiController]
- public class GetMoreThanOneTicketMpsController : ApiControllerBase
- {
- IMoreThanOneTicketService orderService;
- public GetMoreThanOneTicketMpsController(IMoreThanOneTicketService orderService)
- {
- this.orderService = orderService;
- }
- [HttpGet]
- public async Task<ApiJsonModel<Order_MpsOrder>> Get([FromQuery] int orderId, [FromQuery] int draftOrderId)
- {
- var result = await this.orderService.Get(orderId, draftOrderId);
- return ApiJsonModel<Order_MpsOrder>.OK(result);
- }
- [HttpPost]
- public async Task<IActionResult> ConfirmCustomerOrderReceipt(ConfirmCustomerOrderReceiptInput data)
- {
- var result = await orderService.ConfirmCustomerOrderReceipt(data);
- return Ok(result);
- }
- [HttpPost]
- public async Task<IActionResult> ModifyCreateOrderChannelId(MpsModifyCreateOrderChannelId mpsModify)
- {
- var u = User.GetUserContent();
- await orderService.ModifyCreateOrderChannelId(mpsModify, u);
- return Ok();
- }
- public async Task<IActionResult> CustomerOrderOut(string InputNumber, int opStatus)
- {
- var result = await orderService.CustomerOrderOut(InputNumber, opStatus);
- return Ok(result);
- }
- public async Task<IActionResult> BoxStatusOp(int boxId, BoxStatus boxStatus)
- {
- await orderService.BoxStatusOp(boxId, boxStatus);
- return Ok();
- }
- public class OutBoxDataInfo
- {
- public string orderIds
- {
- get; set;
- }
- }
- [AllowAnonymous]
- public async Task<IActionResult> OutBoxData(OutBoxDataInfo dataInfo)
- {
- if (string.IsNullOrEmpty(dataInfo.orderIds))
- throw new Exception("请传入需要下单的订单ID");
- var u = User.GetUserContent();
- byte[] data = await orderService.OutBoxInfo(dataInfo.orderIds.SplitToArray<int>(), u.Roles.Contains("FBA末端重量查看"));
- return File(data, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
- }
- [HttpPost]
- public async Task<IActionResult> UpdateMpsOrder(UpdateMpsOrderInfo updateMpsOrderInfo)
- {
- await orderService.UpdateMpsOrder(updateMpsOrderInfo);
- return Ok();
- }
- [AllowAnonymous]
- [HttpPost]
- public async Task<IActionResult> OutMpsOrderData(OutBoxDataInfo dataInfo)
- {
- if (string.IsNullOrEmpty(dataInfo.orderIds))
- throw new Exception("请传入需要下单的订单ID");
- byte[] data = await orderService.OutMpsOrderData(dataInfo.orderIds.SplitToArray<int>());
- return File(data, "application/x-zip-compressed");
- }
- /// <summary>
- /// 导入箱子信息
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public async Task<IActionResult> ImportMpsBoxInfo()
- {
- var filelist = (await Request.ReadFormAsync()).Files;
- if (filelist != null && filelist.Count > 0)
- {
- var u = User.GetUserContent();
- string userName = u.NiceName;
- if (!u.Roles.Contains("FBA末端重量修改")) { throw new Exception("抱歉,您无权限进行此操作!"); }
- var file = filelist[0];
- var result = await orderService.ImportMpsBoxInfo(file.OpenReadStream(), userName);
- return Ok(result);
- }
- else
- {
- return Error("请上传一个文件");
- }
- }
- /// <summary>
- /// 导入末端订单信息
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public async Task<IActionResult> ImportFBAChannelOrder()
- {
- var filelist = (await Request.ReadFormAsync()).Files;
- if (filelist != null && filelist.Count > 0)
- {
- var u = User.GetUserContent();
- string userName = u.NiceName;
- if (!u.Roles.Contains("FBA末端重量修改")) { throw new Exception("抱歉,您无权限进行此操作!"); }
- var file = filelist[0];
- var result = await orderService.ImportFBAChannelOrder(file.OpenReadStream());
- return Ok(result);
- }
- else
- {
- return Error("请上传一个文件");
- }
- }
- [AllowAnonymous]
- [HttpPost]
- public async Task<IActionResult> Recalculate663Billing()
- {
- await orderService.RecalculateBilling();
- return Ok();
- }
- [AllowAnonymous]
- [HttpPost]
- public async Task<IActionResult> RecalculateCustomerFee()
- {
- await orderService.RecalculateCustomerFee();
- return Ok();
- }
- }
- }
|