库存分析 不判断数量

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

No files matched your search

@@ -136,7 +136,7 @@ namespace HHWMS.Web
MaterialSpec = x.MaterialSpec, MaterialSpec = x.MaterialSpec,
MaterialUnit = x.MaterialUnit, MaterialUnit = x.MaterialUnit,
Batch = x.Batch, Batch = x.Batch,
//Lot = x.Lot, Lot = x.Lot,
//ManufactureDate = x.ManufactureDate, //ManufactureDate = x.ManufactureDate,
//ExpirationDate = x.ExpirationDate, //ExpirationDate = x.ExpirationDate,
//CompanyCode = x.CompanyCode, //CompanyCode = x.CompanyCode,
@@ -33,7 +33,7 @@ namespace HHWMS.Web.Controllers
[HttpPost] [HttpPost]
public ActionResult<dynamic> SelectReceiptCode() 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 }); .Select(x => new { label = x.Code, value = x.Code });
return JsonMore(data); return JsonMore(data);
} }
@@ -73,11 +73,6 @@ public class ReceiptShelfInController : BaseController
var header = receiptHeaderList.Find(x => x.ID.ToString().Equals(item.ReceiptCode)); var header = receiptHeaderList.Find(x => x.ID.ToString().Equals(item.ReceiptCode));
var receipt = header.ReceiptDetails.First(x => x.UniqueCode.Equals(item.UniqueCode)); var receipt = header.ReceiptDetails.First(x => x.UniqueCode.Equals(item.UniqueCode));
if (receipt != null) if (receipt != null)
{
if (receipt.Status == ReceiptStatusEnum.收完) continue;
receipt.CompletedQty += item.BindQty;
}
if(receipt.CompletedQty == receipt.Qty)
{ {
receipt.Status = ReceiptStatusEnum.收完; receipt.Status = ReceiptStatusEnum.收完;
if (!header.ReceiptDetails.Any(x => x.Status < ReceiptStatusEnum.收完)) if (!header.ReceiptDetails.Any(x => x.Status < ReceiptStatusEnum.收完))
@@ -91,6 +86,7 @@ public class ReceiptShelfInController : BaseController
invList.Add(new Inventory invList.Add(new Inventory
{ {
ZoneCode = ZoneCodeEnum.货架库, ZoneCode = ZoneCodeEnum.货架库,
LocationCode = item.BoxCode,
UniqueCode = item.UniqueCode, UniqueCode = item.UniqueCode,
MaterialCode = receipt.MaterialCode, MaterialCode = receipt.MaterialCode,
MaterialType = receipt.MaterialType, MaterialType = receipt.MaterialType,
@@ -99,7 +95,7 @@ public class ReceiptShelfInController : BaseController
Batch = receipt.Batch, Batch = receipt.Batch,
MaterialUnit = receipt.MaterialUnit, MaterialUnit = receipt.MaterialUnit,
SupplierCode = receipt.SupplierCode, SupplierCode = receipt.SupplierCode,
Qty = item.BindQty, Qty = receipt.Qty,
Status = "0", Status = "0",
TaskStatus = InventoryTaskStatus.无任务, TaskStatus = InventoryTaskStatus.无任务,
CreateBy = Wtm.LoginUserInfo.ITCode, CreateBy = Wtm.LoginUserInfo.ITCode,
@@ -1,7 +1,16 @@
<el-row id="slapp"> <el-row id="shelfapp">
<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" @@submit.native.prevent>
<el-row> <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-col :span="16">
<el-form-item label="唯一码" prop="uniqueCode"> <el-form-item label="唯一码" prop="uniqueCode">
<el-input v-model="form.uniqueCode" <el-input v-model="form.uniqueCode"
@@ -11,6 +20,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-table :data="bindingData" stripe max-height="450" border style="width: 100%"> <el-table :data="bindingData" stripe max-height="450" border style="width: 100%">
<el-table-column fixed="left" label="操作" width="120" align="center"> <el-table-column fixed="left" label="操作" width="120" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
@@ -21,6 +31,10 @@
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="位置"
align="center"
prop="boxCode">
</el-table-column>
<el-table-column label="唯一码" <el-table-column label="唯一码"
align="center" align="center"
prop="uniqueCode"> prop="uniqueCode">
@@ -48,11 +62,12 @@
<script> <script>
var app = new Vue({ var app = new Vue({
el: "#slapp", el: "#shelfapp",
data() { data() {
return { return {
form: { form: {
uniqueCode: "", uniqueCode: "",
locationCode: ""
}, },
bindingData: [] bindingData: []
}; };
@@ -149,6 +164,7 @@
materialName: json.Data.MaterialName, materialName: json.Data.MaterialName,
batch: json.Data.Batch, batch: json.Data.Batch,
bindQty: json.Data.Qty, bindQty: json.Data.Qty,
boxCode: _this.form.locationCode
}); });
} }
}, },
@@ -84,6 +84,30 @@ 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))
.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); var inv = _unitWork.FindSingle<Inventory>(x => x.UniqueCode.Equals(uniqueCode) && x.LocationCode == station);
if (inv != null) if (inv != null)
{ {
@@ -110,11 +134,22 @@ public class ShipOutController : BaseController
_unitWork.Add(invTran); _unitWork.Add(invTran);
_unitWork.Delete(inv); _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(); List<Inventory> list = _unitWork.Find<Inventory>(x => x.LocationCode == station).ToList();
if (list.Count() == 0) if (list.Count() == 0)
{ {
var Sation = _unitWork.Find<Location>(x => x.Code == station).FirstOrDefault(); //var Sation = _unitWork.Find<Location>(x => x.Code == station).FirstOrDefault();
if (Sation != null && Sation.Type == "L") if (Sation != null && Sation.Type == "T")
{ {
Sation.ContainerCode = ""; Sation.ContainerCode = "";
Sation.Height = 0; Sation.Height = 0;
@@ -255,9 +255,8 @@ namespace HHWMS.Web.Controllers
var details = data.FirstOrDefault().ShipmentDetails.Where(x => x.Status < ShipStatusEnum.分配完成); var details = data.FirstOrDefault().ShipmentDetails.Where(x => x.Status < ShipStatusEnum.分配完成);
foreach (var item in details) foreach (var item in details)
{ {
var invQty = _unitwork.Find<Inventory>(x => x.UniqueCode.Equals(item.UniqueCode)) var invQty = _unitwork.Find<Inventory>(x => x.UniqueCode.Equals(item.UniqueCode));
.Sum(x => x.Qty); item.InventoryStatus = invQty != null ? "满足" : "不足";
item.InventoryStatus = invQty >= (item.Qty - item.DividedQty) ? "满足" : "不足";
} }
return JsonMore(details); return JsonMore(details);
} }
@@ -318,40 +317,42 @@ namespace HHWMS.Web.Controllers
} }
shipment.UpdateBy = Wtm.LoginUserInfo.ITCode; shipment.UpdateBy = Wtm.LoginUserInfo.ITCode;
shipment.UpdateTime = DateTime.Now; shipment.UpdateTime = DateTime.Now;
_unitwork.Update(shipment);
var ids = data.Select(x => x.ID).ToList(); var ids = data.Select(x => x.ID).ToList();
var invList = _unitwork.Find<Inventory>(x => ids.Contains(x.ID)) if(ids.Count > 0) {
.ToList(); var invList = _unitwork.Find<Inventory>(x => ids.Contains(x.ID))
.ToList();
// 加入交易表 // 加入交易表
var listInvtran = new List<InventoryTransaction>(); var listInvtran = new List<InventoryTransaction>();
foreach (var inv in invList) foreach (var inv in invList)
{
listInvtran.Add(new InventoryTransaction
{ {
BillType = "out", listInvtran.Add(new InventoryTransaction
ZoneCode = inv.ZoneCode, {
BillCode = shipment.Code, BillType = "out",
Type = inv.UniqueCode, ZoneCode = inv.ZoneCode,
MaterialCode = inv.MaterialCode, BillCode = shipment.Code,
MaterialName = inv.MaterialName, Type = inv.UniqueCode,
MaterialSpec = inv.MaterialSpec, MaterialCode = inv.MaterialCode,
MaterialUnit = inv.MaterialUnit, MaterialName = inv.MaterialName,
MaterialType = inv.MaterialType, MaterialSpec = inv.MaterialSpec,
Batch = inv.Batch, MaterialUnit = inv.MaterialUnit,
Lot = inv.Lot, MaterialType = inv.MaterialType,
CompanyCode = inv.CompanyCode, Batch = inv.Batch,
LocationCode = inv.LocationCode, Lot = inv.Lot,
SupplierCode = inv.SupplierCode, CompanyCode = inv.CompanyCode,
Qty = inv.Qty, LocationCode = inv.LocationCode,
CreateTime = DateTime.Now SupplierCode = inv.SupplierCode,
}); Qty = inv.Qty,
} CreateTime = DateTime.Now
_unitwork.BatchAdd(listInvtran.ToArray()); });
}
_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); return JsonMore(null);
} }
@@ -6,6 +6,7 @@
<el-table :data="tableData" max-height="600" border <el-table :data="tableData" max-height="600" border
style="width: 100%" 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="唯一码" 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="MaterialCode"></el-table-column>
<el-table-column label="批次" align="center" prop="Batch"></el-table-column> <el-table-column label="批次" align="center" prop="Batch"></el-table-column>
@@ -51,7 +52,7 @@
methods: { methods: {
pick() { pick() {
var _this = this; var _this = this;
console.log(_this.tableData)
layer.confirm('确定执行一键拣货操作?', { icon: 3, title: '提示' }, layer.confirm('确定执行一键拣货操作?', { icon: 3, title: '提示' },
function (index) { function (index) {
$.ajax({ $.ajax({
@@ -107,10 +108,17 @@
"width": 562.5, "width": 562.5,
"textAlign": "center", "textAlign": "center",
"field": "table", "field": "table",
"columns": [[{ "columns": [[
{
"title": "位置",
"field": "LocationCode",
"width": 80,
"colspan": 1,
"rowspan": 1
}, {
"title": "唯一码", "title": "唯一码",
"field": "UniqueCode", "field": "UniqueCode",
"width": 180, "width": 120,
"colspan": 1, "colspan": 1,
"rowspan": 1 "rowspan": 1
}, { }, {
@@ -123,7 +131,7 @@
{ {
"title": "名称", "title": "名称",
"field": "MaterialName", "field": "MaterialName",
"width": 110, "width": 120,
"colspan": 1, "colspan": 1,
"rowspan": 1 "rowspan": 1
}, { }, {
@@ -58,16 +58,7 @@ namespace HHWMS.Web
_unitwork.Update(inventory); _unitwork.Update(inventory);
shiInventorys.Add(inventory); shiInventorys.Add(inventory);
shipmentDetail.DividedQty += inventory.Qty; shipmentDetail.Status = ShipStatusEnum.分配完成;
if (shipmentDetail.DividedQty >= shipmentDetail.Qty)
{
shipmentDetail.Status = ShipStatusEnum.分配完成;
break;
}
else
{
shipmentDetail.Status = ShipStatusEnum.分配中;
}
} }
shipmentDetail.UpdateTime = DateTime.Now; shipmentDetail.UpdateTime = DateTime.Now;
shipmentDetail.UpdateBy = "wmsjob"; shipmentDetail.UpdateBy = "wmsjob";
@@ -164,8 +155,7 @@ namespace HHWMS.Web
task.TaskDetails = new List<TaskDetail>(); task.TaskDetails = new List<TaskDetail>();
var inv = item.FirstOrDefault(); var inv = item.FirstOrDefault();
var location = _unitwork.Find<Location>(x => x.ContainerCode == item.Key var location = _unitwork.Find<Location>(x => x.ContainerCode == item.Key
&& x.Status != LocationStatus.空仓位 && x.Status != LocationStatus.空仓位).FirstOrDefault();
&& x.Status != LocationStatus.空容器).FirstOrDefault();
//查询仓位表是否符合 //查询仓位表是否符合
if (location != null) if (location != null)
{ {
+3
View File
@@ -1374,6 +1374,9 @@
<data name="ShipmentHeader.Analyse" xml:space="preserve"> <data name="ShipmentHeader.Analyse" xml:space="preserve">
<value>库位分析</value> <value>库位分析</value>
</data> </data>
<data name="ShipmentHeader.ShelfInv" xml:space="preserve">
<value>货架库存</value>
</data>
<data name="ShipmentHeader.StartOut" xml:space="preserve"> <data name="ShipmentHeader.StartOut" xml:space="preserve">
<value>启动出库</value> <value>启动出库</value>
</data> </data>
+7 -7
View File
@@ -27,18 +27,18 @@
// "Value": "Server=127.0.0.1;Port=3306;Database=8357wms;Uid=root;Password=abc123*;Character Set=utf8mb4;", // "Value": "Server=127.0.0.1;Port=3306;Database=8357wms;Uid=root;Password=abc123*;Character Set=utf8mb4;",
// "DBType": "mysql" // "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", // "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", // "DbContext": "DataContext",
// "DBType": "sqlserver" //DataBase, you can choose mysql,sqlserver,pgsql,sqlite,oracle // "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前缀 "CookiePre": "HHWMS", //cookie前缀
"IsQuickDebug": true, //是否启用debug模式 "IsQuickDebug": true, //是否启用debug模式