库存分析 不判断数量

货架出入库加上库位信息
分解订单不判断数量
分拣完成后,更新出库单据信息
This commit is contained in:
zgf 2023-11-28 16:25:00 +08:00
parent 6a1329d74e
commit 54b51891a0
10 changed files with 117 additions and 68 deletions

View File

@ -136,7 +136,7 @@ namespace HHWMS.Web
MaterialSpec = x.MaterialSpec,
MaterialUnit = x.MaterialUnit,
Batch = x.Batch,
//Lot = x.Lot,
Lot = x.Lot,
//ManufactureDate = x.ManufactureDate,
//ExpirationDate = x.ExpirationDate,
//CompanyCode = x.CompanyCode,

View File

@ -33,7 +33,7 @@ namespace HHWMS.Web.Controllers
[HttpPost]
public ActionResult<dynamic> SelectReceiptCode()
{
var data = _unitWork.Find<ReceiptHeader>(x => x.FirstStatus <= ReceiptStatusEnum.收完)
var data = _unitWork.Find<ReceiptHeader>(x => x.FirstStatus < ReceiptStatusEnum.收完)
.Select(x => new { label = x.Code, value = x.Code });
return JsonMore(data);
}

View File

@ -73,11 +73,6 @@ public class ReceiptShelfInController : BaseController
var header = receiptHeaderList.Find(x => x.ID.ToString().Equals(item.ReceiptCode));
var receipt = header.ReceiptDetails.First(x => x.UniqueCode.Equals(item.UniqueCode));
if (receipt != null)
{
if (receipt.Status == ReceiptStatusEnum.收完) continue;
receipt.CompletedQty += item.BindQty;
}
if(receipt.CompletedQty == receipt.Qty)
{
receipt.Status = ReceiptStatusEnum.收完;
if (!header.ReceiptDetails.Any(x => x.Status < ReceiptStatusEnum.收完))
@ -91,6 +86,7 @@ public class ReceiptShelfInController : BaseController
invList.Add(new Inventory
{
ZoneCode = ZoneCodeEnum.货架库,
LocationCode = item.BoxCode,
UniqueCode = item.UniqueCode,
MaterialCode = receipt.MaterialCode,
MaterialType = receipt.MaterialType,
@ -99,7 +95,7 @@ public class ReceiptShelfInController : BaseController
Batch = receipt.Batch,
MaterialUnit = receipt.MaterialUnit,
SupplierCode = receipt.SupplierCode,
Qty = item.BindQty,
Qty = receipt.Qty,
Status = "0",
TaskStatus = InventoryTaskStatus.无任务,
CreateBy = Wtm.LoginUserInfo.ITCode,

View File

@ -1,7 +1,16 @@
<el-row id="slapp">
<el-row id="shelfapp">
<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" @@submit.native.prevent>
<el-row>
<el-col :span="16">
<el-form-item label="位置" prop="locationCode">
<el-input v-model="form.locationCode"
ref="locationCode">
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="16">
<el-form-item label="唯一码" prop="uniqueCode">
<el-input v-model="form.uniqueCode"
@ -11,6 +20,7 @@
</el-form-item>
</el-col>
</el-row>
<el-table :data="bindingData" stripe max-height="450" border style="width: 100%">
<el-table-column fixed="left" label="操作" width="120" align="center">
<template slot-scope="scope">
@ -21,6 +31,10 @@
</el-button>
</template>
</el-table-column>
<el-table-column label="位置"
align="center"
prop="boxCode">
</el-table-column>
<el-table-column label="唯一码"
align="center"
prop="uniqueCode">
@ -48,11 +62,12 @@
<script>
var app = new Vue({
el: "#slapp",
el: "#shelfapp",
data() {
return {
form: {
uniqueCode: "",
locationCode: ""
},
bindingData: []
};
@ -149,6 +164,7 @@
materialName: json.Data.MaterialName,
batch: json.Data.Batch,
bindQty: json.Data.Qty,
boxCode: _this.form.locationCode
});
}
},

View File

@ -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;

View File

@ -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);
}

View File

@ -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
}, {

View File

@ -58,16 +58,7 @@ namespace HHWMS.Web
_unitwork.Update(inventory);
shiInventorys.Add(inventory);
shipmentDetail.DividedQty += inventory.Qty;
if (shipmentDetail.DividedQty >= shipmentDetail.Qty)
{
shipmentDetail.Status = ShipStatusEnum.分配完成;
break;
}
else
{
shipmentDetail.Status = ShipStatusEnum.分配中;
}
shipmentDetail.Status = ShipStatusEnum.分配完成;
}
shipmentDetail.UpdateTime = DateTime.Now;
shipmentDetail.UpdateBy = "wmsjob";
@ -164,8 +155,7 @@ namespace HHWMS.Web
task.TaskDetails = new List<TaskDetail>();
var inv = item.FirstOrDefault();
var location = _unitwork.Find<Location>(x => x.ContainerCode == item.Key
&& x.Status != LocationStatus.空仓位
&& x.Status != LocationStatus.空容器).FirstOrDefault();
&& x.Status != LocationStatus.空仓位).FirstOrDefault();
//查询仓位表是否符合
if (location != null)
{

View File

@ -1374,6 +1374,9 @@
<data name="ShipmentHeader.Analyse" xml:space="preserve">
<value>库位分析</value>
</data>
<data name="ShipmentHeader.ShelfInv" xml:space="preserve">
<value>货架库存</value>
</data>
<data name="ShipmentHeader.StartOut" xml:space="preserve">
<value>启动出库</value>
</data>

View File

@ -27,18 +27,18 @@
// "Value": "Server=127.0.0.1;Port=3306;Database=8357wms;Uid=root;Password=abc123*;Character Set=utf8mb4;",
// "DBType": "mysql"
//}
{
"Key": "default",
"Value": "Data Source=.;Initial Catalog=8357wms;User=sa;Password=abc123*;Persist Security Info=True",
"DbContext": "DataContext",
"DBType": "sqlserver" //DataBase, you can choose mysql,sqlserver,pgsql,sqlite,oracle
}
//{
// "Key": "default",
// "Value": "Data Source=10.18.106.4;Initial Catalog=8357wms;User=wms;Password=abc123*;Persist Security Info=True",
// "Value": "Data Source=.;Initial Catalog=8357wms;User=sa;Password=abc123*;Persist Security Info=True",
// "DbContext": "DataContext",
// "DBType": "sqlserver" //DataBase, you can choose mysql,sqlserver,pgsql,sqlite,oracle
//}
{
"Key": "default",
"Value": "Data Source=10.18.106.4;Initial Catalog=8357wms;User=wms;Password=abc123*;Persist Security Info=True",
"DbContext": "DataContext",
"DBType": "sqlserver" //DataBase, you can choose mysql,sqlserver,pgsql,sqlite,oracle
}
],
"CookiePre": "HHWMS", //cookie前缀
"IsQuickDebug": true, //是否启用debug模式