Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6729d5fd7d | ||
|
|
d156650264 |
No files matched your search
@@ -1,4 +1,4 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -554,51 +554,17 @@ namespace HHWMS.Web.Controllers
|
||||
return FFResult().Alert("所选库存已报工回传,无需再次回传!").RefreshGrid();
|
||||
}
|
||||
|
||||
// 构建ERP请求
|
||||
// 字段映射参照 ReceiptInController:
|
||||
// SourceCode = 单号 -> InCode
|
||||
// ReceiptDetailId = erpdetailid -> MoDetailId
|
||||
// BatchCode = 工序编码 -> StepCode
|
||||
// CreateBy = 操作员 -> WorkerCode
|
||||
// ReceiptCode = 校验员 -> Maker
|
||||
// CompanyCode = 公司 -> ErpCode
|
||||
var request = new FinishInRequest
|
||||
{
|
||||
Main = new FinishInMain
|
||||
{
|
||||
ErpCode = "003", // 账套号
|
||||
InCode = _unitWork.GetSerialNumber("RW"), // 报工单号(上游单号)
|
||||
InDate = (inv.CreateTime ?? DateTime.Now).ToString("yyyy-MM-dd"), // 报工日期
|
||||
StepCode = inv.BatchCode, // 工序(批次编码)
|
||||
WorkerCode = inv.CreateBy, // 工人编码(创建人)
|
||||
Maker = _unitWork.FindSingle<FrameworkUser>(x =>
|
||||
x.ITCode == inv.CreateBy).Name // 制单人(校验员)
|
||||
},
|
||||
Details = new List<FinishInDetail>()
|
||||
};
|
||||
// 使用通用的ProcessErpFinishIn方法
|
||||
var invVM = Wtm.CreateVM<InventoryVM>();
|
||||
var success = await invVM.ProcessErpFinishIn(inv, TaskTypeEnum.入库);
|
||||
|
||||
// 根据库存构建明细
|
||||
request.Details.Add(new FinishInDetail
|
||||
if (success)
|
||||
{
|
||||
MoDetailId = inv.ReceiptDetailId, // 生产订单明细(ERP明细ID)
|
||||
InvCode = inv.MaterialCode, // 物料号
|
||||
Qty = inv.Qty ?? 0 // 完工数量
|
||||
});
|
||||
// 调用ERP接口
|
||||
var apiResult = await Wtm.CallAPI<FinishInResponse>("ERP", "FinishIn", HttpMethodEnum.POST, request);
|
||||
|
||||
if (apiResult.Data is { Result: true })
|
||||
{
|
||||
inv.UploadErpFlag = 1;
|
||||
_unitWork.Update(inv);
|
||||
return FFResult().Alert("回传ERP成功").RefreshGrid();
|
||||
}
|
||||
else
|
||||
{
|
||||
inv.UploadErpFlag = 0;
|
||||
_unitWork.Update(inv);
|
||||
return FFResult().Alert($"调用ERP接口失败 {(apiResult.Data != null ? apiResult.Data.Message : apiResult.ErrorMsg)}")
|
||||
.RefreshGrid();
|
||||
return FFResult().Alert("回传ERP失败").RefreshGrid();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -23,12 +23,14 @@ namespace HHWMS.Web
|
||||
this.MakeGridHeader(x => x.MaterialName),
|
||||
this.MakeGridHeader(x => x.MaterialSpec),
|
||||
this.MakeGridHeader(x => x.BatchCode),
|
||||
this.MakeGridHeader(x => x.NextBatch),
|
||||
this.MakeGridHeader(x => x.SuFigureNo),
|
||||
this.MakeGridHeader(x => x.Company),
|
||||
this.MakeGridHeader(x => x.Remark),
|
||||
this.MakeGridHeader(x => x.LocationCode),
|
||||
this.MakeGridHeader(x => x.SourceCode),
|
||||
this.MakeGridHeader(x => x.Qty),
|
||||
this.MakeGridHeader(x => x.Createtime),
|
||||
this.MakeGridHeaderAction(width: 200)
|
||||
};
|
||||
}
|
||||
@@ -42,6 +44,7 @@ namespace HHWMS.Web
|
||||
.CheckContain(Searcher.MaterialName, x=>x.MaterialName)
|
||||
.CheckContain(Searcher.MaterialSpec, x=>x.MaterialSpec)
|
||||
.CheckContain(Searcher.BatchCode, x=>x.BatchCode)
|
||||
.CheckContain(Searcher.NextBatch, x=>x.Lot)
|
||||
.CheckContain(Searcher.SuFigureNo, x=>x.SupplierCode)
|
||||
.Select(x => new InventoryApi_View
|
||||
{
|
||||
@@ -57,6 +60,8 @@ namespace HHWMS.Web
|
||||
SuFigureNo = x.SupplierCode,
|
||||
LocationCode = x.LocationCode,
|
||||
Qty = x.Qty,
|
||||
Createtime = x.CreateTime,
|
||||
NextBatch = x.Lot
|
||||
}).OrderBy(x => x.MaterialCode);
|
||||
return query;
|
||||
}
|
||||
@@ -69,6 +74,7 @@ namespace HHWMS.Web
|
||||
public string MaterialName { get; set; }
|
||||
public string MaterialSpec { get; set; }
|
||||
public string BatchCode { get; set; }
|
||||
public string NextBatch { get; set; }
|
||||
public string SuFigureNo { get; set; }
|
||||
public string Remark { get; set; }
|
||||
public string SourceCode { get; set; }
|
||||
@@ -76,5 +82,6 @@ namespace HHWMS.Web
|
||||
public string FigureNo { get; set; }
|
||||
public string LocationCode { get; set; }
|
||||
public decimal? Qty { get; set; }
|
||||
public DateTime? Createtime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ namespace HHWMS.Web
|
||||
public String SuFigureNo { get; set; }
|
||||
public String WareHouse { get; set; }
|
||||
|
||||
public string NextBatch { get; set; }
|
||||
protected override void InitVM()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -116,6 +116,9 @@ namespace HHWMS.Web
|
||||
{
|
||||
finishInRequest.Details.Add(new FinishInDetail
|
||||
{
|
||||
MoDetailId = inventory.ZoneId == 1027 ? "" : inventory.ReceiptDetailId, // 生产订单明细(ERP明细ID)
|
||||
InvCode = inventory.MaterialCode, // 物料号
|
||||
Qty = inventory.Qty ?? 0 ,// 完工数量
|
||||
MaterialDetails = new List<MaterialDetail>
|
||||
{
|
||||
new MaterialDetail
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
<a-option v-for="item in orderOptions"
|
||||
:key="item.value"
|
||||
:value="item.value">
|
||||
{{ item.label }}
|
||||
{{ item.value }}
|
||||
</a-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
|
||||
@@ -22,44 +22,12 @@ namespace HHWMS.Web
|
||||
|
||||
var inv = _unitwork.FindSingle<Inventory>(x => x.UploadErpFlag == 0
|
||||
&& x.TaskStatus != InventoryTaskStatusEnum.Locked
|
||||
&& !string.IsNullOrEmpty(x.SourceCode)
|
||||
// && !string.IsNullOrEmpty(x.ReceiptDetailId)
|
||||
);
|
||||
|
||||
var request = new FinishInRequest
|
||||
{
|
||||
Main = new FinishInMain
|
||||
{
|
||||
ErpCode = "003", // 账套号
|
||||
InCode = _unitwork.GetSerialNumber("RW"), // 报工单号(上游单号)
|
||||
InDate = (inv.CreateTime ?? DateTime.Now).ToString("yyyy-MM-dd"), // 报工日期
|
||||
StepCode = inv.BatchCode, // 工序(批次编码)
|
||||
WorkerCode = inv.CreateBy, // 工人编码(创建人)
|
||||
Maker = _unitwork.FindSingle<FrameworkUser>(x =>
|
||||
x.ITCode == inv.CreateBy).Name // 制单人(校验员)
|
||||
},
|
||||
Details = new List<FinishInDetail>()
|
||||
};
|
||||
|
||||
// 根据库存构建明细
|
||||
request.Details.Add(new FinishInDetail
|
||||
{
|
||||
MoDetailId = inv.ReceiptDetailId, // 生产订单明细(ERP明细ID)
|
||||
InvCode = inv.MaterialCode, // 物料号
|
||||
Qty = inv.Qty ?? 0 // 完工数量
|
||||
});
|
||||
// 调用ERP接口
|
||||
var apiResult = await Wtm.CallAPI<FinishInResponse>("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);
|
||||
}
|
||||
// 使用通用的ProcessErpFinishIn方法
|
||||
var invVM = Wtm.CreateVM<InventoryVM>();
|
||||
await invVM.ProcessErpFinishIn(inv, TaskTypeEnum.入库);
|
||||
#region 更新时间
|
||||
var job = _unitwork.FindSingle<SysJob>(x =>
|
||||
x.JobName == context.JobDetail.Key.Name
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"ASPNETCORE_HOSTINGSTARTUPASSEMBLIES": "Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation"
|
||||
},
|
||||
"applicationUrl": "http://0.0.0.0:5000/"
|
||||
"applicationUrl": "http://0.0.0.0:5001/"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user