对接ERP2.7
部分页面修改
This commit is contained in:
1 parent
22bfe9d015
commit
59f2af943b
17 files changed
+770
-887
No files matched your search
@@ -545,10 +545,10 @@ namespace HHWMS.Web.Controllers
|
||||
{
|
||||
return FFResult().Alert("所选库存存在任务,请检查后重试!").RefreshGrid();
|
||||
}
|
||||
if (string.IsNullOrEmpty(inv.SourceCode))
|
||||
{
|
||||
return FFResult().Alert("所选库存没关联订单,无需回传!").RefreshGrid();
|
||||
}
|
||||
// if (string.IsNullOrEmpty(inv.ReceiptDetailId))
|
||||
// {
|
||||
// return FFResult().Alert("所选库存没关联订单,无需回传!").RefreshGrid();
|
||||
// }
|
||||
if (inv.UploadErpFlag is 1)
|
||||
{
|
||||
return FFResult().Alert("所选库存已报工回传,无需再次回传!").RefreshGrid();
|
||||
|
||||
+49
-17
@@ -8,6 +8,23 @@ namespace HHWMS.Web
|
||||
{
|
||||
public partial class InventoryTransactionListVM : BasePagedListVM<InventoryTransaction_View, InventoryTransactionSearcher>
|
||||
{
|
||||
public List<ComboSelectListItem> ZoneCodeList { get; set; }
|
||||
public List<ComboSelectListItem> BillTypeList { get; set; }
|
||||
|
||||
protected override void InitVM()
|
||||
{
|
||||
ZoneCodeList = new List<ComboSelectListItem>
|
||||
{
|
||||
new ComboSelectListItem { Text = "成品", Value = "1028" },
|
||||
new ComboSelectListItem { Text = "线边", Value = "1027" },
|
||||
new ComboSelectListItem { Text = "模具", Value = "1025" }
|
||||
};
|
||||
BillTypeList = new List<ComboSelectListItem>
|
||||
{
|
||||
new ComboSelectListItem { Text = "入库", Value = "in" },
|
||||
new ComboSelectListItem { Text = "出库", Value = "out" }
|
||||
};
|
||||
}
|
||||
protected override List<GridAction> InitGridAction()
|
||||
{
|
||||
return new List<GridAction>
|
||||
@@ -25,28 +42,41 @@ namespace HHWMS.Web
|
||||
|
||||
protected override IEnumerable<IGridColumn<InventoryTransaction_View>> InitGridHeader()
|
||||
{
|
||||
InitVM();
|
||||
return new List<GridColumn<InventoryTransaction_View>>{
|
||||
this.MakeGridHeader(x => x.ZoneCode),
|
||||
this.MakeGridHeader(x => x.Type),
|
||||
this.MakeGridHeader(x => x.ZoneCode)
|
||||
.SetFormat((a, b) =>
|
||||
{
|
||||
var data = ZoneCodeList.FirstOrDefault(x => x.Value.ToString() == a.ZoneCode);
|
||||
return data?.Text ?? a.ZoneCode;
|
||||
}),
|
||||
this.MakeGridHeader(x => x.Type)
|
||||
.SetFormat((a, b) =>
|
||||
{
|
||||
var data = BillTypeList.FirstOrDefault(x => x.Value.ToString() == a.Type);
|
||||
return data?.Text ?? a.Type;
|
||||
}),
|
||||
this.MakeGridHeader(x => x.MaterialCode),
|
||||
this.MakeGridHeader(x => x.MaterialType).SetWidth(100),
|
||||
this.MakeGridHeader(x => x.MaterialName),
|
||||
this.MakeGridHeader(x => x.Qty)
|
||||
.SetFormat((a, b) => { return (int?)a.Qty ?? 0; }),
|
||||
this.MakeGridHeader(x => x.CreateTime),
|
||||
this.MakeGridHeader(x => x.ContainerCode),
|
||||
this.MakeGridHeader(x => x.LocationCode),
|
||||
this.MakeGridHeader(x => x.MaterialCode),
|
||||
this.MakeGridHeader(x => x.MaterialType),
|
||||
this.MakeGridHeader(x => x.MaterialName),
|
||||
this.MakeGridHeader(x => x.MaterialSpec),
|
||||
this.MakeGridHeader(x => x.MaterialUnit),
|
||||
this.MakeGridHeader(x => x.MaterialSpec).SetHide(),
|
||||
this.MakeGridHeader(x => x.MaterialUnit).SetHide(),
|
||||
this.MakeGridHeader(x => x.Batch),
|
||||
this.MakeGridHeader(x => x.Lot),
|
||||
this.MakeGridHeader(x => x.ManufactureDate),
|
||||
this.MakeGridHeader(x => x.ExpirationDate),
|
||||
this.MakeGridHeader(x => x.ManufactureDate).SetHide(),
|
||||
this.MakeGridHeader(x => x.ExpirationDate).SetHide(),
|
||||
this.MakeGridHeader(x => x.CompanyCode),
|
||||
this.MakeGridHeader(x => x.SupplierCode),
|
||||
this.MakeGridHeader(x => x.Qty),
|
||||
this.MakeGridHeader(x => x.BillType),
|
||||
this.MakeGridHeader(x => x.SourceCode),
|
||||
this.MakeGridHeader(x => x.BillCode),
|
||||
this.MakeGridHeader(x => x.BillDetailId),
|
||||
this.MakeGridHeader(x => x.Status),
|
||||
this.MakeGridHeader(x => x.BillType).SetHide(),
|
||||
this.MakeGridHeader(x => x.SourceCode).SetHide(),
|
||||
this.MakeGridHeader(x => x.BillCode).SetHide(),
|
||||
this.MakeGridHeader(x => x.BillDetailId).SetHide(),
|
||||
this.MakeGridHeader(x => x.Status).SetHide(),
|
||||
this.MakeGridHeaderAction(width: 200)
|
||||
};
|
||||
}
|
||||
@@ -56,11 +86,11 @@ namespace HHWMS.Web
|
||||
var query = DC.Set<InventoryTransaction>()
|
||||
.CheckContain(Searcher.ZoneCode, x => x.ZoneCode)
|
||||
.CheckContain(Searcher.Type, x => x.Type)
|
||||
.CheckContain(Searcher.ContainerCode, x => x.ContainerCode)
|
||||
.CheckContain(Searcher.LocationCode, x => x.LocationCode)
|
||||
.CheckContain(Searcher.MaterialCode, x => x.MaterialCode)
|
||||
.CheckContain(Searcher.MaterialType, x => x.MaterialType)
|
||||
.CheckContain(Searcher.MaterialName, x => x.MaterialName)
|
||||
.CheckContain(Searcher.ContainerCode, x => x.ContainerCode)
|
||||
.CheckContain(Searcher.LocationCode, x => x.LocationCode)
|
||||
.CheckContain(Searcher.MaterialSpec, x => x.MaterialSpec)
|
||||
.CheckContain(Searcher.MaterialUnit, x => x.MaterialUnit)
|
||||
.CheckContain(Searcher.Batch, x => x.Batch)
|
||||
@@ -69,6 +99,7 @@ namespace HHWMS.Web
|
||||
.CheckContain(Searcher.SourceCode, x => x.SourceCode)
|
||||
.CheckContain(Searcher.BillCode, x => x.BillCode)
|
||||
.CheckContain(Searcher.Status, x => x.Status)
|
||||
.CheckBetween(Searcher.CreateTime?.GetStartTime(), Searcher.CreateTime?.GetEndTime(), x => x.CreateTime, includeMax: false)
|
||||
.Select(x => new InventoryTransaction_View
|
||||
{
|
||||
ID = x.ID,
|
||||
@@ -93,6 +124,7 @@ namespace HHWMS.Web
|
||||
BillCode = x.BillCode,
|
||||
BillDetailId = x.BillDetailId,
|
||||
Status = x.Status,
|
||||
CreateTime = x.CreateTime,
|
||||
})
|
||||
.OrderBy(x => x.ID);
|
||||
return query;
|
||||
|
||||
+3
@@ -42,6 +42,9 @@ namespace HHWMS.Web
|
||||
public String BillCode { get; set; }
|
||||
[Display(Name = "Inventory.Status")]
|
||||
public String Status { get; set; }
|
||||
|
||||
[Display(Name = "Inventory.CreateTime")]
|
||||
public DateRange CreateTime { get; set; }
|
||||
|
||||
protected override void InitVM()
|
||||
{
|
||||
|
||||
@@ -62,41 +62,87 @@ namespace HHWMS.Web
|
||||
|
||||
protected override IEnumerable<IGridColumn<Inventory_View>> InitGridHeader()
|
||||
{
|
||||
return new List<GridColumn<Inventory_View>>{
|
||||
this.MakeGridHeader(x => x.Name_view).SetWidth(80),
|
||||
this.MakeGridHeader(x => x.ContainerCode).SetWidth(90),
|
||||
this.MakeGridHeader(x => x.LocationCode).SetWidth(130),
|
||||
this.MakeGridHeader(x => x.MaterialCode).SetWidth(90),
|
||||
this.MakeGridHeader(x => x.MaterialType).SetWidth(100),
|
||||
this.MakeGridHeader(x => x.Qty).SetWidth(100)
|
||||
.SetFormat((a, b) =>
|
||||
{
|
||||
return (int?)a.Qty ?? 0;
|
||||
}),
|
||||
this.MakeGridHeader(x => x.SupplierCode).SetWidth(100),
|
||||
this.MakeGridHeader(x => x.Batch).SetWidth(100),
|
||||
this.MakeGridHeader(x => x.Lot).SetWidth(100),
|
||||
this.MakeGridHeader(x => x.TaskStatus).SetWidth(100)
|
||||
.SetBackGroundFunc((a)=>{
|
||||
if(a.TaskStatus == InventoryTaskStatusEnum.Locked )
|
||||
if (Wtm.LoginUserInfo.Groups.Any(x => x.GroupCode == "001"))
|
||||
{
|
||||
// 线边
|
||||
return new List<GridColumn<Inventory_View>>
|
||||
{
|
||||
this.MakeGridHeader(x => x.Name_view).SetWidth(80).SetHide(),
|
||||
this.MakeGridHeader(x => x.MaterialCode).SetWidth(90).SetHide(),
|
||||
this.MakeGridHeader(x => x.MaterialType).SetWidth(100),
|
||||
this.MakeGridHeader(x => x.Qty).SetWidth(100)
|
||||
.SetFormat((a, b) => { return (int?)a.Qty ?? 0; })
|
||||
.SetShowTotal(true),
|
||||
this.MakeGridHeader(x => x.Batch).SetWidth(100),
|
||||
this.MakeGridHeader(x => x.Lot).SetWidth(100),
|
||||
this.MakeGridHeader(x => x.TaskStatus).SetWidth(100)
|
||||
.SetBackGroundFunc((a) =>
|
||||
{
|
||||
return "#FF0000";
|
||||
}
|
||||
return "";
|
||||
}),
|
||||
this.MakeGridHeader(x => x.MaterialName).SetWidth(100),
|
||||
this.MakeGridHeader(x => x.CompanyCode).SetWidth(150),
|
||||
this.MakeGridHeader(x => x.SourceCode).SetWidth(150),
|
||||
this.MakeGridHeader(x => x.MaterialSpec).SetHide().SetWidth(150),
|
||||
this.MakeGridHeader(x => x.MaterialUnit).SetHide(),
|
||||
this.MakeGridHeader(x => x.TaskQty).SetHide(),
|
||||
this.MakeGridHeader(x => x.ManufactureDate).SetHide(),
|
||||
this.MakeGridHeader(x => x.ExpirationDate).SetHide(),
|
||||
this.MakeGridHeader(x => x.ReceiptCode).SetHide(),
|
||||
this.MakeGridHeader(x => x.ReceiptDetailId).SetHide(),
|
||||
this.MakeGridHeader(x => x.Status).SetWidth(100),
|
||||
this.MakeGridHeaderAction(width: 200)
|
||||
};
|
||||
if (a.TaskStatus == InventoryTaskStatusEnum.Locked)
|
||||
{
|
||||
return "#FF0000";
|
||||
}
|
||||
|
||||
return "";
|
||||
}),
|
||||
this.MakeGridHeader(x => x.CreateTime).SetWidth(100),
|
||||
this.MakeGridHeader(x => x.MaterialName).SetWidth(100),
|
||||
this.MakeGridHeader(x => x.ContainerCode).SetWidth(90),
|
||||
this.MakeGridHeader(x => x.LocationCode).SetWidth(130),
|
||||
this.MakeGridHeader(x => x.SupplierCode).SetWidth(100).SetHide(),
|
||||
this.MakeGridHeader(x => x.CompanyCode).SetWidth(150),
|
||||
this.MakeGridHeader(x => x.SourceCode).SetWidth(150),
|
||||
this.MakeGridHeader(x => x.MaterialSpec).SetHide().SetWidth(150),
|
||||
this.MakeGridHeader(x => x.MaterialUnit).SetHide(),
|
||||
this.MakeGridHeader(x => x.TaskQty).SetHide(),
|
||||
this.MakeGridHeader(x => x.ManufactureDate).SetHide(),
|
||||
this.MakeGridHeader(x => x.ExpirationDate).SetHide(),
|
||||
this.MakeGridHeader(x => x.ReceiptCode).SetHide(),
|
||||
this.MakeGridHeader(x => x.ReceiptDetailId).SetHide(),
|
||||
this.MakeGridHeader(x => x.Status).SetWidth(100),
|
||||
this.MakeGridHeaderAction(width: 200)
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
return new List<GridColumn<Inventory_View>>
|
||||
{
|
||||
this.MakeGridHeader(x => x.Name_view).SetWidth(80).SetHide(),
|
||||
this.MakeGridHeader(x => x.MaterialCode).SetWidth(90).SetHide(),
|
||||
this.MakeGridHeader(x => x.MaterialType).SetWidth(100),
|
||||
this.MakeGridHeader(x => x.Qty).SetWidth(100)
|
||||
.SetFormat((a, b) => { return (int?)a.Qty ?? 0; })
|
||||
.SetShowTotal(true),
|
||||
this.MakeGridHeader(x => x.CompanyCode).SetWidth(150),
|
||||
this.MakeGridHeader(x => x.SourceCode).SetWidth(150),
|
||||
this.MakeGridHeader(x => x.Batch).SetWidth(100).SetHide(),
|
||||
this.MakeGridHeader(x => x.Lot).SetWidth(100).SetHide(),
|
||||
this.MakeGridHeader(x => x.TaskStatus).SetWidth(100)
|
||||
.SetBackGroundFunc((a) =>
|
||||
{
|
||||
if (a.TaskStatus == InventoryTaskStatusEnum.Locked)
|
||||
{
|
||||
return "#FF0000";
|
||||
}
|
||||
|
||||
return "";
|
||||
}),
|
||||
this.MakeGridHeader(x => x.CreateTime).SetWidth(100),
|
||||
this.MakeGridHeader(x => x.MaterialName).SetWidth(100),
|
||||
this.MakeGridHeader(x => x.ContainerCode).SetWidth(90),
|
||||
this.MakeGridHeader(x => x.LocationCode).SetWidth(130),
|
||||
this.MakeGridHeader(x => x.SupplierCode).SetWidth(100).SetHide(),
|
||||
this.MakeGridHeader(x => x.MaterialSpec).SetHide().SetWidth(150),
|
||||
this.MakeGridHeader(x => x.MaterialUnit).SetHide(),
|
||||
this.MakeGridHeader(x => x.TaskQty).SetHide(),
|
||||
this.MakeGridHeader(x => x.ManufactureDate).SetHide(),
|
||||
this.MakeGridHeader(x => x.ExpirationDate).SetHide(),
|
||||
this.MakeGridHeader(x => x.ReceiptCode).SetHide(),
|
||||
this.MakeGridHeader(x => x.ReceiptDetailId).SetHide(),
|
||||
this.MakeGridHeader(x => x.Status).SetWidth(100),
|
||||
this.MakeGridHeaderAction(width: 200)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public override IOrderedQueryable<Inventory_View> GetSearchQuery()
|
||||
@@ -140,6 +186,7 @@ namespace HHWMS.Web
|
||||
Status = x.Status,
|
||||
TaskStatus = x.TaskStatus,
|
||||
Flag = x.Flag,
|
||||
CreateTime = x.CreateTime
|
||||
})
|
||||
.OrderBy(x => x.ID);
|
||||
return query;
|
||||
|
||||
@@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations;
|
||||
using WalkingTec.Mvvm.Core;
|
||||
using WalkingTec.Mvvm.Core.Extensions;
|
||||
using HHWMS.Web.Models;
|
||||
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace HHWMS.Web
|
||||
{
|
||||
@@ -18,6 +18,7 @@ namespace HHWMS.Web
|
||||
|
||||
[Display(Name = "Location.OutPort", Description = "拣货口")]
|
||||
public string OutPort { get; set; }
|
||||
private IUnitWork unitWork;
|
||||
|
||||
public InventoryVM()
|
||||
{
|
||||
@@ -26,6 +27,7 @@ namespace HHWMS.Web
|
||||
|
||||
protected override void InitVM()
|
||||
{
|
||||
unitWork = new UnitWork(Wtm);
|
||||
AllZones = DC.Set<LocationZone>().GetSelectListItems(Wtm, y => y.Name);
|
||||
|
||||
AllOutPorts = new List<ComboSelectListItem>
|
||||
@@ -63,5 +65,95 @@ namespace HHWMS.Web
|
||||
{
|
||||
base.DoDelete();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ERP报工处理
|
||||
/// </summary>
|
||||
/// <param name="inventory">库存实体</param>
|
||||
/// <param name="taskType">任务类型(入库/出库)</param>
|
||||
/// <returns>返回处理结果,true表示成功,false表示失败</returns>
|
||||
public async Task<bool> ProcessErpFinishIn(Inventory inventory, TaskTypeEnum? taskType)
|
||||
{
|
||||
if (inventory == null
|
||||
//|| string.IsNullOrEmpty(inventory.ReceiptDetailId)
|
||||
|| inventory.ZoneId == 1025 ) //模具库不报工
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// ERP相关 入库报工
|
||||
var finishInRequest = new FinishInRequest
|
||||
{
|
||||
Main = new FinishInMain
|
||||
{
|
||||
ErpCode = "003", // 账套号
|
||||
InCode = unitWork.GetSerialNumber("RW"), // 报工单号(上游单号)
|
||||
InDate = (inventory.CreateTime ?? DateTime.Now)
|
||||
.ToString("yyyy-MM-dd"), // 报工日期
|
||||
StepCode = inventory.BatchCode, // 工序(批次编码)
|
||||
WorkerCode = inventory.CreateBy, // 工人编码(创建人)
|
||||
Maker = unitWork.FindSingle<FrameworkUser>(x =>
|
||||
x.ITCode == inventory.CreateBy).Name, // 制单人(校验员)
|
||||
Type = inventory.ZoneId == 1027 ? 1: 2,
|
||||
WhCode = inventory.ZoneId == 1027 ? "xb": "cp",
|
||||
},
|
||||
Details = new List<FinishInDetail>()
|
||||
};
|
||||
|
||||
if (taskType == TaskTypeEnum.入库)
|
||||
{
|
||||
// 根据库存构建明细
|
||||
finishInRequest.Details.Add(new FinishInDetail
|
||||
{
|
||||
MoDetailId = inventory.ZoneId == 1027 ? "" : inventory.ReceiptDetailId, // 生产订单明细(ERP明细ID)
|
||||
InvCode = inventory.MaterialCode, // 物料号
|
||||
Qty = inventory.Qty ?? 0 // 完工数量
|
||||
});
|
||||
}
|
||||
else if (taskType == TaskTypeEnum.出库)
|
||||
{
|
||||
finishInRequest.Details.Add(new FinishInDetail
|
||||
{
|
||||
MaterialDetails = new List<MaterialDetail>
|
||||
{
|
||||
new MaterialDetail
|
||||
{
|
||||
MoDetailId = inventory.ZoneId == 1027 ? "" : inventory.ReceiptDetailId, // 生产订单明细ID
|
||||
InvCode = inventory.MaterialCode, // 物料号
|
||||
Qty = (decimal)inventory.Qty // 完工数量(空值兜底为0)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 调用ERP接口
|
||||
var apiResult = await Wtm.CallAPI<FinishInResponse>("ERP", "FinishIn",
|
||||
HttpMethodEnum.POST,
|
||||
finishInRequest);
|
||||
|
||||
if (apiResult.Data != null && apiResult.Data.Result)
|
||||
{
|
||||
inventory.UploadErpFlag = 1;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
inventory.UploadErpFlag = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 异常情况下设置标志为失败
|
||||
inventory.UploadErpFlag = 0;
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
unitWork.Update(inventory);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
<wt:searchpanel vm="@Model" reset-btn="true">
|
||||
<wt:row items-per-row="ItemsPerRowEnum.Three">
|
||||
<wt:textbox field="Searcher.ZoneCode" />
|
||||
<wt:textbox field="Searcher.Type" />
|
||||
<wt:combobox field="Searcher.ZoneCode" items="ZoneCodeList" />
|
||||
<wt:combobox field="Searcher.Type" items="BillTypeList"/>
|
||||
<wt:textbox field="Searcher.ContainerCode" />
|
||||
<wt:textbox field="Searcher.LocationCode" />
|
||||
<wt:textbox field="Searcher.MaterialCode" />
|
||||
@@ -16,8 +16,8 @@
|
||||
<wt:textbox field="Searcher.Lot" />
|
||||
<wt:textbox field="Searcher.BillType" />
|
||||
<wt:textbox field="Searcher.SourceCode" />
|
||||
<wt:textbox field="Searcher.BillCode" />
|
||||
<wt:textbox field="Searcher.Status" />
|
||||
<wt:datetime field="Searcher.CreateTime" range="true" />
|
||||
</wt:row>
|
||||
</wt:searchpanel>
|
||||
<wt:grid vm="@Model" url="/inventory/InventoryTransaction/Search"/>
|
||||
Reference in new issue
Block a user