单据明细点数

This commit is contained in:
zgf 2023-08-31 13:43:43 +08:00
parent 2459d4664a
commit bdaaa0d5d9
7 changed files with 838 additions and 73 deletions

View File

@ -54,79 +54,127 @@ namespace HHWMS.Web
/// </summary>
/// <returns></returns>
[HttpPost]
public IActionResult ReturnStatus(WcsRequest request)
public IActionResult ReturnStatus(TaskResponse response)
{
/*// 参数判断
if (request.State == null || request.PalletNo == null)
var taskno = response.TaskId.Split("-")[0];
//wcs 任务反馈
var task = _unitwork.Find<TaskHeader>(x => x.TaskNo.Equals(taskno) && x.Status != TaskStatusEnum.完成).Include(x => x.TaskDetails).FirstOrDefault();
if (task != null)
{
return ApiResultError(msg: $"传入参数不正确!");
}
var task = _unitwork.FindSingle<TaskHeader>(x => x.ContainerCode.Equals(request.PalletNo));
if (task == null)
{
return ApiResultError(msg: $"未找到容器号{request.PalletNo}的任务!");
}
switch (task.TaskType)
{
case TaskTypeEnum.In:
//1.更新库位状态(目的仓位有货)
_unitwork.BatchUpdate<Location>(x => x.Code.Equals(task.ToLocation), x => new Location
if (task.Status != TaskStatusEnum.完成 && response.Result == (int)TaskStatusEnum.完成)
{
var newTask = new TaskHeader
{
Status = LocationStatus.有货
});
//2.更新容器(旭东不需要)
//3.根据任务明细,创建库存和库存交易
var details = _unitwork.Find<TaskDetail>(x => x.TaskHeaderId.Equals(task.ID));
foreach (var detail in details)
TaskDetails = new List<TaskDetail>()
};
var tasktolocatioin = _unitwork.FindSingle<Location>(x => x.Code.Equals(task.ToLocation));
var taskfromlocatioin = _unitwork.FindSingle<Location>(x => x.Code.Equals(task.FromLocation));
switch (task.TaskType)
{
//创建库存
var inventory = new Inventory
{
MaterialCode = detail.MaterialCode,
MaterialName = detail.MaterialName,
MaterialSpec = detail.MaterialSpec,
MaterialUnit = detail.MaterialUnit,
Batch = detail.Batch,
Lot = detail.Lot,
ContainerCode = task.ContainerCode,
LocationCode = task.ToLocation,
Qty = detail.Qty,
TaskStatus = InventoryTaskStatus.无任务
};
_unitwork.Add(inventory);
//创建库存交易
var invTran = new InventoryTransaction
{
Type = InventoryTranType.入库,
MaterialCode = detail.MaterialCode,
MaterialName = detail.MaterialName,
MaterialSpec = detail.MaterialSpec,
MaterialUnit = detail.MaterialUnit,
Batch = detail.Batch,
Lot = detail.Lot,
ContainerCode = task.ContainerCode,
LocationCode = task.ToLocation,
Qty = detail.Qty,
};
_unitwork.Add(invTran);
case TaskTypeEnum.盘料盒入库:
// 更新库位
// 起始库位为空
// 目标库位为有货
// 更新库存
task.Status = TaskStatusEnum.完成;
break;
case TaskTypeEnum.盘料盒出库:
// 更新库位
// 起始库位为空
// 目标库位为有货
// 更新库存
task.Status = TaskStatusEnum.完成;
// 料盒出库是为了入,还是为了出 1是出,2是入
/*if (task.Station == "1")
{
}
else if (task.Station == "2")
{
}*/
// 测试 创建盘料出库任务
var locationList = _unitwork.Find<Location>(x => x.Row == tasktolocatioin.Row && "T,G2".Contains(x.Type)).ToList();
newTask.ZoneCode = "L";
newTask.TaskNo = _unitwork.GetSerialNumber("pout", 4);
newTask.TaskType = TaskTypeEnum.盘料出库;
newTask.ContainerCode = "L02";
newTask.FromLocation = locationList.First(x => x.Type.Equals("G2")).Code;
newTask.ToLocation = "L02";
newTask.Status = TaskStatusEnum.待下发;
for (int i = 1; i <= 10; i++)
{
newTask.TaskDetails.Add(new TaskDetail
{
UniqueCode = $"{newTask.TaskNo}-{i}",
FromLocation = i.ToString(),
ToLocation = i.ToString(),
Status = TaskStatusEnum.新建
});
}
_unitwork.Add(newTask);
break;
case TaskTypeEnum.盘料入库:
var ll = response.TaskId.Split("-")[1];
task.TaskDetails.First(x => x.FromLocation == ll).Status = TaskStatusEnum.完成;
// 查询料塔 是否还有已下发,未完成的盘料入库任务 有不操作,没有 创建料盒入库任务
if (!task.TaskDetails.Any(x => x.Status < TaskStatusEnum.完成))
{
task.Status = TaskStatusEnum.完成;
// 测试 创建料盒入库任务
var fromL = _unitwork.FindSingle<Location>(x => x.Row.Equals(tasktolocatioin.Row) && x.Type == "G1");
newTask.ZoneCode = "L";
newTask.TaskNo = _unitwork.GetSerialNumber("in", 4);
newTask.TaskType = TaskTypeEnum.盘料盒入库;
newTask.ContainerCode = fromL.Code;
newTask.FromLocation = fromL.Code;
newTask.ToLocation = "L01-02-01-01";
newTask.Status = TaskStatusEnum.待下发;
//newTask.Station = task.Station;
_unitwork.Add(newTask);
}
break;
case TaskTypeEnum.盘料出库:
var lll = response.TaskId.Split("-")[1];
task.TaskDetails.First(x => x.FromLocation == lll).Status = TaskStatusEnum.完成;
// 查询工位 是否还有已下发,未完成的盘料出库任务 有不操作,没有 创建料盒入库任务
if (!task.TaskDetails.Any(x => x.Status < TaskStatusEnum.完成))
{
task.Status = TaskStatusEnum.完成;
// 测试 创建盘料入库任务
var locationList1 = _unitwork.Find<Location>(x => x.Row == tasktolocatioin.Row && "T,G2".Contains(x.Type)).ToList();
newTask.ZoneCode = "L";
newTask.TaskNo = _unitwork.GetSerialNumber("pin", 4);
newTask.TaskType = TaskTypeEnum.盘料入库;
newTask.ContainerCode = locationList1.First(x => x.Type.Equals("T")).Code;
newTask.FromLocation = tasktolocatioin.Code;
newTask.ToLocation = taskfromlocatioin.Code;
newTask.Status = TaskStatusEnum.待下发;
for (int i = 1; i <= 10; i++)
{
newTask.TaskDetails.Add(new TaskDetail
{
UniqueCode = $"{newTask.TaskNo}-{i}",
FromLocation = i.ToString(),
ToLocation = i.ToString(),
Status = TaskStatusEnum.新建
});
}
_unitwork.Add(newTask);
}
break;
default:
break;
}
//4.调用MES接口,告诉MES物料入库
break;
case TaskTypeEnum.Out:
//1.更新库位状态(起始仓位为空)
//2.更新容器(旭东不需要)
//3.删除对应的库存信息,创建库存交易
//4.调用MES接口,告诉MES物料出库
break;
case TaskTypeEnum.Move:
//1.更新库位状态(起始仓位为空,目的仓位有货)
//2.更新容器(旭东不需要)
//3.更新库存信息的库位
break;
_unitwork.Update(task);
}
}
*/
return ApiResult();
}
@ -191,9 +239,9 @@ namespace HHWMS.Web
newTask.ZoneCode = "L";
newTask.TaskNo = _unitwork.GetSerialNumber("pout", 4);
newTask.TaskType = TaskTypeEnum.盘料出库;
newTask.ContainerCode = "L01";
newTask.ContainerCode = "L02";
newTask.FromLocation = locationList.First(x => x.Type.Equals("G2")).Code;
newTask.ToLocation = "L01";
newTask.ToLocation = "L02";
newTask.Status = TaskStatusEnum.待下发;
for (int i = 1; i <= 10; i++)
{
@ -221,7 +269,7 @@ namespace HHWMS.Web
newTask.TaskType = TaskTypeEnum.盘料盒入库;
newTask.ContainerCode = fromL.Code;
newTask.FromLocation = fromL.Code;
newTask.ToLocation = "L01-01-19-01";
newTask.ToLocation = "L01-02-01-01";
newTask.Status = TaskStatusEnum.待下发;
//newTask.Station = task.Station;
_unitwork.Add(newTask);

View File

@ -6,6 +6,8 @@ using WalkingTec.Mvvm.Mvc;
using WalkingTec.Mvvm.Core.Extensions;
using HHWMS.Web;
using HHWMS.Web.Models;
using Microsoft.EntityFrameworkCore;
using System.Linq;
namespace HHWMS.Web.Controllers
{
@ -161,7 +163,7 @@ namespace HHWMS.Web.Controllers
{
if (!ModelState.IsValid || !vm.DoBatchEdit())
{
return PartialView("BatchEdit",vm);
return PartialView("BatchEdit", vm);
}
else
{
@ -185,7 +187,7 @@ namespace HHWMS.Web.Controllers
{
if (!ModelState.IsValid || !vm.DoBatchDelete())
{
return PartialView("BatchDelete",vm);
return PartialView("BatchDelete", vm);
}
else
{
@ -195,7 +197,7 @@ namespace HHWMS.Web.Controllers
#endregion
#region Import
[ActionDescription("Sys.Import")]
[ActionDescription("Sys.Import")]
public ActionResult Import()
{
var vm = Wtm.CreateVM<ReceiptHeaderImportVM>();
@ -226,5 +228,47 @@ namespace HHWMS.Web.Controllers
}
#endregion
#region 点数
[ActionDescription("ReceiptHeader.Count")]
public ActionResult Count(string id)
{
var vm = Wtm.CreateVM<ReceiptHeaderVM>(id);
return PartialView(vm);
}
/// <summary>
/// 查所有新建的明细,已开始收货明细不允许点数
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
public ActionResult SelectReceiptDetailsByCode(string code)
{
var data = _unitwork.Find<ReceiptHeader>(x => x.Code == code)
.Include(x => x.ReceiptDetails).ToList();
return JsonMore(data.FirstOrDefault().ReceiptDetails.Where(x => x.Status == ReceiptStatusEnum.新建));
}
/// <summary>
/// 修改明细的数量
/// </summary>
/// <param name="code"></param>
/// <param name="uniqueCode"></param>
/// <param name="qty"></param>
/// <returns></returns>
public ActionResult CountCommit(string code, string uniqueCode, int qty)
{
var receiptDetail = _unitwork.FindSingle<ReceiptDetail>(x => x.UniqueCode.Equals(uniqueCode));
if (receiptDetail != null)
{
receiptDetail.Qty = qty;
receiptDetail.UpdateTime = DateTime.Now;
receiptDetail.UpdateBy = Wtm.LoginUserInfo.ITCode;
_unitwork.Update(receiptDetail);
return JsonMore(null);
}
return JsonMore(null, 500, $"未找到唯一码{uniqueCode}的单据!");
}
#endregion
}
}

View File

@ -0,0 +1,204 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using HHWMS.Web.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Mvc;
namespace HHWMS.Web.Controllers;
[Area("receipt")]
[ActionDescription("盘料站台入库操作")]
public class ReceiptInOperationController : BaseController
{
private readonly IUnitWork _unitWork;
public ReceiptInOperationController(IUnitWork unitWork)
{
_unitWork = unitWork;
}
#region Index
[ActionDescription("Sys.Search")]
public ActionResult Index()
{
return PartialView("Index");
}
#endregion
/// <summary>
/// 获取已绑定物料的周转箱信息
/// </summary>
/// <returns></returns>
[HttpPost]
public ActionResult BindBox()
{
var boxInfo = _unitWork.Find<TaskHeader>(x => x.Status.Equals(TaskStatusEnum.新建)
&& x.TaskType.Equals(TaskTypeEnum.盘料入库)).ToList();
if(boxInfo.Count > 0)
{
return JsonMore(boxInfo.Select(x => x.ContainerCode).ToList());
}
return JsonMore(null);
}
/// <summary>
/// 扫描散料箱
/// </summary>
/// <param name="boxCode"></param>
/// <returns></returns>
[HttpPost]
public ActionResult ScanBox(string boxCode)
{
// 判断任务重复
if (_unitWork.IsExit<TaskHeader>(x => x.ZoneCode.Equals(ZoneCodeEnum.散料库) && x.ContainerCode.Equals(boxCode)))
{
return JsonMore(null, 500, $"库内已存在{boxCode}的任务,请勿重复操作!");
};
// 判断箱号是否合理
var box = _unitWork.FindSingle<Location>(x => x.ContainerCode.Equals(boxCode));
if (box != null)
{
if (box.Type != LocationTypeEnum.散料库站台)
{
return JsonMore(null, 500, $"{boxCode}不在站台,无法入库!");
}
return JsonMore(null);
}
else
{
return JsonMore(null, 500, $"{boxCode}不正确!");
}
}
/// <summary>
/// 扫描唯一码,并验证,返回入库单明细
/// </summary>
/// <param name="uniqueCode"></param>
/// <returns></returns>
[HttpPost]
public ActionResult ScanUniqueCode(string uniqueCode)
{
var receiptDetail = _unitWork.FindSingle<ReceiptDetail>(x => x.UniqueCode.Equals(uniqueCode));
if (receiptDetail != null)
{
if (receiptDetail.Status == ReceiptStatusEnum.收完)
{
return JsonMore(null, 500, $"{uniqueCode}已全部收完,无需重新绑定!");
}
return JsonMore(receiptDetail);
}
return JsonMore(null, 500, $"{uniqueCode}不存在!");
}
/// <summary>
/// 绑定
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
[HttpPost]
public ActionResult BindingData(List<Binding> data)
{
var receiptHeaderList = _unitWork.Find<ReceiptHeader>(x =>
data.Select(x => x.ReceiptCode).ToList().Contains(x.ID.ToString()))
.Include(x => x.ReceiptDetails).ToList();
// 查找明细,修改对应状态,并且 绑定物料周转箱
foreach (Binding item in data.OrderBy(x => x.ReceiptCode))
{
// 更新入库单明细状态
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.收完))
{
header.FirstStatus = ReceiptStatusEnum.收完;
}
}
// 新建库存
var inventory = new Inventory
{
ZoneCode = ZoneCodeEnum.散料库,
UniqueCode = item.UniqueCode,
Qty = item.BindQty,
Lot = item.Size.ToString(),
ContainerCode = item.BoxCode,
TaskStatus = InventoryTaskStatus.任务中
};
_unitWork.Add(inventory);
}
_unitWork.BatchUpdate(receiptHeaderList.ToArray());
return JsonMore(null);
}
/// <summary>
/// 散料箱回库
/// </summary>
/// <param name="boxCode"></param>
/// <param name="isFull"></param>
/// <returns></returns>
[HttpPost]
public ActionResult BoxBack(string boxCode, bool isFull)
{
// 判断任务重复
if(!_unitWork.IsExit<TaskHeader>(x => x.ZoneCode.Equals(ZoneCodeEnum.散料库) && x.ContainerCode.Equals(boxCode))){
return JsonMore(null, 500, $"库内已存在{boxCode}的任务,请勿重复操作!");
};
// 判断箱号是否合理
var box = _unitWork.FindSingle<Location>(x => x.ContainerCode.Equals(boxCode));
if (box != null)
{
if(box.Type != LocationTypeEnum.散料库站台)
{
return JsonMore(null, 500, $"{boxCode}不在站台,无法入库!");
}
else
{
// 查找目标库位
var toLocation = _unitWork.FindSingle<Location>(x => x.Status.Equals(LocationStatus.空仓位)
&& x.Type.Equals(LocationTypeEnum.散料库位)
&& x.Row.Equals(box.Row));
if (toLocation != null)
{
// 创建任务
var task = new TaskHeader
{
ZoneCode = ZoneCodeEnum.散料库,
TaskNo = _unitWork.GetSerialNumber("CIn"),
TaskType = TaskTypeEnum.散料盒入库,
ContainerCode = boxCode,
FromLocation = box.Code,
ToLocation = toLocation.Code,
Status = TaskStatusEnum.新建,
CreateBy = Wtm.LoginUserInfo.ITCode,
CreateTime = DateTime.Now
};
_unitWork.Add(task);
toLocation.Status = LocationStatus.任务锁;
toLocation.Length = isFull ? 1 : 0; // 是否满盘
_unitWork.Update(toLocation);
}
else
{
return JsonMore(null, 500, $"库内无可用仓位,无法入库!");
}
}
return JsonMore(data: null);
}
else
{
return JsonMore(null, 500, $"{boxCode}不正确!");
}
}
}

View File

@ -19,6 +19,8 @@ namespace HHWMS.Web
return new List<GridAction>
{
this.MakeStandardAction("ReceiptHeader", GridActionStandardTypesEnum.Create, Localizer["Sys.Create"],"receipt", dialogWidth: 800),
this.MakeAction("ReceiptHeader","Count",Localizer["ReceiptHeader.Count"],Localizer["ReceiptHeader.Count"],GridActionParameterTypesEnum.SingleId,"receipt")
.SetShowInRow().SetHideOnToolBar().SetButtonClass("layui-btn-Warm").SetSize(1200,500),
this.MakeStandardAction("ReceiptHeader", GridActionStandardTypesEnum.Edit, Localizer["Sys.Edit"], "receipt", dialogWidth: 800),
this.MakeStandardAction("ReceiptHeader", GridActionStandardTypesEnum.Delete, Localizer["Sys.Delete"], "receipt", dialogWidth: 800),
this.MakeStandardAction("ReceiptHeader", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "receipt", dialogWidth: 800),
@ -26,6 +28,7 @@ namespace HHWMS.Web
this.MakeStandardAction("ReceiptHeader", GridActionStandardTypesEnum.BatchDelete, Localizer["Sys.BatchDelete"], "receipt", dialogWidth: 800),
this.MakeStandardAction("ReceiptHeader", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "receipt", dialogWidth: 800),
this.MakeStandardAction("ReceiptHeader", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "receipt"),
};
}
@ -47,7 +50,7 @@ namespace HHWMS.Web
//this.MakeGridHeader(x => x.LastStatus),
this.MakeGridHeader(x => x.AppointmentTime),
this.MakeGridHeader(x => x.Remark),
this.MakeGridHeaderAction(width: 200)
this.MakeGridHeaderAction(width: 300)
};
}

View File

@ -0,0 +1,149 @@
@model HHWMS.Web.ReceiptHeaderVM
<el-row id="count" :gutter="20">
<el-col :span="14">
<el-card class="box-card">
<el-table :data="tableData" height="450" border
style="width: 100%">
<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="MaterialSpec"></el-table-column>
<el-table-column label="批次" align="center" prop="Batch"></el-table-column>
<el-table-column label="数量" align="center" prop="Qty"></el-table-column>
</el-table>
</el-card>
</el-col>
<el-col :span="10">
<el-card class="box-card">
<el-form ref="form" :model="form" label-width="100px">
<el-form-item label="唯一码" prop="uniqueCode">
<el-input v-model="form.uniqueCode" ref="uniqueCode" placeholder="唯一码" @@change="scanUniqueCode"></el-input>
</el-form-item>
<el-form-item label="物料码" prop="materialCode">
<el-input v-model="form.materialCode"placeholder="物料码" readonly></el-input>
</el-form-item>
<el-form-item label="规格型号" prop="materialSpec">
<el-input v-model="form.materialSpec" placeholder="规格型号" readonly></el-input>
</el-form-item>
<el-form-item label="批次" prop="batch">
<el-input v-model="form.batch" placeholder="批次" readonly></el-input>
</el-form-item>
<el-form-item label="数量" prop="qty">
<el-input v-model.number="form.qty" ref="qty" :placeholder="qtyPlaceholder"></el-input>
</el-form-item>
<el-form-item style="float:right">
<el-button type="primary" @@click="onSubmit">确定</el-button>
</el-form-item>
</el-form>
</el-card>
</el-col>
</el-row>
<script>
var str = "";
@{
<text>str = @Model.Entity.Code; </text>
}
var app = new Vue({
el: "#count",
data() {
return {
form: {
uniqueCode: "",
materialCode: "",
materialSpec: "",
batch: "",
qty: ""
},
tableData: [],
qtyPlaceholder:"数量"
};
},
mounted: function () {
// 获取所有单据明细
$.ajax({
type: "post",
dataType: "json",
data:{ code: str },
url: "/receipt/ReceiptHeader/SelectReceiptDetailsByCode",
success: function (json) {
app.tableData = json.Data;
},
error: function (json) {
alert("加载失败");
}
});
this.$nextTick(() => {
this.$refs.uniqueCode.focus()
})
},
methods: {
// 绑定
onSubmit() {
var _this = this;
console.log(this.form);
// 提交已绑定数据
$.ajax({
type: "post",
dataType: "json",
data: { code: str, uniqueCode: _this.form.uniqueCode, qty: _this.form.qty },
url: "/receipt/ReceiptHeader/CountCommit",
success: function (json) {
if (json.Code == 200) {
_this.$message({
message: "点数成功!",
});
var isExit = _this.tableData.findIndex(function (value) {
return value.UniqueCode == _this.form.uniqueCode;
});
_this.tableData[isExit].Qty = _this.form.qty
_this.$refs['form'].resetFields();
_this.qtyPlaceholder = "数量";
_this.$refs.uniqueCode.focus();
} else {
_this.$message({
message: "失败!",
type: "warning",
duration: "10000",
});
}
},
error: function (json) {
_this.$message({
message: "失败!",
type: "error",
duration: "10000",
});
},
});
},
// 扫描唯一码
scanUniqueCode(data) {
var _this = this;
//1. 判断唯一码是否合理,调用后台,并返回唯一码对应的数量
var isExit = this.tableData.findIndex(function (value) {
return value.UniqueCode == data;
})
if (isExit != -1) {
var dd = this.tableData[isExit];
this.form.materialCode = dd.MaterialCode;
this.form.materialSpec = dd.MaterialSpec;
this.form.batch = dd.Batch;
this.qtyPlaceholder = dd.Qty;
_this.$refs.qty.focus();
}
else {
this.$message({
message: '唯一码' + data + '在此入库单据中不存在!',
type: 'warning'
});
this.$refs['form'].resetFields();
return;
}
},
},
});
</script>

View File

@ -0,0 +1,314 @@
<el-row id="opapp">
<el-card class="box-card" :span="16">
<el-table :data="tableData" ref="multipleTable" border style="width: 100%" @@selection-change="handleSelectionChange">
>
<el-table-column type="selection"
width="55">
</el-table-column>
<el-table-column prop="boxName" label="周转箱" align="center">
</el-table-column>
<el-table-column label="工位" align="center" prop="station">
<template slot-scope="scope">
<el-select v-model="scope.row.station" size="medium" style="width:100%">
<el-option v-for="item in station" :key="item.label" :label="item.label" :value="item.value">
</el-option>
</el-select>
</template>
</el-table-column>
</el-table>
<div style="margin-top: 20px">
<el-button type="primary" @@click="inOperation()">启动入库</el-button>
</div>
</el-card>
</el-row>
<script>
var app = new Vue({
el: "#opapp",
data() {
return {
station: [
{
label: 'left',
value: 1,
},
{
label: 'right',
value: 3,
},
],
// 表格数据
tableData: [
{
boxName: 'M00000001',
station: '',
},
{
boxName: 'E00000001',
station: '',
},
],
selectData: []
};
},
mounted: function () {
// 获取所有单据编码
// $.ajax({
// type: "post",
// dataType: "json",
// data:{},
// url: "/receipt/ReceiptIn/SelectReceiptCode",
// success: function (json) {
// app.options = json.Data;
// },
// error: function (json) {
// alert("加载失败");
// }
// });
},
methods: {
handleSelectionChange(val) {
val.forEach(row => {
if (row.station == '') {
this.$refs.multipleTable.toggleRowSelection(row);
this.$message({
message: "此周转箱没有选择站台!",
type: "warning",
duration: "5000",
});
}
});
this.selectData = val;
console.log(this.selectData);
},
// 呼叫料箱
callBox() {
var _this = this;
$.ajax({
type: "post",
dataType: "json",
data: {},
url: "/receipt/ReceiptSLIn/CallBox",
success: function (json) {
if (json.Code == 200) {
_this.$message({
message: "呼叫成功!",
});
// _this.resetForm('form');
} else {
_this.$message({
message: "呼叫失败!" + json.Msg,
type: "warning",
duration: "10000",
});
}
},
error: function (json) {
_this.$message({
message: "呼叫失败!",
type: "error",
duration: "10000",
});
},
});
},
// 扫描散料箱
scanBox(data) {
var _this = this;
$.ajax({
type: "post",
dataType: "json",
data: { boxCode: _this.form.code },
url: "/receipt/ReceiptSLIn/ScanBox",
success: function (json) {
if (json.Code != 200) {
_this.$message({
message: "扫描失败!" + json.Msg,
type: "warning",
duration: "10000",
});
}
else {
_this.$refs.uniqueCode.focus();
}
},
error: function (json) {
_this.$message({
message: "扫描失败!",
type: "error",
duration: "10000",
});
},
});
},
sizeFormatter(row) {
var rr = this.boxSize.filter((item) => item.value == row.size)[0].label;
return rr;
},
// 绑定
onSubmit() {
var _this = this;
console.log("submit!");
console.log(this.form);
// 提交已绑定数据
$.ajax({
type: "post",
dataType: "json",
data: { data: _this.bindingData },
url: "/receipt/ReceiptSLIn/BindingData",
success: function (json) {
if (json.Code == 200) {
_this.$message({
message: "绑定成功!",
});
_this.bindingData = [];
} else {
_this.$message({
message: "绑定失败!",
type: "warning",
duration: "10000",
});
}
},
error: function (json) {
_this.$message({
message: "绑定失败!",
type: "error",
duration: "10000",
});
},
});
},
// 重置
resetForm(formName) {
this.$refs[formName].resetFields();
this.boxSize = [];
this.bindingData = [];
},
// 选择尺寸后
changeSize() {
this.$refs.uniqueCode.focus();
},
// 扫描唯一码
scanUniqueCode(data) {
var _this = this;
// 1. 判断条件
if (this.form.code == "" || this.form.size == "") {
this.$message({
message: "请先扫描料箱箱编码并选择物料尺寸!",
type: "warning",
});
this.form.uniqueCode = "";
return;
}
//2. 判断唯一码是否合理,调用后台,并返回唯一码对应的数量
var isExit = this.bindingData.findIndex(function (value) {
return value.uniqueCode == data;
})
if (isExit != -1) {
this.$message({
message: '唯一码' + data + '已绑定!',
type: 'warning'
});
this.form.uniqueCode = '';
return;
}
$.ajax({
type: "post",
dataType: "json",
data: { uniqueCode: _this.form.uniqueCode },
url: "/receipt/ReceiptSLIn/ScanUniqueCode",
success: function (json) {
if (json.Code != 200) {
_this.$message({
message: json.Msg,
type: "warning",
duration: "10000",
});
} else {
// 3.已扫描增加
_this.bindingData.push({
receiptCode: json.Data.ReceiptHeaderId,
boxCode: _this.form.code,
uniqueCode: data,
qty: json.Data.Qty - json.Data.CompletedQty,
bindQty: json.Data.Qty - json.Data.CompletedQty,
size: _this.form.size,
});
}
},
error: function (json) {
_this.$message({
message: "扫描失败!",
type: "error",
duration: "10000",
});
},
});
this.form.uniqueCode = "";
},
// 删除已绑定行
deleteRow(index, rows) {
rows.splice(index, 1);
},
handleEdit(index, row) {
console.log(index, row, this.bindingData);
if (row.qty < row.bindQty) {
this.$message({
message: "数量不能大于剩余绑定数量!" + row.qty,
type: "warning",
duration: "1000",
});
this.bindingData[index].bindQty = row.qty;
}
else if (row.bindQty <= 0) {
this.bindingData[index].bindQty = row.qty;
}
},
// 回库
back() {
var _this = this;
// 创建回库任务
if (_this.code == "") {
_this.$message({
message: "箱号为空,不能创建回库任务!",
type: "error",
duration: "1000",
});
return;
}
$.ajax({
type: "post",
dataType: "json",
data: { boxCode: _this.form.code, isFull: _this.form.isFull },
url: "/receipt/ReceiptSLIn/BoxBack",
success: function (json) {
if (json.Code != 200) {
_this.$message({
message: "回库任务创建失败!" + json.Msg,
type: "warning",
duration: "10000",
});
} else {
_this.$message({
message: "回库任务创建成功!"
});
_this.resetForm('form');
}
},
error: function (json) {
_this.$message({
message: "回库任务创建失败!",
type: "error",
duration: "10000",
});
},
});
}
},
});
</script>

View File

@ -1362,4 +1362,7 @@
<data name="ReportDesign.Params" xml:space="preserve">
<value>参数</value>
</data>
<data name="ReceiptHeader.Count" xml:space="preserve">
<value>点数</value>
</data>
</root>