盘料入库页面,层号排序后再分配

添加货架库扫码捡货动作
添加异常出库单据清理任务
This commit is contained in:
zhougf committed 2024-05-09 18:28:40 +08:00
1 parent 9bfee8930c
commit caab84071c
5 files changed
+108 -62

No files matched your search

@@ -323,7 +323,7 @@
this.bindingData.push({ this.bindingData.push({
receiptCode: this.form.code, receiptCode: this.form.code,
boxCode: this.form.boxCode, boxCode: this.form.boxCode,
index: this.dataIndex.shift(), index: this.dataIndex.sort(function(a,b){return a-b}).shift(),
uniqueCode: data, uniqueCode: data,
size: this.form.size size: this.form.size
}) })
@@ -89,12 +89,14 @@ public class ShipOutController : BaseController
[HttpPost] [HttpPost]
public ActionResult Pick(string uniqueCode, decimal qty,string station) public ActionResult Pick(string uniqueCode, decimal qty,string station)
{ {
var shipment = _unitWork.Find<ShipmentDetail>(x => x.UniqueCode.Equals(uniqueCode))
.FirstOrDefault();
using (var tran = Wtm.DC.Database.BeginTransaction()) using (var tran = Wtm.DC.Database.BeginTransaction())
{ {
try try
{ {
var shipment = _unitWork.Find<ShipmentDetail>(x => x.UniqueCode.Equals(uniqueCode)
&& x.Status != ShipStatusEnum.拣货完成)
.FirstOrDefault();
if (shipment == null) if (shipment == null)
{ {
return JsonMore(null, 500, "未找到该出库单!"); return JsonMore(null, 500, "未找到该出库单!");
@@ -105,23 +107,11 @@ public class ShipOutController : BaseController
shipment.UpdateBy = Wtm.LoginUserInfo?.ITCode??"WMS"; shipment.UpdateBy = Wtm.LoginUserInfo?.ITCode??"WMS";
_unitWork.Update(shipment); _unitWork.Update(shipment);
var header = _unitWork.Find<ShipmentHeader>(x => x.ID.Equals(shipment.ShipmentHeaderId))
.FirstOrDefault();
var details = _unitWork.Find<ShipmentDetail>(x => x.ShipmentHeaderId == shipment.ShipmentHeaderId)
.ToList();
if (details.All(x => x.Status == ShipStatusEnum.拣货完成))
{
header.FirstStatus = ShipStatusEnum.拣货完成;
}
else
{
header.FirstStatus = ShipStatusEnum.拣货中;
}
header.UpdateTime = DateTime.Now;
header.UpdateBy = Wtm.LoginUserInfo?.ITCode??"WMS";
_unitWork.Update(header);
var inv = _unitWork.FindSingle<Inventory>(x => x.UniqueCode.Equals(uniqueCode) && x.LocationCode == station); var inv = _unitWork.FindSingle<Inventory>(x => x.UniqueCode.Equals(uniqueCode) && x.LocationCode == station);
if (inv == null && string.IsNullOrEmpty(station))
{
inv = _unitWork.FindSingle<Inventory>(x => x.UniqueCode.Equals(uniqueCode) && x.ZoneCode == ZoneCodeEnum.货架库);
}
if (inv != null) if (inv != null)
{ {
//回传MES //回传MES
@@ -182,7 +172,7 @@ public class ShipOutController : BaseController
CompanyCode = inv.CompanyCode, CompanyCode = inv.CompanyCode,
LocationCode = inv.LocationCode, LocationCode = inv.LocationCode,
SupplierCode = inv.SupplierCode, SupplierCode = inv.SupplierCode,
BillCode = header.Code, BillCode = shipment.ShipmentHeaderId.ToString(),
BillDetailId = shipment.ID, BillDetailId = shipment.ID,
ContainerCode = inv.ContainerCode, ContainerCode = inv.ContainerCode,
Qty = inv.Qty, Qty = inv.Qty,
@@ -214,6 +204,23 @@ public class ShipOutController : BaseController
} }
} }
// 更新单据状态
var header = _unitWork.Find<ShipmentHeader>(x => x.ID.Equals(shipment.ShipmentHeaderId))
.FirstOrDefault();
var details = _unitWork.Find<ShipmentDetail>(x => x.ShipmentHeaderId == shipment.ShipmentHeaderId)
.ToList();
if (details.All(x => x.Status == ShipStatusEnum.拣货完成))
{
header.FirstStatus = ShipStatusEnum.拣货完成;
}
else
{
header.FirstStatus = ShipStatusEnum.拣货中;
}
header.UpdateTime = DateTime.Now;
header.UpdateBy = Wtm.LoginUserInfo?.ITCode??"WMS";
_unitWork.Update(header);
// Wtm.DoLog("", ActionLogTypesEnum.Normal, "mes", request: JsonConvert.SerializeObject(request), result: "success"); // Wtm.DoLog("", ActionLogTypesEnum.Normal, "mes", request: JsonConvert.SerializeObject(request), result: "success");
tran.Commit(); tran.Commit();
return JsonMore(null); return JsonMore(null);
@@ -291,6 +291,7 @@ namespace HHWMS.Web.Controllers
var invList = _unitwork.Find<Inventory>(x => x.ZoneCode.Equals(ZoneCodeEnum.货架库) var invList = _unitwork.Find<Inventory>(x => x.ZoneCode.Equals(ZoneCodeEnum.货架库)
&& x.TaskStatus.Equals(InventoryTaskStatus.无任务) && x.TaskStatus.Equals(InventoryTaskStatus.无任务)
&& details.Contains(x.UniqueCode)) && details.Contains(x.UniqueCode))
.OrderBy(x => x.LocationCode)
.ToList(); .ToList();
//var details = data.ShipmentDetails.Where(x => invList.Contains(x.UniqueCode)); //var details = data.ShipmentDetails.Where(x => invList.Contains(x.UniqueCode));
return JsonMore(invList); return JsonMore(invList);
@@ -2,7 +2,7 @@
<el-card class="box-card" :span="16"> <el-card class="box-card" :span="16">
<el-form ref="form" :model="form" label-width="100px"> <el-form ref="form" :model="form" label-width="100px">
<el-row> <el-row>
<el-col :span="4"> <el-col :span="6">
<el-form-item label="类型" prop="type"> <el-form-item label="类型" prop="type">
<el-select v-model="form.type" <el-select v-model="form.type"
placeholder="请选择类型" placeholder="请选择类型"
@@ -91,7 +91,7 @@
taskType: [ taskType: [
{ label: "散料站台", value: "slbox" }, { label: "散料站台", value: "slbox" },
{ label: "料塔周转箱", value: "lt" }, { label: "料塔周转箱", value: "lt" },
// { label: "唯一码", value: "uniqueCode" }, { label: "货架库", value: "pk" },
], ],
invTable:[], invTable:[],
showTable: false, showTable: false,
@@ -109,6 +109,11 @@
}, },
// 扫描二维码 // 扫描二维码
scanUnique(data) { scanUnique(data) {
if (this.form.type == "pk") {
this.form.uniqueCode = data;
this.onSubmit();
}
else{
if (this.invTable.length == 0) { if (this.invTable.length == 0) {
this.$message({ this.$message({
message: "待拣物料列表为空!", message: "待拣物料列表为空!",
@@ -141,6 +146,7 @@
_this.onSubmit(); _this.onSubmit();
} }
}
}, },
select(data) { select(data) {
@@ -166,51 +172,54 @@
return; return;
} }
let url = ""; let url = "";
if (_this.form.type == "uniqueCode") { if (_this.form.type == "pk") {
url = "/shipment/ShipOut/ScanUniqueCode" // url = "/shipment/ShipOut/ScanUniqueCode"
// _this.form.uniqueCode = data;
//this.onSubmit();
} }
else{ else{
url = "/shipment/ShipOut/ScanBox" url = "/shipment/ShipOut/ScanBox"
}
$.ajax({ $.ajax({
type: "post", type: "post",
dataType: "json", dataType: "json",
data: { code: _this.form.code, type: _this.form.type }, data: { code: _this.form.code, type: _this.form.type },
url: url, url: url,
success: function (json) { success: function (json) {
if (json.Code != 200) { if (json.Code != 200) {
_this.$message({ _this.$message({
message: "扫描失败!" + json.Msg, message: "扫描失败!" + json.Msg,
type: "warning", type: "warning",
duration: "10000", duration: "10000",
}); });
_this.form.code = ""; _this.form.code = "";
} else {
if (_this.form.type == "uniqueCode") {
_this.form.uniqueCode = json.Data.UniqueCode;
_this.form.materialCode = json.Data.MaterialCode;
_this.form.materialSpec = json.Data.MaterialSpec;
_this.form.batch = json.Data.Batch;
_this.form.qty = json.Data.Qty;
} else { } else {
_this.showTable = true; if (_this.form.type == "uniqueCode") {
_this.invTable = json.Data; _this.form.uniqueCode = json.Data.UniqueCode;
if (_this.invTable.length == 0 _this.form.materialCode = json.Data.MaterialCode;
&& _this.form.type == "slbox" _this.form.materialSpec = json.Data.MaterialSpec;
&& _this.form.code.startsWith("C")) { _this.form.batch = json.Data.Batch;
_this.showBack = true; _this.form.qty = json.Data.Qty;
} else {
_this.showTable = true;
_this.invTable = json.Data;
if (_this.invTable.length == 0
&& _this.form.type == "slbox"
&& _this.form.code.startsWith("C")) {
_this.showBack = true;
}
} }
} }
} },
}, error: function (json) {
error: function (json) { _this.$message({
_this.$message({ message: "扫描失败!",
message: "扫描失败!", type: "error",
type: "error", duration: "10000",
duration: "10000", });
}); },
}, });
}); }
}, },
// 拣货 // 拣货
onSubmit() { onSubmit() {
@@ -245,8 +254,9 @@
&& _this.form.code.startsWith("C")) { && _this.form.code.startsWith("C")) {
_this.showBack = true; _this.showBack = true;
} }
if (_this.form.code == "uniqueCode") { if (_this.form.type == "pk") {
_this.form.code = ""; _this.form.code = "";
_this.form.uniqueCode = "";
} }
// 清空下面表单 不清空code // 清空下面表单 不清空code
_this.form.uniqueCode = ""; _this.form.uniqueCode = "";
@@ -261,6 +271,10 @@
type: "warning", type: "warning",
duration: "10000", duration: "10000",
}); });
if (_this.form.type == "pk"){
_this.form.code = "";
_this.form.uniqueCode = "";
}
} }
}, },
error: function (json) { error: function (json) {
@@ -2,6 +2,7 @@ using System;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using HHWMS.Web.Models; using HHWMS.Web.Models;
using Microsoft.EntityFrameworkCore;
using Quartz; using Quartz;
using WalkingTec.Mvvm.Core; using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions; using WalkingTec.Mvvm.Core.Extensions;
@@ -28,6 +29,29 @@ namespace HHWMS.Web
{ {
_unitwork.BatchDelete<ShipmentHeader>(x => x.FirstStatus == ShipStatusEnum.拣货完成); _unitwork.BatchDelete<ShipmentHeader>(x => x.FirstStatus == ShipStatusEnum.拣货完成);
} }
// 清理当前之前的状态不正确的出库单
var errorShip = _unitwork.Find<ShipmentHeader>(x =>
x.FirstStatus < ShipStatusEnum.拣货完成
&& x.FirstStatus > ShipStatusEnum.新建
&& x.CreateTime < DateTime.Now.AddDays(-1))
.Include(u => u.ShipmentDetails)
.ToList();
foreach (var ship in errorShip)
{
if (ship.ShipmentDetails.All(x => x.Status != ShipStatusEnum.新建))
{
var invs = _unitwork.Find<Inventory>(x =>
ship.ShipmentDetails.Select(y => y.UniqueCode).ToList()
.Contains(x.UniqueCode))
.Count();
if (invs == 0)
{
_unitwork.Delete(errorShip);
}
}
}
Wtm.DoLog("清理过期单据", ActionLogTypesEnum.Job, "TestJob"); Wtm.DoLog("清理过期单据", ActionLogTypesEnum.Job, "TestJob");
#region 更新时间 #region 更新时间