工单BOM 及其所需数量
This commit is contained in:
parent
021dd1df17
commit
cd7f9ed8e6
@ -278,12 +278,17 @@ namespace DOAN.Model.MES.product.Dto
|
||||
/// </summary>
|
||||
|
||||
public string SubInvName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 单件数量
|
||||
/// </summary>
|
||||
public string Iusequantity_Single { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 使用数量
|
||||
/// 使用总数量
|
||||
/// </summary>
|
||||
|
||||
public string Iusequantity { get; set; }
|
||||
|
||||
public string Iusequantity_All { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// BOM版本号
|
||||
|
||||
@ -52,10 +52,11 @@ public class QcDefectCollectionDto
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 供应商编码
|
||||
/// 供应商编码
|
||||
/// </summary>
|
||||
|
||||
public string SupplierCode { get; set; }
|
||||
public string SupplierName { get; set; }
|
||||
|
||||
public decimal PlanNum { get; set; }
|
||||
|
||||
@ -104,7 +105,7 @@ public class QcDefectCollectionQueryDto2 : PagerInfo
|
||||
/// 供应商名称
|
||||
/// </summary>
|
||||
public string SupplierName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 产品编码
|
||||
/// </summary>
|
||||
|
||||
@ -17,6 +17,7 @@ using NPOI;
|
||||
using DOAN.Model.MES.ERP;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using Infrastructure.Converter;
|
||||
|
||||
namespace DOAN.Service.group
|
||||
{
|
||||
@ -293,7 +294,7 @@ namespace DOAN.Service.group
|
||||
public int GenerateMaterialRequirePlanByline(MmRequirePlanQueryDto2 parm, string CreatedBy)
|
||||
{
|
||||
//查询当日线下所有工单
|
||||
parm.RequireDate = parm.RequireDate.ToLocalTime().Date;
|
||||
parm.RequireDate = DOANConvertDateTime.ConvertLocalDate(parm.RequireDate);
|
||||
|
||||
int result = 0;
|
||||
|
||||
@ -331,6 +332,8 @@ namespace DOAN.Service.group
|
||||
{
|
||||
need_Materials.Add(item.SubInvCode, need_num);
|
||||
}
|
||||
|
||||
|
||||
if (need_Materials_workOrder.ContainsKey(item.SubInvCode))
|
||||
{
|
||||
|
||||
|
||||
@ -612,18 +612,18 @@ namespace DOAN.Service.MES.product
|
||||
|
||||
//存货编码
|
||||
NPOI.SS.UserModel.ICell currentCell_01 = currentRow.GetCell(0);
|
||||
|
||||
|
||||
workorder.ProductionCode = currentCell_01?.ToString();
|
||||
if(currentCell_01==null||string.IsNullOrEmpty(workorder.ProductionCode))
|
||||
if (currentCell_01 == null || string.IsNullOrEmpty(workorder.ProductionCode))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//产品名称
|
||||
NPOI.SS.UserModel.ICell currentCell_02 = currentRow.GetCell(1);
|
||||
|
||||
|
||||
workorder.ProductionName = currentCell_02?.ToString();
|
||||
if (currentCell_02 == null||string.IsNullOrEmpty(workorder.ProductionName))
|
||||
if (currentCell_02 == null || string.IsNullOrEmpty(workorder.ProductionName))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -632,9 +632,9 @@ namespace DOAN.Service.MES.product
|
||||
|
||||
//规格型号
|
||||
NPOI.SS.UserModel.ICell currentCell_04 = currentRow.GetCell(2);
|
||||
|
||||
|
||||
workorder.Specification = currentCell_04?.ToString();
|
||||
if (currentCell_04 == null||string.IsNullOrEmpty(workorder.Specification))
|
||||
if (currentCell_04 == null || string.IsNullOrEmpty(workorder.Specification))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -780,20 +780,20 @@ namespace DOAN.Service.MES.product
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 分批导入,追加导入
|
||||
/// </summary>
|
||||
/// <param name="formFile"></param>
|
||||
/// <param name="username"></param>
|
||||
/// <returns></returns>
|
||||
public int ImportDataAppend(IFormFile formFile, string username)
|
||||
public int ImportDataAppend(IFormFile formFile, string username)
|
||||
{
|
||||
int result = 0;
|
||||
List<ProWorkorder> workorderList = new();
|
||||
DateTime dateValue = DateTime.MinValue;
|
||||
|
||||
|
||||
|
||||
|
||||
using (var stream = formFile.OpenReadStream())
|
||||
{
|
||||
try
|
||||
@ -820,18 +820,18 @@ namespace DOAN.Service.MES.product
|
||||
|
||||
//存货编码
|
||||
NPOI.SS.UserModel.ICell currentCell_01 = currentRow.GetCell(0);
|
||||
|
||||
|
||||
workorder.ProductionCode = currentCell_01?.ToString();
|
||||
if(currentCell_01==null||string.IsNullOrEmpty(workorder.ProductionCode))
|
||||
if (currentCell_01 == null || string.IsNullOrEmpty(workorder.ProductionCode))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//产品名称
|
||||
NPOI.SS.UserModel.ICell currentCell_02 = currentRow.GetCell(1);
|
||||
|
||||
|
||||
workorder.ProductionName = currentCell_02?.ToString();
|
||||
if (currentCell_02 == null||string.IsNullOrEmpty(workorder.ProductionName))
|
||||
if (currentCell_02 == null || string.IsNullOrEmpty(workorder.ProductionName))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -840,9 +840,9 @@ namespace DOAN.Service.MES.product
|
||||
|
||||
//规格型号
|
||||
NPOI.SS.UserModel.ICell currentCell_04 = currentRow.GetCell(2);
|
||||
|
||||
|
||||
workorder.Specification = currentCell_04?.ToString();
|
||||
if (currentCell_04 == null||string.IsNullOrEmpty(workorder.Specification))
|
||||
if (currentCell_04 == null || string.IsNullOrEmpty(workorder.Specification))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -965,21 +965,21 @@ namespace DOAN.Service.MES.product
|
||||
workorder.WorkorderDate = dateValue;
|
||||
workorder.Status = 1;
|
||||
//获取当前日期工单序列号 和序号
|
||||
DateTime currentDate =dateValue.Date;
|
||||
var MaxWorkorder= Context.Queryable<ProWorkorder>()
|
||||
DateTime currentDate = dateValue.Date;
|
||||
var MaxWorkorder = Context.Queryable<ProWorkorder>()
|
||||
.Where(it => it.WorkorderDate == currentDate)
|
||||
.OrderByDescending(it => it.Sort)
|
||||
.Select(it => new {it.Workorder,it.Sort})
|
||||
.Select(it => new { it.Workorder, it.Sort })
|
||||
.First();
|
||||
//工单 2024-9-13-组-线-序号
|
||||
int index = (row - 2);
|
||||
|
||||
int flowNum =index+
|
||||
int flowNum = index +
|
||||
Convert.ToInt16(MaxWorkorder.Workorder.Substring(MaxWorkorder.Workorder.Length - 3, 3));
|
||||
|
||||
|
||||
workorder.Workorder = dateValue.ToString("yyyyMMdd") + "_" + workorder.GroupCode + "_" + workorder.LineCode + "_" + flowNum.ToString("000");
|
||||
|
||||
|
||||
|
||||
|
||||
workorder.Sort = index * 10 + Convert.ToInt16(MaxWorkorder.Sort);
|
||||
|
||||
|
||||
@ -1004,12 +1004,12 @@ namespace DOAN.Service.MES.product
|
||||
UseTran2(() =>
|
||||
{
|
||||
|
||||
// Context.Deleteable<ProWorkorder>().Where(it => it.WorkorderDate == dateValue).ExecuteCommand();
|
||||
// Context.Deleteable<ProWorkorder>().Where(it => it.WorkorderDate == dateValue).ExecuteCommand();
|
||||
result = Context.Insertable(workorderList).ExecuteCommand();
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -1123,6 +1123,7 @@ namespace DOAN.Service.MES.product
|
||||
/// <returns></returns>
|
||||
public List<WorkOrderBom> SearchBOMNum(string workorder_num)
|
||||
{
|
||||
List<WorkOrderBom> workOrderBoms = new List<WorkOrderBom>();
|
||||
List<BaseMaterialBom> baseMaterialBoms = null;
|
||||
ProWorkorder proworkorder = Context.Queryable<ProWorkorder>().Where(it => it.Workorder == workorder_num).First();
|
||||
if (proworkorder != null)
|
||||
@ -1134,15 +1135,26 @@ namespace DOAN.Service.MES.product
|
||||
{
|
||||
foreach (var item in baseMaterialBoms)
|
||||
{
|
||||
float num = float.Parse(item.Iusequantity) * proworkorder.DeliveryNum.Value;
|
||||
item.Iusequantity = num.ToString();
|
||||
WorkOrderBom objectMaterial = new WorkOrderBom();
|
||||
|
||||
objectMaterial.SubInvCode=item.SubInvCode;
|
||||
objectMaterial.SubInvName = item.SubInvName;
|
||||
objectMaterial.Iusequantity_Single = item.Iusequantity;
|
||||
float num = float.Parse(item.Iusequantity) * proworkorder.DeliveryNum.Value;
|
||||
objectMaterial.Iusequantity_All = num.ToString();
|
||||
objectMaterial.BOMVersion = item.BOMVersion;
|
||||
workOrderBoms.Add(objectMaterial);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return baseMaterialBoms.Adapt<List<WorkOrderBom>>();
|
||||
|
||||
|
||||
|
||||
return workOrderBoms;
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user