力阔入库修改,添加物料绑定
This commit is contained in:
1 parent
a3e91357ee
commit
38c126c7b7
11 files changed
+895
-184
No files matched your search
@@ -279,3 +279,4 @@ __pycache__/
|
|||||||
/nuget.exe
|
/nuget.exe
|
||||||
/demo/WalkingTec.Mvvm.VueDemo/ClientApp/yarn.lock
|
/demo/WalkingTec.Mvvm.VueDemo/ClientApp/yarn.lock
|
||||||
*.lock
|
*.lock
|
||||||
|
.DS_Store
|
||||||
@@ -56,6 +56,7 @@ namespace HHWMS.Web
|
|||||||
// 1.更新库存
|
// 1.更新库存
|
||||||
_unitWork.BatchUpdate<Inventory>(x => x.ContainerCode.Equals(task.ContainerCode), x => new Inventory
|
_unitWork.BatchUpdate<Inventory>(x => x.ContainerCode.Equals(task.ContainerCode), x => new Inventory
|
||||||
{
|
{
|
||||||
|
LocationCode = task.ToLocation,
|
||||||
UpdateTime = DateTime.Now,
|
UpdateTime = DateTime.Now,
|
||||||
UpdateBy = "WMS",
|
UpdateBy = "WMS",
|
||||||
TaskStatus = InventoryTaskStatus.无任务
|
TaskStatus = InventoryTaskStatus.无任务
|
||||||
@@ -80,29 +81,29 @@ namespace HHWMS.Web
|
|||||||
});
|
});
|
||||||
// 4.插入库存交易
|
// 4.插入库存交易
|
||||||
// 1.将任务容器的库存查出来
|
// 1.将任务容器的库存查出来
|
||||||
if (inventoryList.Count > 0)
|
// if (inventoryList.Count > 0)
|
||||||
{
|
// {
|
||||||
// 2.根据库存生成库存交易出库信息
|
// // 2.根据库存生成库存交易出库信息
|
||||||
var inventoryTransactions = inventoryList.Select(inventory => new InventoryTransaction
|
// var inventoryTransactions = inventoryList.Select(inventory => new InventoryTransaction
|
||||||
{
|
// {
|
||||||
BillType = InventoryTranType.入库,
|
// BillType = InventoryTranType.入库,
|
||||||
MaterialCode = inventory.MaterialCode,
|
// MaterialCode = inventory.MaterialCode,
|
||||||
MaterialName = inventory.MaterialName,
|
// MaterialName = inventory.MaterialName,
|
||||||
MaterialUnit = inventory.MaterialUnit,
|
// MaterialUnit = inventory.MaterialUnit,
|
||||||
Batch = inventory.Batch,
|
// Batch = inventory.Batch,
|
||||||
Lot = inventory.Lot,
|
// Lot = inventory.Lot,
|
||||||
LocationCode = inventory.LocationCode,
|
// LocationCode = inventory.LocationCode,
|
||||||
ContainerCode = inventory.ContainerCode,
|
// ContainerCode = inventory.ContainerCode,
|
||||||
Qty = inventory.Qty,
|
// Qty = inventory.Qty,
|
||||||
CreateTime = DateTime.Now,
|
// CreateTime = DateTime.Now,
|
||||||
CreateBy = "WMS",
|
// CreateBy = "WMS",
|
||||||
UpdateTime = DateTime.Now,
|
// UpdateTime = DateTime.Now,
|
||||||
UpdateBy = "WMS"
|
// UpdateBy = "WMS"
|
||||||
}).ToList();
|
// }).ToList();
|
||||||
|
//
|
||||||
// 3.批量插入库存交易
|
// // 3.批量插入库存交易
|
||||||
_unitWork.BatchAdd(inventoryTransactions);
|
// _unitWork.BatchAdd(inventoryTransactions);
|
||||||
}
|
// }
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case TaskTypeEnum.立库出库:
|
case TaskTypeEnum.立库出库:
|
||||||
@@ -121,6 +122,8 @@ namespace HHWMS.Web
|
|||||||
Status = LocationStatus.空仓位,
|
Status = LocationStatus.空仓位,
|
||||||
ContainerCode = ""
|
ContainerCode = ""
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
// 1.将任务容器的库存查出来
|
// 1.将任务容器的库存查出来
|
||||||
var inventoryList2 = _unitWork.Find<Inventory>(x => x.ContainerCode.Equals(task.ContainerCode))
|
var inventoryList2 = _unitWork.Find<Inventory>(x => x.ContainerCode.Equals(task.ContainerCode))
|
||||||
.ToList();
|
.ToList();
|
||||||
@@ -149,10 +152,13 @@ namespace HHWMS.Web
|
|||||||
|
|
||||||
_unitWork.BatchDelete<Inventory>(inventoryList2);
|
_unitWork.BatchDelete<Inventory>(inventoryList2);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// 如果是出库页面创建的任务,则创建入库任务并联动AGV
|
// 如果是出库页面创建的任务,则创建入库任务并联动AGV
|
||||||
if (task.Station == "1")
|
/*
|
||||||
|
if (task.Station == "1")
|
||||||
{
|
{
|
||||||
new ReceiptInController(_unitWork, Wtm).TaskIn(task.ContainerCode, false, false);
|
new ReceiptInController(_unitWork, Wtm).TaskIn(task.ContainerCode);
|
||||||
|
|
||||||
// 下发AGV到出库口的任务
|
// 下发AGV到出库口的任务
|
||||||
|
|
||||||
@@ -170,6 +176,7 @@ namespace HHWMS.Web
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ namespace HHWMS.Web
|
|||||||
this.MakeStandardAction("Material", GridActionStandardTypesEnum.BatchDelete, Localizer["Sys.BatchDelete"], "configs", dialogWidth: 800),
|
this.MakeStandardAction("Material", GridActionStandardTypesEnum.BatchDelete, Localizer["Sys.BatchDelete"], "configs", dialogWidth: 800),
|
||||||
this.MakeStandardAction("Material", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "configs", dialogWidth: 800),
|
this.MakeStandardAction("Material", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "configs", dialogWidth: 800),
|
||||||
this.MakeStandardAction("Material", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "configs"),
|
this.MakeStandardAction("Material", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "configs"),
|
||||||
|
this.MakeAction("Location","Print",Localizer["Sys.Print"],Localizer["Sys.Print"],GridActionParameterTypesEnum.MultiIds,"configs")
|
||||||
|
.SetShowDialog(false).SetOnClickScript("print"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ namespace HHWMS.Web
|
|||||||
{
|
{
|
||||||
[Display(Name = "Inventory.MaterialCode")]
|
[Display(Name = "Inventory.MaterialCode")]
|
||||||
public String MaterialCode { get; set; }
|
public String MaterialCode { get; set; }
|
||||||
|
|
||||||
|
[Display(Name = "Inventory.MaterialName")]
|
||||||
|
public String MaterialName { get; set; }
|
||||||
|
|
||||||
protected override void InitVM()
|
protected override void InitVM()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,7 +3,25 @@
|
|||||||
|
|
||||||
<wt:searchpanel vm="@Model" reset-btn="true">
|
<wt:searchpanel vm="@Model" reset-btn="true">
|
||||||
<wt:row items-per-row="ItemsPerRowEnum.Three">
|
<wt:row items-per-row="ItemsPerRowEnum.Three">
|
||||||
<wt:textbox field="Searcher.MaterialCode" />
|
<wt:textbox field="Searcher.MaterialCode" />
|
||||||
|
<wt:textbox field="Searcher.MaterialName" />
|
||||||
</wt:row>
|
</wt:row>
|
||||||
</wt:searchpanel>
|
</wt:searchpanel>
|
||||||
<wt:grid vm="@Model" url="/configs/Material/Search"/>
|
<wt:grid vm="@Model" url="/configs/Material/Search"/>
|
||||||
|
<script>
|
||||||
|
let template = {"panels":[{"index":0,"height":60,"width":80,"paperHeader":43.5,"paperFooter":170.07874015748033,"printElements":[{"options":{"left":10.5,"top":37.5,"height":50,"width":120,"field":"MaterialCode","fontSize":18,"textAlign":"center","textContentVerticalAlign":"middle"},"printElementType":{"type":"text"}},{"options":{"left":132,"top":37.5,"height":99,"width":90,"title":"123","field":"MaterialCode","textType":"qrcode"},"printElementType":{"type":"text"}},{"options":{"left":10.5,"top":88.5,"height":50,"width":120,"field":"MaterialName","fontSize":12,"textAlign":"center","textContentVerticalAlign":"middle"},"printElementType":{"type":"text"}}],"paperNumberLeft":196,"paperNumberTop":148,"paperNumberDisabled":true}]};
|
||||||
|
let printData = [];
|
||||||
|
|
||||||
|
function print(ids, datas) {
|
||||||
|
datas.forEach(function (value, index, arr) {
|
||||||
|
printData.push({ MaterialCode: value.MaterialCode, MaterialName: value.MaterialName })
|
||||||
|
});
|
||||||
|
|
||||||
|
hiprint.init();
|
||||||
|
var hiprintTemplate = new hiprint.PrintTemplate({
|
||||||
|
template: template
|
||||||
|
});
|
||||||
|
hiprintTemplate.print(printData);
|
||||||
|
printData = [];
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -244,14 +244,14 @@ namespace HHWMS.Web.Controllers
|
|||||||
location.Status = LocationStatus.任务锁;
|
location.Status = LocationStatus.任务锁;
|
||||||
location.UpdateTime = DateTime.Now;
|
location.UpdateTime = DateTime.Now;
|
||||||
location.UpdateBy = Wtm.LoginUserInfo?.ITCode ?? "WMS";
|
location.UpdateBy = Wtm.LoginUserInfo?.ITCode ?? "WMS";
|
||||||
_unitwork.Update(location);
|
// _unitwork.Update(location);
|
||||||
|
|
||||||
// 查找container,并更新状态
|
// 查找container,并更新状态
|
||||||
var container = _unitwork.FindSingle<Container>(x => x.Code == location.ContainerCode);
|
var container = _unitwork.FindSingle<Container>(x => x.Code == location.ContainerCode);
|
||||||
container.IsLock = ContainerLockEnum.任务锁;
|
container.IsLock = ContainerLockEnum.任务锁;
|
||||||
container.UpdateTime = DateTime.Now;
|
container.UpdateTime = DateTime.Now;
|
||||||
container.UpdateBy = Wtm.LoginUserInfo?.ITCode ?? "WMS";
|
container.UpdateBy = Wtm.LoginUserInfo?.ITCode ?? "WMS";
|
||||||
_unitwork.Update(container);
|
// _unitwork.Update(container);
|
||||||
|
|
||||||
//创建出库任务
|
//创建出库任务
|
||||||
var task = new TaskHeader
|
var task = new TaskHeader
|
||||||
@@ -266,7 +266,7 @@ namespace HHWMS.Web.Controllers
|
|||||||
CreateBy = Wtm.LoginUserInfo?.ITCode ?? "WMS",
|
CreateBy = Wtm.LoginUserInfo?.ITCode ?? "WMS",
|
||||||
CreateTime = DateTime.Now
|
CreateTime = DateTime.Now
|
||||||
};
|
};
|
||||||
_unitwork.Add(task);
|
// _unitwork.Add(task);
|
||||||
|
|
||||||
// 下发任务到wcs
|
// 下发任务到wcs
|
||||||
var postData = new
|
var postData = new
|
||||||
@@ -281,15 +281,23 @@ namespace HHWMS.Web.Controllers
|
|||||||
if (res.Success)
|
if (res.Success)
|
||||||
{
|
{
|
||||||
task.Status = TaskStatusEnum.已下发;
|
task.Status = TaskStatusEnum.已下发;
|
||||||
|
task.UpdateTime = DateTime.Now;
|
||||||
|
task.UpdateBy = "WMS";
|
||||||
|
_unitwork.Add(task);
|
||||||
|
|
||||||
|
inv.TaskStatus = InventoryTaskStatus.任务中;
|
||||||
|
_unitwork.Update(inv);
|
||||||
|
|
||||||
|
_unitwork.Update(container);
|
||||||
|
_unitwork.Update(location);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
task.ErrorMsg = res.Msg;
|
task.ErrorMsg = res.Msg;
|
||||||
|
return FFResult().RefreshGrid().Alert("出库任务创建失败!");
|
||||||
}
|
}
|
||||||
|
|
||||||
task.UpdateTime = DateTime.Now;
|
|
||||||
task.UpdateBy = "WMS";
|
|
||||||
_unitwork.Update(task);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FFResult().RefreshGrid().Message("任务创建成功!");
|
return FFResult().RefreshGrid().Message("任务创建成功!");
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace HHWMS.Web
|
|||||||
this.MakeGridHeader(x => x.MaterialCode),
|
this.MakeGridHeader(x => x.MaterialCode),
|
||||||
// this.MakeGridHeader(x => x.MaterialType),
|
// this.MakeGridHeader(x => x.MaterialType),
|
||||||
this.MakeGridHeader(x => x.MaterialName),
|
this.MakeGridHeader(x => x.MaterialName),
|
||||||
// this.MakeGridHeader(x => x.MaterialSpec),
|
this.MakeGridHeader(x => x.MaterialSpec),
|
||||||
// this.MakeGridHeader(x => x.MaterialUnit),
|
// this.MakeGridHeader(x => x.MaterialUnit),
|
||||||
// this.MakeGridHeader(x => x.Batch),
|
// this.MakeGridHeader(x => x.Batch),
|
||||||
// this.MakeGridHeader(x => x.Lot),
|
// this.MakeGridHeader(x => x.Lot),
|
||||||
|
|||||||
@@ -3,12 +3,9 @@
|
|||||||
|
|
||||||
<wt:searchpanel vm="@Model" reset-btn="true">
|
<wt:searchpanel vm="@Model" reset-btn="true">
|
||||||
<wt:row items-per-row="ItemsPerRowEnum.Three">
|
<wt:row items-per-row="ItemsPerRowEnum.Three">
|
||||||
<wt:combobox field="Searcher.ZoneCode" items="ZoneCodes" />
|
|
||||||
<wt:textbox field="Searcher.UniqueCode" />
|
|
||||||
<wt:textbox field="Searcher.MaterialCode" />
|
<wt:textbox field="Searcher.MaterialCode" />
|
||||||
<wt:textbox field="Searcher.Batch" />
|
|
||||||
@*<wt:textbox field="Searcher.MaterialType" />
|
|
||||||
<wt:textbox field="Searcher.MaterialName" />
|
<wt:textbox field="Searcher.MaterialName" />
|
||||||
|
@*<wt:textbox field="Searcher.MaterialType" />
|
||||||
<wt:textbox field="Searcher.MaterialSpec" />
|
<wt:textbox field="Searcher.MaterialSpec" />
|
||||||
<wt:textbox field="Searcher.MaterialUnit" />
|
<wt:textbox field="Searcher.MaterialUnit" />
|
||||||
<wt:textbox field="Searcher.Batch" />
|
<wt:textbox field="Searcher.Batch" />
|
||||||
|
|||||||
@@ -30,124 +30,369 @@ namespace HHWMS.Web.Controllers
|
|||||||
|
|
||||||
#endregion Index
|
#endregion Index
|
||||||
|
|
||||||
[HttpPost]
|
[HttpGet]
|
||||||
public ActionResult TaskIn(string containerCode, bool inv, bool agv)
|
public ActionResult SearchMaterials(string keyword)
|
||||||
{
|
{
|
||||||
if (Wtm == null)
|
if (string.IsNullOrEmpty(keyword))
|
||||||
{
|
{
|
||||||
Wtm = _context;
|
return JsonMore(new { Data = new object[] { } });
|
||||||
}
|
|
||||||
// 判断containerCode是否为空
|
|
||||||
if (string.IsNullOrEmpty(containerCode))
|
|
||||||
{
|
|
||||||
return JsonMore(null, 500, "容器编码为空!请检查后重新提交!");
|
|
||||||
}
|
|
||||||
// 查询container表code为containercode的值
|
|
||||||
var container = _unitWork.FindSingle<Container>(u => u.Code == containerCode);
|
|
||||||
if (container == null)
|
|
||||||
{
|
|
||||||
return JsonMore(null, 500, $"库内没有编码为 {containerCode} 的容器!");
|
|
||||||
}
|
|
||||||
// 如果 container的库位不为空,或者islock为true,则返回错误信息
|
|
||||||
if (!string.IsNullOrEmpty(container.LocationCode) || container.IsLock == ContainerLockEnum.任务锁)
|
|
||||||
{
|
|
||||||
return JsonMore(null, 500, $"容器 {containerCode} 已被锁定或已在库内!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
container.IsLock = ContainerLockEnum.任务锁;
|
var materials = _unitWork.Find<Material>(x =>
|
||||||
container.UpdateTime = DateTime.Now;
|
x.MaterialCode.Contains(keyword) ||
|
||||||
container.UpdateBy = Wtm?.LoginUserInfo?.ITCode??"WMS";
|
x.MaterialName.Contains(keyword))
|
||||||
// _unitWork.Update(container);
|
.Take(10)
|
||||||
|
.Select(x => new {
|
||||||
|
MaterialCode = x.MaterialCode,
|
||||||
|
MaterialName = x.MaterialName,
|
||||||
|
MaterialSpec = x.MaterialSpec,
|
||||||
|
MaterialUnit = x.MaterialUnit
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
//查找仓位
|
return JsonMore( materials );
|
||||||
var location = _unitWork.Find<Location>(u => u.Status == LocationStatus.空仓位
|
}
|
||||||
&& u.Type == container.Type
|
|
||||||
&& !u.IsStop)
|
[HttpPost]
|
||||||
.OrderByDescending(x => x.Layer)
|
public ActionResult AddInventory(string containerCode, string materialCode, decimal qty)
|
||||||
.ThenByDescending(x => x.Line)
|
{
|
||||||
.FirstOrDefault();
|
try
|
||||||
|
|
||||||
// 判断location是否为空
|
|
||||||
if (location == null)
|
|
||||||
{
|
{
|
||||||
return JsonMore(null, 500, "库内没有空闲仓位!");
|
if (string.IsNullOrEmpty(containerCode))
|
||||||
}
|
{
|
||||||
location.Status = LocationStatus.任务锁;
|
return JsonMore(null, 500, "容器编码为空!");
|
||||||
location.UpdateTime = DateTime.Now;
|
}
|
||||||
location.UpdateBy = Wtm?.LoginUserInfo?.ITCode??"WMS";
|
if (string.IsNullOrEmpty(materialCode))
|
||||||
_unitWork.Update(location);
|
{
|
||||||
|
return JsonMore(null, 500, "物料编码为空!");
|
||||||
|
}
|
||||||
|
if (qty <= 0)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, "数量必须大于0!");
|
||||||
|
}
|
||||||
|
|
||||||
if (inv) //有货
|
// 查询容器
|
||||||
{
|
var container = _unitWork.FindSingle<Container>(u => u.Code == containerCode);
|
||||||
_unitWork.Add<Inventory>(new Inventory()
|
if (container == null)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, $"库内没有编码为 {containerCode} 的容器!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询物料信息
|
||||||
|
var material = _unitWork.FindSingle<Material>(x => x.MaterialCode == materialCode);
|
||||||
|
if (material == null)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, $"未找到物料编码为 {materialCode} 的物料信息!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建库存记录
|
||||||
|
var inventory = new Inventory()
|
||||||
{
|
{
|
||||||
ZoneCode = ZoneCodeEnum.立库,
|
ZoneCode = ZoneCodeEnum.立库,
|
||||||
ContainerCode = containerCode,
|
ContainerCode = containerCode,
|
||||||
LocationCode = location.Code,
|
MaterialCode = material.MaterialCode,
|
||||||
MaterialCode = "123456",
|
MaterialName = material.MaterialName,
|
||||||
MaterialName = "矿泉水",
|
MaterialType = material.MaterialType,
|
||||||
Qty = 1,
|
MaterialSpec = material.MaterialSpec,
|
||||||
|
MaterialUnit = material.MaterialUnit,
|
||||||
|
Qty = qty,
|
||||||
TaskStatus = InventoryTaskStatus.任务中,
|
TaskStatus = InventoryTaskStatus.任务中,
|
||||||
CreateTime = DateTime.Now
|
CreateTime = DateTime.Now
|
||||||
});
|
};
|
||||||
}
|
_unitWork.Add(inventory);
|
||||||
_unitWork.Update(container);
|
|
||||||
//创建容器编码为containercode的任务
|
|
||||||
var task = new TaskHeader
|
|
||||||
{
|
|
||||||
ZoneCode = ZoneCodeEnum.立库,
|
|
||||||
TaskNo = _unitWork.GetSerialNumber("In"),
|
|
||||||
TaskType = TaskTypeEnum.立库入库,
|
|
||||||
ContainerCode = containerCode,
|
|
||||||
FromLocation = "",
|
|
||||||
ToLocation = location.Code,
|
|
||||||
Status = TaskStatusEnum.待下发,
|
|
||||||
CreateBy = Wtm?.LoginUserInfo?.ITCode??"WMS",
|
|
||||||
CreateTime = DateTime.Now
|
|
||||||
};
|
|
||||||
_unitWork.Add(task);
|
|
||||||
|
|
||||||
// 下发任务到wcs
|
// 创建入库交易记录
|
||||||
var postData = new
|
var transaction = new InventoryTransaction
|
||||||
{
|
{
|
||||||
TaskNo = task.TaskNo,
|
BillType = InventoryTranType.入库,
|
||||||
PalletNo = task.ContainerCode,
|
MaterialCode = material.MaterialCode,
|
||||||
FromLocation = task.FromLocation,
|
MaterialName = material.MaterialName,
|
||||||
ToLocation = task.ToLocation
|
MaterialUnit = material.MaterialUnit,
|
||||||
};
|
ContainerCode = containerCode,
|
||||||
try
|
Qty = qty,
|
||||||
{
|
CreateTime = DateTime.Now,
|
||||||
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, postData)
|
CreateBy = "WMS",
|
||||||
.Result.Data;
|
UpdateTime = DateTime.Now,
|
||||||
|
UpdateBy = "WMS"
|
||||||
|
};
|
||||||
|
_unitWork.Add(transaction);
|
||||||
|
|
||||||
if (res.Success)
|
return JsonMore(new { Id = inventory.ID });
|
||||||
{
|
|
||||||
task.Status = TaskStatusEnum.已下发;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
task.ErrorMsg = res.Msg;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
task.ErrorMsg = ex.Message;
|
return JsonMore(null, 500, ex.Message);
|
||||||
}
|
}
|
||||||
task.UpdateTime = DateTime.Now;
|
}
|
||||||
task.UpdateBy = "WMS";
|
|
||||||
_unitWork.Update(task);
|
|
||||||
|
|
||||||
if (agv)
|
[HttpPost]
|
||||||
|
public ActionResult TaskIn(string containerCode)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
// 调用AGV接口
|
if (string.IsNullOrEmpty(containerCode))
|
||||||
var task_id = Wtm.ConfigInfo.AppSettings
|
|
||||||
.FirstOrDefault(x => x.Key == "OutIn").Value;
|
|
||||||
var res2 = Wtm.CallAPI<ShipOutController.agvResult>("ACS", "task_mould_do", HttpMethodEnum.POST, new
|
|
||||||
{
|
{
|
||||||
task_id = task_id
|
return JsonMore(null, 500, "容器编码为空!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询容器
|
||||||
|
var container = _unitWork.FindSingle<Container>(u => u.Code == containerCode);
|
||||||
|
if (container == null)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, $"库内没有编码为 {containerCode} 的容器!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询容器的库存
|
||||||
|
var inventories = _unitWork.Find<Inventory>(x => x.ContainerCode == containerCode).ToList();
|
||||||
|
|
||||||
|
// 根据库存情况设置容器状态
|
||||||
|
if (inventories.Any())
|
||||||
|
{
|
||||||
|
container.Status = ContainerStatus.有;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
container.Status = ContainerStatus.空;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查找仓位
|
||||||
|
var location = _unitWork.Find<Location>(u => u.Status == LocationStatus.空仓位
|
||||||
|
&& u.Type == container.Type
|
||||||
|
&& !u.IsStop)
|
||||||
|
.OrderBy(x => x.Layer)
|
||||||
|
.ThenBy(x => x.Line)
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
// 判断location是否为空
|
||||||
|
if (location == null)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, "库内没有空闲仓位!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新容器状态
|
||||||
|
container.IsLock = ContainerLockEnum.任务锁;
|
||||||
|
container.UpdateTime = DateTime.Now;
|
||||||
|
container.UpdateBy = Wtm?.LoginUserInfo?.ITCode ?? "WMS";
|
||||||
|
// _unitWork.Update(container);
|
||||||
|
|
||||||
|
// 更新仓位状态
|
||||||
|
location.Status = LocationStatus.任务锁;
|
||||||
|
location.UpdateTime = DateTime.Now;
|
||||||
|
location.UpdateBy = Wtm?.LoginUserInfo?.ITCode ?? "WMS";
|
||||||
|
// _unitWork.Update(location);
|
||||||
|
|
||||||
|
// 更新库存记录
|
||||||
|
// foreach (var inventory in inventories)
|
||||||
|
// {
|
||||||
|
// inventory.LocationCode = location.Code;
|
||||||
|
// _unitWork.Update(inventory);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// 创建入库任务
|
||||||
|
var task = new TaskHeader
|
||||||
|
{
|
||||||
|
ZoneCode = ZoneCodeEnum.立库,
|
||||||
|
TaskNo = _unitWork.GetSerialNumber("In"),
|
||||||
|
TaskType = TaskTypeEnum.立库入库,
|
||||||
|
ContainerCode = containerCode,
|
||||||
|
FromLocation = "",
|
||||||
|
ToLocation = location.Code,
|
||||||
|
Status = TaskStatusEnum.待下发,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
CreateBy = Wtm?.LoginUserInfo?.ITCode??"WMS",
|
||||||
|
};
|
||||||
|
|
||||||
|
// _unitWork.Add(task);
|
||||||
|
|
||||||
|
// 下发任务到wcs
|
||||||
|
var postData = new
|
||||||
|
{
|
||||||
|
TaskNo = task.TaskNo,
|
||||||
|
PalletNo = task.ContainerCode,
|
||||||
|
FromLocation = task.FromLocation,
|
||||||
|
ToLocation = task.ToLocation
|
||||||
|
};
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var res = Wtm.CallAPI<ApiJsonResult<dynamic>>("WCS", "TaskAssign", HttpMethodEnum.POST, postData)
|
||||||
|
.Result?.Data;
|
||||||
|
|
||||||
|
if (res.Success)
|
||||||
|
{
|
||||||
|
task.Status = TaskStatusEnum.已下发;
|
||||||
|
task.UpdateTime = DateTime.Now;
|
||||||
|
task.UpdateBy = "WMS";
|
||||||
|
_unitWork.Add(task);
|
||||||
|
|
||||||
|
_unitWork.Update(container);
|
||||||
|
_unitWork.Update(location);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
task.ErrorMsg = res.Msg;
|
||||||
|
return JsonMore(null, 500, res.Msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
task.ErrorMsg = ex.Message;
|
||||||
|
return JsonMore(null, 500, "任务下发失败!");
|
||||||
|
}
|
||||||
|
|
||||||
|
return JsonMore(null);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public ActionResult DeleteInventory(int id)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// 查询库存记录
|
||||||
|
var inventory = _unitWork.Find<Inventory>(x => x.ID == id).FirstOrDefault();
|
||||||
|
|
||||||
|
if (inventory == null)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, "未找到对应的库存记录!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建出库交易记录
|
||||||
|
var transaction = new InventoryTransaction
|
||||||
|
{
|
||||||
|
BillType = InventoryTranType.出库,
|
||||||
|
MaterialCode = inventory.MaterialCode,
|
||||||
|
MaterialName = inventory.MaterialName,
|
||||||
|
MaterialUnit = inventory.MaterialUnit,
|
||||||
|
ContainerCode = inventory.ContainerCode,
|
||||||
|
Qty = inventory.Qty,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
CreateBy = "WMS",
|
||||||
|
UpdateTime = DateTime.Now,
|
||||||
|
UpdateBy = "WMS"
|
||||||
|
};
|
||||||
|
_unitWork.Add(transaction);
|
||||||
|
|
||||||
|
// 删除库存记录
|
||||||
|
_unitWork.Delete(inventory);
|
||||||
|
|
||||||
|
return JsonMore(null);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public ActionResult UpdateInventory(int id, decimal qty)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (qty <= 0)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, "数量必须大于0!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询库存记录
|
||||||
|
var inventory = _unitWork.Find<Inventory>(x => x.ID == id).FirstOrDefault();
|
||||||
|
|
||||||
|
if (inventory == null)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, "未找到对应的库存记录!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建出库交易记录(原数量)
|
||||||
|
var outTransaction = new InventoryTransaction
|
||||||
|
{
|
||||||
|
BillType = InventoryTranType.出库,
|
||||||
|
MaterialCode = inventory.MaterialCode,
|
||||||
|
MaterialName = inventory.MaterialName,
|
||||||
|
MaterialUnit = inventory.MaterialUnit,
|
||||||
|
ContainerCode = inventory.ContainerCode,
|
||||||
|
Qty = inventory.Qty,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
CreateBy = "WMS",
|
||||||
|
UpdateTime = DateTime.Now,
|
||||||
|
UpdateBy = "WMS"
|
||||||
|
};
|
||||||
|
_unitWork.Add(outTransaction);
|
||||||
|
|
||||||
|
// 创建入库交易记录(新数量)
|
||||||
|
var inTransaction = new InventoryTransaction
|
||||||
|
{
|
||||||
|
BillType = InventoryTranType.入库,
|
||||||
|
MaterialCode = inventory.MaterialCode,
|
||||||
|
MaterialName = inventory.MaterialName,
|
||||||
|
MaterialUnit = inventory.MaterialUnit,
|
||||||
|
ContainerCode = inventory.ContainerCode,
|
||||||
|
Qty = qty,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
CreateBy = "WMS",
|
||||||
|
UpdateTime = DateTime.Now,
|
||||||
|
UpdateBy = "WMS"
|
||||||
|
};
|
||||||
|
_unitWork.Add(inTransaction);
|
||||||
|
|
||||||
|
// 更新库存数量
|
||||||
|
inventory.Qty = qty;
|
||||||
|
inventory.UpdateTime = DateTime.Now;
|
||||||
|
inventory.UpdateBy = Wtm?.LoginUserInfo?.ITCode ?? "WMS";
|
||||||
|
_unitWork.Update(inventory);
|
||||||
|
|
||||||
|
return JsonMore(null);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return JsonMore(null, 500, ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public JsonResult ValidateContainer(string containerCode)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(containerCode))
|
||||||
|
{
|
||||||
|
return Json(new { Code = 400, Msg = "容器编码不能为空" });
|
||||||
|
}
|
||||||
|
|
||||||
|
var container = _unitWork.FindSingle<Container>(u => u.Code == containerCode);
|
||||||
|
if (container == null)
|
||||||
|
{
|
||||||
|
return Json(new { Code = 400, Msg = "容器不存在" });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(container.LocationCode))
|
||||||
|
{
|
||||||
|
return Json(new { Code = 400, Msg = $"{containerCode} 容器状态不正确!已存在任务或者已在库内" });
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取容器内的物料信息
|
||||||
|
var inventories = _unitWork.Find<Inventory>(x => x.ContainerCode == containerCode)
|
||||||
|
.Select(x => new {
|
||||||
|
Id = x.ID,
|
||||||
|
ContainerCode = x.ContainerCode,
|
||||||
|
MaterialCode = x.MaterialCode,
|
||||||
|
MaterialName = x.MaterialName,
|
||||||
|
Qty = x.Qty
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
return Json(new {
|
||||||
|
Code = 200,
|
||||||
|
Msg = "验证成功",
|
||||||
|
Data = inventories
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return JsonMore(null);
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
return Json(new { Code = 500, Msg = ex.Message });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,36 +1,69 @@
|
|||||||
<div id="receiptin">
|
<div id="receiptin">
|
||||||
<a-space direction="vertical" fill>
|
<a-space direction="vertical" fill>
|
||||||
<a-space>
|
<a-form :model="formData" layout="vertical">
|
||||||
<template #split>
|
<a-form-item field="containerCode" label="容器编码">
|
||||||
<a-divider direction="vertical"/>
|
<a-input
|
||||||
</template>
|
v-model="ContainerCode"
|
||||||
<a-input :style="{width:'150px'}" placeholder="扫描箱号" v-model="ContainerCode" allow-clear/>
|
placeholder="扫描箱号"
|
||||||
<a-switch v-model="inv">
|
allow-clear
|
||||||
<template #checked>
|
@@keyup.enter="validateContainer"
|
||||||
载货
|
ref="containerInput"/>
|
||||||
</template>
|
</a-form-item>
|
||||||
<template #unchecked>
|
<a-form-item field="materialCode" label="物料信息">
|
||||||
空箱
|
<a-auto-complete
|
||||||
</template>
|
v-model="MaterialCode"
|
||||||
</a-switch>
|
:data="materialOptions"
|
||||||
|
@@search="handleSearch"
|
||||||
|
@@select="handleSelect"
|
||||||
|
placeholder="输入物料编码或名称"
|
||||||
|
ref="materialInput">
|
||||||
|
</a-auto-complete>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item field="materialName" label="物料名称">
|
||||||
|
<a-input v-model="MaterialName" disabled/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item field="materialSpec" label="物料型号">
|
||||||
|
<a-input v-model="MaterialSpec" disabled/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item field="qty" label="数量">
|
||||||
|
<a-input-number v-model="Qty" :min="0" style="width: 100%"/>
|
||||||
|
</a-form-item>
|
||||||
|
<a-form-item>
|
||||||
|
<a-space>
|
||||||
|
<a-button @@click="handleBind" type="primary">绑定</a-button>
|
||||||
|
<a-button @@click="handleClick" :loading="loading1" type="primary">入库</a-button>
|
||||||
|
</a-space>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
|
||||||
<a-switch v-model="agv">
|
<a-table :data="bindList" :columns="columns" :pagination="false">
|
||||||
<template #checked>
|
<template #operations="{ record }">
|
||||||
出库口
|
<a-space>
|
||||||
|
<a-button type="text" status="danger" @@click="handleDelete(record)">删除</a-button>
|
||||||
|
<a-button type="text" @@click="handleEdit(record)">修改</a-button>
|
||||||
|
<a-button type="text" @@click="handleDeduct(record)">扣料</a-button>
|
||||||
|
</a-space>
|
||||||
</template>
|
</template>
|
||||||
<template #unchecked>
|
<template #qty="{ record }">
|
||||||
入库口
|
{{ Math.floor(record.Qty) }}
|
||||||
</template>
|
</template>
|
||||||
</a-switch>
|
</a-table>
|
||||||
</a-space>
|
|
||||||
|
|
||||||
<a-space>
|
<a-modal v-model:visible="editModalVisible" title="修改数量" @@ok="handleEditConfirm" @@cancel="handleEditCancel">
|
||||||
<a-button @@click="handleClick"
|
<a-form :model="editForm">
|
||||||
:loading="loading1"
|
<a-form-item field="qty" label="数量">
|
||||||
type="primary" size="large">
|
<a-input-number v-model="editForm.qty" :min="0" :precision="0" style="width: 100%"/>
|
||||||
入库
|
</a-form-item>
|
||||||
</a-button>
|
</a-form>
|
||||||
</a-space>
|
</a-modal>
|
||||||
|
|
||||||
|
<a-modal v-model:visible="deductModalVisible" title="扣除数量" @@ok="handleDeductConfirm" @@cancel="handleDeductCancel">
|
||||||
|
<a-form :model="deductForm">
|
||||||
|
<a-form-item field="qty" label="扣除数量">
|
||||||
|
<a-input-number v-model="deductForm.qty" :min="0" :max="deductForm.maxQty" :precision="0" style="width: 100%"/>
|
||||||
|
</a-form-item>
|
||||||
|
</a-form>
|
||||||
|
</a-modal>
|
||||||
</a-space>
|
</a-space>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
@@ -40,47 +73,371 @@
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
ContainerCode: '',
|
ContainerCode: '',
|
||||||
loading1:false,
|
MaterialCode: '',
|
||||||
inv:false,
|
MaterialName: '',
|
||||||
agv:false,
|
MaterialSpec: '',
|
||||||
data: reactive([])
|
Qty: null,
|
||||||
|
loading1: false,
|
||||||
|
materialOptions: [],
|
||||||
|
searchTimer: null,
|
||||||
|
bindList: [],
|
||||||
|
editModalVisible: false,
|
||||||
|
editForm: {
|
||||||
|
index: -1,
|
||||||
|
qty: 0
|
||||||
|
},
|
||||||
|
deductModalVisible: false,
|
||||||
|
deductForm: {
|
||||||
|
index: -1,
|
||||||
|
qty: 0,
|
||||||
|
maxQty: 0
|
||||||
|
},
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
title: 'ID',
|
||||||
|
dataIndex: 'Id',
|
||||||
|
width: 80
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '容器编码',
|
||||||
|
dataIndex: 'ContainerCode',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '物料编码',
|
||||||
|
dataIndex: 'MaterialCode',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '物料名称',
|
||||||
|
dataIndex: 'MaterialName',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '物料型号',
|
||||||
|
dataIndex: 'MaterialSpec',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '数量',
|
||||||
|
dataIndex: 'Qty',
|
||||||
|
slotName: 'qty'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '操作',
|
||||||
|
slotName: 'operations',
|
||||||
|
width: 120
|
||||||
|
}
|
||||||
|
],
|
||||||
|
formData: {
|
||||||
|
containerCode: '',
|
||||||
|
materialCode: '',
|
||||||
|
materialName: '',
|
||||||
|
qty: 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
// 页面加载完成后,将焦点设置到容器编码输入框
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.containerInput.focus();
|
||||||
|
});
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleSearch(value) {
|
||||||
handleClick() {
|
if (this.searchTimer) {
|
||||||
var _this = this;
|
clearTimeout(this.searchTimer);
|
||||||
if (_this.ContainerCode == ""){
|
|
||||||
_this.$message.error("请扫描箱号!");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
this.searchTimer = setTimeout(() => {
|
||||||
|
if (value) {
|
||||||
|
this.searchMaterials(value);
|
||||||
|
} else {
|
||||||
|
this.materialOptions = [];
|
||||||
|
}
|
||||||
|
}, 300);
|
||||||
|
},
|
||||||
|
|
||||||
_this.loading1 = !_this.loading1
|
searchMaterials(keyword) {
|
||||||
|
var _this = this;
|
||||||
let postData = new URLSearchParams();
|
axios.get(`/receipt/ReceiptIn/SearchMaterials?keyword=${encodeURIComponent(keyword)}`)
|
||||||
postData.append('containerCode', _this.ContainerCode);
|
|
||||||
postData.append('inv', _this.inv);
|
|
||||||
postData.append('agv', _this.agv);
|
|
||||||
|
|
||||||
axios.post("/receipt/ReceiptIn/TaskIn", postData)
|
|
||||||
.then(function (json) {
|
.then(function (json) {
|
||||||
_this.loading1 = !_this.loading1;
|
if (json.data.Code == 200) {
|
||||||
if (json.data.Code == 200){
|
_this.materialOptions = json.data.Data.map(item => ({
|
||||||
_this.ContainerCode = '';
|
...item,
|
||||||
_this.$message.success("入库任务创建成功!");
|
value: item.MaterialCode,
|
||||||
}
|
label: `${item.MaterialCode} - ${item.MaterialName} - ${item.MaterialSpec}`
|
||||||
else{
|
}));
|
||||||
|
} else {
|
||||||
_this.$message.error(json.data.Msg);
|
_this.$message.error(json.data.Msg);
|
||||||
|
_this.materialOptions = [];
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
_this.$message.error(error);
|
_this.$message.error(error);
|
||||||
|
_this.materialOptions = [];
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
handleSelect(value, option) {
|
||||||
|
const selectedMaterial = this.materialOptions.find(item => item.value === value);
|
||||||
|
if (selectedMaterial) {
|
||||||
|
this.MaterialCode = selectedMaterial.MaterialCode;
|
||||||
|
this.MaterialName = selectedMaterial.MaterialName;
|
||||||
|
this.MaterialSpec = selectedMaterial.MaterialSpec;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
handleBind() {
|
||||||
|
if (!this.ContainerCode) {
|
||||||
|
this.$notification.error("请扫描箱号!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!this.MaterialCode) {
|
||||||
|
this.$notification.error("请选择物料!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!this.Qty || this.Qty <= 0 || !Number.isInteger(this.Qty)) {
|
||||||
|
this.$notification.error("请输入大于0的正整数!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查已绑定物料的容器编码
|
||||||
|
if (this.bindList.length > 0) {
|
||||||
|
const firstBind = this.bindList[0];
|
||||||
|
if (firstBind.ContainerCode !== this.ContainerCode) {
|
||||||
|
this.$notification.warning("容器编码已变更,已清空绑定物料");
|
||||||
|
this.bindList = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加到绑定列表
|
||||||
|
const bindItem = {
|
||||||
|
ContainerCode: this.ContainerCode,
|
||||||
|
MaterialCode: this.MaterialCode,
|
||||||
|
MaterialName: this.MaterialName,
|
||||||
|
MaterialSpec: this.MaterialSpec,
|
||||||
|
Qty: this.Qty
|
||||||
|
};
|
||||||
|
|
||||||
|
// 调用后端添加库存
|
||||||
|
let postData = new URLSearchParams();
|
||||||
|
postData.append('containerCode', this.ContainerCode);
|
||||||
|
postData.append('materialCode', this.MaterialCode);
|
||||||
|
postData.append('qty', this.Qty);
|
||||||
|
|
||||||
|
axios.post("/receipt/ReceiptIn/AddInventory", postData)
|
||||||
|
.then((json) => {
|
||||||
|
if (json.data.Code == 200) {
|
||||||
|
// 添加ID到绑定项
|
||||||
|
bindItem.Id = json.data.Data.Id;
|
||||||
|
this.bindList.push(bindItem);
|
||||||
|
this.$message.success("物料绑定成功");
|
||||||
|
// 清空表单
|
||||||
|
this.MaterialCode = '';
|
||||||
|
this.MaterialName = '';
|
||||||
|
this.MaterialSpec = '';
|
||||||
|
this.Qty = null;
|
||||||
|
// 验证成功后,将焦点设置到物料编码输入框
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.materialInput.focus();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$notification.error(json.data.Msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
this.$notification.error("物料绑定失败");
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
handleClick() {
|
||||||
|
if (!this.ContainerCode) {
|
||||||
|
this.$notification.error('请扫描箱号!');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.loading1 = true;
|
||||||
|
let postData = new URLSearchParams();
|
||||||
|
postData.append('containerCode', this.ContainerCode);
|
||||||
|
|
||||||
|
axios.post("/receipt/ReceiptIn/TaskIn", postData)
|
||||||
|
.then((json) => {
|
||||||
|
this.loading1 = false;
|
||||||
|
if (json.data.Code == 200) {
|
||||||
|
this.ContainerCode = '';
|
||||||
|
this.MaterialCode = '';
|
||||||
|
this.MaterialName = '';
|
||||||
|
this.Qty = 1;
|
||||||
|
this.bindList = [];
|
||||||
|
this.$notification.success("入库任务创建成功!");
|
||||||
|
} else {
|
||||||
|
this.$notification.error({
|
||||||
|
content: json.data.Msg,
|
||||||
|
duration: 5000,
|
||||||
|
closable: true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
this.loading1 = false;
|
||||||
|
this.$notification.error({
|
||||||
|
content: error,
|
||||||
|
duration: 5000,
|
||||||
|
closable: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
validateContainer() {
|
||||||
|
if (!this.ContainerCode) return;
|
||||||
|
|
||||||
|
axios.get(`/receipt/ReceiptIn/ValidateContainer?containerCode=${encodeURIComponent(this.ContainerCode)}`)
|
||||||
|
.then((json) => {
|
||||||
|
if (json.data.Code == 200) {
|
||||||
|
this.$message.success("容器验证成功");
|
||||||
|
// 更新绑定列表
|
||||||
|
this.bindList = json.data.Data;
|
||||||
|
// 验证成功后,将焦点设置到物料编码输入框
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.materialInput.focus();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.$message.error(json.data.Msg || "容器验证失败");
|
||||||
|
this.ContainerCode = '';
|
||||||
|
this.bindList = [];
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
this.$message.error("容器验证失败");
|
||||||
|
this.ContainerCode = '';
|
||||||
|
this.bindList = [];
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
handleDelete(record) {
|
||||||
|
const index = this.bindList.findIndex(item => item.Id === record.Id);
|
||||||
|
|
||||||
|
if (index > -1) {
|
||||||
|
// 调用后端删除库存
|
||||||
|
let postData = new URLSearchParams();
|
||||||
|
postData.append('id', record.Id);
|
||||||
|
|
||||||
|
axios.post("/receipt/ReceiptIn/DeleteInventory", postData)
|
||||||
|
.then((json) => {
|
||||||
|
if (json.data.Code == 200) {
|
||||||
|
this.bindList.splice(index, 1);
|
||||||
|
this.$message.success("删除成功");
|
||||||
|
} else {
|
||||||
|
this.$message.error(json.data.Msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
this.$message.error("删除失败");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
handleEdit(record) {
|
||||||
|
this.editForm.index = this.bindList.findIndex(item => item.Id === record.Id);
|
||||||
|
this.editForm.qty = Math.floor(record.Qty);
|
||||||
|
this.editModalVisible = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
handleEditConfirm() {
|
||||||
|
if (this.editForm.index > -1) {
|
||||||
|
if (!this.editForm.qty || this.editForm.qty <= 0 || !Number.isInteger(this.editForm.qty)) {
|
||||||
|
this.$notification.error("请输入大于0的正整数!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const record = this.bindList[this.editForm.index];
|
||||||
|
|
||||||
|
// 调用后端更新库存
|
||||||
|
let postData = new URLSearchParams();
|
||||||
|
postData.append('id', record.Id);
|
||||||
|
postData.append('qty', this.editForm.qty);
|
||||||
|
|
||||||
|
axios.post("/receipt/ReceiptIn/UpdateInventory", postData)
|
||||||
|
.then((json) => {
|
||||||
|
if (json.data.Code == 200) {
|
||||||
|
this.bindList[this.editForm.index].Qty = this.editForm.qty;
|
||||||
|
this.$notification.success("修改成功");
|
||||||
|
this.editModalVisible = false;
|
||||||
|
} else {
|
||||||
|
this.$notification.error(json.data.Msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
this.$notification.error("修改失败");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
handleEditCancel() {
|
||||||
|
this.editModalVisible = false;
|
||||||
|
this.editForm.index = -1;
|
||||||
|
this.editForm.qty = 1;
|
||||||
|
},
|
||||||
|
|
||||||
|
handleDeduct(record) {
|
||||||
|
this.deductForm.index = this.bindList.findIndex(item => item.Id === record.Id);
|
||||||
|
this.deductForm.qty = null;
|
||||||
|
this.deductForm.maxQty = Math.floor(record.Qty);
|
||||||
|
this.deductModalVisible = true;
|
||||||
|
},
|
||||||
|
|
||||||
|
handleDeductConfirm() {
|
||||||
|
if (this.deductForm.index > -1) {
|
||||||
|
const record = this.bindList[this.deductForm.index];
|
||||||
|
|
||||||
|
if (!this.deductForm.qty) {
|
||||||
|
this.$notification.error("请输入扣除数量");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Number.isInteger(this.deductForm.qty) || this.deductForm.qty <= 0) {
|
||||||
|
this.$notification.error("请输入大于0的正整数!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.deductForm.qty > record.Qty) {
|
||||||
|
this.$notification.error("扣除数量不能大于当前数量");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const newQty = record.Qty - this.deductForm.qty;
|
||||||
|
|
||||||
|
if (newQty == 0) {
|
||||||
|
// 如果扣除后数量等于0,直接删除
|
||||||
|
this.handleDelete(record);
|
||||||
|
} else {
|
||||||
|
// 调用后端更新库存
|
||||||
|
let postData = new URLSearchParams();
|
||||||
|
postData.append('id', record.Id);
|
||||||
|
postData.append('qty', newQty);
|
||||||
|
|
||||||
|
axios.post("/receipt/ReceiptIn/UpdateInventory", postData)
|
||||||
|
.then((json) => {
|
||||||
|
if (json.data.Code == 200) {
|
||||||
|
this.bindList[this.deductForm.index].Qty = newQty;
|
||||||
|
this.$notification.success("扣除成功");
|
||||||
|
this.deductModalVisible = false;
|
||||||
|
} else {
|
||||||
|
this.$notification.error(json.data.Msg);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
this.$notification.error("扣除失败");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
handleDeductCancel() {
|
||||||
|
this.deductModalVisible = false;
|
||||||
|
this.deductForm.index = -1;
|
||||||
|
this.deductForm.qty = 1;
|
||||||
|
this.deductForm.maxQty = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
app.use(ArcoVue)
|
app.use(ArcoVue)
|
||||||
.use(ArcoVueIcon)
|
.use(ArcoVueIcon)
|
||||||
.mount('#receiptin');
|
.mount('#receiptin');
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
@model WalkingTec.Mvvm.Core.BaseVM
|
||||||
|
@using System.Text.Json
|
||||||
|
|
||||||
|
<div class="layui-row layui-col-space15" id="frontpage">
|
||||||
|
<div class="layui-col-md12">
|
||||||
|
<div class="layui-row layui-col-space15">
|
||||||
|
<div class="layui-col-md6">
|
||||||
|
<div class="layui-card">
|
||||||
|
<div class="layui-card-header">快捷菜单</div>
|
||||||
|
<div class="layui-card-body">
|
||||||
|
|
||||||
|
<div class="layui-carousel layadmin-carousel layadmin-shortcut">
|
||||||
|
<div carousel-item>
|
||||||
|
<ul class="layui-row layui-col-space10">
|
||||||
|
<li class="layui-col-xs3">
|
||||||
|
<a lay-href="receipt/ReceiptIn/Index">
|
||||||
|
<i class="layui-icon layui-icon-file"></i>
|
||||||
|
<cite>出入库操作</cite>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
$("#frontpage").parent().css("background-color", "#eee");
|
||||||
|
$.get("/Home/GetGithubInfo", function (r) {
|
||||||
|
if (r === undefined || r === null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$("#githubstar").html(r.stargazers_count);
|
||||||
|
$("#githubstars").html(r.stargazers_count);
|
||||||
|
$("#githubfork").html(r.forks_count);
|
||||||
|
$("#githubwatch").html(r.subscribers_count);
|
||||||
|
$("#githubissue").html(r.open_issues_count);
|
||||||
|
});
|
||||||
|
|
||||||
|
//区块轮播切换
|
||||||
|
layui.use(['admin', 'carousel'], function () {
|
||||||
|
var $ = layui.$
|
||||||
|
, admin = layui.admin
|
||||||
|
, carousel = layui.carousel
|
||||||
|
, element = layui.element
|
||||||
|
, device = layui.device();
|
||||||
|
|
||||||
|
//轮播切换
|
||||||
|
$('.layadmin-carousel').each(function () {
|
||||||
|
var othis = $(this);
|
||||||
|
carousel.render({
|
||||||
|
elem: this
|
||||||
|
, width: '100%'
|
||||||
|
, arrow: 'none'
|
||||||
|
, interval: othis.data('interval')
|
||||||
|
, autoplay: othis.data('autoplay') === true
|
||||||
|
, trigger: (device.ios || device.android) ? 'click' : 'hover'
|
||||||
|
, anim: othis.data('anim')
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
element.render('progress');
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
Reference in new issue
Block a user