拣货完成,回传库存信息到mes,数量为0
修改回库库存新增交易表bug 出库页面和功能整改
This commit is contained in:
1 parent
11ea24c544
commit
aacf491051
3 files changed
+103
-14
No files matched your search
@@ -360,7 +360,8 @@ namespace HHWMS.Web
|
|||||||
if(task.TaskType == TaskTypeEnum.盘料盒入库
|
if(task.TaskType == TaskTypeEnum.盘料盒入库
|
||||||
|| task.TaskType == TaskTypeEnum.散料盒入库)
|
|| task.TaskType == TaskTypeEnum.散料盒入库)
|
||||||
{
|
{
|
||||||
var invList = _unitwork.Find<Inventory>(x => x.ContainerCode == task.ContainerCode)
|
var invList = _unitwork.Find<Inventory>(x => x.ContainerCode == task.ContainerCode
|
||||||
|
&& x.TaskStatus == InventoryTaskStatus.任务中)
|
||||||
.ToList();
|
.ToList();
|
||||||
var listInvtran = new List<InventoryTransaction>();
|
var listInvtran = new List<InventoryTransaction>();
|
||||||
foreach (var inv in invList)
|
foreach (var inv in invList)
|
||||||
|
|||||||
@@ -2,8 +2,11 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using HHWMS.Web.Models;
|
using HHWMS.Web.Models;
|
||||||
|
using MESTOWMSService;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using ServiceReference1;
|
||||||
using WalkingTec.Mvvm.Core;
|
using WalkingTec.Mvvm.Core;
|
||||||
using WalkingTec.Mvvm.Mvc;
|
using WalkingTec.Mvvm.Mvc;
|
||||||
|
|
||||||
@@ -34,16 +37,17 @@ public class ShipOutController : BaseController
|
|||||||
/// 扫描散料箱/盘料周转箱 返回待出库明细
|
/// 扫描散料箱/盘料周转箱 返回待出库明细
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="code"></param>
|
/// <param name="code"></param>
|
||||||
|
/// <param name="type"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult ScanBox(string code)
|
public ActionResult ScanBox(string code, string type)
|
||||||
{
|
{
|
||||||
Location box = new Location();
|
Location box = new Location();
|
||||||
if (code.Contains("C"))
|
if (type.Contains("slbox"))
|
||||||
{
|
{
|
||||||
box = _unitWork.FindSingle<Location>(x => x.Code.Equals(code) && x.Type == LocationTypeEnum.散料库站台);
|
box = _unitWork.FindSingle<Location>(x => x.Code.Equals(code) && x.Type == LocationTypeEnum.散料库站台);
|
||||||
}
|
}
|
||||||
else if (code.Contains("L"))
|
else if (type.Contains("lt"))
|
||||||
{
|
{
|
||||||
box = _unitWork.FindSingle<Location>(x => x.Code.Equals(code) && x.Type == LocationTypeEnum.料塔);
|
box = _unitWork.FindSingle<Location>(x => x.Code.Equals(code) && x.Type == LocationTypeEnum.料塔);
|
||||||
}
|
}
|
||||||
@@ -87,6 +91,10 @@ public class ShipOutController : BaseController
|
|||||||
var shipment = _unitWork.Find<ShipmentDetail>(x => x.UniqueCode.Equals(uniqueCode))
|
var shipment = _unitWork.Find<ShipmentDetail>(x => x.UniqueCode.Equals(uniqueCode))
|
||||||
.Include(x => x.ShipmentHeader)
|
.Include(x => x.ShipmentHeader)
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
|
using (var tran = Wtm.DC.Database.BeginTransaction())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
if (shipment == null)
|
if (shipment == null)
|
||||||
{
|
{
|
||||||
return JsonMore(null, 500, "未找到该出库单!");
|
return JsonMore(null, 500, "未找到该出库单!");
|
||||||
@@ -110,6 +118,45 @@ public class ShipOutController : BaseController
|
|||||||
|
|
||||||
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)
|
||||||
|
{
|
||||||
|
//回传MES
|
||||||
|
var qr = _unitWork.FindSingle<MaterialQr>(x => x.UniqueCode.Equals(inv.UniqueCode))?.QRCode;
|
||||||
|
|
||||||
|
var bizData = new InStore
|
||||||
|
{
|
||||||
|
INWMS = new INWMS
|
||||||
|
{
|
||||||
|
INITEMS = new INITEMS
|
||||||
|
{
|
||||||
|
INITEM = new List<INITEMItem>()
|
||||||
|
{
|
||||||
|
new INITEMItem()
|
||||||
|
{
|
||||||
|
ERPSN = qr,
|
||||||
|
WMSSN = inv?.UniqueCode,
|
||||||
|
QTY = "0",
|
||||||
|
TYPE = "2",
|
||||||
|
FLAG = "1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var str = JsonConvert.SerializeObject(bizData);
|
||||||
|
var request = new ServiceReference1.bizOperationV1Request
|
||||||
|
{
|
||||||
|
fromUnit = "8357S",
|
||||||
|
toUnit = "8357TEST",
|
||||||
|
fromSys = "WMSTEST",
|
||||||
|
toSys = "MES",
|
||||||
|
bizOperation = "InStore",
|
||||||
|
bizData = str
|
||||||
|
};
|
||||||
|
var client = new ServiceReference1.portTypeClient();
|
||||||
|
var result = client.bizOperationV1Async(request).Result;
|
||||||
|
//var result = new bizOperationV1Response();
|
||||||
|
//result.Status = "Y";
|
||||||
|
if (result.Status == "Y")
|
||||||
{
|
{
|
||||||
// 删除库存,扣账,记录库存交易 todo,根据站台查询是否还有未拣货的物料,如果没有就清空站台占用
|
// 删除库存,扣账,记录库存交易 todo,根据站台查询是否还有未拣货的物料,如果没有就清空站台占用
|
||||||
|
|
||||||
@@ -132,8 +179,8 @@ public class ShipOutController : BaseController
|
|||||||
CreateTime = DateTime.Now
|
CreateTime = DateTime.Now
|
||||||
};
|
};
|
||||||
_unitWork.Add(invTran);
|
_unitWork.Add(invTran);
|
||||||
|
|
||||||
_unitWork.Delete(inv);
|
_unitWork.Delete(inv);
|
||||||
|
|
||||||
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 == "T")
|
if (Sation != null && Sation.Type == "T")
|
||||||
{
|
{
|
||||||
@@ -157,10 +204,30 @@ public class ShipOutController : BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return JsonMore(inv);
|
Wtm.DoLog("", ActionLogTypesEnum.Normal, "mes", request: JsonConvert.SerializeObject(request), result: "success");
|
||||||
|
tran.Commit();
|
||||||
|
return JsonMore(null);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tran.Rollback();
|
||||||
|
Wtm.DoLog("", ActionLogTypesEnum.Normal, "mes", request: JsonConvert.SerializeObject(request), result: "error");
|
||||||
|
return JsonMore(null, 500, $"回传MES失败,失败原因{result.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tran.Rollback();
|
||||||
return JsonMore(null, 500, $"站台{station}上的{uniqueCode}不存在!");
|
return JsonMore(null, 500, $"站台{station}上的{uniqueCode}不存在!");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
tran.Rollback();
|
||||||
|
return JsonMore(null, 500, $"拣货失败,失败原因{ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 散料箱回库,捡完回库
|
/// 散料箱回库,捡完回库
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="4">
|
<el-col :span="4">
|
||||||
<el-form-item label="类型" prop="type">
|
<el-form-item label="类型" prop="type">
|
||||||
<el-select v-model="type"
|
<el-select v-model="form.type"
|
||||||
placeholder="请选择类型"
|
placeholder="请选择类型"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
@@change="select"
|
@@change="select"
|
||||||
@@ -109,11 +109,17 @@
|
|||||||
select(data) {
|
select(data) {
|
||||||
this.form.code = "";
|
this.form.code = "";
|
||||||
this.form.type = data;
|
this.form.type = data;
|
||||||
|
this.invTable = [];
|
||||||
|
if (this.invTable.length == 0
|
||||||
|
&& this.form.type == "slbox"
|
||||||
|
&& this.form.code.startsWith("C")) {
|
||||||
|
this.showBack = true;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 扫描料塔站台号
|
// 扫描料塔站台号
|
||||||
scanCode(data) {
|
scanCode(data) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
if (_this.type == "") {
|
if (_this.form.type == "") {
|
||||||
_this.$message({
|
_this.$message({
|
||||||
message: "请先选择操作类型!",
|
message: "请先选择操作类型!",
|
||||||
type: "warning",
|
type: "warning",
|
||||||
@@ -123,7 +129,7 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let url = "";
|
let url = "";
|
||||||
if (_this.type == "uniqueCode") {
|
if (_this.form.type == "uniqueCode") {
|
||||||
url = "/shipment/ShipOut/ScanUniqueCode"
|
url = "/shipment/ShipOut/ScanUniqueCode"
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@@ -132,7 +138,7 @@
|
|||||||
$.ajax({
|
$.ajax({
|
||||||
type: "post",
|
type: "post",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
data: { code: _this.form.code },
|
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) {
|
||||||
@@ -141,8 +147,9 @@
|
|||||||
type: "warning",
|
type: "warning",
|
||||||
duration: "10000",
|
duration: "10000",
|
||||||
});
|
});
|
||||||
|
_this.form.code = "";
|
||||||
} else {
|
} else {
|
||||||
if (_this.type == "uniqueCode") {
|
if (_this.form.type == "uniqueCode") {
|
||||||
_this.form.uniqueCode = json.Data.UniqueCode;
|
_this.form.uniqueCode = json.Data.UniqueCode;
|
||||||
_this.form.materialCode = json.Data.MaterialCode;
|
_this.form.materialCode = json.Data.MaterialCode;
|
||||||
_this.form.materialSpec = json.Data.MaterialSpec;
|
_this.form.materialSpec = json.Data.MaterialSpec;
|
||||||
@@ -151,6 +158,11 @@
|
|||||||
} else {
|
} else {
|
||||||
_this.showTable = true;
|
_this.showTable = true;
|
||||||
_this.invTable = json.Data;
|
_this.invTable = json.Data;
|
||||||
|
if (_this.invTable.length == 0
|
||||||
|
&& _this.form.type == "slbox"
|
||||||
|
&& _this.form.code.startsWith("C")) {
|
||||||
|
_this.showBack = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -166,7 +178,14 @@
|
|||||||
// 拣货
|
// 拣货
|
||||||
onSubmit() {
|
onSubmit() {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
|
if (_this.form.uniqueCode == "") {
|
||||||
|
_this.$message({
|
||||||
|
message: "未选择出库明细!",
|
||||||
|
type: "warning",
|
||||||
|
duration: "10000",
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 提交已绑定数据
|
// 提交已绑定数据
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "post",
|
type: "post",
|
||||||
@@ -184,7 +203,9 @@
|
|||||||
arr.splice(index, 1);
|
arr.splice(index, 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (_this.invTable.length == 0 && _this.form.type == "slbox") {
|
if (_this.invTable.length == 0
|
||||||
|
&& _this.form.type == "slbox"
|
||||||
|
&& _this.form.code.startsWith("C")) {
|
||||||
_this.showBack = true;
|
_this.showBack = true;
|
||||||
}
|
}
|
||||||
_this.$refs['form'].resetFields();
|
_this.$refs['form'].resetFields();
|
||||||
@@ -209,7 +230,7 @@
|
|||||||
back() {
|
back() {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
// 创建回库任务
|
// 创建回库任务
|
||||||
if (_this.code == "") {
|
if (_this.form.code == "") {
|
||||||
_this.$message({
|
_this.$message({
|
||||||
message: "箱号为空,不能创建回库任务!",
|
message: "箱号为空,不能创建回库任务!",
|
||||||
type: "error",
|
type: "error",
|
||||||
|
|||||||
Reference in new issue
Block a user