0
우리는 토트를 작성한 다음 사용자 입력에 따라 토트 내에 배치를 작성하는 애플리케이션을 가지고 있습니다. 우리는 일괄 처리를 위해 데이터베이스에 삽입 레코드가 첫 번째 레코드의 .01 초 내에 중복 레코드를 생성하는 임의의 시간이 있음을 발견했습니다.C# MVC 5, EF 6, SQL 데이터베이스 중복 레코드 쓰기
1436 2016-06-14 12:41:28.617 Shipment 26 False Part123 822 NULL
1435 2016-06-14 12:41:28.600 Shipment 26 True Part123 822 NULL
1434 2016-06-14 12:40:38.520 Shipment 4 False Part123 822 NULL
참고 : 기록의 타임 스탬프가 주목
batch.Date = DateTime.Now;
batch.User = User.Identity.Name.Split('\\')[1];
batch.Active = true;
batch.Tote = tote;
database.Batches.Add(batch);
database.SaveChanges();
이것은 우리가 때때로 볼 수있는 기록이다
이
우리가 배치 레코드를 삽입하는 데 사용하는 코드입니다 0.017 초 이내에 발생했습니다. 중간 레코드는 모든 부품이 배치로 스캔되면 완전하다고 표시되기 때문에 사실입니다.이 문제가 발생한 사람이 있습니까? 그것은 네트워크 관련 문제, EF6, 또는 SQL 경우 확실하지 않습니다. 모든 입력을 부탁드립니다!
보기 코드 :
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<input type="hidden" value="@ViewBag.ToteID" id="toteID" />
<div class="form-horizontal">
<h4>New Small Lot</h4>
<hr />
<div class="form-group">
@Html.LabelFor(model => model.PartNum, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.PartNum, new { htmlAttributes = new { @Value = "", onkeydown = "RemoveDollarSign(this);RemoveCreateBatchPartIdentifier(this)" } })
@Html.ValidationMessageFor(model => model.PartNum, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.Quantity, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.Quantity, new { htmlAttributes = new { @Value = "", onkeydown ="RemoveQuantityIdentifier(this);TabtoSubmit(this)"} })
@Html.ValidationMessageFor(model => model.Quantity, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Submit" class="btn btn-primary" />
</div>
</div>
</div>
}
자바 스크립트 :
function RemoveCreateBatchPartIdentifier(i) {
i.value = i.value.replace(/^[Pp]/, '');
};
function RemoveQuantityIdentifier(i) {
i.value = i.value.replace(/[^0-9]/g, '');
};
function RemoveDollarSign(i) {
i.value = i.value.replace(/[$]/g, ' ');
};
function TabtoSubmit(i) {
if (event.which == '9')
{
i.form.submit();
}
여러 레코드를 삽입하는 방법을 조금 더 보여줘야합니다. 하나의 레코드에 대한 삽입 코드는 많은 단서를 제공하지 않습니다. –
에 View 코드가 표시됩니다. 아약스를 통해 서버에 데이터를 보내시겠습니까? 그 것들이 복수 입력 할 수 있기 때문에 – MRebati
귀하의 컨트롤러 코드가 좋습니다. 클라이언트 측에 문제가있을 수 있습니다. – MRebati