| | |
| | | connection.Dispose(); |
| | | } |
| | | } |
| | | public object ExecuteScalarWithTransaction(OracleConnection conn, OracleTransaction tran, string sql, params OracleParameter[] parameters) |
| | | { |
| | | using (var cmd = conn.CreateCommand()) |
| | | { |
| | | cmd.Transaction = tran; |
| | | cmd.CommandText = sql; |
| | | if (parameters != null) |
| | | { |
| | | cmd.Parameters.AddRange(parameters); |
| | | } |
| | | return cmd.ExecuteScalar(); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | public List<CcFailItems>? failItems { get; set; } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 配件绑定 |
| | | /// </summary> |
| | | public List<AccessoryList>? accessoryList { get; set; } |
| | | |
| | | |
| | | } |
| | | /// <summary> |
| | | /// 产测SN失败项明细表 |
| | | /// </summary> |
| | | public class CcFailItems |
| | | { |
| | | |
| | | |
| | | /// <summary> |
| | | /// 不良问题 |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | public string? MaterialHandling { get; set; } |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 配件明细 |
| | | /// </summary> |
| | | public class AccessoryList |
| | | { |
| | | |
| | | /// <summary> |
| | | /// 绑定状态((0:绑定, 1:解绑) |
| | | /// </summary> |
| | | public string? bindingState { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 配件SN号 |
| | | /// </summary> |
| | | public string? accessorySn { get; set; } |
| | | |
| | | /// <summary> |
| | | ///配件中文含义 |
| | | /// </summary> |
| | | public string? accessoryName { get; set; } |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "DAA008")] |
| | | public decimal? Daa008 { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 提交状态 |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "FSUBMIT")] |
| | | public decimal? FSubmit { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 提交人 |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "FSUBMIT_BY")] |
| | | public string? FSubmitBy { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 提交时间 |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "FSUBMIT_DATE")] |
| | | public DateTime? FSubmitDate { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 工单编号 |
| | | /// </summary> |
| | | [SugarColumn(ColumnName = "MOID_NUM")] |
| | | public string? MoidNum { get; set; } |
| | | } |
| | |
| | | public class QsItemIpiReq |
| | | { |
| | | /// <summary> |
| | | /// 首检单号 |
| | | /// </summary> |
| | | [Column("BILL_NO")] |
| | | [SugarColumn(ColumnName = "BILL_NO")] //用于SqlSugar |
| | | [StringLength(50, ErrorMessage = "首检单号长度不能超出50")] |
| | | public string? BillNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 备注 |
| | | /// </summary> |
| | | [Column("COMMENTS")] |
| | | [SugarColumn(ColumnName = "COMMENTS")] //用于SqlSugar |
| | | [StringLength(500, ErrorMessage = "备注长度不能超出500")] |
| | | public string? Comments { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 完成时间 |
| | | /// </summary> |
| | | [Column("COMPLETE_TIME")] |
| | | [SugarColumn(ColumnName = "COMPLETE_TIME")] //用于SqlSugar |
| | | public DateTime? CompleteTime { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 创建时间 |
| | | /// </summary> |
| | | [Column("CREATE_TIME")] |
| | | [SugarColumn(ColumnName = "CREATE_TIME")] //用于SqlSugar |
| | | public DateTime? CreateTime { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 序列SEQ_QS_IPI |
| | | /// </summary> |
| | | [Column("ID")] |
| | | /// |
| | | ///</summary> |
| | | [SugarColumn(IsPrimaryKey = true, OracleSequenceName = "SEQ_QS_IPI", |
| | | ColumnName = "ID")] |
| | | public decimal? Id { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 0表示不合格,1表示合格 |
| | | /// </summary> |
| | | [Column("IS_PASS")] |
| | | [SugarColumn(ColumnName = "IS_PASS")] //用于SqlSugar |
| | | public decimal? IsPass { get; set; } |
| | | /// |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "BILL_NO")] |
| | | public string BillNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 产品规格 |
| | | /// </summary> |
| | | [Column("ITEM_MOD")] |
| | | [SugarColumn(ColumnName = "ITEM_MOD")] //用于SqlSugar |
| | | [StringLength(1000, ErrorMessage = "产品规格长度不能超出1000")] |
| | | public string? ItemMod { get; set; } |
| | | /// |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "ITEM_NO")] |
| | | public string ItemNo { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 产品名 |
| | | /// </summary> |
| | | [Column("ITEM_NAME")] |
| | | [SugarColumn(ColumnName = "ITEM_NAME")] //用于SqlSugar |
| | | [StringLength(200, ErrorMessage = "产品名长度不能超出200")] |
| | | public string? ItemName { get; set; } |
| | | /// |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "ITEM_NAME")] |
| | | public string ItemName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 产品编号 |
| | | /// </summary> |
| | | [Column("ITEM_NO")] |
| | | [SugarColumn(ColumnName = "ITEM_NO")] //用于SqlSugar |
| | | [StringLength(50, ErrorMessage = "产品编号长度不能超出50")] |
| | | public string? ItemNo { get; set; } |
| | | /// |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "ITEM_MOD")] |
| | | public string ItemMod { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 产线 |
| | | /// </summary> |
| | | [Column("LINE")] |
| | | [SugarColumn(ColumnName = "LINE")] //用于SqlSugar |
| | | [StringLength(50, ErrorMessage = "产线长度不能超出50")] |
| | | public string? Line { get; set; } |
| | | /// |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "LINE")] |
| | | public string Line { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 产线名 |
| | | /// </summary> |
| | | [Column("LINE_NAME")] |
| | | [SugarColumn(ColumnName = "LINE_NAME")] //用于SqlSugar |
| | | [StringLength(50, ErrorMessage = "产线名长度不能超出50")] |
| | | public string? LineName { get; set; } |
| | | /// |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "LINE_NAME")] |
| | | public string LineName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 排产单号 |
| | | /// </summary> |
| | | [Column("PBAID")] |
| | | [SugarColumn(ColumnName = "PBAID")] //用于SqlSugar |
| | | public decimal? Pbaid { get; set; } |
| | | /// |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "WORKSHOP_CODE")] |
| | | public string WorkshopCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 审核日期 |
| | | /// </summary> |
| | | [Column("STATUS_DATE")] |
| | | [SugarColumn(ColumnName = "STATUS_DATE")] //用于SqlSugar |
| | | /// |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "WORKSHOP_NAME")] |
| | | public string WorkshopName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "STATUS_USER")] |
| | | public string StatusUser { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "STATUS_DATE")] |
| | | public DateTime? StatusDate { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 审核人 |
| | | /// </summary> |
| | | [Column("STATUS_USER")] |
| | | [SugarColumn(ColumnName = "STATUS_USER")] //用于SqlSugar |
| | | [StringLength(50, ErrorMessage = "审核人长度不能超出50")] |
| | | public string? StatusUser { get; set; } |
| | | /// |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "COMMENTS")] |
| | | public string Comments { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 车间编码 |
| | | /// </summary> |
| | | [Column("WORKSHOP_CODE")] |
| | | [SugarColumn(ColumnName = "WORKSHOP_CODE")] //用于SqlSugar |
| | | [StringLength(50, ErrorMessage = "车间编码长度不能超出50")] |
| | | public string? WorkshopCode { get; set; } |
| | | /// |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "IS_PASS")] |
| | | public short? IsPass { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 车间名 |
| | | /// </summary> |
| | | [Column("WORKSHOP_NAME")] |
| | | [SugarColumn(ColumnName = "WORKSHOP_NAME")] //用于SqlSugar |
| | | [StringLength(50, ErrorMessage = "车间名长度不能超出50")] |
| | | public string? WorkshopName { get; set; } |
| | | |
| | | /// |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "CREATE_TIME")] |
| | | public DateTime? CreateTime { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 模具号 |
| | | /// </summary> |
| | | [Column("MOID_NUM")] |
| | | [SugarColumn(ColumnName = "MOID_NUM")] //用于SqlSugar |
| | | [StringLength(50, ErrorMessage = "模具号长度不能超出50")] |
| | | public string? MoidNum { get; set; } |
| | | /// |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "COMPLETE_TIME")] |
| | | public DateTime? CompleteTime { get; set; } |
| | | |
| | | [Column("Remarks")] |
| | | [SugarColumn(ColumnName = "Remarks")] //用于SqlSugar |
| | | [StringLength(200, ErrorMessage = "备注不能超出200")] |
| | | public string? Remarks { get; set; } |
| | | /// <summary> |
| | | /// |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "PBAID")] |
| | | public decimal? Pbaid { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "MOID_NUM")] |
| | | public string MoidNum { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "FSUBMIT_BY")] |
| | | public string FsubmitBy { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "FSUBMIT_DATE")] |
| | | public DateTime? FsubmitDate { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "FSUBMIT")] |
| | | public decimal? Fsubmit { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "STATUS")] |
| | | public short? Status { get; set; } |
| | | |
| | | /// <summary> |
| | | /// |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "REMARKS")] |
| | | public string Remarks { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 物料ID |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "ITEM_ID")] |
| | | public decimal? ItemId { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 创建人 |
| | | ///</summary> |
| | | [SugarColumn(ColumnName = "CREATE_BY")] |
| | | public string CreateBy { get; set; } |
| | | } |
| | |
| | | } |
| | | |
| | | //获取所有数据分页 |
| | | public List<SJPageResult> getPage(SJPageResult queryObj) |
| | | public (List<SJPageResult> item, int TotalCount) getPage(SJPageResult queryObj) |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | | string[]? lineNo = null; |
| | | |
| | | if (StringUtil.IsNotNullOrEmpty(queryObj.StatusUser)) |
| | | lineNo = _baseService.getUserLineNo(queryObj.StatusUser); |
| | | // if (StringUtil.IsNotNullOrEmpty(queryObj.StatusUser)) |
| | | // lineNo = _baseService.getUserLineNo(queryObj.StatusUser); |
| | | |
| | | var totalCount = 0; |
| | | |
| | | var data = db.Queryable<SJPageResult>() |
| | | .WhereIF(lineNo != null && lineNo.Length > 0, |
| | |
| | | .WhereIF(queryObj.Id != null, a => a.Id == queryObj.Id) |
| | | .WhereIF(StringUtil.IsNotNullOrEmpty(queryObj.BillNo), |
| | | a => a.BillNo == queryObj.BillNo) |
| | | // .WhereIF( |
| | | // StringUtil.IsNotNullOrEmpty(queryObj.Result) && |
| | | // "未完成".Equals(queryObj.Result), |
| | | // a => a.Result == queryObj.Result && (a.FSubmit == 0 || a.FSubmit == null)) |
| | | .WhereIF( |
| | | StringUtil.IsNotNullOrEmpty(queryObj.Result) && |
| | | "未完成".Equals(queryObj.Result), |
| | | a => a.Result == queryObj.Result) |
| | | a => a.FSubmit == 0 || a.FSubmit == null) |
| | | // .WhereIF( |
| | | // StringUtil.IsNotNullOrEmpty(queryObj.Result) && |
| | | // !"未完成".Equals(queryObj.Result), |
| | | // a => a.Result != "未完成" && a.FSubmit == 1) |
| | | .WhereIF( |
| | | StringUtil.IsNotNullOrEmpty(queryObj.Result) && |
| | | !"未完成".Equals(queryObj.Result), |
| | | a => a.Result != "未完成") |
| | | a => a.FSubmit == 1) |
| | | .OrderBy(a => a.BillNo, OrderByType.Desc) |
| | | .ToPageList(queryObj.PageIndex, queryObj.Limit); |
| | | .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount); |
| | | |
| | | return data; |
| | | return (data, totalCount); |
| | | } |
| | | |
| | | |
| | |
| | | item.Items = getQSItems(qsItemIpiReq.Id, null); |
| | | var sjPageResult = new SJPageResult |
| | | { Id = item.From.Id, Limit = 1, PageIndex = 1 }; |
| | | item.Result = getPage(sjPageResult)[0]; |
| | | var pageResult = getPage(sjPageResult); |
| | | item.Result = pageResult.item[0]; |
| | | |
| | | return item; |
| | | } |
| | |
| | | |
| | | return withOracle; |
| | | } |
| | | |
| | | public bool SJQaSubmit(LLJDto rkjDto) |
| | | { |
| | | var useTransactionWithOracle = |
| | | SqlSugarHelper.UseTransactionWithOracle(db => |
| | | { |
| | | return db.Updateable<QsItemIpiReq>() |
| | | .SetColumns(s => s.Fsubmit == 1) |
| | | .SetColumns(s => s.FsubmitBy == rkjDto.userNo) |
| | | .SetColumns(s => s.FsubmitDate == DateTime.Now) |
| | | .Where(s => s.Id == rkjDto.gid) |
| | | .ExecuteCommand(); |
| | | }); |
| | | |
| | | return useTransactionWithOracle > 0; |
| | | } |
| | | } |
| | |
| | | }).ToList(); |
| | | } |
| | | |
| | | public List<QsQaItemXj> getPage(XJPageResult queryObj) |
| | | public (List<QsQaItemXj> item, int TotalCount) getPage(XJPageResult queryObj) |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | |
| | | var id = Convert.ToDecimal(queryObj.id); |
| | | |
| | | var totalCount = 0; |
| | | |
| | | string[]? lineNo = null; |
| | | |
| | | if (StringUtil.IsNotNullOrEmpty(queryObj.createUser)) |
| | | lineNo = _baseService.getUserLineNo(queryObj.createUser); |
| | | // if (StringUtil.IsNotNullOrEmpty(queryObj.createUser)) |
| | | // lineNo = _baseService.getUserLineNo(queryObj.createUser); |
| | | |
| | | return db |
| | | .Queryable<QsQaItemXj, Womdaa, MesLine, |
| | | MesItems>((s, a, c, b) => |
| | | var pageList = db |
| | | .Queryable<QsQaItemXj, Womdaa, |
| | | MesItems>((s, a, b) => |
| | | new JoinQueryInfos( |
| | | JoinType.Inner, s.BillNo == a.Daa001, |
| | | JoinType.Left, a.Daa015 == c.LineNo, |
| | | JoinType.Left, s.ItemId == b.Id |
| | | ) |
| | | ) |
| | | .WhereIF(lineNo != null && lineNo.Length > 0, |
| | | (s, a, c, b) => lineNo.Contains(c.LineNo)) |
| | | |
| | | .WhereIF( |
| | | StringUtil.IsNotNullOrEmpty(queryObj.result) && |
| | | "未完成".Equals(queryObj.result), |
| | | (s, a, c, b) => s.FcheckResu == null) |
| | | (s, a, b) => s.Fsubmit == null || s.Fsubmit == 0) |
| | | // .WhereIF( |
| | | // StringUtil.IsNotNullOrEmpty(queryObj.result) && |
| | | // !"未完成".Equals(queryObj.result), |
| | | // (s, a, b) => s.FcheckResu != null) |
| | | .WhereIF( |
| | | StringUtil.IsNotNullOrEmpty(queryObj.result) && |
| | | !"未完成".Equals(queryObj.result), |
| | | (s, a, c, b) => s.FcheckResu != null) |
| | | .WhereIF(id > 0, (s, a, c, b) => s.Id == id) |
| | | .Select((s, a, c, b) => new QsQaItemXj |
| | | (s, a, b) => s.Fsubmit == 1) |
| | | .WhereIF(id > 0, (s, a, b) => s.Id == id) |
| | | .Select((s, a, b) => new QsQaItemXj |
| | | { |
| | | Daa020 = c.LineNo, |
| | | Id = s.Id, |
| | | PlanQty = a.Daa008, |
| | | CreateBy = s.CreateBy, |
| | |
| | | ItemModel = b.ItemModel, |
| | | FcheckBy = s.FcheckBy, |
| | | FcheckResu = s.FcheckResu, |
| | | Remarks = s.Remarks |
| | | Remarks = s.Remarks, |
| | | Fsubmit = s.Fsubmit, |
| | | FcheckDate = s.FcheckDate, |
| | | FsubmitBy = s.FsubmitBy |
| | | }).OrderBy(s => s.CreateDate, OrderByType.Desc) |
| | | .ToPageList(queryObj.PageIndex, queryObj.Limit); |
| | | .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount); |
| | | |
| | | return (pageList, totalCount); |
| | | } |
| | | |
| | | public bool XJQaSubmit(LLJDto rkjDto) |
| | | { |
| | | var useTransactionWithOracle = |
| | | SqlSugarHelper.UseTransactionWithOracle(db => |
| | | { |
| | | return db.Updateable<QsQaItemXj>() |
| | | .SetColumns(s => s.Fsubmit == 1) |
| | | .SetColumns(s => s.FsubmitBy == rkjDto.userNo) |
| | | .SetColumns(s => s.FsubmitDate == DateTime.Now) |
| | | .Where(s => s.Id == rkjDto.gid) |
| | | .ExecuteCommand(); |
| | | }); |
| | | |
| | | return useTransactionWithOracle > 0; |
| | | } |
| | | |
| | | public List<QsQaItemXj01> setJYItem(string itemNo) |
| | | { |
| | |
| | | { |
| | | var sqlHelper = new OracleSQLHelper(); |
| | | bool result = true; |
| | | // |
| | | |
| | | var (connection, transaction) = sqlHelper.BeginTransaction(); |
| | | |
| | | try |
| | | { |
| | | // 主表插入 |
| | | var sql1 = $@"INSERT INTO MES_SN_STATUS_DETAILS |
| | | (ID, TICKET_NO, SN_NO, WORKSTATION_NO, SN_STATE, LOGIN_ID) |
| | | VALUES (SEQ_MES_SN_STATUS_DETAILS_ID.NEXTVAL, |
| | | '{asnInfo.tickeNo}', |
| | | '{asnInfo.snNo}', |
| | | '{asnInfo.workstationNo}', |
| | | '{asnInfo.snState}', |
| | | '{asnInfo.loginId}')"; |
| | | |
| | | // 1. 主表插入 |
| | | var sql1 = $@" |
| | | INSERT INTO MES_SN_STATUS_DETAILS |
| | | (ID, TICKET_NO, SN_NO, WORKSTATION_NO, SN_STATE, LOGIN_ID) |
| | | VALUES (SEQ_MES_SN_STATUS_DETAILS_ID.NEXTVAL, |
| | | '{asnInfo.tickeNo}', |
| | | '{asnInfo.snNo}', |
| | | '{asnInfo.workstationNo}', |
| | | '{asnInfo.snState}', |
| | | '{asnInfo.loginId}')"; |
| | | int i = sqlHelper.ExecuteNonQueryWithTransaction(connection, transaction, sql1); |
| | | |
| | | // 2. 失败项插入 |
| | | if (i > 0 && asnInfo.failItems?.Count > 0) |
| | | { |
| | | foreach (var item in asnInfo.failItems) |
| | | { |
| | | var sql2 = $@"INSERT INTO CC_FAIL_ITEMS |
| | | (ID, MID, DEFECT_ISSUE, ROOT_CAUSE, REPAIR_METHOD, MATERIAL_HANDLING, CREATE_DATE, CREATED_BY) |
| | | VALUES (SEQ_CC_FAIL_ITEMS.NEXTVAL, |
| | | SEQ_MES_SN_STATUS_DETAILS_ID.CURRVAL, |
| | | '{item.DefectIssue}', |
| | | '{item.RootCause}', |
| | | '{item.RepairMethod}', |
| | | '{item.MaterialHandling}', |
| | | SYSDATE, |
| | | '{asnInfo.loginId}')"; |
| | | |
| | | var sql2 = $@" |
| | | INSERT INTO CC_FAIL_ITEMS |
| | | (ID, MID, DEFECT_ISSUE, ROOT_CAUSE, REPAIR_METHOD, MATERIAL_HANDLING, CREATE_DATE, CREATED_BY) |
| | | VALUES (SEQ_CC_FAIL_ITEMS.NEXTVAL, |
| | | SEQ_MES_SN_STATUS_DETAILS_ID.CURRVAL, |
| | | '{item.DefectIssue}', |
| | | '{item.RootCause}', |
| | | '{item.RepairMethod}', |
| | | '{item.MaterialHandling}', |
| | | SYSDATE, |
| | | '{asnInfo.loginId}')"; |
| | | sqlHelper.ExecuteNonQueryWithTransaction(connection, transaction, sql2); |
| | | } |
| | | } |
| | | |
| | | // 全部成功提交 |
| | | // 3. 配件绑定/解绑 & 日志记录 |
| | | if (asnInfo.accessoryList?.Count > 0) |
| | | { |
| | | foreach (var accessory in asnInfo.accessoryList) |
| | | { |
| | | var now = "SYSDATE"; |
| | | var user = asnInfo.loginId; |
| | | var snNo = asnInfo.snNo; |
| | | var partSn = accessory.accessorySn; |
| | | var partName = accessory.accessoryName; |
| | | |
| | | if (accessory.bindingState == "0") |
| | | { |
| | | // ====== 校验:同一个配件SN是否已绑定 ====== |
| | | var checkSql = $@" |
| | | SELECT COUNT(1) FROM MES_SN_PART_BINDING |
| | | WHERE PART_SN_NO = '{partSn}'"; |
| | | var exists = Convert.ToInt32(sqlHelper.ExecuteScalarWithTransaction(connection, transaction, checkSql)); |
| | | if (exists > 0) |
| | | { |
| | | throw new Exception($"配件SN[{partSn}]已绑定,请先解绑再绑定!"); |
| | | } |
| | | |
| | | // 绑定 |
| | | var sqlBind = $@" |
| | | INSERT INTO MES_SN_PART_BINDING |
| | | (ID, SN_NO, PART_SN_NO, PART_NAME_CN, CREATE_DATE, CREATE_USER) |
| | | VALUES (SEQ_MES_SN_PART_BINDING.NEXTVAL, |
| | | '{snNo}', |
| | | '{partSn}', |
| | | '{partName}', |
| | | {now}, |
| | | '{user}')"; |
| | | sqlHelper.ExecuteNonQueryWithTransaction(connection, transaction, sqlBind); |
| | | |
| | | // 日志 |
| | | var sqlLog = $@" |
| | | INSERT INTO MES_SN_PART_BINDING_LOG |
| | | (ID, SN_NO, PART_SN_NO, PART_NAME_CN, CREATE_DATE, CREATE_USER, OP_TYPE) |
| | | VALUES (SEQ_MES_SN_PART_BINDING_LOG.NEXTVAL, |
| | | '{snNo}', |
| | | '{partSn}', |
| | | '{partName}', |
| | | {now}, |
| | | '{user}', |
| | | 0)"; |
| | | sqlHelper.ExecuteNonQueryWithTransaction(connection, transaction, sqlLog); |
| | | } |
| | | else if (accessory.bindingState == "1") |
| | | { |
| | | // 解绑 |
| | | var sqlUnbind = $@" |
| | | DELETE FROM MES_SN_PART_BINDING |
| | | WHERE SN_NO = '{snNo}' |
| | | AND PART_SN_NO = '{partSn}'"; |
| | | sqlHelper.ExecuteNonQueryWithTransaction(connection, transaction, sqlUnbind); |
| | | |
| | | // 日志 |
| | | var sqlLog = $@" |
| | | INSERT INTO MES_SN_PART_BINDING_LOG |
| | | (ID, SN_NO, PART_SN_NO, PART_NAME_CN, CREATE_DATE, CREATE_USER, OP_TYPE) |
| | | VALUES (SEQ_MES_SN_PART_BINDING_LOG.NEXTVAL, |
| | | '{snNo}', |
| | | '{partSn}', |
| | | '{partName}', |
| | | {now}, |
| | | '{user}', |
| | | 1)"; |
| | | sqlHelper.ExecuteNonQueryWithTransaction(connection, transaction, sqlLog); |
| | | } |
| | | } |
| | | } |
| | | |
| | | transaction.Commit(); |
| | | } |
| | | catch (Exception ex) |
| | | catch (Exception) |
| | | { |
| | | transaction.Rollback(); |
| | | result = false; |
| | | throw; // 建议记录日志 |
| | | throw; |
| | | } |
| | | finally |
| | | { |
| | |
| | | return result; |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 设置中箱码(绑定/解绑 SN) |
| | | /// </summary> |
| | |
| | | try |
| | | { |
| | | dynamic resultInfos = new ExpandoObject(); |
| | | var tbBillList = |
| | | new SJService().getPage(queryObj); |
| | | resultInfos.tbBillList = tbBillList; |
| | | var (item, totalCount) = new SJService().getPage(queryObj); |
| | | resultInfos.tbBillList = item; |
| | | return new ResponseResult |
| | | { |
| | | status = 0, |
| | | message = "OK", |
| | | data = resultInfos |
| | | data = resultInfos, |
| | | TotalCount = totalCount |
| | | }; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | return ResponseResult.ResponseError(ex); |
| | | } |
| | | } |
| | | |
| | | //IqcQaSubmit |
| | | [HttpPost("SJQaSubmit")] |
| | | public ResponseResult SJQaSubmit(LLJDto rkjDto) |
| | | { |
| | | try |
| | | { |
| | | dynamic resultInfos = new ExpandoObject(); |
| | | var tbBillList = |
| | | new SJService().SJQaSubmit(rkjDto); |
| | | resultInfos.tbBillList = tbBillList; |
| | | return new ResponseResult |
| | | { |
| | | status = 0, |
| | | message = "OK", |
| | | data = resultInfos |
| | | }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return ResponseResult.ResponseError(ex); |
| | | } |
| | | } |
| | | } |
| | |
| | | return ResponseResult.ResponseError(ex); |
| | | } |
| | | } |
| | | |
| | | [HttpPost("XJQaSubmit")] |
| | | public ResponseResult XJQaSubmit(LLJDto rkjDto) |
| | | { |
| | | try |
| | | { |
| | | dynamic resultInfos = new ExpandoObject(); |
| | | var tbBillList = |
| | | new XJService().XJQaSubmit(rkjDto); |
| | | resultInfos.tbBillList = tbBillList; |
| | | return new ResponseResult |
| | | { |
| | | status = 0, |
| | | message = "OK", |
| | | data = resultInfos |
| | | }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return ResponseResult.ResponseError(ex); |
| | | } |
| | | } |
| | | |
| | | //setJYItem |
| | | [HttpPost("setJYItem")] |
| | |
| | | try |
| | | { |
| | | dynamic resultInfos = new ExpandoObject(); |
| | | var (item, totalCount) = new XJService().getPage(queryObj); |
| | | var tbBillList = |
| | | new XJService().getPage(queryObj); |
| | | resultInfos.tbBillList = tbBillList; |
| | | resultInfos.tbBillList = item; |
| | | return new ResponseResult |
| | | { |
| | | status = 0, |
| | | message = "OK", |
| | | data = resultInfos |
| | | data = resultInfos, |
| | | TotalCount = totalCount |
| | | }; |
| | | } |
| | | catch (Exception ex) |