Files
8357WMS/HHWMS.Web/Areas/Receipt/Controllers/ReceiptInController.cs
T
2023-08-21 23:41:26 +08:00

78 lines
2.2 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()
{
return PartialView("Index");
}
[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; }
}
}