8357WMS/HHWMS.Web/Areas/Receipt/Controllers/ReceiptInController.cs

89 lines
2.6 KiB
C#

using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Mvc;
using WalkingTec.Mvvm.Core.Extensions;
using HHWMS.Web;
using HHWMS.Web.Models;
using Microsoft.EntityFrameworkCore;
using System.Linq;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace HHWMS.Web.Controllers
{
[Area("receipt")]
[ActionDescription("入库单操作")]
public partial class ReceiptInController : BaseController
{
private readonly IUnitWork _unitwork;
public ReceiptInController(IUnitWork unitwork)
{
_unitwork = unitwork;
}
#region Search
[ActionDescription("Sys.Search")]
public ActionResult Index()
{
var vm = Wtm.CreateVM<ReceiptInListVM>();
return PartialView(vm);
}
/* [ActionDescription("Sys.Search")]
[HttpPost]
public string Search(ReceiptDetailListVM vm)
{
vm.Searcher.Page = vm.FC.GetValue<int>("Page");
vm.Searcher.Limit = vm.FC.GetValue<int>("Limit");
vm.Searcher.ReceiptHeaderId = vm.FC.GetValue<int>("Code");
return vm.GetJson(false);
}*/
[HttpPost]
public ActionResult<dynamic> SelectReceiptCode()
{
var data = _unitwork.Find<ReceiptHeader>(x => x.FirstStatus < ReceiptStatusEnum.回传)
.Select(x => new { label = x.Code, value = x.Code });
return JsonMore(data);
}
[HttpPost]
public ActionResult<dynamic> SelectReceipt(string Code)
{
var data = _unitwork.Find<ReceiptHeader>(x => x.Code == Code).Include(x => x.ReceiptDetails).FirstOrDefault();
if(data != null)
{
var result = data.ReceiptDetails.Select(x => new { name = x.MaterialCode });
return JsonMore(result);
}
else
{
return JsonMore(null);
}
}
/// <summary>
/// 入库盘料绑定操作
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
[HttpPost]
public dynamic BindingData(List<Binding> data)
{
// 查找明细,修改对应状态,并且 绑定物料周转箱
return new ApiJsonResult<object> { Success = true };
}
#endregion
}
public class Binding
{
public string UniqueCode { get; set; }
public string BoxCode { get; set; }
public int Index { get; set; }
public int Size { get; set; }
}
}