| | |
| | | // }) |
| | | // .ToList(); |
| | | |
| | | var sql =string.Format(@"SELECT c.item_no ItemNo,c.item_name ItemName,c.item_model ItemModel,b.dab006 FQty,b.dab007 SQty,b.dab006 - b.dab007 DSQty , |
| | | var sql =string.Format(@"SELECT c.item_no ItemNo,c.item_name ItemName,c.item_model ItemModel,b.dab006 FQty,b.dab007 SQty,b.dab006 - b.dab007 DSQty ,C.item_id FMaterialId , |
| | | dbo.F_QX_GETRECODEPOTSE(B.dab003,'','','') as RecoKw |
| | | FROM WOMDAB B |
| | | LEFT JOIN WOMDAA A ON A.guid = B.daaGuid |
| | |
| | | /// <returns></returns> |
| | | public dynamic getZsBarInfo(dynamic query) |
| | | { |
| | | if (query == null) |
| | | throw new ArgumentNullException(nameof(query), "参数对象不能为null"); |
| | | |
| | | var sql = string.Format(@"SELECT TOP 1 A.barCode AS zsBarcode, |
| | | D.name AS lineName, |
| | | D.line_no, |
| | | B.daa001, |
| | | C.item_no, |
| | | C.item_name, |
| | | C.item_model, |
| | | A.quantity as barQty, |
| | | B.daa008 as sumQty, |
| | | isnull((SELECT count(1) FROM WORK_COLLECT WHERE processNo = '{0}' AND ABOUT_GUID = A.ABOUT_GUID),0) AS finQty, |
| | | isnull((SELECT TOP 1 processNo FROM WORK_COLLECT WHERE WORK_COLLECT.barCode = '{1}' AND checkResult = '√' ORDER BY WORK_COLLECT.createDate DESC ),'') AS lastGx |
| | | FROM WORK_TRAC_CODE A |
| | | LEFT JOIN WOMDAA B ON A.ABOUT_GUID = B.guid |
| | | LEFT JOIN MES_ITEMS C ON B.daa002 = C.item_id |
| | | LEFT JOIN MES_WORKSHOP_LINE D ON A.lineId = D.id |
| | | WHERE A.barCode = '{1}'", query.GX, query.Zsbarcode); |
| | | if (string.IsNullOrEmpty(query.Zsbarcode?.ToString())) |
| | | throw new ArgumentException("追溯码不能为空", nameof(query.Zsbarcode)); |
| | | |
| | | var ZsBarInfo = Db.Ado.SqlQuery<dynamic>(sql); |
| | | if (string.IsNullOrEmpty(query.GX?.ToString())) |
| | | throw new ArgumentException("工序不能为空", nameof(query.GX)); |
| | | |
| | | if (ZsBarInfo.Count < 1) |
| | | var parameters = new[] |
| | | { |
| | | new SugarParameter("@pi_trac_barcode", query.Zsbarcode), |
| | | new SugarParameter("@pi_gx", query.GX), |
| | | new SugarParameter("@inP1", null), |
| | | new SugarParameter("@inP2", null), |
| | | new SugarParameter("@inP3", null), |
| | | new SugarParameter("@inP4", null) |
| | | }; |
| | | |
| | | try |
| | | { |
| | | throw new Exception($"该追溯码{query.Zsbarcode}不存在不存在"); |
| | | } |
| | | var ZsBarInfo = Db.Ado.SqlQuery<dynamic>("EXEC prc_pda_scll_selZsBarInfo @pi_trac_barcode,@pi_gx,@inP1,@inP2,@inP3,@inP4", parameters); |
| | | |
| | | return ZsBarInfo; |
| | | if (ZsBarInfo.Count < 1) |
| | | { |
| | | throw new Exception($"该追溯码{query.Zsbarcode}不存在或已绑定"); |
| | | } |
| | | |
| | | return ZsBarInfo; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | // 保留原有异常处理逻辑 |
| | | throw new Exception($"{ex.Message}"); |
| | | } |
| | | } |
| | | |
| | | //获取生产 |
| | |
| | | |
| | | return Traceability; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取物料相关条码信息 |
| | | /// </summary> |
| | | /// <param name="unity"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="Exception"></exception> |
| | | public dynamic GetBarKwByItem(dynamic unity) |
| | | { |
| | | if (unity == null) |
| | | throw new ArgumentNullException(nameof(unity), "参数对象不能为null"); |
| | | |
| | | if (string.IsNullOrEmpty(unity.itemId?.ToString())) |
| | | throw new ArgumentException("物料ID不能为空", nameof(unity.itemId)); |
| | | |
| | | try |
| | | { |
| | | var parameters = new List<SugarParameter> |
| | | { |
| | | new SugarParameter("@itemId", unity.itemId) |
| | | }; |
| | | |
| | | return Db.Ado.SqlQuery<dynamic>("EXEC prc_pda_scll_selBarMx @itemId", parameters); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | throw new Exception($"获取条码信息失败:{ex.Message}"); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | public dynamic ProductBinding(dynamic query) |
| | | { |
| | |
| | | return XtItem; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// AGV送检 |
| | | /// </summary> |
| | | /// <param name="query"></param> |
| | | /// <returns></returns> |
| | | /// <exception cref="ArgumentNullException"></exception> |
| | | /// <exception cref="ArgumentException"></exception> |
| | | /// <exception cref="Exception"></exception> |
| | | public dynamic HandleAGVInspection(dynamic query) |
| | | { |
| | | if (query == null) throw new ArgumentNullException(nameof(query)); |
| | | |
| | | if (string.IsNullOrEmpty(query.userAccount?.ToString())) |
| | | throw new ArgumentException("用户账号不能为空", nameof(query.userAccount)); |
| | | |
| | | if (string.IsNullOrEmpty(query.KbBar?.ToString())) |
| | | throw new ArgumentException("卡板条码不能为空", nameof(query.KbBar)); |
| | | |
| | | using (var conn = new SqlConnection(DbHelperSQL.strConn)) |
| | | { |
| | | using (var cmd = new SqlCommand("prc_pda_AgvSj", conn)) |
| | | { |
| | | cmd.CommandType = CommandType.StoredProcedure; |
| | | var parameters = new SqlParameter[] |
| | | { |
| | | new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userAccount }, |
| | | new("@pi_kb_barcode", SqlDbType.NVarChar, 100) { Value = query.KbBar }, |
| | | new("@outMsg", SqlDbType.NVarChar, 2500) { Direction = ParameterDirection.Output }, |
| | | new("@outSum", SqlDbType.Int) { Direction = ParameterDirection.Output } |
| | | }; |
| | | |
| | | cmd.Parameters.AddRange(parameters); |
| | | conn.Open(); |
| | | cmd.ExecuteNonQuery(); |
| | | |
| | | var result = new |
| | | { |
| | | message = parameters[2].Value?.ToString(), |
| | | status = Convert.ToInt32(parameters[3].Value) |
| | | }; |
| | | |
| | | if (result.status <= 0) |
| | | throw new Exception(result.message); |
| | | |
| | | return result; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public dynamic HandleAGVCall(dynamic query) |
| | | { |
| | | if (query == null) throw new ArgumentNullException(nameof(query)); |
| | | |
| | | if (string.IsNullOrEmpty(query.userAccount?.ToString())) |
| | | throw new ArgumentException("用户账号不能为空", nameof(query.userAccount)); |
| | | |
| | | if (string.IsNullOrEmpty(query.XtNum?.ToString())) |
| | | throw new ArgumentException("线体编号不能为空", nameof(query.XtNum)); |
| | | |
| | | using (var conn = new SqlConnection(DbHelperSQL.strConn)) |
| | | { |
| | | using (var cmd = new SqlCommand("prc_pda_AgvHj", conn)) |
| | | { |
| | | cmd.CommandType = CommandType.StoredProcedure; |
| | | var parameters = new SqlParameter[] |
| | | { |
| | | new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userAccount }, |
| | | new("@pi_xtNum", SqlDbType.NVarChar, 100) { Value = query.XtNum }, |
| | | new("@outMsg", SqlDbType.NVarChar, 2500) { Direction = ParameterDirection.Output }, |
| | | new("@outSum", SqlDbType.Int) { Direction = ParameterDirection.Output } |
| | | }; |
| | | |
| | | cmd.Parameters.AddRange(parameters); |
| | | conn.Open(); |
| | | cmd.ExecuteNonQuery(); |
| | | |
| | | var result = new |
| | | { |
| | | message = parameters[2].Value?.ToString(), |
| | | status = Convert.ToInt32(parameters[3].Value) |
| | | }; |
| | | |
| | | if (result.status <= 0) |
| | | throw new Exception(result.message); |
| | | |
| | | return result; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | public dynamic HandleAgvJy(dynamic query) |
| | | { |
| | | if (query == null) throw new ArgumentNullException(nameof(query)); |
| | | |
| | | // 参数验证强化 |
| | | if (string.IsNullOrEmpty(query.userAccount?.ToString())) |
| | | throw new ArgumentException("用户名不允许为空", nameof(query.userAccount)); |
| | | |
| | | if (string.IsNullOrEmpty(query.KbBar?.ToString())) |
| | | throw new ArgumentException("卡板条码不允许为空", nameof(query.KbBar)); |
| | | |
| | | if (string.IsNullOrEmpty(query.jyz?.ToString())) |
| | | throw new ArgumentException("检验结果不允许为空", nameof(query.jyz)); |
| | | |
| | | var _strMsg = ""; |
| | | var _intSum = ""; |
| | | |
| | | using (var conn = new SqlConnection(DbHelperSQL.strConn)) |
| | | { |
| | | using (var cmd = new SqlCommand("prc_pda_AgvJy", conn)) |
| | | { |
| | | cmd.CommandType = CommandType.StoredProcedure; |
| | | |
| | | // 添加存储过程参数 |
| | | SqlParameter[] parameters = |
| | | { |
| | | new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userAccount }, |
| | | new("@pi_kbBarcode", SqlDbType.NVarChar, 100) { Value = query.KbBar }, |
| | | new("@pi_jyz", SqlDbType.NVarChar, 100) { Value = query.jyz }, |
| | | new("@outMsg", SqlDbType.NVarChar, 2500) { Direction = ParameterDirection.Output }, |
| | | new("@outSum", SqlDbType.Int) { Direction = ParameterDirection.Output } |
| | | }; |
| | | |
| | | foreach (var parameter in parameters) |
| | | cmd.Parameters.Add(parameter); |
| | | |
| | | conn.Open(); |
| | | cmd.ExecuteNonQuery(); |
| | | |
| | | _strMsg = parameters[3].Value?.ToString() ?? ""; |
| | | _intSum = parameters[4].Value?.ToString() ?? "-1"; |
| | | |
| | | var result = Convert.ToInt32(_intSum); |
| | | if (result <= 0) throw new Exception(_strMsg); |
| | | |
| | | return new |
| | | { |
| | | message = _strMsg, |
| | | status = result, |
| | | kbBarcode = query.KbBar |
| | | }; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public dynamic HandleAgvRk(dynamic query) |
| | | { |
| | | if (query == null) throw new ArgumentNullException(nameof(query)); |
| | | |
| | | if (string.IsNullOrEmpty(query.userAccount?.ToString())) |
| | | throw new ArgumentException("用户账号不能为空", nameof(query.userAccount)); |
| | | |
| | | if (string.IsNullOrEmpty(query.KbBar?.ToString())) |
| | | throw new ArgumentException("卡板条码不能为空", nameof(query.KbBar)); |
| | | |
| | | if (string.IsNullOrEmpty(query.Postition?.ToString())) |
| | | throw new ArgumentException("楼层位置不能为空", nameof(query.Postition)); |
| | | |
| | | using (var conn = new SqlConnection(DbHelperSQL.strConn)) |
| | | { |
| | | using (var cmd = new SqlCommand("prc_pda_AgvRk", conn)) |
| | | { |
| | | cmd.CommandType = CommandType.StoredProcedure; |
| | | var parameters = new SqlParameter[] |
| | | { |
| | | new("@pi_user", SqlDbType.NVarChar, 100) { Value = query.userAccount }, |
| | | new("@pi_kb_barcode", SqlDbType.NVarChar, 100) { Value = query.KbBar }, |
| | | new("@pi_kb_Postition", SqlDbType.NVarChar, 100) { Value = query.Postition }, |
| | | new("@outMsg", SqlDbType.NVarChar, 2500) { Direction = ParameterDirection.Output }, |
| | | new("@outSum", SqlDbType.Int) { Direction = ParameterDirection.Output } |
| | | }; |
| | | |
| | | cmd.Parameters.AddRange(parameters); |
| | | conn.Open(); |
| | | cmd.ExecuteNonQuery(); |
| | | |
| | | var result = new |
| | | { |
| | | message = parameters[3].Value?.ToString(), |
| | | status = Convert.ToInt32(parameters[4].Value) |
| | | }; |
| | | |
| | | if (result.status <= 0) |
| | | throw new Exception(result.message); |
| | | |
| | | return result; |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |