diff --git a/HHWMS.Web/Areas/Api/IWCSController.cs b/HHWMS.Web/Areas/Api/IWCSController.cs
index 18cd9ae..72e9be9 100644
--- a/HHWMS.Web/Areas/Api/IWCSController.cs
+++ b/HHWMS.Web/Areas/Api/IWCSController.cs
@@ -84,8 +84,8 @@ namespace HHWMS.Web
return ApiResultError($"处理请求时发生错误: {ex.Message}");
}
}
-
-
+
+
///
/// 满入处理
///
@@ -100,14 +100,14 @@ namespace HHWMS.Web
{
return ApiResultError(msg: "未找到任务!");
}
-
+
// 更新旧仓位
var oldLoc = _unitWork.FindSingle(x => x.Code == task.ToLocation);
oldLoc.ContainerCode = "FullIn";
oldLoc.UpdateBy = "FullIn";
oldLoc.UpdateTime = DateTime.Now;
_unitWork.Update(oldLoc);
-
+
//查找新仓位
var locationVm = Wtm.CreateVM();
var res = locationVm.GetMoveLocation(oldLoc);
@@ -131,11 +131,11 @@ namespace HHWMS.Web
}
else
{
- return ApiResultError(msg:res.Message);
+ return ApiResultError(msg: res.Message);
}
}
-
-
+
+
///
/// 空出处理
///
@@ -149,31 +149,32 @@ namespace HHWMS.Web
{
return ApiResultError(msg: "未找到任务!");
}
+
//1. 更新容器
var container = _unitWork.FindSingle(x => x.Code == task.ContainerCode);
container.UpdateBy = "EmptyOut";
container.UpdateTime = DateTime.Now;
_unitWork.Update(container);
-
+
//2. 更新库位
var location = _unitWork.FindSingle(x => x.Code == task.FromLocation);
location.UpdateBy = "EmptyOut";
location.UpdateTime = DateTime.Now;
location.ContainerStatus = LocationStatus.空仓位;
_unitWork.Update(location);
-
+
//3. 更新任务
task.UpdateBy = "EmptyOut";
task.UpdateTime = DateTime.Now;
task.ErrorMsg = "空出";
-
-
+
+
var taskHistory = _mapper.Map(task);
_unitWork.Add(taskHistory);
_unitWork.Delete(task);
//4. 更新库存
- _unitWork.BatchUpdate(x => x.ContainerCode == task.ContainerCode,x => new Inventory()
+ _unitWork.BatchUpdate(x => x.ContainerCode == task.ContainerCode, x => new Inventory()
{
LocationCode = "空出",
UpdateBy = "EmptyOut",
@@ -181,8 +182,8 @@ namespace HHWMS.Web
});
return ApiResult();
}
-
-
+
+
///
/// 取货错处理
///
@@ -196,13 +197,14 @@ namespace HHWMS.Web
{
return ApiResultError(msg: "未找到任务!");
}
+
var outLoc = _unitWork.FindSingle(x => x.Code == task.FromLocation);
var outTask = _unitWork.FindSingle(x => x.FromLocation == outLoc.ContiguousCode);
if (outTask != null)
{
return ApiResultError(msg: $"外侧仓位 {outLoc.Code} 已有出库任务!");
}
-
+
// 生成外侧仓位的移库任务
var locationVm = Wtm.CreateVM();
var moveLocRes = locationVm.GetMoveLocation(outLoc);
@@ -221,7 +223,7 @@ namespace HHWMS.Web
CreateBy = "PickError",
CreateTime = DateTime.Now,
};
-
+
var sendTaskRes = locationVm.SendWcsTask(taskHeader);
if (sendTaskRes.Status)
{
@@ -241,9 +243,10 @@ namespace HHWMS.Web
{
return ApiResultError(msg: moveLocRes.Message);
}
-
+
return ApiResult();
}
+
///
/// 状态返回(带防抖)
///
@@ -303,17 +306,17 @@ namespace HHWMS.Web
// 根据请求的高度,分配仓位
var locationVm = Wtm.CreateVM();
-
+
request.RoadWay = 2;
-
+
// 默认1 模具2 低仓位3 高仓位4 成品大于4 超限 模具大于2 超限
- if(request.Height == 2)
+ if (request.Height == 2)
request.Height = 999;
else if (request.Height == 3)
request.Height = 1100;
else
request.Height = 0;
-
+
var container = _unitWork.FindSingle(x => x.Code == task.ContainerCode);
if (container != null)
{
@@ -331,6 +334,7 @@ namespace HHWMS.Web
{
return ApiResultError(msg: "模具超高,未找到合适的仓位");
}
+
var location = locationVm.GetLocation(request).Data;
if (location != null)
{
@@ -382,40 +386,67 @@ namespace HHWMS.Web
{
var containerconfig = _unitWork.Find(x => x.DictType == "ContainerConfig")
.ToList();
- int ContainerWeight = int.Parse(containerconfig.FirstOrDefault(x => x.DictLabelUs.ToLower() == "container")?.DictValue);
- int SmallContainerWeight = int.Parse(containerconfig.FirstOrDefault(x => x.ID == inventory.Flag)?.DictValue);
+ int ContainerWeight = int.Parse(containerconfig
+ .FirstOrDefault(x => x.DictLabelUs.ToLower() == "container")?.DictValue);
+ int SmallContainerWeight =
+ int.Parse(containerconfig.FirstOrDefault(x => x.ID == inventory.Flag)?.DictValue);
var material =
_unitWork.FindSingle(x => x.MaterialCode == inventory.MaterialCode);
- inventory.Qty = (int)((request.Weight * 100 - ContainerWeight - inventory.TaskQty * SmallContainerWeight) / (material.Qty ?? 1));
+ inventory.Qty =
+ (int)((request.Weight * 100 - ContainerWeight -
+ inventory.TaskQty * SmallContainerWeight) / (material.Qty ?? 1));
inventory.Qty = inventory.Qty > 0 ? inventory.Qty : 0;
-
- // ERP相关
+ }
+
+ if (!string.IsNullOrEmpty(inventory.ReceiptDetailId))
+ {
+ // ERP相关 入库报工
var finishInRequest = new FinishInRequest
{
Main = new FinishInMain
{
- ErpCode = "999", // 账套号
- InCode = _unitWork.GetSerialNumber(inventory.SourceCode), // 报工单号(上游单号)
- InDate = (inventory.CreateTime ?? DateTime.Now).ToString("yyyy-MM-dd"), // 报工日期
- StepCode = inventory.BatchCode, // 工序(批次编码)
- WorkerCode = inventory.CreateBy, // 工人编码(创建人)
- Maker = _unitWork.FindSingle(x =>
- x.ITCode == inventory.CreateBy).Name // 制单人(校验员)
+ ErpCode = "002", // 账套号
+ InCode = _unitWork.GetSerialNumber("RW"), // 报工单号(上游单号)
+ InDate = (inventory.CreateTime ?? DateTime.Now)
+ .ToString("yyyy-MM-dd"), // 报工日期
+ StepCode = inventory.BatchCode, // 工序(批次编码)
+ WorkerCode = inventory.CreateBy, // 工人编码(创建人)
+ Maker = _unitWork.FindSingle(x =>
+ x.ITCode == inventory.CreateBy).Name // 制单人(校验员)
},
Details = new List()
};
-
- // 根据库存构建明细
- finishInRequest.Details.Add(new FinishInDetail
+ if (task.TaskType == TaskTypeEnum.入库)
{
- MoDetailId = inventory.ReceiptDetailId, // 生产订单明细(ERP明细ID)
- InvCode = inventory.MaterialCode, // 物料号
- Qty = inventory.Qty ?? 0 // 完工数量
- });
-
+ // 根据库存构建明细
+ finishInRequest.Details.Add(new FinishInDetail
+ {
+ MoDetailId = inventory.ReceiptDetailId, // 生产订单明细(ERP明细ID)
+ InvCode = inventory.MaterialCode, // 物料号
+ Qty = inventory.Qty ?? 0 // 完工数量
+ });
+ }
+ else if (task.TaskType == TaskTypeEnum.出库)
+ {
+ finishInRequest.Details.Add(new FinishInDetail
+ {
+ MaterialDetails = new List
+ {
+ new MaterialDetail
+ {
+ MoDetailId = inventory.ReceiptDetailId, // 生产订单明细ID
+ InvCode = inventory.MaterialCode, // 物料号
+ Qty = (decimal)inventory.Qty // 完工数量(空值兜底为0)
+ }
+ }
+ });
+ }
+
// 调用ERP接口
- var apiResult = await Wtm.CallAPI("ERP", "FinishIn", HttpMethodEnum.POST, finishInRequest);
+ var apiResult = await Wtm.CallAPI("ERP", "FinishIn",
+ HttpMethodEnum.POST,
+ finishInRequest);
if (apiResult.Data != null && apiResult.Data.Result)
{
@@ -426,6 +457,7 @@ namespace HHWMS.Web
inventory.UploadErpFlag = 0;
}
}
+
if (task.TaskType != TaskTypeEnum.移库)
{
@@ -434,7 +466,7 @@ namespace HHWMS.Web
invTran.Type = task.TaskType == TaskTypeEnum.入库
? InventoryTranType.入库
: InventoryTranType.出库;
-
+
invTrans.Add(invTran);
}
else
@@ -442,16 +474,16 @@ namespace HHWMS.Web
// 创建库存交易记录 放到任务完成,计算数量信息
var invTran = _mapper.Map(inventory);
invTran.Type = InventoryTranType.入库;
-
+
invTrans.Add(invTran);
-
+
var invTran2 = _mapper.Map(inventory);
invTran2.Type = InventoryTranType.出库;
-
+
invTrans.Add(invTran2);
}
}
-
+
inventory.TaskStatus = InventoryTaskStatusEnum.Idle;
}
@@ -477,7 +509,7 @@ namespace HHWMS.Web
container.LocationCode = task.TaskType == TaskTypeEnum.出库 ? "" : task.ToLocation;
container.IsLock = ContainerLockEnum.未锁;
container.UpdateTime = DateTime.Now;
-
+
_unitWork.Update(container);
}
@@ -516,7 +548,7 @@ namespace HHWMS.Web
// 处理移库:同时更新源库位和目标库位
// 1. 更新源库位(移出后变为空)
var sourceLocation = _unitWork.FindSingle(x => x.Code == task.FromLocation);
-
+
// 2. 更新目标库位(移入后有容器)
var targetLocation = _unitWork.FindSingle(x => x.Code == task.ToLocation);
if (targetLocation != null)
@@ -527,7 +559,7 @@ namespace HHWMS.Web
targetLocation.UpdateTime = DateTime.Now;
_unitWork.Update(targetLocation);
}
-
+
if (sourceLocation != null)
{
sourceLocation.ContainerCode = "";
@@ -566,8 +598,7 @@ namespace HHWMS.Web
}
#region 暂时无用
-
-
+
///
/// 请求入库(带防抖)
///
@@ -595,7 +626,7 @@ namespace HHWMS.Web
await Task.Delay(1000); // 模拟异步处理
}
-
+
///
/// 请求空闲库位(带防抖)
///
@@ -660,7 +691,7 @@ namespace HHWMS.Web
return ApiResult(new { LocationCode = location?.Code });
}
-
+
#endregion
}
}
\ No newline at end of file
diff --git a/HHWMS.Web/Areas/Configs/Views/Material/Edit.cshtml b/HHWMS.Web/Areas/Configs/Views/Material/Edit.cshtml
index b44800f..ae4c04d 100644
--- a/HHWMS.Web/Areas/Configs/Views/Material/Edit.cshtml
+++ b/HHWMS.Web/Areas/Configs/Views/Material/Edit.cshtml
@@ -5,13 +5,13 @@
-
-
-
+
+
+
-
+
diff --git a/HHWMS.Web/Areas/Inventory/Controllers/InventoryApiController.cs b/HHWMS.Web/Areas/Inventory/Controllers/InventoryApiController.cs
new file mode 100644
index 0000000..b74b2cd
--- /dev/null
+++ b/HHWMS.Web/Areas/Inventory/Controllers/InventoryApiController.cs
@@ -0,0 +1,54 @@
+using Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using WalkingTec.Mvvm.Core;
+using WalkingTec.Mvvm.Core.Extensions;
+using WalkingTec.Mvvm.Mvc;
+using HHWMS.Web;
+using HHWMS.Web.Models;
+
+
+namespace HHWMS.Web.Controllers
+{
+ [Area("inventory")]
+ [Public]
+ [ActionDescription("库存管理")]
+ [ApiController]
+ [Route("api/Inventory")]
+ public partial class InventoryApiController : BaseApiController
+ {
+ [ActionDescription("Sys.Search")]
+ [HttpPost("Search")]
+ [Public]
+ public IActionResult Search(InventoryApiSearcher searcher)
+ {
+ if (ModelState.IsValid)
+ {
+ var vm = Wtm.CreateVM(passInit: true);
+ searcher.SortInfo = new SortInfo()
+ {
+ Property = "MaterialCode",
+ Direction = SortDir.Asc
+ };
+ searcher.IsPlainText = false;
+ searcher.IsEnumToString = true;
+ vm.Searcher = searcher;
+
+ if (searcher.WareHouse.ToLower() == "mj")
+ vm.Searcher.ZoneId = 1025;
+ else if (searcher.WareHouse.ToLower() == "xb")
+ vm.Searcher.ZoneId = 1027;
+ else if (searcher.WareHouse.ToLower() == "cp")
+ vm.Searcher.ZoneId = 1028;
+
+ var data = vm.GetJson();
+ return Content(data);
+ }
+ else
+ {
+ return BadRequest(ModelState.GetErrorJson());
+ }
+ }
+ }
+}
diff --git a/HHWMS.Web/Areas/Inventory/Controllers/InventoryController.cs b/HHWMS.Web/Areas/Inventory/Controllers/InventoryController.cs
index bc1310e..6cf5131 100644
--- a/HHWMS.Web/Areas/Inventory/Controllers/InventoryController.cs
+++ b/HHWMS.Web/Areas/Inventory/Controllers/InventoryController.cs
@@ -549,6 +549,10 @@ namespace HHWMS.Web.Controllers
{
return FFResult().Alert("所选库存没关联订单,无需回传!").RefreshGrid();
}
+ if (inv.UploadErpFlag == 0)
+ {
+ return FFResult().Alert("所选库存已报工回传,无需再次回传!").RefreshGrid();
+ }
// 构建ERP请求
// 字段映射参照 ReceiptInController:
@@ -562,8 +566,8 @@ namespace HHWMS.Web.Controllers
{
Main = new FinishInMain
{
- ErpCode = "999", // 账套号
- InCode = $"{inv.SourceCode}-{DateTime.Now.Ticks}", // 报工单号(上游单号)
+ ErpCode = "002", // 账套号
+ InCode = _unitWork.GetSerialNumber("RW"), // 报工单号(上游单号)
InDate = (inv.CreateTime ?? DateTime.Now).ToString("yyyy-MM-dd"), // 报工日期
StepCode = inv.BatchCode, // 工序(批次编码)
WorkerCode = inv.CreateBy, // 工人编码(创建人)
diff --git a/HHWMS.Web/Areas/Inventory/ViewModels/InventoryVMs/InventoryApiListVM.cs b/HHWMS.Web/Areas/Inventory/ViewModels/InventoryVMs/InventoryApiListVM.cs
new file mode 100644
index 0000000..9f35532
--- /dev/null
+++ b/HHWMS.Web/Areas/Inventory/ViewModels/InventoryVMs/InventoryApiListVM.cs
@@ -0,0 +1,70 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using WalkingTec.Mvvm.Core;
+using WalkingTec.Mvvm.Core.Extensions;
+using Microsoft.EntityFrameworkCore;
+using System.ComponentModel.DataAnnotations;
+using HHWMS.Web.Models;
+
+
+namespace HHWMS.Web
+{
+ public partial class InventoryApiListVM : BasePagedListVM
+ {
+
+ protected override IEnumerable> InitGridHeader()
+ {
+ return new List>{
+ this.MakeGridHeader(x => x.WareHouse),
+ this.MakeGridHeader(x => x.MaterialCode),
+ this.MakeGridHeader(x => x.FigureNo),
+ this.MakeGridHeader(x => x.MaterialName),
+ this.MakeGridHeader(x => x.MaterialSpec),
+ this.MakeGridHeader(x => x.BatchCode),
+ this.MakeGridHeader(x => x.SuFigureNo),
+ this.MakeGridHeader(x => x.Qty),
+ this.MakeGridHeaderAction(width: 200)
+ };
+ }
+
+ public override IOrderedQueryable GetSearchQuery()
+ {
+ var query = DC.Set()
+ .Where(x => x.ZoneId == Searcher.ZoneId)
+ .CheckContain(Searcher.MaterialCode, x=>x.MaterialCode)
+ .CheckContain(Searcher.FigureNo, x=>x.MaterialType)
+ .CheckContain(Searcher.MaterialName, x=>x.MaterialName)
+ .CheckContain(Searcher.MaterialSpec, x=>x.MaterialSpec)
+ .CheckContain(Searcher.BatchCode, x=>x.BatchCode)
+ .CheckContain(Searcher.SuFigureNo, x=>x.SupplierCode)
+ .Select(x => new InventoryApi_View
+ {
+ WareHouse = x.ZoneId == 1027 ? "xb" : x.ZoneId == 1028 ? "cp" : "mj" ,
+ MaterialCode = x.MaterialCode,
+ FigureNo = x.MaterialType,
+ MaterialName = x.MaterialName,
+ MaterialSpec = x.MaterialSpec,
+ BatchCode = x.BatchCode,
+ SuFigureNo = x.SupplierCode,
+ LocationCode = x.LocationCode,
+ Qty = x.Qty,
+ }).OrderBy(x => x.MaterialCode);
+ return query;
+ }
+
+ }
+
+ public class InventoryApi_View : TopBasePoco {
+ public String WareHouse { get; set; }
+ public string MaterialCode { get; set; }
+ public string MaterialName { get; set; }
+ public string MaterialSpec { get; set; }
+ public string BatchCode { get; set; }
+ public string SuFigureNo { get; set; }
+ public string FigureNo { get; set; }
+ public string LocationCode { get; set; }
+ public decimal? Qty { get; set; }
+ }
+}
diff --git a/HHWMS.Web/Areas/Inventory/ViewModels/InventoryVMs/InventoryApiSearcher.cs b/HHWMS.Web/Areas/Inventory/ViewModels/InventoryVMs/InventoryApiSearcher.cs
new file mode 100644
index 0000000..5a4f6c2
--- /dev/null
+++ b/HHWMS.Web/Areas/Inventory/ViewModels/InventoryVMs/InventoryApiSearcher.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Threading.Tasks;
+using WalkingTec.Mvvm.Core;
+using WalkingTec.Mvvm.Core.Extensions;
+using HHWMS.Web.Models;
+
+
+namespace HHWMS.Web
+{
+ public partial class InventoryApiSearcher : BaseSearcher
+ {
+ public int ZoneId { get; set; }
+ [Display(Name = "Inventory.MaterialCode")]
+ public String MaterialCode { get; set; }
+ [Display(Name = "Inventory.MaterialType")]
+ public String FigureNo { get; set; }
+ [Display(Name = "Inventory.MaterialName")]
+ public String MaterialName { get; set; }
+ [Display(Name = "Inventory.MaterialSpec")]
+ public String MaterialSpec { get; set; }
+ [Display(Name = "Inventory.Batch")]
+ public String BatchCode { get; set; }
+ [Display(Name = "Inventory.SupplierCode")]
+ public String SuFigureNo { get; set; }
+ public String WareHouse { get; set; }
+
+ protected override void InitVM()
+ {
+ }
+
+ }
+}
diff --git a/HHWMS.Web/Areas/Inventory/ViewModels/InventoryVMs/InventorySearcher.cs b/HHWMS.Web/Areas/Inventory/ViewModels/InventoryVMs/InventorySearcher.cs
index 5b634fb..53fcf65 100644
--- a/HHWMS.Web/Areas/Inventory/ViewModels/InventoryVMs/InventorySearcher.cs
+++ b/HHWMS.Web/Areas/Inventory/ViewModels/InventoryVMs/InventorySearcher.cs
@@ -39,6 +39,10 @@ namespace HHWMS.Web
public String Status { get; set; }
[Display(Name = "Inventory.TaskStatus")]
public InventoryTaskStatusEnum? TaskStatus { get; set; }
+
+ public string SupplierCode { get; set; }
+ public string BatchCode { get; set; }
+ public string MaterialSpec { get; set; }
protected override void InitVM()
{
diff --git a/HHWMS.Web/Areas/Receipt/Controllers/ReceiptHeaderController.cs b/HHWMS.Web/Areas/Receipt/Controllers/ReceiptHeaderController.cs
index ca20570..8887d79 100644
--- a/HHWMS.Web/Areas/Receipt/Controllers/ReceiptHeaderController.cs
+++ b/HHWMS.Web/Areas/Receipt/Controllers/ReceiptHeaderController.cs
@@ -267,7 +267,7 @@ namespace HHWMS.Web.Controllers
// 调用 ERP 接口获取该订单的最新数据
var request = new LoadMoDetailListRequest
{
- ErpCode = "999",
+ ErpCode = "002",
MoCode = receiptCode, // 使用生产订单号查询
Size = 100,
Page = 1
diff --git a/HHWMS.Web/Areas/Receipt/Controllers/ReceiptInController.cs b/HHWMS.Web/Areas/Receipt/Controllers/ReceiptInController.cs
index 1e19a26..381213e 100644
--- a/HHWMS.Web/Areas/Receipt/Controllers/ReceiptInController.cs
+++ b/HHWMS.Web/Areas/Receipt/Controllers/ReceiptInController.cs
@@ -60,7 +60,7 @@ namespace HHWMS.Web.Controllers
{
var request = new LoadInventoryRequest
{
- ErpCode = "999",
+ ErpCode = "002",
InvDefine1 = keyword,
Size = 15,
Page = 1
@@ -185,7 +185,8 @@ namespace HHWMS.Web.Controllers
[HttpPost]
public IActionResult GetOperators()
{
- var users = _unitWork.Find(x => x.ITCode != "Admin")
+ var users = _unitWork.Find(x => x.ITCode != "Admin"
+ && x.ITCode.Length > 5)
.Select(x => new
{
value = x.ITCode,
@@ -443,13 +444,13 @@ namespace HHWMS.Web.Controllers
// 调用WCS任务下发接口
// tran.Commit();
// return Json(new { Code = 200, Msg = "入库成功", Data = new { TaskNo = taskNo } });
- // var wcsResult = Wtm
- // .CallAPI("WCSXB", "TaskAssign", HttpMethodEnum.POST, wcsTaskModel).Result.Data;
- var wcsResult = new WCSTaskResponse()
- {
- Success = true,
- Msg = "Success"
- };
+ var wcsResult = Wtm
+ .CallAPI("WCSXB", "TaskAssign", HttpMethodEnum.POST, wcsTaskModel).Result.Data;
+ // var wcsResult = new WCSTaskResponse()
+ // {
+ // Success = true,
+ // Msg = "Success"
+ // };
if (wcsResult != null && wcsResult.Success)
{
// WCS任务下发成功,提交事务
diff --git a/HHWMS.Web/Areas/Receipt/Controllers/SimpleReceiptInController.cs b/HHWMS.Web/Areas/Receipt/Controllers/SimpleReceiptInController.cs
index 4f0e6c2..2f56888 100644
--- a/HHWMS.Web/Areas/Receipt/Controllers/SimpleReceiptInController.cs
+++ b/HHWMS.Web/Areas/Receipt/Controllers/SimpleReceiptInController.cs
@@ -191,7 +191,8 @@ namespace HHWMS.Web.Controllers
BatchCode = batchCode,
TaskStatus = InventoryTaskStatusEnum.Locked,
CreateTime = DateTime.Now,
- CreateBy = Wtm.LoginUserInfo.ITCode
+ CreateBy = Wtm.LoginUserInfo.ITCode,
+ UploadErpFlag = 0
};
_unitWork.Add(inventory);
diff --git a/HHWMS.Web/Areas/Receipt/ViewModels/ReceiptDetailVMs/ReceiptDetailListVM2.cs b/HHWMS.Web/Areas/Receipt/ViewModels/ReceiptDetailVMs/ReceiptDetailListVM2.cs
index 3298689..a76367a 100644
--- a/HHWMS.Web/Areas/Receipt/ViewModels/ReceiptDetailVMs/ReceiptDetailListVM2.cs
+++ b/HHWMS.Web/Areas/Receipt/ViewModels/ReceiptDetailVMs/ReceiptDetailListVM2.cs
@@ -33,17 +33,17 @@ namespace HHWMS.Web
//this.MakeGridHeader(x => x.Code_view),
//this.MakeGridHeader(x => x.ZoneCode),
this.MakeGridHeader(x => x.MaterialCode),
- //this.MakeGridHeader(x => x.MaterialType),
+ this.MakeGridHeader(x => x.MaterialType),
+ // this.MakeGridHeader(x => x.Batch),
this.MakeGridHeader(x => x.MaterialName),
//this.MakeGridHeader(x => x.MaterialSpec),
this.MakeGridHeader(x => x.MaterialUnit),
- this.MakeGridHeader(x => x.Batch),
//this.MakeGridHeader(x => x.Lot).SetHide(),
//this.MakeGridHeader(x => x.ManufactureDate),
//this.MakeGridHeader(x => x.ExpirationDate),
//this.MakeGridHeader(x => x.CompanyCode),
this.MakeGridHeader(x => x.SupplierCode),
- this.MakeGridHeader(x => x.CompletedQty),
+ // this.MakeGridHeader(x => x.CompletedQty),
this.MakeGridHeader(x => x.Qty),
//this.MakeGridHeader(x => x.InventoryStatus),
this.MakeGridHeader(x => x.Status)
diff --git a/HHWMS.Web/Areas/Receipt/ViewModels/ReceiptHeaderVMs/ReceiptHeaderListVM.cs b/HHWMS.Web/Areas/Receipt/ViewModels/ReceiptHeaderVMs/ReceiptHeaderListVM.cs
index 297a9b4..908f58d 100644
--- a/HHWMS.Web/Areas/Receipt/ViewModels/ReceiptHeaderVMs/ReceiptHeaderListVM.cs
+++ b/HHWMS.Web/Areas/Receipt/ViewModels/ReceiptHeaderVMs/ReceiptHeaderListVM.cs
@@ -38,12 +38,12 @@ namespace HHWMS.Web
{
InitVM();
return new List>{
- //this.MakeGridHeader(x => x.SourceCode),
this.MakeGridHeader(x => x.Code).SetFormat((a,b) =>
{
string rv = UIService.MakeScriptButton(ButtonTypesEnum.Link,a.Code,$"details('{a.ID}')");
return rv;
}),
+ this.MakeGridHeader(x => x.SourceCode),
this.MakeGridHeader(x => x.BillType)
.SetFormat((a, b) =>
{
diff --git a/HHWMS.Web/Areas/Receipt/Views/SimpleReceiptIn/Index.cshtml b/HHWMS.Web/Areas/Receipt/Views/SimpleReceiptIn/Index.cshtml
index 174e4aa..46bd206 100644
--- a/HHWMS.Web/Areas/Receipt/Views/SimpleReceiptIn/Index.cshtml
+++ b/HHWMS.Web/Areas/Receipt/Views/SimpleReceiptIn/Index.cshtml
@@ -75,7 +75,7 @@
删除
- 修改
+ @* 修改 *@
扣料
diff --git a/HHWMS.Web/Areas/System/Controllers/jobs/FinishInJob.cs b/HHWMS.Web/Areas/System/Controllers/jobs/FinishInJob.cs
new file mode 100644
index 0000000..1455570
--- /dev/null
+++ b/HHWMS.Web/Areas/System/Controllers/jobs/FinishInJob.cs
@@ -0,0 +1,92 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using HHWMS.Web.Models;
+using Quartz;
+using WalkingTec.Mvvm.Core;
+using WalkingTec.Mvvm.Core.Support.Quartz;
+
+namespace HHWMS.Web
+{
+ //[QuartzRepeat(10,10, true, 30)]
+ [PersistJobDataAfterExecution]
+ [DisallowConcurrentExecution]
+ public class FinishInJob : WtmJob
+ {
+ public override async Task Execute(IJobExecutionContext context)
+ {
+ try
+ {
+ var _unitwork = new UnitWork(Wtm);
+
+ var inv = _unitwork.FindSingle(x => x.UploadErpFlag == 0
+ && x.TaskStatus != InventoryTaskStatusEnum.Locked
+ && !string.IsNullOrEmpty(x.SourceCode)
+ );
+
+ var request = new FinishInRequest
+ {
+ Main = new FinishInMain
+ {
+ ErpCode = "002", // 账套号
+ InCode = _unitwork.GetSerialNumber("RW"), // 报工单号(上游单号)
+ InDate = (inv.CreateTime ?? DateTime.Now).ToString("yyyy-MM-dd"), // 报工日期
+ StepCode = inv.BatchCode, // 工序(批次编码)
+ WorkerCode = inv.CreateBy, // 工人编码(创建人)
+ Maker = _unitwork.FindSingle(x =>
+ x.ITCode == inv.CreateBy).Name // 制单人(校验员)
+ },
+ Details = new List()
+ };
+
+ // 根据库存构建明细
+ request.Details.Add(new FinishInDetail
+ {
+ MoDetailId = inv.ReceiptDetailId, // 生产订单明细(ERP明细ID)
+ InvCode = inv.MaterialCode, // 物料号
+ Qty = inv.Qty ?? 0 // 完工数量
+ });
+ // 调用ERP接口
+ var apiResult = await Wtm.CallAPI("ERP", "FinishIn", HttpMethodEnum.POST, request);
+
+ if (apiResult.Data != null && apiResult.Data.Result)
+ {
+ inv.UploadErpFlag = 1;
+ _unitwork.Update(inv);
+ }
+ else
+ {
+ inv.UploadErpFlag = 0;
+ _unitwork.Update(inv);
+ }
+ #region 更新时间
+ var job = _unitwork.FindSingle(x =>
+ x.JobName == context.JobDetail.Key.Name
+ );
+ if (job != null)
+ {
+ job.LastFireTime = TimeZoneInfo.ConvertTimeFromUtc(
+ context.FireTimeUtc.DateTime,
+ TimeZoneInfo.Local
+ );
+ // 只执行一次 没有下次执行时间
+ if (context.NextFireTimeUtc != null)
+ {
+ job.NextFireTime = TimeZoneInfo.ConvertTimeFromUtc(
+ context.NextFireTimeUtc.Value.DateTime,
+ TimeZoneInfo.Local
+ );
+ }
+ _unitwork.Update(job);
+ }
+ #endregion
+ }
+ catch(Exception ex) {
+ Wtm.DoLog("ERP报工失败", ActionLogTypesEnum.Job, "FinishInJob", request:"error", result:ex.Message);
+ }
+ }
+ }
+
+}
+
diff --git a/HHWMS.Web/Areas/System/Controllers/jobs/LoadErpOrderJob.cs b/HHWMS.Web/Areas/System/Controllers/jobs/LoadErpOrderJob.cs
index 05a8088..6381ee7 100644
--- a/HHWMS.Web/Areas/System/Controllers/jobs/LoadErpOrderJob.cs
+++ b/HHWMS.Web/Areas/System/Controllers/jobs/LoadErpOrderJob.cs
@@ -23,7 +23,7 @@ namespace HHWMS.Web
// 调用接口获取ERP订单数据
var request = new LoadMoDetailListRequest
{
- ErpCode = "999",
+ ErpCode = "002",
Size = 100,
Page = 1
};
diff --git a/HHWMS.Web/Areas/System/Controllers/jobs/LoadErpUserJob.cs b/HHWMS.Web/Areas/System/Controllers/jobs/LoadErpUserJob.cs
index 74af80f..69cc3ce 100644
--- a/HHWMS.Web/Areas/System/Controllers/jobs/LoadErpUserJob.cs
+++ b/HHWMS.Web/Areas/System/Controllers/jobs/LoadErpUserJob.cs
@@ -23,7 +23,7 @@ namespace HHWMS.Web
// 调用接口获取ERP用户数据
var request = new LoadPersonRequest
{
- ErpCode = "999",
+ ErpCode = "002",
Size = 1000,
Page = 1
};
diff --git a/HHWMS.Web/Models/Request/Request/FinishInRequest.cs b/HHWMS.Web/Models/Request/Request/FinishInRequest.cs
index 27e3e08..76258e9 100644
--- a/HHWMS.Web/Models/Request/Request/FinishInRequest.cs
+++ b/HHWMS.Web/Models/Request/Request/FinishInRequest.cs
@@ -73,5 +73,32 @@ namespace HHWMS.Web.Models
/// 完工数量,必填
///
public decimal Qty { get; set; }
+
+ ///
+ /// 出库明细
+ ///
+
+ public List MaterialDetails { get; set; }
+ }
+
+ ///
+ /// 出库明细
+ ///
+ public class MaterialDetail
+ {
+ ///
+ /// 生产订单明细,必填
+ ///
+ public string MoDetailId { get; set; }
+
+ ///
+ /// 物料号,必填
+ ///
+ public string InvCode { get; set; }
+
+ ///
+ /// 完工数量,必填
+ ///
+ public decimal Qty { get; set; }
}
}
diff --git a/HHWMS.Web/Resources/Program.zh.resx b/HHWMS.Web/Resources/Program.zh.resx
index e2f6b54..1ea25c1 100644
--- a/HHWMS.Web/Resources/Program.zh.resx
+++ b/HHWMS.Web/Resources/Program.zh.resx
@@ -1023,6 +1023,12 @@
出库
+
+ 报工回传
+
+
+ 获取ERP订单
+
出 库
diff --git a/HHWMS.Web/Views/Home/Index.cshtml b/HHWMS.Web/Views/Home/Index.cshtml
index 620607b..b1d2e1d 100644
--- a/HHWMS.Web/Views/Home/Index.cshtml
+++ b/HHWMS.Web/Views/Home/Index.cshtml
@@ -1,285 +1 @@
-
-
\ No newline at end of file