添加工序配置
修改入库页面,任务完成,库存页面等
This commit is contained in:
1 parent
c2b039ea47
commit
5a04ca9d59
41 files changed
+1151
-84
No files matched your search
@@ -24,9 +24,9 @@ namespace HHWMS.Web.Controllers
|
||||
_unitWork = unitwork;
|
||||
_materialZones = new Dictionary<string, LineRange>
|
||||
{
|
||||
{ "zone1", new LineRange { BeginLine = 1, EndLine = 25 } },
|
||||
{ "zone2", new LineRange { BeginLine = 26, EndLine = 57 } },
|
||||
{ "zone3", new LineRange { BeginLine = 58, EndLine = 96 } },
|
||||
{ "Zone1", new LineRange { BeginLine = 1, EndLine = 25 } },
|
||||
{ "Zone2", new LineRange { BeginLine = 26, EndLine = 57 } },
|
||||
{ "Zone3", new LineRange { BeginLine = 58, EndLine = 96 } },
|
||||
};
|
||||
}
|
||||
|
||||
@@ -121,6 +121,21 @@ namespace HHWMS.Web.Controllers
|
||||
return Json(new { Code = 200, Data = orders });
|
||||
}
|
||||
|
||||
[Public]
|
||||
[HttpGet]
|
||||
public IActionResult GetTrayTypes()
|
||||
{
|
||||
var containerconfig = _unitWork.Find<SysDictData>(x => x.DictType == "ContainerConfig"
|
||||
&& x.DictLabelUs.ToLower() != "container")
|
||||
.Select(x => new
|
||||
{
|
||||
value = x.ID,
|
||||
label = x.DictLabel,
|
||||
})
|
||||
.ToList();
|
||||
return Json(new { Code = 200, Data = containerconfig });
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public IActionResult SubmitReceipt([FromBody] ReceiptInModel model)
|
||||
{
|
||||
@@ -141,15 +156,28 @@ namespace HHWMS.Web.Controllers
|
||||
{
|
||||
return Json(new { Code = 500, Msg = "容器不存在" });
|
||||
}
|
||||
var materialProcessList = _unitWork.Find<MaterialProcess>(m => m.MaterialCode == material.MaterialCode);
|
||||
|
||||
var materialProcess = _unitWork.FindSingle<MaterialProcess>(m => m.ID == model.ProcessId);
|
||||
if (materialProcess == null)
|
||||
{
|
||||
return Json(new { Code = 500, Msg = "未找到此工序配置" });
|
||||
return Json(new { Code = 500, Msg = "未找到此物料工序配置" });
|
||||
}
|
||||
|
||||
// 下一道工序
|
||||
var nextProcess = materialProcessList
|
||||
// 筛选同一物料
|
||||
.Where(p => p.MaterialCode == material.MaterialCode)
|
||||
// 筛选顺序大于当前工序的工序
|
||||
.Where(p => p.ProcessOrder > materialProcess.ProcessOrder)
|
||||
// 按工序顺序升序排列(取最小的一个,即下一道)
|
||||
.OrderBy(p => p.ProcessOrder)
|
||||
// 取第一个(下一道工序)
|
||||
.FirstOrDefault();
|
||||
|
||||
// 从字典查询工序对应的区域
|
||||
var zoneName = _unitWork.FindSingle<SysDictData>(x => x.DictType == "ProcessZone"
|
||||
&& x.DictLabel == materialProcess.ProcessCode)?.DictValue;
|
||||
var zoneName = _unitWork.FindSingle<ProcessConfig>(x =>
|
||||
x.Code == nextProcess.ProcessCode)?.Zone;
|
||||
|
||||
if (string.IsNullOrEmpty(zoneName))
|
||||
{
|
||||
@@ -180,7 +208,7 @@ namespace HHWMS.Web.Controllers
|
||||
TaskType = TaskTypeEnum.入库,
|
||||
FromLocation = "",
|
||||
ToLocation = locationCode,
|
||||
ContainerCode = model.PalletCode,
|
||||
ContainerCode = container.Code,
|
||||
RoadWay = 1,
|
||||
Status = TaskStatusEnum.新建,
|
||||
CreateBy = model.OperatorId,
|
||||
@@ -193,18 +221,21 @@ namespace HHWMS.Web.Controllers
|
||||
var inventory = new Inventory
|
||||
{
|
||||
ZoneId = zone.ID,
|
||||
ContainerCode = model.PalletCode,
|
||||
ContainerCode = taskHeader.ContainerCode,
|
||||
LocationCode = locationCode,
|
||||
MaterialCode = model.MaterialCode,
|
||||
MaterialType = material.MaterialType,
|
||||
MaterialName = material.MaterialName,
|
||||
MaterialSpec = material.MaterialSpec,
|
||||
MaterialUnit = material.MaterialUnit,
|
||||
SupplierCode = material.SupplierCode,
|
||||
SourceCode = model.SourceCode,
|
||||
Batch = materialProcess.ProcessName,
|
||||
Lot = materialProcess.ProcessCode,
|
||||
Lot = nextProcess?.ProcessName,
|
||||
Status = model.IsQualified ? "合格" : "不合格",
|
||||
TaskStatus = InventoryTaskStatusEnum.Locked,
|
||||
TaskQty = model.Qty,
|
||||
TaskQty = model.Qty,//小托盘数量
|
||||
Flag = model.Type,//小托盘类型
|
||||
CreateBy = model.OperatorId,
|
||||
ReceiptCode = model.OperatorInfo, //校验员
|
||||
CreateTime = DateTime.Now
|
||||
@@ -226,7 +257,7 @@ namespace HHWMS.Web.Controllers
|
||||
{
|
||||
Status = LocationStatusEnum.锁定,
|
||||
ContainerStatus = LocationStatus.有货,
|
||||
ContainerCode = model.PalletCode,
|
||||
ContainerCode = taskHeader.ContainerCode,
|
||||
UpdateTime = DateTime.Now,
|
||||
UpdateBy = "WMS",
|
||||
Version = Guid.NewGuid()
|
||||
@@ -243,7 +274,7 @@ namespace HHWMS.Web.Controllers
|
||||
var wcsTaskModel = new WCSTaskModel
|
||||
{
|
||||
TaskNo = taskNo,
|
||||
PalletNo = model.PalletCode,
|
||||
PalletNo = taskHeader.ContainerCode,
|
||||
FromLocation = "", // 入库任务起始位置为空
|
||||
ToLocation = locationCode,
|
||||
};
|
||||
@@ -295,7 +326,7 @@ namespace HHWMS.Web.Controllers
|
||||
|
||||
// 1. 查找可用库位信息
|
||||
var locationVm = Wtm.CreateVM<LocationVM>();
|
||||
var locationCode = locationVm.GetEmptyLocationFromXb(_materialZones["zone1"].BeginLine, _materialZones["zone1"].EndLine);
|
||||
var locationCode = locationVm.GetEmptyLocationFromXb(_materialZones["Zone1"].BeginLine, _materialZones["Zone1"].EndLine);
|
||||
|
||||
if (string.IsNullOrWhiteSpace(locationCode))
|
||||
{
|
||||
@@ -317,7 +348,7 @@ namespace HHWMS.Web.Controllers
|
||||
TaskType = TaskTypeEnum.入库,
|
||||
FromLocation = "",
|
||||
ToLocation = locationCode,
|
||||
ContainerCode = model.PalletCode,
|
||||
ContainerCode = container.Code,
|
||||
RoadWay = 1,
|
||||
Status = TaskStatusEnum.新建,
|
||||
CreateBy = model.OperatorId,
|
||||
@@ -358,7 +389,7 @@ namespace HHWMS.Web.Controllers
|
||||
var wcsTaskModel = new WCSTaskModel
|
||||
{
|
||||
TaskNo = taskNo,
|
||||
PalletNo = model.PalletCode,
|
||||
PalletNo = taskHeader.ContainerCode,
|
||||
FromLocation = "", // 入库任务起始位置为空
|
||||
ToLocation = locationCode,
|
||||
};
|
||||
@@ -387,6 +418,58 @@ namespace HHWMS.Web.Controllers
|
||||
}
|
||||
}}
|
||||
|
||||
/// <summary>
|
||||
/// 空托盘出库
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public IActionResult EmptyPalletOut()
|
||||
{
|
||||
var container = _unitWork.FindSingle<Container>(x => x.Status == ContainerStatus.空
|
||||
&& x.IsLock == ContainerLockEnum.未锁
|
||||
&& !string.IsNullOrEmpty(x.LocationCode));
|
||||
if (container == null)
|
||||
{
|
||||
return Json(new { Code = 500, Msg = "库内不存在可用空容器!"} );
|
||||
}
|
||||
|
||||
//创建出库任务
|
||||
var location = _unitWork.FindSingle<Location>(x => x.Code == container.LocationCode);
|
||||
|
||||
var outPort = _unitWork.FindSingle<ProcessConfig>(x => x.Code == "00")?.Port;
|
||||
if (string.IsNullOrEmpty(outPort))
|
||||
{
|
||||
return Json(new { Code = 500, Msg = "未配置空托盘出库口,请配置后重新呼叫出库任务!"} );
|
||||
}
|
||||
|
||||
var task = new TaskHeader()
|
||||
{
|
||||
ZoneId = location.ZoneId,
|
||||
TaskNo = _unitWork.GetSerialNumber("Out", 6),
|
||||
TaskType = TaskTypeEnum.出库,
|
||||
ContainerCode = container.Code,
|
||||
FromLocation = container.LocationCode,
|
||||
ToLocation = outPort,
|
||||
Status = TaskStatusEnum.新建
|
||||
};
|
||||
|
||||
var vm = Wtm.CreateVM<LocationVM>();
|
||||
var result = vm.SendWcsTask(task);
|
||||
if (!result.Status)
|
||||
{
|
||||
return Json(new { Code = 500, Msg =result.Message});
|
||||
}
|
||||
|
||||
location.Status = LocationStatusEnum.锁定;
|
||||
location.UpdateTime = DateTime.Now;
|
||||
_unitWork.Update(location);
|
||||
|
||||
container.IsLock = ContainerLockEnum.任务锁;
|
||||
container.UpdateTime = DateTime.Now;
|
||||
_unitWork.Update(container);
|
||||
return Json(new { Code = 200, Msg = "提交成功" });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 搜索物料
|
||||
/// </summary>
|
||||
@@ -425,11 +508,13 @@ namespace HHWMS.Web.Controllers
|
||||
public class ReceiptInModel
|
||||
{
|
||||
public string PalletCode { get; set; }
|
||||
public string SourceCode { get; set; }
|
||||
public string MaterialCode { get; set; }
|
||||
public string OrderId { get; set; }
|
||||
public string OperatorId { get; set; }
|
||||
public int ProcessId { get; set; }
|
||||
public string ProcessName { get; set; }
|
||||
public int Type { get; set; }
|
||||
public int Qty { get; set; }
|
||||
public bool IsQualified { get; set; }
|
||||
public string OperatorInfo { get; set; }
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace HHWMS.Web.Controllers
|
||||
var inventory = new Inventory()
|
||||
{
|
||||
ZoneId = zone.ID,
|
||||
ContainerCode = containerCode,
|
||||
ContainerCode = container.Code,
|
||||
MaterialCode = material.MaterialCode,
|
||||
MaterialName = material.MaterialName,
|
||||
MaterialType = material.MaterialType,
|
||||
@@ -186,7 +186,7 @@ namespace HHWMS.Web.Controllers
|
||||
MaterialCode = material.MaterialCode,
|
||||
MaterialName = material.MaterialName,
|
||||
MaterialUnit = material.MaterialUnit,
|
||||
ContainerCode = containerCode,
|
||||
ContainerCode = container.Code,
|
||||
CompanyCode = inventory.CompanyCode,
|
||||
SourceCode = inventory.SourceCode,
|
||||
SupplierCode = inventory.SupplierCode,
|
||||
@@ -249,7 +249,7 @@ namespace HHWMS.Web.Controllers
|
||||
TaskNo = _unitWork.GetSerialNumber("In"),
|
||||
TaskType = TaskTypeEnum.入库,
|
||||
RoadWay = 2,
|
||||
ContainerCode = containerCode,
|
||||
ContainerCode = container.Code,
|
||||
FromLocation = "Enter_0000",
|
||||
ToLocation = "",
|
||||
Status = TaskStatusEnum.待下发,
|
||||
@@ -452,7 +452,7 @@ namespace HHWMS.Web.Controllers
|
||||
TaskNo = _unitWork.GetSerialNumber("In"),
|
||||
TaskType = TaskTypeEnum.入库,
|
||||
RoadWay = 2,
|
||||
ContainerCode = containerCode,
|
||||
ContainerCode = container.Code,
|
||||
FromLocation = "Enter_0000",
|
||||
ToLocation = "",
|
||||
Status = TaskStatusEnum.待下发,
|
||||
|
||||
@@ -39,6 +39,21 @@
|
||||
<a-input v-model="form.processName" />
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item field="sourceCode" label="单号">
|
||||
<a-input v-model="form.sourceCode" style="width: 100%" ref="sourceCodeRef" @@keydown.enter="focusNext('numInput')"/>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item field="type" label="小托盘类型" >
|
||||
<a-radio-group v-model="form.type" type="button">
|
||||
<a-radio
|
||||
v-for="item in trayTypeOptions"
|
||||
:key="item.value"
|
||||
:value="item.value">
|
||||
{{ item.label }}
|
||||
</a-radio>
|
||||
</a-radio-group>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item field="qty" label="小托盘数量">
|
||||
<a-input-number v-model="form.qty" :min="0" style="width: 100%" ref="numInput" @@keydown.enter="focusNext('operatorIdRef')"/>
|
||||
</a-form-item>
|
||||
@@ -57,9 +72,10 @@
|
||||
|
||||
<a-form-item>
|
||||
<a-space>
|
||||
<a-button type="primary" @@click="submitForm" :loading="loading">上架入库</a-button>
|
||||
<a-button type="success" @@click="submitEmptyPallet" :loading="loading">空托盘入库</a-button>
|
||||
<a-button @@click="resetForm">重置</a-button>
|
||||
<a-button type="primary" status="success" @@click="submitForm" :loading="loading">上架入库</a-button>
|
||||
<a-button type="primary" status="warning" @@click="submitEmptyPallet" :loading="loading">空托盘入库</a-button>
|
||||
<a-button type="primary" status="danger" @@click="emptyPalletOut" :loading="loading">空托盘出库</a-button>
|
||||
<a-button type="outline" @@click="resetForm">重置</a-button>
|
||||
</a-space>
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
@@ -79,13 +95,16 @@
|
||||
|
||||
const palletCodeRef = ref(null);
|
||||
const materialCodeRef = ref(null);
|
||||
const sourceCodeRef = ref(null);
|
||||
const numInput = ref(null);
|
||||
const operatorIdRef = ref(null);
|
||||
const operatorInfoRef = ref(null);
|
||||
const trayTypeOptions = ref([]);
|
||||
|
||||
const inputRefs = {
|
||||
palletCodeRef,
|
||||
materialCodeRef,
|
||||
sourceCodeRef,
|
||||
numInput,
|
||||
operatorIdRef,
|
||||
operatorInfoRef
|
||||
@@ -101,11 +120,13 @@
|
||||
const form = reactive({
|
||||
palletCode: '',
|
||||
materialCode: '',
|
||||
sourceCode:'',
|
||||
orderId: '',
|
||||
operatorId: '',
|
||||
processId: '',
|
||||
processName:'',
|
||||
name:'',
|
||||
type:'',
|
||||
qty:null,
|
||||
isQualified: true,
|
||||
operatorInfo: ''
|
||||
@@ -157,7 +178,7 @@
|
||||
|
||||
const processSelect = (value) => {
|
||||
form.processName = processOptions.value.find(item => item.value === value).processName;
|
||||
focusNext('numInput');
|
||||
focusNext('sourceCodeRef');
|
||||
}
|
||||
|
||||
// 加载工序列表
|
||||
@@ -358,6 +379,35 @@
|
||||
});
|
||||
};
|
||||
|
||||
// 呼叫空托盘出库
|
||||
const emptyPalletOut = () => {
|
||||
loading.value = true;
|
||||
|
||||
$.ajax({
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
contentType: "application/json",
|
||||
url: "/receipt/ReceiptIn/EmptyPalletOut",
|
||||
success: (json) => {
|
||||
if (json.Code == 200) {
|
||||
Message.success('空托盘出库任务创建成功!');
|
||||
resetForm();
|
||||
} else {
|
||||
Message.error({
|
||||
content: json.Msg || '空托盘出库任务创建失败!',
|
||||
duration: 5000
|
||||
});
|
||||
}
|
||||
},
|
||||
error: (xhr, status, error) => {
|
||||
Message.error('提交失败:' + error);
|
||||
},
|
||||
complete: () => {
|
||||
loading.value = false;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 重置表单
|
||||
const resetForm = () => {
|
||||
formRef.value.resetFields();
|
||||
@@ -369,6 +419,29 @@
|
||||
}, 100);
|
||||
};
|
||||
|
||||
// 从后端获取托盘类型列表
|
||||
const loadTrayTypes = () => {
|
||||
// 调用后端接口获取数据
|
||||
axios.get('/receipt/ReceiptIn/GetTrayTypes')
|
||||
.then(response => {
|
||||
const result = response.data;
|
||||
console.log(result)
|
||||
if (result.Code == 200) {
|
||||
// 假设后端返回格式:[{value: 'mini', label: 'Mini'}, ...]
|
||||
trayTypeOptions.value = result.Data;
|
||||
|
||||
// 可选:设置默认值(取第一个选项)
|
||||
if (trayTypeOptions.value.length > 0) {
|
||||
form.type = trayTypeOptions.value[0].value;
|
||||
}
|
||||
} else {
|
||||
Message.error('获取托盘类型失败:' + result.Msg);
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
Message.error('请求失败:' + error.message);
|
||||
});
|
||||
};
|
||||
|
||||
// 生命周期钩子
|
||||
onMounted(() => {
|
||||
@@ -378,6 +451,8 @@
|
||||
palletCodeRef.value.focus();
|
||||
}
|
||||
}, 100);
|
||||
|
||||
loadTrayTypes();
|
||||
});
|
||||
|
||||
return {
|
||||
@@ -391,19 +466,22 @@
|
||||
scanMaterial,
|
||||
submitForm,
|
||||
submitEmptyPallet,
|
||||
emptyPalletOut,
|
||||
resetForm,
|
||||
materialOptions,
|
||||
handleMaterialSearch,
|
||||
handleMaterialSelect,
|
||||
palletCodeRef,
|
||||
materialCodeRef,
|
||||
sourceCodeRef,
|
||||
numInput,
|
||||
operatorIdRef,
|
||||
operatorInfoRef,
|
||||
focusNext,
|
||||
loadProcesses,
|
||||
loadProcessesByMaterial,
|
||||
processSelect
|
||||
processSelect,
|
||||
trayTypeOptions
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user