123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402 |
- 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.Finance;
- using XYY.Model.Standard.MpsOrder;
- using XYY.Model.Standard.MpsOrder.dto;
- using XYY.Model.Standard.MpsOrder.views;
- using XYY.Service.Standard.Order.FBA;
- namespace XYY.Api.Order.Controllers.FBA
- {
- [Route("api/[controller]/[action]")]
- [ApiController]
- public class FBAOrderController : ApiControllerBase
- {
- IFBAOrderService orderService;
- public FBAOrderController(IFBAOrderService orderService)
- {
- this.orderService = orderService;
- }
- #region 空派收件
- public async Task<IActionResult> GetReceivingInfo(QueryModel queryModel)
- {
- if (queryModel?.QueryParamer != null && queryModel.QueryParamer.Any(x => x.Filed == "IsGoodsNames"))
- {
- var tempParamer = queryModel.QueryParamer.Where(x => x.Filed == "IsGoodsNames").FirstOrDefault();
- if (tempParamer.Value == "1") { queryModel.QueryParamer.Add(new QueryParamer() { Filed = "GoodsNames", Method = "IsNotNl", Value = "" }); }
- else if (tempParamer.Value == "2") { queryModel.QueryParamer.Add(new QueryParamer() { Filed = "GoodsNames", Method = "IsNl", Value = "" }); }
- queryModel.QueryParamer.Remove(tempParamer);
- }
- var data = await this.orderService.GetReceivingInfo(queryModel);
- return Ok(data);
- }
- public async Task<IActionResult> GetReceivingBoxs(int Id)
- {
- var data = await this.orderService.GetReceivingBoxs(new List<int>() { Id });
- return Ok(data);
- }
- public async Task<IActionResult> GetReceivingBoxsByIds(IEnumerable<int> Ids)
- {
- var data = await this.orderService.GetReceivingBoxs(Ids);
- return Ok(data);
- }
- public async Task<IActionResult> UpdateReceivingBoxs(List<Order_MpsOrderBox> boxs)
- {
- var data = await this.orderService.UpdateReceivingBoxs(boxs);
- return Ok(data);
- }
- public async Task<IActionResult> GoToPrint(IEnumerable<int> Ids)
- {
- var data = await this.orderService.GoToPrint(Ids);
- return Ok(data);
- }
- public async Task<IActionResult> UpdateFile(string BoxNumber)
- {
- var boxPicInfo = await orderService.GetBoxPictureOrderInfo(BoxNumber);
- var filelist = (await Request.ReadFormAsync()).Files;
- foreach (var file in filelist)
- {
- var result = await orderService.UpdateBoxPicture(boxPicInfo, file.OpenReadStream());
- }
- return Ok();
- }
- public async Task<IActionResult> GetBoxPictures(string BoxNumber)
- {
- var data = await orderService.GetBoxPictures(BoxNumber);
- return Ok(data);
- }
- public async Task<IActionResult> RemoveBoxPicture(int[] PicIds)
- {
- var data = await orderService.RemoveBoxPicture(PicIds);
- return Ok(data);
- }
- [HttpPost]
- public async Task<IActionResult> ImportMpsBoxAddresseeInfo()
- {
- var filelist = (await Request.ReadFormAsync()).Files;
- if (filelist != null && filelist.Count > 0)
- {
- var u = User.GetUserContent();
- string userName = u.NiceName;
- var file = filelist[0];
- var result = await orderService.ImportMpsBoxAddresseeInfo(file.OpenReadStream(), userName);
- return Ok(result);
- }
- else
- {
- return Error("请上传一个文件");
- }
- }
- #endregion
- //public async Task<IActionResult> GetOrderReceivingInfo(int orderId)
- //{
- // var data = await this.orderService.GetOrderReceivingInfo(orderId);
- // return Ok(data);
- //}
- //public async Task<IActionResult> SaveOrderRceiveingInfo(View_Order_ReceivingInfo View_Order_ReceivingInfo)
- //{
- // await this.orderService.SaveOrderRceiveingInfo(View_Order_ReceivingInfo);
- // return Ok();
- //}
- #region 空派打单
- public async Task<IActionResult> GetPrintList(QueryModel queryModel)
- {
- if (queryModel?.QueryParamer != null && queryModel.QueryParamer.Any(x => x.Filed == "IsXYY"))
- {
- var tempParamer = queryModel.QueryParamer.Where(x => x.Filed == "IsXYY").FirstOrDefault();
- if (tempParamer.Value == "1") { queryModel.QueryParamer.Add(new QueryParamer() { Filed = "LEFT(TrackingNumber,3)", Method = "NotEq", Value = "XYY" }); }
- else if (tempParamer.Value == "2") { queryModel.QueryParamer.Add(new QueryParamer() { Filed = "LEFT(TrackingNumber,3)", Method = "Eq", Value = "XYY" }); }
- queryModel.QueryParamer.Remove(tempParamer);
- }
- if (queryModel?.QueryParamer != null && queryModel.QueryParamer.Any(x => x.Filed == "IsOrderPrintQty"))
- {
- var tempParamer = queryModel.QueryParamer.Where(x => x.Filed == "IsOrderPrintQty").FirstOrDefault();
- if (tempParamer.Value == "1") { queryModel.QueryParamer.Add(new QueryParamer() { Filed = "isnull(OrderPrintQty,0)", Method = "Eq", Value = "1" }); }
- else if (tempParamer.Value == "2") { queryModel.QueryParamer.Add(new QueryParamer() { Filed = "isnull(OrderPrintQty,0)", Method = "Eq", Value = "0" }); }
- queryModel.QueryParamer.Remove(tempParamer);
- }
- var data = await this.orderService.GetPrintList(queryModel);
- return Ok(data);
- }
- public async Task<IActionResult> GetPrint(int orderId)
- {
- var data = await this.orderService.GetPrint(orderId);
- return Ok(data);
- }
- public async Task<IActionResult> GetReceivingBoxsGoods(int Id)
- {
- var data = await this.orderService.GetReceivingGoods(Id);
- return Ok(data);
- }
- public async Task<IActionResult> GetReceivingAddress(int Id)
- {
- var data = await this.orderService.GetReceivingAddress(Id);
- return Ok(data);
- }
- public async Task<IActionResult> UpdatePrintBoxs(MpsPrint boxs)
- {
- var data = await this.orderService.UpdatePrintBoxs(boxs);
- return Ok(data);
- }
- public async Task<IActionResult> GoToIncome(IEnumerable<int> Ids)
- {
- var data = await this.orderService.GoToIncome(Ids);
- return Ok(data);
- }
- public async Task<IActionResult> UpdateOrderPrintQty(int orderId, bool OrderPrintQty)
- {
- var data = await this.orderService.UpdateOrderPrintQty(orderId, OrderPrintQty);
- return Ok(data);
- }
- public async Task<IActionResult> BatchUpdateOrderPrintQty(IEnumerable<int> Ids)
- {
- var data = await this.orderService.BatchUpdateOrderPrintQty(Ids);
- return Ok(data);
- }
- #endregion
- //public async Task<IActionResult> SavePrintInfos(View_Order_Print View_Order_ReceivingInfo)
- //{
- // await this.orderService.SavePrintInfos(View_Order_ReceivingInfo);
- // return Ok();
- //}
- #region 空派收入
- public async Task<IActionResult> GetCustomerConfirmList(QueryModel queryModel)
- {
- //判断用户角色
- var u = User.GetUserContent();
- if (u.Roles.Contains("销售"))
- {
- if (queryModel?.QueryParamer != null)
- { queryModel.QueryParamer.Add(new QueryParamer() { Filed = "NickName", Method = "Eq", Value = u.NiceName }); }
- else
- { queryModel.QueryParamer = new List<QueryParamer>(); queryModel.QueryParamer.Add(new QueryParamer() { Filed = "NickName", Method = "Eq", Value = u.NiceName }); }
- }
- if (queryModel?.QueryParamer != null && queryModel.QueryParamer.Any(x => x.Filed == "IsConfim"))
- {
- var tempParamer = queryModel.QueryParamer.Where(x => x.Filed == "IsConfim").FirstOrDefault();
- if (tempParamer.Value == "1") { queryModel.QueryParamer.Add(new QueryParamer() { Filed = "isnull(SalesmanConfirmFee,0)", Method = "Gr", Value = "0" }); }
- else if (tempParamer.Value == "2") { queryModel.QueryParamer.Add(new QueryParamer() { Filed = "isnull(SalesmanConfirmFee,0)", Method = "LeE", Value = "0" }); }
- queryModel.QueryParamer.Remove(tempParamer);
- }
- var data = await this.orderService.GetCustomerConfirmList(queryModel);
- return Ok(data);
- }
- public async Task<IActionResult> GetCustomerConfirm(int orderId)
- {
- var data = await this.orderService.GetCustomerConfirm(orderId);
- return Ok(data);
- }
- public async Task<IActionResult> UpdateCustomerConfirm(MpsCustomerConfirm dto)
- {
- var data = await this.orderService.UpdateCustomerConfirm(dto);
- return Ok(data);
- }
- public async Task<IActionResult> GetBatchConfirmWeight(IEnumerable<int> Ids)
- {
- var data = await this.orderService.GetBatchConfirmWeight(Ids);
- return Ok(data);
- }
- public async Task<IActionResult> UpdateBatchConfirmWeight(List<ConfirmWeight> confirmWeights)
- {
- var data = await this.orderService.UpdateBatchConfirmWeight(confirmWeights);
- return Ok();
- }
- public async Task<IActionResult> GetBatchConfirmIncidenta(IEnumerable<int> Ids)
- {
- var data = await this.orderService.GetBatchIncidenta(Ids, XYY.Model.Standard.Finance.FBAIncidentalCalculateTarget.客户);
- data = data.OrderBy(x => x.OrderId).ToList();
- return Ok(data);
- }
- public async Task<IActionResult> UpdateBatchConfirmIncidenta(List<FBA_Incidental> incidentals)
- {
- var data = await this.orderService.UpdateBatchConfirmIncidenta(incidentals);
- return Ok();
- }
- public async Task<IActionResult> GoToSettlement(IEnumerable<int> Ids)
- {
- var u = User.GetUserContent();
- var data = await this.orderService.GoToSettlement(Ids, u.NiceName);
- return Ok(data);
- }
- public async Task<IActionResult> ExportWaitConfirm(IEnumerable<int> Ids)
- {
- byte[] data = await orderService.ExportWaitConfirm(Ids);
- return File(data, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", DateTime.Now.ToString_yyyyMMddHHmm() + ".xls");
- }
- public async Task<IActionResult> GetBoxIDCR(Order_MpsOrderBox box)
- {
- string data = await orderService.GetBoxIDCR(box);
- return Ok(data);
- }
- public async Task<IActionResult> SalesmanConfirmFee(int Id)
- {
- var data = await orderService.SalesmanConfirmFee(Id);
- return Ok(data);
- }
- /// <summary>
- /// 修改创建渠道
- /// </summary>
- /// <returns></returns>
- [HttpPost]
- public async Task<IActionResult> ModifyCreateOrderChannelId(MpsModifyCreateOrderChannelId mpsModify)
- {
- var u = User.GetUserContent();
- await orderService.ModifyCreateOrderChannelId(mpsModify, u);
- return Ok();
- }
- //修复一下新增的计算计费 实重/泡重 数据
- public async Task<IActionResult> RepairSettlementData(List<int> Ids)
- {
- var data = await orderService.RepairSettlementData(Ids);
- return Ok(data);
- }
- #endregion
- #region 单价获取
- public async Task<IActionResult> GetUnitPrice(KPUnitPriceRequest request)
- {
- var data = await this.orderService.GetUnitPrice(request);
- return Ok(data);
- }
- #endregion
- #region 结算
- public async Task<IActionResult> GetSettlementConfirmList(QueryModel queryModel)
- {
- if (queryModel?.QueryParamer != null && queryModel.QueryParamer.Any(x => x.Filed == "IsConfim"))
- {
- var tempParamer = queryModel.QueryParamer.Where(x => x.Filed == "IsConfim").FirstOrDefault();
- if (tempParamer.Value == "1") { queryModel.QueryParamer.Add(new QueryParamer() { Filed = "isnull(IsSettlementConfirm,0)", Method = "Eq", Value = "1" }); }
- else if (tempParamer.Value == "2") { queryModel.QueryParamer.Add(new QueryParamer() { Filed = "isnull(IsSettlementConfirm,0)", Method = "Eq", Value = "0" }); }
- queryModel.QueryParamer.Remove(tempParamer);
- }
- var data = await this.orderService.GetSettlementConfirmList(queryModel);
- return Ok(data);
- }
- public async Task<IActionResult> ExportEnd(QueryModel queryModel)
- {
- if (queryModel?.QueryParamer != null && queryModel.QueryParamer.Any(x => x.Filed == "IsConfim"))
- {
- var tempParamer = queryModel.QueryParamer.Where(x => x.Filed == "IsConfim").FirstOrDefault();
- if (tempParamer.Value == "1") { queryModel.QueryParamer.Add(new QueryParamer() { Filed = "isnull(IsSettlementConfirm,0)", Method = "Eq", Value = "1" }); }
- else if (tempParamer.Value == "2") { queryModel.QueryParamer.Add(new QueryParamer() { Filed = "isnull(IsSettlementConfirm,0)", Method = "Eq", Value = "0" }); }
- queryModel.QueryParamer.Remove(tempParamer);
- }
- byte[] data = await orderService.ExportSettlementConfirm(queryModel);
- return File(data, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", DateTime.Now.ToString_yyyyMMddHHmm() + ".xls");
- }
- public async Task<IActionResult> GetSettlementConfirm(int orderId)
- {
- var data = await this.orderService.GetSettlementConfirm(orderId);
- return Ok(data);
- }
- public async Task<IActionResult> GetBatchSettlementWeight(IEnumerable<int> Ids)
- {
- var data = await this.orderService.GetBatchSettlementWeight(Ids);
- return Ok(data);
- }
- public async Task<IActionResult> UpdateBatchSettlementWeight(List<ConfirmWeight> confirmWeights)
- {
- var data = await this.orderService.UpdateBatchSettlementWeight(confirmWeights);
- return Ok();
- }
- public async Task<IActionResult> UpdateSettlementConfirm(MpsSettlementConfirm dto)
- {
- var data = await this.orderService.UpdateSettlementConfirm(dto);
- return Ok(data);
- }
- public async Task<IActionResult> GetBatchSettlementIncidenta(IEnumerable<int> Ids)
- {
- var data = await this.orderService.GetBatchIncidenta(Ids, XYY.Model.Standard.Finance.FBAIncidentalCalculateTarget.结算价);
- data = data.OrderBy(x => x.OrderId).ToList();
- return Ok(data);
- }
- public async Task<IActionResult> UpdateBatchSettlementIncidenta(List<FBA_Incidental> incidentals)
- {
- var data = await this.orderService.UpdateBatchSettlementIncidenta(incidentals);
- return Ok();
- }
- public async Task<IActionResult> UpdateSettlementConfirmForTable(MpsSettlementConfirmTableData dto)
- {
- var data = await this.orderService.UpdateSettlementConfirmForTable(dto);
- return Ok(data);
- }
- public async Task<IActionResult> SettlementConfirmOperation(int orderId)
- {
- var u = User.GetUserContent();
- var data = await this.orderService.SettlementConfirmOperation(orderId, u.NiceName);
- return Ok(data);
- }
- public async Task<IActionResult> GoToEnd(IEnumerable<int> Ids)
- {
- var u = User.GetUserContent();
- var data = await this.orderService.GoToEnd(Ids, u.NiceName);
- return Ok(data);
- }
- //重算订单结算数据
- public async Task<IActionResult> recalculationOrderSettlementPrice(List<int> Ids)
- {
- await orderService.CalculateSettlementPrice(Ids);
- return Ok();
- }
- #endregion
- public async Task<IActionResult> SaveCustomerConfirm(View_Order_CustomerConfirm View_Order_CustomerConfirm)
- {
- await this.orderService.SaveCustomerConfirm(View_Order_CustomerConfirm);
- return Ok();
- }
- public async Task<IActionResult> SaveSettlementConfirm(View_Order_SettlementConfirm View_Order_SettlementConfirm)
- {
- await this.orderService.SaveSettlementConfirm(View_Order_SettlementConfirm);
- return Ok();
- }
- #region 合计报表
- public async Task<IActionResult> GetGrossProfitByCustomer(QueryModel queryModel)
- {
- var data = await orderService.GetGrossProfitByCustomer(queryModel);
- return Ok(data);
- }
- public async Task<IActionResult> GetGrossProfitByOrder(QueryModel queryModel)
- {
- //判断用户角色
- var u = User.GetUserContent();
- if (u.Roles.Contains("销售"))
- {
- if (queryModel?.QueryParamer != null)
- { queryModel.QueryParamer.Add(new QueryParamer() { Filed = "NickName", Method = "Eq", Value = u.NiceName }); }
- else
- { queryModel.QueryParamer = new List<QueryParamer>(); queryModel.QueryParamer.Add(new QueryParamer() { Filed = "NickName", Method = "Eq", Value = u.NiceName }); }
- }
- var data = await orderService.GetGrossProfitByOrder(queryModel);
- return Ok(data);
- }
- #endregion
- }
- }
|