116 lines
3.7 KiB
C#
116 lines
3.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web.Http;
|
|
using BLL;
|
|
using Model;
|
|
|
|
namespace WebAPI.Controllers.CQMS
|
|
{
|
|
/// <summary>
|
|
/// 共检通知单控制器
|
|
/// </summary>
|
|
public class InspectionManagementController : ApiController
|
|
{
|
|
/// <summary>
|
|
/// 首次扫描执行,加载数据
|
|
/// </summary>
|
|
/// <param name="InspectionNoticeMenuId"></param>
|
|
/// <returns></returns>
|
|
[HttpGet]
|
|
public Model.ResponeData GetPersonQuality(string InspectionNoticeMenuId)
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
var model = BLL.InspectionManagementService.GetInspectionManagementById(InspectionNoticeMenuId);
|
|
returnPersonQuality newModel = new returnPersonQuality();
|
|
if (model != null)
|
|
{
|
|
newModel.InspectionCode = model.InspectionCode;
|
|
newModel.IsOnceQualified = model.IsOnceQualified;
|
|
if (!string.IsNullOrEmpty(model.InspectionDate.ToString()))
|
|
{
|
|
newModel.InspectionDate = model.InspectionDate.ToString().Replace("/", "-");
|
|
}
|
|
newModel.UnqualifiedReason = model.UnqualifiedReason;
|
|
//附件
|
|
var Fjmodel = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == InspectionNoticeMenuId && x.MenuId == Const.InspectionNoticeMenuId);
|
|
if (model != null)
|
|
{
|
|
newModel.AttachUrl = Fjmodel.AttachUrl;
|
|
}
|
|
|
|
responeData.data = newModel;
|
|
}
|
|
else {
|
|
responeData.code = 0;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
|
|
#region 根据二维码ID验收日期、是否一次合格
|
|
/// <summary>
|
|
/// 根据二维码ID修改验收日期、是否一次合格
|
|
/// </summary>
|
|
/// <param name="model"></param>
|
|
/// <returns></returns>
|
|
[HttpPost]
|
|
public Model.ResponeData SavePersonQuality([FromBody] Model.ProcessControl_InspectionManagement model)
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
InspectionManagementService.UpdateByInspectionManagementId(model);
|
|
//上传附件
|
|
SaveAttachFile(model.InspectionId, BLL.Const.InspectionNoticeMenuId, model.AttachUrl);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
|
|
return responeData;
|
|
}
|
|
#endregion
|
|
|
|
public static void SaveAttachFile(string dataId, string menuId, string url)
|
|
{
|
|
Model.ToDoItem toDoItem = new Model.ToDoItem
|
|
{
|
|
MenuId = menuId,
|
|
DataId = dataId,
|
|
UrlStr = url,
|
|
};
|
|
APIUpLoadFileService.SaveAttachUrl(toDoItem);
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// 返回实体
|
|
/// </summary>
|
|
public class returnPersonQuality
|
|
{
|
|
public string InspectionDate { get; set; }
|
|
|
|
public bool? IsOnceQualified { get; set; }
|
|
|
|
public int MyProperty { get; set; }
|
|
|
|
public string InspectionCode { get; set; }
|
|
|
|
public string UnqualifiedReason { get; set; }
|
|
|
|
public string AttachUrl { get; set; }
|
|
}
|
|
}
|
|
} |