散料入库
This commit is contained in:
1 parent
630e33a27a
commit
2097bffabb
6 files changed
+388
-247
No files matched your search
@@ -1,35 +1,91 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using HHWMS.Web.Models;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
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
|
||||
namespace HHWMS.Web.Controllers;
|
||||
|
||||
[Area("receipt")]
|
||||
[ActionDescription("散料操作")]
|
||||
public class ReceiptSLInController : BaseController
|
||||
{
|
||||
[Area("receipt")]
|
||||
[ActionDescription("散料操作")]
|
||||
public partial class ReceiptSLInController : BaseController
|
||||
private readonly IUnitWork _unitWork;
|
||||
|
||||
public ReceiptSLInController(IUnitWork unitWork)
|
||||
{
|
||||
private readonly IUnitWork _unitwork;
|
||||
public ReceiptSLInController(IUnitWork unitwork)
|
||||
{
|
||||
_unitwork = unitwork;
|
||||
}
|
||||
#region Search
|
||||
[ActionDescription("Sys.Search")]
|
||||
public ActionResult Index()
|
||||
{
|
||||
return PartialView("Index");
|
||||
}
|
||||
_unitWork = unitWork;
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region Search
|
||||
|
||||
[ActionDescription("Sys.Search")]
|
||||
public ActionResult Index()
|
||||
{
|
||||
return PartialView("Index");
|
||||
}
|
||||
#endregion
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult CallBox()
|
||||
{
|
||||
// 查询站台占用
|
||||
var stations = _unitWork.Find<Location>(x => (x.Code == StationCode.散料库左抽屉
|
||||
|| x.Code == StationCode.散料库右抽屉)
|
||||
&& x.Status != LocationStatus.任务锁).ToList();
|
||||
if (stations.Count == 0) return JsonMore(null, 500, "无可用站台!");
|
||||
|
||||
// 查找没任务的仓位,分两边查,那边站台能用 查哪边
|
||||
var box = _unitWork.Find<Location>(x => (x.ZoneCode == ZoneCodeEnum.散料库)
|
||||
& (x.Status != LocationStatus.任务锁)
|
||||
&& x.Status != LocationStatus.满货
|
||||
&& x.Status != LocationStatus.空仓位
|
||||
&& x.Row == stations.First().Row).FirstOrDefault();
|
||||
if (box == null && stations.Count == 2)
|
||||
box = _unitWork.Find<Location>(x => (x.ZoneCode == ZoneCodeEnum.散料库)
|
||||
& (x.Status != LocationStatus.任务锁)
|
||||
&& x.Status != LocationStatus.满货
|
||||
&& x.Status != LocationStatus.空仓位
|
||||
&& x.Row == stations.Last().Row).FirstOrDefault();
|
||||
|
||||
if (box == null) return JsonMore(null, 500, "库内没有可用散料箱!");
|
||||
|
||||
var toLocation = box.Row == 1 ? StationCode.散料库右抽屉 : StationCode.散料库左抽屉;
|
||||
// 创建任务
|
||||
var task = new TaskHeader
|
||||
{
|
||||
ZoneCode = ZoneCodeEnum.散料库,
|
||||
TaskNo = _unitWork.GetSerialNumber("SOut"),
|
||||
TaskType = TaskTypeEnum.散料盒出库,
|
||||
ContainerCode = box.ContainerCode,
|
||||
FromLocation = box.Code,
|
||||
ToLocation = toLocation,
|
||||
Status = TaskStatusEnum.新建,
|
||||
CreateTime = DateTime.Now,
|
||||
CreateBy = Wtm.LoginUserInfo.ITCode
|
||||
};
|
||||
_unitWork.Add(task);
|
||||
return JsonMore(null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 扫描唯一码,并验证,返回入库单明细
|
||||
/// </summary>
|
||||
/// <param name="uniqueCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public ActionResult ScanUniqueCode(string uniqueCode)
|
||||
{
|
||||
var receiptDetail = _unitWork.FindSingle<ReceiptDetail>(x => x.UniqueCode.Equals(uniqueCode));
|
||||
if (receiptDetail != null)
|
||||
{
|
||||
if (receiptDetail.Status == ReceiptStatusEnum.收完)
|
||||
{
|
||||
return JsonMore(null, 500, $"{uniqueCode}已绑定,无需重新绑定!");
|
||||
}
|
||||
return JsonMore(receiptDetail);
|
||||
}
|
||||
return JsonMore(null, 500, $"{uniqueCode}不存在!");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user