1
yusijie
2025-04-07 175c63b06390015e40148dbd8b6065ebff737898
WebAPI/Controllers/CJGL/Sc_KeyElementBindingController.cs
@@ -554,5 +554,67 @@
        }
        #endregion
        [Route("Sc_KeyElementBinding/UpdatePartsCode")]
        [HttpGet]
        /// <summary>
        /// 替换配件码绑定
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        public object UpdatePartsCode(string HInterID, string HEntryID, string HPartsCode,string HPartsOld,string HOrgID,string user)
        {
            try
            {
                if (HInterID == null || HInterID == "" || HInterID == "undefined" || HEntryID == null || HEntryID == "" || HEntryID == "undefined")
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "操作失败!主内码或子内码为空";
                    objJsonResult.data = 1;
                    return objJsonResult;
                }
                string sql = "exec h_p_Sc_KeyElementBinding_Change '" + HInterID + "','" + HEntryID + "','" + HPartsCode + "','" + HPartsOld + "','" + HOrgID + "','" + user + "'";
                ds = oCN.RunProcReturn(sql, "h_p_Sc_KeyElementBinding_Replace");
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    if (ClsPub.isLong(ds.Tables[0].Rows[0]["HBack"]) != 0)
                    {
                        objJsonResult.code = "0";
                        objJsonResult.count = 0;
                        objJsonResult.Message = ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = "";
                        return objJsonResult;
                    }
                    else
                    {
                        objJsonResult.code = "1";
                        objJsonResult.count = 1;
                        objJsonResult.Message = ClsPub.isStrNull(ds.Tables[0].Rows[0]["HBackRemark"]);
                        objJsonResult.data = ds.Tables[0];
                        return objJsonResult;
                    }
                }
                else
                {
                    objJsonResult.code = "0";
                    objJsonResult.count = 0;
                    objJsonResult.Message = "";
                    objJsonResult.data = "没有返回数据:" + sql;
                    return objJsonResult;
                }
            }
            catch (Exception e)
            {
                objJsonResult.code = "0";
                objJsonResult.count = 0;
                objJsonResult.Message = "失败!" + e.ToString();
                objJsonResult.data = null;
                return objJsonResult;
            }
        }
    }
}