库存分析 不判断数量
货架出入库加上库位信息 分解订单不判断数量 分拣完成后,更新出库单据信息
This commit is contained in:
1 parent
6a1329d74e
commit
54b51891a0
10 files changed
+117
-68
No files matched your search
@@ -84,6 +84,30 @@ public class ShipOutController : BaseController
|
||||
[HttpPost]
|
||||
public ActionResult Pick(string uniqueCode, decimal qty,string station)
|
||||
{
|
||||
var shipment = _unitWork.Find<ShipmentDetail>(x => x.UniqueCode.Equals(uniqueCode))
|
||||
.Include(x => x.ShipmentHeader)
|
||||
.FirstOrDefault();
|
||||
if (shipment == null)
|
||||
{
|
||||
return JsonMore(null, 500, "未找到该出库单!");
|
||||
}
|
||||
shipment.Status = ShipStatusEnum.拣货完成;
|
||||
shipment.UpdateTime = DateTime.Now;
|
||||
shipment.UpdateBy = Wtm.LoginUserInfo.ITCode;
|
||||
|
||||
|
||||
if (!shipment.ShipmentHeader.ShipmentDetails.Any(x => x.Status < ShipStatusEnum.拣货完成))
|
||||
{
|
||||
shipment.ShipmentHeader.FirstStatus = ShipStatusEnum.拣货完成;
|
||||
}
|
||||
else
|
||||
{
|
||||
shipment.ShipmentHeader.FirstStatus = ShipStatusEnum.拣货中;
|
||||
}
|
||||
shipment.UpdateBy = Wtm.LoginUserInfo.ITCode;
|
||||
shipment.UpdateTime = DateTime.Now;
|
||||
_unitWork.Update(shipment);
|
||||
|
||||
var inv = _unitWork.FindSingle<Inventory>(x => x.UniqueCode.Equals(uniqueCode) && x.LocationCode == station);
|
||||
if (inv != null)
|
||||
{
|
||||
@@ -110,11 +134,22 @@ public class ShipOutController : BaseController
|
||||
_unitWork.Add(invTran);
|
||||
|
||||
_unitWork.Delete(inv);
|
||||
var Sation = _unitWork.Find<Location>(x => x.Code == station).FirstOrDefault();
|
||||
if (Sation != null && Sation.Type == "T")
|
||||
{
|
||||
Sation.Height -= 1;
|
||||
if (Sation.Height <= 0)
|
||||
{
|
||||
Sation.Height = 0;
|
||||
Sation.ContainerCode = "";
|
||||
}
|
||||
_unitWork.Update(Sation);
|
||||
}
|
||||
List<Inventory> list = _unitWork.Find<Inventory>(x => x.LocationCode == station).ToList();
|
||||
if (list.Count() == 0)
|
||||
{
|
||||
var Sation = _unitWork.Find<Location>(x => x.Code == station).FirstOrDefault();
|
||||
if (Sation != null && Sation.Type == "L")
|
||||
//var Sation = _unitWork.Find<Location>(x => x.Code == station).FirstOrDefault();
|
||||
if (Sation != null && Sation.Type == "T")
|
||||
{
|
||||
Sation.ContainerCode = "";
|
||||
Sation.Height = 0;
|
||||
|
||||
@@ -255,9 +255,8 @@ namespace HHWMS.Web.Controllers
|
||||
var details = data.FirstOrDefault().ShipmentDetails.Where(x => x.Status < ShipStatusEnum.分配完成);
|
||||
foreach (var item in details)
|
||||
{
|
||||
var invQty = _unitwork.Find<Inventory>(x => x.UniqueCode.Equals(item.UniqueCode))
|
||||
.Sum(x => x.Qty);
|
||||
item.InventoryStatus = invQty >= (item.Qty - item.DividedQty) ? "满足" : "不足";
|
||||
var invQty = _unitwork.Find<Inventory>(x => x.UniqueCode.Equals(item.UniqueCode));
|
||||
item.InventoryStatus = invQty != null ? "满足" : "不足";
|
||||
}
|
||||
return JsonMore(details);
|
||||
}
|
||||
@@ -318,40 +317,42 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
shipment.UpdateBy = Wtm.LoginUserInfo.ITCode;
|
||||
shipment.UpdateTime = DateTime.Now;
|
||||
_unitwork.Update(shipment);
|
||||
|
||||
var ids = data.Select(x => x.ID).ToList();
|
||||
var invList = _unitwork.Find<Inventory>(x => ids.Contains(x.ID))
|
||||
.ToList();
|
||||
|
||||
if(ids.Count > 0) {
|
||||
var invList = _unitwork.Find<Inventory>(x => ids.Contains(x.ID))
|
||||
.ToList();
|
||||
|
||||
// 加入交易表
|
||||
var listInvtran = new List<InventoryTransaction>();
|
||||
foreach (var inv in invList)
|
||||
{
|
||||
listInvtran.Add(new InventoryTransaction
|
||||
// 加入交易表
|
||||
var listInvtran = new List<InventoryTransaction>();
|
||||
foreach (var inv in invList)
|
||||
{
|
||||
BillType = "out",
|
||||
ZoneCode = inv.ZoneCode,
|
||||
BillCode = shipment.Code,
|
||||
Type = inv.UniqueCode,
|
||||
MaterialCode = inv.MaterialCode,
|
||||
MaterialName = inv.MaterialName,
|
||||
MaterialSpec = inv.MaterialSpec,
|
||||
MaterialUnit = inv.MaterialUnit,
|
||||
MaterialType = inv.MaterialType,
|
||||
Batch = inv.Batch,
|
||||
Lot = inv.Lot,
|
||||
CompanyCode = inv.CompanyCode,
|
||||
LocationCode = inv.LocationCode,
|
||||
SupplierCode = inv.SupplierCode,
|
||||
Qty = inv.Qty,
|
||||
CreateTime = DateTime.Now
|
||||
});
|
||||
}
|
||||
_unitwork.BatchAdd(listInvtran.ToArray());
|
||||
listInvtran.Add(new InventoryTransaction
|
||||
{
|
||||
BillType = "out",
|
||||
ZoneCode = inv.ZoneCode,
|
||||
BillCode = shipment.Code,
|
||||
Type = inv.UniqueCode,
|
||||
MaterialCode = inv.MaterialCode,
|
||||
MaterialName = inv.MaterialName,
|
||||
MaterialSpec = inv.MaterialSpec,
|
||||
MaterialUnit = inv.MaterialUnit,
|
||||
MaterialType = inv.MaterialType,
|
||||
Batch = inv.Batch,
|
||||
Lot = inv.Lot,
|
||||
CompanyCode = inv.CompanyCode,
|
||||
LocationCode = inv.LocationCode,
|
||||
SupplierCode = inv.SupplierCode,
|
||||
Qty = inv.Qty,
|
||||
CreateTime = DateTime.Now
|
||||
});
|
||||
}
|
||||
_unitwork.BatchAdd(listInvtran.ToArray());
|
||||
|
||||
// 删除库存
|
||||
_unitwork.BatchDelete<Inventory>(x => data.Select(u => u.ID).Contains(x.ID));
|
||||
// 删除库存
|
||||
_unitwork.BatchDelete<Inventory>(x => data.Select(u => u.ID).Contains(x.ID));
|
||||
}
|
||||
return JsonMore(null);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<el-table :data="tableData" max-height="600" border
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-table-column label="位置" align="center" prop="LocationCode"></el-table-column>
|
||||
<el-table-column label="唯一码" width="220" align="center" prop="UniqueCode"></el-table-column>
|
||||
<el-table-column label="编码" align="center" prop="MaterialCode"></el-table-column>
|
||||
<el-table-column label="批次" align="center" prop="Batch"></el-table-column>
|
||||
@@ -51,7 +52,7 @@
|
||||
methods: {
|
||||
pick() {
|
||||
var _this = this;
|
||||
console.log(_this.tableData)
|
||||
|
||||
layer.confirm('确定执行一键拣货操作?', { icon: 3, title: '提示' },
|
||||
function (index) {
|
||||
$.ajax({
|
||||
@@ -107,10 +108,17 @@
|
||||
"width": 562.5,
|
||||
"textAlign": "center",
|
||||
"field": "table",
|
||||
"columns": [[{
|
||||
"columns": [[
|
||||
{
|
||||
"title": "位置",
|
||||
"field": "LocationCode",
|
||||
"width": 80,
|
||||
"colspan": 1,
|
||||
"rowspan": 1
|
||||
}, {
|
||||
"title": "唯一码",
|
||||
"field": "UniqueCode",
|
||||
"width": 180,
|
||||
"width": 120,
|
||||
"colspan": 1,
|
||||
"rowspan": 1
|
||||
}, {
|
||||
@@ -123,7 +131,7 @@
|
||||
{
|
||||
"title": "名称",
|
||||
"field": "MaterialName",
|
||||
"width": 110,
|
||||
"width": 120,
|
||||
"colspan": 1,
|
||||
"rowspan": 1
|
||||
}, {
|
||||
|
||||
Reference in new issue
Block a user