Browse Source

1. 修正PCS021過站 NG新增Table

PTD
ray 3 years ago
parent
commit
56d9421892
  1. 46
      AMESCoreStudio.Web/Controllers/PCSController.cs
  2. 7
      AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs
  3. 2
      AMESCoreStudio.WebApi/Controllers/AMES/NgComponentsController.cs
  4. 3
      AMESCoreStudio.WebApi/Controllers/AMES/NgInfoController.cs
  5. 36
      AMESCoreStudio.WebApi/Models/AMES/NgComponent.cs

46
AMESCoreStudio.Web/Controllers/PCSController.cs

@ -2252,9 +2252,9 @@ namespace AMESCoreStudio.Web.Controllers
StatusID = NextStopCloseStation.Success ? -1 : 1,
CreateUserID = 1
};
var resutPost = await _pcsApi.PostBarcodeInfoes(JsonConvert.SerializeObject(barcodeInfo));
if (resutPost.Success)
model.BarCodeID = (int)resutPost.Data.Select(s => s.BarcodeID).FirstOrDefault();
var resultBarCodeInfo = await _pcsApi.PostBarcodeInfoes(JsonConvert.SerializeObject(barcodeInfo));
if (resultBarCodeInfo.Success)
model.BarCodeID = (int)resultBarCodeInfo.Data.Select(s => s.BarcodeID).FirstOrDefault();
}
// 新增 BarCodeStation
@ -2309,8 +2309,10 @@ namespace AMESCoreStudio.Web.Controllers
}
// 新增 NgInfo 不良時新增 判斷有不良代碼
// 判斷有不良代碼 新增 NgInfo NgComponent
if (model.BarcodeNG)
{
foreach (var NGNo in model.Inputs.Where(w => w.Contains("$")))
{
var FixtureNo = string.Join(",", model.MaterialOutfits.Select(s => s.Inputs).ToArray());
NgInfo ngInfo = new NgInfo
@ -2320,12 +2322,24 @@ namespace AMESCoreStudio.Web.Controllers
OperatorID = 0,
FixtureNo = string.IsNullOrWhiteSpace(FixtureNo) ? "-1" : FixtureNo,
BarcodeID = model.BarCodeID,
ReasonNo = NGNo,
ProgramNo = "N/A",
MachineNo = "N/A",
RuleStationId = model.RuleStation,
WipId = model.WipID
};
await _pcsApi.PostNgInfo(JsonConvert.SerializeObject(ngInfo));
var resultNgInfo = await _pcsApi.PostNgInfo(JsonConvert.SerializeObject(ngInfo));
if (resultNgInfo.Success)
{
NgComponent ngComponent = new NgComponent
{
NgID = resultNgInfo.Data.FirstOrDefault().NgID,
LocationNo = "N/A",
NgNo = NGNo
};
await _pcsApi.PostNgComponent(JsonConvert.SerializeObject(ngComponent));
}
}
}
#region 當生產單位為SMT或DIP時,確認是否有綁Group,有綁連片一起過站
@ -2392,18 +2406,34 @@ namespace AMESCoreStudio.Web.Controllers
// 新增 NgInfo 不良時新增 判斷有不良代碼
if (model.BarcodeNG)
{
foreach (var NGNo in model.Inputs.Where(w => w.Contains("$")))
{
var FixtureNo = string.Join(",", model.MaterialOutfits.Select(s => s.Inputs).ToArray());
NgInfo ngInfo = new NgInfo
{
TypeNo = model.StationTestType,
OperatorID = 0,
FixtureNo = string.Join(",", model.MaterialOutfits.Select(s => s.Inputs).ToArray()),
BarcodeID = id,
FixtureNo = string.IsNullOrWhiteSpace(FixtureNo) ? "-1" : FixtureNo,
BarcodeID = model.BarCodeID,
ReasonNo = NGNo,
ProgramNo = "N/A",
MachineNo = "N/A",
RuleStationId = model.RuleStation,
WipId = model.WipID
};
await _pcsApi.PostNgInfo(JsonConvert.SerializeObject(ngInfo));
var resultNgInfo = await _pcsApi.PostNgInfo(JsonConvert.SerializeObject(ngInfo));
if (resultNgInfo.Success)
{
NgComponent ngComponent = new NgComponent
{
NgID = resultNgInfo.Data.FirstOrDefault().NgID,
LocationNo = "N/A",
NgNo = NGNo
};
await _pcsApi.PostNgComponent(JsonConvert.SerializeObject(ngComponent));
}
}
}
}
}

7
AMESCoreStudio.Web/HttpApis/AMES/IPCS.cs

@ -243,6 +243,13 @@ namespace AMESCoreStudio.Web
[WebApiClient.Attributes.HttpPut("api/NgInfo")]
ITask<ResultModel<NgInfo>> PutNgInfo([FromBody, RawJsonContent] string model);
/// <summary>
/// 更新不良零件資料
/// </summary>
/// <returns></returns>
[WebApiClient.Attributes.HttpPost("api/NgComponents")]
ITask<ResultModel<NgComponent>> PostNgComponent([FromBody, RawJsonContent] string model);
#endregion
#region BarcodeType 條碼類別資料檔 PCS001

2
AMESCoreStudio.WebApi/Controllers/AMES/NgComponentsController.cs

@ -150,6 +150,8 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
public async Task<ResultModel<NgComponent>> PostNgComponent(NgComponent ngComponent)
{
ResultModel<NgComponent> result = new ResultModel<NgComponent>();
Helper helper = new Helper(_context);
ngComponent.ComponentID = helper.GetIDKey("COMPONENT_ID").Result;
_context.NgComponents.Add(ngComponent);
try

3
AMESCoreStudio.WebApi/Controllers/AMES/NgInfoController.cs

@ -175,11 +175,14 @@ namespace AMESCoreStudio.WebApi.Controllers.AMES
Helper helper = new Helper(_context);
ngInfo.NgID = helper.GetIDKey("NG_ID").Result;
_context.NgInfos.Add(ngInfo);
List<NgInfo> ngInfos = new List<NgInfo> { ngInfo };
try
{
await _context.SaveChangesAsync();
result.Success = true;
result.Msg = "OK";
result.Data = ngInfos;
}
catch (Exception ex)
{

36
AMESCoreStudio.WebApi/Models/AMES/NgComponent.cs

@ -17,20 +17,20 @@ namespace AMESCoreStudio.WebApi.Models.AMES
/// 不良零件ID
/// </summary>
[Key]
[Column("COMPONENT_ID", TypeName = "NUMBER")]
[Column("COMPONENT_ID")]
[DataMember]
[Required]
[Display(Name = "不良零件ID")]
public decimal ComponentID { get; set; }
public int ComponentID { get; set; }
/// <summary>
/// 測試不良ID
/// </summary>
[Column("NG_ID", TypeName = "NUMBER")]
[Column("NG_ID")]
[DataMember]
[Required]
[Display(Name = "測試不良ID")]
public decimal NgID { get; set; }
public int NgID { get; set; }
/// <summary>
/// 零件位置代碼
@ -45,10 +45,10 @@ namespace AMESCoreStudio.WebApi.Models.AMES
/// <summary>
/// 不良腳位數量
/// </summary>
[Column("PIN_QTY", TypeName = "NUMBER")]
[Column("PIN_QTY")]
[DataMember]
[Display(Name = "不良腳位數量")]
public decimal PinQty { get; set; }
public int PinQty { get; set; }
/// <summary>
/// 不良原因代碼
@ -73,50 +73,50 @@ namespace AMESCoreStudio.WebApi.Models.AMES
/// <summary>
/// 平均高度測試值
/// </summary>
[Column("HEIGHT_AVG", TypeName = "NUMBER")]
[Column("HEIGHT_AVG")]
[DataMember]
[Display(Name = "平均高度測試值")]
public decimal HeightAvg { get; set; }
public decimal HeightAvg { get; set; } = 0;
/// <summary>
/// 平均面積測試值
/// </summary>
[Column("AREA_AVG", TypeName = "NUMBER")]
[Column("AREA_AVG")]
[DataMember]
[Display(Name = "平均面積測試值")]
public decimal AreaAvg { get; set; }
public decimal AreaAvg { get; set; } = 0;
/// <summary>
/// 平均體積測試值
/// </summary>
[Column("VOLUME_AVG", TypeName = "NUMBER")]
[Column("VOLUME_AVG")]
[DataMember]
[Display(Name = "平均體積測試值")]
public decimal VolumeAvg { get; set; }
public decimal VolumeAvg { get; set; } = 0;
/// <summary>
/// 平均X軸偏移量測試值
/// </summary>
[Column("X_OFFSET_AVG", TypeName = "NUMBER")]
[Column("X_OFFSET_AVG")]
[DataMember]
[Display(Name = "平均X軸偏移量測試值")]
public decimal XOffsetAvg { get; set; }
public decimal XOffsetAvg { get; set; } = 0;
/// <summary>
/// 平均Y軸偏移量測試值
/// </summary>
[Column("Y_OFFSET_AVG", TypeName = "NUMBER")]
[Column("Y_OFFSET_AVG")]
[DataMember]
[Display(Name = "平均Y軸偏移量測試值")]
public decimal YOffsetAvg { get; set; }
public decimal YOffsetAvg { get; set; } = 0;
/// <summary>
/// 處理狀態(0:尚未維修處理, 1:已維修處理, 2:誤判)
/// </summary>
[Column("STATUS", TypeName = "NUMBER")]
[Column("STATUS")]
[DataMember]
[Display(Name = "處理狀態")]
public decimal Status { get; set; } = 0;
public int Status { get; set; } = 0;
/// <summary>
/// 更換料號

Loading…
Cancel
Save