| | |
| | | using System.Data.SqlClient; |
| | | using System.Text; |
| | | using Masuit.Tools; |
| | | using Microsoft.SqlServer.Server; |
| | | using NewPdaSqlServer.DB; |
| | | using NewPdaSqlServer.Dto.service; |
| | | using NewPdaSqlServer.entity; |
| | | using NewPdaSqlServer.entity.Base; |
| | | using NewPdaSqlServer.util; |
| | | using SqlSugar; |
| | | |
| | | namespace NewPdaSqlServer.service.Wom; |
| | |
| | | |
| | | var _strMsg = ""; |
| | | var _intSum = ""; |
| | | var _cfBar = "";//拆分后条码 |
| | | var _cfBar = ""; //拆分后条码 |
| | | using (var conn = new SqlConnection(DbHelperSQL.strConn)) |
| | | { |
| | | using (var cmd = new SqlCommand("[prc_pda_SCLLHB_CF]", conn)) |
| | |
| | | var dto = new ProductionPickDto |
| | | { |
| | | daa001 = query.hbNo, |
| | | barcode = query.barcode,//原条码 |
| | | cfBarcode = _cfBar//拆分后条码 |
| | | barcode = query.barcode, //原条码 |
| | | cfBarcode = _cfBar //拆分后条码 |
| | | }; |
| | | |
| | | return dto; |
| | |
| | | { |
| | | if (string.IsNullOrEmpty(query.hbNo)) throw new Exception("合并单号为空"); |
| | | |
| | | var queryResult = Db.Queryable<Womdaahb, Womdaa, MesItems>( |
| | | (b, a, i) => new JoinQueryInfos( |
| | | JoinType.Left, b.OrgId.ToString() == a.ErpSczz, // Womdaahb ↔ Womdaa 关联 |
| | | JoinType.Left, a.Daa002 == i.ItemId.ToString()) // Womdaa ↔ MesItems 关联 |
| | | ) |
| | | .Where((b, a, i) => |
| | | (b.Daah009 != null && a.Daa021 != null) && // 防止null异常 |
| | | ( |
| | | b.Daah009.Contains("," + a.Daa021 + ",") || // 匹配中间值 |
| | | b.Daah009.StartsWith(a.Daa021 + ",") || // 匹配开头值 |
| | | b.Daah009.EndsWith("," + a.Daa021) || // 匹配结尾值 |
| | | b.Daah009 == a.Daa021 // 完全匹配 |
| | | ) |
| | | ) |
| | | .Where((b, a, i) => b.Daahb001 == query.hbNo && b.Fstatus == 1) // 其他条件 |
| | | .Select((b, a, i) => new |
| | | { |
| | | b.Daahb001, |
| | | a.Daa001, // 工单号 |
| | | a.CaaGuid, // Womdaa 的 GUID |
| | | i.ItemName // MesItems 的字段 |
| | | }) |
| | | .First(); |
| | | var queryResult = Db.Queryable<Womdaahb, Womdaa, MesItems>((b, a, i) => |
| | | new JoinQueryInfos( |
| | | JoinType.Left, |
| | | b.OrgId.ToString() == a.ErpSczz, // Womdaahb ↔ Womdaa 关联 |
| | | JoinType.Left, |
| | | a.Daa002 == i.ItemId.ToString()) // Womdaa ↔ MesItems 关联 |
| | | ) |
| | | .Where((b, a, i) => |
| | | b.Daah009 != null && a.Daa021 != null && // 防止null异常 |
| | | ( |
| | | b.Daah009.Contains("," + a.Daa021 + ",") || // 匹配中间值 |
| | | b.Daah009.StartsWith(a.Daa021 + ",") || // 匹配开头值 |
| | | b.Daah009.EndsWith("," + a.Daa021) || // 匹配结尾值 |
| | | b.Daah009 == a.Daa021 // 完全匹配 |
| | | ) |
| | | ) |
| | | .Where((b, a, i) => |
| | | b.Daahb001 == query.hbNo && b.Fstatus == 1) // 其他条件 |
| | | .Select((b, a, i) => new |
| | | { |
| | | b.Daahb001, |
| | | a.Daa001, // 工单号 |
| | | a.CaaGuid, // Womdaa 的 GUID |
| | | i.ItemName // MesItems 的字段 |
| | | }) |
| | | .First(); |
| | | |
| | | if (queryResult?.Daahb001 == null) throw new Exception("合并单号不存在"); |
| | | |
| | |
| | | // }) |
| | | // .ToList(); |
| | | |
| | | var sql =string.Format(@"SELECT max(ahb.GUID) as hbguid, |
| | | var sql = string.Format(@"SELECT max(ahb.GUID) as hbguid, |
| | | m.item_no as itemNo, |
| | | max(m.item_name) as itemName, |
| | | max(m.item_model) as itemModel, |
| | |
| | | }) |
| | | .ToList(); |
| | | |
| | | var womcaa = Db.Queryable<Womcaa>().Where(s => s.Guid == queryResult.CaaGuid) |
| | | var womcaa = Db.Queryable<Womcaa>() |
| | | .Where(s => s.Guid == queryResult.CaaGuid) |
| | | .First(); |
| | | |
| | | if (womcaa == null) |
| | | { |
| | | throw new Exception("生产任务单不存在"); |
| | | } |
| | | if (womcaa == null) throw new Exception("生产任务单不存在"); |
| | | |
| | | var dto = new ProductionPickDto |
| | | { |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取工单条码信息 |
| | | /// 获取工单条码信息 |
| | | /// </summary> |
| | | /// <param name="query"></param> |
| | | /// <returns></returns> |
| | | public dynamic getZsBarInfo(dynamic query) |
| | | { |
| | | |
| | | var sql = string.Format(@"SELECT TOP 1 A.barCode AS zsBarcode, |
| | | D.name AS lineName, |
| | | D.line_no, |
| | |
| | | var ZsBarInfo = Db.Ado.SqlQuery<dynamic>(sql); |
| | | |
| | | if (ZsBarInfo.Count < 1) |
| | | { |
| | | throw new Exception($"该追溯码{query.Zsbarcode}不存在不存在"); |
| | | } |
| | | |
| | | return ZsBarInfo; |
| | | } |
| | |
| | | //获取生产 |
| | | public dynamic getTraceability(dynamic query) |
| | | { |
| | | var sql = string.Format(@"SELECT processNo, A.barCode, B.lineId, line_no, name AS lineName, checkResult, C.USER_NAME |
| | | var sql = string.Format( |
| | | @"SELECT processNo, A.barCode, B.lineId, line_no, name AS lineName, checkResult, C.USER_NAME |
| | | FROM WORK_COLLECT A |
| | | LEFT JOIN WORK_TRAC_CODE B ON A.barCode = B.barCode |
| | | LEFT JOIN SYS_USER C ON C.ACCOUNT = A.createBy |
| | |
| | | |
| | | public dynamic ProductBinding(dynamic query) |
| | | { |
| | | if (query == null) throw new ArgumentNullException(nameof(query), "参数对象不能为 null"); |
| | | if (query == null) |
| | | throw new ArgumentNullException(nameof(query), "参数对象不能为 null"); |
| | | |
| | | // 2. 使用 string.IsNullOrEmpty 直接判断字符串属性(避免 NullReferenceException) |
| | | if (string.IsNullOrEmpty(query.userName?.ToString())) |
| | |
| | | cmd.CommandType = CommandType.StoredProcedure; |
| | | SqlParameter[] parameters = |
| | | { |
| | | new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userName }, |
| | | new("@pi_trac_barcode", SqlDbType.NVarChar, 100) { Value = query.ZsBar }, |
| | | new("@pi_ls_barcode", SqlDbType.NVarChar, 100) { Value = query.LsBar }, |
| | | new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output }, |
| | | new("@po_outStatus", SqlDbType.Int) { Direction = ParameterDirection.Output } |
| | | new("@pi_user", SqlDbType.NVarChar, 100) |
| | | { Value = query.userName }, |
| | | new("@pi_trac_barcode", SqlDbType.NVarChar, 100) |
| | | { Value = query.ZsBar }, |
| | | new("@pi_ls_barcode", SqlDbType.NVarChar, 100) |
| | | { Value = query.LsBar }, |
| | | new("@po_outMsg", SqlDbType.NVarChar, 2000) |
| | | { Direction = ParameterDirection.Output }, |
| | | new("@po_outStatus", SqlDbType.Int) |
| | | { Direction = ParameterDirection.Output } |
| | | }; |
| | | |
| | | |
| | | foreach (var parameter in parameters) |
| | | cmd.Parameters.Add(parameter); |
| | | |
| | | |
| | | cmd.ExecuteNonQuery(); |
| | | |
| | | |
| | | _strMsg = parameters[3].Value?.ToString() ?? ""; |
| | | _intSum = parameters[4].Value?.ToString() ?? "-1"; |
| | | |
| | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取卡板信息 |
| | | /// 获取卡板信息 |
| | | /// </summary> |
| | | /// <param name="query"></param> |
| | | /// <returns></returns> |
| | |
| | | ISNULL((SELECT COUNT(1) FROM MES_INV_ITEM_BARCODES_TBMX WHERE ABOUT_TB_BARCODE = '{0}'), 0) AS YSum, |
| | | DAA001 |
| | | FROM MES_INV_ITEM_BARCODES A LEFT JOIN WOMDAA B ON A.ABOUT_GUID = B.guid |
| | | WHERE ITEM_BARCODE = '{0}' ", query.Kbbarcode); |
| | | WHERE ITEM_BARCODE = '{0}' ", query.Kbbarcode); |
| | | |
| | | var ZsBarInfo = Db.Ado.SqlQuery<dynamic>(sql); |
| | | |
| | | if (ZsBarInfo.Count < 1) |
| | | { |
| | | throw new Exception($"该卡板码{query.Zsbarcode}不存在!"); |
| | | } |
| | | |
| | | return ZsBarInfo; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取卡板明细信息 |
| | | /// 获取卡板明细信息 |
| | | /// </summary> |
| | | /// <param name="query"></param> |
| | | /// <returns></returns> |
| | | public dynamic getKbBarMxInfo(dynamic query) |
| | | { |
| | | |
| | | var sql = string.Format(@"SELECT ITEM_BARCODE, QUANTITY,item_no,item_name,item_model,weight |
| | | var sql = string.Format( |
| | | @"SELECT ITEM_BARCODE, QUANTITY,item_no,item_name,item_model,weight |
| | | FROM MES_INV_ITEM_BARCODES_TBMX A |
| | | LEFT JOIN WOMDAA B ON B.daa001 = A.DAA_001 |
| | | LEFT JOIN MES_ITEMS C ON C.item_id = B.daa002 |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取箱明细信息 |
| | | /// 获取箱明细信息 |
| | | /// </summary> |
| | | /// <param name="query"></param> |
| | | /// <returns></returns> |
| | |
| | | { |
| | | try |
| | | { |
| | | |
| | | using (var cmd = new SqlCommand("prc_pda_Xbar_binding_JY", conn, transaction)) |
| | | using (var cmd = new SqlCommand("prc_pda_Xbar_binding_JY", |
| | | conn, transaction)) |
| | | { |
| | | cmd.CommandType = CommandType.StoredProcedure; |
| | | SqlParameter[] parameters = |
| | | { |
| | | cmd.CommandType = CommandType.StoredProcedure; |
| | | SqlParameter[] parameters = |
| | | { |
| | | new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userName }, |
| | | new("@pi_kb_barcode", SqlDbType.NVarChar, 100) { Value = query.KbBar }, |
| | | new("@pi_ls_barcode", SqlDbType.NVarChar, 100) { Value = query.Xbarcode }, |
| | | new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output }, |
| | | new("@po_outStatus", SqlDbType.Int) { Direction = ParameterDirection.Output } |
| | | }; |
| | | new("@pi_user", SqlDbType.NVarChar, 100) |
| | | { Value = query.userName }, |
| | | new("@pi_kb_barcode", SqlDbType.NVarChar, 100) |
| | | { Value = query.KbBar }, |
| | | new("@pi_ls_barcode", SqlDbType.NVarChar, 100) |
| | | { Value = query.Xbarcode }, |
| | | new("@po_outMsg", SqlDbType.NVarChar, 2000) |
| | | { Direction = ParameterDirection.Output }, |
| | | new("@po_outStatus", SqlDbType.Int) |
| | | { Direction = ParameterDirection.Output } |
| | | }; |
| | | |
| | | foreach (var parameter in parameters) |
| | | cmd.Parameters.Add(parameter); |
| | | foreach (var parameter in parameters) |
| | | cmd.Parameters.Add(parameter); |
| | | |
| | | cmd.ExecuteNonQuery(); |
| | | cmd.ExecuteNonQuery(); |
| | | |
| | | var _strMsg = parameters[3].Value?.ToString() ?? ""; |
| | | var _intSum = parameters[4].Value?.ToString() ?? "-1"; |
| | | var _strMsg = parameters[3].Value?.ToString() ?? ""; |
| | | var _intSum = parameters[4].Value?.ToString() ?? "-1"; |
| | | |
| | | var result = Convert.ToInt32(_intSum); |
| | | if (result <= 0) |
| | | { |
| | | //transaction.Rollback(); |
| | | throw new Exception(_strMsg); |
| | | //return new { |
| | | // status = result, |
| | | // message = $"操作回滚:{_strMsg}", |
| | | // failedBarcode = xBar.iteM_BARCODE, |
| | | // successCount = successRecords.Count |
| | | //}; |
| | | } |
| | | var result = Convert.ToInt32(_intSum); |
| | | if (result <= 0) |
| | | //transaction.Rollback(); |
| | | throw new Exception(_strMsg); |
| | | //return new { |
| | | // status = result, |
| | | // message = $"操作回滚:{_strMsg}", |
| | | // failedBarcode = xBar.iteM_BARCODE, |
| | | // successCount = successRecords.Count |
| | | //}; |
| | | } |
| | | |
| | | } |
| | | |
| | | transaction.Commit(); // 全部成功提交事务 |
| | | } |
| | | catch (Exception ex) |
| | |
| | | } |
| | | } |
| | | |
| | | var sql2 = string.Format(@"SELECT ITEM_BARCODE, QUANTITY,item_no,item_name,item_model,'0' as is_hedui |
| | | var sql2 = string.Format( |
| | | @"SELECT ITEM_BARCODE, QUANTITY,item_no,item_name,item_model,'0' as is_hedui |
| | | FROM MES_INV_ITEM_BARCODES_TBMX A |
| | | LEFT JOIN WOMDAA B ON B.daa001 = A.DAA_001 |
| | | LEFT JOIN MES_ITEMS C ON C.item_id = B.daa002 |
| | |
| | | var ZsBarInfo = Db.Ado.SqlQuery<dynamic>(sql2); |
| | | |
| | | if (ZsBarInfo.Count < 1) |
| | | { |
| | | throw new Exception($"该箱条码[{query.Xbarcode}]对应工单与托码工单[{query.DAA001}]不匹配或已绑定托码!"); |
| | | } |
| | | throw new Exception( |
| | | $"该箱条码[{query.Xbarcode}]对应工单与托码工单[{query.DAA001}]不匹配或已绑定托码!"); |
| | | |
| | | return ZsBarInfo; |
| | | } |
| | | |
| | | public dynamic submitAllChecked(dynamic query) |
| | | { |
| | | if (query == null) throw new ArgumentNullException(nameof(query), "参数对象不能为 null"); |
| | | if (query == null) |
| | | throw new ArgumentNullException(nameof(query), "参数对象不能为 null"); |
| | | |
| | | // 参数校验强化 |
| | | if (string.IsNullOrEmpty(query.userName?.ToString())) |
| | | throw new ArgumentException("用户名不允许为空", nameof(query.userName)); |
| | | |
| | | |
| | | if (string.IsNullOrEmpty(query.KbBar?.ToString())) |
| | | throw new ArgumentException("卡板条码不允许为空", nameof(query.KbBar)); |
| | | |
| | | if (query.XbarInfo == null || !((IEnumerable<dynamic>)query.XbarInfo).GetEnumerator().MoveNext()) |
| | | |
| | | if (query.XbarInfo == null || !((IEnumerable<dynamic>)query.XbarInfo) |
| | | .GetEnumerator().MoveNext()) |
| | | throw new ArgumentException("箱码列表不能为空", nameof(query.XbarInfo)); |
| | | |
| | | var successRecords = new List<dynamic>(); |
| | |
| | | try |
| | | { |
| | | foreach (var xBar in query.XbarInfo) // 遍历箱码集合 |
| | | { |
| | | using (var cmd = new SqlCommand("prc_pda_Xbar_binding", conn, transaction)) |
| | | using (var cmd = new SqlCommand("prc_pda_Xbar_binding", |
| | | conn, transaction)) |
| | | { |
| | | cmd.CommandType = CommandType.StoredProcedure; |
| | | SqlParameter[] parameters = |
| | | SqlParameter[] parameters = |
| | | { |
| | | new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userName }, |
| | | new("@pi_kb_barcode", SqlDbType.NVarChar, 100) { Value = query.KbBar }, |
| | | new("@pi_ls_barcode", SqlDbType.NVarChar, 100) { Value = xBar.iteM_BARCODE }, |
| | | new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output }, |
| | | new("@po_outStatus", SqlDbType.Int) { Direction = ParameterDirection.Output } |
| | | new("@pi_user", SqlDbType.NVarChar, 100) |
| | | { Value = query.userName }, |
| | | new("@pi_kb_barcode", SqlDbType.NVarChar, 100) |
| | | { Value = query.KbBar }, |
| | | new("@pi_ls_barcode", SqlDbType.NVarChar, 100) |
| | | { Value = xBar.iteM_BARCODE }, |
| | | new("@po_outMsg", SqlDbType.NVarChar, 2000) |
| | | { Direction = ParameterDirection.Output }, |
| | | new("@po_outStatus", SqlDbType.Int) |
| | | { Direction = ParameterDirection.Output } |
| | | }; |
| | | |
| | | |
| | | foreach (var parameter in parameters) |
| | | cmd.Parameters.Add(parameter); |
| | | |
| | | |
| | | cmd.ExecuteNonQuery(); |
| | | |
| | | |
| | | var _strMsg = parameters[3].Value?.ToString() ?? ""; |
| | | var _intSum = parameters[4].Value?.ToString() ?? "-1"; |
| | | |
| | | var _intSum = parameters[4].Value?.ToString() ?? |
| | | "-1"; |
| | | |
| | | var result = Convert.ToInt32(_intSum); |
| | | if (result <= 0) |
| | | { |
| | | //transaction.Rollback(); |
| | | throw new Exception(_strMsg); |
| | | //return new { |
| | | // status = result, |
| | | // message = $"操作回滚:{_strMsg}", |
| | | // failedBarcode = xBar.iteM_BARCODE, |
| | | // successCount = successRecords.Count |
| | | //}; |
| | | } |
| | | |
| | | successRecords.Add(new { |
| | | //return new { |
| | | // status = result, |
| | | // message = $"操作回滚:{_strMsg}", |
| | | // failedBarcode = xBar.iteM_BARCODE, |
| | | // successCount = successRecords.Count |
| | | //}; |
| | | successRecords.Add(new |
| | | { |
| | | kbBarcode = query.KbBar, |
| | | xBarcode = xBar.iteM_BARCODE, |
| | | processTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") |
| | | processTime = |
| | | DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") |
| | | }); |
| | | } |
| | | } |
| | | |
| | | transaction.Commit(); // 全部成功提交事务 |
| | | return new { |
| | | status = 1, |
| | | return new |
| | | { |
| | | status = 1, |
| | | message = "批量绑定成功", |
| | | successCount = successRecords.Count, |
| | | details = successRecords |
| | | details = successRecords |
| | | }; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | |
| | | public dynamic SubmitKbInspection(dynamic query) |
| | | { |
| | | if (query == null) throw new ArgumentNullException(nameof(query), "参数对象不能为 null"); |
| | | if (query == null) |
| | | throw new ArgumentNullException(nameof(query), "参数对象不能为 null"); |
| | | |
| | | // 参数校验 |
| | | if (string.IsNullOrEmpty(query.userAccount?.ToString())) |
| | | throw new ArgumentException("用户名不允许为空", nameof(query.userAccount)); |
| | | |
| | | |
| | | if (string.IsNullOrEmpty(query.KbBar?.ToString())) |
| | | throw new ArgumentException("卡板条码不允许为空", nameof(query.KbBar)); |
| | | |
| | | |
| | | var _strMsg = ""; |
| | | var _status = -1; |
| | | using (var conn = new SqlConnection(DbHelperSQL.strConn)) |
| | | { |
| | | using (var cmd = new SqlCommand("prc_pda_KBbar_submitInspection", conn)) |
| | | using (var cmd = |
| | | new SqlCommand("prc_pda_KBbar_submitInspection", conn)) |
| | | { |
| | | try |
| | | { |
| | | conn.Open(); |
| | | cmd.CommandType = CommandType.StoredProcedure; |
| | | SqlParameter[] parameters = |
| | | SqlParameter[] parameters = |
| | | { |
| | | new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userAccount }, |
| | | new("@pi_kb_barcode", SqlDbType.NVarChar, 100) { Value = query.KbBar }, |
| | | new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output }, |
| | | new("@po_outStatus", SqlDbType.Int) { Direction = ParameterDirection.Output } |
| | | new("@pi_user", SqlDbType.NVarChar, 100) |
| | | { Value = query.userAccount }, |
| | | new("@pi_kb_barcode", SqlDbType.NVarChar, 100) |
| | | { Value = query.KbBar }, |
| | | new("@po_outMsg", SqlDbType.NVarChar, 2000) |
| | | { Direction = ParameterDirection.Output }, |
| | | new("@po_outStatus", SqlDbType.Int) |
| | | { Direction = ParameterDirection.Output } |
| | | }; |
| | | |
| | | |
| | | foreach (var parameter in parameters) |
| | | cmd.Parameters.Add(parameter); |
| | | |
| | | |
| | | cmd.ExecuteNonQuery(); |
| | | |
| | | |
| | | _strMsg = parameters[2].Value?.ToString() ?? ""; |
| | | _status = Convert.ToInt32(parameters[3].Value ?? -1); |
| | | |
| | | |
| | | if (_status <= 0) throw new Exception(_strMsg); |
| | | |
| | | return new { |
| | | |
| | | return new |
| | | { |
| | | message = _strMsg, |
| | | status = _status, |
| | | kbBarcode = query.KbBar |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | //根据工单号返回产品型号和待领物料 |
| | | public XcslResultDto GetItemsXcsl(WarehouseQuery query) |
| | | { |
| | |
| | | new JoinQueryInfos(JoinType.Left, |
| | | a.Daa002 == i.ItemId.ToString())) |
| | | .Where((a, i) => a.Daa001 == query.daa001 |
| | | && a.Fstatus == 1) |
| | | && a.Fstatus == 1) |
| | | .Select((a, i) => new |
| | | { |
| | | a.Daa001, |
| | |
| | | if (womdaa?.Daa001 == null) throw new Exception("工单号不存在"); |
| | | |
| | | // 使用参数化查询防止SQL注入 |
| | | var sqlParams = new List<SugarParameter> { new("@daa001", query.daa001) }; |
| | | var sqlParams = new List<SugarParameter> |
| | | { new("@daa001", query.daa001) }; |
| | | |
| | | var sql1 = @"SELECT A.item_out_no, |
| | | SUM(B.QUANTITY) AS BL_Num, |
| | |
| | | |
| | | var XcslItem = Db.Ado.SqlQuery<dynamic>(sql1, sqlParams); |
| | | |
| | | var sql2 = @"SELECT B.ITEM_BARCODE ,B.QUANTITY,C.item_no,C.item_name,D.USER_NAME,A.create_date |
| | | var sql2 = |
| | | @"SELECT B.ITEM_BARCODE ,B.QUANTITY,C.item_no,C.item_name,D.USER_NAME,A.create_date |
| | | FROM MES_INV_ITEM_OUTS A |
| | | LEFT JOIN MES_INV_ITEM_OUT_C_DETAILS B ON A.GUID = B.ITEM_OUT_ID |
| | | LEFT JOIN MES_ITEMS C ON B.ITEM_ID = C.item_id |
| | |
| | | |
| | | var XcslWjsBar = Db.Ado.SqlQuery<dynamic>(sql2, sqlParams); |
| | | |
| | | var sql3 = @"SELECT B.ITEM_BARCODE ,B.QUANTITY,C.item_no,C.item_name,D.USER_NAME,B.XCSL_CREATE_DATE |
| | | var sql3 = |
| | | @"SELECT B.ITEM_BARCODE ,B.QUANTITY,C.item_no,C.item_name,D.USER_NAME,B.XCSL_CREATE_DATE |
| | | FROM MES_INV_ITEM_OUTS A |
| | | LEFT JOIN MES_INV_ITEM_OUT_C_DETAILS B ON A.GUID = B.ITEM_OUT_ID |
| | | LEFT JOIN MES_ITEMS C ON B.ITEM_ID = C.item_id |
| | |
| | | XcslItemList = XcslItem, |
| | | XcslWjsBarList = XcslWjsBar, |
| | | XcslYjsBarList = XcslYjsBar |
| | | |
| | | }; |
| | | |
| | | return dto; |
| | | } |
| | | |
| | | // 现场收料展示列表 |
| | | public class XcslResultDto |
| | | { |
| | | public int? GD_Num { get; set; } |
| | | public string? workNo { get; set; } |
| | | public List<dynamic> XcslItemList { get; set; } |
| | | public List<dynamic> XcslWjsBarList { get; set; } |
| | | public List<dynamic> XcslYjsBarList { get; set; } |
| | | } |
| | | |
| | | |
| | | public dynamic ScanXcsl(dynamic query) |
| | | { |
| | | if (query == null) throw new ArgumentNullException(nameof(query), "参数对象不能为 null"); |
| | | if (query == null) |
| | | throw new ArgumentNullException(nameof(query), "参数对象不能为 null"); |
| | | |
| | | // 参数校验(根据存储过程新增参数) |
| | | if (string.IsNullOrEmpty(query.userAccount?.ToString())) |
| | |
| | | // 根据存储过程调整参数顺序和命名 |
| | | SqlParameter[] parameters = |
| | | { |
| | | new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userAccount }, |
| | | new("@pi_barcode", SqlDbType.NVarChar, 100) { Value = query.Bar }, |
| | | new("@pi_daa001", SqlDbType.NVarChar, 100) { Value = query.DAA001 }, |
| | | new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output }, |
| | | new("@po_outStatus", SqlDbType.Int) { Direction = ParameterDirection.Output } |
| | | new("@pi_user", SqlDbType.NVarChar, 100) |
| | | { Value = query.userAccount }, |
| | | new("@pi_barcode", SqlDbType.NVarChar, 100) |
| | | { Value = query.Bar }, |
| | | new("@pi_daa001", SqlDbType.NVarChar, 100) |
| | | { Value = query.DAA001 }, |
| | | new("@po_outMsg", SqlDbType.NVarChar, 2000) |
| | | { Direction = ParameterDirection.Output }, |
| | | new("@po_outStatus", SqlDbType.Int) |
| | | { Direction = ParameterDirection.Output } |
| | | }; |
| | | |
| | | foreach (var parameter in parameters) |
| | |
| | | |
| | | public dynamic GetWeightByXt(dynamic query) |
| | | { |
| | | if (query == null) throw new ArgumentNullException(nameof(query), "参数对象不能为null"); |
| | | if (query == null) |
| | | throw new ArgumentNullException(nameof(query), "参数对象不能为null"); |
| | | |
| | | // 参数校验 |
| | | if (string.IsNullOrEmpty(query.userName?.ToString())) |
| | |
| | | var _strMsg = ""; |
| | | var _status = -1; |
| | | var _weight = "0"; |
| | | |
| | | |
| | | using (var conn = new SqlConnection(DbHelperSQL.strConn)) |
| | | { |
| | | using (var cmd = new SqlCommand("prc_pda_Xbar_chenzhong", conn)) |
| | |
| | | conn.Open(); |
| | | cmd.CommandType = CommandType.StoredProcedure; |
| | | |
| | | SqlParameter[] parameters = |
| | | SqlParameter[] parameters = |
| | | { |
| | | new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userName }, |
| | | new("@pi_ls_barcode", SqlDbType.NVarChar, 100) { Value = query.LsBar }, |
| | | new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output }, |
| | | new("@po_outStatus", SqlDbType.Int) { Direction = ParameterDirection.Output }, |
| | | new("@po_outWeight", SqlDbType.NVarChar, 100) { Direction = ParameterDirection.Output } |
| | | new("@pi_user", SqlDbType.NVarChar, 100) |
| | | { Value = query.userName }, |
| | | new("@pi_ls_barcode", SqlDbType.NVarChar, 100) |
| | | { Value = query.LsBar }, |
| | | new("@po_outMsg", SqlDbType.NVarChar, 2000) |
| | | { Direction = ParameterDirection.Output }, |
| | | new("@po_outStatus", SqlDbType.Int) |
| | | { Direction = ParameterDirection.Output }, |
| | | new("@po_outWeight", SqlDbType.NVarChar, 100) |
| | | { Direction = ParameterDirection.Output } |
| | | }; |
| | | |
| | | cmd.Parameters.AddRange(parameters); |
| | |
| | | |
| | | if (_status <= 0) throw new Exception(_strMsg); |
| | | |
| | | return new |
| | | return new |
| | | { |
| | | message = _strMsg, |
| | | status = _status, |
| | |
| | | |
| | | public dynamic GetXcslDaa(dynamic unity) |
| | | { |
| | | |
| | | var sqlParams = new List<SugarParameter> { }; |
| | | var sqlParams = new List<SugarParameter>(); |
| | | |
| | | var sql2 = new StringBuilder(@" |
| | | SELECT daahb001 as daaInfo,daahb001 as daa001 |
| | |
| | | |
| | | var XcslItem = Db.Ado.SqlQuery<dynamic>(sql2.ToString(), sqlParams); |
| | | |
| | | if (XcslItem == null) |
| | | { |
| | | throw new Exception("该条件下无对应工单信息,请重新输入!"); |
| | | } |
| | | if (XcslItem == null) throw new Exception("该条件下无对应工单信息,请重新输入!"); |
| | | |
| | | return XcslItem; |
| | | } |
| | |
| | | new JoinQueryInfos(JoinType.Left, |
| | | a.Daa002 == i.ItemId.ToString())) |
| | | .Where((a, i) => a.Daa001 == query.daa001 |
| | | && a.Fstatus == 1) |
| | | && a.Fstatus == 1) |
| | | .Select((a, i) => new |
| | | { |
| | | a.Daa001, |
| | |
| | | if (womdaa?.Daa001 == null) throw new Exception("工单号不存在"); |
| | | |
| | | // 使用参数化查询防止SQL注入 |
| | | var sqlParams = new List<SugarParameter> { new("@daa001", query.daa001) }; |
| | | var sqlParams = new List<SugarParameter> |
| | | { new("@daa001", query.daa001) }; |
| | | |
| | | var sql1 = @"SELECT A.item_out_no, |
| | | SUM(B.QUANTITY) AS BL_Num, |
| | |
| | | |
| | | var XcslItem = Db.Ado.SqlQuery<dynamic>(sql1, sqlParams); |
| | | |
| | | var sql2 = @"SELECT B.ITEM_BARCODE ,B.QUANTITY,C.item_no,C.item_name,D.USER_NAME,A.create_date |
| | | var sql2 = |
| | | @"SELECT B.ITEM_BARCODE ,B.QUANTITY,C.item_no,C.item_name,D.USER_NAME,A.create_date |
| | | FROM MES_INV_ITEM_OUTS A |
| | | LEFT JOIN MES_INV_ITEM_OUT_C_DETAILS B ON A.GUID = B.ITEM_OUT_ID |
| | | LEFT JOIN MES_ITEMS C ON B.ITEM_ID = C.item_id |
| | |
| | | |
| | | var XcslWjsBar = Db.Ado.SqlQuery<dynamic>(sql2, sqlParams); |
| | | |
| | | var sql3 = @"SELECT B.ITEM_BARCODE ,B.QUANTITY,C.item_no,C.item_name,D.USER_NAME,B.CXTR_CREATE_DATE |
| | | var sql3 = |
| | | @"SELECT B.ITEM_BARCODE ,B.QUANTITY,C.item_no,C.item_name,D.USER_NAME,B.CXTR_CREATE_DATE |
| | | FROM MES_INV_ITEM_OUTS A |
| | | LEFT JOIN MES_INV_ITEM_OUT_C_DETAILS B ON A.GUID = B.ITEM_OUT_ID |
| | | LEFT JOIN MES_ITEMS C ON B.ITEM_ID = C.item_id |
| | |
| | | XcslItemList = XcslItem, |
| | | XcslWjsBarList = XcslWjsBar, |
| | | XcslYjsBarList = XcslYjsBar |
| | | |
| | | }; |
| | | |
| | | return dto; |
| | |
| | | |
| | | public dynamic ScanXctl(dynamic query) |
| | | { |
| | | if (query == null) throw new ArgumentNullException(nameof(query), "参数对象不能为 null"); |
| | | if (query == null) |
| | | throw new ArgumentNullException(nameof(query), "参数对象不能为 null"); |
| | | |
| | | // 参数校验(根据存储过程新增参数) |
| | | if (string.IsNullOrEmpty(query.userAccount?.ToString())) |
| | |
| | | // 根据存储过程调整参数顺序和命名 |
| | | SqlParameter[] parameters = |
| | | { |
| | | new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userAccount }, |
| | | new("@pi_barcode", SqlDbType.NVarChar, 100) { Value = query.Bar }, |
| | | new("@pi_daa001", SqlDbType.NVarChar, 100) { Value = query.DAA001 }, |
| | | new("@po_outMsg", SqlDbType.NVarChar, 2000) { Direction = ParameterDirection.Output }, |
| | | new("@po_outStatus", SqlDbType.Int) { Direction = ParameterDirection.Output } |
| | | new("@pi_user", SqlDbType.NVarChar, 100) |
| | | { Value = query.userAccount }, |
| | | new("@pi_barcode", SqlDbType.NVarChar, 100) |
| | | { Value = query.Bar }, |
| | | new("@pi_daa001", SqlDbType.NVarChar, 100) |
| | | { Value = query.DAA001 }, |
| | | new("@po_outMsg", SqlDbType.NVarChar, 2000) |
| | | { Direction = ParameterDirection.Output }, |
| | | new("@po_outStatus", SqlDbType.Int) |
| | | { Direction = ParameterDirection.Output } |
| | | }; |
| | | |
| | | foreach (var parameter in parameters) |
| | |
| | | } |
| | | } |
| | | |
| | | // 现场收料展示列表 |
| | | public class XcslResultDto |
| | | { |
| | | public int? GD_Num { get; set; } |
| | | public string? workNo { get; set; } |
| | | public List<dynamic> XcslItemList { get; set; } |
| | | public List<dynamic> XcslWjsBarList { get; set; } |
| | | public List<dynamic> XcslYjsBarList { get; set; } |
| | | } |
| | | } |